[Bug libc/32440] New: getrandom() in glibc 2.40 returns EINVAL as retcode instead of errno

jan.stancek at gmail dot com sourceware-bugzilla@sourceware.org
Tue Dec 10 11:13:01 GMT 2024


https://sourceware.org/bugzilla/show_bug.cgi?id=32440

            Bug ID: 32440
           Summary: getrandom() in glibc 2.40 returns EINVAL as retcode
                    instead of errno
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: jan.stancek at gmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

-------------------------- 8< ------------------------------
#include <sys/random.h>
#include <stdio.h>
#include <errno.h>

int main(void)
{
        char buf[50];
        int ret = getrandom(buf, 50, -1);
        printf("%d %d\n", ret, errno);
}
-------------------------- 8< ------------------------------

using VDSO implementation (the defalut) it returns:
# ./a.out 
22 0

while I'd expect -1 22 - same as returned by "syscall(__NR_getrandom, 50, -1)"

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list