mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 17:53:37 +08:00
[BZ #9733]
* elf/dl-load.c (_dl_map_object_from_fd): Only call audit hooks if we are not loading a new audit library. * elf/dl-reloc (_dl_relocate_object): Third parameter is now a bitmask. Only use profiling trampoline for auditing if we are not relocating an audit library. * elf/dl-open.c (dl_open_worker): Adjust _dl_relocate_object call. * elf/rtld.c: Likewise. * sysdeps/generic/ldsodefs.h: Adjust _dl_relocate_object prototype.
This commit is contained in:
parent
7e34260365
commit
2ca285b098
10
ChangeLog
10
ChangeLog
@ -1,5 +1,15 @@
|
||||
2009-03-15 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
[BZ #9733]
|
||||
* elf/dl-load.c (_dl_map_object_from_fd): Only call audit hooks
|
||||
if we are not loading a new audit library.
|
||||
* elf/dl-reloc (_dl_relocate_object): Third parameter is now a bitmask.
|
||||
Only use profiling trampoline for auditing if we are not relocating
|
||||
an audit library.
|
||||
* elf/dl-open.c (dl_open_worker): Adjust _dl_relocate_object call.
|
||||
* elf/rtld.c: Likewise.
|
||||
* sysdeps/generic/ldsodefs.h: Adjust _dl_relocate_object prototype.
|
||||
|
||||
* elf/rtld.c (dl_main): Extend help message for --audit option.
|
||||
|
||||
[BZ #9759]
|
||||
|
@ -941,7 +941,8 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
|
||||
{
|
||||
#ifdef SHARED
|
||||
/* Auditing checkpoint: we are going to add new objects. */
|
||||
if (__builtin_expect (GLRO(dl_naudit) > 0, 0))
|
||||
if ((mode & __RTLD_AUDIT) == 0
|
||||
&& __builtin_expect (GLRO(dl_naudit) > 0, 0))
|
||||
{
|
||||
struct link_map *head = GL(dl_ns)[nsid]._ns_loaded;
|
||||
/* Do not call the functions for any auditing object. */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Load a shared object at runtime, relocate it, and run its initializer.
|
||||
Copyright (C) 1996-2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996-2007, 2009 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -207,7 +207,6 @@ dl_open_worker (void *a)
|
||||
const char *file = args->file;
|
||||
int mode = args->mode;
|
||||
struct link_map *new;
|
||||
int lazy;
|
||||
unsigned int i;
|
||||
bool any_tls = false;
|
||||
struct link_map *call_map = NULL;
|
||||
@ -366,7 +365,9 @@ dl_open_worker (void *a)
|
||||
_dl_debug_state ();
|
||||
|
||||
/* Only do lazy relocation if `LD_BIND_NOW' is not set. */
|
||||
lazy = (mode & RTLD_BINDING_MASK) == RTLD_LAZY && GLRO(dl_lazy);
|
||||
int reloc_mode = mode & __RTLD_AUDIT;
|
||||
if (GLRO(dl_lazy))
|
||||
reloc_mode |= mode & RTLD_LAZY;
|
||||
|
||||
/* Relocate the objects loaded. We do this in reverse order so that copy
|
||||
relocs of earlier objects overwrite the data written by later objects. */
|
||||
@ -388,7 +389,7 @@ dl_open_worker (void *a)
|
||||
start the profiling. */
|
||||
struct link_map *old_profile_map = GL(dl_profile_map);
|
||||
|
||||
_dl_relocate_object (l, l->l_scope, 1, 1);
|
||||
_dl_relocate_object (l, l->l_scope, reloc_mode | RTLD_LAZY, 1);
|
||||
|
||||
if (old_profile_map == NULL && GL(dl_profile_map) != NULL)
|
||||
{
|
||||
@ -401,7 +402,7 @@ dl_open_worker (void *a)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
_dl_relocate_object (l, l->l_scope, lazy, 0);
|
||||
_dl_relocate_object (l, l->l_scope, reloc_mode, 0);
|
||||
}
|
||||
|
||||
if (l == new)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Relocate a shared object and resolve its references to other loaded objects.
|
||||
Copyright (C) 1995-2004, 2005, 2006, 2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-2006, 2008, 2009 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -151,7 +151,7 @@ _dl_nothread_init_static_tls (struct link_map *map)
|
||||
|
||||
void
|
||||
_dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
|
||||
int lazy, int consider_profiling)
|
||||
int reloc_mode, int consider_profiling)
|
||||
{
|
||||
struct textrels
|
||||
{
|
||||
@ -162,9 +162,11 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
|
||||
} *textrels = NULL;
|
||||
/* Initialize it to make the compiler happy. */
|
||||
const char *errstring = NULL;
|
||||
int lazy = reloc_mode & RTLD_LAZY;
|
||||
|
||||
#ifdef SHARED
|
||||
/* If we are auditing, install the same handlers we need for profiling. */
|
||||
if ((reloc_mode & __RTLD_AUDIT) == 0)
|
||||
consider_profiling |= GLRO(dl_audit) != NULL;
|
||||
#elif defined PROF
|
||||
/* Never use dynamic linker profiling for gprof profiling code. */
|
||||
|
12
elf/rtld.c
12
elf/rtld.c
@ -574,7 +574,7 @@ _dl_start (void *arg)
|
||||
struct relocate_args
|
||||
{
|
||||
struct link_map *l;
|
||||
int lazy;
|
||||
int reloc_mode;
|
||||
};
|
||||
|
||||
struct map_args
|
||||
@ -613,7 +613,7 @@ relocate_doit (void *a)
|
||||
{
|
||||
struct relocate_args *args = (struct relocate_args *) a;
|
||||
|
||||
_dl_relocate_object (args->l, args->l->l_scope, args->lazy, 0);
|
||||
_dl_relocate_object (args->l, args->l->l_scope, args->reloc_mode, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1909,7 +1909,9 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
|
||||
struct link_map *l = main_map;
|
||||
|
||||
/* Relocate the main executable. */
|
||||
struct relocate_args args = { .l = l, .lazy = GLRO(dl_lazy) };
|
||||
struct relocate_args args = { .l = l,
|
||||
.reloc_mode = (GLRO(dl_lazy)
|
||||
? RTLD_LAZY : 0) };
|
||||
_dl_receive_error (print_unresolved, relocate_doit, &args);
|
||||
|
||||
/* This loop depends on the dependencies of the executable to
|
||||
@ -1986,7 +1988,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
|
||||
struct relocate_args args;
|
||||
struct link_map *l;
|
||||
|
||||
args.lazy = GLRO(dl_lazy);
|
||||
args.reloc_mode = GLRO(dl_lazy) ? RTLD_LAZY : 0;
|
||||
|
||||
l = main_map;
|
||||
while (l->l_next != NULL)
|
||||
@ -2226,7 +2228,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
|
||||
}
|
||||
|
||||
if (l != &GL(dl_rtld_map))
|
||||
_dl_relocate_object (l, l->l_scope, GLRO(dl_lazy),
|
||||
_dl_relocate_object (l, l->l_scope, GLRO(dl_lazy) ? RTLD_LAZY : 0,
|
||||
consider_profiling);
|
||||
|
||||
/* Add object to slot information data if necessasy. */
|
||||
|
@ -882,10 +882,10 @@ extern struct link_map *_dl_new_object (char *realname, const char *libname,
|
||||
|
||||
/* Relocate the given object (if it hasn't already been).
|
||||
SCOPE is passed to _dl_lookup_symbol in symbol lookups.
|
||||
If LAZY is nonzero, don't relocate its PLT. */
|
||||
If RTLD_LAZY is set in RELOC-MODE, don't relocate its PLT. */
|
||||
extern void _dl_relocate_object (struct link_map *map,
|
||||
struct r_scope_elem *scope[],
|
||||
int lazy, int consider_profiling)
|
||||
int reloc_mode, int consider_profiling)
|
||||
attribute_hidden;
|
||||
|
||||
/* Protect PT_GNU_RELRO area. */
|
||||
|
Loading…
Reference in New Issue
Block a user