]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Fix trampoline usage in preempt
authorAlexei Starovoitov <ast@kernel.org>
Tue, 21 Jan 2020 03:22:31 +0000 (19:22 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 22 Jan 2020 10:31:21 +0000 (11:31 +0100)
commit1e4b68c80b0075d0ccd94811896f425fcafed474
tree746224e9acb03427aba28b7bb61e160379115f52
parent02d90e24f701d0d2f16dae7b5343611f2e43dadc
bpf: Fix trampoline usage in preempt

Though the second half of trampoline page is unused a task could be
preempted in the middle of the first half of trampoline and two
updates to trampoline would change the code from underneath the
preempted task. Hence wait for tasks to voluntarily schedule or go
to userspace. Add similar wait before freeing the trampoline.

Fixes: 2cefb9dd93cc ("bpf: Introduce BPF trampoline")
Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Paul E. McKenney <paulmck@kernel.org>
Link: https://lore.kernel.org/bpf/20200121032231.3292185-1-ast@kernel.org
kernel/bpf/trampoline.c