Re: selinux: error: ‘NETLINK_ROUTE_SOCKET__NLMSG’ undeclared

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/8/25 02:45, Sebastian Andrzej Siewior wrote:
> On 2025-01-08 21:31:15 [+1100], Thiébaud Weksteen wrote:
>> Thanks for the report. This is a known issue where the generated
>> header is not cleaned properly:
>> https://lore.kernel.org/selinux/20241127-selinux-clean-v2-1-a6e528c1ff93@xxxxxxxxxxxxx/
>>
>> Could you try to remove security/selinux/av_permissions.h manually
>> from your build directory and build again?
> 
> I used a "clean" build directory for this: as in
> 
> | make O=/dev/shm/build defconfig
> | make O=/dev/shm/build security/selinux/nlmsgtab.o
> 
> and it occurred. But since you gave me the pointer, I had
> av_permissions.h in my source directory which did not pop in "git
> status" as it was ignored. Now that this is gone, it builds again.
> I have no idea who this ended up in my source tree since I build out of
> tree.
> 
> Anyway, thank you!
> 
> Sebastian

+linux-kbuild@xxxxxxxxxxxxxxx

I was seeing a similar issue. I was trying builds against
multiple ARCH settings. Based upon the prior comments I first
removed the instances of av_permissions.h from my build
directories, but still had the "undeclared" issue.  I then
noticed I had an instance of av_permissions.h in my source
directory, so I removed it, but then got:

../security/selinux/nlmsgtab.c:20:10: fatal error: 'av_permissions.h' file not found
   20 | #include "av_permissions.h"
      |          ^~~~~~~~~~~~~~~~~~
1 error generated.
make[5]: *** [../scripts/Makefile.build:194: security/selinux/nlmsgtab.o] Error 1
make[5]: Target 'security/selinux/' not remade because of errors.
make[4]: *** [../scripts/Makefile.build:440: security/selinux] Error 2

So I dug into the selinux Makefile and discovered there isn't a
specific rule to make av_permissions.h, but instead it is built
as a side-effect of creating flask.h.  So I removed all versions
of flask.h from my source and build directories, and now my
selinux build issues are gone.

Is someone going to followup on the comments in selinux/Makefile
about replacing the dependency rules?

# NOTE: There are a number of improvements that can be made to this Makefile
# once the kernel requires make v4.3 or greater; the most important feature
# lacking in older versions of make is support for grouped targets.  These
# improvements are noted inline in the Makefile below ...
...
# see the note above, replace the dependency rule with the one below:
#  $(addprefix $(obj)/,$(selinux-y)): $(addprefix $(obj)/,$(genhdrs))
$(addprefix $(obj)/,$(selinux-y)): $(obj)/flask.h
...
# see the note above, replace the $targets and 'flask.h' rule with the lines
# below:
#  targets += $(genhdrs)
#  $(addprefix $(obj)/,$(genhdrs)) &: $(obj)/genheaders FORCE
targets += flask.h
$(obj)/flask.h: $(obj)/genheaders FORCE
	$(call if_changed,genhdrs)

/jeff
/jeff





[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux