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.

Author dmalcolm
Recipients Arach, Arfrever, Huzaifa.Sidhpurwala, Jim.Jewett, Mark.Shannon, PaulMcMillan, Zhiping.Deng, alex, barry, benjamin.peterson, christian.heimes, dmalcolm, eric.araujo, eric.snow, fx5, georg.brandl, grahamd, gregory.p.smith, gvanrossum, gz, jcea, lemburg, loewis, mark.dickinson, neologix, pitrou, skorgu, skrah, terry.reedy, tim.peters, v+python, vstinner, zbysz
Date 2012-02-02.01:18:25
SpamBayes Score 1.00181e-12
Marked as misclassified No
Message-id <1328145445.18775.14.camel@surprise>
In-reply-to <>
On Mon, 2012-01-30 at 23:41 +0000, Martin wrote:
> Martin <> added the comment:
> > Has anyone had a chance to try this patch on Windows?  Martin?  I'm
> > hoping that it doesn't impose a startup cost in the default
> > no-randomization cost, and that any startup cost in the -R case is
> > acceptable.
> Just tested as requested. Is the patch against 3.1 for a reason? Can't
> really be compared to earlier results, but get enough weird outliers
> that that may not be useful anyway. Also needed the following change:
> -+        chunk = Py_MIN(size, INT_MAX);
> ++        chunk = size > INT_MAX ? INT_MAX : size;
> Summary, looks like extra work in the default case is avoided and
> isn't crippling otherwise, though there were a couple of very odd runs
> not presented probably due to other disk access.

Thanks for testing this!

Oops, yes: Py_MIN is only present in "default" [it was added to
Include/Python.h (as PY_MIN) in 72475:8beaa9a37387 for PEP 393, renamed
to Py_MIN in 72489:dacac31460c0, eventually reaching Include/pymacro.h
in 72512:36fc514de7f0]

"orig_size" in win32_urandom was apparently unused, so I've removed it.

I also found and fixed an occasional failure in my 2.6 backport of the
new test_os.URandomTests.get_urandom_subprocess.

Am attaching 4 patches containing the above changes, plus patches to fix
dict/set ordering assumptions that start breaking if you try to run the
test suite with randomization enabled:

2.6 also could use the dict-ordering fix for test_symtable that was
fixed in 2.7 as 74256:789d59773801

FWIW I'm seeing a failure this failure in test_urllib2, but I also see
it with a clean checkout of 2.6:
ERROR: test_invalid_redirect (__main__.HandlerTests)
Traceback (most recent call last):
  File "Lib/test/", line 963, in test_invalid_redirect
    MockHeaders({"location": valid_url}))
"/home/david/coding/python-hg/cpython-2.6-hash-randomization/Lib/", line 616, in http_error_302
    return, timeout=req.timeout)
"/home/david/coding/python-hg/cpython-2.6-hash-randomization/Lib/", line 218, in __getattr__
    raise AttributeError, attr
AttributeError: timeout
File name Uploaded
add-randomization-to-2.6-dmalcolm-2012-02-01-001.patch dmalcolm, 2012-02-02.01:18:06
add-randomization-to-3.1-dmalcolm-2012-02-01-001.patch dmalcolm, 2012-02-02.01:18:17
fix-broken-tests-on-2.6-dmalcolm-2012-02-01-001.patch dmalcolm, 2012-02-02.01:18:17
fix-broken-tests-on-3.1-dmalcolm-2012-02-01-001.patch dmalcolm, 2012-02-02.01:18:23
Date User Action Args
2012-02-02 01:18:31dmalcolmsetrecipients: + dmalcolm, lemburg, gvanrossum, tim.peters, loewis, barry, georg.brandl, terry.reedy, gregory.p.smith, jcea, mark.dickinson, pitrou, vstinner, christian.heimes, benjamin.peterson, eric.araujo, grahamd, Arfrever, v+python, alex, zbysz, skrah, gz, neologix, Arach, Mark.Shannon, eric.snow, Zhiping.Deng, Huzaifa.Sidhpurwala, Jim.Jewett, PaulMcMillan, fx5, skorgu
2012-02-02 01:18:27dmalcolmlinkissue13703 messages
2012-02-02 01:18:26dmalcolmcreate