Skip to content

Commit

Permalink
add resolve_libc_imports
Browse files Browse the repository at this point in the history
  • Loading branch information
smx-smx committed Apr 5, 2024
1 parent 6aede92 commit 62c289e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions xzre.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ typedef uintptr_t uptr;
#include <openssl/evp.h>
#include <openssl/rsa.h>
#include <elf.h>
#include <link.h>

#define UPTR(x) ((uptr)(x))
#define PTRADD(a, b) (UPTR(a) + UPTR(b))
Expand Down Expand Up @@ -877,5 +878,19 @@ extern BOOL secret_data_append_singleton(
*/
extern BOOL backdoor_setup(backdoor_setup_params_t *params);

/**
* @brief parses the libc ELF from the supplied link map, and resolves its imports
*
* @param libc the loaded libc's link map (obtained by traversing r_debug->r_map)
* @param libc_info pointer to an ELF context that will be populated with the parsed ELF information
* @param imports pointer to libc imports that will be populated with resolved libc function pointers
* @return BOOL TRUE if successful, FALSE otherwise
*/
extern BOOL resolve_libc_imports(
struct link_map *libc,
elf_info_t *libc_info,
libc_imports_t *imports
);

#include "util.h"
#endif
3 changes: 3 additions & 0 deletions xzre.lds
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,8 @@ SECTIONS {

"backdoor_setup" = ".";
*(.text.microlzma_encoder_inia);

"resolve_libc_imports" = ".";
*(.text.lzma_index_buffer_encoda);
}
} INSERT AFTER .text;

0 comments on commit 62c289e

Please sign in to comment.