aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2015-03-26 10:58:03 +0000
committerJohn Crispin <blogic@openwrt.org>2015-03-26 10:58:03 +0000
commit2c93d1ab3dcc443739cbc68e7f3c9ac71da74ac6 (patch)
tree056f89f268b4793c1f550eff841b56d0a11c9212 /target
parent3d898d18875741016ed7cb372773a2780308f602 (diff)
downloadupstream-2c93d1ab3dcc443739cbc68e7f3c9ac71da74ac6.tar.gz
upstream-2c93d1ab3dcc443739cbc68e7f3c9ac71da74ac6.tar.bz2
upstream-2c93d1ab3dcc443739cbc68e7f3c9ac71da74ac6.zip
kernel: extend seccomp with a LOG action
Signed-off-by: John Crispin <blogic@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@45007 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r--target/linux/generic/patches-3.18/999-seccomp_log.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/target/linux/generic/patches-3.18/999-seccomp_log.patch b/target/linux/generic/patches-3.18/999-seccomp_log.patch
new file mode 100644
index 0000000000..1f90b32e93
--- /dev/null
+++ b/target/linux/generic/patches-3.18/999-seccomp_log.patch
@@ -0,0 +1,34 @@
+--- a/kernel/seccomp.c
++++ b/kernel/seccomp.c
+@@ -614,6 +614,7 @@
+ #ifdef CONFIG_SECCOMP_FILTER
+ static u32 __seccomp_phase1_filter(int this_syscall, struct seccomp_data *sd)
+ {
++ char name[sizeof(current->comm)];
+ u32 filter_ret, action;
+ int data;
+
+@@ -644,6 +645,13 @@
+ case SECCOMP_RET_TRACE:
+ return filter_ret; /* Save the rest for phase 2. */
+
++ case SECCOMP_RET_LOG:
++ get_task_comm(name, current);
++ pr_err_ratelimited("seccomp: %s [%u] tried to call non-whitelisted syscall: %d\n", name, current->pid, this_syscall);
++ syscall_set_return_value(current, task_pt_regs(current),
++ -data, 0);
++ goto skip;
++
+ case SECCOMP_RET_ALLOW:
+ return SECCOMP_PHASE1_OK;
+
+--- a/include/uapi/linux/seccomp.h
++++ b/include/uapi/linux/seccomp.h
+@@ -28,6 +28,7 @@
+ #define SECCOMP_RET_KILL 0x00000000U /* kill the task immediately */
+ #define SECCOMP_RET_TRAP 0x00030000U /* disallow and force a SIGSYS */
+ #define SECCOMP_RET_ERRNO 0x00050000U /* returns an errno */
++#define SECCOMP_RET_LOG 0x00070000U /* allow + logline */
+ #define SECCOMP_RET_TRACE 0x7ff00000U /* pass to a tracer or disallow */
+ #define SECCOMP_RET_ALLOW 0x7fff0000U /* allow */
+