Use PR_SET_VMA_ANON_NAME to name the abort message mapping.

This makes it easier for tools to find the mapping. I am planning
to use this in crashpad to add HWASAN reports to the minidump.

Bug: http://crbug.com/crashpad/287
Change-Id: I600e551ef26d6ff62849319365d77912afa82fde
This commit is contained in:
Peter Collingbourne 2019-03-27 14:28:57 -07:00
parent 2e824e3150
commit feb5ed1b54
1 changed files with 5 additions and 0 deletions

View File

@ -33,6 +33,7 @@
#include <stddef.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/prctl.h>
#include "private/bionic_defs.h"
#include "private/bionic_globals.h"
@ -82,6 +83,10 @@ void android_set_abort_message(const char* msg) {
return;
}
// Name the abort message mapping to make it easier for tools to find the
// mapping.
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, map, size, "abort message");
magic_abort_msg_t* new_magic_abort_message = reinterpret_cast<magic_abort_msg_t*>(map);
fill_abort_message_magic(new_magic_abort_message);
new_magic_abort_message->msg.size = size;