Commit 5b8b6a5
committed
stack_overflow: Enable re-raising SIGSEGV / SIGBUS in their own handlers
By default, UNIX signals are blocked during their own handlers'
execution, so `raise(signum)` from inside a handler was not actually
getting delivered. Therefore the following instruction,
`intrinsics::abort()`, was getting executed. This led to segfaulting
Rust programs incorrectly having a termination status indicating SIGILL
from the `abort()`, instead of SIGSEGV (or SIGBUS).
We can use the `SA_NODEFER` flag to prevent this behavior. We can also
use `SA_RESETHAND` to have the system reset the default signal handler
for us upon entry, instead of doing that ourselves.1 parent 2a93dca commit 5b8b6a5
File tree
3 files changed
+20
-18
lines changed- src
- libstd/sys/unix
- test/run-pass
3 files changed
+20
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
171 | | - | |
172 | | - | |
| 172 | + | |
| 173 | + | |
173 | 174 | | |
174 | 175 | | |
175 | 176 | | |
| |||
226 | 227 | | |
227 | 228 | | |
228 | 229 | | |
| 230 | + | |
| 231 | + | |
229 | 232 | | |
230 | 233 | | |
231 | 234 | | |
| |||
275 | 278 | | |
276 | 279 | | |
277 | 280 | | |
| 281 | + | |
| 282 | + | |
278 | 283 | | |
279 | 284 | | |
280 | 285 | | |
| |||
328 | 333 | | |
329 | 334 | | |
330 | 335 | | |
| 336 | + | |
| 337 | + | |
331 | 338 | | |
332 | 339 | | |
333 | 340 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
| 47 | + | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | 74 | | |
83 | 75 | | |
84 | 76 | | |
85 | 77 | | |
86 | 78 | | |
87 | 79 | | |
88 | 80 | | |
89 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
90 | 84 | | |
91 | 85 | | |
92 | | - | |
93 | | - | |
94 | 86 | | |
95 | 87 | | |
96 | 88 | | |
| |||
105 | 97 | | |
106 | 98 | | |
107 | 99 | | |
108 | | - | |
| 100 | + | |
109 | 101 | | |
110 | 102 | | |
111 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
21 | | - | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
| |||
0 commit comments