From: "Lauro Ramos Venancio" <lauro.venancio@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [patch] fix getgroups and getgroups32 syscalls
Date: Fri, 7 Dec 2007 20:17:18 -0300 [thread overview]
Message-ID: <9c10c9f0712071517k3832dea4te2706e302c085e2f@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 354 bytes --]
The attached patch fixes a bug in getgroups and getgroups32 syscalls.
The current implementation returns error when size=0.
According the manual:
" If size is zero, list is not modified, but the total number of
supplementary group IDs for the process is returned."
--
Lauro Ramos Venancio
OpenBossa Labs - Instituto Nokia de Tecnologia
Recife - Brazil
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 00_fix_getgroups.patch --]
[-- Type: text/x-patch; name=00_fix_getgroups.patch, Size: 1608 bytes --]
Index: qemu-arm-eabi/linux-user/syscall.c
===================================================================
--- qemu-arm-eabi.orig/linux-user/syscall.c 2007-12-07 19:59:03.000000000 -0300
+++ qemu-arm-eabi/linux-user/syscall.c 2007-12-07 20:01:47.000000000 -0300
@@ -5024,12 +5024,13 @@
{
int gidsetsize = arg1;
uint16_t *target_grouplist;
- gid_t *grouplist;
+ gid_t *grouplist = NULL;
int i;
- grouplist = alloca(gidsetsize * sizeof(gid_t));
+ if (gidsetsize)
+ grouplist = alloca(gidsetsize * sizeof(gid_t));
ret = get_errno(getgroups(gidsetsize, grouplist));
- if (!is_error(ret)) {
+ if (gidsetsize && !is_error(ret)) {
target_grouplist = lock_user(VERIFY_WRITE, arg2, gidsetsize * 2, 0);
if (!target_grouplist)
goto efault;
@@ -5174,12 +5175,13 @@
{
int gidsetsize = arg1;
uint32_t *target_grouplist;
- gid_t *grouplist;
+ gid_t *grouplist = NULL;
int i;
- grouplist = alloca(gidsetsize * sizeof(gid_t));
+ if (gidsetsize)
+ grouplist = alloca(gidsetsize * sizeof(gid_t));
ret = get_errno(getgroups(gidsetsize, grouplist));
- if (!is_error(ret)) {
+ if (gidsetsize && !is_error(ret)) {
target_grouplist = lock_user(VERIFY_WRITE, arg2, gidsetsize * 4, 0);
if (!target_grouplist) {
ret = -TARGET_EFAULT;
next reply other threads:[~2007-12-07 23:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-07 23:17 Lauro Ramos Venancio [this message]
2007-12-08 12:50 ` [Qemu-devel] [patch] fix getgroups and getgroups32 syscalls Kirill A. Shutemov
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=9c10c9f0712071517k3832dea4te2706e302c085e2f@mail.gmail.com \
--to=lauro.venancio@gmail.com \
--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).