* + proc-report-sigev_none-in-proc-pid-timers-if-target-task-has-died.patch added to mm-nonmm-unstable branch
@ 2026-08-30 1:03 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-08-30 1:03 UTC (permalink / raw)
To: mm-commits, tglx, ptikhomirov, avagin, akpm
The patch titled
Subject: proc: report SIGEV_NONE in /proc/pid/timers if target task has died
has been added to the -mm mm-nonmm-unstable branch. Its filename is
proc-report-sigev_none-in-proc-pid-timers-if-target-task-has-died.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/proc-report-sigev_none-in-proc-pid-timers-if-target-task-has-died.patch
This patch will later appear in the mm-nonmm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Andrei Vagin <avagin@google.com>
Subject: proc: report SIGEV_NONE in /proc/pid/timers if target task has died
Date: Sun, 16 Aug 2026 16:12:15 +0000
When a posix timer is created targeting a specific thread (using
SIGEV_SIGNAL | SIGEV_THREAD_ID), it takes a reference to the target struct
pid in timer->it_pid. If the target thread subsequently terminates, its
numeric tid is freed and can be recycled for an unrelated task. However,
the timer holds its reference to the original struct pid.
show_timer() in /proc/[pid]/timers previously called pid_nr_ns() directly
on timer->it_pid without checking whether any task remained attached to
that struct pid. As a result:
1. It reported the stale tid, which could mistakenly refer to a recycled
pid.
2. In the kernel, expired signals for dead target threads are dropped by
posixtimer_send_sigqueue() because posixtimer_get_target() returns
NULL, so the timer functionally acts as SIGEV_NONE.
3. Checkpoint/restore tools (CRIU) parsing /proc/[pid]/timers would try
to restore a timer with SIGEV_SIGNAL | SIGEV_THREAD_ID targeting a
non-existent or unrelated thread.
Check pid_has_task(timer->it_pid, timer->it_pid_type) in show_timer(). If
the target task has died, override notify to SIGEV_NONE and report PID 0
(e.g., 'notify: none/pid.0').
Link: https://lore.kernel.org/20260816161216.984580-1-avagin@google.com
Signed-off-by: Andrei Vagin <avagin@google.com>
Reviewed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
fs/proc/base.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/fs/proc/base.c~proc-report-sigev_none-in-proc-pid-timers-if-target-task-has-died
+++ a/fs/proc/base.c
@@ -2519,17 +2519,23 @@ static int show_timer(struct seq_file *m
struct k_itimer *timer = hlist_entry((struct hlist_node *)v, struct k_itimer, list);
struct timers_private *tp = m->private;
int notify = timer->it_sigev_notify;
+ pid_t nr = 0;
guard(spinlock_irq)(&timer->it_lock);
if (!posixtimer_valid(timer))
return 0;
+ if (timer->it_pid && pid_has_task(timer->it_pid, timer->it_pid_type))
+ nr = pid_nr_ns(timer->it_pid, tp->ns);
+ else
+ notify = SIGEV_NONE;
+
seq_printf(m, "ID: %d\n", timer->it_id);
seq_printf(m, "signal: %d/%px\n", timer->sigq.info.si_signo,
timer->sigq.info.si_value.sival_ptr);
seq_printf(m, "notify: %s/%s.%d\n", nstr[notify & ~SIGEV_THREAD_ID],
(notify & SIGEV_THREAD_ID) ? "tid" : "pid",
- pid_nr_ns(timer->it_pid, tp->ns));
+ nr);
seq_printf(m, "ClockID: %d\n", timer->it_clock);
return 0;
_
Patches currently in -mm which might be from avagin@google.com are
proc-report-sigev_none-in-proc-pid-timers-if-target-task-has-died.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-30 1:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-30 1:03 + proc-report-sigev_none-in-proc-pid-timers-if-target-task-has-died.patch added to mm-nonmm-unstable branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.