From 746ad15912cfa82271424747e94d8125acc43d8c Mon Sep 17 00:00:00 2001 From: Ryan Prichard Date: Thu, 22 Nov 2018 03:16:06 -0800 Subject: 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 --- libc/bionic/bionic_arc4random.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'libc/bionic/bionic_arc4random.cpp') 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 -#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(args.getauxval(AT_RANDOM)) + at_random_bytes_consumed, n); + memcpy(buf, reinterpret_cast(getauxval(AT_RANDOM)) + at_random_bytes_consumed, n); at_random_bytes_consumed += n; return; } -- cgit v1.2.3