diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-11-11 12:52:35 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-11-11 20:41:25 +0000 |
commit | 1ccbb9258eed0f667edf459a28ba23a805549b36 (patch) | |
tree | ad130ed6b0e7a1a1c5ee5ee87f27ed88264abf44 | |
parent | 9cec82de715b3ffc625a6c67d107a3fcb26af566 (diff) | |
download | glibc-1ccbb9258eed0f667edf459a28ba23a805549b36.zip glibc-1ccbb9258eed0f667edf459a28ba23a805549b36.tar.gz glibc-1ccbb9258eed0f667edf459a28ba23a805549b36.tar.bz2 |
hurd: Notify the proc server later during initialization
Notifying the proc server is an involved task, and unleashes various signal
handling etc. so we have to do this after e.g. ifunc relocations are
completed.
-rw-r--r-- | hurd/hurdinit.c | 36 | ||||
-rw-r--r-- | sysdeps/hurd/include/hurd.h | 3 | ||||
-rw-r--r-- | sysdeps/mach/hurd/i386/init-first.c | 3 |
3 files changed, 31 insertions, 11 deletions
diff --git a/hurd/hurdinit.c b/hurd/hurdinit.c index a884b78..e4ec005 100644 --- a/hurd/hurdinit.c +++ b/hurd/hurdinit.c @@ -34,6 +34,10 @@ sigset_t _hurdsig_traced; char **__libc_argv; int __libc_argc; +static int *_hurd_intarray; +static size_t _hurd_intarraysize; +static mach_port_t *_hurd_portarray; +static size_t _hurd_portarraysize; error_t _hurd_ports_use (int which, error_t (*operate) (mach_port_t)) @@ -87,17 +91,10 @@ _hurd_init (int flags, char **argv, if (intarraysize > INIT_TRACEMASK) _hurdsig_traced = intarray[INIT_TRACEMASK]; - /* Tell the proc server we exist, if it does. */ - if (portarray[INIT_PORT_PROC] != MACH_PORT_NULL) - _hurd_new_proc_init (argv, intarray, intarraysize); - - /* All done with init ints and ports. */ - __vm_deallocate (__mach_task_self (), - (vm_address_t) intarray, - intarraysize * sizeof (int)); - __vm_deallocate (__mach_task_self (), - (vm_address_t) portarray, - portarraysize * sizeof (mach_port_t)); + _hurd_intarray = intarray; + _hurd_intarraysize = intarraysize; + _hurd_portarray = portarray; + _hurd_portarraysize = portarraysize; if (flags & EXEC_SECURE) { @@ -113,6 +110,23 @@ _hurd_init (int flags, char **argv, RUN_HOOK (_hurd_subinit, ()); } libc_hidden_def (_hurd_init) + +void +_hurd_libc_proc_init (char **argv) +{ + /* Tell the proc server we exist, if it does. */ + if (_hurd_portarray[INIT_PORT_PROC] != MACH_PORT_NULL) + _hurd_new_proc_init (argv, _hurd_intarray, _hurd_intarraysize); + + /* All done with init ints and ports. */ + __vm_deallocate (__mach_task_self (), + (vm_address_t) _hurd_intarray, + _hurd_intarraysize * sizeof (int)); + __vm_deallocate (__mach_task_self (), + (vm_address_t) _hurd_portarray, + _hurd_portarraysize * sizeof (mach_port_t)); +} +libc_hidden_def (_hurd_libc_proc_init) #include <hurd/signal.h> diff --git a/sysdeps/hurd/include/hurd.h b/sysdeps/hurd/include/hurd.h index dc87717..7da9af2 100644 --- a/sysdeps/hurd/include/hurd.h +++ b/sysdeps/hurd/include/hurd.h @@ -1,6 +1,8 @@ #ifndef _HURD_H #include_next <hurd.h> +void _hurd_libc_proc_init (char **argv); + /* Like __USEPORT, but cleans fd on cancel. */ #define __USEPORT_CANCEL(which, expr) \ HURD_PORT_USE_CANCEL (&_hurd_ports[INIT_PORT_##which], (expr)) @@ -8,5 +10,6 @@ #ifndef _ISOMAC libc_hidden_proto (_hurd_exec_paths) libc_hidden_proto (_hurd_init) +libc_hidden_proto (_hurd_libc_proc_init) #endif #endif diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c index 6c35dc8..a3d2fda 100644 --- a/sysdeps/mach/hurd/i386/init-first.c +++ b/sysdeps/mach/hurd/i386/init-first.c @@ -63,6 +63,9 @@ posixland_init (int argc, char **argv, char **envp) { /* Set the FPU control word to the proper default value. */ __setfpucw (__fpu_control); + + /* Now we have relocations etc. we can start signals etc. */ + _hurd_libc_proc_init (argv); } else { |