From: Thomas Gleixner <tglx@kernel.org>
To: Oleg Nesterov <oleg@redhat.com>,
Frederic Weisbecker <frederic@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org,
Wongi Lee <qw3rtyp0@gmail.com>, Jungwoo Lee <jwlee2217@gmail.com>,
stable@vger.kernel.org, x86@kernel.org
Subject: Re: [tip: timers/urgent] posix-cpu-timers: Prevent UAF caused by non-leader exec() race
Date: Wed, 08 Jul 2026 20:04:19 +0200 [thread overview]
Message-ID: <87v7apqrx8.ffs@fw13> (raw)
In-Reply-To: <ak5-L-1SzGPEc0_i@redhat.com>
On Wed, Jul 08 2026 at 18:43, Oleg Nesterov wrote:
> On 07/08, Frederic Weisbecker wrote:
>>
>> > There is a similar problem vs. posix_cpu_timer_set(). For regular posix
>> > timers it just transiently returns -ESRCH to user space, but for the use
>> > case in do_cpu_nanosleep() it's the same UAF just that the k_itimer is
>> > allocated on the stack.
>>
>> do_cpu_nanosleep() only targets current and since it's on the stack, no
>> other task can access it. And the current task can't be exiting/exec'ing
>> while calling posix_cpu_timer_set() on that stack timer.
>
> I thought the same initially, but it seems that this is not true...
Indeed.
> I can never understand this API, but it seems that
> sys_clock_nanosleep() can target the !current processes/threads ?
It obviously can't target the current thread because how would that
accumulate run-time when it's sleeping?
It can target the current or some other process, so it's subject to the
non-leader exec race.
> Or why else we have clock_getcpuclockid() ?
To express which thread or thread group the sleep should be on. It's
exactly the same as timer_create() + timer_set(). It sleeps until that
clock accumulated enough runtime, while regular posix-timers either wait
for a signal or handle it async.
Thanks,
tglx
next prev parent reply other threads:[~2026-07-08 18:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-05 9:46 [tip: timers/urgent] posix-cpu-timers: Prevent UAF caused by non-leader exec() race tip-bot2 for Thomas Gleixner
2026-07-08 16:06 ` Frederic Weisbecker
2026-07-08 16:43 ` Oleg Nesterov
2026-07-08 18:04 ` Thomas Gleixner [this message]
2026-07-08 18:35 ` Oleg Nesterov
2026-07-08 20:27 ` Frederic Weisbecker
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=87v7apqrx8.ffs@fw13 \
--to=tglx@kernel.org \
--cc=frederic@kernel.org \
--cc=jwlee2217@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=qw3rtyp0@gmail.com \
--cc=stable@vger.kernel.org \
--cc=x86@kernel.org \
/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