Skip to content

Commit 27146b8

Browse files
committed
bpf: Reject bpf_timer for PREEMPT_RT
JIRA: https://issues.redhat.com/browse/RHEL-83826 commit e25ddfb Author: Leon Hwang <leon.hwang@linux.dev> Date: Wed Sep 10 20:57:39 2025 +0800 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 <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: Gregory Bell <grbell@redhat.com>
1 parent 2c415ad commit 27146b8

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
@@ -7763,6 +7763,10 @@ static int process_timer_func(struct bpf_verifier_env *env, int regno,
77637763
verbose(env, "verifier bug. Two map pointers in a timer helper\n");
77647764
return -EFAULT;
77657765
}
7766+
if (IS_ENABLED(CONFIG_PREEMPT_RT)) {
7767+
verbose(env, "bpf_timer cannot be used for PREEMPT_RT.\n");
7768+
return -EOPNOTSUPP;
7769+
}
77667770
meta->map_uid = reg->map_uid;
77677771
meta->map_ptr = map;
77687772
return 0;

0 commit comments

Comments
 (0)