diff options
author | Kees Cook <keescook@chromium.org> | 2014-05-21 18:02:11 -0400 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2014-07-18 15:13:36 -0400 |
commit | d78ab02c2c194257a03355fbb79eb721b381d105 (patch) | |
tree | ef515dffebcea6ec1fe1189dfc715c26ab2844f7 | |
parent | c04f9d61caa34fc83e3517e3092874c9607c19c3 (diff) |
seccomp: create internal mode-setting function
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>
-rw-r--r-- | kernel/seccomp.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/kernel/seccomp.c b/kernel/seccomp.c index 301bbc24739c..afb916c7e890 100644 --- a/kernel/seccomp.c +++ b/kernel/seccomp.c | |||
@@ -473,7 +473,7 @@ long prctl_get_seccomp(void) | |||
473 | } | 473 | } |
474 | 474 | ||
475 | /** | 475 | /** |
476 | * prctl_set_seccomp: configures current->seccomp.mode | 476 | * seccomp_set_mode: internal function for setting seccomp mode |
477 | * @seccomp_mode: requested mode to use | 477 | * @seccomp_mode: requested mode to use |
478 | * @filter: optional struct sock_fprog for use with SECCOMP_MODE_FILTER | 478 | * @filter: optional struct sock_fprog for use with SECCOMP_MODE_FILTER |
479 | * | 479 | * |
@@ -486,7 +486,7 @@ long prctl_get_seccomp(void) | |||
486 | * | 486 | * |
487 | * Returns 0 on success or -EINVAL on failure. | 487 | * Returns 0 on success or -EINVAL on failure. |
488 | */ | 488 | */ |
489 | long prctl_set_seccomp(unsigned long seccomp_mode, char __user *filter) | 489 | static long seccomp_set_mode(unsigned long seccomp_mode, char __user *filter) |
490 | { | 490 | { |
491 | long ret = -EINVAL; | 491 | long ret = -EINVAL; |
492 | 492 | ||
@@ -517,3 +517,15 @@ long prctl_set_seccomp(unsigned long seccomp_mode, char __user *filter) | |||
517 | out: | 517 | out: |
518 | return ret; | 518 | return ret; |
519 | } | 519 | } |
520 | |||
521 | /** | ||
522 | * prctl_set_seccomp: configures current->seccomp.mode | ||
523 | * @seccomp_mode: requested mode to use | ||
524 | * @filter: optional struct sock_fprog for use with SECCOMP_MODE_FILTER | ||
525 | * | ||
526 | * Returns 0 on success or -EINVAL on failure. | ||
527 | */ | ||
528 | long prctl_set_seccomp(unsigned long seccomp_mode, char __user *filter) | ||
529 | { | ||
530 | return seccomp_set_mode(seccomp_mode, filter); | ||
531 | } | ||