The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Chris Mason" <mason@kernel.org>, <brauner@kernel.org>,
	<oleg@redhat.com>, <daniel@iogearbox.net>, <andrii@kernel.org>,
	<bpf@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <akpm@linux-foundation.org>, <peterz@infradead.org>,
	<mingo@redhat.com>, <kees@kernel.org>, <tj@kernel.org>,
	<eddyz87@gmail.com>, <memxor@gmail.com>,
	<yonghong.song@linux.dev>, <martin.lau@linux.dev>,
	<song@kernel.org>, <jolsa@kernel.org>, <emil@etsalapatis.com>,
	<ihor.solodrai@linux.dev>, <sched-ext@lists.linux.dev>
Subject: Re: [PATCH 0/3] fork, exit: fix BPF use-after-frees on task pointers
Date: Fri, 04 Dec 2026 02:36:25 +0000	[thread overview]
Message-ID: <DNBLK9RDUGDB.9IRD3EGPT1GZ@gmail.com> (raw)
In-Reply-To: <20261203200612.26376-1-mason@kernel.org>

On Thu, Dec 03, 2026 at 12:06 PM Chris Mason <mason@kernel.org> wrote:
> These are AI generated fixes for a few ways that BPF programs can follow
> task_struct pointers into freed memory.

The bugs look real. fork and exit are the right place to fix them imo.
The verifier can't tell a released task from a live one.

BUT the title is misleading.
The kernel has the same bug without bpf. fill_stats_for_pid() holds
a reference on tsk and nothing else. Then bacct_add_tsk() reads
tsk->group_leader->start_time.

> Patch 2 makes a released thread hold a reference on its group leader,
> which I don't love.  If there are better ideas, I'm happy to get
> the bots cranking on them.

I don't see a different option.

Oleg,
pls review.

Christian,
if it looks good to folks, could you take patches 1-2 via your tree?
I'll take patch 3.

      parent reply	other threads:[~2026-12-04  2:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 20:06 [PATCH 0/3] fork, exit: fix BPF use-after-frees on task pointers Chris Mason
2026-12-03 20:06 ` [PATCH 1/3] fork: make the creator the parent of an unlinked task Chris Mason
2026-12-03 20:06 ` [PATCH 2/3] exit: don't leave stale parent and leader pointers Chris Mason
2026-12-03 20:55   ` bot+bpf-ci
2026-12-03 20:06 ` [PATCH 3/3] bpf: Don't start a thread walk at a released task Chris Mason
2026-12-03 20:42   ` bot+bpf-ci
2026-12-04  2:36 ` Alexei Starovoitov [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=DNBLK9RDUGDB.9IRD3EGPT1GZ@gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=jolsa@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mason@kernel.org \
    --cc=memxor@gmail.com \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sched-ext@lists.linux.dev \
    --cc=song@kernel.org \
    --cc=tj@kernel.org \
    --cc=yonghong.song@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox