Skip to content

Commit e25ddfb

Browse files
AsphalttAlexei Starovoitov
authored andcommitted
bpf: Reject bpf_timer for PREEMPT_RT
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent a3967ba commit e25ddfb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

kernel/bpf/verifier.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8547,6 +8547,10 @@ static int process_timer_func(struct bpf_verifier_env *env, int regno,
85478547
verifier_bug(env, "Two map pointers in a timer helper");
85488548
return -EFAULT;
85498549
}
8550+
if (IS_ENABLED(CONFIG_PREEMPT_RT)) {
8551+
verbose(env, "bpf_timer cannot be used for PREEMPT_RT.\n");
8552+
return -EOPNOTSUPP;
8553+
}
85508554
meta->map_uid = reg->map_uid;
85518555
meta->map_ptr = map;
85528556
return 0;

0 commit comments

Comments
 (0)