1
0
Fork 0

selinux: use the kernel headers when building scripts/selinux

Commit 3322d0d64f ("selinux: keep SELinux in sync with new capability
definitions") added a check on the defined capabilities without
explicitly including the capability header file which caused problems
when building genheaders for users of clang/llvm.  Resolve this by
using the kernel headers when building genheaders, which is arguably
the right thing to do regardless, and explicitly including the
kernel's capability.h header file in classmap.h.  We also update the
mdp build, even though it wasn't causing an error we really should
be using the headers from the kernel we are building.

Reported-by: Nicolas Iooss <nicolas.iooss@m4x.org>
Signed-off-by: Paul Moore <paul@paul-moore.com>
hifive-unleashed-5.1
Paul Moore 2016-12-21 10:39:25 -05:00
parent 9287aed2ad
commit bfc5e3a6af
5 changed files with 16 additions and 2 deletions

View File

@ -1,4 +1,6 @@
hostprogs-y := genheaders
HOST_EXTRACFLAGS += -Isecurity/selinux/include
HOST_EXTRACFLAGS += \
-I$(srctree)/include/uapi -I$(srctree)/include \
-I$(srctree)/security/selinux/include
always := $(hostprogs-y)

View File

@ -1,3 +1,7 @@
/* NOTE: we really do want to use the kernel headers here */
#define __EXPORTED_HEADERS__
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

View File

@ -1,5 +1,7 @@
hostprogs-y := mdp
HOST_EXTRACFLAGS += -Isecurity/selinux/include
HOST_EXTRACFLAGS += \
-I$(srctree)/include/uapi -I$(srctree)/include \
-I$(srctree)/security/selinux/include
always := $(hostprogs-y)
clean-files := policy.* file_contexts

View File

@ -24,6 +24,10 @@
* Authors: Serge E. Hallyn <serue@us.ibm.com>
*/
/* NOTE: we really do want to use the kernel headers here */
#define __EXPORTED_HEADERS__
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

View File

@ -1,3 +1,5 @@
#include <linux/capability.h>
#define COMMON_FILE_SOCK_PERMS "ioctl", "read", "write", "create", \
"getattr", "setattr", "lock", "relabelfrom", "relabelto", "append"