[PATCH v3] linux-user: fix getgroups/setgroups allocations

2023-04-09 Thread Michael Tokarev
linux-user getgroups(), setgroups(), getgroups32() and setgroups32() used alloca() to allocate grouplist arrays, with unchecked gidsetsize coming from the "guest". With NGROUPS_MAX being 65536 (linux, and it is common for an application to allocate NGROUPS_MAX for getgroups()), this means a typica

Re: [PATCH v3] linux-user: fix getgroups/setgroups allocations

2023-04-09 Thread Michael Tokarev
09.04.2023 13:48, Michael Tokarev пишет: .. v3: - fix a bug in getgroups(). In initial implementation I checked for ret>0 in order to convert returned list of groups to target byte order. But this clashes with unusual corner case for this syscall: getgroups(0,NULL) return current nu