diff options
| author | Leon Hwang <leon.hwang@linux.dev> | 2025-09-10 20:57:39 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-10-02 13:44:09 +0200 |
| commit | 452ad253585046e2fc427aaf62b0395d217778e5 (patch) | |
| tree | 0e7c60c81351289fc0d51cfb79f5f466eb48556a /kernel | |
| parent | 7a75aae4c0c217c08755e172aebd0506759f20bd (diff) | |
| download | linux-452ad253585046e2fc427aaf62b0395d217778e5.tar.gz linux-452ad253585046e2fc427aaf62b0395d217778e5.tar.bz2 linux-452ad253585046e2fc427aaf62b0395d217778e5.zip | |
bpf: Reject bpf_timer for PREEMPT_RT
[ Upstream commit e25ddfb388c8b7e5f20e3bf38d627fb485003781 ]
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>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/bpf/verifier.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 6e22abf3326b..1829f62a74a9 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -7799,6 +7799,10 @@ static int process_timer_func(struct bpf_verifier_env *env, int regno, verbose(env, "verifier bug. Two map pointers in a timer helper\n"); 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_ptr = map; return 0; |
