[PATCH 2/2] linux: use __getrandom_nocancel in getentropy

Cristian Rodríguez cristian@rodriguez.im
Sat Nov 22 14:35:01 GMT 2025


On Wed, Feb 12, 2025 at 6:40 PM Cristian Rodríguez
<cristian@rodriguez.im> wrote:
>
> On Wed, Feb 12, 2025 at 9:57 AM Adhemerval Zanella Netto
> <adhemerval.zanella@linaro.org> wrote:
>
> >
> > And remove both sysdeps/mach/hurd/getentropy.c and sysdeps/unix/sysv/linux/getentropy.c
>
>
> OK, Im gonna post an improved version later.

Went back to this again.. what to do with GETENTROPY_MAX now.. ? Posix says

{GETENTROPY_MAX}The maximum value of the length argument in calls to
the getentropy() function.
Minimum Acceptable Value: 256

However since:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e3c1c4fd9e6d14059ed93ebfe15e1c57793b1a05

 The kernel special case is PAGE_SIZE not 256..and the special 256
never worked in the first place..

So at least for the linux parts

- GETENTROPY_MAX == 256 ? and forget such a limit will not be enforced?
-  GETENTROPY_MAX == getpagesize() ? because PAGE_SIZE is not fixed in
userspace?
- Do not define it all.. make the wrapper return EINVAL if bigger than
a pagesize to match the current kernel special case.

looking forward to your inputs.


More information about the Libc-alpha mailing list