[Toybox] getrandom(2)

Rob Landley rob at landley.net
Fri Jul 13 10:33:47 PDT 2018


On 07/06/2018 09:55 PM, enh wrote:
> Oh, weird. I didn't know that. My Linux hosts usually have the opposite problem
> of a kernel years newer than their libc. 
> 
>     Lemme try a fix... ok, how's that?
> 
> I was actually assuming you'd be best off just removing the compile time check
> and using syscall(3). Wouldn't that be best for your musl prebuilts? And still
> work fine for glibc. 

Today I got https://github.com/landley/toybox/pull/97.patch and went "wait,
shouldn't that have broken on my Ubuntu 16.04 test?" and dug into it and...
ubuntu 16.04 isn't enabling getrandom() either, because
http://man7.org/linux/man-pages/man2/getrandom.2.html lies about sys/random.h
being a thing (you need to use linux/random.h) because
https://lwn.net/Articles/711013/ and...

This is not ripe. I'm leaning towards ripping it back _out_ again and waiting a
few more years.

That said, the syscall is there even in ubuntu 14.04 (4.4 kernel, syscall
introduced in 3.17). The other option is wrapping the syscall myself in
portability.h and saying that the libc support is too broken for words because
glibc's stopped viably leading anything.

Rob

P.S. I tried to upgrade to a system that could run the android NDK x86-64
binaries (rather than illegal instruction segfaulting in the startup code
because x86-64 has i386/i486/i586/i686 versions now but doesn't name them in a
way that makes it remotely obvious anymore), but as with the last time I bought
something from system76 what I thought was a netbook turns out to need wheels
and a handle to be considered "portable". So that's still not part of my regular
testing environment quite yet simply because I never have it _with_ me...


More information about the Toybox mailing list