mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
sclog: don't try to find libc functions outside libc.
On AArch64, there are unexpectedly malloc and free functions in ld.so, so the module-load function finds them there, wraps them, and then misses the real versions in libc.
This commit is contained in:
parent
b3f2726b83
commit
e97a364d07
@ -546,6 +546,7 @@ static void try_wrap_fn(const module_data_t *module, const char *name,
|
|||||||
static void load_module(
|
static void load_module(
|
||||||
void *drcontext, const module_data_t *module, bool loaded)
|
void *drcontext, const module_data_t *module, bool loaded)
|
||||||
{
|
{
|
||||||
|
bool libc = !strncmp(dr_module_preferred_name(module), "libc", 4);
|
||||||
|
|
||||||
#define TRY_WRAP(fn, pre, post) do \
|
#define TRY_WRAP(fn, pre, post) do \
|
||||||
{ \
|
{ \
|
||||||
@ -556,6 +557,7 @@ static void load_module(
|
|||||||
if (loaded) {
|
if (loaded) {
|
||||||
TRY_WRAP("log_to_file_real", wrap_logsetfile, NULL);
|
TRY_WRAP("log_to_file_real", wrap_logsetfile, NULL);
|
||||||
TRY_WRAP("dry_run_real", NULL, wrap_dryrun);
|
TRY_WRAP("dry_run_real", NULL, wrap_dryrun);
|
||||||
|
if (libc) {
|
||||||
TRY_WRAP("malloc", wrap_malloc_pre, wrap_alloc_post);
|
TRY_WRAP("malloc", wrap_malloc_pre, wrap_alloc_post);
|
||||||
TRY_WRAP("realloc", wrap_realloc_pre, wrap_alloc_post);
|
TRY_WRAP("realloc", wrap_realloc_pre, wrap_alloc_post);
|
||||||
TRY_WRAP("free", wrap_free_pre, unpause_post);
|
TRY_WRAP("free", wrap_free_pre, unpause_post);
|
||||||
@ -583,6 +585,7 @@ static void load_module(
|
|||||||
TRY_WRAP("cfree", wrap_free_pre, unpause_post);
|
TRY_WRAP("cfree", wrap_free_pre, unpause_post);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Main entry point that sets up all the facilities we need.
|
* Main entry point that sets up all the facilities we need.
|
||||||
|
Loading…
Reference in New Issue
Block a user