]> www.infradead.org Git - mtd-utils.git/commit
mkfs.ubifs: fix xattr scanning for builds with selinux support
authorDavid Oberhollenzer <goliath@infraroot.at>
Fri, 15 Dec 2023 11:42:41 +0000 (12:42 +0100)
committerDavid Oberhollenzer <goliath@infraroot.at>
Tue, 19 Dec 2023 09:23:59 +0000 (10:23 +0100)
commit9471c13faf76ff05f58d636b988bb066ad6d05fa
tree29e04b6874c2389ba4abcf67d770841c9bc998e0
parent2425614638a798e55e79e1b1f9b8d84567769311
mkfs.ubifs: fix xattr scanning for builds with selinux support

mkfs.uibfs can add Selinux xattrs from a labeling file using
libselinux to parse it. The commit that added this feature simply
introduced a separate function, inode_add_selinux_xattr, which is
called instead of inode_add_xattr. If no --selinux argument is
specified for mkfs.ubifs, this is a no-op.

The problem is, that this breaks xattr scanning for any build with
Selinux enabled. The Selinux version is always called and it does
not scan for xattrs on the filesystem, or dispatch to the original.

This commit fixes the xattr scanning behavior. We unconditionally call
both functions (they each have no-op implementations if the feature
is missing) and in the regular xattr scanning code, we skip selinux
attributes, if the --selinux option was given.

Fixes: f1feccec5ad8 ("mkfs.ubifs: Implement selinux labelling support")
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
ubifs-utils/mkfs.ubifs/mkfs.ubifs.c