@@ -175,17 +175,16 @@ static int seccomp_check_filter(struct sock_filter *filter, unsigned int flen)
175175 */
176176static u32 seccomp_run_filters (struct seccomp_data * sd )
177177{
178- struct seccomp_filter * f = ACCESS_ONCE (current -> seccomp .filter );
179178 struct seccomp_data sd_local ;
180179 u32 ret = SECCOMP_RET_ALLOW ;
180+ /* Make sure cross-thread synced filter points somewhere sane. */
181+ struct seccomp_filter * f =
182+ lockless_dereference (current -> seccomp .filter );
181183
182184 /* Ensure unexpected behavior doesn't result in failing open. */
183185 if (unlikely (WARN_ON (f == NULL )))
184186 return SECCOMP_RET_KILL ;
185187
186- /* Make sure cross-thread synced filter points somewhere sane. */
187- smp_read_barrier_depends ();
188-
189188 if (!sd ) {
190189 populate_seccomp_data (& sd_local );
191190 sd = & sd_local ;
@@ -549,7 +548,11 @@ void secure_computing_strict(int this_syscall)
549548{
550549 int mode = current -> seccomp .mode ;
551550
552- if (mode == 0 )
551+ if (config_enabled (CONFIG_CHECKPOINT_RESTORE ) &&
552+ unlikely (current -> ptrace & PT_SUSPEND_SECCOMP ))
553+ return ;
554+
555+ if (mode == SECCOMP_MODE_DISABLED )
553556 return ;
554557 else if (mode == SECCOMP_MODE_STRICT )
555558 __secure_computing_strict (this_syscall );
@@ -650,6 +653,10 @@ u32 seccomp_phase1(struct seccomp_data *sd)
650653 int this_syscall = sd ? sd -> nr :
651654 syscall_get_nr (current , task_pt_regs (current ));
652655
656+ if (config_enabled (CONFIG_CHECKPOINT_RESTORE ) &&
657+ unlikely (current -> ptrace & PT_SUSPEND_SECCOMP ))
658+ return SECCOMP_PHASE1_OK ;
659+
653660 switch (mode ) {
654661 case SECCOMP_MODE_STRICT :
655662 __secure_computing_strict (this_syscall ); /* may call do_exit */
0 commit comments