about summary refs log tree commit diff
path: root/src/prng/lrand48.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2022-06-03 18:54:41 -0400
committerRich Felker <dalias@aerifal.cx>2022-06-03 18:54:41 -0400
commit4100279825c17807bdabf1c128ba4e49a1dea406 (patch)
tree5b9477609bce9bb38843ac5b38d31a59244335d6 /src/prng/lrand48.c
parent6c858d6fd4df8b5498ef2cae66c8f3c3eff1587b (diff)
downloadmusl-4100279825c17807bdabf1c128ba4e49a1dea406.tar.gz
musl-4100279825c17807bdabf1c128ba4e49a1dea406.tar.xz
musl-4100279825c17807bdabf1c128ba4e49a1dea406.zip
remove random filename obfuscation that leaks ASLR information
the __randname function is used by various temp file creation
interfaces as a backend to produce a name to attempt using. it does
not have to produce results that are safe against guessing, and only
aims to avoid unintentional collisions.

mixing the address of an object on the stack in a reversible manner
leaked ASLR information, potentially allowing an attacker who can
observe the temp files created and their creation timestamps to narrow
down the possible ASLR state of the process that created them. there
is no actual value in mixing these addresses in; it was just
obfuscation. so don't do it.

instead, mix the tid, just to avoid collisions if multiple
processes/threads stampede to create temp files at the same moment.
even without this measure, they should not collide unless the clock
source is very low resolution, but it's a cheap improvement.

if/when we have a guaranteed-available userspace csprng, it could be
used here instead. even though there is no need for cryptographic
entropy here, it would avoid having to reason about clock resolution
and such to determine whether the behavior is nice.
Diffstat (limited to 'src/prng/lrand48.c')
0 files changed, 0 insertions, 0 deletions