On Mon, May 6, 2019 at 7:57 AM Jiufei Xue <jiufei.xue@xxxxxxxxxxxxxxxxx> wrote: > > We found that it return success when we set IMMUTABLE_FL flag to a > file in docker even though the docker didn't have the capability > CAP_LINUX_IMMUTABLE. > > The commit d1d04ef8572b ("ovl: stack file ops") and > dab5ca8fd9dd ("ovl: add lsattr/chattr support") implemented chattr > operations on a regular overlay file. ovl_real_ioctl() overridden the > current process's subjective credentials with ofs->creator_cred which > have the capability CAP_LINUX_IMMUTABLE so that it will return success > in vfs_ioctl()->cap_capable(). > > Fix this by checking the capability before cred overriden. And here we > only care about APPEND_FL and IMMUTABLE_FL, so get these information from > inode. > > Changes since v1: > - remove S_DIRSYNC since ovl_copyflags() does not copy FS_DIRSYNC_FL, > pointed out by Amir Goldstein. > > Signed-off-by: Jiufei Xue <jiufei.xue@xxxxxxxxxxxxxxxxx> Thanks. Applied with modification, please see my vfs.git#overlayfs-next tree. Miklos