History

seccomp: remove the 'sd' argument from __secure_computing()

After the previous changes 'sd' is always NULL.

Oleg Nesterov committed 1 year ago

Commit 1027cd81 parent b37778b4 files · +10 −12Browse files

Unified · Split

4 files
  1. arch/powerpc/kernel/ptrace/ptrace.c +1 −1
  2. include/linux/seccomp.h +3 −3
  3. kernel/entry/common.c +1 −1
  4. kernel/seccomp.c +5 −7
arch/powerpc/kernel/ptrace/ptrace.c+1−1
@@ -215,7 +215,7 @@ static int do_seccomp(struct pt_regs *regs) · 214 unmodified lines
215215 * have already loaded -ENOSYS into r3, or seccomp has put
216216 * something else in r3 (via SECCOMP_RET_ERRNO/TRACE).
217217 */
218− if (__secure_computing(NULL))
218+ if (__secure_computing())
219219 return -1;
220220
221221 /*
include/linux/seccomp.h+3−3
@@ -22,13 +22,13 @@ · 21 unmodified lines
2222 #include <linux/atomic.h>
2323 #include <asm/seccomp.h>
2424
25−extern int __secure_computing(const struct seccomp_data *sd);
25+extern int __secure_computing(void);
2626
2727 #ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER
2828 static inline int secure_computing(void)
2929 {
3030 if (unlikely(test_syscall_work(SECCOMP)))
31− return __secure_computing(NULL);
31+ return __secure_computing();
3232 return 0;
3333 }
3434 #else
@@ -54,7 +54,7 @@ static inline int secure_computing(void) { return 0; } · 19 unmodified lines
5454 #else
5555 static inline void secure_computing_strict(int this_syscall) { return; }
5656 #endif
57−static inline int __secure_computing(const struct seccomp_data *sd) { return 0; }
57+static inline int __secure_computing(void) { return 0; }
5858
5959 static inline long prctl_get_seccomp(void)
6060 {
kernel/entry/common.c+1−1
@@ -49,7 +49,7 @@ long syscall_trace_enter(struct pt_regs *regs, long syscall, · 48 unmodified lines
4949
5050 /* Do seccomp after ptrace, to catch any tracer changes. */
5151 if (work & SYSCALL_WORK_SECCOMP) {
52− ret = __secure_computing(NULL);
52+ ret = __secure_computing();
5353 if (ret == -1L)
5454 return ret;
5555 }
kernel/seccomp.c+5−7
@@ -1072,10 +1072,9 @@ void secure_computing_strict(int this_syscall) · 1071 unmodified lines
10721072 else
10731073 BUG();
10741074 }
1075−int __secure_computing(const struct seccomp_data *sd)
1075+int __secure_computing(void)
10761076 {
1077− int this_syscall = sd ? sd->nr :
1078− syscall_get_nr(current, current_pt_regs());
1077+ int this_syscall = syscall_get_nr(current, current_pt_regs());
10791078
10801079 secure_computing_strict(this_syscall);
10811080 return 0;
@@ -1365,7 +1364,7 @@ static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd, · 283 unmodified lines
13651364 }
13661365 #endif
13671366
1368−int __secure_computing(const struct seccomp_data *sd)
1367+int __secure_computing(void)
13691368 {
13701369 int mode = current->seccomp.mode;
13711370 int this_syscall;
@@ -1374,15 +1373,14 @@ int __secure_computing(const struct seccomp_data *sd) · 2 unmodified lines
13741373 unlikely(current->ptrace & PT_SUSPEND_SECCOMP))
13751374 return 0;
13761375
1377− this_syscall = sd ? sd->nr :
1378− syscall_get_nr(current, current_pt_regs());
1376+ this_syscall = syscall_get_nr(current, current_pt_regs());
13791377
13801378 switch (mode) {
13811379 case SECCOMP_MODE_STRICT:
13821380 __secure_computing_strict(this_syscall); /* may call do_exit */
13831381 return 0;
13841382 case SECCOMP_MODE_FILTER:
1385− return __seccomp_filter(this_syscall, sd, false);
1383+ return __seccomp_filter(this_syscall, NULL, false);
13861384 /* Surviving SECCOMP_RET_KILL_* must be proactively impossible. */
13871385 case SECCOMP_MODE_DEAD:
13881386 WARN_ON_ONCE(1);