seccomp: Merge in v4 of thread sync code

Synchronized with Kees v4 set of patches, in particular ensuring
that setting the seccomp flag happens under the seccomp lock.