Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

um: do not send SIGALRM to userspace in time-travel mode

We send a SIGALRM to userspace processes to interrupt them. Really,
doing so is only needed if they are actually executing at the time (to
ensure we return to kernelspace). Unfortunately, we do not have that
information readily available. We can however be sure that this is never
the case when we are in time-travel mode with infinite CPU.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Link: https://patch.msgid.link/20250408074524.300153-1-benjamin@sipsolutions.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Benjamin Berg and committed by
Johannes Berg
49caacf1 82c8e128

+9 -4
+9 -4
arch/um/kernel/time.c
··· 856 856 857 857 static irqreturn_t um_timer(int irq, void *dev) 858 858 { 859 - if (get_current()->mm != NULL) 860 - { 861 - /* userspace - relay signal, results in correct userspace timers */ 859 + /* 860 + * Interrupt the (possibly) running userspace process, technically this 861 + * should only happen if userspace is currently executing. 862 + * With infinite CPU time-travel, we can only get here when userspace 863 + * is not executing. Do not notify there and avoid spurious scheduling. 864 + */ 865 + if (time_travel_mode != TT_MODE_INFCPU && 866 + time_travel_mode != TT_MODE_EXTERNAL && 867 + get_current()->mm) 862 868 os_alarm_process(get_current()->mm->context.id.pid); 863 - } 864 869 865 870 (*timer_clockevent.event_handler)(&timer_clockevent); 866 871