linux/scripts/selinux
Masahiro Yamada 541b57e313 selinux: do not include <linux/*.h> headers from host programs
The header, security/selinux/include/classmap.h, is included not only
from kernel space but also from host programs.

It includes <linux/capability.h> and <linux/socket.h>, which pull in
more <linux/*.h> headers. This makes the host programs less portable,
specifically causing build errors on macOS.

Those headers are included for the following purposes:

 - <linux/capability.h> for checking CAP_LAST_CAP
 - <linux/socket.h> for checking PF_MAX

These checks can be guarded by __KERNEL__ so they are skipped when
building host programs. Testing them when building the kernel should
be sufficient.

The header, security/selinux/include/initial_sid_to_string.h, includes
<linux/stddef.h> for the NULL definition, but this is not portable
either. Instead, <stddef.h> should be included for host programs.

Reported-by: Daniel Gomez <da.gomez@samsung.com>
Closes: https://lore.kernel.org/lkml/20240807-macos-build-support-v1-6-4cd1ded85694@samsung.com/
Closes: https://lore.kernel.org/lkml/20240807-macos-build-support-v1-7-4cd1ded85694@samsung.com/
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Paul Moore <paul@paul-moore.com>
2024-10-03 15:34:24 -04:00
..
genheaders selinux: do not include <linux/*.h> headers from host programs 2024-10-03 15:34:24 -04:00
mdp selinux: do not include <linux/*.h> headers from host programs 2024-10-03 15:34:24 -04:00
install_policy.sh selinux: remove runtime disable message in the install_policy.sh script 2022-09-20 14:12:25 -04:00
Makefile
README

Please see Documentation/admin-guide/LSM/SELinux.rst for information on
installing a dummy SELinux policy.