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.
Showing the changes to kernel (3 of 7 files). Show all
Unified · Split
| @@ -54,7 +54,7 @@ static long syscall_trace_enter(struct pt_regs *regs, long syscall, · 53 unmodified lines | ||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /* Do seccomp after ptrace, to catch any tracer changes. */ |
| 57 | − if (ti_work & _TIF_SECCOMP) { | |
| 57 | + if (work & SYSCALL_WORK_SECCOMP) { | |
| 58 | 58 | ret = __secure_computing(NULL); |
| 59 | 59 | if (ret == -1L) |
| 60 | 60 | return ret; |
| @@ -1625,7 +1625,7 @@ static void copy_seccomp(struct task_struct *p) · 1624 unmodified lines | ||
| 1625 | 1625 | * to manually enable the seccomp thread flag here. |
| 1626 | 1626 | */ |
| 1627 | 1627 | if (p->seccomp.mode != SECCOMP_MODE_DISABLED) |
| 1628 | − set_tsk_thread_flag(p, TIF_SECCOMP); | |
| 1628 | + set_task_syscall_work(p, SECCOMP); | |
| 1629 | 1629 | #endif |
| 1630 | 1630 | } |
| 1631 | 1631 | |
| @@ -356,14 +356,14 @@ static inline void seccomp_assign_mode(struct task_struct *task, · 355 unmodified lines | ||
| 356 | 356 | |
| 357 | 357 | task->seccomp.mode = seccomp_mode; |
| 358 | 358 | /* |
| 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 | |
| 360 | 360 | * filter) is set. |
| 361 | 361 | */ |
| 362 | 362 | smp_mb__before_atomic(); |
| 363 | 363 | /* Assume default seccomp processes want spec flaw mitigation. */ |
| 364 | 364 | if ((flags & SECCOMP_FILTER_FLAG_SPEC_ALLOW) == 0) |
| 365 | 365 | arch_seccomp_spec_mitigate(task); |
| 366 | − set_tsk_thread_flag(task, TIF_SECCOMP); | |
| 366 | + set_task_syscall_work(task, SECCOMP); | |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | #ifdef CONFIG_SECCOMP_FILTER |
| @@ -929,7 +929,7 @@ static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd, · 559 unmodified lines | ||
| 929 | 929 | |
| 930 | 930 | /* |
| 931 | 931 | * 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. | |
| 933 | 933 | */ |
| 934 | 934 | rmb(); |
| 935 | 935 | |