qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 12/32] bsd-user: Implement getgroups(2) and setgroups(2) syst


From: Richard Henderson
Subject: Re: [PATCH 12/32] bsd-user: Implement getgroups(2) and setgroups(2) system calls.
Date: Tue, 29 Aug 2023 12:53:17 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

On 8/27/23 08:57, Karim Taha wrote:
From: Stacey Son <sson@FreeBSD.org>

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Karim Taha <kariem.taha2.7@gmail.com>
---
  bsd-user/bsd-proc.h           | 44 +++++++++++++++++++++++++++++++++++
  bsd-user/freebsd/os-syscall.c |  9 +++++++
  2 files changed, 53 insertions(+)

diff --git a/bsd-user/bsd-proc.h b/bsd-user/bsd-proc.h
index b6225e520e..ecd6a13c2d 100644
--- a/bsd-user/bsd-proc.h
+++ b/bsd-user/bsd-proc.h
@@ -41,4 +41,48 @@ static inline abi_long do_bsd_exit(void *cpu_env, abi_long 
arg1)
      return 0;
  }
+/* getgroups(2) */
+static inline abi_long do_bsd_getgroups(abi_long gidsetsize, abi_long arg2)
+{
+    abi_long ret;
+    uint32_t *target_grouplist;
+    gid_t *grouplist;
+    int i;
+
+    grouplist = alloca(gidsetsize * sizeof(gid_t));

Don't use alloca for items that are sized by the guest.

Use g_autofree and g_try_new, failing with ENOMEM.

+/* setgroups(2) */
+static inline abi_long do_bsd_setgroups(abi_long gidsetsize, abi_long arg2)
+{
+    uint32_t *target_grouplist;
+    gid_t *grouplist;
+    int i;
+
+    grouplist = alloca(gidsetsize * sizeof(gid_t));

Likewise.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]