* [PATCH] ARM: select HAVE_POSIX_CPU_TIMERS_TASK_WORK
@ 2026-07-18 21:45 Karl Mehltretter
2026-07-19 16:15 ` Arnd Bergmann
2026-07-20 7:26 ` Sebastian Andrzej Siewior
0 siblings, 2 replies; 3+ messages in thread
From: Karl Mehltretter @ 2026-07-18 21:45 UTC (permalink / raw)
To: Russell King, Sebastian Andrzej Siewior
Cc: Karl Mehltretter, Arnd Bergmann, linux-rt-devel, linux-arm-kernel
Commit c6e61c06d606 ("ARM: 9463/1: Allow to enable RT") enabled PREEMPT_RT
on ARM but did not select HAVE_POSIX_CPU_TIMERS_TASK_WORK. This leaves
CONFIG_POSIX_CPU_TIMERS_TASK_WORK disabled, so CPU timers expire in hard
IRQ context.
On PREEMPT_RT this makes run_posix_cpu_timers() take the sleeping
sighand->siglock:
BUG: sleeping function called from invalid context at spinlock_rt.c:48
rt_spin_lock from lock_task_sighand
lock_task_sighand from run_posix_cpu_timers
run_posix_cpu_timers from update_process_times
ARM handles TIF_NOTIFY_RESUME on all return-to-user paths, including v7-M.
ARM32 KVM host support was removed by commit 541ad0150ca4 ("arm: Remove
32bit KVM host support"), so the select need not be conditional on KVM.
Select it to defer POSIX CPU timer expiry to task context.
Reproduced with setrlimit(RLIMIT_CPU, ...) and a busy loop. The same path
is used by setitimer(ITIMER_PROF or ITIMER_VIRTUAL) and POSIX CPU timers
created with timer_create().
Fixes: c6e61c06d606 ("ARM: 9463/1: Allow to enable RT")
Assisted-by: Claude:claude-fable-5
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
---
Found with a self-hosted syzkaller instance patched to fuzz kernels on
QEMU's versatilepb machine (ARM926EJ-S, ARMv5TE). Runtime-tested before
and after the change on that setup, and compile-tested mps2_defconfig
with PREEMPT_RT (NOMMU, CPU_V7M).
arch/arm/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 9187240a02db..f073b5102d4e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -133,6 +133,7 @@ config ARM
select HAVE_PERF_EVENTS
select HAVE_PERF_REGS
select HAVE_PERF_USER_STACK_DUMP
+ select HAVE_POSIX_CPU_TIMERS_TASK_WORK
select MMU_GATHER_RCU_TABLE_FREE if SMP && ARM_LPAE
select HAVE_REGS_AND_STACK_ACCESS_API
select HAVE_RSEQ
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ARM: select HAVE_POSIX_CPU_TIMERS_TASK_WORK
2026-07-18 21:45 [PATCH] ARM: select HAVE_POSIX_CPU_TIMERS_TASK_WORK Karl Mehltretter
@ 2026-07-19 16:15 ` Arnd Bergmann
2026-07-20 7:26 ` Sebastian Andrzej Siewior
1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2026-07-19 16:15 UTC (permalink / raw)
To: Karl Mehltretter, Russell King, Sebastian Andrzej Siewior
Cc: linux-rt-devel, linux-arm-kernel
On Sat, Jul 18, 2026, at 23:45, Karl Mehltretter wrote:
> Commit c6e61c06d606 ("ARM: 9463/1: Allow to enable RT") enabled PREEMPT_RT
> on ARM but did not select HAVE_POSIX_CPU_TIMERS_TASK_WORK. This leaves
> CONFIG_POSIX_CPU_TIMERS_TASK_WORK disabled, so CPU timers expire in hard
> IRQ context.
>
> On PREEMPT_RT this makes run_posix_cpu_timers() take the sleeping
> sighand->siglock:
>
> BUG: sleeping function called from invalid context at spinlock_rt.c:48
> rt_spin_lock from lock_task_sighand
> lock_task_sighand from run_posix_cpu_timers
> run_posix_cpu_timers from update_process_times
>
> ARM handles TIF_NOTIFY_RESUME on all return-to-user paths, including v7-M.
> ARM32 KVM host support was removed by commit 541ad0150ca4 ("arm: Remove
> 32bit KVM host support"), so the select need not be conditional on KVM.
>
> Select it to defer POSIX CPU timer expiry to task context.
>
> Reproduced with setrlimit(RLIMIT_CPU, ...) and a busy loop. The same path
> is used by setitimer(ITIMER_PROF or ITIMER_VIRTUAL) and POSIX CPU timers
> created with timer_create().
>
> Fixes: c6e61c06d606 ("ARM: 9463/1: Allow to enable RT")
> Assisted-by: Claude:claude-fable-5
> Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Indeed selecting HAVE_POSIX_CPU_TIMERS_TASK_WORK was previously
part of the RT patch [1] set but got lost during one of the
updates before the patch got merged.
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
> Found with a self-hosted syzkaller instance patched to fuzz kernels on
> QEMU's versatilepb machine (ARM926EJ-S, ARMv5TE). Runtime-tested before
> and after the change on that setup
Good to hear that this configuration works with your patch,
I don't think many people have tested ARMv5 RT recently.
Arnd
[1] https://lore.kernel.org/all/20251030152253.tK-rY89Y@linutronix.de/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ARM: select HAVE_POSIX_CPU_TIMERS_TASK_WORK
2026-07-18 21:45 [PATCH] ARM: select HAVE_POSIX_CPU_TIMERS_TASK_WORK Karl Mehltretter
2026-07-19 16:15 ` Arnd Bergmann
@ 2026-07-20 7:26 ` Sebastian Andrzej Siewior
1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-07-20 7:26 UTC (permalink / raw)
To: Karl Mehltretter
Cc: Russell King, Arnd Bergmann, linux-rt-devel, linux-arm-kernel
On 2026-07-18 23:45:15 [+0200], Karl Mehltretter wrote:
> Commit c6e61c06d606 ("ARM: 9463/1: Allow to enable RT") enabled PREEMPT_RT
> on ARM but did not select HAVE_POSIX_CPU_TIMERS_TASK_WORK. This leaves
> CONFIG_POSIX_CPU_TIMERS_TASK_WORK disabled, so CPU timers expire in hard
> IRQ context.
…
> Fixes: c6e61c06d606 ("ARM: 9463/1: Allow to enable RT")
> Assisted-by: Claude:claude-fable-5
> Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Found with a self-hosted syzkaller instance patched to fuzz kernels on
> QEMU's versatilepb machine (ARM926EJ-S, ARMv5TE). Runtime-tested before
> and after the change on that setup, and compile-tested mps2_defconfig
> with PREEMPT_RT (NOMMU, CPU_V7M).
I obviously got the rules confused while dropping the KVM patches.
Sebastian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-20 7:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-18 21:45 [PATCH] ARM: select HAVE_POSIX_CPU_TIMERS_TASK_WORK Karl Mehltretter
2026-07-19 16:15 ` Arnd Bergmann
2026-07-20 7:26 ` Sebastian Andrzej Siewior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox