All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-trivial@nongnu.org, Stefan Weil <sw@weilnetz.de>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid
Date: Wed, 10 Oct 2012 11:58:22 -0600	[thread overview]
Message-ID: <5075B73E.9020506@redhat.com> (raw)
In-Reply-To: <50759F9E.3060800@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 995 bytes --]

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 setfsugid(int uid, int gid)
>>>           CAP_DAC_OVERRIDE,
>>>       };
>>>   -    setfsgid(gid);
>>> -    setfsuid(uid);
>>> +    if (setfsgid(gid) != 0) {
>>> +        return -1;
>>> +    }
>>
>> Wouldn't setfsgid(gid) == gid be also ok?
> 
> Of course, it should be < 0.  I have no idea how to test this thing...

POSIX states that uid_t and gid_t may be unsigned, so checking for < 0
is not necessarily possible (really, all you can check for is equality
with the same value as ((uid_t)-1) when put through integer promotion
rules).

-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 617 bytes --]

  parent reply	other threads:[~2012-10-10 17:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-10 11:32 [Qemu-trivial] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid Paolo Bonzini
2012-10-10 16:14 ` [Qemu-trivial] [Qemu-devel] " Stefan Weil
2012-10-10 16:17   ` Paolo Bonzini
2012-10-10 16:23     ` Stefan Weil
2012-10-10 16:36       ` Paolo Bonzini
2012-10-10 16:54         ` Stefan Weil
2012-10-10 16:59           ` Stefan Weil
2012-10-11  7:25             ` M. Mohan Kumar
2012-10-11 12:25               ` Paolo Bonzini
2012-12-04 18:55                 ` Aneesh Kumar K.V
2012-12-05  6:59                   ` M. Mohan Kumar
2012-12-05  8:35                   ` Aneesh Kumar K.V
2012-12-05 12:37                     ` Paolo Bonzini
2012-12-12 13:52                       ` [Qemu-trivial] " Paolo Bonzini
2012-12-12 16:50                         ` Aneesh Kumar K.V
2012-10-10 17:00           ` [Qemu-trivial] [Qemu-devel] " Paolo Bonzini
2012-10-10 17:58     ` Eric Blake [this message]
2012-10-10 17:55 ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5075B73E.9020506@redhat.com \
    --to=eblake@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=sw@weilnetz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.