mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Use atomics when checking for parent setgid in VFS2 tmpfs file creation.
Reported-by: syzbot+59550b48e06cc0d3b638@syzkaller.appspotmail.com PiperOrigin-RevId: 386075453
This commit is contained in:
@@ -397,8 +397,8 @@ func (i *inode) init(impl interface{}, fs *filesystem, kuid auth.KUID, kgid auth
|
||||
}
|
||||
|
||||
// Inherit the group and setgid bit as in fs/inode.c:inode_init_owner().
|
||||
if parentDir != nil && parentDir.inode.mode&linux.S_ISGID == linux.S_ISGID {
|
||||
kgid = auth.KGID(parentDir.inode.gid)
|
||||
if parentDir != nil && atomic.LoadUint32(&parentDir.inode.mode)&linux.S_ISGID == linux.S_ISGID {
|
||||
kgid = auth.KGID(atomic.LoadUint32(&parentDir.inode.gid))
|
||||
if mode&linux.S_IFDIR == linux.S_IFDIR {
|
||||
mode |= linux.S_ISGID
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user