From nobody Sat Apr 05 23:43:48 2025 X-Original-To: freebsd-current@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 4ZVX9j1s9Hz5sXJV for ; Sat, 05 Apr 2025 23:43:53 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) (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 4ZVX9h1gl2z3n27 for ; Sat, 05 Apr 2025 23:43:52 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=hardenedbsd.org header.s=google header.b=e4SxEDRU; dmarc=none; spf=pass (mx1.freebsd.org: domain of shawn.webb@hardenedbsd.org designates 2607:f8b0:4864:20::d2d as permitted sender) smtp.mailfrom=shawn.webb@hardenedbsd.org Received: by mail-io1-xd2d.google.com with SMTP id ca18e2360f4ac-86135d11760so32375039f.2 for ; Sat, 05 Apr 2025 16:43:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; t=1743896631; x=1744501431; darn=freebsd.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=AesN6FBFAsCFgL/LKX0IrvdG8jJ0XRkxWMEFFqGHMEY=; b=e4SxEDRUR0Jzk+wOFBijsyTfVtstt3tClZto+NmjPOTWAzrKEQjGEalM4QwLK060ao d691N5z9CHtbbRbkOTriObdfHCrEeDTdMqHsyCsUPfpncgIIT4PgQOKYgyW/bWENv3of u5gZU6sbicdD/EZcfWruQLVpAK5M8ZmuDZHY3n/UxSO7+Ooyjr9gXXJlRW7iqsddH+RZ amuBigRDi8TTtL+QjeDuKHsoN/bar5CzTBhsTLT66psIWBH0W6HHNzgjw3w4wBt0BBGZ lzkVpw257BZFaqWS45UQu7ZA32X+vLUNnEqvBKyDJAcCWDuQzdYp2mm9aMt6ZUI/kjTT FafQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743896631; x=1744501431; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=AesN6FBFAsCFgL/LKX0IrvdG8jJ0XRkxWMEFFqGHMEY=; b=SA4M665A3anbWxQhA2eCr7ww4LCunXSGcVALBVDCPHYvW87XRxnw02rZ5P2fgWyukF mJUi2C89m7KIwmHmA/0+Ng9HbtgU2Dt3XpCnrBo95SpoGGsfoFA9wQtuXHjzD91eyAIQ 9uRY50H2bsqbbmg6chF7aCG6pxzjr81hVtQ10Ai0PKLIMlSKkeJuSv4VqriV0V304l38 y8J5cITov6rO7O4T265/qSe0WLULzOsIc3Ov5upRZpWMKv3ySz8FNTbGDXDx1bMwksV6 dsZLsYrYRntRqIeETIvuRrgTx0hSfumJ7xENO7+ae2pNxPAzqmHIWSFQSzgqb/ewPDTh PkVA== X-Gm-Message-State: AOJu0YwAchcLFwA+Ka0BXOVQYowNW+o0Ut3lm8fOyHBLshulXnOAse1v BglxCGAi1NXtYVS3qR7e9B1SFtFC8/eHR/qPab1NjnY2DNltKKUQr0FnMTNwQGI= X-Gm-Gg: ASbGnctsNfOSLTpq6U1yOHGonAcvTJJId7UUR8pRIRIx2C6g1Sunx2Bd43uRQRTukKm KbF+NLmJMI6qhw6fYztXLCVvboH2ZTqhQfL8N+nyQdGr/zoZZ3VXJJdnHeyOT/66829sVx6Po7q pGxNsBXEs6dljzRA46gFnjAdkk1qVeuFEfjHnfWzO8OzJWpYw9zCSguQLCP2CBytn45miHlvf1E cn6964hV5UY4cIznmmUxPr1xOmdfXjTnstJi9eq0xdza4SiKhhVu94gRwsjR6sHkeGjMcCsTJtJ vXCUaKmt14mhbCh3E0qtOSHs6V4= X-Google-Smtp-Source: AGHT+IFlevVtojPjiyUj/gTQSyy0bcTTqRUQym6C1w2pWj+aawoaYXMgPbo9i8nTjPE892g150It/A== X-Received: by 2002:a05:6602:3785:b0:85b:4362:3403 with SMTP id ca18e2360f4ac-8611c301feamr759621839f.7.1743896630599; Sat, 05 Apr 2025 16:43:50 -0700 (PDT) Received: from mutt-hbsd ([2001:470:4001:1::95]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-861112890dfsm122716139f.16.2025.04.05.16.43.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Apr 2025 16:43:49 -0700 (PDT) Date: Sat, 5 Apr 2025 23:43:48 +0000 From: Shawn Webb To: Rick Macklem Cc: FreeBSD CURRENT Subject: Re: Heads Up: commit 2ec2ba7e232d just hit main Message-ID: X-Operating-System: FreeBSD mutt-hbsd 14.2-STABLE-HBSD FreeBSD 14.2-STABLE-HBSD HARDENEDBSD-14-STABLE amd64 X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <2rq3bpvhclcipvgg3mo4gml7ysuzbvt6rfnzkprceumzeaeh4b@casrpprm6mgt> <4beaxy5dpajikvafxpjogcxrpyuwwicng5ln5rxbxlbzp2o2g7@ib7wo5jzlte4> List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ejepkcclmfbqoplx" Content-Disposition: inline In-Reply-To: X-Spamd-Result: default: False [-4.72 / 15.00]; SIGNED_PGP(-2.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.62)[-0.624]; MID_RHS_NOT_FQDN(0.50)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_LAST(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; ARC_NA(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; DMARC_NA(0.00)[hardenedbsd.org]; FROM_HAS_DN(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MIME_TRACE(0.00)[0:+,1:+,2:~]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; MISSING_XM_UA(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; TAGGED_RCPT(0.00)[]; MLMMJ_DEST(0.00)[freebsd-current@freebsd.org]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::d2d:from] X-Rspamd-Queue-Id: 4ZVX9h1gl2z3n27 X-Spamd-Bar: ---- --ejepkcclmfbqoplx Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: Heads Up: commit 2ec2ba7e232d just hit main MIME-Version: 1.0 On Sat, Apr 05, 2025 at 04:12:15PM -0700, Rick Macklem wrote: > On Sat, Apr 5, 2025 at 9:12=E2=80=AFAM Shawn Webb wrote: > > > > On Sat, Apr 05, 2025 at 08:52:06AM -0700, Rick Macklem wrote: > > > On Sat, Apr 5, 2025 at 8:50=E2=80=AFAM Rick Macklem wrote: > > > > > > > > On Fri, Apr 4, 2025 at 6:27=E2=80=AFPM Shawn Webb wrote: > > > > > > > > > > On Sat, Apr 05, 2025 at 01:04:25AM +0000, Shawn Webb wrote: > > > > > > On Fri, Apr 04, 2025 at 05:40:21PM -0700, Rick Macklem wrote: > > > > > > > On Fri, Apr 4, 2025 at 10:50=E2=80=AFAM Shawn Webb wrote: > > > > > > > > > > > > > > > > On Thu, Apr 03, 2025 at 06:12:59PM -0700, Rick Macklem wrot= e: > > > > > > > > > On Thu, Apr 3, 2025 at 4:52=E2=80=AFPM Shawn Webb wrote: > > > > > > > > > > > > > > > > > > > > On Wed, Apr 02, 2025 at 01:51:26PM -0700, Rick Macklem = wrote: > > > > > > > > > > > The commit 2ec2ba7e232d just hit main. I do not thin= k it will > > > > > > > > > > > cause problems, but it is fairly large. > > > > > > > > > > > > > > > > > > > > > > Man page updates will be done as separate commits. > > > > > > > > > > > > > > > > > > > > > > Hopefully this will not cause grief, rick > > > > > > > > > > > > > > > > > > > > Hey Rick, > > > > > > > > > > > > > > > > > > > > The patch review test plan mentions a patch to ZFS itse= lf to support > > > > > > > > > > named attributes. Is that patch available somewhere? > > > > > > > > > The ZFS patch is currently in phabricator as D49654. > > > > > > > > > Feel free to review it. > > > > > > > > > > > > > > > > > > It can also be found at: > > > > > > > > > https://people.freebsd.org/~rmacklem/zfs-xattr.patch > > > > > > > > > (this is a smaller diff which can be applied to an up-to-= date main src > > > > > > > > > tree easily) > > > > > > > > > > > > > > > > Hey Rick, > > > > > > > > > > > > > > > > I applied that zfs patch, but trying pathconf(2) on a file = on a ZFS > > > > > > > > dataset with xattr=3Don (which seems to be the default) ret= urns 0. Am I > > > > > > > > doing something wrong? > > > > > > > > > > > > > > > > =3D=3D=3D=3D BEGIN LOG =3D=3D=3D=3D > > > > > > > > hbsd-current-01[shawn]:/home/shawn/tmp $ ./xattrtest xattrt= est > > > > > > > > xattrtest: Named attributes not enabled: No error: 0 > > > > > > > > hbsd-current-01[shawn]:/home/shawn/tmp (1) $ zfs list /usr/= home/shawn > > > > > > > > NAME USED AVAIL REFER MOUNTPOINT > > > > > > > > rpool/usr/home 10.4G 71.4G 9.85G /usr/home > > > > > > > > hbsd-current-01[shawn]:/home/shawn/tmp $ zfs get xattr rpoo= l/usr/home > > > > > > > > NAME PROPERTY VALUE SOURCE > > > > > > > > rpool/usr/home xattr on default > > > > > > > > =3D=3D=3D=3D END LOG =3D=3D=3D=3D > > > > > > > > > > > > > > > > That xattrtest application is yours from: > > > > > > > > https://people.freebsd.org/~rmacklem/xattrtest.c > > > > > > > No idea. It works for me. You used up-to-date kernel sources? > > > > > > > (Check that VIRF_NAMEDATTR is defined in sys/sys/vnode.h.) > > > > > > > Oh, and one more thing to check. zfs_xattr_compat needs to be= non-zero. > > > > > > > (It's found in sys/contrib/openzfs/module/os/freebsd/zfs/zfs_= vnops_os.c. > > > > > > > It's initialized to 1 and I don't see anything that sets it t= o 0?) > > > > > > > > > > > > It is indeed set to 1. > > > > > > > > > > > > > > > > > > > > The only thing I can think if is, if you changed xattr to on,= you need to > > > > > > > reboot (or at least remount) to get it to take effect. > > > > > > > (Maybe try setting it to "dir" and then reboot/remount. Maybe= there is > > > > > > > a difference between "on" and "dir"?) > > > > > > > > > > > > Yeah, tried rebooting and still no go. Note that xattr defaults= to > > > > > > "on" in FreeBSD by default. My src tree is synced up to FreeBSD= commit > > > > > > 7e70d94acd68b3ac6b45f49d4ab7a0f7867c3ea7. I brought in the ZFS = patch > > > > > > you linked to. > > > > > > > > > > > > > > > > > > > > Or, did you build zfs.ko some other way than as part of a ker= nel build? > > > > > > > (It needs the patched .h files in the kernel sources, not som= ething in > > > > > > > /usr/include/sys > > > > > > > that has not yet been updated.) > > > > > > > All the ZFS changes are #ifdef'd, since OpenZFS requires the = sources > > > > > > > build for older kernels. (Basically #ifdef'd on that VIRF_NAM= EDATTR mentioned > > > > > > > above.) > > > > > > > > > > > > Perhaps I need to do a clean build. I'll try that and report ba= ck. > > > > > > > > > > > > > > > > > > > > It does remind me that I need to try a build of zfs.ko by doi= ng a "make" in > > > > > > > the module directory. > > > > > > > > > > > > > > You can try the attached trivial patch and see if it spits ou= t "pathconf ret=3D1" > > > > > > > on the console. > > > > > > > > > > > > I'll try that after a clean rebuild of the kernel. > > > > > > > > > > Clean rebuild didn't resolve it. However, I made some progress. > > > > > > > > > > I created a dataset specifically for this since I can't really un= mount > > > > > my /usr/home dataset, so my example down below is a bit different= than > > > > > the previous example I gave. > > > > > > > > > > The xattr property is set to "on" for the dataset. However, it's = not > > > > > mounted with the xattr property. In order to get it to work, I ha= d to > > > > > run the following commands: > > > > > > > > > > =3D=3D=3D=3D BEGIN LOG =3D=3D=3D=3D > > > > > $ sudo zfs umount rpool/scratch/xattr > > > > > $ sudo mount -t zfs -o xattr rpool/scratch/xattr /scratch/xattr > > > > > $ zfs get xattr rpool/scratch/xattr > > > > > NAME PROPERTY VALUE SOURCE > > > > > rpool/scratch/xattr xattr on local > > > > > $ mount | grep xattr > > > > > rpool/scratch/xattr on /scratch/xattr (zfs, local, noatime, nfsv4= acls, named attributes) > > > > > $ mount | grep named > > > > > rpool/scratch/xattr on /scratch/xattr (zfs, local, noatime, nfsv4= acls, named attributes) > > > > > =3D=3D=3D=3D END LOG =3D=3D=3D=3D > > > > > > > > > > So it looks like FreeBSD does not honor the xattr zfs property, > > > > > otherwise you would see a whole bunch of datasets mounted with the > > > > > "named attributes" flag in that last `mount | grep` command. > > > > I've looked at this a little more... > > > > There is a function xattr_changed_cb() that updates the xattr prope= rty > > > > information. > > > > It gets called when "zfs set xattr=3DXX " is done or w= hen > > > > the mount option "xattr" is set. > > > > > > > > The question seems to be "Why was the stuff not correctly set for y= our file > > > > systems, although they show xattr=3Don?" > > > > This is indeed what I was inferring. xattr has been set to "on" since > > the pool's creation as far as I can tell. Until experimenting with > > your patch, I didn't really even know the xattr property even existed. > I was able to reproduce this with a fresh zpool. > Although it reported "xattr on", that is not really accurate. >=20 > I stuck a printf() in here (line#853-861 of > sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.) >=20 > /* should either have both of these objects or none */ > error =3D zap_lookup(os, MASTER_NODE_OBJ, ZFS_SA_ATTRS, 8, 1, > &sa_obj); > if (error !=3D 0) > return (error); >=20 > error =3D zfs_get_zplprop(os, ZFS_PROP_XATTR, &val); > --> The printf here shows that error =3D=3D ENOENT. > if (error =3D=3D 0 && val =3D=3D ZFS_XATTR_SA) > zfsvfs->z_xattr_sa =3D B_TRUE; >=20 > The printf() of error showed ENOENT. So, "xattr" actually does not > exist. "zfs get xattr " calls it "on" but that's not accurat= e. >=20 > As root, I did: > # zfs set xattr=3Ddir > - reboot >=20 > This makes it work, although the above call still returns ENOENT. > It looks to me like zfsvfs_init() gets called from zfsvfs_create() > right at the beginning of zfs_domount(). > Later in zfs_domount() it calls zfsvfs_setup()->zfs_register_callbacks(), > which now finds the property (because of the "zfs set xattr=3Ddir ") > and registers it via dsl_prop_register(). >=20 > I don't know if the above is correct? > Personally, I would prefer to see "zfs get xattr " reply "no= t set" > instead of "on". >=20 > rick >=20 >=20 > Setting the property makes it work, but only after rebooting > (a umount/mount would probably have the same effect, I think?). So I wonder why neither an unmount/mount nor a reboot causes `mount | grep "named attribute"` to fail for me. HardenedBSD doesn't have any changes to ZFS that would cause that kind of behavior. I have to unmount, but manually mount with `mount -t zfs -o xattr ...` in order to access the new feature you wrote. Weird. --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Signal Username: shawn_webb.74 Tor-ified Signal: +1 303-901-1600 / shawn_webb_opsec.50 https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --ejepkcclmfbqoplx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmfxwC4ACgkQ/y5nonf4 4frBxw//XpMY0Mm1fYtn/BugeW8qjhMsMelDs8KG6csVaVM1PWGy4iyphmvLV1mY 0owRcDWjjly8gfvsSf3jLAAdltGjY+5e/+SbNKzK4/ZL11S7m41b7nRRLKnlCV68 xenIfFMhqb39oacYmBCqLFM94STXyhoewGU+jeWthph5gKv5Y9s2bC5aaIzQhyAl QRtPpwQEpPHxHuGEVQ2znCgIfcWyX0F9Ncq7+CT8NVN+h8UW19fDA0yuKOA1TVtb o8k/m1sJB6IZsOeINxICVSfZd5ci9B4T1Z778Cf6KXYGSHW7ljxTjiu4f5GgVVgS /hDnj72xLwCDmTVNpblqlc4xC2KLEpugI64Q3c1Mf77Fvtb4rF7IjSgXQKgn/WwV EBixO64ylm08bbf2JhmZacTBG8NccGa2v4Zz8Zjdwt+ABi1IjTIbe8/iZDmrultU YbrC4QggcVYdLV4jbdvkXrEcm6UzKKHrQxs2QfZISDy9xJw/ZKbVwPNndxDS9ot4 VfyvN7948LTwAyLJ9T3PzABKufjqv+7uc1EVdAX0NB5GZIEjquMlZ+Wt2q0anB3L 0AkT15DWj34hhsMa/dIfjbXEi3wwiK4AnhZNNMGCo5mjdBGnaH5uqFPEpuaTyz4j i4+mwUn+aYE35Akg2RYo+FarGOpx8/qYreRvEZoBVLuEKsY83h8= =QmFG -----END PGP SIGNATURE----- --ejepkcclmfbqoplx--