Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!hq-usenetpeers!hq-usenetpeers.eweka.nl!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.025 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; '"this': 0.03; 'preferably': 0.05; 'paths': 0.07; 'subject:()': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'exist.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'patches': 0.16; 'subject:patch': 0.16; 'two.': 0.16; 'wrote:': 0.18; 'subject:request': 0.19; 'seems': 0.21; 'cc:addr:python.org': 0.22; 'alternate': 0.24; 'decide': 0.24; 'guys': 0.24; 'paul': 0.24; '(or': 0.24; 'cc:2**0': 0.24; 'supported': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'patch': 0.29; 'words': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'this.': 0.32; 'probably': 0.32; 'run': 0.32; 'linux': 0.33; 'fri,': 0.33; 'guess': 0.33; 'trouble': 0.34; 'could': 0.34; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'two': 0.37; 'implement': 0.38; 'does': 0.39; 'even': 0.60; 'new': 0.61; 'course': 0.61; "you're": 0.61; 'further': 0.61; 'url:17': 0.68; 'jul': 0.74; './configure': 0.84; 'python-dev': 0.84; 'url:2014': 0.84; 'yet?': 0.84; 'probe': 0.91; 'to:none': 0.92; 'reducing': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=CMebIVus1TFecYng/F49ql+ycGfAywITqAqkkFmvtts=; b=ZH4ZqbgcNcBAg/s4mkBDrAlqpmUZpSBX+3FZWX2uzxKyc/WFugdpgF/Zmx9fK3AEPz grpr5xGWPN01y+WD7zKzQwPwBvUBSNAdCEmC/0EQ54fs3WoPyXm2wkpSrjbLk18IoAI5 K9yKPshk1w8fHPa886PAeTc/04ntbplWqr1tyd9vPmT4s3YOlkZ2t7vpOK28fJ0pwn/y Orb5Dp9JUCOdbp+FEY/l3MErDE/oERsnYSXRCsZ/cx6olk51I9AXK2kDiK537Q1aRD7k G+xoRZGeAa0JgTypDEpJuNQBBVccvApLZqesUMbdYqFqZt0HxI9+AWrVhTGK+qL6HovC inLw== MIME-Version: 1.0 X-Received: by 10.52.248.232 with SMTP id yp8mr12754376vdc.83.1405622683378; Thu, 17 Jul 2014 11:44:43 -0700 (PDT) In-Reply-To: <7xlhrrkf6h.fsf@ruckus.brouhaha.com> References: <7xlhrrkf6h.fsf@ruckus.brouhaha.com> Date: Fri, 18 Jul 2014 04:44:43 +1000 Subject: Re: patch request for os.urandom() From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1405622692 news.xs4all.nl 2927 [2001:888:2000:d::a6]:38390 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 4469 X-Received-Body-CRC: 3903117751 Xref: csiph.com comp.lang.python:74671 On Fri, Jul 18, 2014 at 4:34 AM, Paul Rubin 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