kernel-fxtec-pro1x/kernel/sched
Jann Horn 48046e092a sched/fair: Don't free p->numa_faults with concurrent readers
commit 16d51a590a8ce3befb1308e0e7ab77f3b661af33 upstream.

When going through execve(), zero out the NUMA fault statistics instead of
freeing them.

During execve, the task is reachable through procfs and the scheduler. A
concurrent /proc/*/sched reader can read data from a freed ->numa_faults
allocation (confirmed by KASAN) and write it back to userspace.
I believe that it would also be possible for a use-after-free read to occur
through a race between a NUMA fault and execve(): task_numa_fault() can
lead to task_numa_compare(), which invokes task_weight() on the currently
running task of a different CPU.

Another way to fix this would be to make ->numa_faults RCU-managed or add
extra locking, but it seems easier to wipe the NUMA fault statistics on
execve.

Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will@kernel.org>
Fixes: 82727018b0 ("sched/numa: Call task_numa_free() from do_execve()")
Link: https://lkml.kernel.org/r/20190716152047.14424-1-jannh@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-04 09:30:56 +02:00
..
autogroup.c
autogroup.h
clock.c
completion.c
core.c sched/core: Add __sched tag for io_schedule() 2019-07-26 09:14:08 +02:00
cpuacct.c
cpudeadline.c
cpudeadline.h
cpufreq.c
cpufreq_schedutil.c sched/cpufreq: Fix kobject memleak 2019-05-25 18:23:45 +02:00
cpupri.c
cpupri.h
cputime.c
deadline.c sched/deadline: Correctly handle active 0-lag timers 2019-05-02 09:58:56 +02:00
debug.c jump_label: move 'asm goto' support test to Kconfig 2019-06-04 08:02:34 +02:00
fair.c sched/fair: Don't free p->numa_faults with concurrent readers 2019-08-04 09:30:56 +02:00
features.h
idle.c
isolation.c
loadavg.c
Makefile
membarrier.c
pelt.c
pelt.h
rt.c sched/rt: Check integer overflow at usec to nsec conversion 2019-05-31 06:46:19 -07:00
sched-pelt.h sched/fair: Fix "runnable_avg_yN_inv" not used warnings 2019-07-26 09:14:08 +02:00
sched.h jump_label: move 'asm goto' support test to Kconfig 2019-06-04 08:02:34 +02:00
stats.c
stats.h
stop_task.c
swait.c
topology.c
wait.c
wait_bit.c