This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hi, Neale Ferguson from Software AG pointed us to a severe problem with the ucontext structure and signal handling. The ugly truth is that it never has worked as it was supposed to. The ucontext structure in the kernel doesn't match the definition in the glibc: glibc: struct ucontext { unsigned long int uc_flags; struct ucontext *uc_link; __sigset_t uc_sigmask; stack_t uc_stack; mcontext_t uc_mcontext; long int uc_filler[170]; }; kernel: struct ucontext { unsigned long uc_flags; struct ucontext *uc_link; stack_t uc_stack; sigset_t uc_sigmask; /* mask last for extensibility */ struct sigcontext *sc; /* Added for pthread support */ }; The signal handler simply did put_user to the uc_flags, uc_link and uc_stack fields using the offsets of the kernel ucontext structure. It never bothered to store anything in uc_sigmask and the uc_mcontext is missing. Horribly broken. Uli (Weigand) and me had a session on how to fix this. The conclusion was that since it was completly broken anyway we can as well redefine both structures and make them look sane. The glibc definition of the ucontext structure should have the uc_sigmask field last, the greg_t array will be 8 bytes smaller because we removed an unnecessary entry and the version field in the mcontext will be removed as well. This way the mcontext structure in the glibc matches the _sigregs structure in the kernel. Here is the glibc part of the fix: 2001-08-15 Martin Schwidefsky <schwidefsky@de.ibm.com> * sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S (__getcontext): Store the access registers to the ucontext structure. * sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S (__getcontext): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S (__setcontext): Load the access registers from the ucontext structure. * sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S (__setcontext): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h: Adjust the SC_xxx offsets to the new ucontext layout. * sysdeps/unix/sysv/linux/s390/s390-64/ucontext_i.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/ucontext.h: Fix the layout of the ucontext structure. * sysdeps/unix/sysv/linux/s390/s390-64/ucontext.h: Likewise. (See attached file: ucontext-glibc-diff) blue skies, Martin Linux/390 Design & Development, IBM Deutschland Entwicklung GmbH Schönaicherstr. 220, D-71032 Böblingen, Telefon: 49 - (0)7031 - 16-2247 E-Mail: schwidefsky@de.ibm.com
=?iso-8859-1?Q?ucontext-glibc-diff?=
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |