linux-sg2042/include
Christian Brauner 3a15fb6ed9 seccomp: release filter after task is fully dead
The seccomp filter used to be released in free_task() which is called
asynchronously via call_rcu() and assorted mechanisms. Since we need
to inform tasks waiting on the seccomp notifier when a filter goes empty
we will notify them as soon as a task has been marked fully dead in
release_task(). To not split seccomp cleanup into two parts, move
filter release out of free_task() and into release_task() after we've
unhashed struct task from struct pid, exited signals, and unlinked it
from the threadgroups' thread list. We'll put the empty filter
notification infrastructure into it in a follow up patch.

This also renames put_seccomp_filter() to seccomp_filter_release() which
is a more descriptive name of what we're doing here especially once
we've added the empty filter notification mechanism in there.

We're also NULL-ing the task's filter tree entrypoint which seems
cleaner than leaving a dangling pointer in there. Note that this shouldn't
need any memory barriers since we're calling this when the task is in
release_task() which means it's EXIT_DEAD. So it can't modify its seccomp
filters anymore. You can also see this from the point where we're calling
seccomp_filter_release(). It's after __exit_signal() and at this point,
tsk->sighand will already have been NULLed which is required for
thread-sync and filter installation alike.

Cc: Tycho Andersen <tycho@tycho.ws>
Cc: Kees Cook <keescook@chromium.org>
Cc: Matt Denton <mpdenton@google.com>
Cc: Sargun Dhillon <sargun@sargun.me>
Cc: Jann Horn <jannh@google.com>
Cc: Chris Palmer <palmer@google.com>
Cc: Aleksa Sarai <cyphar@cyphar.com>
Cc: Robert Sesek <rsesek@google.com>
Cc: Jeffrey Vander Stoep <jeffv@google.com>
Cc: Linux Containers <containers@lists.linux-foundation.org>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Link: https://lore.kernel.org/r/20200531115031.391515-2-christian.brauner@ubuntu.com
Signed-off-by: Kees Cook <keescook@chromium.org>
2020-07-10 16:01:51 -07:00
..
acpi Merge branch 'acpica' 2020-06-10 17:27:28 +02:00
asm-generic The X86 entry, exception and interrupt code rework 2020-06-13 10:05:47 -07:00
clocksource
crypto
drm drm: remove drm specific kmap_atomic code 2020-06-04 19:06:22 -07:00
dt-bindings - qcom : 2020-06-11 12:42:14 -07:00
keys keys: Implement update for the big_key type 2020-06-02 17:22:31 +01:00
kunit
kvm
linux seccomp: release filter after task is fully dead 2020-07-10 16:01:51 -07:00
math-emu
media media updates for v5.8-rc1 2020-06-13 13:09:38 -07:00
misc
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-06-13 16:27:13 -07:00
pcmcia
ras
rdma dynamic_debug: add an option to enable dynamic debug for modules only 2020-06-08 11:05:56 -07:00
scsi SCSI misc on 20200605 2020-06-05 15:11:50 -07:00
soc pci-v5.8-changes 2020-06-06 11:01:58 -07:00
sound ASoC: Updates for v5.8 2020-06-01 20:26:07 +02:00
target scsi: target: Rename target_setup_cmd_from_cdb() to target_cmd_parse_cdb() 2020-06-09 21:57:26 -04:00
trace block-5.8-2020-06-11 2020-06-11 16:07:33 -07:00
uapi Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-06-13 16:27:13 -07:00
vdso
video
xen xen: Move xen_setup_callback_vector() definition to include/xen/hvm.h 2020-06-11 15:15:19 +02:00