aboutsummaryrefslogtreecommitdiffstats
path: root/libc/bionic/bionic_arc4random.cpp
diff options
context:
space:
mode:
authorRyan Prichard <rprichard@google.com>2018-11-22 03:16:06 -0800
committerRyan Prichard <rprichard@google.com>2018-12-03 17:14:44 -0800
commit746ad15912cfa82271424747e94d8125acc43d8c (patch)
treeb0744ec1a4a69acb0f5d54b92b13a337e82f05d2 /libc/bionic/bionic_arc4random.cpp
parentbdab4a2b97c53af0205788875342ec08e6901376 (diff)
downloadandroid_bionic-746ad15912cfa82271424747e94d8125acc43d8c.tar.gz
android_bionic-746ad15912cfa82271424747e94d8125acc43d8c.tar.bz2
android_bionic-746ad15912cfa82271424747e94d8125acc43d8c.zip
Replace TLS_SLOT_BIONIC_PREINIT w/ shared globals
Instead of passing the address of a KernelArgumentBlock to libc.so for initialization, use __loader_shared_globals() to initialize globals. Most of the work happened in the previous CLs. This CL switches a few KernelArgumentBlock::getauxval calls to [__bionic_]getauxval and stops routing the KernelArgumentBlock address through the libc init functions. Bug: none Test: bionic unit tests Change-Id: I96c7b02c21d55c454558b7a5a9243c682782f2dd
Diffstat (limited to 'libc/bionic/bionic_arc4random.cpp')
-rw-r--r--libc/bionic/bionic_arc4random.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/libc/bionic/bionic_arc4random.cpp b/libc/bionic/bionic_arc4random.cpp
index fa2617f0d..74ac43cb2 100644
--- a/libc/bionic/bionic_arc4random.cpp
+++ b/libc/bionic/bionic_arc4random.cpp
@@ -35,9 +35,7 @@
#include <async_safe/log.h>
-#include "private/KernelArgumentBlock.h"
-
-void __libc_safe_arc4random_buf(void* buf, size_t n, KernelArgumentBlock& args) {
+void __libc_safe_arc4random_buf(void* buf, size_t n) {
// Only call arc4random_buf once we have `/dev/urandom` because getentropy(3)
// will fall back to using `/dev/urandom` if getrandom(2) fails, and abort if
// if can't use `/dev/urandom`.
@@ -53,7 +51,7 @@ void __libc_safe_arc4random_buf(void* buf, size_t n, KernelArgumentBlock& args)
16 - at_random_bytes_consumed, n);
}
- memcpy(buf, reinterpret_cast<char*>(args.getauxval(AT_RANDOM)) + at_random_bytes_consumed, n);
+ memcpy(buf, reinterpret_cast<char*>(getauxval(AT_RANDOM)) + at_random_bytes_consumed, n);
at_random_bytes_consumed += n;
return;
}