aboutsummaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2016-07-06 02:53:19 -0400
committerKees Cook <keescook@chromium.org>2016-07-07 13:58:03 -0400
commitf6041c1d8a0825e41219a0443d365318d238d7b3 (patch)
treea46722209d07b7de7111ac77c384e3738b36771a /samples
parentd011a4d861ce583466a8ae72a0c8e7f51c8cba4e (diff)
samples/seccomp: Add standalone config option
Add a separate Kconfig option for SAMPLES_SECCOMP. Main reason for this is that, just like other samples, it's forced to be a module. Without this, since the sample is a target only controlled by CONFIG_SECCOMP_FILTER, the samples will be built before include files are put in place properly. For example, from an arm64 allmodconfig built with "make -sk -j 32" (without specific target), the following happens: samples/seccomp/bpf-fancy.c:13:27: fatal error: linux/seccomp.h: No such file or directory samples/seccomp/bpf-helper.h:20:50: fatal error: linux/seccomp.h: No such file or directory samples/seccomp/dropper.c:20:27: fatal error: linux/seccomp.h: No such file or directory samples/seccomp/bpf-direct.c:21:27: fatal error: linux/seccomp.h: No such file or directory So, just stick to the same format as other samples. Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'samples')
-rw-r--r--samples/Kconfig7
-rw-r--r--samples/seccomp/Makefile2
2 files changed, 8 insertions, 1 deletions
diff --git a/samples/Kconfig b/samples/Kconfig
index 559a58baff6e..ccc50beaf17b 100644
--- a/samples/Kconfig
+++ b/samples/Kconfig
@@ -85,4 +85,11 @@ config SAMPLE_CONNECTOR
85 with it. 85 with it.
86 See also Documentation/connector/connector.txt 86 See also Documentation/connector/connector.txt
87 87
88config SAMPLE_SECCOMP
89 tristate "Build seccomp sample code -- loadable modules only"
90 depends on SECCOMP_FILTER && m
91 help
92 Build samples of seccomp filters using various methods of
93 BPF filter construction.
94
88endif # SAMPLES 95endif # SAMPLES
diff --git a/samples/seccomp/Makefile b/samples/seccomp/Makefile
index 1b4e4b8f5e47..ae7ff6f24f36 100644
--- a/samples/seccomp/Makefile
+++ b/samples/seccomp/Makefile
@@ -1,7 +1,7 @@
1# kbuild trick to avoid linker error. Can be omitted if a module is built. 1# kbuild trick to avoid linker error. Can be omitted if a module is built.
2obj- := dummy.o 2obj- := dummy.o
3 3
4hostprogs-$(CONFIG_SECCOMP_FILTER) := bpf-fancy dropper bpf-direct 4hostprogs-$(CONFIG_SAMPLE_SECCOMP) := bpf-fancy dropper bpf-direct
5 5
6HOSTCFLAGS_bpf-fancy.o += -I$(objtree)/usr/include 6HOSTCFLAGS_bpf-fancy.o += -I$(objtree)/usr/include
7HOSTCFLAGS_bpf-fancy.o += -idirafter $(objtree)/include 7HOSTCFLAGS_bpf-fancy.o += -idirafter $(objtree)/include