From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE4F1606A337 for ; Tue, 1 Dec 2026 03:26:32 +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=fcfHjjyy Received: by kanga.kvack.org (Postfix) id DF0BA6B05E4; Mon, 30 Nov 2026 22:26:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DC7856B05E5; Mon, 30 Nov 2026 22:26:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CDE2F6B05E6; Mon, 30 Nov 2026 22:26:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 9F2E06B05E4 for ; Mon, 30 Nov 2026 22:26:31 -0500 (EST) Received: from smtpin10.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 24C1D1A0C26 for ; Tue, 1 Dec 2026 03:26:31 +0000 (UTC) X-FDA: 85493976582.10.10F2322 Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf03.hostedemail.com (Postfix) with ESMTP id 6F48220009 for ; Tue, 1 Dec 2026 03:26:29 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=fcfHjjyy; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf03.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796095589; b=7gGSHosFnMJ7m06O3Hdz6NPE05QWKHOAIfyUTDihg3I8YnKb+9+JlwxYuz/z8H21noGKlz DH0GjOhnB+waLV6RisDzWjimi1t9GXdEogjxj+PteOIH8ficQQi8LaS8D4Vf6Di54ajds8 duPmtDvW/boOxYqs/Y9e4eYMRGZ5UFU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796095589; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=E0scMMTFf3cEAJCLXJ2LDAtU+DW460lJlZpIsPvZfDs=; b=jVBAW7kTVuXZPXf0tnu3R/uBTgMKMOLNDjCy7WlR62ofndB6GfCen9iswiJzRQuTA1JxNo CGbD7432v0ZOIsyCj+k+YorLysCcG8Tqmp3F40Zx+PdpLPn0iURAeoeVSJYLGzgy1MeoNu mcJwSxDnhc31EFAjui8hcDbCGFs0NNY= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=fcfHjjyy; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf03.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 5CC70439C5; Tue, 1 Dec 2026 03:26:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51B861F000C1; Tue, 1 Dec 2026 03:26:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796095588; bh=E0scMMTFf3cEAJCLXJ2LDAtU+DW460lJlZpIsPvZfDs=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=fcfHjjyyHIAIoCzdROcnsbNssv7+zLnmaZt+94KXfW608HRc9ozSlh8mS3ffnTl2C 3AvHdPk1kVUyUoPSwOaBi+K/Dd3g1CELTEsIZrYQt0WzL0D7boLI45lZyRpzNikOdn /SfGWuIRwiN93z+Hb/PSs6AV8iS2vyA3/ENRBVbXMPuFtXbuVoWhftjodAyxHbKqX1 gGpcvzoPStCiQc3gviPa0WU2nxFZ87a4sWMz0ya7Hej+7y+6zDIAKi9afVuoAt0S70 3EYi+F2JZ4zMD0V276Y0/Jm8djqFEnUWubvi3W+E8IVjx9VnLJUVz81Aq6qqTh/sxi +gGZIb25zXuYw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [RFC PATCH v9 22/29] ipc/mqueue: Implement ->set_nsexec() fs_context operation Reply-To: sashiko-reviews@lists.linux.dev To: "Jarkko Sakkinen" Cc: bpf@vger.kernel.org, linux-mm@kvack.org, linux-security-module@vger.kernel.org, "Aleksa Sarai" , "Alexander Mikhalitsyn" , "Alexander Viro" , "Alexei Starovoitov" , "Andrew Morton" , "Andrii Nakryiko" , "Andy Lutomirski" , "Arnd Bergmann" , "Baolin Wang" , "Ben Segall" , "Christian Brauner" , "Daniel Borkmann" , "David Hildenbrand" , "David Howells" , "David Woodhouse" , "Davidlohr Bueso" , "Dietmar Eggemann" , "Eduard Zingerman" , "Emil Tsalapatis" , "Eric Biggers" , "Georgia Garcia" , "Giuseppe Scrivano" , =?utf-8?b?R8O8bnRoZXIgTm9hY2s=?= , "Hugh Dickins" , "Ihor Solodrai" , "Ingo Molnar" , "James Morris" , "Jan Kara" , "Jason Gunthorpe" , "Jeff Layton" , "Jiri Olsa" , "John Johansen" , "Jonathan Corbet" , "Josef Bacik" , "Juri Lelli" , "Kees Cook" , "K Prateek Nayak" , "KP Singh" , "Kumar Kartikeya Dwivedi" , "Lennart Poettering" , "Liam R. Howlett" , "Manfred Spraul" , "Martin KaFai Lau" , "Matt Bobrowski" , "Mel Gorman" , "Michal Hocko" , =?utf-8?b?TWlja2HDq2wgU2FsYcO8bg==?= , "Mike Rapoport" , "Neal Gompa" , "Oleg Nesterov" , "Paul Moore" , "Pavel Tikhomirov" , "Peter Zijlstra" , "Randy Dunlap" , "Serge E. Hallyn" , "Serge Hallyn" , "Shuah Khan" , "Song Liu" , "Stephen Smalley" , "Steven Rostedt" , "Valentin Schneider" , "Vincent Guittot" , "Yonghong Song" , "Zygmunt Krynicki" In-Reply-To: <20261201031002.593830-23-jarkko@kernel.org> References: <20261201031002.593830-1-jarkko@kernel.org> <20261201031002.593830-23-jarkko@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 03:26:24 +0000 X-Rspam-User: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 6F48220009 X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Stat-Signature: ewkt8mexr98zbgumq93q9j6ixzp5xrzg X-HE-Tag: 1796095589-177110 X-HE-Meta: U2FsdGVkX19qgqylA7ZCBpcqFvaB5kzX3VxawnwcPbx2WfDq716N1ZM9vEA7cqRlVYQ3of5c3+F4txXbEUNFqoaqAadAOeSL6wL7NYJsug91g5vJ7u1AD2jc01QTKj0tPxCIrNzx7vyouBGtut7/DgaPwkT2gUWQkqzhQW2j9ihWUM22VgJTtzvkt0WC44QZemO6+q6Yx+0SGHq1NX4toU66BLtYT5aVTyhceCy31sgu8m2vX6JFT0JbaII0nRtjl0g5gN+yWAnglNz0TBBVsQQUxnlQ/B5uRrb5Bo84UWfCPUhrWEnEF7km+Iy40Ke50K/x8QDlC9BpjNqmjfL4SqLMp6XmIc2pAWLXfPbgz9r0vQoXISOS+o5IuhiEoEwnWHDXg6f7oeTESeEpuVtiA91WmRAj2zphER+qicGZVDDYcNutH8Yp7wLpYEX1oAOCBbdyt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/pYM9mhPInoVaovQZEuh6Ug8Kj/De97zh2rDewpKDbZqEJNtGEk/RAMVzmqP6fNVBbZSp6ZAmzEnpd8z6XEL0uQPtJwFa/HmZyyEfBNFidPbLalVAdGWCT3G1sz6O8tMOf6uXit0tN5ucUyfh/DWqNFkWH4fE54G3bFO9JhXbyRX12CwHLOdxX/RpScsBgKvZsTbxn82rYYzJWwY2y/Zvd7Zp8yCGfed9Jepa1Q4Ad3CFdGB8auDfZbcbfn3WkDHBet4q5xGh1vttVGen7XrzZOGGqEOpz/r4OFbIhO4HS6ZgennbAn+ypzWY6C4cVQFO7eml/rcR58e+o9buTxiuZ0jWZ40V7PyVan4etGi2NNgJvNuGA0BBCF6h6mHpgJNOU703dBcsinz4Tcuy43CGp0Jq3tJDYfg3oSBBZ7llOTt8U= Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Critical] ipc/mqueue: unlocked s_fs_info access in mqueue_init_fs_context() -- commit 067998e02a49b9e15984753bd84467279b66c72f Author: Jarkko Sakkinen ipc/mqueue: Implement ->set_nsexec() fs_context operation This commit implements the ->set_nsexec() fs_context operation for mqueue so that FSCONFIG_SET_NSEXEC binds the mount context to the target nsexec's IPC and user namespaces, and marks mqueue with FS_NSEXEC_MOUNT. > diff --git a/ipc/mqueue.c b/ipc/mqueue.c > index 322c3dd98c447..026462d9b40f9 100644 > --- a/ipc/mqueue.c > +++ b/ipc/mqueue.c [ ... ] > @@ -453,9 +468,13 @@ static int mqueue_init_fs_context(struct fs_context = *fc) > if (!ctx) > return -ENOMEM; > =20 > - ctx->ipc_ns =3D get_ipc_ns(current->nsproxy->ipc_ns); > - put_user_ns(fc->user_ns); > - fc->user_ns =3D get_user_ns(ctx->ipc_ns->user_ns); > + if (fc->purpose =3D=3D FS_CONTEXT_FOR_RECONFIGURE) { > + ctx->ipc_ns =3D get_ipc_ns(fc->root->d_sb->s_fs_info); [Severity: Critical] Can this race with put_ipc_ns() and cause a use-after-free on struct ipc_namespace? An mqueue superblock does not hold a reference to the ipc_namespace in sb->s_fs_info; instead, put_ipc_ns() drops the last reference and clears sb->s_fs_info under mq_lock (which is why get_ns_from_inode() takes mq_lock around get_ipc_ns(inode->i_sb->s_fs_info)). Without mq_lock, a reconfiguration context created via fspick() can read s_fs_info as the last reference is dropped: CPU0 CPU1 mqueue_init_fs_context() put_ipc_ns(ns) ns =3D fc->root->d_sb->s_fs_info ns_ref_put_and_lock(ns, &mq_lock) mq_clear_sbinfo(ns) spin_unlock(&mq_lock) schedule_work(&free_ipc_work) get_ipc_ns(ns) <-- refcount inc on 0 free_ipc() free_ipc_ns(ns) <-- frees ns mqueue_fs_context_free() put_ipc_ns(ctx->ipc_ns) <-- use-after-free Acquiring ctx->ipc_ns under spin_lock(&mq_lock) (or leaving ctx->ipc_ns as NULL for FS_CONTEXT_FOR_RECONFIGURE, since mqueue does not use it during reconfiguration) would avoid this race. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201031002.5938= 30-1-jarkko@kernel.org?part=3D22