summaryrefslogtreecommitdiff
path: root/debian/watch
blob: 17393d010e93b495345622e7d00629b350f7f381 (plain)
1
2
version=3
http://sf.net/cscope/cscope-(.*)\.tar\.gz
76eb4518d68cee3bc1272091b'/>
context:
space:
mode:
authorAntonio Murdaca <amurdaca@redhat.com>2016-04-07 15:48:25 +0200
committerMiklos Szeredi <mszeredi@redhat.com>2016-05-27 08:55:26 +0200
commit3fe6e52f062643676eb4518d68cee3bc1272091b (patch)
tree31dc27b85db350a2840d3d08a2597444233da15c /fs/overlayfs/copy_up.c
parent2dcd0af568b0cf583645c8a317dd12e344b1c72a (diff)
ovl: override creds with the ones from the superblock mounter
In user namespace the whiteout creation fails with -EPERM because the current process isn't capable(CAP_SYS_ADMIN) when setting xattr. A simple reproducer: $ mkdir upper lower work merged lower/dir $ sudo mount -t overlay overlay -olowerdir=lower,upperdir=upper,workdir=work merged $ unshare -m -p -f -U -r bash Now as root in the user namespace: \# touch merged/dir/{1,2,3} # this will force a copy up of lower/dir \# rm -fR merged/* This ends up failing with -EPERM after the files in dir has been correctly deleted: unlinkat(4, "2", 0) = 0 unlinkat(4, "1", 0) = 0 unlinkat(4, "3", 0) = 0 close(4) = 0 unlinkat(AT_FDCWD, "merged/dir", AT_REMOVEDIR) = -1 EPERM (Operation not permitted) Interestingly, if you don't place files in merged/dir you can remove it, meaning if upper/dir does not exist, creating the char device file works properly in that same location. This patch uses ovl_sb_creator_cred() to get the cred struct from the superblock mounter and override the old cred with these new ones so that the whiteout creation is possible because overlay is wrong in assuming that the creds it will get with prepare_creds will be in the initial user namespace. The old cap_raise game is removed in favor of just overriding the old cred struct. This patch also drops from ovl_copy_up_one() the following two lines: override_cred->fsuid = stat->uid; override_cred->fsgid = stat->gid; This is because the correct uid and gid are taken directly with the stat struct and correctly set with ovl_set_attr(). Signed-off-by: Antonio Murdaca <runcom@redhat.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs/copy_up.c')