From nobody Wed Jan 07 01:00:42 2026 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dm8qL2cfyz6N0Nb for ; Wed, 07 Jan 2026 01:01:02 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dm8qK5LS3z47GT for ; Wed, 07 Jan 2026 01:01:01 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20230601 header.b=JaR0sdH6; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of rick.macklem@gmail.com designates 2a00:1450:4864:20::532 as permitted sender) smtp.mailfrom=rick.macklem@gmail.com Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-64b58553449so2300578a12.1 for ; Tue, 06 Jan 2026 17:01:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767747654; x=1768352454; darn=freebsd.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+3pGtW7An/qlMAK+nriLpmukt+iIP2zbV3ePDvI6mTE=; b=JaR0sdH6XOv51RA0d+F6F/3wQszuWi7qCZMduG98zd1gkG26dB3AnUJ64WYDJgFDgz QVpYiMp7S7lUvTSvEqkbkJTQhtR3OfhVq3NCXdmMPzt9Qs8QyfmdkxgsRVo0jnPJNsez ap3w35t1N1lP9S/u57JDENMr5UkMJi6tg2bnc9Lw0ZTrs2WWhCzAwlAc+MOkXNUEQ5I2 /luhJkemQbM7IoYLnsBXC132uNhGjqZpBDjG2VwE/U92cihrVf3DACYpEQjk1ARXANly ezjwr+pnqynJxE7vcSoFRe5vj7+EK7QurfihE/mI6wlYaZT8aSUOfX0/i+OfvOWmZCMR weeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767747654; x=1768352454; h=content-transfer-encoding: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; bh=+3pGtW7An/qlMAK+nriLpmukt+iIP2zbV3ePDvI6mTE=; b=TTXblYBTzT2SxlQQGFqedyXhrI1zoio7AzsJ1Vi0GUNhmtJ0pnnRYri0djrjZM4iME eA1kkHC4iOA/aFAVSEmVvKssQXIuqw4+mQ8d2RCLTQyQFZJ+1Up7EWuoppr9W4iA5vRi +Z9jQa2jyOzdYT6/GFgXUoyDqtequuYHjX6Z4OVpYie08mbd72eB8Gwe4l0n9EjJNNrA ZVtVJHoRdf6ZTCW3Cg4MCYPeaLHOYCiWYm8tM4EH663rZseqnHXGCsm0Ftvy8p+e5xqB Iz0IPXIazfJNmm+G8PZM5o1rfNmnA2m1z1rTZw6x4h51MjK/6ssHNdkulyCbHMVbiEWF FYtQ== X-Gm-Message-State: AOJu0YzsufekBbdcO7/TjWOmbhwsdQfh7Iy1mCcQsWOxju8EqvNnFbF6 fE5/F5SGovL1dZ1apgi9JZtFdai1WdR5RZpi8QY1uxLq76O2YXXIbjVBKAlccTg+jBG5hCRUUNx PcN1PnzLy0lw+IXPXzW92eKkM/CBk6w== X-Gm-Gg: AY/fxX5ro1Xz90UVNPGt2ZaT9rOpwwph0LzI1z+ETgzecF/TdDEVIpNz5/awMEQnZ6i eMISNI8ufaOf6VzLB/5N2riShupReK2paN91p6VlPVOKGfR4XlcERjDcQbg7gOwAIF+06J8UvOC eC7ibusBdlSJVQZca+YC7/WnpIgI+FN9Nhebybw3BnE8fPcMZ+zRPjwLLplwjYaY1Jp9xXbgr3X lsswF8oaAw5TEEalLQnfejgdS9C9niROXzfbbFNnMvYF1B0GSC+V55zYdHvB8sfmTF0ati+9GcG yfH28GRyslxD/Tpbicg/XtIvIhjCuZWPHsJApFw= X-Google-Smtp-Source: AGHT+IFc1JExouNsMiZ4Q9WtZA1x4S4ZgSzg4TCOdMj6p1oGRmDPdgesoJTbCPUw7i5LzAcrUSNWf8mD1pEfMH0YViE= X-Received: by 2002:a05:6402:2546:b0:64d:2769:8481 with SMTP id 4fb4d7f45d1cf-65097e946e6mr692849a12.33.1767747653862; Tue, 06 Jan 2026 17:00:53 -0800 (PST) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org MIME-Version: 1.0 References: In-Reply-To: From: Rick Macklem Date: Tue, 6 Jan 2026 17:00:42 -0800 X-Gm-Features: AQt7F2qkW_iZus1uHZz0mcdXUvUWQ3AV-XT-FS7Tbpws5REOtXszPU8ueBMByj0 Message-ID: Subject: Re: FreeBSD 15.0 nfsd makes all write accesses EPERM To: =?UTF-8?Q?Aur=C3=A9lien_Couderc?= Cc: freebsd-hackers@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: --- X-Spamd-Result: default: False [-4.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.998]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; RCVD_TLS_LAST(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_SOME(0.00)[]; TAGGED_FROM(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; MISSING_XM_UA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; MID_RHS_MATCH_FROMTLD(0.00)[]; TAGGED_RCPT(0.00)[]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; RCVD_COUNT_ONE(0.00)[1]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::532:from] X-Rspamd-Queue-Id: 4dm8qK5LS3z47GT On Tue, Jan 6, 2026 at 3:05=E2=80=AFPM Rick Macklem wrote: > > On Tue, Jan 6, 2026 at 12:36=E2=80=AFPM Aur=C3=A9lien Couderc > wrote: > > > > On Tue, Jan 6, 2026 at 9:07=E2=80=AFPM Aur=C3=A9lien Couderc > > wrote: > > > > > > Our CI uses this script to quickly setup a FreeBSD NFSv4.1 server for > > > testing. The script worked with FreeBSD 14.2, but with FreeBSD 15.0 > > > all files are suddenly read-only (write access gets EPERM): > > > > > > sysrc rpcbind_enable=3D"YES" > > > sysrc mountd_enable=3D"YES" > > > sysrc nfs_server_enable=3DYES > > > sysrc nfsv4_server_enable=3DYES > > > sysrc nfsuserd_flags=3D"-domain GLOBAL.LOC" > > > sysrc nfsuserd_enable=3DYES > > > sysrc nfscbd_enable=3DYES > > > printf 'vfs.nfs.enable_uidtostring=3D0\n' >>'/etc/sysctl.conf' > > > printf 'vfs.nfsd.enable_stringtouid=3D0\n' >>'/etc/sysctl.conf' > > > printf 'vfs.nfsd.issue_delegations=3D1\n' >>'/etc/sysctl.conf' > > > mkdir /nfsdata > > > chmod a+rwxt /nfsdata > > > printf 'V4: /\n' >'/etc/exports' > > > printf '/nfsdata -network=3D80.247.17.0 -mask=3D255.255.255.0 -sec= =3Dsys\n' > > > >>'/etc/exports' > > > service nfsd start > > > > > > > > > The failed NFS4.2 op looks like this in wireshark: > > > > > > Network File System, Ops(8): SEQUENCE, PUTFH, SAVEFH, OPEN, GETFH, > > > GETATTR, RESTOREFH, GETATTR > > > [Program Version: 4] > > > [V4 Procedure: COMPOUND (1)] > > > Tag: open > > > minorversion: 2 > > > Operations (count: 8): SEQUENCE, PUTFH, SAVEFH, OPEN, GETFH, > > > GETATTR, RESTOREFH, GETATTR > > > Opcode: SEQUENCE (53) > > > Opcode: PUTFH (22) > > > Opcode: SAVEFH (32) > > > Opcode: OPEN (18) > > > seqid: 0x00000000 > > > share_access: OPEN4_SHARE_ACCESS_WRITE (2) > > > share_deny: OPEN4_SHARE_DENY_NONE (0) > > > clientid: 0x0000000000000000 > > > owner: > > > Open Type: OPEN4_CREATE (1) > > > Create Mode: UNCHECKED4 (0) > > > Attr mask[0]: 0x02000010 (Size, Hidden) > > > reqd_attr: Size (4) > > > size: 0 > > > reco_attr: Hidden (25) > > > fattr4_hidden: No > > > Attr mask[1]: 0x00004002 (Mode, System) > > > reco_attr: Mode (33) > > > mode: 0644, Name: Unknown, Read permission fo= r > > > owner, Write permission for owner, Read permission for group, Read > > > permission for others > > > reco_attr: System (46) > > > fattr4_system: No > > > Claim Type: CLAIM_NULL (0) > > > > I think I found the problem: If our JAVA client does not set the > > FATTR_HIDDEN and FATTR_SYSTEM attributes, then write access works. > > > > Why did this change in FreeBSD? > Support for these was added for 15.0 (archive is in stable/15, > but didn't quite make the release cutoff). Mostly because you > guys requested them. > > It appears that you've found a bug in the handling of system, hidden > in this new support. (In FreeBSD, they are never specified in OPEN, only > in SETATTR, so you've tested the OPEN case and it appears to be broken. > At this point, I am not sure if the breakage is in ZFS or the NFS server = code, > but I do see a place where the NFS server is missing code. I think the bug is in ZFS. For file creation, it calls secpolicy_xvattr() if any of the flags (system and hidden are in there). secpolicy_xvattr() returns EPERM unless the caller is root. --> This isn't correct for the flags that can be set by the owner of the file, such as system and hidden. (This check is not done for zfs_setattr(), so chflags works as expected.) The fix is either to not call secpolicy_xvattr() when the flags are ones that can be set by the file owner OR secpolicy_xvattr() needs to be changed to handle these cases. I can come up with a patch that disables the secpolicy_xvattr() call if you can test it? rick > > Can you build a kernel from sources with a test patch, if I email > you the patch? > > rick > > > > > Aur=C3=A9lien > > -- > > Aur=C3=A9lien Couderc > > Big Data/Data mining expert, chess enthusiast > >