diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-12-14 00:01:18 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-12-14 00:01:18 +0000 |
commit | 887dc4cf4ae9f6c2d4d529adffe87014bbaa4a4a (patch) | |
tree | c72d4ffdacda2da1892288a4dac9f43ace6f0377 | |
parent | 011cbd22f73d8dcd5cdbbecdc6626ca6f36f8a03 (diff) | |
parent | 16f36f1c0ee546f7e350ea45fd30189586427363 (diff) | |
download | bionic-android14-qpr2-s1-release.tar.gz |
Snap for 11216811 from 16f36f1c0ee546f7e350ea45fd30189586427363 to 24Q1-releaseandroid-14.0.0_r37android-14.0.0_r36android-14.0.0_r35android-14.0.0_r34android-14.0.0_r33android-14.0.0_r32android-14.0.0_r31android-14.0.0_r30android-14.0.0_r29android14-qpr2-s5-releaseandroid14-qpr2-s4-releaseandroid14-qpr2-s3-releaseandroid14-qpr2-s2-releaseandroid14-qpr2-s1-releaseandroid14-qpr2-release
Change-Id: I0a2d617f070762f696ab1d5c58135cd1d96c4f38
-rw-r--r-- | libc/bionic/vdso.cpp | 12 | ||||
-rw-r--r-- | libc/platform/bionic/tls_defines.h | 14 |
2 files changed, 19 insertions, 7 deletions
diff --git a/libc/bionic/vdso.cpp b/libc/bionic/vdso.cpp index d0f01d0a7..0a9a9e540 100644 --- a/libc/bionic/vdso.cpp +++ b/libc/bionic/vdso.cpp @@ -131,6 +131,7 @@ void __libc_init_vdso(libc_globals* globals) { for (size_t i = 0; i < vdso_ehdr->e_shnum; ++i) { if (vdso_shdr[i].sh_type == SHT_DYNSYM) { symbol_count = vdso_shdr[i].sh_size / sizeof(ElfW(Sym)); + break; } } if (symbol_count == 0) { @@ -147,6 +148,7 @@ void __libc_init_vdso(libc_globals* globals) { } else if (vdso_phdr[i].p_type == PT_LOAD) { vdso_addr = vdso_ehdr_addr + vdso_phdr[i].p_offset - vdso_phdr[i].p_vaddr; } + if (vdso_addr && vdso_dyn) break; } if (vdso_addr == 0 || vdso_dyn == nullptr) { return; @@ -161,16 +163,18 @@ void __libc_init_vdso(libc_globals* globals) { } else if (d->d_tag == DT_SYMTAB) { symtab = reinterpret_cast<ElfW(Sym)*>(vdso_addr + d->d_un.d_ptr); } + if (strtab && symtab) break; } if (strtab == nullptr || symtab == nullptr) { return; } // Are there any symbols we want? - for (size_t i = 0; i < symbol_count; ++i) { - for (size_t j = 0; j < VDSO_END; ++j) { - if (strcmp(vdso[j].name, strtab + symtab[i].st_name) == 0) { - vdso[j].fn = reinterpret_cast<void*>(vdso_addr + symtab[i].st_value); + for (size_t i = 0; i < VDSO_END; ++i) { + for (size_t j = 0; j < symbol_count; ++j) { + if (strcmp(vdso[i].name, strtab + symtab[j].st_name) == 0) { + vdso[i].fn = reinterpret_cast<void*>(vdso_addr + symtab[j].st_value); + break; } } } diff --git a/libc/platform/bionic/tls_defines.h b/libc/platform/bionic/tls_defines.h index 3e2efa36a..8fe8701af 100644 --- a/libc/platform/bionic/tls_defines.h +++ b/libc/platform/bionic/tls_defines.h @@ -68,6 +68,11 @@ // // - TLS_SLOT_APP: Available for use by apps in Android Q and later. (This slot // was used for errno in P and earlier.) +// +// - TLS_SLOT_NATIVE_BRIDGE_GUEST_STATE: Pointer to the guest state for native +// bridge implementations. It is (to be) used by debuggerd to access this +// state for guest aware crash reporting of the binary translated code. +// (Introduced in V) #if defined(__arm__) || defined(__aarch64__) @@ -80,7 +85,8 @@ // [1] "Addenda to, and Errata in, the ABI for the ARM Architecture". Section 3. // http://infocenter.arm.com/help/topic/com.arm.doc.ihi0045e/IHI0045E_ABI_addenda.pdf -#define MIN_TLS_SLOT (-1) // update this value when reserving a slot +#define MIN_TLS_SLOT (-2) // update this value when reserving a slot +#define TLS_SLOT_NATIVE_BRIDGE_GUEST_STATE (-2) #define TLS_SLOT_BIONIC_TLS (-1) #define TLS_SLOT_DTV 0 #define TLS_SLOT_THREAD_ID 1 @@ -112,7 +118,8 @@ #define TLS_SLOT_ART_THREAD_SELF 7 #define TLS_SLOT_DTV 8 #define TLS_SLOT_BIONIC_TLS 9 -#define MAX_TLS_SLOT 9 // update this value when reserving a slot +#define TLS_SLOT_NATIVE_BRIDGE_GUEST_STATE 10 +#define MAX_TLS_SLOT 10 // update this value when reserving a slot #elif defined(__riscv) @@ -123,8 +130,9 @@ // [1]: RISC-V ELF Specification. Section: Thread Local Storage // https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc#thread-local-storage -#define MIN_TLS_SLOT (-9) // update this value when reserving a slot +#define MIN_TLS_SLOT (-10) // update this value when reserving a slot +#define TLS_SLOT_NATIVE_BRIDGE_GUEST_STATE (-10) #define TLS_SLOT_BIONIC_TLS (-9) #define TLS_SLOT_DTV (-8) #define TLS_SLOT_THREAD_ID (-7) |