glibc/sysdeps/unix/sysv/linux/s390/kernel_sigaction.h
Stefan Liebler d8abfab7d4 S390: Fix struct sigaction for 31bit in kernel_sigaction.h.
The recent commit b4a5d26d88
"linux: Consolidate sigaction implementation" changed the definition
of struct sigaction for s390 (31bit). Unfortunately the order of the
fields were wrong.

This leads to blocking testcases e.g. nptl/tst-sem11.
A thread which blocks due to sem_wait() is cancelled via pthread_cancel()
and the signal-handler sigcancel_handler (see <glibc-src>/nptl/nptl-init.c
is called.
But it just returns as the siginfo_t argument is not setup by the kernel.
Then the main-thread is blocking due to pthread_join().

The flag SA_SIGINFO is set in sa_flags in struct sigaction and
is copied to the "kernel_sigaction.h" struct by the sigaction() call,
but due to the wrong ordering of the struct fields,
the kernel does not recognize it.
2018-04-12 09:37:26 +02:00

33 lines
1.0 KiB
C

#include <bits/types/siginfo_t.h>
#define SA_RESTORER 0x04000000
/* This is the sigaction structure from the Linux 3.2 kernel. */
struct kernel_sigaction
{
union
{
__sighandler_t _sa_handler;
void (*_sa_sigaction)(int, siginfo_t *, void *);
} _u;
#define k_sa_handler _u._sa_handler
/* The 'struct sigaction' definition in s390 kernel header
arch/s390/include/uapi/asm/signal.h is used for __NR_rt_sigaction
on 64 bits and for __NR_sigaction for 31 bits.
The expected layout for __NR_rt_sigaction for 31 bits is either
'struct sigaction' from include/linux/signal_types.h or
'struct compat_sigaction' from include/linux/compat.h.
So for __NR_rt_sigaction we can use the same layout for both s390x
and s390. */
unsigned long sa_flags;
void (*sa_restorer)(void);
sigset_t sa_mask;
};
#define SET_SA_RESTORER(kact, act) \
(kact)->sa_restorer = (act)->sa_restorer
#define RESET_SA_RESTORER(act, kact) \
(act)->sa_restorer = (kact)->sa_restorer