[PATCH v3] posix: Deprecate group_member for Linux

Florian Weimer fweimer@redhat.com
Tue Oct 17 14:00:00 GMT 2023


* 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,
Florian



More information about the Libc-alpha mailing list