diff options
author | Kostya Kortchinsky <kostyak@google.com> | 2017-06-21 15:56:03 +0000 |
---|---|---|
committer | Kostya Kortchinsky <kostyak@google.com> | 2017-06-21 15:56:03 +0000 |
commit | 2b053b1c28bd1df6475ae133766db2f52dd564e8 (patch) | |
tree | 60a44660705e270db65616539603fc30561a4510 /llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp | |
parent | c1b6aa77bbdb7c022a47f435ecfc557f01988d3f (diff) | |
download | llvm-2b053b1c28bd1df6475ae133766db2f52dd564e8.zip llvm-2b053b1c28bd1df6475ae133766db2f52dd564e8.tar.gz llvm-2b053b1c28bd1df6475ae133766db2f52dd564e8.tar.bz2 |
[sanitizer] Add a function to gather random bytes
Summary:
AFAICT compiler-rt doesn't have a function that would return 'good' random
bytes to seed a PRNG. Currently, the `SizeClassAllocator64` uses addresses
returned by `mmap` to seed its PRNG, which is not ideal, and
`SizeClassAllocator32` doesn't benefit from the entropy offered by its 64-bit
counterpart address space, so right now it has nothing. This function aims at
solving this, allowing to implement good 32-bit chunk randomization. Scudo also
has a function that does this for Cookie purposes, which would go away in a
later CL once this lands.
This function will try the `getrandom` syscall if available, and fallback to
`/dev/urandom` if not.
Unfortunately, I do not have a way to implement and test a Mac and Windows
version, so those are unimplemented as of now. Note that `kRandomShuffleChunks`
is only used on Linux for now.
Reviewers: alekseyshl
Reviewed By: alekseyshl
Subscribers: zturner, rnk, llvm-commits, kubamracek
Differential Revision: https://reviews.llvm.org/D34412
llvm-svn: 305922
Diffstat (limited to 'llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp')
0 files changed, 0 insertions, 0 deletions