Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1895017

Summary: unsquashfs does not preserve file capabilities
Product: Red Hat Enterprise Linux 8 Reporter: Christophe Besson <cbesson>
Component: squashfs-toolsAssignee: Abhijith Das <adas>
Status: CLOSED ERRATA QA Contact: Robin Hack <rhack>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.2CC: adas, darcari, dwysocha, lmiksik, lpol, pdancak, qe-baseos-daemons, rhack, xiawu
Target Milestone: rcKeywords: Patch, Reproducer, TestCaseNeeded, Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1895013
: 1935338 (view as bug list) Environment:
Last Closed: 2021-05-18 15:10:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1895013    
Bug Blocks: 1935338    

Description Christophe Besson 2020-11-05 15:08:32 UTC
+++ This bug was initially created as a clone of Bug #1895013 +++

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 4 Abhijith Das 2021-01-18 05:50:41 UTC
https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=34334352

Here's a test build for you to try out. 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.

Comment 5 Christophe Besson 2021-01-18 14:54:18 UTC
Thanks for that build.
On my side, I don't have any non-regression tests for this pkg.
I requested the customer to check that package in its environment.

Comment 6 Christophe Besson 2021-01-18 15:49:21 UTC
Sorry I just realized it was the one for el8, customer needs a fix for el7 (#1895013).

Comment 18 Abhijith Das 2021-03-04 21:36:44 UTC
https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=35272511 - 8.4.0-candidate build

Comment 24 errata-xmlrpc 2021-05-18 15:10:49 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (squashfs-tools bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1732