linux-user: Support setgroups syscall with no groups
PATCH 1/1 linux-user: Support setgroups syscall with no groups
From: Dillon Amburgey <[email protected]>
Signed-off-by Dillon Amburgey <[email protected]>
--- linux-user/syscall.c | 22 ++++++++++++---------- 1 files changed, 12 insertions(+), 10 deletions(-)
linux-user/syscall.c +12 -10
@@ -7653,18 +7653,20 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, {int gidsetsize = arg1;target_id *target_grouplist; -gid_t *grouplist; +gid_t *grouplist =NULL ;int i; - - grouplist =alloca (gidsetsize *sizeof (gid_t)); - target_grouplist =lock_user (VERIFY_READ , arg2, gidsetsize *2 ,1 ); -if (!target_grouplist) { - ret = -TARGET_EFAULT ; - goto fail; +if (gidsetsize) { + grouplist =alloca (gidsetsize *sizeof (gid_t)); + target_grouplist =lock_user (VERIFY_READ , arg2, gidsetsize *2 ,1 ); +if (!target_grouplist) { + ret = -TARGET_EFAULT ; + goto fail; + } +for (i =0 ; i < gidsetsize; i++) { + grouplist[i] =low2highgid (tswapid (target_grouplist[i])); + } +unlock_user (target_grouplist, arg2,0 ); } -for (i =0 ;i < gidsetsize; i++) - grouplist[i] =low2highgid (tswapid (target_grouplist[i])); -unlock_user (target_grouplist, arg2,0 ); ret =get_errno (setgroups (gidsetsize, grouplist)); }break ;
Signature · 1 line
1.7.5.4
Quoted 3 lines · On 2 February 2013 23:04, <[email protected]> wrote:
From: Dillon Amburgey <[email protected]>
Signed-off-by Dillon Amburgey <[email protected]>
Reviewed-by Peter Maydell <[email protected]>
-- PMM