Skip to content
Commit c89e843a authored by Hou Tao's avatar Hou Tao Committed by Martin KaFai Lau
Browse files

bpf: Use this_cpu_{inc_return|dec} for prog->active



Both __this_cpu_inc_return() and __this_cpu_dec() are not preemption
safe and now migrate_disable() doesn't disable preemption, so the update
of prog-active is not atomic and in theory under fully preemptible kernel
recurisve prevention may do not work.

Fixing by using the preemption-safe and IRQ-safe variants.

Fixes: ca06f55b ("bpf: Add per-program recursion prevention mechanism")
Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/r/20220901061938.3789460-3-houtao@huaweicloud.com


Signed-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
parent 197827a0
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment