summaryrefslogtreecommitdiff
path: root/pod/perlrun.pod
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2022-03-06 09:42:14 +0100
committerYves Orton <demerphq@gmail.com>2022-03-10 03:22:33 +0100
commitc3c9d6b15f57fdce79988a553671a1ceb54c0f10 (patch)
treeedf6ddb1f711af36059bea8ec21790a0933d68a5 /pod/perlrun.pod
parent8a35994ac8fcc50aaed538b7625ba79635683630 (diff)
downloadperl-c3c9d6b15f57fdce79988a553671a1ceb54c0f10.tar.gz
hv.c - rework PL_hash_rand_bits update logic, add tests, -Dh debug mode
This moves all run time mutations of PL_hash_rand_bits into a set of macros which allow us to debug what is happening. It also moves away from our poor mans RNG based on mixing in various sources of data as we go and switches to using an XORSHIFT RNG for generating the random bits. This particular RNG is very efficient, using three xor operations and three shift operations, so it shouldn't hurt us to use it. As a bonus it also removes the conditional logic involved, as we use seed() to initialize things at the very beginning when we are running under RANDOMIZE mode, which should fix any problems with running on platforms that do not use process space randomization like cygwin. It adds support for -Dh under DEBUGGING to allow introspection of the the state of PL_hash_rand_bits and source and cause of changes to it. With -Dhv you can also get an idea of the keys which are triggering these mutations as well. -Dh has also been changed to imply PERL_HASH_SEED_DEBUG as a convenience. This goes alongside a new test, based on one from Nicholas R (atoomic) to test that the various PERL_PERTURB_KEYS options behave as expected and that 1 bit mutations of the seed actually *do* affect the key order and hashing of our strings. The test is run many times to ensure that it passes under many different randomly generated hash seeds. Parts of this test would fail without the preceding commit to this one adjusting how SBOX32 is initialized.
Diffstat (limited to 'pod/perlrun.pod')
-rw-r--r--pod/perlrun.pod2
1 files changed, 2 insertions, 0 deletions
diff --git a/pod/perlrun.pod b/pod/perlrun.pod
index f2ecfad7da..3202e13c94 100644
--- a/pod/perlrun.pod
+++ b/pod/perlrun.pod
@@ -411,6 +411,8 @@ B<-D14> is equivalent to B<-Dtls>):
2048 u Tainting checks
4096 U Unofficial, User hacking (reserved for private,
unreleased use)
+ 8192 h Show hash randomization debug output (changes to
+ PL_hash_rand_bits and their origin)
16384 X Scratchpad allocation
32768 D Cleaning up
65536 S Op slab allocation