Article View: muc.lists.freebsd.hackers
Article #68Re: [PATCH] NFSv4.2: request mode after CLONE
From: Rick Macklem
Date: Tue, 27 Oct 2026 23:47
Date: Tue, 27 Oct 2026 23:47
84 lines
8738 bytes
8738 bytes
On Tue, Oct 27, 2026 at 7:06 AM Cedric Blancher
<cedric.blancher@gmail.com> wrote:
>
> Good afternoon!
>
> Does the FreeBSD NFSv4.2 client request the mode after the update?
Yes.
>
> Ced
>
> ---------- Forwarded message ---------
> From: Felix Hoffmann <f3lix.dev@gmx.de>
> Date: Sun, 2 Aug 2026 at 21:58
> Subject: [PATCH] NFSv4.2: request mode after CLONE
> To: Trond Myklebust <trondmy@kernel.org>, Anna Schumaker <anna@kernel.org>
> Cc: Peng Tao <tao.peng@primarydata.com>, <linux-nfs@vger.kernel.org>,
> <linux-kernel@vger.kernel.org>
>
>
> The NFS server can clear setuid and setgid bits when CLONE modifies the
> destination. The client currently omits mode from the post-operation
> attributes, so the cached mode can retain setid bits after the server has
> removed them. A local process can then execute the file using those stale
> privilege bits.
>
> Request mode in the CLONE compound's GETATTR. This lets the ordered
> post-operation update install the server's mode before CLONE returns.
>
> Fixes: e5341f3a5762 ("nfs42: add CLONE proc functions")
> Cc: stable@vger.kernel.org
> Assisted-by: Codex:gpt-5
> Signed-off-by: Felix Hoffmann <f3lix.dev@gmx.de>
> ---
> Tested on x86-64 using an NFSv4.2 loopback mount with Linux NFSD and a
> Btrfs export:
>
> - before this change, the client retained mode 04775 while the server
> stored mode 0775, and the privilege transition reproduced in 10/10
> non-debug runs
> - with this change, both client and server reported mode 0775 and no
> privilege transition occurred in 10/10 non-debug runs or 3/3 KASAN
> runs
>
> The reproducer requires write authorization to the destination; NFSD
> rejected the same operation against a non-writable 04755 file with EACCES.
> A working reproducer is available privately on request.
>
> fs/nfs/nfs42proc.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
> index ab86246fc364..35a4909d51b7 100644
> --- a/fs/nfs/nfs42proc.c
> +++ b/fs/nfs/nfs42proc.c
> @@ -1302,7 +1302,8 @@ static int _nfs42_proc_clone(struct rpc_message
> *msg, struct file *src_f,
> return -ENOMEM;
>
> nfs4_bitmask_set(dst_bitmask, server->cache_consistency_bitmask,
> - dst_inode, NFS_INO_INVALID_BLOCKS);
> + dst_inode,
> + NFS_INO_INVALID_BLOCKS | NFS_INO_INVALID_MODE);
>
> status = nfs4_call_sync(server->client, server, msg,
> &args.seq_args, &res.seq_res, 0);
> --
> 2.43.0
>
>
>
> --
> Cedric Blancher <cedric.blancher@gmail.com>
> [https://plus.google.com/u/0/+CedricBlancher/]
> Institute Pasteur
>
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID:
<CAM5tNy4_kw9JV1QgXrXLfiCkK2v90pH50-GXoDBtKq64UCg3Kg@mail.gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mailReferences:
<CALXu0UehOWLoY8cnHXPDeHYxUB2XUNwzPzzxDeYJ6DZeScz9sQ@mail.gmail.com> <>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail
From: Rick Macklem <rick.macklem@gmail.com>
Newsgroups: muc.lists.freebsd.hackers
Subject: Re: [PATCH] NFSv4.2: request mode after CLONE
Date: Tue, 27 Oct 2026 16:47:01 -0700
Organization: Newsgate at muc.de e.V.
Sender: owner-freebsd-hackers@FreeBSD.org
Approved: news-admin@muc.de
Distribution: world
Message-ID: <CAM5tNy4_kw9JV1QgXrXLfiCkK2v90pH50-GXoDBtKq64UCg3Kg@mail.gmail.com>
References: <CALXu0UehOWLoY8cnHXPDeHYxUB2XUNwzPzzxDeYJ6DZeScz9sQ@mail.gmail.com> <>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2";
logging-data="20533"; mail-complaints-to="news-admin@muc.de"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
t=1793144839; h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:cc:mime-version:mime-version:
content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:list-id:list-help:
list-owner:list-unsubscribe:list-subscribe:list-post;
bh=xjqx/pcqKb2ZbD6DXjPK4J3HXzmkH4hkbS/eQ0OeYHw=;
b=Ycj4fb/VfJ8SoW87rPnQ3fWp6gkibAYRYtEZxgP8f3eA0LoPpYohAPndiJWAFXFAgT7DjQ
Hr3X3ldQUDn34R8JMQEklxnyXcX7JlRrE7Tk02t+u9PCUla06BCQRNYchXZEtXSnfRok11
U91KnGTEQ2jCpftmd/DvHbxzTo8t96lz9mYNl1tjIHAaUQ6abubWSyKaySGOpOn0asTZCU
HyJPQhdSIQQ/ilvy1h/ftJuqzxGUU6Q3WYwYt+eLxN3cqy3hqVjtTimgGfq8AvkP/jvuKC
EKOHdb+t8tGG3G2fZv/qFnYnBvsTPFOn/uA2UX/fOk2EA3ypkXags2KphdyVMg==
X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org
Authentication-Results: mx1.freebsd.org;
dkim=pass header.d=gmail.com header.s=20260707 header.b=fZqQxwZa;
arc=pass ("google.com:s=arc-20260327:i=1");
spf=pass (mx1.freebsd.org: domain of rick.macklem@gmail.com designates 2a00:1450:4864:20::529 as permitted sender) smtp.mailfrom=rick.macklem@gmail.com;
dmarc=pass (policy=none) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1793144833; x=1793749633; darn=freebsd.org;
h=content-transfer-encoding:content-type:cc:to:subject:message-id
:date:from:in-reply-to:references:mime-version:from:to:cc:subject
:date:message-id:reply-to:content-type;
bh=xjqx/pcqKb2ZbD6DXjPK4J3HXzmkH4hkbS/eQ0OeYHw=;
b=fZqQxwZa7ciF9MlQBwmeaJG/CsiZ5pkVaB+QhWTTwIAhSC7aXwUzuDsM+ad+MA5uX/
pX9OW76i3ozK/VxYHPBrWT0JJBqtG4HwhzkKuNYnrK0+keh/tTzZ3jj552fr70lDN95K
kLHfdaKNPlAwy5GS0AmRvUheXpkocMuyzgbAn4ERFcfBtNTroNmMdyS2Oajb52XAqT7R
E77vDBnWs+8XDBL15L8ldXH3bUBKi1F7+EFVMIHlT3hJAwrsTmZrPQA8yI709cbsvWgi
gwyyxKOx6lfqpMuKADHlWLME9BNpnE9Q507TB7udMdlgVpNtxr59KJbGotcejsLHf2gJ
CiBQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1793144833; x=1793749633;
h=content-transfer-encoding:content-type:cc:to:subject:message-id
:date:from:in-reply-to:references:mime-version:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=xjqx/pcqKb2ZbD6DXjPK4J3HXzmkH4hkbS/eQ0OeYHw=;
b=OHNNgvNqMpzc2nyFeegaUepP3YqYpy6dKCdItMJA9c+4NRkEig01CAToSPEPcjAb2K
Wew6PdRTQRM2Bo61DBrTG01x04SlP0lzCn8gPvRJfKJdaaRoeZgH/MxbXqf15s86J4P/
5q3itKw1qMsiiPYPd7Uc6+7ebatw0+AKL5DFu7hZ59tko95McuGJBTz6hXS9/Zyw2roh
TPn+BtYV6UqbhO1OWRxS0CRIRmU1q2S/voS+Ms1MFPgyxWAQe57nkNa6Zjah2yMY/E99
LDgYIWwgxEP/+27r4t22yfEQFNqVKTdr5tY8GkJMTcRdediQpf7gqq/1+8kdW5keBHp9
4y6g==
X-Gm-Message-State: AFq9FYIqRi7yKamQ9Y8xXepdxc47u6g0L2dUUdLAxBkN/dk1PsPREeUQ
0CMQIZuGdQkYDuHApwXX1H2mi1HK3/LXoxKf+L+hgxbzdSj170Y/xC8yJLW+kZ7XPeZ1Kjj+DOy
Mslm4NOnXH1TuLehUnW2KGCHwHbEqrhGt
X-Gm-Gg: AYBFou2yyNnX3ol4FnxAHwFPvbPu/2Qgh9Th3jDsflv/fKF6cKgr6/9/9e3vXSBmqAW
0gw4r6yVDgZJf6rktnMh2MFsVG9+D4ttFbJoCWaWA6dFvBqK0g6mTDLvWh9nbTIDBOqQiL5/L/a
r2UA645n/+twwKo56ZKwx3wQgr3ganQlmxLp9IfyX+Ll9ayYVjy/6nnmt2weBkuqwMZd3c5SBT+
i8X0N60ehC5nuTRurv+G9Zs4FsmdvErCD7RjJhjT4h0weADv6ZoZUMBiYOZaz4h32YFBQ51T9X9
U8KbYObMl/Fxt+/7Zhy3c1qijrWes9as+JLvF54fLLz2dkGvm40YfJRFhCUYELUPjEJTX8gWA8q
uFwETb22LFaGLUdwnoLVpEQAaobKsPWt8lDQSuA==
Precedence: list
In-Reply-To: <CALXu0UehOWLoY8cnHXPDeHYxUB2XUNwzPzzxDeYJ6DZeScz9sQ@mail.gmail.com>
X-Gm-Features: AclHuK9xoZO32EMXJ-fj4Oo5H4iAO2Nxt_ogJQAtCHXMO8niBAJToay_gjzj9gc
X-Spamd-Bar: --
X-Spamd-Result: default: False [-2.00 / 15.00];
ARC_ALLOW(-1.00)[google.com:s=arc-20260327:i=1];
DMARC_POLICY_ALLOW(-0.50)[gmail.com,none];
R_DKIM_ALLOW(-0.20)[gmail.com:s=20260707];
R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4864::/56];
MIME_GOOD(-0.10)[text/plain];
ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US];
RCVD_COUNT_ONE(0.00)[1];
TO_DN_SOME(0.00)[];
MISSING_XM_UA(0.00)[];
MIME_TRACE(0.00)[0:+];
FREEMAIL_ENVFROM(0.00)[gmail.com];
FREEMAIL_FROM(0.00)[gmail.com];
MID_RHS_MATCH_FROMTLD(0.00)[];
FREEMAIL_TO(0.00)[gmail.com];
RCPT_COUNT_TWO(0.00)[2];
TO_MATCH_ENVRCPT_SOME(0.00)[];
FROM_EQ_ENVFROM(0.00)[];
FROM_HAS_DN(0.00)[];
RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::529:from];
DWL_DNSWL_NONE(0.00)[gmail.com:dkim];
RCVD_TLS_LAST(0.00)[];
PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org];
MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org];
ALIAS_RESOLVED(0.00)[];
DKIM_TRACE(0.00)[gmail.com:+]
X-Rspamd-Queue-Id: 4jDnGX3N27z4g21
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes