mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
* elf/dl-error.c (_dl_signal_error): Store information about use of
real malloc in the catch object. (_dl_catch_error): Forward information about malloc use to caller in new parameter. (_dl_out_of_memory): Make static. * elf/dl-deps.c: Adjust callers of _dl_catch_error. * elf/dl-libc.c: Likewise. * elf/dl-open.c: Likewise. * elf/rtld.c: Likewise. Add new --audit option. * sysdeps/generic/ldsodefs.h: Remove _dl_out_of_memory declaration. (rtld_global_ro._dl_signal_error): Add new parameter. * include/dlfcn.h (_dl_catch_error): Add new parameter. * dlfcn/dlfcn.c (_dlerror_run): Pass additional parameter to _dl_catch_error. Only free if the returned newly value says so.
This commit is contained in:
@ -504,11 +504,6 @@ void *
|
||||
_dl_open (const char *file, int mode, const void *caller_dlopen, Lmid_t nsid,
|
||||
int argc, char *argv[], char *env[])
|
||||
{
|
||||
struct dl_open_args args;
|
||||
const char *objname;
|
||||
const char *errstring;
|
||||
int errcode;
|
||||
|
||||
if ((mode & RTLD_BINDING_MASK) == 0)
|
||||
/* One of the flags must be set. */
|
||||
_dl_signal_error (EINVAL, file, NULL, N_("invalid mode for dlopen()"));
|
||||
@ -543,6 +538,7 @@ no more namespaces available for dlmopen()"));
|
||||
_dl_signal_error (EINVAL, file, NULL,
|
||||
N_("invalid target namespace in dlmopen()"));
|
||||
|
||||
struct dl_open_args args;
|
||||
args.file = file;
|
||||
args.mode = mode;
|
||||
args.caller_dlopen = caller_dlopen;
|
||||
@ -552,7 +548,12 @@ no more namespaces available for dlmopen()"));
|
||||
args.argc = argc;
|
||||
args.argv = argv;
|
||||
args.env = env;
|
||||
errcode = _dl_catch_error (&objname, &errstring, dl_open_worker, &args);
|
||||
|
||||
const char *objname;
|
||||
const char *errstring;
|
||||
bool malloced;
|
||||
int errcode = _dl_catch_error (&objname, &errstring, &malloced,
|
||||
dl_open_worker, &args);
|
||||
|
||||
#ifndef MAP_COPY
|
||||
/* We must munmap() the cache file. */
|
||||
@ -603,7 +604,7 @@ no more namespaces available for dlmopen()"));
|
||||
memcpy (local_errstring, errstring, len_errstring);
|
||||
}
|
||||
|
||||
if (errstring != _dl_out_of_memory)
|
||||
if (malloced)
|
||||
free ((char *) errstring);
|
||||
|
||||
assert (_dl_debug_initialize (0, args.nsid)->r_state == RT_CONSISTENT);
|
||||
|
Reference in New Issue
Block a user