ufs: adding read support for UFS2 extended attributes

From: Ali Ahmet Memis

Date: Thu Aug 06 2026 - 11:01:21 EST


Linux mounts UFS2 but ignores the per-inode extended attribute area
completely. There is no xattr code in fs/ufs at all, so the POSIX.1e
ACLs and MAC labels FreeBSD wrote are silently dropped on the floor.
The volumes I read are FreeBSD ones, so that metadata is invisible to
me today, and I would like to add read-only getxattr/listxattr for it.

The first question is whether you want that in fs/ufs at all. I would
rather hear no now than after posting a series.

If you do, I have the on-disk format already. I took it off an image
FreeBSD 15.1 wrote rather than off extattr.h, which turned out to
matter. The base length is roundup8(offsetof(struct extattr, ea_name)
+ ea_namelength), not roundup8(sizeof(struct extattr) + ea_namelength).
sizeof() is 8 because of ea_name[1], so the obvious reading puts every
short-named attribute eight bytes out of place. A single record can
also straddle both ui_extb blocks, so the area has to be parsed as one
linear buffer rather than block by block.

The other thing I would rather settle up front is the namespace
mapping. I am planning EXTATTR_NAMESPACE_USER -> user.*,
EXTATTR_NAMESPACE_SYSTEM -> trusted.*, contents passed through
untouched, and explicitly not translating system.posix1e.acl_access
into Linux POSIX ACLs. The encodings differ, and guessing at the
semantics does not belong in a first version.

RFC series after the merge window.

Thanks,
Ali