patch request for os.urandom()

Chris Angelico rosuav at gmail.com
Thu Jul 17 20:44:43 CEST 2014


On Fri, Jul 18, 2014 at 4:34 AM, Paul Rubin <no.email at nospam.invalid> wrote:
> Could os.urandom() be patched to use the new Linux getrandom() system
> call on systems where it is available?  Further info:
>
> http://lists.openwall.net/linux-kernel/2014/07/17/235

Uhm... does that even exist in kernel trunk yet? That's pretty
amazingly new. I would guess Python doesn't want to start using
something like that until it's *at least* appeared in a released
kernel; although of course you're welcome to run a patched Python on a
patched Linux to make use of this.

Trouble with that seems to be that it's reducing code paths from two
to... two. Instead of having a seldom-used code path for the fall-back
when there's no fd available, you instead have an alternate code path
for the fall-back when getrandom() doesn't exist. But if the Linux
guys decide to implement this, then you can take it to python-dev with
"This is supported by Linux 3.x.y" (or probably "Linux 3.x"), and
preferably a patch that includes something in ./configure to probe for
availability. Patches speak louder than words :)

ChrisA



More information about the Python-list mailing list