Skip to content

Commit

Permalink
selinux: use the kernel headers when building scripts/selinux
Browse files Browse the repository at this point in the history
Commit 3322d0d ("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>
  • Loading branch information
pcmoore committed Dec 21, 2016
1 parent 9287aed commit bfc5e3a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
4 changes: 3 additions & 1 deletion scripts/selinux/genheaders/Makefile
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 4 additions & 0 deletions scripts/selinux/genheaders/genheaders.c
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
4 changes: 3 additions & 1 deletion scripts/selinux/mdp/Makefile
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions scripts/selinux/mdp/mdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 2 additions & 0 deletions security/selinux/include/classmap.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <linux/capability.h>

#define COMMON_FILE_SOCK_PERMS "ioctl", "read", "write", "create", \
"getattr", "setattr", "lock", "relabelfrom", "relabelto", "append"

Expand Down

0 comments on commit bfc5e3a

Please sign in to comment.