mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
bpf: Reject bpf_timer for PREEMPT_RT
[ Upstream commit e25ddfb388 ]
When enable CONFIG_PREEMPT_RT, the kernel will warn when run timer
selftests by './test_progs -t timer':
BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
In order to avoid such warning, reject bpf_timer in verifier when
PREEMPT_RT is enabled.
Signed-off-by: Leon Hwang <leon.hwang@linux.dev>
Link: https://lore.kernel.org/r/20250910125740.52172-2-leon.hwang@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f577bec983
commit
b6b7db6530
@@ -8405,6 +8405,10 @@ static int process_timer_func(struct bpf_verifier_env *env, int regno,
|
|||||||
verifier_bug(env, "Two map pointers in a timer helper");
|
verifier_bug(env, "Two map pointers in a timer helper");
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
if (IS_ENABLED(CONFIG_PREEMPT_RT)) {
|
||||||
|
verbose(env, "bpf_timer cannot be used for PREEMPT_RT.\n");
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
meta->map_uid = reg->map_uid;
|
meta->map_uid = reg->map_uid;
|
||||||
meta->map_ptr = map;
|
meta->map_ptr = map;
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user