1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00
2004-01-13  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/unix/sysv/linux/dl-execstack.c: Change interface.  Add
	challenge for caller.
	* sysdeps/generic/ldsodefs.h: Change declaration and type of hook
	member in rtld_global appropriately.
	* elf/dl-support.c: Likewise.
	* elf/dl-load.c (_dl_map_object_from_fd): Take additional paramter.
	Pass it on to the changed function.
	(_dl_map_object): Pass new parameter to _dl_map_object_from_fd.
This commit is contained in:
Ulrich Drepper
2004-01-13 15:47:32 +00:00
parent 0a182a286d
commit d1fc817ea4
7 changed files with 46 additions and 19 deletions

View File

@ -1,3 +1,14 @@
2004-01-13 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/dl-execstack.c: Change interface. Add
challenge for caller.
* sysdeps/generic/ldsodefs.h: Change declaration and type of hook
member in rtld_global appropriately.
* elf/dl-support.c: Likewise.
* elf/dl-load.c (_dl_map_object_from_fd): Take additional paramter.
Pass it on to the changed function.
(_dl_map_object): Pass new parameter to _dl_map_object_from_fd.
2004-01-13 Richard Henderson <rth@redhat.com> 2004-01-13 Richard Henderson <rth@redhat.com>
* sysdeps/alpha/bits/atomic.h (__arch_compare_and_exchange_xxx_8_int): * sysdeps/alpha/bits/atomic.h (__arch_compare_and_exchange_xxx_8_int):

View File

