From 516fcb28f2fb591e9ae14f909acf00ca5a8b0dc6 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sat, 1 Aug 2015 22:25:42 -0400 Subject: [PATCH] name the arc4random structure mappings Change-Id: I6e150e526f6ceee31aa9bd219fa45317d5a729cb --- libc/upstream-openbsd/android/include/arc4random.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libc/upstream-openbsd/android/include/arc4random.h b/libc/upstream-openbsd/android/include/arc4random.h index c07257d24..96d9c9a26 100644 --- a/libc/upstream-openbsd/android/include/arc4random.h +++ b/libc/upstream-openbsd/android/include/arc4random.h @@ -27,6 +27,8 @@ #include #include +#include "private/bionic_prctl.h" + // Android gets these from "thread_private.h". #include "thread_private.h" //static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; @@ -76,12 +78,18 @@ _rs_allocate(struct _rs **rsp, struct _rsx **rsxp) MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) return (-1); + prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, *rsp, sizeof(**rsp), + "arc4random _rs structure"); + if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) { munmap(*rsxp, sizeof(**rsxp)); return (-1); } + prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, *rsxp, sizeof(**rsxp), + "arc4random _rsx structure"); + _ARC4_ATFORK(_rs_forkhandler); return (0); }