Bug 1013345

Summary: RHEL7: xfsrestore does not preserve file capabilities
Product: Red Hat Enterprise Linux 7 Reporter: Eryu Guan <eguan>
Component: xfsdumpAssignee: Eric Sandeen <esandeen>
Status: CLOSED CURRENTRELEASE QA Contact: Eryu Guan <eguan>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: branto, eguan, esandeen, jjarvis, linuxdev-kernel-it
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: xfsdump-3.1.3-5.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 905585 Environment:
Last Closed: 2014-06-13 10:35:37 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:
Bug Depends On: 905584, 905585    
Bug Blocks: 807834, 1050219    

Comment 1 Eryu Guan 2014-01-18 14:16:41 UTC
*** Bug 1054570 has been marked as a duplicate of this bug. ***

Comment 3 Fujitsu kernel engineers 2014-02-17 10:38:28 UTC
Hi,

We believe below upstream patch fixes this problem.
Which RHEL7 snapshot will include the patch?

commit a88c49071dde2539cce6d502effc27501416983a
Author: Dave Chinner <dchinner>
Date:   Thu Feb 6 16:48:39 2014 +1100

    restore: don't trash file capabilities
    
    xfsrestore fails to restore file capabilities correctly because it
    sets the owner on the file after it has restored the capability
    attributes. This results in the kernel stripping the capabilities
    when changing the owner of the file and hence the restored file is
    not complete.
    
    Fix this by changing the owner of the file when it is created rather
    than after it has been fully restored. This ensures we don't kill
    the caps as they are restored after the owner it appropriately set.
    This fixes the xfs/296 failure.

Regards,
Masayoshi Mizuma

Comment 4 Eric Sandeen 2014-02-17 17:58:16 UTC
*** Bug 905586 has been marked as a duplicate of this bug. ***

Comment 5 Eric Sandeen 2014-02-17 17:59:04 UTC
Yes, that fixes it.  The next build of xfsdump will have this fix, I will fill in the fixed-in field when it's done.  I do not know which snapshot will include it.

Comment 6 Eric Sandeen 2014-02-17 18:00:37 UTC
I can fix it after I gain blocker approval for this bug.

Comment 7 Eric Sandeen 2014-02-17 20:41:15 UTC
Built in xfsdump-3.1.3-5.el7

Comment 9 Eryu Guan 2014-02-23 07:14:13 UTC
Verified with xfsdump-3.1.3-5.el7, though xfs/296 still fails, but I believe it's a test case issue, and has been fixed upstream in xfstests.

=== full diff out/out.bad ===   
--- /dev/fd/63  2014-02-23 02:06:31.460922512 -0500
+++ results/xfs/296.out.bad     2014-02-23 02:06:30.913942889 -0500
@@ -50,6 +50,7 @@
 user.name

 Checking for capability on restored file
-RESTORE_DIR/DUMP_SUBDIR/testfile cap_setgid,cap_setuid+ep
+RESTORE_DIR/DUMP_SUBDIR/testfile = cap_setgid,cap_setuid+ep
 # file: RESTORE_DIR/DUMP_SUBDIR/testfile
 security.capability
+

Fixed by

Date: Wed,  5 Feb 2014 12:53:12 +1100
From: Dave Chinner <david>
To: xfs.com
Subject: [PATCH] xfs/296: fix golden output

From: Dave Chinner <dchinner>

This test never passed, so the golden output was never properly
verified as correct. Now that the bug is fixed, fix the golden
output to match the actual test output.

Signed-off-by: Dave Chinner <dchinner>

Set to VERIFIED.

Comment 10 Ludek Smid 2014-06-13 10:35:37 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.