All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@sigma-star.at>
To: Richard Weinberger <richard@nod.at>,
	xenomai@lists.linux.dev, upstream@sigma-star.at,
	Jan Kiszka <jan.kiszka@siemens.com>
Cc: upstream+xenomai@sigma-star.at
Subject: Re: [PATCH] Fix race between RTDM task termination and xnthread_join
Date: Thu, 29 Jan 2026 11:09:02 +0100	[thread overview]
Message-ID: <9873549.lNWL4n7ouV@nailgun> (raw)
In-Reply-To: <64c4befa-111c-43c4-ba24-5f079e17c4c7@siemens.com>

On Donnerstag, 29. Jänner 2026 10:57 Jan Kiszka wrote:
> On 29.01.26 09:36, Richard Weinberger wrote:
> > On Donnerstag, 29. Jänner 2026 08:45 'Jan Kiszka' via upstream wrote:
> >> On 27.01.26 22:39, Richard Weinberger wrote:
> >>> Ensure that the task structure remains valid until the join operation is complete.
> >>> Previously, a race condition could cause the structure to be freed before
> >>> xnthread_join() accessed it, leading to a use-after-free scenario.
> >>
> >> Where exactly? xnthread_join performs some checks for the existence of
> >> the target, and it is locking it (find_get_pid).
> > 
> > xnthread_host_pid() in xnthread_join() dereferences the task struct via
> > task_pid_nr().
> 
> Then then next question would be what is protecting the task struct in
> case of userspace task. Is this here only papering over a more
> fundamental issue?

Hmm, for userspace I'd expect that Linux frees the task struct only after
the parent fetched the exit code? So, after zombie state.

Thanks,
//richard

-- 
​​​​​sigma star gmbh | Eduard-Bodem-Gasse 6, 6020 Innsbruck, AUT UID/VAT Nr:
ATU 66964118 | FN: 374287y



  reply	other threads:[~2026-01-29 10:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-27 21:39 [PATCH] Fix race between RTDM task termination and xnthread_join Richard Weinberger
2026-01-29  7:45 ` Jan Kiszka
2026-01-29  8:36   ` Richard Weinberger
2026-01-29  9:57     ` Jan Kiszka
2026-01-29 10:09       ` Richard Weinberger [this message]
2026-01-29 10:29         ` Jan Kiszka
2026-01-29 10:34           ` Richard Weinberger
2026-02-04 17:28             ` Jan Kiszka
2026-02-04 17:43               ` Richard Weinberger
2026-02-04 17:45                 ` Jan Kiszka

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=9873549.lNWL4n7ouV@nailgun \
    --to=richard@sigma-star.at \
    --cc=jan.kiszka@siemens.com \
    --cc=richard@nod.at \
    --cc=upstream+xenomai@sigma-star.at \
    --cc=upstream@sigma-star.at \
    --cc=xenomai@lists.linux.dev \
    /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 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.