From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796328376; b=FvcXmy91VoBUCVvhaXJjDIJ9hPo5+rqrh6gd97ZFcDuIJP2sUwnVTBiVU38Ld6/daqRO S9sf6P8Ar/qIygvbxjnMZVjBre+9SvebqrVDWCIdhXHpEPTpvDoTuimY+ykvpvy17/h5F 51wurtI49a/L2LmIsH1znJWSiM+wIPhmcDwj0n+xJe1prhq5oO8HXNiaIgzn+Rmkpxdq3 wqB1BBaFG6fTuumFX6fBRPrmZTi5uAAbLzcHPewrDinQjwrzVHYqx7Rj84znTXT7Qi+1j a6FpvRxUCiptxz9zzgw+Rojl6ZuiSphlo0bFPrQAQFCg+tc4ioPV8wNVxe4QykwBMnw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796328376; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Transfer-Encoding; bh=o41IN9Y6zdhttc+fTrbGT4YcQ43Wg8swWPrBB1nz1Kw=; b=p1yppS3za4WzPe1nffwbxQIWac9n5m7jov+K2r6jahmH3v7Jalpm6TKfW97ZASM8c9Ih fnrU3kAZZamQxrT+xYGd9K+aUL99Gtty7ZjIp9KaDqOizQRBhTshqeEOBzudvEClGxIhn K9BCR16tk2vqkLSY7PGfh01MmHpZSCZBFe/BTgKLdlgefidlK0UMBP2mRfeqMCDKsoVGM DFDHF6j5nAx+CLl9IIlm8/l2s0UpiLOxUERF7MiCz/Jfh9lCzT/6mDveIvVEv1F5QAH+W KvqYHGcpmkqLXRkuuvh/38wRBd1KAYqYK6zq3Gp0mJN2G4ezIv3QxmXE2ZSN1QK4L8A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="K80tklK/"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B06B8606A33E; Thu, 3 Dec 2026 20:06:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=K80tklK/ Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB8051F0092B; Thu, 3 Dec 2026 20:06:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796328376; bh=o41IN9Y6zdhttc+fTrbGT4YcQ43Wg8swWPrBB1nz1Kw=; h=From:To:Cc:Subject:Date; b=K80tklK/ZSkflW5LtJM/TP4ibQ0vkdP9AsVRTyVhnyPxu6QdnZLMxVupHQvXWKqad UMZhGosAhxQLexkSDq19CrnjGiVfIzG6Js9ULN7/qhOT0lMrVa1Q9i1ZYyR3muY/7G 38SiUnKe4/uxPUifyLY/ivKYfnxEYi+H1hhW3HwaZVd7uTuwyZV7+SXkgegEA3iAP8 TgK2s7q9OdOP9FaxW+GsxZ6ffM2Yqe1+0hNzXA7x7nhXR85fXW3VtMbjjsUKLPdKn3 ctlRwnT6P2Q680yLVSosIjLAxOJl8U4ocZC1uck7NrIQi2z+wsFjzvCndBBJK0UsUI tpdRo6Prn0+3g== From: Chris Mason 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 Message-ID: <20261203200612.26376-1-mason@kernel.org> X-Mailer: git-send-email 2.55.0 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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