seccomp: create internal mode-setting function
authorKees Cook <keescook@chromium.org>
Wed, 21 May 2014 22:02:11 +0000 (15:02 -0700)
committerJP Abgrall <jpa@google.com>
Thu, 28 Aug 2014 01:50:03 +0000 (01:50 +0000)
In preparation for having other callers of the seccomp mode setting
logic, split the prctl entry point away from the core logic that performs
seccomp mode setting.

Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Andy Lutomirski <luto@amacapital.net>
kernel/seccomp.c

index 260ff1fce63dbaf792e39ffe49235afc19fcf3a4..bf1cd927707f8bfdccb7eca6e0c5585f7b96d229 100644 (file)
@@ -483,7 +483,7 @@ long prctl_get_seccomp(void)
 }
 
 /**
- * prctl_set_seccomp: configures current->seccomp.mode
+ * seccomp_set_mode: internal function for setting seccomp mode
  * @seccomp_mode: requested mode to use
  * @filter: optional struct sock_fprog for use with SECCOMP_MODE_FILTER
  *
@@ -496,7 +496,7 @@ long prctl_get_seccomp(void)
  *
  * Returns 0 on success or -EINVAL on failure.
  */
-long prctl_set_seccomp(unsigned long seccomp_mode, char __user *filter)
+static long seccomp_set_mode(unsigned long seccomp_mode, char __user *filter)
 {
        long ret = -EINVAL;
 
@@ -527,3 +527,15 @@ long prctl_set_seccomp(unsigned long seccomp_mode, char __user *filter)
 out:
        return ret;
 }
+
+/**
+ * prctl_set_seccomp: configures current->seccomp.mode
+ * @seccomp_mode: requested mode to use
+ * @filter: optional struct sock_fprog for use with SECCOMP_MODE_FILTER
+ *
+ * Returns 0 on success or -EINVAL on failure.
+ */
+long prctl_set_seccomp(unsigned long seccomp_mode, char __user *filter)
+{
+       return seccomp_set_mode(seccomp_mode, filter);
+}