This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: [Patch] Use arc4random_buf() on CloudABI
Type: Stage:
Components: Interpreter Core Versions: Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: vstinner Nosy List: EdSchouten, christian.heimes, ncoghlan, vstinner
Priority: normal Keywords:

Created on 2016-07-30 10:56 by EdSchouten, last changed 2022-04-11 14:58 by admin.

Files
File name Uploaded Description Edit
patch-arc4random EdSchouten, 2016-07-30 10:56 Patch for using arc4random_buf() on CloudABI
patch-arc4random EdSchouten, 2016-09-07 12:47 Patch that also has comments review
Messages (5)
msg271680 - (view) Author: Ed Schouten (EdSchouten) * Date: 2016-07-30 10:56
While porting Python over to CloudABI (https://mail.python.org/pipermail/python-dev/2016-July/145708.html), we stumbled upon a small issue that caused the build to fail.

As CloudABI is a sandboxed runtime environment, there is no support for accessing the global filesystem namespace. This means that dev_urandom_noraise()/dev_urandom_python() are not capable of accessing /dev/urandom.

The attached change extends these functions to use CloudABI's arc4random_buf() function, which is also present on a lot of other operating systems (the BSDs, Mac OS X, etc). I'm not enabling the use of arc4random_buf() on those operating systems yet, as that should likely be decided by the people responsible for those ports.

Alternatively, if we do think arc4random_buf() should be used on all operating systems that support it, we can extend Autoconf to test for its presence. Be sure to let me know and I'll update the patch accordingly.
msg274749 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2016-09-07 04:15
Victor, Christian - this looks like another interesting platform-specific corner case for the system RNG wrapper.
msg274802 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2016-09-07 11:54
Thanks. The bare call to arc4random_buf() looks wrong at first. Please add a comment that arc4random_buf() cannot fail / does not report back errors.
msg274807 - (view) Author: Ed Schouten (EdSchouten) * Date: 2016-09-07 12:47
Sure thing! Attached is an updated patch.
msg274808 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2016-09-07 13:20
LGTM, but it's Victor's final call.
History
Date User Action Args
2022-04-11 14:58:34adminsetgithub: 71841
2016-09-07 13:20:23christian.heimessetassignee: vstinner
messages: + msg274808
2016-09-07 12:47:08EdSchoutensetfiles: + patch-arc4random

messages: + msg274807
2016-09-07 11:54:27christian.heimessetmessages: + msg274802
2016-09-07 04:15:03ncoghlansetnosy: + vstinner, christian.heimes, ncoghlan
messages: + msg274749
2016-07-30 10:56:14EdSchoutencreate