Jann Horn
2d1c482277
seccomp: Make duplicate listener detection non-racy
...
commit dfe719fef03d752f1682fa8aeddf30ba501c8555 upstream.
Currently, init_listener() tries to prevent adding a filter with
SECCOMP_FILTER_FLAG_NEW_LISTENER if one of the existing filters already
has a listener. However, this check happens without holding any lock that
would prevent another thread from concurrently installing a new filter
(potentially with a listener) on top of the ones we already have.
Theoretically, this is also a data race: The plain load from
current->seccomp.filter can race with concurrent writes to the same
location.
Fix it by moving the check into the region that holds the siglock to guard
against concurrent TSYNC.
(The "Fixes" tag points to the commit that introduced the theoretical
data race; concurrent installation of another filter with TSYNC only
became possible later, in commit 51891498f2da ("seccomp: allow TSYNC and
USER_NOTIF together").)
Fixes: 6a21cc50f0 ("seccomp: add a return code to trap to userspace")
Reviewed-by: Tycho Andersen <tycho@tycho.pizza>
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20201005014401.490175-1-jannh@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-11-05 11:43:23 +01:00
..
bpf
bpf: Permit map_ptr arithmetic with opcode add and offset 0
2020-11-05 11:43:17 +01:00
cgroup
cgroup: fix cgroup_sk_alloc() for sk_clone_lock()
2020-07-22 09:32:49 +02:00
configs
debug
kgdb: Make "kgdbcon" work properly with "kgdb_earlycon"
2020-11-05 11:43:16 +01:00
dma
dma-direct: fix data truncation in dma_direct_get_required_mask()
2020-04-29 16:33:00 +02:00
events
perf: Fix task_function_call() error handling
2020-10-14 10:33:05 +02:00
gcov
gcov: add support for GCC 10.1
2020-09-17 13:47:56 +02:00
irq
genirq/matrix: Deal with the sillyness of for_each_cpu() on UP
2020-09-03 11:27:06 +02:00
livepatch
livepatch: Nullify obj->mod in klp_module_coming()'s error path
2019-08-19 13:03:37 +02:00
locking
locking/lockdep: Decrement IRQ context counters when removing lock chain
2020-10-01 13:17:33 +02:00
power
PM: hibernate: remove the bogus call to get_gendisk() in software_resume()
2020-10-29 09:58:04 +01:00
printk
printk: handle blank console arguments passed in.
2020-10-01 13:18:04 +02:00
rcu
rcu: Allow only one expedited GP to run concurrently with wakeups
2020-03-05 16:43:50 +01:00
sched
sched/features: Fix !CONFIG_JUMP_LABEL case
2020-10-29 09:58:00 +01:00
time
timekeeping: Prevent 32bit truncation in scale64_check_overflow()
2020-10-01 13:17:38 +02:00
trace
tracing: Make the space reserved for the pid wider
2020-10-07 08:01:27 +02:00
.gitignore
acct.c
async.c
audit.c
audit: fix a net reference leak in audit_list_rules_send()
2020-06-22 09:30:59 +02:00
audit.h
audit: fix a net reference leak in audit_list_rules_send()
2020-06-22 09:30:59 +02:00
audit_fsnotify.c
audit_tree.c
audit_watch.c
audit: CONFIG_CHANGE don't log internal bookkeeping as an event
2020-10-01 13:17:32 +02:00
auditfilter.c
audit: fix a net reference leak in audit_list_rules_send()
2020-06-22 09:30:59 +02:00
auditsc.c
backtracetest.c
bounds.c
capability.c
compat.c
configs.c
kernel/configs: Replace GPL boilerplate code with SPDX identifier
2019-07-30 18:34:15 +02:00
context_tracking.c
cpu.c
sched/core: Fix illegal RCU from offline CPUs
2020-06-22 09:31:01 +02:00
cpu_pm.c
kernel/cpu_pm: Fix uninitted local in cpu_pm
2020-06-22 09:31:22 +02:00
crash_core.c
crash_dump.c
cred.c
keys: Fix request_key() cache
2020-01-17 19:48:42 +01:00
delayacct.c
dma.c
elfcore.c
kernel/elfcore.c: include proper prototypes
2019-09-25 17:51:39 -07:00
exec_domain.c
exit.c
exit: Move preemption fixup up, move blocking operations down
2020-06-22 09:31:01 +02:00
extable.c
extable: Add function to search only kernel exception table
2019-08-21 22:23:48 +10:00
fail_function.c
fork.c
mm, oom_adj: don't loop through tasks in __set_oom_adj when not necessary
2020-10-29 09:57:45 +01:00
freezer.c
Revert "libata, freezer: avoid block device removal while system is frozen"
2019-10-06 09:11:37 -06:00
futex.c
futex: Fix incorrect should_fail_futex() handling
2020-11-05 11:43:13 +01:00
gen_kheaders.sh
kbuild: add variables for compression tools
2020-09-03 11:27:10 +02:00
groups.c
hung_task.c
iomem.c
irq_work.c
jump_label.c
jump_label: Don't warn on __exit jump entries
2019-08-29 15:10:10 +01:00
kallsyms.c
kallsyms: Refactor kallsyms_show_value() to take cred
2020-07-16 08:16:44 +02:00
kcmp.c
kernel/kcmp.c: Use new infrastructure to fix deadlocks in execve
2020-10-01 13:17:48 +02:00
Kconfig.freezer
Kconfig.hz
Kconfig.locks
Kconfig.preempt
kcov.c
kexec.c
kexec_load: Disable at runtime if the kernel is locked down
2019-08-19 21:54:15 -07:00
kexec_core.c
kexec: bail out upon SIGKILL when allocating memory.
2019-09-25 17:51:40 -07:00
kexec_elf.c
kexec_elf: support 32 bit ELF files
2019-09-06 23:58:44 +02:00
kexec_file.c
Merge branch 'next-lockdown' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
2019-09-28 08:14:15 -07:00
kexec_internal.h
kheaders.c
kmod.c
kmod: make request_module() return an error when autoloading is disabled
2020-04-17 10:50:22 +02:00
kprobes.c
kprobes: Fix compiler warning for !CONFIG_KPROBES_ON_FTRACE
2020-10-01 13:18:25 +02:00
ksysfs.c
kthread.c
kthread: Do not preempt current task if it is going to call schedule()
2020-08-26 10:40:53 +02:00
latencytop.c
Makefile
kernel/sysctl-test: Add null pointer test for sysctl.c:proc_dointvec()
2020-10-01 13:17:10 +02:00
module-internal.h
module.c
module: statically initialize init section freeing data
2020-10-29 09:57:55 +01:00
module_signature.c
MODSIGN: Export module signature definitions
2019-08-05 18:39:56 -04:00
module_signing.c
MODSIGN: Export module signature definitions
2019-08-05 18:39:56 -04:00
notifier.c
kernel/notifier.c: intercept duplicate registrations to avoid infinite loops
2020-10-01 13:17:23 +02:00
nsproxy.c
padata.c
padata: add separate cpuhp node for CPUHP_PADATA_DEAD
2020-06-17 16:40:22 +02:00
panic.c
panic: ensure preemption is disabled during panic()
2019-10-07 15:47:19 -07:00
params.c
lockdown: Lock down module params that specify hardware parameters (eg. ioport)
2019-08-19 21:54:16 -07:00
pid.c
pid_namespace.c
profile.c
ptrace.c
ptrace: reintroduce usage of subjective credentials in ptrace_has_cap()
2020-01-23 08:22:36 +01:00
range.c
reboot.c
relay.c
kernel/relay.c: fix memleak on destroy relay channel
2020-08-26 10:40:51 +02:00
resource.c
/dev/mem: Revoke mappings when a driver claims the region
2020-06-24 17:50:35 +02:00
rseq.c
seccomp.c
seccomp: Make duplicate listener detection non-racy
2020-11-05 11:43:23 +01:00
signal.c
signal: check sig before setting info in kill_pid_usb_asyncio
2020-05-02 08:48:55 +02:00
smp.c
smpboot.c
smpboot.h
softirq.c
stackleak.c
stacktrace.c
stacktrace: Don't skip first entry on noncurrent tasks
2019-11-04 21:19:25 +01:00
stop_machine.c
stop_machine: Avoid potential race behaviour
2019-10-17 12:47:12 +02:00
sys.c
kernel/sys.c: avoid copying possible padding bytes in copy_to_user
2020-10-01 13:17:23 +02:00
sys_ni.c
sysctl-test.c
kernel/sysctl-test: Add null pointer test for sysctl.c:proc_dointvec()
2020-10-01 13:17:10 +02:00
sysctl.c
kernel: sysctl: make drop_caches write-only
2020-01-04 19:18:32 +01:00
sysctl_binary.c
task_work.c
taskstats.c
taskstats: fix data-race
2020-01-09 10:19:54 +01:00
test_kprobes.c
torture.c
torture: Remove exporting of internal functions
2019-08-01 14:30:22 -07:00
tracepoint.c
tsacct.c
ucount.c
uid16.c
uid16.h
umh.c
usermodehelper: reset umask to default before executing user process
2020-10-14 10:32:58 +02:00
up.c
user-return-notifier.c
user.c
user_namespace.c
utsname.c
utsname_sysctl.c
watchdog.c
watchdog/softlockup: Enforce that timestamp is valid on boot
2020-02-24 08:36:52 +01:00
watchdog_hld.c
workqueue.c
workqueue: Remove the warning in wq_worker_sleeping()
2020-10-01 13:17:54 +02:00
workqueue_internal.h