ovl: copy new uid/gid into overlayfs runtime inode
diff mbox

Message ID 145424648900.10573.4331586687947621230.stgit@zurg
State New
Headers show

Commit Message

Konstantin Khlebnikov Jan. 31, 2016, 1:21 p.m. UTC
Overlayfs must update uid/gid after chown, otherwise functions
like inode_owner_or_capable() will check user against stale uid.
Catched by xfstests generic/087, it chowns file and calls utimes.

Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
---
 fs/overlayfs/inode.c |    2 ++
 1 file changed, 2 insertions(+)


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Miklos Szeredi March 3, 2016, 4:04 p.m. UTC | #1
On Sun, Jan 31, 2016 at 2:21 PM, Konstantin Khlebnikov <koct9i@gmail.com> wrote:
> Overlayfs must update uid/gid after chown, otherwise functions
> like inode_owner_or_capable() will check user against stale uid.
> Catched by xfstests generic/087, it chowns file and calls utimes.

Queued up patch.  Thanks.

Miklos
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sedat Dilek March 3, 2016, 6:58 p.m. UTC | #2
On 3/3/16, Miklos Szeredi <miklos@szeredi.hu> wrote:
> On Sun, Jan 31, 2016 at 2:21 PM, Konstantin Khlebnikov <koct9i@gmail.com>
> wrote:
>> Overlayfs must update uid/gid after chown, otherwise functions
>> like inode_owner_or_capable() will check user against stale uid.
>> Catched by xfstests generic/087, it chowns file and calls utimes.
>
> Queued up patch.  Thanks.
>

In which Git tree you do that?
[1] points to [2], still true?

- Sedat -

[1] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/MAINTAINERS#n8110
[2] http://git.kernel.org/cgit/linux/kernel/git/mszeredi/vfs.git/

> Miklos
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Miklos Szeredi March 4, 2016, 5:06 a.m. UTC | #3
On Thu, Mar 3, 2016 at 7:58 PM, Sedat Dilek <sedat.dilek@gmail.com> wrote:
> On 3/3/16, Miklos Szeredi <miklos@szeredi.hu> wrote:
>> On Sun, Jan 31, 2016 at 2:21 PM, Konstantin Khlebnikov <koct9i@gmail.com>
>> wrote:
>>> Overlayfs must update uid/gid after chown, otherwise functions
>>> like inode_owner_or_capable() will check user against stale uid.
>>> Catched by xfstests generic/087, it chowns file and calls utimes.
>>
>> Queued up patch.  Thanks.
>>
>
> In which Git tree you do that?
> [1] points to [2], still true?

It is.  I just forgot to push yesterday evening.  Pushed now.

Thanks,
Miklos


>
> - Sedat -
>
> [1] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/MAINTAINERS#n8110
> [2] http://git.kernel.org/cgit/linux/kernel/git/mszeredi/vfs.git/
>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index 49e204560655..a4ff5d0d7db9 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -65,6 +65,8 @@  int ovl_setattr(struct dentry *dentry, struct iattr *attr)
 
 		inode_lock(upperdentry->d_inode);
 		err = notify_change(upperdentry, attr, NULL);
+		if (!err)
+			ovl_copyattr(upperdentry->d_inode, dentry->d_inode);
 		inode_unlock(upperdentry->d_inode);
 	}
 	ovl_drop_write(dentry);