Bug 68891 - File capabilities are lost when sending/receiving a btrfs subvolume
Summary: File capabilities are lost when sending/receiving a btrfs subvolume
Status: RESOLVED PATCH_ALREADY_AVAILABLE
Alias: None
Product: File System
Classification: Unclassified
Component: btrfs (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: David Sterba
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-17 11:12 UTC by Juan Orti
Modified: 2018-01-20 19:26 UTC (History)
6 users (show)

See Also:
Kernel Version: 3.12.7
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Juan Orti 2014-01-17 11:12:43 UTC
When doing a send and receive of a btrfs volume the file capabilities are not preserved.

In the original root volume:
# find /usr -type f | xargs getcap
/usr/bin/systemd-detect-virt = cap_dac_override,cap_sys_ptrace+ep
/usr/bin/ping = cap_net_admin,cap_net_raw+ep
/usr/bin/ping6 = cap_net_admin,cap_net_raw+ep
/usr/bin/rcp = cap_net_bind_service+ep
/usr/bin/rlogin = cap_net_bind_service+ep
/usr/bin/rsh = cap_net_bind_service+ep
/usr/sbin/arping = cap_net_raw+ep
/usr/sbin/clockdiff = cap_net_raw+ep
/usr/sbin/mtr = cap_net_raw+ep

In the received volume:
# find /mnt/root_received/usr  -type f | xargs getcap
<empty>

Versions used:
btrfs-progs-3.12-1.fc20.x86_64
kernel-3.12.7-300.fc20.x86_64
Comment 1 Chris Murphy 2014-04-30 15:54:21 UTC
Reproduced on Fedora Rawhide with:
kernel-3.15.0-0.rc3.git0.1.fc21.x86_64
btrfs-progs-3.14-1.fc21.x86_64

cp -a preserves these, but btrfs send/receive drops them.
Comment 2 flo 2015-02-17 18:11:37 UTC
Hi,

also with 3.18.5-201.fc21.x86_64 capabilities  are dropped, any idea when this will be supported?


regards
Comment 3 flo 2015-02-17 18:15:02 UTC
Hi again,

forgot btrfs-progs version.

btrfs-progs-3.18.1-1.fc21.x86_64

regards
Comment 4 David Sterba 2015-05-27 14:07:49 UTC
I cannot reproduce it with kernel 4.1-rc and progs from current git (equivalent to 4.0.1). A quick test with kernel 3.14 and progs 3.18 (or 3.14) works as well.
Comment 5 David Sterba 2015-05-27 14:14:40 UTC
Oh well, chown resets the capabilities, I've missed that in
http://thread.gmane.org/gmane.comp.file-systems.btrfs/42655
Comment 6 David Sterba 2015-05-27 16:49:03 UTC
Proposed fix https://patchwork.kernel.org/patch/6491351/ , feel free to test and reopen the bug eventually.
Comment 7 frederik 2018-01-20 19:26:17 UTC
This problem exists again with btrfs-progs 4.14 and kernel 4.14.14 (on Archlinux)

# find /usr/bin -type f | xargs getcap                                           /usr/bin/rsh = cap_net_bind_service+ep
/usr/bin/rcp = cap_net_bind_service+ep
/usr/bin/rlogin = cap_net_bind_service+ep
/usr/bin/ping = cap_net_raw+ep
/usr/bin/mtr-packet = cap_net_bind_service,cap_net_raw+ep
/usr/bin/sway = cap_sys_ptrace+eip
/usr/bin/dumpcap = cap_dac_override,cap_net_admin,cap_net_raw+eip

send/received volume:
# find /usr/bin -type f | xargs getcap
<nothing>

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