From nobody Sun Apr 06 21:52:28 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 4ZW5fx50qhz5sYdK for ; Sun, 06 Apr 2025 21:52:41 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) (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 4ZW5fx0vHZz45WN for ; Sun, 06 Apr 2025 21:52:41 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-ac6ed4ab410so614525166b.1 for ; Sun, 06 Apr 2025 14:52:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743976360; x=1744581160; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ThMuF4bTy+pu6LN2lIXBxVDcOGbSwI9dMXWItY+kJHY=; b=cj3dODk27p9zeYA4mMU0O0Rsz1IJXBGQh81BPR8jYhrxXbg+lGP9XZ3iFvSYlNcI0p uWOlHLM4uEcrmDA7M9aIZwuSsshFx48D1CNmZPz3CHtH/jUA2YvhAM6xA5vdfFMjJRJz 0S5CusS8bMErnlb+dOhHnV5jdEXC6lQ13TqllLo8ABfbnqeq2lGFO409AXjdPEFu2i4u VlCmzIgMoAkE3RWkG684sGUl5vLOKxp7tx+2x8p4qCbTZ9Qrg91cVBZvmWTOybBI5kf8 GNUXW/Py7nsnF4wNOer+JTD486B53vJIopzx1LQCS3TgkhlJNy/q5mX76pEVYJaSMk9R ErPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743976360; x=1744581160; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ThMuF4bTy+pu6LN2lIXBxVDcOGbSwI9dMXWItY+kJHY=; b=fw5OAMBFj7xBqiI/noKg6xcwwHOlGH+8Mq4T0clwExr4QRgmFYPLiDNw7mg1NSnu0+ gwOz/NeqyTRzvRend0DGQL4wwyY5126pGV1iJDTFUg7OQ9JduNGTEYh+446h1Z2h5WwT Mfr9H00AxWTDcVOeeRXnT6RXOPJIh4NLHpX2KZNJNywL2ChgfnLHfYWsaQVIzMJMQq+o Y3+CEHqZyAg6hDN366HLJnSgV2kh+WgkaQkEJh1ak/VIJv5Jd9dOGAJD4gzExQGGgtqT ujh9uHernk+U+0xdyCj6WKqI2bYG9vZta2uw2TEY+z5AoBjpdYtQO84KKFP13Jnol62U QhLg== X-Gm-Message-State: AOJu0YyJ+DMipW4qCbjy9Rd3aS/jE96TcucWKMQv9dpUPQdlwqOjpRKX h/7nyES6rFekI9xUlmoiGThJVN4rPTtpi2MsaBtbEp331VT4qDcWQdm3g+fZJIUDTeOmyljKWQR 5ikOTK2EV//Hj+7w0MnyRJs+y2A== X-Gm-Gg: ASbGnctgDRjLzg2EweM+M6jwj66HMaWLdtRFx5Kqi1PdFM16l6iar8FR3e7ritTyVV5 l2fNnNDsBVz68TCSR/gXtFogXmAgaY+7OSJdYBKknj5R5wUGs4WnbNO7VwnjnX66ZPQowuF7TCL ph6WiABI+Qz1dw2m3NmHJNLf/9WBqFDPPmBEDXTuziNNG/K+4XLRrbn+eT7/vMqmccyeqw X-Google-Smtp-Source: AGHT+IFTqWHYVuvVz2XZCvPWfAzB1YO2cu5Dauqj2B+20hrux7NWF0XQyeXXM7jTfMJTl/FQ1LaVAXFpsEzhgM106hg= X-Received: by 2002:a17:906:f587:b0:ac7:391a:e158 with SMTP id a640c23a62f3a-ac7d1c69b7dmr1054756266b.59.1743976359401; Sun, 06 Apr 2025 14:52:39 -0700 (PDT) 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 References: <2rq3bpvhclcipvgg3mo4gml7ysuzbvt6rfnzkprceumzeaeh4b@casrpprm6mgt> <4beaxy5dpajikvafxpjogcxrpyuwwicng5ln5rxbxlbzp2o2g7@ib7wo5jzlte4> In-Reply-To: From: Rick Macklem Date: Sun, 6 Apr 2025 14:52:28 -0700 X-Gm-Features: ATxdqUF4_BqVZzrLuwb5YQFXkVbfsuPk9Dm5uQRvydAg0wDaRiN5PKWLouFQOF4 Message-ID: Subject: Re: Heads Up: commit 2ec2ba7e232d just hit main To: Shawn Webb Cc: FreeBSD CURRENT Content-Type: multipart/mixed; boundary="000000000000664d03063223232b" X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Queue-Id: 4ZW5fx0vHZz45WN X-Spamd-Bar: ---- --000000000000664d03063223232b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Apr 5, 2025 at 5:45=E2=80=AFPM Shawn Webb wrote: > > On Sat, Apr 05, 2025 at 05:36:07PM -0700, Rick Macklem wrote: > > On Sat, Apr 5, 2025 at 4:43=E2=80=AFPM Shawn Webb wrote: > > > > > > 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 wr= ote: > > > > > > > > > > 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 Mackle= m wrote: > > > > > > > > > > > > On Thu, Apr 3, 2025 at 4:52=E2=80=AFPM Shawn Webb <= shawn.webb@hardenedbsd.org> wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, Apr 02, 2025 at 01:51:26PM -0700, Rick Ma= cklem wrote: > > > > > > > > > > > > > > The commit 2ec2ba7e232d just hit main. I do no= t think it will > > > > > > > > > > > > > > cause problems, but it is fairly large. > > > > > > > > > > > > > > > > > > > > > > > > > > > > Man page updates will be done as separate commi= ts. > > > > > > > > > > > > > > > > > > > > > > > > > > > > Hopefully this will not cause grief, rick > > > > > > > > > > > > > > > > > > > > > > > > > > Hey Rick, > > > > > > > > > > > > > > > > > > > > > > > > > > The patch review test plan mentions a patch to ZF= S itself to support > > > > > > > > > > > > > named attributes. Is that patch available somewhe= re? > > > > > > > > > > > > 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.patc= h > > > > > > > > > > > > (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 defaul= t) returns 0. Am I > > > > > > > > > > > doing something wrong? > > > > > > > > > > > > > > > > > > > > > > =3D=3D=3D=3D BEGIN LOG =3D=3D=3D=3D > > > > > > > > > > > hbsd-current-01[shawn]:/home/shawn/tmp $ ./xattrtest = xattrtest > > > > > > > > > > > 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 xatt= r rpool/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 so= urces? > > > > > > > > > > (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/zf= s/zfs_vnops_os.c. > > > > > > > > > > It's initialized to 1 and I don't see anything that set= s it to 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 de= faults to > > > > > > > > > "on" in FreeBSD by default. My src tree is synced up to F= reeBSD commit > > > > > > > > > 7e70d94acd68b3ac6b45f49d4ab7a0f7867c3ea7. I brought in th= e ZFS patch > > > > > > > > > you linked to. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Or, did you build zfs.ko some other way than as part of= a kernel build? > > > > > > > > > > (It needs the patched .h files in the kernel sources, n= ot something in > > > > > > > > > > /usr/include/sys > > > > > > > > > > that has not yet been updated.) > > > > > > > > > > All the ZFS changes are #ifdef'd, since OpenZFS require= s the sources > > > > > > > > > > build for older kernels. (Basically #ifdef'd on that VI= RF_NAMEDATTR mentioned > > > > > > > > > > above.) > > > > > > > > > > > > > > > > > > Perhaps I need to do a clean build. I'll try that and rep= ort back. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > It does remind me that I need to try a build of zfs.ko = by doing a "make" in > > > > > > > > > > the module directory. > > > > > > > > > > > > > > > > > > > > You can try the attached trivial patch and see if it sp= its out "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 progr= ess. > > > > > > > > > > > > > > > > I created a dataset specifically for this since I can't rea= lly unmount > > > > > > > > my /usr/home dataset, so my example down below is a bit dif= ferent 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 had 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/x= attr > > > > > > > > $ 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,= nfsv4acls, named attributes) > > > > > > > > $ mount | grep named > > > > > > > > rpool/scratch/xattr on /scratch/xattr (zfs, local, noatime,= nfsv4acls, named attributes) > > > > > > > > =3D=3D=3D=3D END LOG =3D=3D=3D=3D > > > > > > > > > > > > > > > > So it looks like FreeBSD does not honor the xattr zfs prope= rty, > > > > > > > > otherwise you would see a whole bunch of datasets mounted w= ith 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= property > > > > > > > information. > > > > > > > It gets called when "zfs set xattr=3DXX " is don= e or when > > > > > > > the mount option "xattr" is set. > > > > > > > > > > > > > > The question seems to be "Why was the stuff not correctly set= for your file > > > > > > > systems, although they show xattr=3Don?" > > > > > > > > > > This is indeed what I was inferring. xattr has been set to "on" s= ince > > > > > the pool's creation as far as I can tell. Until experimenting wit= h > > > > > your patch, I didn't really even know the xattr property even exi= sted. > > > > I was able to reproduce this with a fresh zpool. > > > > Although it reported "xattr on", that is not really accurate. > > > > > > > > I stuck a printf() in here (line#853-861 of > > > > sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.) > > > > > > > > /* 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); > > > > > > > > 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; > > > > > > > > The printf() of error showed ENOENT. So, "xattr" actually does not > > > > exist. "zfs get xattr " calls it "on" but that's not a= ccurate. > > > > > > > > As root, I did: > > > > # zfs set xattr=3Ddir > > > > - reboot > > > > > > > > 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_callba= cks(), > > > > which now finds the property (because of the "zfs set xattr=3Ddir <= file-system>") > > > > and registers it via dsl_prop_register(). > > > > > > > > I don't know if the above is correct? > > > > Personally, I would prefer to see "zfs get xattr " rep= ly "not set" > > > > instead of "on". > > > > > > > > rick > > > > > > > > > > > > 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. > > So, you have done > > # zfs set xattr=3Ddir > > followed by a reboot and it still doesn't work? > > Correct, even a reboot does not work. No idea. If you apply the atteched little patch (just printf's) and post what gets printed out (when a mount that doesn't work is done), it might help explain it. rick > > -- > 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/0= 3A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --000000000000664d03063223232b Content-Type: application/octet-stream; name="debugzfs.patch" Content-Disposition: attachment; filename="debugzfs.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_m966hjd30 LS0tIHN5cy9jb250cmliL29wZW56ZnMvbW9kdWxlL29zL2ZyZWVic2QvemZzL3pmc192ZnNvcHMu Yy54eHgJMjAyNS0wNC0wNiAxNDozNDo0NC4wNjY4NjcwMDAgLTA3MDAKKysrIHN5cy9jb250cmli L29wZW56ZnMvbW9kdWxlL29zL2ZyZWVic2QvemZzL3pmc192ZnNvcHMuYwkyMDI1LTA0LTA2IDE0 OjM3OjU1LjEyNzQ1NjAwMCAtMDcwMApAQCAtNTAwLDYgKzUwMCw3IEBAIHhhdHRyX2NoYW5nZWRf Y2Iodm9pZCAqYXJnLCB1aW50NjRfdCBuZXd2YWwpCiAJCWVsc2UKIAkJCXpmc3Zmcy0+el94Y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