From: Laurent Vivier <laurent@vivier.eu>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v5 8/8] linux-user: Split out some process syscalls
Date: Thu, 10 Jan 2019 15:17:14 +0100 [thread overview]
Message-ID: <7fc313fc-e9da-37fc-c632-62b846831c32@vivier.eu> (raw)
In-Reply-To: <20181219042113.7364-9-richard.henderson@linaro.org>
On 19/12/2018 05:21, Richard Henderson wrote:
> This includes clone, getgroups, gettid, setfsgid, setfsuid,
> setgroups, setsid, setuid, fork, getegid, getegid32, geteuid,
> geteuid32, getgid, getgid32, getgroups32, getpgrp, getpid,
> getppid, getresgid, getresgid32, getresuid, getresuid32,
> getuid, getuid32, getxgid, getxpid, getxuid, setfsgid32,
> setgsuid32, setgid32, setgroups32, setregid, setregid32,
> setresgid, setresgid32, setresuid, setresuid32, setreuid,
> setreuid32, setuid32, vfork.
I have errors with getgroups.
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> linux-user/syscall-defs.h | 121 +++++
> linux-user/syscall.h | 1 +
> linux-user/strace.c | 36 +-
> linux-user/syscall-proc.inc.c | 861 ++++++++++++++++++++++++++++++++++
> linux-user/syscall.c | 677 +-------------------------
> linux-user/strace.list | 147 ------
> 6 files changed, 988 insertions(+), 855 deletions(-)
> create mode 100644 linux-user/syscall-proc.inc.c
...
> diff --git a/linux-user/syscall-proc.inc.c b/linux-user/syscall-proc.inc.c
> new file mode 100644
> index 0000000000..dee441b4ff
> --- /dev/null
> +++ b/linux-user/syscall-proc.inc.c
...
> +
> +SYSCALL_IMPL(getgroups)
> +{
> + int gidsetsize = arg1;
> + gid_t *grouplist;
> + abi_long ret;
> +
kernel checks for gidsetsize < 0 and returns EINVAL in this case
> + grouplist = g_try_new(gid_t, gidsetsize);
> + if (!grouplist) {
> + return -TARGET_ENOMEM;
> + }
gidsetsize == 0 is a valid case (see man) but it fails with g_try_new().
Moreover, ENOMEM is not a valid error value for getgroups().
> + ret = get_errno(getgroups(gidsetsize, grouplist));
> +
> + if (!is_error(ret) && gidsetsize != 0) {
> + size_t target_grouplist_size = gidsetsize * sizeof(target_id);
> + target_id *target_grouplist
> + = lock_user(VERIFY_WRITE, arg2, target_grouplist_size, 0);
> + if (target_grouplist) {
> + int i;
> + for (i = 0; i < ret; i++) {
> + target_grouplist[i] = tswapid(high2lowgid(grouplist[i]));
> + }
> + unlock_user(target_grouplist, arg2, target_grouplist_size);
> + } else {
> + ret = -TARGET_EFAULT;
> + }
> + }
> + g_free(grouplist);
> + return ret;
> +}
> +
> +#ifdef TARGET_NR_getgroups32
> +SYSCALL_IMPL(getgroups32)
likewise.
Thanks,
Laurent
next prev parent reply other threads:[~2019-01-10 14:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-19 4:21 [Qemu-devel] [PATCH v5 0/8] linux-user: Split do_syscall Richard Henderson
2018-12-19 4:21 ` [Qemu-devel] [PATCH v5 1/8] linux-user: Setup split syscall infrastructure Richard Henderson
2018-12-19 4:21 ` [Qemu-devel] [PATCH v5 2/8] linux-user: Split out some simple file syscalls Richard Henderson
2018-12-19 4:21 ` [Qemu-devel] [PATCH v5 3/8] linux-user: Reduce regpairs_aligned & target_offset64 ifdefs Richard Henderson
2018-12-19 4:21 ` [Qemu-devel] [PATCH v5 4/8] linux-user: Split out preadv, pwritev, readv, writev, pread64, pwrite64 Richard Henderson
2019-01-10 15:17 ` Laurent Vivier
2019-01-11 21:31 ` Richard Henderson
2019-01-14 11:04 ` Laurent Vivier
2018-12-19 4:21 ` [Qemu-devel] [PATCH v5 5/8] linux-user: Split out name_to_handle_at, open_by_handle_at Richard Henderson
2018-12-19 4:21 ` [Qemu-devel] [PATCH v5 6/8] linux-user: Split out ipc syscalls Richard Henderson
2018-12-19 4:21 ` [Qemu-devel] [PATCH v5 7/8] linux-user: Split out memory syscalls Richard Henderson
2018-12-19 4:21 ` [Qemu-devel] [PATCH v5 8/8] linux-user: Split out some process syscalls Richard Henderson
2019-01-10 14:17 ` Laurent Vivier [this message]
2018-12-25 3:19 ` [Qemu-devel] [PATCH v5 0/8] linux-user: Split do_syscall no-reply
2019-01-09 9:50 ` Laurent Vivier
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=7fc313fc-e9da-37fc-c632-62b846831c32@vivier.eu \
--to=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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).