From 763b5a0e9c55a2f069ee10e489ef28f36e54e755 Mon Sep 17 00:00:00 2001 From: Stefano Moioli Date: Tue, 23 Apr 2024 22:05:20 +0200 Subject: [PATCH] add dummy_tls_get_addr --- xzre.h | 15 +++++++++++++++ xzre.lds.in | 1 + 2 files changed, 16 insertions(+) diff --git a/xzre.h b/xzre.h index 041d277..75e133f 100644 --- a/xzre.h +++ b/xzre.h @@ -2664,6 +2664,21 @@ extern void *update_got_address(elf_entry_ctx_t *entry_ctx); */ extern ptrdiff_t get_tls_get_addr_random_symbol_got_offset(elf_entry_ctx_t *ctx); +typedef struct dl_tls_index +{ + uint64_t ti_module; + uint64_t ti_offset; +} tls_index; + +/** + * @brief a dummy function that calls __tls_get_addr, + * to make sure its GOT slot doesn't get removed by compiler optimizations + * + * @param ti + * @return void* + */ +extern void *dummy_tls_get_addr (tls_index *ti); + /** * @brief the backdoored symbind64 installed in GLRO(dl_audit) * diff --git a/xzre.lds.in b/xzre.lds.in index 53dce2a..da0b56d 100644 --- a/xzre.lds.in +++ b/xzre.lds.in @@ -124,6 +124,7 @@ SECTIONS_BEGIN() DEFSYM(mm_answer_keyallowed_hook, .text.file_info_decoda) DEFSYM(mm_answer_keyverify_hook, .text.bt_skip_funz) DEFSYM(mm_log_handler_hook, .text.parse_lzma12z) + DEFSYM(dummy_tls_get_addr, .text.lzma_simple_props_encoda) SECTIONS_END(.text) SECTIONS_BEGIN()