The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Chris Mason <mason@kernel.org>
To: brauner@kernel.org, oleg@redhat.com, ast@kernel.org,
	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, mason@kernel.org
Subject: [PATCH 0/3] fork, exit: fix BPF use-after-frees on task pointers
Date: Thu,  3 Dec 2026 15:06:09 -0500	[thread overview]
Message-ID: <20261203200612.26376-1-mason@kernel.org> (raw)

Hi everyone,

These are AI generated fixes for a few ways that BPF programs can follow
task_struct pointers into freed memory.

Patch 1 fixes the parent pointers of new tasks and idle tasks, patch 2
fixes the parent and leader pointers of released tasks, and patch 3 stops
the BPF thread iterator from starting at a released task.

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.

Chris Mason (3):
  fork: make the creator the parent of an unlinked task
  exit: don't leave stale parent and leader pointers
  bpf: Don't start a thread walk at a released task

 kernel/bpf/task_iter.c |  3 +++
 kernel/exit.c          | 22 +++++++++++++++++++++-
 kernel/fork.c          | 40 ++++++++++++++++++++++++++--------------
 3 files changed, 50 insertions(+), 15 deletions(-)


base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
-- 
2.55.0


             reply	other threads:[~2026-12-03 20:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 20:06 Chris Mason [this message]
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: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

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=20261203200612.26376-1-mason@kernel.org \
    --to=mason@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=andrii@kernel.org \
    --cc=ast@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=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