c6bd051557c178f17faf04c3284916860a71e6af
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / uclibc / 0.9.33.2 / 0056-MIPS-set-_NSIG-to-128-not-129.-This-matches-glibc.patch
1 From 2da958760f798224065508431787e3a83b7fe2ae Mon Sep 17 00:00:00 2001
2 From: Denys Vlasenko <vda.linux@googlemail.com>
3 Date: Fri, 28 Jun 2013 21:59:54 +0200
4 Subject: [PATCH-0.9.33] MIPS: set _NSIG to 128, not 129. This matches glibc.
5
6 Prompted by lkml discussion of a MIPS bug where sending
7 signal 128 was found to be able to crash the machine :/
8
9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 ---
11  libc/sysdeps/linux/mips/bits/signum.h | 17 +++++++++++++++--
12  1 file changed, 15 insertions(+), 2 deletions(-)
13
14 diff --git a/libc/sysdeps/linux/mips/bits/signum.h b/libc/sysdeps/linux/mips/bits/signum.h
15 index cf9b834..e83250e 100644
16 --- a/libc/sysdeps/linux/mips/bits/signum.h
17 +++ b/libc/sysdeps/linux/mips/bits/signum.h
18 @@ -53,7 +53,20 @@
19  #define SIGXCPU                30      /* CPU limit exceeded (4.2 BSD).  */
20  #define SIGXFSZ                31      /* File size limit exceeded (4.2 BSD).  */
21  
22 -/* Biggest signal number + 1 (including real-time signals).  */
23 -#define _NSIG          129
24 +/* MIPS is special by having 128 signals.
25 + * All (?) other architectures have at most 64 signals.
26 + * Having 128 signals is problematic because signal nos are 1-based
27 + * and last signal number is then 128.
28 + * This plays havoc with WIFSIGNALED and WCOREDUMP in waitpid status word,
29 + * when process dies from signal 128.
30 + * Linux kernel 3.9 accepts signal 128, with awful results :/
31 + * It is being fixed.
32 + *
33 + * glibc (accidentally?) papers over this issue by declaring _NSIG to be 128,
34 + * not 129 (despite claiming that _NSIG is "biggest signal number + 1"
35 + * in the comment above that definition). We follow suit.
36 + * Note that this results in __SIGRTMAX == 127. It is intended.
37 + */
38 +#define _NSIG          128
39  
40  #endif /* <signal.h> included.  */
41 -- 
42 1.8.1.2
43