android_kernel_google_msm/kernel
Kees Cook 52cc75eef8 seccomp: introduce writer locking
Normally, task_struct.seccomp.filter is only ever read or modified by
the task that owns it (current). This property aids in fast access
during system call filtering as read access is lockless.

Updating the pointer from another task, however, opens up race
conditions. To allow cross-thread filter pointer updates, writes to the
seccomp fields are now protected by the sighand spinlock (which is shared
by all threads in the thread group). Read access remains lockless because
pointer updates themselves are atomic.  However, writes (or cloning)
often entail additional checking (like maximum instruction counts)
which require locking to perform safely.

In the case of cloning threads, the child is invisible to the system
until it enters the task list. To make sure a child can't be cloned from
a thread and left in a prior state, seccomp duplication is additionally
moved under the sighand lock. Then parent and child are certain have
the same seccomp state when they exit the lock.

Based on patches by Will Drewry and David Drysdale.

Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Andy Lutomirski <luto@amacapital.net>

Conflicts:
	kernel/fork.c
2014-10-31 19:46:29 -07:00
..
debug debug: add parameters to prevent entering debug mode on errors 2012-05-18 17:03:10 -07:00
events perf: Treat attr.config as u64 in perf_swevent_init() 2013-05-14 09:12:03 -07:00
gcov
irq random: remove rand_initialize_irq() 2013-09-09 17:01:42 -07:00
power Power: Changes the permission to read only for sysfs file 2014-08-05 19:00:47 +00:00
sched sched: Fix migration thread runtime bogosity 2014-07-09 14:32:18 -07:00
time timekeeping: fix 32-bit overflow in get_monotonic_boottime 2013-04-18 16:08:05 -07:00
trace trace/events: add gpu trace events 2013-04-18 16:08:19 -07:00
.gitignore
acct.c
async.c
audit.c
audit.h
audit_tree.c
audit_watch.c
auditfilter.c
auditsc.c seccomp: remove duplicated failure logging 2014-10-31 19:46:13 -07:00
backtracetest.c
bounds.c
capability.c
cgroup.c cgroup: Fix use after free of cgrp (cgrp->css_sets) 2014-07-24 15:38:09 -07:00
cgroup_freezer.c
compat.c compat: Fix RT signal mask corruption via sigprocmask 2012-05-10 08:58:33 -07:00
configs.c
cpu.c
cpu_pm.c
cpuset.c
crash_dump.c
cred.c
delayacct.c
dma.c
elfcore.c
exec_domain.c
exit.c lockdep: remove task argument from debug_check_no_locks_held 2013-07-12 14:22:56 -07:00
extable.c
fork.c seccomp: introduce writer locking 2014-10-31 19:46:29 -07:00
freezer.c freezer: skip waking up tasks with PF_FREEZER_SKIP set 2013-07-12 14:22:56 -07:00
futex.c futex: Make lookup_pi_state more robust 2014-06-11 15:16:22 -07:00
futex_compat.c
groups.c
hrtimer.c nanosleep: use freezable blocking call 2013-07-12 14:22:58 -07:00
hung_task.c
irq_work.c
itimer.c
jump_label.c
kallsyms.c vsprintf: Fix %ps on non symbols when using kallsyms 2013-02-08 15:14:22 -08:00
Kconfig.freezer
Kconfig.hz
Kconfig.locks
Kconfig.preempt
kexec.c
kfifo.c
kmod.c
kprobes.c
ksysfs.c
kthread.c
latencytop.c
lockdep.c lockdep: remove task argument from debug_check_no_locks_held 2013-07-12 14:22:56 -07:00
lockdep_internals.h
lockdep_proc.c
lockdep_states.h
Makefile
module.c
mutex-debug.c
mutex-debug.h
mutex.c
mutex.h
notifier.c
nsproxy.c
padata.c
panic.c panic: resume console if panic after console suspend. 2013-09-09 17:16:14 -07:00
params.c
pid.c
pid_namespace.c
posix-cpu-timers.c
posix-timers.c
printk.c panic: resume console if panic after console suspend. 2013-09-09 17:16:14 -07:00
profile.c
ptrace.c ptrace: ensure arch_ptrace/ptrace_request can never race with SIGKILL 2013-04-18 16:08:07 -07:00
range.c
rcu.h
rcupdate.c
rcutiny.c
rcutiny_plugin.h
rcutorture.c
rcutree.c rcu: Fix day-one dyntick-idle stall-warning bug 2013-02-08 15:14:25 -08:00
rcutree.h
rcutree_plugin.h
rcutree_trace.c
relay.c
res_counter.c
resource.c DMM: Fix for movable bytes near end of address space 2013-02-20 02:50:30 -08:00
rtmutex-debug.c
rtmutex-debug.h
rtmutex-tester.c
rtmutex.c
rtmutex.h
rtmutex_common.h
rwsem.c
seccomp.c seccomp: introduce writer locking 2014-10-31 19:46:29 -07:00
semaphore.c
signal.c signal, x86: add SIGSYS info and make it synchronous. 2014-10-31 19:46:15 -07:00
smp.c
softirq.c
spinlock.c
srcu.c
stacktrace.c
stop_machine.c
sys.c sched: move no_new_privs into new atomic flags 2014-10-31 19:46:28 -07:00
sys_ni.c seccomp: add "seccomp" syscall 2014-10-31 19:46:27 -07:00
sysctl.c Revert "sched: add sysctl for controlling task migrations on wake" 2013-03-15 17:13:14 -07:00
sysctl_binary.c msm: 8x55: put reason for boot in procfs from SMEM 2013-02-08 15:14:28 -08:00
taskstats.c
test_kprobes.c
time.c
timeconst.pl
timer.c timer: Don't reinitialize the cpu base lock during CPU_UP_PREPARE 2013-06-24 18:55:42 +00:00
tracepoint.c
tsacct.c
uid16.c
up.c
user-return-notifier.c
user.c
user_namespace.c
utsname.c
utsname_sysctl.c
wait.c
watchdog.c
workqueue.c workqueue: skip nr_running sanity check in worker_enter_idle() if trustee is active 2013-03-04 12:48:24 -08:00
workqueue_sched.h