Skip to content

Commit fae7649

Browse files
author
Martin Schwidefsky
committed
s390/signal: cleanup uapi struct sigaction
The struct sigaction for user space in arch/s390/include/uapi/asm/signal.h is ill defined. The kernel uses two structures 'struct sigaction' and 'struct old_sigaction', the correlation in the kernel for both 31 and 64 bit is as follows sys_sigaction -> struct old_sigaction sys_rt_sigaction -> struct sigaction The correlation of the (single) uapi definition for 'struct sigaction' under '#ifndef __KERNEL__': 31-bit: sys_sigaction -> uapi struct sigaction 31-bit: sys_rt_sigaction -> no structure available 64-bit: sys_sigaction -> no structure available 64-bit: sys_rt_sigaction -> uapi struct sigaction This is quite confusing. To make it a bit less confusing make the uapi definition of 'struct sigaction' usable for sys_rt_sigaction for both 31-bit and 64-bit. Signed-off-by: Martin Schwidefsky <[email protected]>
1 parent 49d23a8 commit fae7649

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

arch/s390/include/uapi/asm/signal.h

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,22 +97,31 @@ typedef unsigned long sigset_t;
9797
#include <asm-generic/signal-defs.h>
9898

9999
#ifndef __KERNEL__
100-
/* Here we must cater to libcs that poke about in kernel headers. */
101100

101+
/*
102+
* There are two system calls in regard to sigaction, sys_rt_sigaction
103+
* and sys_sigaction. Internally the kernel uses the struct old_sigaction
104+
* for the older sys_sigaction system call, and the kernel version of the
105+
* struct sigaction for the newer sys_rt_sigaction.
106+
*
107+
* The uapi definition for struct sigaction has made a strange distinction
108+
* between 31-bit and 64-bit in the past. For 64-bit the uapi structure
109+
* looks like the kernel struct sigaction, but for 31-bit it used to
110+
* look like the kernel struct old_sigaction. That practically made the
111+
* structure unusable for either system call. To get around this problem
112+
* the glibc always had its own definitions for the sigaction structures.
113+
*
114+
* The current struct sigaction uapi definition below is suitable for the
115+
* sys_rt_sigaction system call only.
116+
*/
102117
struct sigaction {
103118
union {
104119
__sighandler_t _sa_handler;
105120
void (*_sa_sigaction)(int, struct siginfo *, void *);
106121
} _u;
107-
#ifndef __s390x__ /* lovely */
108-
sigset_t sa_mask;
109-
unsigned long sa_flags;
110-
void (*sa_restorer)(void);
111-
#else /* __s390x__ */
112122
unsigned long sa_flags;
113123
void (*sa_restorer)(void);
114124
sigset_t sa_mask;
115-
#endif /* __s390x__ */
116125
};
117126

118127
#define sa_handler _u._sa_handler

0 commit comments

Comments
 (0)