diff options
author | Florian Weimer <fweimer@redhat.com> | 2020-12-16 15:09:52 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2020-12-16 15:13:40 +0100 |
commit | e7570f4131a6af9405af7b4fd1c31de807e7cf68 (patch) | |
tree | 0f11050a7a1b768fb0d683dc60412bc2a101c3a5 /sysdeps/mach | |
parent | 9459fe9da0f981f77ba931790f82e43ac552b73c (diff) | |
download | glibc-e7570f4131a6af9405af7b4fd1c31de807e7cf68.zip glibc-e7570f4131a6af9405af7b4fd1c31de807e7cf68.tar.gz glibc-e7570f4131a6af9405af7b4fd1c31de807e7cf68.tar.bz2 |
Replace __libc_multiple_libcs with __libc_initial flag
Change sbrk to fail for !__libc_initial (in the generic
implementation). As a result, sbrk is (relatively) safe to use
for the __libc_initial case (from the main libc). It is therefore
no longer necessary to avoid using it in that case (or updating the
brk cache), and the __libc_initial flag does not need to be updated
as part of dlmopen or static dlopen.
As before, direct brk system calls on Linux may lead to memory
corruption.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/mach')
-rw-r--r-- | sysdeps/mach/hurd/dl-sysdep.c | 2 | ||||
-rw-r--r-- | sysdeps/mach/hurd/i386/init-first.c | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c index 3704957..a5169d8 100644 --- a/sysdeps/mach/hurd/dl-sysdep.c +++ b/sysdeps/mach/hurd/dl-sysdep.c @@ -57,8 +57,6 @@ extern char **_environ; int __libc_enable_secure = 0; rtld_hidden_data_def (__libc_enable_secure) -int __libc_multiple_libcs = 0; /* Defining this here avoids the inclusion - of init-first. */ /* This variable contains the lowest stack address ever used. */ void *__libc_stack_end = NULL; rtld_hidden_data_def(__libc_stack_end) diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c index 1827479..cbbc122 100644 --- a/sysdeps/mach/hurd/i386/init-first.c +++ b/sysdeps/mach/hurd/i386/init-first.c @@ -30,6 +30,7 @@ #include <ldsodefs.h> #include <fpu_control.h> #include <libc-diag.h> +#include <libc-internal.h> extern void __mach_init (void); extern void __init_misc (int, char **, char **); @@ -40,7 +41,6 @@ unsigned long int __hurd_threadvar_stack_mask; #ifndef SHARED int __libc_enable_secure; #endif -int __libc_multiple_libcs attribute_hidden = 1; extern int __libc_argc attribute_hidden; extern char **__libc_argv attribute_hidden; @@ -56,13 +56,12 @@ DEFINE_HOOK (_hurd_preinit_hook, (void)); static void posixland_init (int argc, char **argv, char **envp) { - __libc_multiple_libcs = &_dl_starting_up && !_dl_starting_up; - /* Now we have relocations etc. we can start signals etc. */ _hurd_libc_proc_init (argv); +#ifdef SHARED /* Make sure we don't initialize twice. */ - if (!__libc_multiple_libcs) + if (__libc_initial) { /* Set the FPU control word to the proper default value. */ __setfpucw (__fpu_control); @@ -72,6 +71,9 @@ posixland_init (int argc, char **argv, char **envp) /* Initialize data structures so the additional libc can do RPCs. */ __mach_init (); } +#else /* !SHARED */ + __setfpucw (__fpu_control); +#endif /* Save the command-line arguments. */ __libc_argc = argc; |