History

seccomp: Migrate to use SYSCALL_WORK flag

On architectures using the generic syscall entry code the architecture independent syscall work is moved to flags in thread_info::syscall_work. This removes architecture dependencies and frees up TIF bits. Define SYSCALL_WORK_SECCOMP, use it in the generic entry code and convert the code which uses the TIF specific helper functions to use the new *_syscall_work() helpers which either resolve to the new mode for users of the generic entry code or to the TIF based functions for the other architectures.

Gabriel Krisman Bertazi committed 5 years ago

Commit 23d67a51 parent b86678c7 files · +15 −13Browse files

Showing the changes to kernel (3 of 7 files). Show all

Unified · Split

3 files
  1. kernel/entry/common.c +1 −1
  2. kernel/fork.c +1 −1
  3. kernel/seccomp.c +3 −3
kernel/entry/common.c+1−1
@@ -54,7 +54,7 @@ static long syscall_trace_enter(struct pt_regs *regs, long syscall, · 53 unmodified lines
5454 }
5555
5656 /* Do seccomp after ptrace, to catch any tracer changes. */
57− if (ti_work & _TIF_SECCOMP) {
57+ if (work & SYSCALL_WORK_SECCOMP) {
5858 ret = __secure_computing(NULL);
5959 if (ret == -1L)
6060 return ret;
kernel/fork.c+1−1
@@ -1625,7 +1625,7 @@ static void copy_seccomp(struct task_struct *p) · 1624 unmodified lines
16251625 * to manually enable the seccomp thread flag here.
16261626 */
16271627 if (p->seccomp.mode != SECCOMP_MODE_DISABLED)
1628− set_tsk_thread_flag(p, TIF_SECCOMP);
1628+ set_task_syscall_work(p, SECCOMP);
16291629 #endif
16301630 }
16311631
kernel/seccomp.c+3−3
@@ -356,14 +356,14 @@ static inline void seccomp_assign_mode(struct task_struct *task, · 355 unmodified lines
356356
357357 task->seccomp.mode = seccomp_mode;
358358 /*
359− * Make sure TIF_SECCOMP cannot be set before the mode (and
359+ * Make sure SYSCALL_WORK_SECCOMP cannot be set before the mode (and
360360 * filter) is set.
361361 */
362362 smp_mb__before_atomic();
363363 /* Assume default seccomp processes want spec flaw mitigation. */
364364 if ((flags & SECCOMP_FILTER_FLAG_SPEC_ALLOW) == 0)
365365 arch_seccomp_spec_mitigate(task);
366− set_tsk_thread_flag(task, TIF_SECCOMP);
366+ set_task_syscall_work(task, SECCOMP);
367367 }
368368
369369 #ifdef CONFIG_SECCOMP_FILTER
@@ -929,7 +929,7 @@ static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd, · 559 unmodified lines
929929
930930 /*
931931 * Make sure that any changes to mode from another thread have
932− * been seen after TIF_SECCOMP was seen.
932+ * been seen after SYSCALL_WORK_SECCOMP was seen.
933933 */
934934 rmb();
935935

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t