]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Make sure bpf_disable_instrumentation() is safe vs preemption.
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Sat, 27 Nov 2021 16:32:00 +0000 (17:32 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 30 Nov 2021 14:40:49 +0000 (15:40 +0100)
commit6a3180d05af6e648254e4a90207dea1c9a4f24da
treeba6f3792751c1a6ed6d0b8757e8acbceb5859fdd
parent97e39375b2535021eb4e930e472bc802d3deac93
bpf: Make sure bpf_disable_instrumentation() is safe vs preemption.

The initial implementation of migrate_disable() for mainline was a
wrapper around preempt_disable(). RT kernels substituted this with a
real migrate disable implementation.

Later on mainline gained true migrate disable support, but neither
documentation nor affected code were updated.

Remove stale comments claiming that migrate_disable() is PREEMPT_RT only.

Don't use __this_cpu_inc() in the !PREEMPT_RT path because preemption is
not disabled and the RMW operation can be preempted.

Fixes: 1e05619e8b2ed ("sched: Make migrate_disable/enable() independent of RT")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20211127163200.10466-3-bigeasy@linutronix.de
include/linux/bpf.h
include/linux/filter.h