OSDN Git Service

virtiofsd: passthrough_ll: create new files in caller's context
authorVivek Goyal <vgoyal@redhat.com>
Wed, 15 Aug 2018 15:05:29 +0000 (17:05 +0200)
committerDr. David Alan Gilbert <dgilbert@redhat.com>
Thu, 23 Jan 2020 16:41:36 +0000 (16:41 +0000)
commit929cfb7a9a1b101cdfc9ac19807ecab4c81a13e4
treed5dd3f260708c379136cc01593f8fd5b23226505
parentbad7d2c3ad1af9344df035aedaf8e0967a543070
virtiofsd: passthrough_ll: create new files in caller's context

We need to create files in the caller's context. Otherwise after
creating a file, the caller might not be able to do file operations on
that file.

Changed effective uid/gid to caller's uid/gid, create file and then
switch back to uid/gid 0.

Use syscall(setresuid, ...) otherwise glibc does some magic to change EUID
in all threads, which is not what we want.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
tools/virtiofsd/passthrough_ll.c