@ -811,7 +811,7 @@ static
struct link_map * struct link_map *
_dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp, _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
char *realname, struct link_map *loader, int l_type, char *realname, struct link_map *loader, int l_type,
int mode) int mode, void **stack_endp)
{ {
struct link_map *l = NULL; struct link_map *l = NULL;
const ElfW(Ehdr) *header; const ElfW(Ehdr) *header;
@ -1351,7 +1351,7 @@ cannot allocate TLS data structures for initial thread");
{ {
/* The stack is presently not executable, but this module /* The stack is presently not executable, but this module
requires that it be executable. */ requires that it be executable. */
errval = (*GL(dl_make_stack_executable_hook)) (); errval = (*GL(dl_make_stack_executable_hook)) (stack_endp);
if (errval) if (errval)
{ {
errstring = N_("\ errstring = N_("\
@ -1949,7 +1949,10 @@ cannot create shared object descriptor"));
N_("cannot open shared object file")); N_("cannot open shared object file"));
} }
return _dl_map_object_from_fd (name, fd, &fb, realname, loader, type, mode); extern void *__libc_stack_end;
void *stack_end = __libc_stack_end;
return _dl_map_object_from_fd (name, fd, &fb, realname, loader, type, mode,
&stack_end);
} }
INTDEF (_dl_map_object) INTDEF (_dl_map_object)

View File

@ -1,5 +1,5 @@
/* Support for dynamic linking code in static libc. /* Support for dynamic linking code in static libc.
Copyright (C) 1996-2002, 2003 Free Software Foundation, Inc. Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -136,7 +136,7 @@ ElfW(Word) _dl_stack_flags = PF_R|PF_W|PF_X;
/* If loading a shared object requires that we make the stack executable /* If loading a shared object requires that we make the stack executable
when it was not, we do it by calling this function. when it was not, we do it by calling this function.
It returns an errno code or zero on success. */ It returns an errno code or zero on success. */
int (*_dl_make_stack_executable_hook) (void) internal_function int (*_dl_make_stack_executable_hook) (void **) internal_function
= _dl_make_stack_executable; = _dl_make_stack_executable;

View File

@ -1,12 +1,18 @@
2004-01-13 Ulrich Drepper <drepper@redhat.com>
* allocatestack.c (__make_stacks_executable): Change interface.
Check parameters. Pass parameter on to libc counterpart.
* pthreadP.h: Change declaration.
2004-01-13 Richard Henderson <rth@redhat.com> 2004-01-13 Richard Henderson <rth@redhat.com>
* sysdeps/alpha/Makefile: New file. * sysdeps/alpha/Makefile: New file.
* sysdeps/alpha/tcb-offsets.sym: New file. * sysdeps/alpha/tcb-offsets.sym: New file.
* sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (SINGLE_THREAD_P): * sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (SINGLE_THREAD_P):
Use MULTIPLE_THREADS_OFFSET to implement !libpthread !libc version. Use MULTIPLE_THREADS_OFFSET to implement !libpthread !libc version.
* sysdeps/unix/sysv/linux/alpha/lowlevellock.h: Rewrite based * sysdeps/unix/sysv/linux/alpha/lowlevellock.h: Rewrite based
on powerpc version. on powerpc version.
2004-01-08 Jakub Jelinek <jakub@redhat.com> 2004-01-08 Jakub Jelinek <jakub@redhat.com>

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. /* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -661,10 +661,16 @@ __deallocate_stack (struct pthread *pd)
} }
extern void *__libc_stack_end;
int int
internal_function internal_function
__make_stacks_executable (void) __make_stacks_executable (void **stack_endp)
{ {
/* Challenge the caller. */
if (*stack_endp != __libc_stack_end)
return EPERM;
#ifdef NEED_SEPARATE_REGISTER_STACK #ifdef NEED_SEPARATE_REGISTER_STACK
const size_t pagemask = ~(__getpagesize () - 1); const size_t pagemask = ~(__getpagesize () - 1);
#endif #endif
@ -702,7 +708,7 @@ __make_stacks_executable (void)
lll_unlock (stack_cache_lock); lll_unlock (stack_cache_lock);
if (err == 0) if (err == 0)
err = _dl_make_stack_executable (); err = _dl_make_stack_executable (stack_endp);
return err; return err;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. /* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -216,7 +216,8 @@ extern void __deallocate_stack (struct pthread *pd)
extern void __reclaim_stacks (void) attribute_hidden; extern void __reclaim_stacks (void) attribute_hidden;
/* Make all threads's stacks executable. */ /* Make all threads's stacks executable. */
int __make_stacks_executable (void) internal_function attribute_hidden; extern int __make_stacks_executable (void **stack_endp)
internal_function attribute_hidden;
/* longjmp handling. */ /* longjmp handling. */
extern void __pthread_cleanup_upto (__jmp_buf target, char *targetframe); extern void __pthread_cleanup_upto (__jmp_buf target, char *targetframe);

View File

@ -1,5 +1,5 @@
/* Run-time dynamic linker data structures for loaded ELF shared objects. /* Run-time dynamic linker data structures for loaded ELF shared objects.
Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc. Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -366,7 +366,7 @@ struct rtld_global
/* If loading a shared object requires that we make the stack executable /* If loading a shared object requires that we make the stack executable
when it was not, we do it by calling this function. when it was not, we do it by calling this function.
It returns an errno code or zero on success. */ It returns an errno code or zero on success. */
EXTERN int (*_dl_make_stack_executable_hook) (void) internal_function; EXTERN int (*_dl_make_stack_executable_hook) (void **) internal_function;
/* Keep the conditional TLS members at the end so the layout of the /* Keep the conditional TLS members at the end so the layout of the
structure used by !USE_TLS code matches the prefix of the layout in structure used by !USE_TLS code matches the prefix of the layout in
@ -453,7 +453,7 @@ extern void **_dl_initial_error_catch_tsd (void) __attribute__ ((const))
/* This is the initial value of GL(dl_make_stack_executable_hook). /* This is the initial value of GL(dl_make_stack_executable_hook).
A threads library can change it. */ A threads library can change it. */
extern int _dl_make_stack_executable (void) internal_function; extern int _dl_make_stack_executable (void **stack_endp) internal_function;
rtld_hidden_proto (_dl_make_stack_executable) rtld_hidden_proto (_dl_make_stack_executable)
/* Parameters passed to the dynamic linker. */ /* Parameters passed to the dynamic linker. */