RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1895013 - unsquashfs does not preserve file capabilities
Summary: unsquashfs does not preserve file capabilities
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: squashfs-tools
Version: 7.9
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Abhijith Das
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks: 1895017
TreeView+ depends on / blocked
 
Reported: 2020-11-05 15:06 UTC by Christophe Besson
Modified: 2021-07-06 14:25 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1895017 (view as bug list)
Environment:
Last Closed: 2021-07-06 14:25:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Christophe Besson 2020-11-05 15:06:32 UTC
Description of problem:
While running unsquashfs, file capabilities are not preserved.

Version-Release number of selected component (if applicable):
squashfs-tools-4.3-0.21.gitaae0aff4

How reproducible:
100%

Steps to Reproduce:
~~~
# mksquashfs /usr/bin/ping /tmp/test.img
# mount /tmp/test.img /mnt
# getcap /mnt/ping 
/mnt/ping = cap_net_admin,cap_net_raw+p
# unsquashfs /tmp/test.img
# getcap squashfs-root/ping
<EMPTY OUTPUT>
~~~

Additional info:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=804194

Applying blindly that patch against the RHEL srpm fixed the issue for me.
~~~
--- squashfs4.3.orig/squashfs-tools/unsquashfs.c	2020-11-05 13:08:22.000000000 +0100
+++ squashfs4.3/squashfs-tools/unsquashfs.c	2020-11-05 13:09:02.000000000 +0100
@@ -818,8 +818,6 @@
 {
 	struct utimbuf times = { time, time };
 
-	write_xattr(pathname, xattr);
-
 	if(utime(pathname, &times) == -1) {
 		ERROR("set_attributes: failed to set time on %s, because %s\n",
 			pathname, strerror(errno));
@@ -842,6 +840,8 @@
 		return FALSE;
 	}
 
+	write_xattr(pathname, xattr);
+
 	return TRUE;
 }
~~~

Issue has been fixed a little bit differently in 4.4 upstream.
The bug also concerns the RHEL 8 version, so cloning this bug.

Comment 2 Abhijith Das 2021-01-18 17:16:38 UTC
https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=34344140

Here's a rhel7 test build with the above patch. It passed the test case outlined in the description. Could you please run additional tests to make sure the patch didn't break anything else? If all looks fine, I'll go ahead and file an erratum.

Out of curiosity, who is the customer and what is their use-case for squashfs?

Comment 3 Christophe Besson 2021-01-19 13:41:54 UTC
Thanks, requesting to verify if it works in that environment.


Note You need to log in before you can comment on or make changes to this bug.