From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: Laurent Vivier <laurent@vivier.eu>
Subject: Re: [PATCH] linux-user: Return EINVAL for getgroups() with negative gidsetsize
Date: Fri, 2 Jun 2023 22:04:43 +0200 [thread overview]
Message-ID: <50dd74e9-94db-a516-c455-58f8f8a64405@linaro.org> (raw)
In-Reply-To: <20230602174806.2060683-1-peter.maydell@linaro.org>
On 2/6/23 19:48, Peter Maydell wrote:
> Coverity doesn't like the way we might end up calling getgroups()
> with a NULL grouplist pointer. This is fine for the special case
> of gidsetsize == 0, but we will also do it if the guest passes
> us a negative gidsetsize. (CID 1512465)
>
> Explicitly fail the negative gidsetsize with EINVAL, as the kernel
> does. This means we definitely only call the libc getgroups()
> with valid parameters.
>
> Possibly Coverity may still complain about getgroups(0, NULL), but
> that would be a false positive.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> linux-user/syscall.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
next prev parent reply other threads:[~2023-06-02 20:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-02 17:48 [PATCH] linux-user: Return EINVAL for getgroups() with negative gidsetsize Peter Maydell
2023-06-02 18:05 ` Laurent Vivier
2023-06-02 20:04 ` Philippe Mathieu-Daudé [this message]
2023-06-03 17:08 ` Michael Tokarev
2023-06-03 17:11 ` Michael Tokarev
2023-06-09 8:04 ` Michael Tokarev
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=50dd74e9-94db-a516-c455-58f8f8a64405@linaro.org \
--to=philmd@linaro.org \
--cc=laurent@vivier.eu \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).