mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Andrei Vagin <avagin@google.com>
Cc: Thomas Gleixner <tglx@kernel.org>,
	linux-kernel@vger.kernel.org, criu@lists.linux.dev,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] proc: Report SIGEV_NONE in /proc/pid/timers if target task has died
Date: Sat, 29 Aug 2026 18:02:05 -0700	[thread overview]
Message-ID: <20260829180205.16dc4d5ed20150b79533f3c2@linux-foundation.org> (raw)
In-Reply-To: <20260816161216.984580-1-avagin@google.com>

On Sun, 16 Aug 2026 16:12:15 +0000 Andrei Vagin <avagin@google.com> wrote:

> 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.

This sounds like a somewhat significant issue for CRIU but that's just
me wildly guessing.

> 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').

No Fixes: and no cc:stable?  Maybe my guess was wrong?

      parent reply	other threads:[~2026-08-30  1:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-16 16:12 Andrei Vagin
2026-08-19  9:27 ` Pavel Tikhomirov
2026-08-20 18:10   ` Andrei Vagin
2026-08-30  1:02 ` Andrew Morton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260829180205.16dc4d5ed20150b79533f3c2@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=avagin@google.com \
    --cc=criu@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®