[PATCH v2] miscutils/seedrng.c: fix <sys/random.h> include error on glibc < 2.25

Steffen Nurpmeso steffen at sdaoden.eu
Fri Feb 17 19:57:22 UTC 2023


Thomas Devoogdt wrote in
 <CACXRmJjuTdoz551xv0Zez2--TWEV-oTZRE+jcv6GiA0ZShRU0g at mail.gmail.com>:
 |Perhaps the whole function should be rewritten to simply fallback to that
 |syscall rather than directly fallback to /dev/random?

Better not.

 |Or should I replace the define (-1) by that syscall?

It was more a well hm joke.  But i have

    fill = su_RANDOM_GETRANDOM_FUN(rdp->b8, a_RANDOM_SEED_BYTES);

coming from

        #define su_RANDOM_GETRANDOM_FUN(B,S) getrandom(B, S, 0)
        #define su_RANDOM_GETRANDOM_H <sys/random.h>' <<\!

or

        #define su_RANDOM_GETRANDOM_FUN(B,S) syscall(SYS_getrandom, B, S, 0)
        #define su_RANDOM_GETRANDOM_H <sys/syscall.h>' <<\!

but configure-time (and user choosable).
I mean, busybox _does_ use syscall(2) in a few places, looking for
SYS_getrandom and trying that would be just one more use case.
Years passed in between the syscall and the glibc.

Having said that, simply going /dev/random (or even /dev/urandom,
possibly, maybe, now i had to check the kernel sources) after
getrandom is imho complication enough for this thing.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


More information about the busybox mailing list