[PATCH v3] posix: Deprecate group_member for Linux
Joe Simmons-Talbott
josimmon@redhat.com
Tue Oct 17 14:34:51 GMT 2023
On Tue, Oct 17, 2023 at 04:00:00PM +0200, Florian Weimer wrote:
> * Joe Simmons-Talbott:
>
> > The alloca usage in group_member could lead to stack overflow on Linux.
> > Removing the alloca usage would require group_member to handle the error
> > condition where memory could not be allocated and that cannot be done
> > since group_member returns a boolean value. Thus deprecate group_member.
> > Add a testcase.
> > ---
> > Changes to v2:
> > * Move the linux group_member.h to the bits directory
> > * Include the correct group_member.h in posix/unistd.h
> >
> > NEWS | 5 ++-
> > bits/group_member.h | 31 ++++++++++++++++
> > posix/Makefile | 4 ++
> > posix/tst-group_member.c | 41 +++++++++++++++++++++
> > posix/unistd.h | 6 +--
> > sysdeps/unix/sysv/linux/bits/group_member.h | 32 ++++++++++++++++
> > 6 files changed, 115 insertions(+), 4 deletions(-)
> > create mode 100644 bits/group_member.h
> > create mode 100644 posix/tst-group_member.c
> > create mode 100644 sysdeps/unix/sysv/linux/bits/group_member.h
>
> There are __group_member calls in sysdeps/posix/euidaccess.c and
> sysdeps/unix/sysv/linux/faccessat.c. We can return ENOMEM in those
> cases. Furthermore, euidaccess should really be layered on top of
> faccessat (and use kernel support for AT_EACCESS if available).
>
> Those are separate changes, but necessary to avoid exposing the alloca
> path to non-deprecated functionality.
Thanks for pointing those out. So are you suggesting that I perhaps do
need to create an internal only __group_member2 that uses malloc or a
scratch_buffer?
Thanks,
Joe
More information about the Libc-alpha
mailing list