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=1796443358; b=XEIBsUlVLfWcb0Xde+ZK+ceMFAOqNxYej4eOrmdnF/SG5ScE1Hx9Cbl67ZnG0fB0A/ng mW0Tva9ACgWw/xGBv0LwkFPo/PdkmeBfkDGj5YZ76JC/QJjxR2iPkKAjZs/4TpvAWHtIz 3Q/9rlVMtHM8n8qX1P7RvDiLy545kVcU8I9sl6gxxzdeeZLYwTewBdquitVei2C64rKiq Ih0TUUC1AkoFdbRp/MOG/rZqUkAbDQNQj7ZiqLeQf1tXh6WRaK+gK5gjP0ymYGW3SriKJ jpLT1EcAxvvDnx6VAAInGGcr8f+jHmWXjGzNeJoI6dtw37K6T7eldkcQBpllfXihmWg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796443358; h=Received:DKIM-Signature:Content-Type:MIME-Version:Message-Id: In-Reply-To:References:Subject:From:To:Cc:Date; bh=7pwynEt60VLm8w7Qm0kGDcrMMqFTKMqkQIqF4jRdSs0=; b=dLaMaRH2TW5U6gWYU05Uovj5NqfKXZwoZnZI97UntloRdImULYFugu7fLvGZcMTayoVa oNXfk7ctI/8iucExVC2l6pdfkJpPG6nDs6QwHiL5zxru2CX7RmSQ3TkAviPKxDpqbvkfs +Afquld7XbBfJaztdD1HG6BjmOLQFgzl2tSD6OZVLcsb+HrIkXsp7r9Z3TA/VFF22vYZP PqaFc/G2VWQ+6dEiZprI0shN6iNy/TclsGqrQznSQaTB3pFwu5ygAVjGiAo9SMPdvGNYH dbUBg8xL9wLaJLF1tXm4Pxp503Lz9svVpq/B+s0hcQPxiJ7GAvfGFu68dVlPCrVjMdA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="LjiGm1N/"; 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 A9B27606A335; Sat, 5 Dec 2026 04:02:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LjiGm1N/ Received: by smtp.kernel.org (Postfix) with ESMTPSA id E06EA1F00A07; Sat, 5 Dec 2026 04:02:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796443358; bh=7pwynEt60VLm8w7Qm0kGDcrMMqFTKMqkQIqF4jRdSs0=; h=In-Reply-To:References:Subject:From:To:Cc:Date; b=LjiGm1N/ezXS9Pp55CcCHdvFpU1n9i7vcpw4u8iGuC/xYuG4OS/G8Y+zXXoX/525f UJkP1RWnqx1G3mY1jm3u9qagUmSkRaCgLYNDlKLqg2ui6QaNPhrNsEbScweKpQ0jLc TxWI0iIchovsI4BMMlJOIHxGWLu1P/Il+6gIT5zPPOWNiua6HY/9kQaySGvohYIoVh nVhyCLzvpKNWEdGYuyHZPFzWi5mWLhCKpfQrpD/yJZ6FBJQ3RKA1i9wY+P89CNqzJm iJlP+3+2+EMB5mMu76UHH5j9OfE3VkAK6YY5yuecuiTQ5a7XdrJKMvsc0jDkbdiFjR hnHzKmNFW4XAQ== Content-Type: multipart/mixed; boundary="===============2719597146281391332==" 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 Message-Id: <69c9bd0ba7f8a4012dcfcc553ddc7dca76da11f2cf14fbb1c9d56f5273abb00c@mail.kernel.org> In-Reply-To: <20261205032633.1702772-21-jarkko@kernel.org> References: <20261205032633.1702772-21-jarkko@kernel.org> Subject: Re: [RFC PATCH v10 20/28] proc: Implement ->set_run() fs_context operation From: bot+bpf-ci@kernel.org To: jarkko@kernel.org,fsdevel@vger.kernel.org Cc: jarkko@kernel.org,bpf@vger.kernel.org,containers@lists.linux.dev,linux-api@vger.kernel.org,linux-arch@vger.kernel.org,linux-doc@vger.kernel.org,linux-fsdevel@vger.kernel.org,linux-integrity@vger.kernel.org,linux-kernel@vger.kernel.org,linux-kselftest@vger.kernel.org,linux-mm@kvack.org,linux-security-module@vger.kernel.org,aleksa@amutable.com,alex@amutable.com,viro@zeniv.linux.org.uk,ast@kernel.org,akpm@linux-foundation.org,andrii@kernel.org,luto@amacapital.net,arnd@arndb.de,baolin.wang@linux.alibaba.com,bsegall@google.com,brauner@kernel.org,daniel@iogearbox.net,david@kernel.org,dhowells@redhat.com,dwmw2@infradead.org,dave@stgolabs.net,dietmar.eggemann@arm.com,eddyz87@gmail.com,emil@etsalapatis.com,ebiggers@kernel.org,georgia.garcia@canonical.com,giuseppe@scrivano.org,gnoack@google.com,hughd@google.com,ihor.solodrai@linux.dev,mingo@redhat.com,jmorris@namei.org,jack@suse.cz,jgg@nvidia.com,jlayton@kernel.org,jolsa@kernel.org,john.johansen@canonical.com,corbet@lwn.net,josef@toxicpand a.com,juri.lelli@redhat.com,kees@kernel.org,kprateek.nayak@amd.com,kpsingh@kernel.org,memxor@gmail.com,lennart@poettering.net,liam@infradead.org,manfred@colorfullife.com,martin.lau@linux.dev,matt@bobrowski.net,mgorman@suse.de,mhocko@suse.com,mic@digikod.net,rppt@kernel.org,neal@gompa.dev,oleg@redhat.com,paul@paul-moore.com,ptikhomirov@virtuozzo.com,peterz@infradead.org,rdunlap@infradead.org,serge@hallyn.com,sergeh@kernel.org,skhan@linuxfoundation.org,song@kernel.org,stephen.smalley.work@gmail.com,rostedt@goodmis.org,vschneid@redhat.com,vincent.guittot@linaro.org,yonghong.song@linux.dev,zygmunt.krynicki@canonical.com,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev Date: Sat, 5 Dec 2026 04:02:31 +0000 (UTC) --===============2719597146281391332== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit > proc: Implement ->set_run() fs_context operation TL;DR: The procfs gid= change may be an unintended user-visible behaviour change: mounts and remounts that worked before (e.g. with pidns= or from an ancestor userns) may now fail with -EINVAL. Should it be a separate patch? > diff --git a/fs/proc/root.c b/fs/proc/root.c > --- a/fs/proc/root.c > +++ b/fs/proc/root.c [ ... ] > @@ -178,7 +180,9 @@ static int proc_parse_param(struct fs_context *fc, struct fs_parameter *param) > > switch (opt) { > case Opt_gid: > - ctx->gid = result.uint_32; > + if (!kgid_has_mapping(fc->user_ns, result.gid)) > + return invalfc(fc, "Invalid gid"); > + ctx->gid = result.gid; > break; [ ... ] > @@ -234,8 +241,11 @@ static int proc_apply_options(struct proc_fs_info *fs_info, > ctx->pidonly != fs_info->pidonly) > return invalf(fc, "proc: subset=pid cannot be changed\n"); > > - if (ctx->mask & (1 << Opt_gid)) > - fs_info->pid_gid = make_kgid(user_ns, ctx->gid); > + if (ctx->mask & (1 << Opt_gid)) { > + if (!kgid_has_mapping(fc->user_ns, ctx->gid)) > + return invalfc(fc, "Invalid gid"); > + fs_info->pid_gid = ctx->gid; > + } Is it intended to change how gid= is handled for every procfs mount and remount, rather than only run-bound ones? The changelog only describes ->set_run(). The option used to be a u32 converted with make_kgid(current_user_ns(), ...) when applied. It is now converted at parse time by fs_param_is_gid(), and the resulting kgid must also be mapped in fc->user_ns, both in proc_parse_param() and in proc_apply_options(). Mounts that worked before can now fail with -EINVAL when the caller's user namespace is an ancestor of the procfs owner and the group is not mapped into that owner. For example, host root runs: mount -t proc -o pidns=/proc//ns/pid,gid= proc /mnt against a user-namespaced container. proc_parse_pidns_param() sets: fc->user_ns = get_user_ns(ctx->pid_ns->user_ns); to the container's user namespace. If gid= comes after pidns=, proc_parse_param() rejects it immediately with "Invalid gid". If gid= comes first, proc_fill_super() -> proc_apply_options() rejects it. Before the patch both orders succeeded and pid_gid was set to the host kgid. The same happens when host root enters only the container's pid and mount namespaces (nsenter -p -m, without -U) and mounts or remounts proc with gid=. For a remount, fc->user_ns is s_user_ns, which is now kept by the new FS_CONTEXT_FOR_RECONFIGURE branch in proc_init_fs_context(). Also, gid=4294967295 is now refused by fs_param_is_gid()'s gid_valid() check, where before it was silently stored as INVALID_GID. The stricter rule matches tmpfs, devpts and bpffs and may well be intended, but it is a user-visible restriction on an existing mount option, and Documentation/filesystems/proc.rst does not mention it. The s_fs_info move in proc_fill_super() and the reconfigure branch in proc_init_fs_context() exist only to support this new check. Should the gid change be a separate patch, with its own rationale and a note on the compatibility impact for pidns= and remount users? [ ... ] --- AI reviewed your patch. Please fix the bug or email reply why it's not a bug. See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md CI run summary: https://github.com/kernel-patches/bpf/actions/runs/47474652355 --===============2719597146281391332==--