Skip to content

Commit d78ab02

Browse files
committed
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>
1 parent c04f9d6 commit d78ab02

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

‎kernel/seccomp.c‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ long prctl_get_seccomp(void)
473473
}
474474

475475
/**
476-
* prctl_set_seccomp: configures current->seccomp.mode
476+
* seccomp_set_mode: internal function for setting seccomp mode
477477
* @seccomp_mode: requested mode to use
478478
* @filter: optional struct sock_fprog for use with SECCOMP_MODE_FILTER
479479
*
@@ -486,7 +486,7 @@ long prctl_get_seccomp(void)
486486
*
487487
* Returns 0 on success or -EINVAL on failure.
488488
*/
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)
490490
{
491491
long ret = -EINVAL;
492492

@@ -517,3 +517,15 @@ long prctl_set_seccomp(unsigned long seccomp_mode, char __user *filter)
517517
out:
518518
return ret;
519519
}
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+
}

0 commit comments

Comments
 (0)