Re: [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid

2012-12-12 Thread Paolo Bonzini
Il 05/12/2012 13:37, Paolo Bonzini ha scritto: I have tested the below patch. Currently i don't have a signed-off-by on the patch. One change noted by mohan which I incorporated in the patch is we need to call setresgid before calling setresuid. If you are ok with this change I can send it

Re: [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid

2012-12-12 Thread Aneesh Kumar K.V
Paolo Bonzini pbonz...@redhat.com writes: Il 05/12/2012 13:37, Paolo Bonzini ha scritto: I have tested the below patch. Currently i don't have a signed-off-by on the patch. One change noted by mohan which I incorporated in the patch is we need to call setresgid before calling setresuid. If

Re: [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid

2012-12-05 Thread Aneesh Kumar K.V
Hi, I have tested the below patch. Currently i don't have a signed-off-by on the patch. One change noted by mohan which I incorporated in the patch is we need to call setresgid before calling setresuid. If you are ok with this change I can send it upstream. commit

Re: [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid

2012-12-05 Thread Paolo Bonzini
Il 05/12/2012 09:35, Aneesh Kumar K.V ha scritto: I have tested the below patch. Currently i don't have a signed-off-by on the patch. One change noted by mohan which I incorporated in the patch is we need to call setresgid before calling setresuid. If you are ok with this change I can send it

Re: [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid

2012-12-04 Thread Aneesh Kumar K.V
Paolo Bonzini pbonz...@redhat.com writes: Il 11/10/2012 09:25, M. Mohan Kumar ha scritto: Also as per the man page: When glibc determines that the argument is not a valid user ID, it will return -1 and set errno to EINVAL without attempting the system call. If it

Re: [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid

2012-12-04 Thread M. Mohan Kumar
Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com writes: I found this to be confusing. How about avoiding all those pointers, something like below ? If you are ok can I add the signed-off-by for this ? I can test this and get a pull request out with the build fix. commit

Re: [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid

2012-10-11 Thread M. Mohan Kumar
Stefan Weil s...@weilnetz.de writes: We need to change fsuid and fsgid in 9p server side when 9p client wants to create a file with given uid and gid. In my case setfsuid and setfsgid never return -1 even if a normal user tries to change fsuid. I am running F17 and glibc is 2.15-56.fc17 IMHO

Re: [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid

2012-10-11 Thread Paolo Bonzini
Il 11/10/2012 09:25, M. Mohan Kumar ha scritto: Also as per the man page: When glibc determines that the argument is not a valid user ID, it will return -1 and set errno to EINVAL without attempting the system call. If it mean a nonexistent id by 'not a valid user ID'

[Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid

2012-10-10 Thread Paolo Bonzini
Fixes the following error with glibc 2.16 on Fedora 18: virtfs-proxy-helper.c: In function ‘setfsugid’: virtfs-proxy-helper.c:293:13: error: ignoring return value of ‘setfsgid’, declared with attribute warn_unused_result [-Werror=unused-result] virtfs-proxy-helper.c:294:13: error: ignoring

Re: [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid

2012-10-10 Thread Stefan Weil
Am 10.10.2012 13:32, schrieb Paolo Bonzini: Fixes the following error with glibc 2.16 on Fedora 18: virtfs-proxy-helper.c: In function ‘setfsugid’: virtfs-proxy-helper.c:293:13: error: ignoring return value of ‘setfsgid’, declared with attribute warn_unused_result [-Werror=unused-result]

Re: [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid

2012-10-10 Thread Paolo Bonzini
Il 10/10/2012 18:14, Stefan Weil ha scritto: diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c index f9a8270..b34a84a 100644 --- a/fsdev/virtfs-proxy-helper.c +++ b/fsdev/virtfs-proxy-helper.c @@ -290,8 +290,12 @@ static int setfsugid(int uid, int gid)

Re: [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid

2012-10-10 Thread Stefan Weil
Am 10.10.2012 18:17, schrieb Paolo Bonzini: Il 10/10/2012 18:14, Stefan Weil ha scritto: diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c index f9a8270..b34a84a 100644 --- a/fsdev/virtfs-proxy-helper.c +++ b/fsdev/virtfs-proxy-helper.c @@ -290,8 +290,12 @@ static int

Re: [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid

2012-10-10 Thread Paolo Bonzini
Il 10/10/2012 18:23, Stefan Weil ha scritto: 0 would be wrong because it looks like both functions never return negative values. I just wrote a small test program (see below) and called it with different uids with and without root rights. This pattern should be fine: new_uid =

Re: [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid

2012-10-10 Thread Stefan Weil
Am 10.10.2012 18:36, schrieb Paolo Bonzini: Il 10/10/2012 18:23, Stefan Weil ha scritto: 0 would be wrong because it looks like both functions never return negative values. I just wrote a small test program (see below) and called it with different uids with and without root rights. This

Re: [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid

2012-10-10 Thread Stefan Weil
Am 10.10.2012 18:54, schrieb Stefan Weil: Am 10.10.2012 18:36, schrieb Paolo Bonzini: Il 10/10/2012 18:23, Stefan Weil ha scritto: 0 would be wrong because it looks like both functions never return negative values. I just wrote a small test program (see below) and called it with different

Re: [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid

2012-10-10 Thread Paolo Bonzini
Il 10/10/2012 18:54, Stefan Weil ha scritto: if (setfsuid(uid) 0 || setfsuid(uid) != uid) { return -1; } but it seems wasteful to do four syscalls instead of two. I added a local variable in my example to avoid those extra syscalls. Note that the two setfsuid() calls

Re: [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid

2012-10-10 Thread Eric Blake
On 10/10/2012 05:32 AM, Paolo Bonzini wrote: Fixes the following error with glibc 2.16 on Fedora 18: virtfs-proxy-helper.c: In function ‘setfsugid’: virtfs-proxy-helper.c:293:13: error: ignoring return value of ‘setfsgid’, declared with attribute warn_unused_result [-Werror=unused-result]

Re: [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid

2012-10-10 Thread Eric Blake
On 10/10/2012 10:17 AM, Paolo Bonzini wrote: Il 10/10/2012 18:14, Stefan Weil ha scritto: diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c index f9a8270..b34a84a 100644 --- a/fsdev/virtfs-proxy-helper.c +++ b/fsdev/virtfs-proxy-helper.c @@ -290,8 +290,12 @@ static int