diff options
Diffstat (limited to 'arch')
107 files changed, 768 insertions, 1294 deletions
diff --git a/arch/alpha/include/asm/posix_types.h b/arch/alpha/include/asm/posix_types.h index 24779fc95994..5a8a48320efe 100644 --- a/arch/alpha/include/asm/posix_types.h +++ b/arch/alpha/include/asm/posix_types.h | |||
@@ -10,9 +10,6 @@ | |||
10 | typedef unsigned int __kernel_ino_t; | 10 | typedef unsigned int __kernel_ino_t; |
11 | #define __kernel_ino_t __kernel_ino_t | 11 | #define __kernel_ino_t __kernel_ino_t |
12 | 12 | ||
13 | typedef unsigned int __kernel_nlink_t; | ||
14 | #define __kernel_nlink_t __kernel_nlink_t | ||
15 | |||
16 | typedef unsigned long __kernel_sigset_t; /* at least 32 bits */ | 13 | typedef unsigned long __kernel_sigset_t; /* at least 32 bits */ |
17 | 14 | ||
18 | #include <asm-generic/posix_types.h> | 15 | #include <asm-generic/posix_types.h> |
diff --git a/arch/alpha/kernel/signal.c b/arch/alpha/kernel/signal.c index 10ab2d74ecbb..a8c97d42ec8e 100644 --- a/arch/alpha/kernel/signal.c +++ b/arch/alpha/kernel/signal.c | |||
@@ -226,7 +226,6 @@ do_sigreturn(struct sigcontext __user *sc, struct pt_regs *regs, | |||
226 | if (__get_user(set.sig[0], &sc->sc_mask)) | 226 | if (__get_user(set.sig[0], &sc->sc_mask)) |
227 | goto give_sigsegv; | 227 | goto give_sigsegv; |
228 | 228 | ||
229 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
230 | set_current_blocked(&set); | 229 | set_current_blocked(&set); |
231 | 230 | ||
232 | if (restore_sigcontext(sc, regs, sw)) | 231 | if (restore_sigcontext(sc, regs, sw)) |
@@ -261,7 +260,6 @@ do_rt_sigreturn(struct rt_sigframe __user *frame, struct pt_regs *regs, | |||
261 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 260 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
262 | goto give_sigsegv; | 261 | goto give_sigsegv; |
263 | 262 | ||
264 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
265 | set_current_blocked(&set); | 263 | set_current_blocked(&set); |
266 | 264 | ||
267 | if (restore_sigcontext(&frame->uc.uc_mcontext, regs, sw)) | 265 | if (restore_sigcontext(&frame->uc.uc_mcontext, regs, sw)) |
@@ -468,12 +466,9 @@ static inline void | |||
468 | handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info, | 466 | handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info, |
469 | struct pt_regs * regs, struct switch_stack *sw) | 467 | struct pt_regs * regs, struct switch_stack *sw) |
470 | { | 468 | { |
471 | sigset_t *oldset = ¤t->blocked; | 469 | sigset_t *oldset = sigmask_to_save(); |
472 | int ret; | 470 | int ret; |
473 | 471 | ||
474 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
475 | oldset = ¤t->saved_sigmask; | ||
476 | |||
477 | if (ka->sa.sa_flags & SA_SIGINFO) | 472 | if (ka->sa.sa_flags & SA_SIGINFO) |
478 | ret = setup_rt_frame(sig, ka, info, oldset, regs, sw); | 473 | ret = setup_rt_frame(sig, ka, info, oldset, regs, sw); |
479 | else | 474 | else |
@@ -483,12 +478,7 @@ handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
483 | force_sigsegv(sig, current); | 478 | force_sigsegv(sig, current); |
484 | return; | 479 | return; |
485 | } | 480 | } |
486 | block_sigmask(ka, sig); | 481 | signal_delivered(sig, info, ka, regs, 0); |
487 | /* A signal was successfully delivered, and the | ||
488 | saved sigmask was stored on the signal frame, | ||
489 | and will be restored by sigreturn. So we can | ||
490 | simply clear the restore sigmask flag. */ | ||
491 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
492 | } | 482 | } |
493 | 483 | ||
494 | static inline void | 484 | static inline void |
@@ -572,9 +562,7 @@ do_signal(struct pt_regs * regs, struct switch_stack * sw, | |||
572 | } | 562 | } |
573 | 563 | ||
574 | /* If there's no signal to deliver, we just restore the saved mask. */ | 564 | /* If there's no signal to deliver, we just restore the saved mask. */ |
575 | if (test_and_clear_thread_flag(TIF_RESTORE_SIGMASK)) | 565 | restore_saved_sigmask(); |
576 | set_current_blocked(¤t->saved_sigmask); | ||
577 | |||
578 | if (single_stepping) | 566 | if (single_stepping) |
579 | ptrace_set_bpt(current); /* re-set breakpoint */ | 567 | ptrace_set_bpt(current); /* re-set breakpoint */ |
580 | } | 568 | } |
@@ -590,7 +578,5 @@ do_notify_resume(struct pt_regs *regs, struct switch_stack *sw, | |||
590 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | 578 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { |
591 | clear_thread_flag(TIF_NOTIFY_RESUME); | 579 | clear_thread_flag(TIF_NOTIFY_RESUME); |
592 | tracehook_notify_resume(regs); | 580 | tracehook_notify_resume(regs); |
593 | if (current->replacement_session_keyring) | ||
594 | key_replace_session_keyring(); | ||
595 | } | 581 | } |
596 | } | 582 | } |
diff --git a/arch/arm/boot/dts/db8500.dtsi b/arch/arm/boot/dts/db8500.dtsi index 881bc3987844..4ad5160018cb 100644 --- a/arch/arm/boot/dts/db8500.dtsi +++ b/arch/arm/boot/dts/db8500.dtsi | |||
@@ -58,6 +58,8 @@ | |||
58 | "st,nomadik-gpio"; | 58 | "st,nomadik-gpio"; |
59 | reg = <0x8012e000 0x80>; | 59 | reg = <0x8012e000 0x80>; |
60 | interrupts = <0 119 0x4>; | 60 | interrupts = <0 119 0x4>; |
61 | interrupt-controller; | ||
62 | #interrupt-cells = <2>; | ||
61 | supports-sleepmode; | 63 | supports-sleepmode; |
62 | gpio-controller; | 64 | gpio-controller; |
63 | #gpio-cells = <2>; | 65 | #gpio-cells = <2>; |
@@ -69,6 +71,8 @@ | |||
69 | "st,nomadik-gpio"; | 71 | "st,nomadik-gpio"; |
70 | reg = <0x8012e080 0x80>; | 72 | reg = <0x8012e080 0x80>; |
71 | interrupts = <0 120 0x4>; | 73 | interrupts = <0 120 0x4>; |
74 | interrupt-controller; | ||
75 | #interrupt-cells = <2>; | ||
72 | supports-sleepmode; | 76 | supports-sleepmode; |
73 | gpio-controller; | 77 | gpio-controller; |
74 | #gpio-cells = <2>; | 78 | #gpio-cells = <2>; |
@@ -80,6 +84,8 @@ | |||
80 | "st,nomadik-gpio"; | 84 | "st,nomadik-gpio"; |
81 | reg = <0x8000e000 0x80>; | 85 | reg = <0x8000e000 0x80>; |
82 | interrupts = <0 121 0x4>; | 86 | interrupts = <0 121 0x4>; |
87 | interrupt-controller; | ||
88 | #interrupt-cells = <2>; | ||
83 | supports-sleepmode; | 89 | supports-sleepmode; |
84 | gpio-controller; | 90 | gpio-controller; |
85 | #gpio-cells = <2>; | 91 | #gpio-cells = <2>; |
@@ -91,6 +97,8 @@ | |||
91 | "st,nomadik-gpio"; | 97 | "st,nomadik-gpio"; |
92 | reg = <0x8000e080 0x80>; | 98 | reg = <0x8000e080 0x80>; |
93 | interrupts = <0 122 0x4>; | 99 | interrupts = <0 122 0x4>; |
100 | interrupt-controller; | ||
101 | #interrupt-cells = <2>; | ||
94 | supports-sleepmode; | 102 | supports-sleepmode; |
95 | gpio-controller; | 103 | gpio-controller; |
96 | #gpio-cells = <2>; | 104 | #gpio-cells = <2>; |
@@ -102,6 +110,8 @@ | |||
102 | "st,nomadik-gpio"; | 110 | "st,nomadik-gpio"; |
103 | reg = <0x8000e100 0x80>; | 111 | reg = <0x8000e100 0x80>; |
104 | interrupts = <0 123 0x4>; | 112 | interrupts = <0 123 0x4>; |
113 | interrupt-controller; | ||
114 | #interrupt-cells = <2>; | ||
105 | supports-sleepmode; | 115 | supports-sleepmode; |
106 | gpio-controller; | 116 | gpio-controller; |
107 | #gpio-cells = <2>; | 117 | #gpio-cells = <2>; |
@@ -113,6 +123,8 @@ | |||
113 | "st,nomadik-gpio"; | 123 | "st,nomadik-gpio"; |
114 | reg = <0x8000e180 0x80>; | 124 | reg = <0x8000e180 0x80>; |
115 | interrupts = <0 124 0x4>; | 125 | interrupts = <0 124 0x4>; |
126 | interrupt-controller; | ||
127 | #interrupt-cells = <2>; | ||
116 | supports-sleepmode; | 128 | supports-sleepmode; |
117 | gpio-controller; | 129 | gpio-controller; |
118 | #gpio-cells = <2>; | 130 | #gpio-cells = <2>; |
@@ -124,6 +136,8 @@ | |||
124 | "st,nomadik-gpio"; | 136 | "st,nomadik-gpio"; |
125 | reg = <0x8011e000 0x80>; | 137 | reg = <0x8011e000 0x80>; |
126 | interrupts = <0 125 0x4>; | 138 | interrupts = <0 125 0x4>; |
139 | interrupt-controller; | ||
140 | #interrupt-cells = <2>; | ||
127 | supports-sleepmode; | 141 | supports-sleepmode; |
128 | gpio-controller; | 142 | gpio-controller; |
129 | #gpio-cells = <2>; | 143 | #gpio-cells = <2>; |
@@ -135,6 +149,8 @@ | |||
135 | "st,nomadik-gpio"; | 149 | "st,nomadik-gpio"; |
136 | reg = <0x8011e080 0x80>; | 150 | reg = <0x8011e080 0x80>; |
137 | interrupts = <0 126 0x4>; | 151 | interrupts = <0 126 0x4>; |
152 | interrupt-controller; | ||
153 | #interrupt-cells = <2>; | ||
138 | supports-sleepmode; | 154 | supports-sleepmode; |
139 | gpio-controller; | 155 | gpio-controller; |
140 | #gpio-cells = <2>; | 156 | #gpio-cells = <2>; |
@@ -146,12 +162,18 @@ | |||
146 | "st,nomadik-gpio"; | 162 | "st,nomadik-gpio"; |
147 | reg = <0xa03fe000 0x80>; | 163 | reg = <0xa03fe000 0x80>; |
148 | interrupts = <0 127 0x4>; | 164 | interrupts = <0 127 0x4>; |
165 | interrupt-controller; | ||
166 | #interrupt-cells = <2>; | ||
149 | supports-sleepmode; | 167 | supports-sleepmode; |
150 | gpio-controller; | 168 | gpio-controller; |
151 | #gpio-cells = <2>; | 169 | #gpio-cells = <2>; |
152 | gpio-bank = <8>; | 170 | gpio-bank = <8>; |
153 | }; | 171 | }; |
154 | 172 | ||
173 | pinctrl { | ||
174 | compatible = "stericsson,nmk_pinctrl"; | ||
175 | }; | ||
176 | |||
155 | usb@a03e0000 { | 177 | usb@a03e0000 { |
156 | compatible = "stericsson,db8500-musb", | 178 | compatible = "stericsson,db8500-musb", |
157 | "mentor,musb"; | 179 | "mentor,musb"; |
@@ -169,20 +191,195 @@ | |||
169 | prcmu@80157000 { | 191 | prcmu@80157000 { |
170 | compatible = "stericsson,db8500-prcmu"; | 192 | compatible = "stericsson,db8500-prcmu"; |
171 | reg = <0x80157000 0x1000>; | 193 | reg = <0x80157000 0x1000>; |
172 | interrupts = <46 47>; | 194 | interrupts = <0 47 0x4>; |
173 | #address-cells = <1>; | 195 | #address-cells = <1>; |
174 | #size-cells = <1>; | 196 | #size-cells = <1>; |
175 | ranges; | 197 | ranges; |
176 | 198 | ||
177 | prcmu-timer-4@80157450 { | 199 | prcmu-timer-4@80157450 { |
178 | compatible = "stericsson,db8500-prcmu-timer-4"; | 200 | compatible = "stericsson,db8500-prcmu-timer-4"; |
179 | reg = <0x80157450 0xC>; | 201 | reg = <0x80157450 0xC>; |
180 | }; | 202 | }; |
181 | 203 | ||
204 | db8500-prcmu-regulators { | ||
205 | compatible = "stericsson,db8500-prcmu-regulator"; | ||
206 | |||
207 | // DB8500_REGULATOR_VAPE | ||
208 | db8500_vape_reg: db8500_vape { | ||
209 | regulator-name = "db8500-vape"; | ||
210 | regulator-always-on; | ||
211 | }; | ||
212 | |||
213 | // DB8500_REGULATOR_VARM | ||
214 | db8500_varm_reg: db8500_varm { | ||
215 | regulator-name = "db8500-varm"; | ||
216 | }; | ||
217 | |||
218 | // DB8500_REGULATOR_VMODEM | ||
219 | db8500_vmodem_reg: db8500_vmodem { | ||
220 | regulator-name = "db8500-vmodem"; | ||
221 | }; | ||
222 | |||
223 | // DB8500_REGULATOR_VPLL | ||
224 | db8500_vpll_reg: db8500_vpll { | ||
225 | regulator-name = "db8500-vpll"; | ||
226 | }; | ||
227 | |||
228 | // DB8500_REGULATOR_VSMPS1 | ||
229 | db8500_vsmps1_reg: db8500_vsmps1 { | ||
230 | regulator-name = "db8500-vsmps1"; | ||
231 | }; | ||
232 | |||
233 | // DB8500_REGULATOR_VSMPS2 | ||
234 | db8500_vsmps2_reg: db8500_vsmps2 { | ||
235 | regulator-name = "db8500-vsmps2"; | ||
236 | }; | ||
237 | |||
238 | // DB8500_REGULATOR_VSMPS3 | ||
239 | db8500_vsmps3_reg: db8500_vsmps3 { | ||
240 | regulator-name = "db8500-vsmps3"; | ||
241 | }; | ||
242 | |||
243 | // DB8500_REGULATOR_VRF1 | ||
244 | db8500_vrf1_reg: db8500_vrf1 { | ||
245 | regulator-name = "db8500-vrf1"; | ||
246 | }; | ||
247 | |||
248 | // DB8500_REGULATOR_SWITCH_SVAMMDSP | ||
249 | db8500_sva_mmdsp_reg: db8500_sva_mmdsp { | ||
250 | regulator-name = "db8500-sva-mmdsp"; | ||
251 | }; | ||
252 | |||
253 | // DB8500_REGULATOR_SWITCH_SVAMMDSPRET | ||
254 | db8500_sva_mmdsp_ret_reg: db8500_sva_mmdsp_ret { | ||
255 | regulator-name = "db8500-sva-mmdsp-ret"; | ||
256 | }; | ||
257 | |||
258 | // DB8500_REGULATOR_SWITCH_SVAPIPE | ||
259 | db8500_sva_pipe_reg: db8500_sva_pipe { | ||
260 | regulator-name = "db8500_sva_pipe"; | ||
261 | }; | ||
262 | |||
263 | // DB8500_REGULATOR_SWITCH_SIAMMDSP | ||
264 | db8500_sia_mmdsp_reg: db8500_sia_mmdsp { | ||
265 | regulator-name = "db8500_sia_mmdsp"; | ||
266 | }; | ||
267 | |||
268 | // DB8500_REGULATOR_SWITCH_SIAMMDSPRET | ||
269 | db8500_sia_mmdsp_ret_reg: db8500_sia_mmdsp_ret { | ||
270 | regulator-name = "db8500-sia-mmdsp-ret"; | ||
271 | }; | ||
272 | |||
273 | // DB8500_REGULATOR_SWITCH_SIAPIPE | ||
274 | db8500_sia_pipe_reg: db8500_sia_pipe { | ||
275 | regulator-name = "db8500-sia-pipe"; | ||
276 | }; | ||
277 | |||
278 | // DB8500_REGULATOR_SWITCH_SGA | ||
279 | db8500_sga_reg: db8500_sga { | ||
280 | regulator-name = "db8500-sga"; | ||
281 | vin-supply = <&db8500_vape_reg>; | ||
282 | }; | ||
283 | |||
284 | // DB8500_REGULATOR_SWITCH_B2R2_MCDE | ||
285 | db8500_b2r2_mcde_reg: db8500_b2r2_mcde { | ||
286 | regulator-name = "db8500-b2r2-mcde"; | ||
287 | vin-supply = <&db8500_vape_reg>; | ||
288 | }; | ||
289 | |||
290 | // DB8500_REGULATOR_SWITCH_ESRAM12 | ||
291 | db8500_esram12_reg: db8500_esram12 { | ||
292 | regulator-name = "db8500-esram12"; | ||
293 | }; | ||
294 | |||
295 | // DB8500_REGULATOR_SWITCH_ESRAM12RET | ||
296 | db8500_esram12_ret_reg: db8500_esram12_ret { | ||
297 | regulator-name = "db8500-esram12-ret"; | ||
298 | }; | ||
299 | |||
300 | // DB8500_REGULATOR_SWITCH_ESRAM34 | ||
301 | db8500_esram34_reg: db8500_esram34 { | ||
302 | regulator-name = "db8500-esram34"; | ||
303 | }; | ||
304 | |||
305 | // DB8500_REGULATOR_SWITCH_ESRAM34RET | ||
306 | db8500_esram34_ret_reg: db8500_esram34_ret { | ||
307 | regulator-name = "db8500-esram34-ret"; | ||
308 | }; | ||
309 | }; | ||
310 | |||
182 | ab8500@5 { | 311 | ab8500@5 { |
183 | compatible = "stericsson,ab8500"; | 312 | compatible = "stericsson,ab8500"; |
184 | reg = <5>; /* mailbox 5 is i2c */ | 313 | reg = <5>; /* mailbox 5 is i2c */ |
185 | interrupts = <0 40 0x4>; | 314 | interrupts = <0 40 0x4>; |
315 | |||
316 | ab8500-regulators { | ||
317 | compatible = "stericsson,ab8500-regulator"; | ||
318 | |||
319 | // supplies to the display/camera | ||
320 | ab8500_ldo_aux1_reg: ab8500_ldo_aux1 { | ||
321 | regulator-name = "V-DISPLAY"; | ||
322 | regulator-min-microvolt = <2500000>; | ||
323 | regulator-max-microvolt = <2900000>; | ||
324 | regulator-boot-on; | ||
325 | /* BUG: If turned off MMC will be affected. */ | ||
326 | regulator-always-on; | ||
327 | }; | ||
328 | |||
329 | // supplies to the on-board eMMC | ||
330 | ab8500_ldo_aux2_reg: ab8500_ldo_aux2 { | ||
331 | regulator-name = "V-eMMC1"; | ||
332 | regulator-min-microvolt = <1100000>; | ||
333 | regulator-max-microvolt = <3300000>; | ||
334 | }; | ||
335 | |||
336 | // supply for VAUX3; SDcard slots | ||
337 | ab8500_ldo_aux3_reg: ab8500_ldo_aux3 { | ||
338 | regulator-name = "V-MMC-SD"; | ||
339 | regulator-min-microvolt = <1100000>; | ||
340 | regulator-max-microvolt = <3300000>; | ||
341 | }; | ||
342 | |||
343 | // supply for v-intcore12; VINTCORE12 LDO | ||
344 | ab8500_ldo_initcore_reg: ab8500_ldo_initcore { | ||
345 | regulator-name = "V-INTCORE"; | ||
346 | }; | ||
347 | |||
348 | // supply for tvout; gpadc; TVOUT LDO | ||
349 | ab8500_ldo_tvout_reg: ab8500_ldo_tvout { | ||
350 | regulator-name = "V-TVOUT"; | ||
351 | }; | ||
352 | |||
353 | // supply for ab8500-usb; USB LDO | ||
354 | ab8500_ldo_usb_reg: ab8500_ldo_usb { | ||
355 | regulator-name = "dummy"; | ||
356 | }; | ||
357 | |||
358 | // supply for ab8500-vaudio; VAUDIO LDO | ||
359 | ab8500_ldo_audio_reg: ab8500_ldo_audio { | ||
360 | regulator-name = "V-AUD"; | ||
361 | }; | ||
362 | |||
363 | // supply for v-anamic1 VAMic1-LDO | ||
364 | ab8500_ldo_anamic1_reg: ab8500_ldo_anamic1 { | ||
365 | regulator-name = "V-AMIC1"; | ||
366 | }; | ||
367 | |||
368 | // supply for v-amic2; VAMIC2 LDO; reuse constants for AMIC1 | ||
369 | ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 { | ||
370 | regulator-name = "V-AMIC2"; | ||
371 | }; | ||
372 | |||
373 | // supply for v-dmic; VDMIC LDO | ||
374 | ab8500_ldo_dmic_reg: ab8500_ldo_dmic { | ||
375 | regulator-name = "V-DMIC"; | ||
376 | }; | ||
377 | |||
378 | // supply for U8500 CSI/DSI; VANA LDO | ||
379 | ab8500_ldo_ana_reg: ab8500_ldo_ana { | ||
380 | regulator-name = "V-CSI/DSI"; | ||
381 | }; | ||
382 | }; | ||
186 | }; | 383 | }; |
187 | }; | 384 | }; |
188 | 385 | ||
@@ -235,7 +432,8 @@ | |||
235 | status = "disabled"; | 432 | status = "disabled"; |
236 | 433 | ||
237 | // Add one of these for each child device | 434 | // Add one of these for each child device |
238 | cs-gpios = <&gpio0 31 &gpio4 14 &gpio4 16 &gpio6 22 &gpio7 0>; | 435 | cs-gpios = <&gpio0 31 0x4 &gpio4 14 0x4 &gpio4 16 0x4 |
436 | &gpio6 22 0x4 &gpio7 0 0x4>; | ||
239 | 437 | ||
240 | }; | 438 | }; |
241 | 439 | ||
diff --git a/arch/arm/boot/dts/snowball.dts b/arch/arm/boot/dts/snowball.dts index d99dc04f0d91..ec3c33975110 100644 --- a/arch/arm/boot/dts/snowball.dts +++ b/arch/arm/boot/dts/snowball.dts | |||
@@ -20,6 +20,16 @@ | |||
20 | reg = <0x00000000 0x20000000>; | 20 | reg = <0x00000000 0x20000000>; |
21 | }; | 21 | }; |
22 | 22 | ||
23 | en_3v3_reg: en_3v3 { | ||
24 | compatible = "regulator-fixed"; | ||
25 | regulator-name = "en-3v3-fixed-supply"; | ||
26 | regulator-min-microvolt = <3300000>; | ||
27 | regulator-max-microvolt = <3300000>; | ||
28 | gpios = <&gpio0 26 0x4>; // 26 | ||
29 | startup-delay-us = <5000>; | ||
30 | enable-active-high; | ||
31 | }; | ||
32 | |||
23 | gpio_keys { | 33 | gpio_keys { |
24 | compatible = "gpio-keys"; | 34 | compatible = "gpio-keys"; |
25 | #address-cells = <1>; | 35 | #address-cells = <1>; |
@@ -30,35 +40,35 @@ | |||
30 | wakeup = <1>; | 40 | wakeup = <1>; |
31 | linux,code = <2>; | 41 | linux,code = <2>; |
32 | label = "userpb"; | 42 | label = "userpb"; |
33 | gpios = <&gpio1 0 0>; | 43 | gpios = <&gpio1 0 0x4>; |
34 | }; | 44 | }; |
35 | button@2 { | 45 | button@2 { |
36 | debounce_interval = <50>; | 46 | debounce_interval = <50>; |
37 | wakeup = <1>; | 47 | wakeup = <1>; |
38 | linux,code = <3>; | 48 | linux,code = <3>; |
39 | label = "extkb1"; | 49 | label = "extkb1"; |
40 | gpios = <&gpio4 23 0>; | 50 | gpios = <&gpio4 23 0x4>; |
41 | }; | 51 | }; |
42 | button@3 { | 52 | button@3 { |
43 | debounce_interval = <50>; | 53 | debounce_interval = <50>; |
44 | wakeup = <1>; | 54 | wakeup = <1>; |
45 | linux,code = <4>; | 55 | linux,code = <4>; |
46 | label = "extkb2"; | 56 | label = "extkb2"; |
47 | gpios = <&gpio4 24 0>; | 57 | gpios = <&gpio4 24 0x4>; |
48 | }; | 58 | }; |
49 | button@4 { | 59 | button@4 { |
50 | debounce_interval = <50>; | 60 | debounce_interval = <50>; |
51 | wakeup = <1>; | 61 | wakeup = <1>; |
52 | linux,code = <5>; | 62 | linux,code = <5>; |
53 | label = "extkb3"; | 63 | label = "extkb3"; |
54 | gpios = <&gpio5 1 0>; | 64 | gpios = <&gpio5 1 0x4>; |
55 | }; | 65 | }; |
56 | button@5 { | 66 | button@5 { |
57 | debounce_interval = <50>; | 67 | debounce_interval = <50>; |
58 | wakeup = <1>; | 68 | wakeup = <1>; |
59 | linux,code = <6>; | 69 | linux,code = <6>; |
60 | label = "extkb4"; | 70 | label = "extkb4"; |
61 | gpios = <&gpio5 2 0>; | 71 | gpios = <&gpio5 2 0x4>; |
62 | }; | 72 | }; |
63 | }; | 73 | }; |
64 | 74 | ||
@@ -66,12 +76,11 @@ | |||
66 | compatible = "gpio-leds"; | 76 | compatible = "gpio-leds"; |
67 | used-led { | 77 | used-led { |
68 | label = "user_led"; | 78 | label = "user_led"; |
69 | gpios = <&gpio4 14>; | 79 | gpios = <&gpio4 14 0x4>; |
70 | }; | 80 | }; |
71 | }; | 81 | }; |
72 | 82 | ||
73 | soc-u9500 { | 83 | soc-u9500 { |
74 | |||
75 | external-bus@50000000 { | 84 | external-bus@50000000 { |
76 | status = "okay"; | 85 | status = "okay"; |
77 | 86 | ||
@@ -80,6 +89,9 @@ | |||
80 | reg = <0 0x10000>; | 89 | reg = <0 0x10000>; |
81 | interrupts = <12 0x1>; | 90 | interrupts = <12 0x1>; |
82 | interrupt-parent = <&gpio4>; | 91 | interrupt-parent = <&gpio4>; |
92 | vdd33a-supply = <&en_3v3_reg>; | ||
93 | vddvario-supply = <&db8500_vape_reg>; | ||
94 | |||
83 | 95 | ||
84 | reg-shift = <1>; | 96 | reg-shift = <1>; |
85 | reg-io-width = <2>; | 97 | reg-io-width = <2>; |
@@ -91,11 +103,13 @@ | |||
91 | 103 | ||
92 | sdi@80126000 { | 104 | sdi@80126000 { |
93 | status = "enabled"; | 105 | status = "enabled"; |
94 | cd-gpios = <&gpio6 26>; | 106 | vmmc-supply = <&ab8500_ldo_aux3_reg>; |
107 | cd-gpios = <&gpio6 26 0x4>; // 218 | ||
95 | }; | 108 | }; |
96 | 109 | ||
97 | sdi@80114000 { | 110 | sdi@80114000 { |
98 | status = "enabled"; | 111 | status = "enabled"; |
112 | vmmc-supply = <&ab8500_ldo_aux2_reg>; | ||
99 | }; | 113 | }; |
100 | 114 | ||
101 | uart@80120000 { | 115 | uart@80120000 { |
@@ -114,7 +128,7 @@ | |||
114 | tc3589x@42 { | 128 | tc3589x@42 { |
115 | //compatible = "tc3589x"; | 129 | //compatible = "tc3589x"; |
116 | reg = <0x42>; | 130 | reg = <0x42>; |
117 | interrupts = <25>; | 131 | gpios = <&gpio6 25 0x4>; |
118 | interrupt-parent = <&gpio6>; | 132 | interrupt-parent = <&gpio6>; |
119 | }; | 133 | }; |
120 | tps61052@33 { | 134 | tps61052@33 { |
diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig index 7e84f453e8a6..2d4f661d1cf6 100644 --- a/arch/arm/configs/u8500_defconfig +++ b/arch/arm/configs/u8500_defconfig | |||
@@ -75,6 +75,7 @@ CONFIG_AB5500_CORE=y | |||
75 | CONFIG_AB8500_CORE=y | 75 | CONFIG_AB8500_CORE=y |
76 | CONFIG_REGULATOR=y | 76 | CONFIG_REGULATOR=y |
77 | CONFIG_REGULATOR_AB8500=y | 77 | CONFIG_REGULATOR_AB8500=y |
78 | CONFIG_REGULATOR_FIXED_VOLTAGE=y | ||
78 | # CONFIG_HID_SUPPORT is not set | 79 | # CONFIG_HID_SUPPORT is not set |
79 | CONFIG_USB_GADGET=y | 80 | CONFIG_USB_GADGET=y |
80 | CONFIG_AB8500_USB=y | 81 | CONFIG_AB8500_USB=y |
diff --git a/arch/arm/include/asm/posix_types.h b/arch/arm/include/asm/posix_types.h index efdf99045d87..d2de9cbbcd9b 100644 --- a/arch/arm/include/asm/posix_types.h +++ b/arch/arm/include/asm/posix_types.h | |||
@@ -22,9 +22,6 @@ | |||
22 | typedef unsigned short __kernel_mode_t; | 22 | typedef unsigned short __kernel_mode_t; |
23 | #define __kernel_mode_t __kernel_mode_t | 23 | #define __kernel_mode_t __kernel_mode_t |
24 | 24 | ||
25 | typedef unsigned short __kernel_nlink_t; | ||
26 | #define __kernel_nlink_t __kernel_nlink_t | ||
27 | |||
28 | typedef unsigned short __kernel_ipc_pid_t; | 25 | typedef unsigned short __kernel_ipc_pid_t; |
29 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t | 26 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t |
30 | 27 | ||
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 17fc36c41cff..fd2392a17ac1 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c | |||
@@ -22,8 +22,6 @@ | |||
22 | 22 | ||
23 | #include "signal.h" | 23 | #include "signal.h" |
24 | 24 | ||
25 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
26 | |||
27 | /* | 25 | /* |
28 | * For ARM syscalls, we encode the syscall number into the instruction. | 26 | * For ARM syscalls, we encode the syscall number into the instruction. |
29 | */ | 27 | */ |
@@ -210,10 +208,8 @@ static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf) | |||
210 | int err; | 208 | int err; |
211 | 209 | ||
212 | err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set)); | 210 | err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set)); |
213 | if (err == 0) { | 211 | if (err == 0) |
214 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
215 | set_current_blocked(&set); | 212 | set_current_blocked(&set); |
216 | } | ||
217 | 213 | ||
218 | __get_user_error(regs->ARM_r0, &sf->uc.uc_mcontext.arm_r0, err); | 214 | __get_user_error(regs->ARM_r0, &sf->uc.uc_mcontext.arm_r0, err); |
219 | __get_user_error(regs->ARM_r1, &sf->uc.uc_mcontext.arm_r1, err); | 215 | __get_user_error(regs->ARM_r1, &sf->uc.uc_mcontext.arm_r1, err); |
@@ -528,13 +524,13 @@ setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, | |||
528 | /* | 524 | /* |
529 | * OK, we're invoking a handler | 525 | * OK, we're invoking a handler |
530 | */ | 526 | */ |
531 | static int | 527 | static void |
532 | handle_signal(unsigned long sig, struct k_sigaction *ka, | 528 | handle_signal(unsigned long sig, struct k_sigaction *ka, |
533 | siginfo_t *info, sigset_t *oldset, | 529 | siginfo_t *info, struct pt_regs *regs) |
534 | struct pt_regs * regs) | ||
535 | { | 530 | { |
536 | struct thread_info *thread = current_thread_info(); | 531 | struct thread_info *thread = current_thread_info(); |
537 | struct task_struct *tsk = current; | 532 | struct task_struct *tsk = current; |
533 | sigset_t *oldset = sigmask_to_save(); | ||
538 | int usig = sig; | 534 | int usig = sig; |
539 | int ret; | 535 | int ret; |
540 | 536 | ||
@@ -559,17 +555,9 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
559 | 555 | ||
560 | if (ret != 0) { | 556 | if (ret != 0) { |
561 | force_sigsegv(sig, tsk); | 557 | force_sigsegv(sig, tsk); |
562 | return ret; | 558 | return; |
563 | } | 559 | } |
564 | 560 | signal_delivered(sig, info, ka, regs, 0); | |
565 | /* | ||
566 | * Block the signal if we were successful. | ||
567 | */ | ||
568 | block_sigmask(ka, sig); | ||
569 | |||
570 | tracehook_signal_handler(sig, info, ka, regs, 0); | ||
571 | |||
572 | return 0; | ||
573 | } | 561 | } |
574 | 562 | ||
575 | /* | 563 | /* |
@@ -617,8 +605,6 @@ static void do_signal(struct pt_regs *regs, int syscall) | |||
617 | */ | 605 | */ |
618 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 606 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
619 | if (signr > 0) { | 607 | if (signr > 0) { |
620 | sigset_t *oldset; | ||
621 | |||
622 | /* | 608 | /* |
623 | * Depending on the signal settings we may need to revert the | 609 | * Depending on the signal settings we may need to revert the |
624 | * decision to restart the system call. But skip this if a | 610 | * decision to restart the system call. But skip this if a |
@@ -635,20 +621,7 @@ static void do_signal(struct pt_regs *regs, int syscall) | |||
635 | clear_thread_flag(TIF_SYSCALL_RESTARTSYS); | 621 | clear_thread_flag(TIF_SYSCALL_RESTARTSYS); |
636 | } | 622 | } |
637 | 623 | ||
638 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | 624 | handle_signal(signr, &ka, &info, regs); |
639 | oldset = ¤t->saved_sigmask; | ||
640 | else | ||
641 | oldset = ¤t->blocked; | ||
642 | if (handle_signal(signr, &ka, &info, oldset, regs) == 0) { | ||
643 | /* | ||
644 | * A signal was successfully delivered; the saved | ||
645 | * sigmask will have been stored in the signal frame, | ||
646 | * and will be restored by sigreturn, so we can simply | ||
647 | * clear the TIF_RESTORE_SIGMASK flag. | ||
648 | */ | ||
649 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
650 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
651 | } | ||
652 | return; | 625 | return; |
653 | } | 626 | } |
654 | 627 | ||
@@ -663,11 +636,7 @@ static void do_signal(struct pt_regs *regs, int syscall) | |||
663 | set_thread_flag(TIF_SYSCALL_RESTARTSYS); | 636 | set_thread_flag(TIF_SYSCALL_RESTARTSYS); |
664 | } | 637 | } |
665 | 638 | ||
666 | /* If there's no signal to deliver, we just put the saved sigmask | 639 | restore_saved_sigmask(); |
667 | * back. | ||
668 | */ | ||
669 | if (test_and_clear_thread_flag(TIF_RESTORE_SIGMASK)) | ||
670 | set_current_blocked(¤t->saved_sigmask); | ||
671 | } | 640 | } |
672 | 641 | ||
673 | asmlinkage void | 642 | asmlinkage void |
@@ -679,7 +648,5 @@ do_notify_resume(struct pt_regs *regs, unsigned int thread_flags, int syscall) | |||
679 | if (thread_flags & _TIF_NOTIFY_RESUME) { | 648 | if (thread_flags & _TIF_NOTIFY_RESUME) { |
680 | clear_thread_flag(TIF_NOTIFY_RESUME); | 649 | clear_thread_flag(TIF_NOTIFY_RESUME); |
681 | tracehook_notify_resume(regs); | 650 | tracehook_notify_resume(regs); |
682 | if (current->replacement_session_keyring) | ||
683 | key_replace_session_keyring(); | ||
684 | } | 651 | } |
685 | } | 652 | } |
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index b735521a4a54..2c7217d971db 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
@@ -109,7 +109,6 @@ static void percpu_timer_stop(void); | |||
109 | int __cpu_disable(void) | 109 | int __cpu_disable(void) |
110 | { | 110 | { |
111 | unsigned int cpu = smp_processor_id(); | 111 | unsigned int cpu = smp_processor_id(); |
112 | struct task_struct *p; | ||
113 | int ret; | 112 | int ret; |
114 | 113 | ||
115 | ret = platform_cpu_disable(cpu); | 114 | ret = platform_cpu_disable(cpu); |
@@ -139,12 +138,7 @@ int __cpu_disable(void) | |||
139 | flush_cache_all(); | 138 | flush_cache_all(); |
140 | local_flush_tlb_all(); | 139 | local_flush_tlb_all(); |
141 | 140 | ||
142 | read_lock(&tasklist_lock); | 141 | clear_tasks_mm_cpumask(cpu); |
143 | for_each_process(p) { | ||
144 | if (p->mm) | ||
145 | cpumask_clear_cpu(cpu, mm_cpumask(p->mm)); | ||
146 | } | ||
147 | read_unlock(&tasklist_lock); | ||
148 | 142 | ||
149 | return 0; | 143 | return 0; |
150 | } | 144 | } |
diff --git a/arch/arm/mach-ux500/board-mop500-uib.c b/arch/arm/mach-ux500/board-mop500-uib.c index b29a788f498c..1f47d962e3a1 100644 --- a/arch/arm/mach-ux500/board-mop500-uib.c +++ b/arch/arm/mach-ux500/board-mop500-uib.c | |||
@@ -96,7 +96,7 @@ static void __init __mop500_uib_init(struct uib *uib, const char *why) | |||
96 | /* | 96 | /* |
97 | * Detect the UIB attached based on the presence or absence of i2c devices. | 97 | * Detect the UIB attached based on the presence or absence of i2c devices. |
98 | */ | 98 | */ |
99 | static int __init mop500_uib_init(void) | 99 | int __init mop500_uib_init(void) |
100 | { | 100 | { |
101 | struct uib *uib = mop500_uib; | 101 | struct uib *uib = mop500_uib; |
102 | struct i2c_adapter *i2c0; | 102 | struct i2c_adapter *i2c0; |
@@ -131,5 +131,3 @@ static int __init mop500_uib_init(void) | |||
131 | 131 | ||
132 | return 0; | 132 | return 0; |
133 | } | 133 | } |
134 | |||
135 | module_init(mop500_uib_init); | ||
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index fba8adea421e..9c74ac545849 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c | |||
@@ -673,9 +673,15 @@ static void __init u8500_cryp1_hash1_init(struct device *parent) | |||
673 | static struct platform_device *snowball_platform_devs[] __initdata = { | 673 | static struct platform_device *snowball_platform_devs[] __initdata = { |
674 | &snowball_led_dev, | 674 | &snowball_led_dev, |
675 | &snowball_key_dev, | 675 | &snowball_key_dev, |
676 | &snowball_sbnet_dev, | ||
676 | &ab8500_device, | 677 | &ab8500_device, |
677 | }; | 678 | }; |
678 | 679 | ||
680 | static struct platform_device *snowball_of_platform_devs[] __initdata = { | ||
681 | &snowball_led_dev, | ||
682 | &snowball_key_dev, | ||
683 | }; | ||
684 | |||
679 | static void __init mop500_init_machine(void) | 685 | static void __init mop500_init_machine(void) |
680 | { | 686 | { |
681 | struct device *parent = NULL; | 687 | struct device *parent = NULL; |
@@ -710,6 +716,8 @@ static void __init mop500_init_machine(void) | |||
710 | 716 | ||
711 | /* This board has full regulator constraints */ | 717 | /* This board has full regulator constraints */ |
712 | regulator_has_full_constraints(); | 718 | regulator_has_full_constraints(); |
719 | |||
720 | mop500_uib_init(); | ||
713 | } | 721 | } |
714 | 722 | ||
715 | static void __init snowball_init_machine(void) | 723 | static void __init snowball_init_machine(void) |
@@ -774,6 +782,8 @@ static void __init hrefv60_init_machine(void) | |||
774 | 782 | ||
775 | /* This board has full regulator constraints */ | 783 | /* This board has full regulator constraints */ |
776 | regulator_has_full_constraints(); | 784 | regulator_has_full_constraints(); |
785 | |||
786 | mop500_uib_init(); | ||
777 | } | 787 | } |
778 | 788 | ||
779 | MACHINE_START(U8500, "ST-Ericsson MOP500 platform") | 789 | MACHINE_START(U8500, "ST-Ericsson MOP500 platform") |
@@ -834,6 +844,10 @@ struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { | |||
834 | static const struct of_device_id u8500_local_bus_nodes[] = { | 844 | static const struct of_device_id u8500_local_bus_nodes[] = { |
835 | /* only create devices below soc node */ | 845 | /* only create devices below soc node */ |
836 | { .compatible = "stericsson,db8500", }, | 846 | { .compatible = "stericsson,db8500", }, |
847 | { .compatible = "stericsson,db8500-prcmu", }, | ||
848 | { .compatible = "stericsson,db8500-prcmu-regulator", }, | ||
849 | { .compatible = "stericsson,ab8500", }, | ||
850 | { .compatible = "stericsson,ab8500-regulator", }, | ||
837 | { .compatible = "simple-bus"}, | 851 | { .compatible = "simple-bus"}, |
838 | { }, | 852 | { }, |
839 | }; | 853 | }; |
@@ -852,7 +866,7 @@ static void __init u8500_init_machine(void) | |||
852 | else if (of_machine_is_compatible("st-ericsson,hrefv60+")) | 866 | else if (of_machine_is_compatible("st-ericsson,hrefv60+")) |
853 | hrefv60_pinmaps_init(); | 867 | hrefv60_pinmaps_init(); |
854 | 868 | ||
855 | parent = u8500_init_devices(); | 869 | parent = u8500_of_init_devices(); |
856 | 870 | ||
857 | for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++) | 871 | for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++) |
858 | mop500_platform_devs[i]->dev.parent = parent; | 872 | mop500_platform_devs[i]->dev.parent = parent; |
@@ -869,15 +883,23 @@ static void __init u8500_init_machine(void) | |||
869 | ARRAY_SIZE(mop500_platform_devs)); | 883 | ARRAY_SIZE(mop500_platform_devs)); |
870 | 884 | ||
871 | mop500_sdi_init(parent); | 885 | mop500_sdi_init(parent); |
872 | |||
873 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); | 886 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); |
874 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); | 887 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); |
875 | i2c_register_board_info(2, mop500_i2c2_devices, | 888 | i2c_register_board_info(2, mop500_i2c2_devices, |
876 | ARRAY_SIZE(mop500_i2c2_devices)); | 889 | ARRAY_SIZE(mop500_i2c2_devices)); |
877 | 890 | ||
891 | mop500_uib_init(); | ||
892 | |||
878 | } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) { | 893 | } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) { |
879 | platform_add_devices(snowball_platform_devs, | 894 | /* |
880 | ARRAY_SIZE(snowball_platform_devs)); | 895 | * Devices to be DT:ed: |
896 | * snowball_led_dev = todo | ||
897 | * snowball_key_dev = todo | ||
898 | * snowball_sbnet_dev = done | ||
899 | * ab8500_device = done | ||
900 | */ | ||
901 | platform_add_devices(snowball_of_platform_devs, | ||
902 | ARRAY_SIZE(snowball_of_platform_devs)); | ||
881 | 903 | ||
882 | snowball_sdi_init(parent); | 904 | snowball_sdi_init(parent); |
883 | } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) { | 905 | } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) { |
@@ -898,6 +920,8 @@ static void __init u8500_init_machine(void) | |||
898 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); | 920 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); |
899 | i2c_register_board_info(2, mop500_i2c2_devices, | 921 | i2c_register_board_info(2, mop500_i2c2_devices, |
900 | ARRAY_SIZE(mop500_i2c2_devices)); | 922 | ARRAY_SIZE(mop500_i2c2_devices)); |
923 | |||
924 | mop500_uib_init(); | ||
901 | } | 925 | } |
902 | mop500_i2c_init(parent); | 926 | mop500_i2c_init(parent); |
903 | 927 | ||
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h index bc44c07c71a9..2f87b25a908a 100644 --- a/arch/arm/mach-ux500/board-mop500.h +++ b/arch/arm/mach-ux500/board-mop500.h | |||
@@ -89,7 +89,11 @@ void __init mop500_pinmaps_init(void); | |||
89 | void __init snowball_pinmaps_init(void); | 89 | void __init snowball_pinmaps_init(void); |
90 | void __init hrefv60_pinmaps_init(void); | 90 | void __init hrefv60_pinmaps_init(void); |
91 | 91 | ||
92 | int __init mop500_uib_init(void); | ||
92 | void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info, | 93 | void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info, |
93 | unsigned n); | 94 | unsigned n); |
94 | 95 | ||
96 | /* TODO: Once all pieces are DT:ed, remove completely. */ | ||
97 | struct device * __init u8500_of_init_devices(void); | ||
98 | |||
95 | #endif | 99 | #endif |
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c index 16169c4bf6ca..33275eb4c689 100644 --- a/arch/arm/mach-ux500/cpu-db8500.c +++ b/arch/arm/mach-ux500/cpu-db8500.c | |||
@@ -140,7 +140,6 @@ static struct platform_device *platform_devs[] __initdata = { | |||
140 | static struct platform_device *of_platform_devs[] __initdata = { | 140 | static struct platform_device *of_platform_devs[] __initdata = { |
141 | &u8500_dma40_device, | 141 | &u8500_dma40_device, |
142 | &db8500_pmu_device, | 142 | &db8500_pmu_device, |
143 | &db8500_prcmu_device, | ||
144 | }; | 143 | }; |
145 | 144 | ||
146 | static resource_size_t __initdata db8500_gpio_base[] = { | 145 | static resource_size_t __initdata db8500_gpio_base[] = { |
@@ -222,6 +221,28 @@ struct device * __init u8500_init_devices(void) | |||
222 | platform_device_register_data(parent, | 221 | platform_device_register_data(parent, |
223 | "cpufreq-u8500", -1, NULL, 0); | 222 | "cpufreq-u8500", -1, NULL, 0); |
224 | 223 | ||
224 | for (i = 0; i < ARRAY_SIZE(platform_devs); i++) | ||
225 | platform_devs[i]->dev.parent = parent; | ||
226 | |||
227 | platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs)); | ||
228 | |||
229 | return parent; | ||
230 | } | ||
231 | |||
232 | /* TODO: Once all pieces are DT:ed, remove completely. */ | ||
233 | struct device * __init u8500_of_init_devices(void) | ||
234 | { | ||
235 | struct device *parent; | ||
236 | int i; | ||
237 | |||
238 | parent = db8500_soc_device_init(); | ||
239 | |||
240 | db8500_add_rtc(parent); | ||
241 | db8500_add_usb(parent, usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg); | ||
242 | |||
243 | platform_device_register_data(parent, | ||
244 | "cpufreq-u8500", -1, NULL, 0); | ||
245 | |||
225 | for (i = 0; i < ARRAY_SIZE(of_platform_devs); i++) | 246 | for (i = 0; i < ARRAY_SIZE(of_platform_devs); i++) |
226 | of_platform_devs[i]->dev.parent = parent; | 247 | of_platform_devs[i]->dev.parent = parent; |
227 | 248 | ||
@@ -229,7 +250,7 @@ struct device * __init u8500_init_devices(void) | |||
229 | * Devices to be DT:ed: | 250 | * Devices to be DT:ed: |
230 | * u8500_dma40_device = todo | 251 | * u8500_dma40_device = todo |
231 | * db8500_pmu_device = todo | 252 | * db8500_pmu_device = todo |
232 | * db8500_prcmu_device = todo | 253 | * db8500_prcmu_device = done |
233 | */ | 254 | */ |
234 | platform_add_devices(of_platform_devs, ARRAY_SIZE(of_platform_devs)); | 255 | platform_add_devices(of_platform_devs, ARRAY_SIZE(of_platform_devs)); |
235 | 256 | ||
diff --git a/arch/avr32/include/asm/posix_types.h b/arch/avr32/include/asm/posix_types.h index 74667bfc88cc..9ba9e749b3f3 100644 --- a/arch/avr32/include/asm/posix_types.h +++ b/arch/avr32/include/asm/posix_types.h | |||
@@ -17,9 +17,6 @@ | |||
17 | typedef unsigned short __kernel_mode_t; | 17 | typedef unsigned short __kernel_mode_t; |
18 | #define __kernel_mode_t __kernel_mode_t | 18 | #define __kernel_mode_t __kernel_mode_t |
19 | 19 | ||
20 | typedef unsigned short __kernel_nlink_t; | ||
21 | #define __kernel_nlink_t __kernel_nlink_t | ||
22 | |||
23 | typedef unsigned short __kernel_ipc_pid_t; | 20 | typedef unsigned short __kernel_ipc_pid_t; |
24 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t | 21 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t |
25 | 22 | ||
diff --git a/arch/avr32/kernel/entry-avr32b.S b/arch/avr32/kernel/entry-avr32b.S index 169268c40ae2..df2884181313 100644 --- a/arch/avr32/kernel/entry-avr32b.S +++ b/arch/avr32/kernel/entry-avr32b.S | |||
@@ -281,7 +281,7 @@ syscall_exit_work: | |||
281 | ld.w r1, r0[TI_flags] | 281 | ld.w r1, r0[TI_flags] |
282 | rjmp 1b | 282 | rjmp 1b |
283 | 283 | ||
284 | 2: mov r2, _TIF_SIGPENDING | _TIF_RESTORE_SIGMASK | _TIF_NOTIFY_RESUME | 284 | 2: mov r2, _TIF_SIGPENDING | _TIF_NOTIFY_RESUME |
285 | tst r1, r2 | 285 | tst r1, r2 |
286 | breq 3f | 286 | breq 3f |
287 | unmask_interrupts | 287 | unmask_interrupts |
@@ -587,7 +587,7 @@ fault_exit_work: | |||
587 | ld.w r1, r0[TI_flags] | 587 | ld.w r1, r0[TI_flags] |
588 | rjmp fault_exit_work | 588 | rjmp fault_exit_work |
589 | 589 | ||
590 | 1: mov r2, _TIF_SIGPENDING | _TIF_RESTORE_SIGMASK | 590 | 1: mov r2, _TIF_SIGPENDING | _TIF_NOTIFY_RESUME |
591 | tst r1, r2 | 591 | tst r1, r2 |
592 | breq 2f | 592 | breq 2f |
593 | unmask_interrupts | 593 | unmask_interrupts |
diff --git a/arch/avr32/kernel/signal.c b/arch/avr32/kernel/signal.c index ae386c304bee..c140f9b41dce 100644 --- a/arch/avr32/kernel/signal.c +++ b/arch/avr32/kernel/signal.c | |||
@@ -22,8 +22,6 @@ | |||
22 | #include <asm/ucontext.h> | 22 | #include <asm/ucontext.h> |
23 | #include <asm/syscalls.h> | 23 | #include <asm/syscalls.h> |
24 | 24 | ||
25 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
26 | |||
27 | asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, | 25 | asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, |
28 | struct pt_regs *regs) | 26 | struct pt_regs *regs) |
29 | { | 27 | { |
@@ -89,7 +87,6 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs) | |||
89 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 87 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
90 | goto badframe; | 88 | goto badframe; |
91 | 89 | ||
92 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
93 | set_current_blocked(&set); | 90 | set_current_blocked(&set); |
94 | 91 | ||
95 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) | 92 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) |
@@ -224,30 +221,27 @@ static inline void setup_syscall_restart(struct pt_regs *regs) | |||
224 | 221 | ||
225 | static inline void | 222 | static inline void |
226 | handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | 223 | handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, |
227 | sigset_t *oldset, struct pt_regs *regs, int syscall) | 224 | struct pt_regs *regs, int syscall) |
228 | { | 225 | { |
229 | int ret; | 226 | int ret; |
230 | 227 | ||
231 | /* | 228 | /* |
232 | * Set up the stack frame | 229 | * Set up the stack frame |
233 | */ | 230 | */ |
234 | ret = setup_rt_frame(sig, ka, info, oldset, regs); | 231 | ret = setup_rt_frame(sig, ka, info, sigmask_to_save(), regs); |
235 | 232 | ||
236 | /* | 233 | /* |
237 | * Check that the resulting registers are sane | 234 | * Check that the resulting registers are sane |
238 | */ | 235 | */ |
239 | ret |= !valid_user_regs(regs); | 236 | ret |= !valid_user_regs(regs); |
240 | 237 | ||
241 | if (ret != 0) { | ||
242 | force_sigsegv(sig, current); | ||
243 | return; | ||
244 | } | ||
245 | |||
246 | /* | 238 | /* |
247 | * Block the signal if we were successful. | 239 | * Block the signal if we were successful. |
248 | */ | 240 | */ |
249 | block_sigmask(ka, sig); | 241 | if (ret != 0) |
250 | clear_thread_flag(TIF_RESTORE_SIGMASK); | 242 | force_sigsegv(sig, current); |
243 | else | ||
244 | signal_delivered(sig, info, ka, regs, 0); | ||
251 | } | 245 | } |
252 | 246 | ||
253 | /* | 247 | /* |
@@ -255,7 +249,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | |||
255 | * doesn't want to handle. Thus you cannot kill init even with a | 249 | * doesn't want to handle. Thus you cannot kill init even with a |
256 | * SIGKILL even by mistake. | 250 | * SIGKILL even by mistake. |
257 | */ | 251 | */ |
258 | int do_signal(struct pt_regs *regs, sigset_t *oldset, int syscall) | 252 | static void do_signal(struct pt_regs *regs, int syscall) |
259 | { | 253 | { |
260 | siginfo_t info; | 254 | siginfo_t info; |
261 | int signr; | 255 | int signr; |
@@ -267,12 +261,7 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset, int syscall) | |||
267 | * without doing anything if so. | 261 | * without doing anything if so. |
268 | */ | 262 | */ |
269 | if (!user_mode(regs)) | 263 | if (!user_mode(regs)) |
270 | return 0; | 264 | return; |
271 | |||
272 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
273 | oldset = ¤t->saved_sigmask; | ||
274 | else if (!oldset) | ||
275 | oldset = ¤t->blocked; | ||
276 | 265 | ||
277 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 266 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
278 | if (syscall) { | 267 | if (syscall) { |
@@ -297,15 +286,11 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset, int syscall) | |||
297 | 286 | ||
298 | if (signr == 0) { | 287 | if (signr == 0) { |
299 | /* No signal to deliver -- put the saved sigmask back */ | 288 | /* No signal to deliver -- put the saved sigmask back */ |
300 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | 289 | restore_saved_sigmask(); |
301 | clear_thread_flag(TIF_RESTORE_SIGMASK); | 290 | return; |
302 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
303 | } | ||
304 | return 0; | ||
305 | } | 291 | } |
306 | 292 | ||
307 | handle_signal(signr, &ka, &info, oldset, regs, syscall); | 293 | handle_signal(signr, &ka, &info, regs, syscall); |
308 | return 1; | ||
309 | } | 294 | } |
310 | 295 | ||
311 | asmlinkage void do_notify_resume(struct pt_regs *regs, struct thread_info *ti) | 296 | asmlinkage void do_notify_resume(struct pt_regs *regs, struct thread_info *ti) |
@@ -315,13 +300,11 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, struct thread_info *ti) | |||
315 | if ((sysreg_read(SR) & MODE_MASK) == MODE_SUPERVISOR) | 300 | if ((sysreg_read(SR) & MODE_MASK) == MODE_SUPERVISOR) |
316 | syscall = 1; | 301 | syscall = 1; |
317 | 302 | ||
318 | if (ti->flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) | 303 | if (ti->flags & _TIF_SIGPENDING)) |
319 | do_signal(regs, ¤t->blocked, syscall); | 304 | do_signal(regs, syscall); |
320 | 305 | ||
321 | if (ti->flags & _TIF_NOTIFY_RESUME) { | 306 | if (ti->flags & _TIF_NOTIFY_RESUME) { |
322 | clear_thread_flag(TIF_NOTIFY_RESUME); | 307 | clear_thread_flag(TIF_NOTIFY_RESUME); |
323 | tracehook_notify_resume(regs); | 308 | tracehook_notify_resume(regs); |
324 | if (current->replacement_session_keyring) | ||
325 | key_replace_session_keyring(); | ||
326 | } | 309 | } |
327 | } | 310 | } |
diff --git a/arch/blackfin/include/asm/posix_types.h b/arch/blackfin/include/asm/posix_types.h index 41bc1875c4d7..1bd3436db6a7 100644 --- a/arch/blackfin/include/asm/posix_types.h +++ b/arch/blackfin/include/asm/posix_types.h | |||
@@ -10,9 +10,6 @@ | |||
10 | typedef unsigned short __kernel_mode_t; | 10 | typedef unsigned short __kernel_mode_t; |
11 | #define __kernel_mode_t __kernel_mode_t | 11 | #define __kernel_mode_t __kernel_mode_t |
12 | 12 | ||
13 | typedef unsigned short __kernel_nlink_t; | ||
14 | #define __kernel_nlink_t __kernel_nlink_t | ||
15 | |||
16 | typedef unsigned int __kernel_ipc_pid_t; | 13 | typedef unsigned int __kernel_ipc_pid_t; |
17 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t | 14 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t |
18 | 15 | ||
diff --git a/arch/blackfin/include/asm/thread_info.h b/arch/blackfin/include/asm/thread_info.h index 02560fd8a121..53ad10005ae3 100644 --- a/arch/blackfin/include/asm/thread_info.h +++ b/arch/blackfin/include/asm/thread_info.h | |||
@@ -100,7 +100,6 @@ static inline struct thread_info *current_thread_info(void) | |||
100 | TIF_NEED_RESCHED */ | 100 | TIF_NEED_RESCHED */ |
101 | #define TIF_MEMDIE 4 /* is terminating due to OOM killer */ | 101 | #define TIF_MEMDIE 4 /* is terminating due to OOM killer */ |
102 | #define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ | 102 | #define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ |
103 | #define TIF_FREEZE 6 /* is freezing for suspend */ | ||
104 | #define TIF_IRQ_SYNC 7 /* sync pipeline stage */ | 103 | #define TIF_IRQ_SYNC 7 /* sync pipeline stage */ |
105 | #define TIF_NOTIFY_RESUME 8 /* callback before returning to user */ | 104 | #define TIF_NOTIFY_RESUME 8 /* callback before returning to user */ |
106 | #define TIF_SINGLESTEP 9 | 105 | #define TIF_SINGLESTEP 9 |
@@ -111,7 +110,6 @@ static inline struct thread_info *current_thread_info(void) | |||
111 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 110 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
112 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | 111 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) |
113 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | 112 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) |
114 | #define _TIF_FREEZE (1<<TIF_FREEZE) | ||
115 | #define _TIF_IRQ_SYNC (1<<TIF_IRQ_SYNC) | 113 | #define _TIF_IRQ_SYNC (1<<TIF_IRQ_SYNC) |
116 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 114 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
117 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) | 115 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) |
diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c index e5bbc1a5edc2..6682b73a8523 100644 --- a/arch/blackfin/kernel/signal.c +++ b/arch/blackfin/kernel/signal.c | |||
@@ -19,8 +19,6 @@ | |||
19 | #include <asm/fixed_code.h> | 19 | #include <asm/fixed_code.h> |
20 | #include <asm/syscall.h> | 20 | #include <asm/syscall.h> |
21 | 21 | ||
22 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
23 | |||
24 | /* Location of the trace bit in SYSCFG. */ | 22 | /* Location of the trace bit in SYSCFG. */ |
25 | #define TRACE_BITS 0x0001 | 23 | #define TRACE_BITS 0x0001 |
26 | 24 | ||
@@ -98,7 +96,6 @@ asmlinkage int do_rt_sigreturn(unsigned long __unused) | |||
98 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 96 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
99 | goto badframe; | 97 | goto badframe; |
100 | 98 | ||
101 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
102 | set_current_blocked(&set); | 99 | set_current_blocked(&set); |
103 | 100 | ||
104 | if (rt_restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0)) | 101 | if (rt_restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0)) |
@@ -190,17 +187,22 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t * info, | |||
190 | err |= copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | 187 | err |= copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); |
191 | 188 | ||
192 | if (err) | 189 | if (err) |
193 | goto give_sigsegv; | 190 | return -EFAULT; |
194 | 191 | ||
195 | /* Set up registers for signal handler */ | 192 | /* Set up registers for signal handler */ |
196 | wrusp((unsigned long)frame); | ||
197 | if (current->personality & FDPIC_FUNCPTRS) { | 193 | if (current->personality & FDPIC_FUNCPTRS) { |
198 | struct fdpic_func_descriptor __user *funcptr = | 194 | struct fdpic_func_descriptor __user *funcptr = |
199 | (struct fdpic_func_descriptor *) ka->sa.sa_handler; | 195 | (struct fdpic_func_descriptor *) ka->sa.sa_handler; |
200 | __get_user(regs->pc, &funcptr->text); | 196 | u32 pc, p3; |
201 | __get_user(regs->p3, &funcptr->GOT); | 197 | err |= __get_user(pc, &funcptr->text); |
198 | err |= __get_user(p3, &funcptr->GOT); | ||
199 | if (err) | ||
200 | return -EFAULT; | ||
201 | regs->pc = pc; | ||
202 | regs->p3 = p3; | ||
202 | } else | 203 | } else |
203 | regs->pc = (unsigned long)ka->sa.sa_handler; | 204 | regs->pc = (unsigned long)ka->sa.sa_handler; |
205 | wrusp((unsigned long)frame); | ||
204 | regs->rets = SIGRETURN_STUB; | 206 | regs->rets = SIGRETURN_STUB; |
205 | 207 | ||
206 | regs->r0 = frame->sig; | 208 | regs->r0 = frame->sig; |
@@ -208,10 +210,6 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t * info, | |||
208 | regs->r2 = (unsigned long)(&frame->uc); | 210 | regs->r2 = (unsigned long)(&frame->uc); |
209 | 211 | ||
210 | return 0; | 212 | return 0; |
211 | |||
212 | give_sigsegv: | ||
213 | force_sigsegv(sig, current); | ||
214 | return -EFAULT; | ||
215 | } | 213 | } |
216 | 214 | ||
217 | static inline void | 215 | static inline void |
@@ -247,24 +245,21 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler) | |||
247 | /* | 245 | /* |
248 | * OK, we're invoking a handler | 246 | * OK, we're invoking a handler |
249 | */ | 247 | */ |
250 | static int | 248 | static void |
251 | handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka, | 249 | handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka, |
252 | sigset_t *oldset, struct pt_regs *regs) | 250 | struct pt_regs *regs) |
253 | { | 251 | { |
254 | int ret; | ||
255 | |||
256 | /* are we from a system call? to see pt_regs->orig_p0 */ | 252 | /* are we from a system call? to see pt_regs->orig_p0 */ |
257 | if (regs->orig_p0 >= 0) | 253 | if (regs->orig_p0 >= 0) |
258 | /* If so, check system call restarting.. */ | 254 | /* If so, check system call restarting.. */ |
259 | handle_restart(regs, ka, 1); | 255 | handle_restart(regs, ka, 1); |
260 | 256 | ||
261 | /* set up the stack frame */ | 257 | /* set up the stack frame */ |
262 | ret = setup_rt_frame(sig, ka, info, oldset, regs); | 258 | if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs) < 0) |
263 | 259 | force_sigsegv(sig, current); | |
264 | if (ret == 0) | 260 | else |
265 | block_sigmask(ka, sig); | 261 | signal_delivered(sig, info, ka, regs, |
266 | 262 | test_thread_flag(TIF_SINGLESTEP)); | |
267 | return ret; | ||
268 | } | 263 | } |
269 | 264 | ||
270 | /* | 265 | /* |
@@ -281,37 +276,16 @@ asmlinkage void do_signal(struct pt_regs *regs) | |||
281 | siginfo_t info; | 276 | siginfo_t info; |
282 | int signr; | 277 | int signr; |
283 | struct k_sigaction ka; | 278 | struct k_sigaction ka; |
284 | sigset_t *oldset; | ||
285 | 279 | ||
286 | current->thread.esp0 = (unsigned long)regs; | 280 | current->thread.esp0 = (unsigned long)regs; |
287 | 281 | ||
288 | if (try_to_freeze()) | ||
289 | goto no_signal; | ||
290 | |||
291 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
292 | oldset = ¤t->saved_sigmask; | ||
293 | else | ||
294 | oldset = ¤t->blocked; | ||
295 | |||
296 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 282 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
297 | if (signr > 0) { | 283 | if (signr > 0) { |
298 | /* Whee! Actually deliver the signal. */ | 284 | /* Whee! Actually deliver the signal. */ |
299 | if (handle_signal(signr, &info, &ka, oldset, regs) == 0) { | 285 | handle_signal(signr, &info, &ka, regs); |
300 | /* a signal was successfully delivered; the saved | ||
301 | * sigmask will have been stored in the signal frame, | ||
302 | * and will be restored by sigreturn, so we can simply | ||
303 | * clear the TIF_RESTORE_SIGMASK flag */ | ||
304 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
305 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
306 | |||
307 | tracehook_signal_handler(signr, &info, &ka, regs, | ||
308 | test_thread_flag(TIF_SINGLESTEP)); | ||
309 | } | ||
310 | |||
311 | return; | 286 | return; |
312 | } | 287 | } |
313 | 288 | ||
314 | no_signal: | ||
315 | /* Did we come from a system call? */ | 289 | /* Did we come from a system call? */ |
316 | if (regs->orig_p0 >= 0) | 290 | if (regs->orig_p0 >= 0) |
317 | /* Restart the system call - no handlers present */ | 291 | /* Restart the system call - no handlers present */ |
@@ -319,10 +293,7 @@ asmlinkage void do_signal(struct pt_regs *regs) | |||
319 | 293 | ||
320 | /* if there's no signal to deliver, we just put the saved sigmask | 294 | /* if there's no signal to deliver, we just put the saved sigmask |
321 | * back */ | 295 | * back */ |
322 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | 296 | restore_saved_sigmask(); |
323 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
324 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
325 | } | ||
326 | } | 297 | } |
327 | 298 | ||
328 | /* | 299 | /* |
@@ -330,14 +301,12 @@ asmlinkage void do_signal(struct pt_regs *regs) | |||
330 | */ | 301 | */ |
331 | asmlinkage void do_notify_resume(struct pt_regs *regs) | 302 | asmlinkage void do_notify_resume(struct pt_regs *regs) |
332 | { | 303 | { |
333 | if (test_thread_flag(TIF_SIGPENDING) || test_thread_flag(TIF_RESTORE_SIGMASK)) | 304 | if (test_thread_flag(TIF_SIGPENDING)) |
334 | do_signal(regs); | 305 | do_signal(regs); |
335 | 306 | ||
336 | if (test_thread_flag(TIF_NOTIFY_RESUME)) { | 307 | if (test_thread_flag(TIF_NOTIFY_RESUME)) { |
337 | clear_thread_flag(TIF_NOTIFY_RESUME); | 308 | clear_thread_flag(TIF_NOTIFY_RESUME); |
338 | tracehook_notify_resume(regs); | 309 | tracehook_notify_resume(regs); |
339 | if (current->replacement_session_keyring) | ||
340 | key_replace_session_keyring(); | ||
341 | } | 310 | } |
342 | } | 311 | } |
343 | 312 | ||
diff --git a/arch/blackfin/kernel/trace.c b/arch/blackfin/kernel/trace.c index 44bbf2f564cb..f7f7a18abca9 100644 --- a/arch/blackfin/kernel/trace.c +++ b/arch/blackfin/kernel/trace.c | |||
@@ -10,6 +10,8 @@ | |||
10 | #include <linux/hardirq.h> | 10 | #include <linux/hardirq.h> |
11 | #include <linux/thread_info.h> | 11 | #include <linux/thread_info.h> |
12 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
13 | #include <linux/oom.h> | ||
14 | #include <linux/sched.h> | ||
13 | #include <linux/uaccess.h> | 15 | #include <linux/uaccess.h> |
14 | #include <linux/module.h> | 16 | #include <linux/module.h> |
15 | #include <linux/kallsyms.h> | 17 | #include <linux/kallsyms.h> |
@@ -27,8 +29,7 @@ void decode_address(char *buf, unsigned long address) | |||
27 | { | 29 | { |
28 | struct task_struct *p; | 30 | struct task_struct *p; |
29 | struct mm_struct *mm; | 31 | struct mm_struct *mm; |
30 | unsigned long flags, offset; | 32 | unsigned long offset; |
31 | unsigned char in_atomic = (bfin_read_IPEND() & 0x10) || in_atomic(); | ||
32 | struct rb_node *n; | 33 | struct rb_node *n; |
33 | 34 | ||
34 | #ifdef CONFIG_KALLSYMS | 35 | #ifdef CONFIG_KALLSYMS |
@@ -112,17 +113,17 @@ void decode_address(char *buf, unsigned long address) | |||
112 | * mappings of all our processes and see if we can't be a whee | 113 | * mappings of all our processes and see if we can't be a whee |
113 | * bit more specific | 114 | * bit more specific |
114 | */ | 115 | */ |
115 | write_lock_irqsave(&tasklist_lock, flags); | 116 | read_lock(&tasklist_lock); |
116 | for_each_process(p) { | 117 | for_each_process(p) { |
117 | mm = (in_atomic ? p->mm : get_task_mm(p)); | 118 | struct task_struct *t; |
118 | if (!mm) | ||
119 | continue; | ||
120 | 119 | ||
121 | if (!down_read_trylock(&mm->mmap_sem)) { | 120 | t = find_lock_task_mm(p); |
122 | if (!in_atomic) | 121 | if (!t) |
123 | mmput(mm); | ||
124 | continue; | 122 | continue; |
125 | } | 123 | |
124 | mm = t->mm; | ||
125 | if (!down_read_trylock(&mm->mmap_sem)) | ||
126 | goto __continue; | ||
126 | 127 | ||
127 | for (n = rb_first(&mm->mm_rb); n; n = rb_next(n)) { | 128 | for (n = rb_first(&mm->mm_rb); n; n = rb_next(n)) { |
128 | struct vm_area_struct *vma; | 129 | struct vm_area_struct *vma; |
@@ -131,7 +132,7 @@ void decode_address(char *buf, unsigned long address) | |||
131 | 132 | ||
132 | if (address >= vma->vm_start && address < vma->vm_end) { | 133 | if (address >= vma->vm_start && address < vma->vm_end) { |
133 | char _tmpbuf[256]; | 134 | char _tmpbuf[256]; |
134 | char *name = p->comm; | 135 | char *name = t->comm; |
135 | struct file *file = vma->vm_file; | 136 | struct file *file = vma->vm_file; |
136 | 137 | ||
137 | if (file) { | 138 | if (file) { |
@@ -164,8 +165,7 @@ void decode_address(char *buf, unsigned long address) | |||
164 | name, vma->vm_start, vma->vm_end); | 165 | name, vma->vm_start, vma->vm_end); |
165 | 166 | ||
166 | up_read(&mm->mmap_sem); | 167 | up_read(&mm->mmap_sem); |
167 | if (!in_atomic) | 168 | task_unlock(t); |
168 | mmput(mm); | ||
169 | 169 | ||
170 | if (buf[0] == '\0') | 170 | if (buf[0] == '\0') |
171 | sprintf(buf, "[ %s ] dynamic memory", name); | 171 | sprintf(buf, "[ %s ] dynamic memory", name); |
@@ -175,8 +175,8 @@ void decode_address(char *buf, unsigned long address) | |||
175 | } | 175 | } |
176 | 176 | ||
177 | up_read(&mm->mmap_sem); | 177 | up_read(&mm->mmap_sem); |
178 | if (!in_atomic) | 178 | __continue: |
179 | mmput(mm); | 179 | task_unlock(t); |
180 | } | 180 | } |
181 | 181 | ||
182 | /* | 182 | /* |
@@ -186,7 +186,7 @@ void decode_address(char *buf, unsigned long address) | |||
186 | sprintf(buf, "/* kernel dynamic memory */"); | 186 | sprintf(buf, "/* kernel dynamic memory */"); |
187 | 187 | ||
188 | done: | 188 | done: |
189 | write_unlock_irqrestore(&tasklist_lock, flags); | 189 | read_unlock(&tasklist_lock); |
190 | } | 190 | } |
191 | 191 | ||
192 | #define EXPAND_LEN ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN) * 256 - 1) | 192 | #define EXPAND_LEN ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN) * 256 - 1) |
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S index 80aa2535e2c9..04c2fbe41a7f 100644 --- a/arch/blackfin/mach-common/entry.S +++ b/arch/blackfin/mach-common/entry.S | |||
@@ -711,8 +711,6 @@ ENTRY(_system_call) | |||
711 | jump .Lresume_userspace_1; | 711 | jump .Lresume_userspace_1; |
712 | 712 | ||
713 | .Lsyscall_sigpending: | 713 | .Lsyscall_sigpending: |
714 | cc = BITTST(r7, TIF_RESTORE_SIGMASK); | ||
715 | if cc jump .Lsyscall_do_signals; | ||
716 | cc = BITTST(r7, TIF_SIGPENDING); | 714 | cc = BITTST(r7, TIF_SIGPENDING); |
717 | if cc jump .Lsyscall_do_signals; | 715 | if cc jump .Lsyscall_do_signals; |
718 | cc = BITTST(r7, TIF_NOTIFY_RESUME); | 716 | cc = BITTST(r7, TIF_NOTIFY_RESUME); |
diff --git a/arch/c6x/kernel/signal.c b/arch/c6x/kernel/signal.c index cf37478c1169..3d8f3c22a94f 100644 --- a/arch/c6x/kernel/signal.c +++ b/arch/c6x/kernel/signal.c | |||
@@ -20,8 +20,6 @@ | |||
20 | #include <asm/cacheflush.h> | 20 | #include <asm/cacheflush.h> |
21 | 21 | ||
22 | 22 | ||
23 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
24 | |||
25 | /* | 23 | /* |
26 | * Do a signal return, undo the signal stack. | 24 | * Do a signal return, undo the signal stack. |
27 | */ | 25 | */ |
@@ -87,7 +85,6 @@ asmlinkage int do_rt_sigreturn(struct pt_regs *regs) | |||
87 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 85 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
88 | goto badframe; | 86 | goto badframe; |
89 | 87 | ||
90 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
91 | set_current_blocked(&set); | 88 | set_current_blocked(&set); |
92 | 89 | ||
93 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) | 90 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) |
@@ -248,10 +245,9 @@ do_restart: | |||
248 | /* | 245 | /* |
249 | * handle the actual delivery of a signal to userspace | 246 | * handle the actual delivery of a signal to userspace |
250 | */ | 247 | */ |
251 | static int handle_signal(int sig, | 248 | static void handle_signal(int sig, |
252 | siginfo_t *info, struct k_sigaction *ka, | 249 | siginfo_t *info, struct k_sigaction *ka, |
253 | sigset_t *oldset, struct pt_regs *regs, | 250 | struct pt_regs *regs, int syscall) |
254 | int syscall) | ||
255 | { | 251 | { |
256 | int ret; | 252 | int ret; |
257 | 253 | ||
@@ -278,11 +274,9 @@ static int handle_signal(int sig, | |||
278 | } | 274 | } |
279 | 275 | ||
280 | /* Set up the stack frame */ | 276 | /* Set up the stack frame */ |
281 | ret = setup_rt_frame(sig, ka, info, oldset, regs); | 277 | if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs) < 0) |
282 | if (ret == 0) | 278 | return; |
283 | block_sigmask(ka, sig); | 279 | signal_delivered(sig, info, ka, regs, 0); |
284 | |||
285 | return ret; | ||
286 | } | 280 | } |
287 | 281 | ||
288 | /* | 282 | /* |
@@ -292,7 +286,6 @@ static void do_signal(struct pt_regs *regs, int syscall) | |||
292 | { | 286 | { |
293 | struct k_sigaction ka; | 287 | struct k_sigaction ka; |
294 | siginfo_t info; | 288 | siginfo_t info; |
295 | sigset_t *oldset; | ||
296 | int signr; | 289 | int signr; |
297 | 290 | ||
298 | /* we want the common case to go fast, which is why we may in certain | 291 | /* we want the common case to go fast, which is why we may in certain |
@@ -300,25 +293,9 @@ static void do_signal(struct pt_regs *regs, int syscall) | |||
300 | if (!user_mode(regs)) | 293 | if (!user_mode(regs)) |
301 | return; | 294 | return; |
302 | 295 | ||
303 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
304 | oldset = ¤t->saved_sigmask; | ||
305 | else | ||
306 | oldset = ¤t->blocked; | ||
307 | |||
308 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 296 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
309 | if (signr > 0) { | 297 | if (signr > 0) { |
310 | if (handle_signal(signr, &info, &ka, oldset, | 298 | handle_signal(signr, &info, &ka, regs, syscall); |
311 | regs, syscall) == 0) { | ||
312 | /* a signal was successfully delivered; the saved | ||
313 | * sigmask will have been stored in the signal frame, | ||
314 | * and will be restored by sigreturn, so we can simply | ||
315 | * clear the TIF_RESTORE_SIGMASK flag */ | ||
316 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
317 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
318 | |||
319 | tracehook_signal_handler(signr, &info, &ka, regs, 0); | ||
320 | } | ||
321 | |||
322 | return; | 299 | return; |
323 | } | 300 | } |
324 | 301 | ||
@@ -343,10 +320,7 @@ static void do_signal(struct pt_regs *regs, int syscall) | |||
343 | 320 | ||
344 | /* if there's no signal to deliver, we just put the saved sigmask | 321 | /* if there's no signal to deliver, we just put the saved sigmask |
345 | * back */ | 322 | * back */ |
346 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | 323 | restore_saved_sigmask(); |
347 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
348 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
349 | } | ||
350 | } | 324 | } |
351 | 325 | ||
352 | /* | 326 | /* |
@@ -357,14 +331,11 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, u32 thread_info_flags, | |||
357 | int syscall) | 331 | int syscall) |
358 | { | 332 | { |
359 | /* deal with pending signal delivery */ | 333 | /* deal with pending signal delivery */ |
360 | if (thread_info_flags & ((1 << TIF_SIGPENDING) | | 334 | if (thread_info_flags & (1 << TIF_SIGPENDING)) |
361 | (1 << TIF_RESTORE_SIGMASK))) | ||
362 | do_signal(regs, syscall); | 335 | do_signal(regs, syscall); |
363 | 336 | ||
364 | if (thread_info_flags & (1 << TIF_NOTIFY_RESUME)) { | 337 | if (thread_info_flags & (1 << TIF_NOTIFY_RESUME)) { |
365 | clear_thread_flag(TIF_NOTIFY_RESUME); | 338 | clear_thread_flag(TIF_NOTIFY_RESUME); |
366 | tracehook_notify_resume(regs); | 339 | tracehook_notify_resume(regs); |
367 | if (current->replacement_session_keyring) | ||
368 | key_replace_session_keyring(); | ||
369 | } | 340 | } |
370 | } | 341 | } |
diff --git a/arch/cris/arch-v10/kernel/signal.c b/arch/cris/arch-v10/kernel/signal.c index e16f8f297f61..0bb477c13a4e 100644 --- a/arch/cris/arch-v10/kernel/signal.c +++ b/arch/cris/arch-v10/kernel/signal.c | |||
@@ -31,8 +31,6 @@ | |||
31 | 31 | ||
32 | #define DEBUG_SIG 0 | 32 | #define DEBUG_SIG 0 |
33 | 33 | ||
34 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
35 | |||
36 | /* a syscall in Linux/CRIS is a break 13 instruction which is 2 bytes */ | 34 | /* a syscall in Linux/CRIS is a break 13 instruction which is 2 bytes */ |
37 | /* manipulate regs so that upon return, it will be re-executed */ | 35 | /* manipulate regs so that upon return, it will be re-executed */ |
38 | 36 | ||
@@ -176,7 +174,6 @@ asmlinkage int sys_sigreturn(long r10, long r11, long r12, long r13, long mof, | |||
176 | sizeof(frame->extramask)))) | 174 | sizeof(frame->extramask)))) |
177 | goto badframe; | 175 | goto badframe; |
178 | 176 | ||
179 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
180 | set_current_blocked(&set); | 177 | set_current_blocked(&set); |
181 | 178 | ||
182 | if (restore_sigcontext(regs, &frame->sc)) | 179 | if (restore_sigcontext(regs, &frame->sc)) |
@@ -212,7 +209,6 @@ asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13, | |||
212 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 209 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
213 | goto badframe; | 210 | goto badframe; |
214 | 211 | ||
215 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
216 | set_current_blocked(&set); | 212 | set_current_blocked(&set); |
217 | 213 | ||
218 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) | 214 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) |
@@ -415,10 +411,11 @@ give_sigsegv: | |||
415 | * OK, we're invoking a handler | 411 | * OK, we're invoking a handler |
416 | */ | 412 | */ |
417 | 413 | ||
418 | static inline int handle_signal(int canrestart, unsigned long sig, | 414 | static inline void handle_signal(int canrestart, unsigned long sig, |
419 | siginfo_t *info, struct k_sigaction *ka, | 415 | siginfo_t *info, struct k_sigaction *ka, |
420 | sigset_t *oldset, struct pt_regs *regs) | 416 | struct pt_regs *regs) |
421 | { | 417 | { |
418 | sigset_t *oldset = sigmask_to_save(); | ||
422 | int ret; | 419 | int ret; |
423 | 420 | ||
424 | /* Are we from a system call? */ | 421 | /* Are we from a system call? */ |
@@ -456,9 +453,7 @@ static inline int handle_signal(int canrestart, unsigned long sig, | |||
456 | ret = setup_frame(sig, ka, oldset, regs); | 453 | ret = setup_frame(sig, ka, oldset, regs); |
457 | 454 | ||
458 | if (ret == 0) | 455 | if (ret == 0) |
459 | block_sigmask(ka, sig); | 456 | signal_delivered(sig, info, ka, regs, 0); |
460 | |||
461 | return ret; | ||
462 | } | 457 | } |
463 | 458 | ||
464 | /* | 459 | /* |
@@ -478,7 +473,6 @@ void do_signal(int canrestart, struct pt_regs *regs) | |||
478 | siginfo_t info; | 473 | siginfo_t info; |
479 | int signr; | 474 | int signr; |
480 | struct k_sigaction ka; | 475 | struct k_sigaction ka; |
481 | sigset_t *oldset; | ||
482 | 476 | ||
483 | /* | 477 | /* |
484 | * We want the common case to go fast, which | 478 | * We want the common case to go fast, which |
@@ -489,23 +483,10 @@ void do_signal(int canrestart, struct pt_regs *regs) | |||
489 | if (!user_mode(regs)) | 483 | if (!user_mode(regs)) |
490 | return; | 484 | return; |
491 | 485 | ||
492 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
493 | oldset = ¤t->saved_sigmask; | ||
494 | else | ||
495 | oldset = ¤t->blocked; | ||
496 | |||
497 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 486 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
498 | if (signr > 0) { | 487 | if (signr > 0) { |
499 | /* Whee! Actually deliver the signal. */ | 488 | /* Whee! Actually deliver the signal. */ |
500 | if (handle_signal(canrestart, signr, &info, &ka, | 489 | handle_signal(canrestart, signr, &info, &ka, regs); |
501 | oldset, regs)) { | ||
502 | /* a signal was successfully delivered; the saved | ||
503 | * sigmask will have been stored in the signal frame, | ||
504 | * and will be restored by sigreturn, so we can simply | ||
505 | * clear the TIF_RESTORE_SIGMASK flag */ | ||
506 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
507 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
508 | } | ||
509 | return; | 490 | return; |
510 | } | 491 | } |
511 | 492 | ||
@@ -525,8 +506,5 @@ void do_signal(int canrestart, struct pt_regs *regs) | |||
525 | 506 | ||
526 | /* if there's no signal to deliver, we just put the saved sigmask | 507 | /* if there's no signal to deliver, we just put the saved sigmask |
527 | * back */ | 508 | * back */ |
528 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | 509 | restore_saved_sigmask(); |
529 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
530 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
531 | } | ||
532 | } | 510 | } |
diff --git a/arch/cris/arch-v32/kernel/signal.c b/arch/cris/arch-v32/kernel/signal.c index b338d8fc0c12..b60d1b65a426 100644 --- a/arch/cris/arch-v32/kernel/signal.c +++ b/arch/cris/arch-v32/kernel/signal.c | |||
@@ -24,9 +24,6 @@ | |||
24 | 24 | ||
25 | extern unsigned long cris_signal_return_page; | 25 | extern unsigned long cris_signal_return_page; |
26 | 26 | ||
27 | /* Flag to check if a signal is blockable. */ | ||
28 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
29 | |||
30 | /* | 27 | /* |
31 | * A syscall in CRIS is really a "break 13" instruction, which is 2 | 28 | * A syscall in CRIS is really a "break 13" instruction, which is 2 |
32 | * bytes. The registers is manipulated so upon return the instruction | 29 | * bytes. The registers is manipulated so upon return the instruction |
@@ -167,7 +164,6 @@ sys_sigreturn(long r10, long r11, long r12, long r13, long mof, long srp, | |||
167 | sizeof(frame->extramask)))) | 164 | sizeof(frame->extramask)))) |
168 | goto badframe; | 165 | goto badframe; |
169 | 166 | ||
170 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
171 | set_current_blocked(&set); | 167 | set_current_blocked(&set); |
172 | 168 | ||
173 | if (restore_sigcontext(regs, &frame->sc)) | 169 | if (restore_sigcontext(regs, &frame->sc)) |
@@ -208,7 +204,6 @@ sys_rt_sigreturn(long r10, long r11, long r12, long r13, long mof, long srp, | |||
208 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 204 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
209 | goto badframe; | 205 | goto badframe; |
210 | 206 | ||
211 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
212 | set_current_blocked(&set); | 207 | set_current_blocked(&set); |
213 | 208 | ||
214 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) | 209 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) |
@@ -434,11 +429,12 @@ give_sigsegv: | |||
434 | } | 429 | } |
435 | 430 | ||
436 | /* Invoke a signal handler to, well, handle the signal. */ | 431 | /* Invoke a signal handler to, well, handle the signal. */ |
437 | static inline int | 432 | static inline void |
438 | handle_signal(int canrestart, unsigned long sig, | 433 | handle_signal(int canrestart, unsigned long sig, |
439 | siginfo_t *info, struct k_sigaction *ka, | 434 | siginfo_t *info, struct k_sigaction *ka, |
440 | sigset_t *oldset, struct pt_regs * regs) | 435 | struct pt_regs * regs) |
441 | { | 436 | { |
437 | sigset_t *oldset = sigmask_to_save(); | ||
442 | int ret; | 438 | int ret; |
443 | 439 | ||
444 | /* Check if this got called from a system call. */ | 440 | /* Check if this got called from a system call. */ |
@@ -489,9 +485,7 @@ handle_signal(int canrestart, unsigned long sig, | |||
489 | ret = setup_frame(sig, ka, oldset, regs); | 485 | ret = setup_frame(sig, ka, oldset, regs); |
490 | 486 | ||
491 | if (ret == 0) | 487 | if (ret == 0) |
492 | block_sigmask(ka, sig); | 488 | signal_delivered(sig, info, ka, regs, 0); |
493 | |||
494 | return ret; | ||
495 | } | 489 | } |
496 | 490 | ||
497 | /* | 491 | /* |
@@ -511,7 +505,6 @@ do_signal(int canrestart, struct pt_regs *regs) | |||
511 | int signr; | 505 | int signr; |
512 | siginfo_t info; | 506 | siginfo_t info; |
513 | struct k_sigaction ka; | 507 | struct k_sigaction ka; |
514 | sigset_t *oldset; | ||
515 | 508 | ||
516 | /* | 509 | /* |
517 | * The common case should go fast, which is why this point is | 510 | * The common case should go fast, which is why this point is |
@@ -521,25 +514,11 @@ do_signal(int canrestart, struct pt_regs *regs) | |||
521 | if (!user_mode(regs)) | 514 | if (!user_mode(regs)) |
522 | return; | 515 | return; |
523 | 516 | ||
524 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
525 | oldset = ¤t->saved_sigmask; | ||
526 | else | ||
527 | oldset = ¤t->blocked; | ||
528 | |||
529 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 517 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
530 | 518 | ||
531 | if (signr > 0) { | 519 | if (signr > 0) { |
532 | /* Whee! Actually deliver the signal. */ | 520 | /* Whee! Actually deliver the signal. */ |
533 | if (handle_signal(canrestart, signr, &info, &ka, | 521 | handle_signal(canrestart, signr, &info, &ka, regs); |
534 | oldset, regs)) { | ||
535 | /* a signal was successfully delivered; the saved | ||
536 | * sigmask will have been stored in the signal frame, | ||
537 | * and will be restored by sigreturn, so we can simply | ||
538 | * clear the TIF_RESTORE_SIGMASK flag */ | ||
539 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
540 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
541 | } | ||
542 | |||
543 | return; | 522 | return; |
544 | } | 523 | } |
545 | 524 | ||
@@ -560,10 +539,7 @@ do_signal(int canrestart, struct pt_regs *regs) | |||
560 | 539 | ||
561 | /* if there's no signal to deliver, we just put the saved sigmask | 540 | /* if there's no signal to deliver, we just put the saved sigmask |
562 | * back */ | 541 | * back */ |
563 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | 542 | restore_saved_sigmask(); |
564 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
565 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
566 | } | ||
567 | } | 543 | } |
568 | 544 | ||
569 | asmlinkage void | 545 | asmlinkage void |
diff --git a/arch/cris/include/asm/posix_types.h b/arch/cris/include/asm/posix_types.h index 234891c74e2b..ce4e51793151 100644 --- a/arch/cris/include/asm/posix_types.h +++ b/arch/cris/include/asm/posix_types.h | |||
@@ -15,9 +15,6 @@ | |||
15 | typedef unsigned short __kernel_mode_t; | 15 | typedef unsigned short __kernel_mode_t; |
16 | #define __kernel_mode_t __kernel_mode_t | 16 | #define __kernel_mode_t __kernel_mode_t |
17 | 17 | ||
18 | typedef unsigned short __kernel_nlink_t; | ||
19 | #define __kernel_nlink_t __kernel_nlink_t | ||
20 | |||
21 | typedef unsigned short __kernel_ipc_pid_t; | 18 | typedef unsigned short __kernel_ipc_pid_t; |
22 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t | 19 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t |
23 | 20 | ||
diff --git a/arch/cris/kernel/ptrace.c b/arch/cris/kernel/ptrace.c index d114ad3da9b1..58d44ee1a71f 100644 --- a/arch/cris/kernel/ptrace.c +++ b/arch/cris/kernel/ptrace.c | |||
@@ -40,7 +40,5 @@ void do_notify_resume(int canrestart, struct pt_regs *regs, | |||
40 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | 40 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { |
41 | clear_thread_flag(TIF_NOTIFY_RESUME); | 41 | clear_thread_flag(TIF_NOTIFY_RESUME); |
42 | tracehook_notify_resume(regs); | 42 | tracehook_notify_resume(regs); |
43 | if (current->replacement_session_keyring) | ||
44 | key_replace_session_keyring(); | ||
45 | } | 43 | } |
46 | } | 44 | } |
diff --git a/arch/frv/include/asm/posix_types.h b/arch/frv/include/asm/posix_types.h index 3f34cb45fbb3..fe512af74a5a 100644 --- a/arch/frv/include/asm/posix_types.h +++ b/arch/frv/include/asm/posix_types.h | |||
@@ -10,9 +10,6 @@ | |||
10 | typedef unsigned short __kernel_mode_t; | 10 | typedef unsigned short __kernel_mode_t; |
11 | #define __kernel_mode_t __kernel_mode_t | 11 | #define __kernel_mode_t __kernel_mode_t |
12 | 12 | ||
13 | typedef unsigned short __kernel_nlink_t; | ||
14 | #define __kernel_nlink_t __kernel_nlink_t | ||
15 | |||
16 | typedef unsigned short __kernel_ipc_pid_t; | 13 | typedef unsigned short __kernel_ipc_pid_t; |
17 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t | 14 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t |
18 | 15 | ||
diff --git a/arch/frv/include/asm/thread_info.h b/arch/frv/include/asm/thread_info.h index 54ab13a0de41..0ff03a33c81e 100644 --- a/arch/frv/include/asm/thread_info.h +++ b/arch/frv/include/asm/thread_info.h | |||
@@ -94,8 +94,8 @@ register struct thread_info *__current_thread_info asm("gr15"); | |||
94 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | 94 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ |
95 | #define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ | 95 | #define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ |
96 | #define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ | 96 | #define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ |
97 | #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ | 97 | #define TIF_POLLING_NRFLAG 6 /* true if poll_idle() is polling TIF_NEED_RESCHED */ |
98 | #define TIF_MEMDIE 17 /* is terminating due to OOM killer */ | 98 | #define TIF_MEMDIE 7 /* is terminating due to OOM killer */ |
99 | 99 | ||
100 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | 100 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) |
101 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) | 101 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) |
@@ -105,8 +105,16 @@ register struct thread_info *__current_thread_info asm("gr15"); | |||
105 | #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) | 105 | #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) |
106 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) | 106 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) |
107 | 107 | ||
108 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ | 108 | /* work to do on interrupt/exception return */ |
109 | #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ | 109 | #define _TIF_WORK_MASK \ |
110 | (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_SINGLESTEP) | ||
111 | |||
112 | /* work to do on any return to u-space */ | ||
113 | #define _TIF_ALLWORK_MASK (_TIF_WORK_MASK | _TIF_SYSCALL_TRACE) | ||
114 | |||
115 | #if _TIF_ALLWORK_MASK >= 0x2000 | ||
116 | #error "_TIF_ALLWORK_MASK won't fit in an ANDI now (see entry.S)" | ||
117 | #endif | ||
110 | 118 | ||
111 | /* | 119 | /* |
112 | * Thread-synchronous status. | 120 | * Thread-synchronous status. |
diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S index 5ba23f715ea5..7d5e000fd32e 100644 --- a/arch/frv/kernel/entry.S +++ b/arch/frv/kernel/entry.S | |||
@@ -905,18 +905,19 @@ __syscall_call: | |||
905 | __syscall_exit: | 905 | __syscall_exit: |
906 | LEDS 0x6300 | 906 | LEDS 0x6300 |
907 | 907 | ||
908 | sti gr8,@(gr28,#REG_GR(8)) ; save return value | 908 | # keep current PSR in GR23 |
909 | movsg psr,gr23 | ||
909 | 910 | ||
910 | # rebuild saved psr - execve will change it for init/main.c | ||
911 | ldi @(gr28,#REG_PSR),gr22 | 911 | ldi @(gr28,#REG_PSR),gr22 |
912 | |||
913 | sti.p gr8,@(gr28,#REG_GR(8)) ; save return value | ||
914 | |||
915 | # rebuild saved psr - execve will change it for init/main.c | ||
912 | srli gr22,#1,gr5 | 916 | srli gr22,#1,gr5 |
913 | andi.p gr22,#~PSR_PS,gr22 | 917 | andi.p gr22,#~PSR_PS,gr22 |
914 | andi gr5,#PSR_PS,gr5 | 918 | andi gr5,#PSR_PS,gr5 |
915 | or gr5,gr22,gr22 | 919 | or gr5,gr22,gr22 |
916 | ori gr22,#PSR_S,gr22 | 920 | ori.p gr22,#PSR_S,gr22 |
917 | |||
918 | # keep current PSR in GR23 | ||
919 | movsg psr,gr23 | ||
920 | 921 | ||
921 | # make sure we don't miss an interrupt setting need_resched or sigpending between | 922 | # make sure we don't miss an interrupt setting need_resched or sigpending between |
922 | # sampling and the RETT | 923 | # sampling and the RETT |
@@ -924,9 +925,7 @@ __syscall_exit: | |||
924 | movgs gr23,psr | 925 | movgs gr23,psr |
925 | 926 | ||
926 | ldi @(gr15,#TI_FLAGS),gr4 | 927 | ldi @(gr15,#TI_FLAGS),gr4 |
927 | sethi.p %hi(_TIF_ALLWORK_MASK),gr5 | 928 | andicc gr4,#_TIF_ALLWORK_MASK,gr0,icc0 |
928 | setlo %lo(_TIF_ALLWORK_MASK),gr5 | ||
929 | andcc gr4,gr5,gr0,icc0 | ||
930 | bne icc0,#0,__syscall_exit_work | 929 | bne icc0,#0,__syscall_exit_work |
931 | 930 | ||
932 | # restore all registers and return | 931 | # restore all registers and return |
@@ -1111,9 +1110,7 @@ __entry_resume_userspace: | |||
1111 | __entry_return_from_user_interrupt: | 1110 | __entry_return_from_user_interrupt: |
1112 | LEDS 0x6402 | 1111 | LEDS 0x6402 |
1113 | ldi @(gr15,#TI_FLAGS),gr4 | 1112 | ldi @(gr15,#TI_FLAGS),gr4 |
1114 | sethi.p %hi(_TIF_WORK_MASK),gr5 | 1113 | andicc gr4,#_TIF_WORK_MASK,gr0,icc0 |
1115 | setlo %lo(_TIF_WORK_MASK),gr5 | ||
1116 | andcc gr4,gr5,gr0,icc0 | ||
1117 | beq icc0,#1,__entry_return_direct | 1114 | beq icc0,#1,__entry_return_direct |
1118 | 1115 | ||
1119 | __entry_work_pending: | 1116 | __entry_work_pending: |
@@ -1133,9 +1130,7 @@ __entry_work_resched: | |||
1133 | 1130 | ||
1134 | LEDS 0x6401 | 1131 | LEDS 0x6401 |
1135 | ldi @(gr15,#TI_FLAGS),gr4 | 1132 | ldi @(gr15,#TI_FLAGS),gr4 |
1136 | sethi.p %hi(_TIF_WORK_MASK),gr5 | 1133 | andicc gr4,#_TIF_WORK_MASK,gr0,icc0 |
1137 | setlo %lo(_TIF_WORK_MASK),gr5 | ||
1138 | andcc gr4,gr5,gr0,icc0 | ||
1139 | beq icc0,#1,__entry_return_direct | 1134 | beq icc0,#1,__entry_return_direct |
1140 | andicc gr4,#_TIF_NEED_RESCHED,gr0,icc0 | 1135 | andicc gr4,#_TIF_NEED_RESCHED,gr0,icc0 |
1141 | bne icc0,#1,__entry_work_resched | 1136 | bne icc0,#1,__entry_work_resched |
@@ -1163,7 +1158,9 @@ __syscall_trace_entry: | |||
1163 | # perform syscall exit tracing | 1158 | # perform syscall exit tracing |
1164 | __syscall_exit_work: | 1159 | __syscall_exit_work: |
1165 | LEDS 0x6340 | 1160 | LEDS 0x6340 |
1166 | andicc gr4,#_TIF_SYSCALL_TRACE,gr0,icc0 | 1161 | andicc gr22,#PSR_PS,gr0,icc1 ; don't handle on return to kernel mode |
1162 | andicc.p gr4,#_TIF_SYSCALL_TRACE,gr0,icc0 | ||
1163 | bne icc1,#0,__entry_return_direct | ||
1167 | beq icc0,#1,__entry_work_pending | 1164 | beq icc0,#1,__entry_work_pending |
1168 | 1165 | ||
1169 | movsg psr,gr23 | 1166 | movsg psr,gr23 |
diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c index 8cf5dca01758..f3b9064c548c 100644 --- a/arch/frv/kernel/signal.c +++ b/arch/frv/kernel/signal.c | |||
@@ -28,8 +28,6 @@ | |||
28 | 28 | ||
29 | #define DEBUG_SIG 0 | 29 | #define DEBUG_SIG 0 |
30 | 30 | ||
31 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
32 | |||
33 | struct fdpic_func_descriptor { | 31 | struct fdpic_func_descriptor { |
34 | unsigned long text; | 32 | unsigned long text; |
35 | unsigned long GOT; | 33 | unsigned long GOT; |
@@ -149,7 +147,6 @@ asmlinkage int sys_sigreturn(void) | |||
149 | __copy_from_user(&set.sig[1], &frame->extramask, sizeof(frame->extramask))) | 147 | __copy_from_user(&set.sig[1], &frame->extramask, sizeof(frame->extramask))) |
150 | goto badframe; | 148 | goto badframe; |
151 | 149 | ||
152 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
153 | set_current_blocked(&set); | 150 | set_current_blocked(&set); |
154 | 151 | ||
155 | if (restore_sigcontext(&frame->sc, &gr8)) | 152 | if (restore_sigcontext(&frame->sc, &gr8)) |
@@ -172,7 +169,6 @@ asmlinkage int sys_rt_sigreturn(void) | |||
172 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 169 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
173 | goto badframe; | 170 | goto badframe; |
174 | 171 | ||
175 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
176 | set_current_blocked(&set); | 172 | set_current_blocked(&set); |
177 | 173 | ||
178 | if (restore_sigcontext(&frame->uc.uc_mcontext, &gr8)) | 174 | if (restore_sigcontext(&frame->uc.uc_mcontext, &gr8)) |
@@ -426,9 +422,10 @@ give_sigsegv: | |||
426 | /* | 422 | /* |
427 | * OK, we're invoking a handler | 423 | * OK, we're invoking a handler |
428 | */ | 424 | */ |
429 | static int handle_signal(unsigned long sig, siginfo_t *info, | 425 | static void handle_signal(unsigned long sig, siginfo_t *info, |
430 | struct k_sigaction *ka, sigset_t *oldset) | 426 | struct k_sigaction *ka) |
431 | { | 427 | { |
428 | sigset_t *oldset = sigmask_to_save(); | ||
432 | int ret; | 429 | int ret; |
433 | 430 | ||
434 | /* Are we from a system call? */ | 431 | /* Are we from a system call? */ |
@@ -460,11 +457,11 @@ static int handle_signal(unsigned long sig, siginfo_t *info, | |||
460 | else | 457 | else |
461 | ret = setup_frame(sig, ka, oldset); | 458 | ret = setup_frame(sig, ka, oldset); |
462 | 459 | ||
463 | if (ret == 0) | 460 | if (ret) |
464 | block_sigmask(ka, sig); | 461 | return; |
465 | |||
466 | return ret; | ||
467 | 462 | ||
463 | signal_delivered(sig, info, ka, __frame, | ||
464 | test_thread_flag(TIF_SINGLESTEP)); | ||
468 | } /* end handle_signal() */ | 465 | } /* end handle_signal() */ |
469 | 466 | ||
470 | /*****************************************************************************/ | 467 | /*****************************************************************************/ |
@@ -477,44 +474,14 @@ static void do_signal(void) | |||
477 | { | 474 | { |
478 | struct k_sigaction ka; | 475 | struct k_sigaction ka; |
479 | siginfo_t info; | 476 | siginfo_t info; |
480 | sigset_t *oldset; | ||
481 | int signr; | 477 | int signr; |
482 | 478 | ||
483 | /* | ||
484 | * We want the common case to go fast, which | ||
485 | * is why we may in certain cases get here from | ||
486 | * kernel mode. Just return without doing anything | ||
487 | * if so. | ||
488 | */ | ||
489 | if (!user_mode(__frame)) | ||
490 | return; | ||
491 | |||
492 | if (try_to_freeze()) | ||
493 | goto no_signal; | ||
494 | |||
495 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
496 | oldset = ¤t->saved_sigmask; | ||
497 | else | ||
498 | oldset = ¤t->blocked; | ||
499 | |||
500 | signr = get_signal_to_deliver(&info, &ka, __frame, NULL); | 479 | signr = get_signal_to_deliver(&info, &ka, __frame, NULL); |
501 | if (signr > 0) { | 480 | if (signr > 0) { |
502 | if (handle_signal(signr, &info, &ka, oldset) == 0) { | 481 | handle_signal(signr, &info, &ka); |
503 | /* a signal was successfully delivered; the saved | ||
504 | * sigmask will have been stored in the signal frame, | ||
505 | * and will be restored by sigreturn, so we can simply | ||
506 | * clear the TIF_RESTORE_SIGMASK flag */ | ||
507 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
508 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
509 | |||
510 | tracehook_signal_handler(signr, &info, &ka, __frame, | ||
511 | test_thread_flag(TIF_SINGLESTEP)); | ||
512 | } | ||
513 | |||
514 | return; | 482 | return; |
515 | } | 483 | } |
516 | 484 | ||
517 | no_signal: | ||
518 | /* Did we come from a system call? */ | 485 | /* Did we come from a system call? */ |
519 | if (__frame->syscallno != -1) { | 486 | if (__frame->syscallno != -1) { |
520 | /* Restart the system call - no handlers present */ | 487 | /* Restart the system call - no handlers present */ |
@@ -536,11 +503,7 @@ no_signal: | |||
536 | 503 | ||
537 | /* if there's no signal to deliver, we just put the saved sigmask | 504 | /* if there's no signal to deliver, we just put the saved sigmask |
538 | * back */ | 505 | * back */ |
539 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | 506 | restore_saved_sigmask(); |
540 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
541 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
542 | } | ||
543 | |||
544 | } /* end do_signal() */ | 507 | } /* end do_signal() */ |
545 | 508 | ||
546 | /*****************************************************************************/ | 509 | /*****************************************************************************/ |
@@ -555,15 +518,13 @@ asmlinkage void do_notify_resume(__u32 thread_info_flags) | |||
555 | clear_thread_flag(TIF_SINGLESTEP); | 518 | clear_thread_flag(TIF_SINGLESTEP); |
556 | 519 | ||
557 | /* deal with pending signal delivery */ | 520 | /* deal with pending signal delivery */ |
558 | if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) | 521 | if (thread_info_flags & _TIF_SIGPENDING)) |
559 | do_signal(); | 522 | do_signal(); |
560 | 523 | ||
561 | /* deal with notification on about to resume userspace execution */ | 524 | /* deal with notification on about to resume userspace execution */ |
562 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | 525 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { |
563 | clear_thread_flag(TIF_NOTIFY_RESUME); | 526 | clear_thread_flag(TIF_NOTIFY_RESUME); |
564 | tracehook_notify_resume(__frame); | 527 | tracehook_notify_resume(__frame); |
565 | if (current->replacement_session_keyring) | ||
566 | key_replace_session_keyring(); | ||
567 | } | 528 | } |
568 | 529 | ||
569 | } /* end do_notify_resume() */ | 530 | } /* end do_notify_resume() */ |
diff --git a/arch/h8300/include/asm/posix_types.h b/arch/h8300/include/asm/posix_types.h index bc4c34efb1ad..91e62ba4c7b0 100644 --- a/arch/h8300/include/asm/posix_types.h +++ b/arch/h8300/include/asm/posix_types.h | |||
@@ -10,9 +10,6 @@ | |||
10 | typedef unsigned short __kernel_mode_t; | 10 | typedef unsigned short __kernel_mode_t; |
11 | #define __kernel_mode_t __kernel_mode_t | 11 | #define __kernel_mode_t __kernel_mode_t |
12 | 12 | ||
13 | typedef unsigned short __kernel_nlink_t; | ||
14 | #define __kernel_nlink_t __kernel_nlink_t | ||
15 | |||
16 | typedef unsigned short __kernel_ipc_pid_t; | 13 | typedef unsigned short __kernel_ipc_pid_t; |
17 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t | 14 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t |
18 | 15 | ||
diff --git a/arch/h8300/kernel/signal.c b/arch/h8300/kernel/signal.c index d4b0555d2904..fca10378701b 100644 --- a/arch/h8300/kernel/signal.c +++ b/arch/h8300/kernel/signal.c | |||
@@ -47,8 +47,6 @@ | |||
47 | #include <asm/traps.h> | 47 | #include <asm/traps.h> |
48 | #include <asm/ucontext.h> | 48 | #include <asm/ucontext.h> |
49 | 49 | ||
50 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
51 | |||
52 | /* | 50 | /* |
53 | * Atomically swap in the new signal mask, and wait for a signal. | 51 | * Atomically swap in the new signal mask, and wait for a signal. |
54 | */ | 52 | */ |
@@ -186,7 +184,6 @@ asmlinkage int do_sigreturn(unsigned long __unused,...) | |||
186 | sizeof(frame->extramask)))) | 184 | sizeof(frame->extramask)))) |
187 | goto badframe; | 185 | goto badframe; |
188 | 186 | ||
189 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
190 | set_current_blocked(&set); | 187 | set_current_blocked(&set); |
191 | 188 | ||
192 | if (restore_sigcontext(regs, &frame->sc, &er0)) | 189 | if (restore_sigcontext(regs, &frame->sc, &er0)) |
@@ -211,7 +208,6 @@ asmlinkage int do_rt_sigreturn(unsigned long __unused,...) | |||
211 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 208 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
212 | goto badframe; | 209 | goto badframe; |
213 | 210 | ||
214 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
215 | set_current_blocked(&set); | 211 | set_current_blocked(&set); |
216 | 212 | ||
217 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &er0)) | 213 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &er0)) |
@@ -412,8 +408,9 @@ give_sigsegv: | |||
412 | */ | 408 | */ |
413 | static void | 409 | static void |
414 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | 410 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, |
415 | sigset_t *oldset, struct pt_regs * regs) | 411 | struct pt_regs * regs) |
416 | { | 412 | { |
413 | sigset_t *oldset = sigmask_to_save(); | ||
417 | int ret; | 414 | int ret; |
418 | /* are we from a system call? */ | 415 | /* are we from a system call? */ |
419 | if (regs->orig_er0 >= 0) { | 416 | if (regs->orig_er0 >= 0) { |
@@ -441,10 +438,8 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
441 | else | 438 | else |
442 | ret = setup_frame(sig, ka, oldset, regs); | 439 | ret = setup_frame(sig, ka, oldset, regs); |
443 | 440 | ||
444 | if (!ret) { | 441 | if (!ret) |
445 | block_sigmask(ka, sig); | 442 | signal_delivered(sig, info, ka, regs, 0); |
446 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
447 | } | ||
448 | } | 443 | } |
449 | 444 | ||
450 | /* | 445 | /* |
@@ -457,7 +452,6 @@ statis void do_signal(struct pt_regs *regs) | |||
457 | siginfo_t info; | 452 | siginfo_t info; |
458 | int signr; | 453 | int signr; |
459 | struct k_sigaction ka; | 454 | struct k_sigaction ka; |
460 | sigset_t *oldset; | ||
461 | 455 | ||
462 | /* | 456 | /* |
463 | * We want the common case to go fast, which | 457 | * We want the common case to go fast, which |
@@ -468,23 +462,14 @@ statis void do_signal(struct pt_regs *regs) | |||
468 | if ((regs->ccr & 0x10)) | 462 | if ((regs->ccr & 0x10)) |
469 | return; | 463 | return; |
470 | 464 | ||
471 | if (try_to_freeze()) | ||
472 | goto no_signal; | ||
473 | |||
474 | current->thread.esp0 = (unsigned long) regs; | 465 | current->thread.esp0 = (unsigned long) regs; |
475 | 466 | ||
476 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
477 | oldset = ¤t->saved_sigmask; | ||
478 | else | ||
479 | oldset = ¤t->blocked; | ||
480 | |||
481 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 467 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
482 | if (signr > 0) { | 468 | if (signr > 0) { |
483 | /* Whee! Actually deliver the signal. */ | 469 | /* Whee! Actually deliver the signal. */ |
484 | handle_signal(signr, &info, &ka, oldset, regs); | 470 | handle_signal(signr, &info, &ka, regs); |
485 | return; | 471 | return; |
486 | } | 472 | } |
487 | no_signal: | ||
488 | /* Did we come from a system call? */ | 473 | /* Did we come from a system call? */ |
489 | if (regs->orig_er0 >= 0) { | 474 | if (regs->orig_er0 >= 0) { |
490 | /* Restart the system call - no handlers present */ | 475 | /* Restart the system call - no handlers present */ |
@@ -501,8 +486,7 @@ statis void do_signal(struct pt_regs *regs) | |||
501 | } | 486 | } |
502 | 487 | ||
503 | /* If there's no signal to deliver, we just restore the saved mask. */ | 488 | /* If there's no signal to deliver, we just restore the saved mask. */ |
504 | if (test_and_clear_thread_flag(TIF_RESTORE_SIGMASK)) | 489 | restore_saved_sigmask(); |
505 | set_current_blocked(¤t->saved_sigmask); | ||
506 | } | 490 | } |
507 | 491 | ||
508 | asmlinkage void do_notify_resume(struct pt_regs *regs, u32 thread_info_flags) | 492 | asmlinkage void do_notify_resume(struct pt_regs *regs, u32 thread_info_flags) |
@@ -513,7 +497,5 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, u32 thread_info_flags) | |||
513 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | 497 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { |
514 | clear_thread_flag(TIF_NOTIFY_RESUME); | 498 | clear_thread_flag(TIF_NOTIFY_RESUME); |
515 | tracehook_notify_resume(regs); | 499 | tracehook_notify_resume(regs); |
516 | if (current->replacement_session_keyring) | ||
517 | key_replace_session_keyring(); | ||
518 | } | 500 | } |
519 | } | 501 | } |
diff --git a/arch/hexagon/kernel/signal.c b/arch/hexagon/kernel/signal.c index 434866eb0f1c..304b0808d072 100644 --- a/arch/hexagon/kernel/signal.c +++ b/arch/hexagon/kernel/signal.c | |||
@@ -31,8 +31,6 @@ | |||
31 | #include <asm/signal.h> | 31 | #include <asm/signal.h> |
32 | #include <asm/vdso.h> | 32 | #include <asm/vdso.h> |
33 | 33 | ||
34 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
35 | |||
36 | struct rt_sigframe { | 34 | struct rt_sigframe { |
37 | unsigned long tramp[2]; | 35 | unsigned long tramp[2]; |
38 | struct siginfo info; | 36 | struct siginfo info; |
@@ -149,11 +147,9 @@ sigsegv: | |||
149 | /* | 147 | /* |
150 | * Setup invocation of signal handler | 148 | * Setup invocation of signal handler |
151 | */ | 149 | */ |
152 | static int handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka, | 150 | static void handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka, |
153 | sigset_t *oldset, struct pt_regs *regs) | 151 | struct pt_regs *regs) |
154 | { | 152 | { |
155 | int rc; | ||
156 | |||
157 | /* | 153 | /* |
158 | * If we're handling a signal that aborted a system call, | 154 | * If we're handling a signal that aborted a system call, |
159 | * set up the error return value before adding the signal | 155 | * set up the error return value before adding the signal |
@@ -186,15 +182,12 @@ static int handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka, | |||
186 | * Set up the stack frame; not doing the SA_SIGINFO thing. We | 182 | * Set up the stack frame; not doing the SA_SIGINFO thing. We |
187 | * only set up the rt_frame flavor. | 183 | * only set up the rt_frame flavor. |
188 | */ | 184 | */ |
189 | rc = setup_rt_frame(sig, ka, info, oldset, regs); | ||
190 | |||
191 | /* If there was an error on setup, no signal was delivered. */ | 185 | /* If there was an error on setup, no signal was delivered. */ |
192 | if (rc) | 186 | if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs) < 0) |
193 | return rc; | 187 | return; |
194 | |||
195 | block_sigmask(ka, sig); | ||
196 | 188 | ||
197 | return 0; | 189 | signal_delivered(sig, info, ka, regs, |
190 | test_thread_flag(TIF_SINGLESTEP)); | ||
198 | } | 191 | } |
199 | 192 | ||
200 | /* | 193 | /* |
@@ -209,34 +202,13 @@ static void do_signal(struct pt_regs *regs) | |||
209 | if (!user_mode(regs)) | 202 | if (!user_mode(regs)) |
210 | return; | 203 | return; |
211 | 204 | ||
212 | if (try_to_freeze()) | ||
213 | goto no_signal; | ||
214 | |||
215 | signo = get_signal_to_deliver(&info, &sigact, regs, NULL); | 205 | signo = get_signal_to_deliver(&info, &sigact, regs, NULL); |
216 | 206 | ||
217 | if (signo > 0) { | 207 | if (signo > 0) { |
218 | sigset_t *oldset; | 208 | handle_signal(signo, &info, &sigact, regs); |
219 | |||
220 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
221 | oldset = ¤t->saved_sigmask; | ||
222 | else | ||
223 | oldset = ¤t->blocked; | ||
224 | |||
225 | if (handle_signal(signo, &info, &sigact, oldset, regs) == 0) { | ||
226 | /* | ||
227 | * Successful delivery case. The saved sigmask is | ||
228 | * stored in the signal frame, and will be restored | ||
229 | * by sigreturn. We can clear the TIF flag. | ||
230 | */ | ||
231 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
232 | |||
233 | tracehook_signal_handler(signo, &info, &sigact, regs, | ||
234 | test_thread_flag(TIF_SINGLESTEP)); | ||
235 | } | ||
236 | return; | 209 | return; |
237 | } | 210 | } |
238 | 211 | ||
239 | no_signal: | ||
240 | /* | 212 | /* |
241 | * If we came from a system call, handle the restart. | 213 | * If we came from a system call, handle the restart. |
242 | */ | 214 | */ |
@@ -259,10 +231,7 @@ no_signal: | |||
259 | 231 | ||
260 | no_restart: | 232 | no_restart: |
261 | /* If there's no signal to deliver, put the saved sigmask back */ | 233 | /* If there's no signal to deliver, put the saved sigmask back */ |
262 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | 234 | restore_saved_sigmask(); |
263 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
264 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
265 | } | ||
266 | } | 235 | } |
267 | 236 | ||
268 | void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) | 237 | void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) |
@@ -273,8 +242,6 @@ void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) | |||
273 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | 242 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { |
274 | clear_thread_flag(TIF_NOTIFY_RESUME); | 243 | clear_thread_flag(TIF_NOTIFY_RESUME); |
275 | tracehook_notify_resume(regs); | 244 | tracehook_notify_resume(regs); |
276 | if (current->replacement_session_keyring) | ||
277 | key_replace_session_keyring(); | ||
278 | } | 245 | } |
279 | } | 246 | } |
280 | 247 | ||
@@ -303,7 +270,6 @@ asmlinkage int sys_rt_sigreturn(void) | |||
303 | if (__copy_from_user(&blocked, &frame->uc.uc_sigmask, sizeof(blocked))) | 270 | if (__copy_from_user(&blocked, &frame->uc.uc_sigmask, sizeof(blocked))) |
304 | goto badframe; | 271 | goto badframe; |
305 | 272 | ||
306 | sigdelsetmask(&blocked, ~_BLOCKABLE); | ||
307 | set_current_blocked(&blocked); | 273 | set_current_blocked(&blocked); |
308 | 274 | ||
309 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) | 275 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) |
diff --git a/arch/ia64/include/asm/posix_types.h b/arch/ia64/include/asm/posix_types.h index 7323ab9467eb..99ee1d6510cf 100644 --- a/arch/ia64/include/asm/posix_types.h +++ b/arch/ia64/include/asm/posix_types.h | |||
@@ -1,9 +1,6 @@ | |||
1 | #ifndef _ASM_IA64_POSIX_TYPES_H | 1 | #ifndef _ASM_IA64_POSIX_TYPES_H |
2 | #define _ASM_IA64_POSIX_TYPES_H | 2 | #define _ASM_IA64_POSIX_TYPES_H |
3 | 3 | ||
4 | typedef unsigned int __kernel_nlink_t; | ||
5 | #define __kernel_nlink_t __kernel_nlink_t | ||
6 | |||
7 | typedef unsigned long __kernel_sigset_t; /* at least 32 bits */ | 4 | typedef unsigned long __kernel_sigset_t; /* at least 32 bits */ |
8 | 5 | ||
9 | #include <asm-generic/posix_types.h> | 6 | #include <asm-generic/posix_types.h> |
diff --git a/arch/ia64/include/asm/thread_info.h b/arch/ia64/include/asm/thread_info.h index 310d9734f02d..f7ee85378311 100644 --- a/arch/ia64/include/asm/thread_info.h +++ b/arch/ia64/include/asm/thread_info.h | |||
@@ -141,7 +141,23 @@ static inline void set_restore_sigmask(void) | |||
141 | { | 141 | { |
142 | struct thread_info *ti = current_thread_info(); | 142 | struct thread_info *ti = current_thread_info(); |
143 | ti->status |= TS_RESTORE_SIGMASK; | 143 | ti->status |= TS_RESTORE_SIGMASK; |
144 | set_bit(TIF_SIGPENDING, &ti->flags); | 144 | WARN_ON(!test_bit(TIF_SIGPENDING, &ti->flags)); |
145 | } | ||
146 | static inline void clear_restore_sigmask(void) | ||
147 | { | ||
148 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
149 | } | ||
150 | static inline bool test_restore_sigmask(void) | ||
151 | { | ||
152 | return current_thread_info()->status & TS_RESTORE_SIGMASK; | ||
153 | } | ||
154 | static inline bool test_and_clear_restore_sigmask(void) | ||
155 | { | ||
156 | struct thread_info *ti = current_thread_info(); | ||
157 | if (!(ti->status & TS_RESTORE_SIGMASK)) | ||
158 | return false; | ||
159 | ti->status &= ~TS_RESTORE_SIGMASK; | ||
160 | return true; | ||
145 | } | 161 | } |
146 | #endif /* !__ASSEMBLY__ */ | 162 | #endif /* !__ASSEMBLY__ */ |
147 | 163 | ||
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index f00ba025375d..d7f558c1e711 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c | |||
@@ -604,12 +604,6 @@ pfm_unprotect_ctx_ctxsw(pfm_context_t *x, unsigned long f) | |||
604 | spin_unlock(&(x)->ctx_lock); | 604 | spin_unlock(&(x)->ctx_lock); |
605 | } | 605 | } |
606 | 606 | ||
607 | static inline unsigned long | ||
608 | pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags, unsigned long exec) | ||
609 | { | ||
610 | return get_unmapped_area(file, addr, len, pgoff, flags); | ||
611 | } | ||
612 | |||
613 | /* forward declaration */ | 607 | /* forward declaration */ |
614 | static const struct dentry_operations pfmfs_dentry_operations; | 608 | static const struct dentry_operations pfmfs_dentry_operations; |
615 | 609 | ||
@@ -2333,8 +2327,8 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t | |||
2333 | down_write(&task->mm->mmap_sem); | 2327 | down_write(&task->mm->mmap_sem); |
2334 | 2328 | ||
2335 | /* find some free area in address space, must have mmap sem held */ | 2329 | /* find some free area in address space, must have mmap sem held */ |
2336 | vma->vm_start = pfm_get_unmapped_area(NULL, 0, size, 0, MAP_PRIVATE|MAP_ANONYMOUS, 0); | 2330 | vma->vm_start = get_unmapped_area(NULL, 0, size, 0, MAP_PRIVATE|MAP_ANONYMOUS); |
2337 | if (vma->vm_start == 0UL) { | 2331 | if (IS_ERR_VALUE(vma->vm_start)) { |
2338 | DPRINT(("Cannot find unmapped area for size %ld\n", size)); | 2332 | DPRINT(("Cannot find unmapped area for size %ld\n", size)); |
2339 | up_write(&task->mm->mmap_sem); | 2333 | up_write(&task->mm->mmap_sem); |
2340 | goto error; | 2334 | goto error; |
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index 5e0e86ddb12f..dd6fc1449741 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c | |||
@@ -199,8 +199,6 @@ do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall) | |||
199 | if (test_thread_flag(TIF_NOTIFY_RESUME)) { | 199 | if (test_thread_flag(TIF_NOTIFY_RESUME)) { |
200 | clear_thread_flag(TIF_NOTIFY_RESUME); | 200 | clear_thread_flag(TIF_NOTIFY_RESUME); |
201 | tracehook_notify_resume(&scr->pt); | 201 | tracehook_notify_resume(&scr->pt); |
202 | if (current->replacement_session_keyring) | ||
203 | key_replace_session_keyring(); | ||
204 | } | 202 | } |
205 | 203 | ||
206 | /* copy user rbs to kernel rbs */ | 204 | /* copy user rbs to kernel rbs */ |
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c index 7523501d3bc0..a199be1fe619 100644 --- a/arch/ia64/kernel/signal.c +++ b/arch/ia64/kernel/signal.c | |||
@@ -30,7 +30,6 @@ | |||
30 | 30 | ||
31 | #define DEBUG_SIG 0 | 31 | #define DEBUG_SIG 0 |
32 | #define STACK_ALIGN 16 /* minimal alignment for stack pointer */ | 32 | #define STACK_ALIGN 16 /* minimal alignment for stack pointer */ |
33 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
34 | 33 | ||
35 | #if _NSIG_WORDS > 1 | 34 | #if _NSIG_WORDS > 1 |
36 | # define PUT_SIGSET(k,u) __copy_to_user((u)->sig, (k)->sig, sizeof(sigset_t)) | 35 | # define PUT_SIGSET(k,u) __copy_to_user((u)->sig, (k)->sig, sizeof(sigset_t)) |
@@ -200,7 +199,6 @@ ia64_rt_sigreturn (struct sigscratch *scr) | |||
200 | if (GET_SIGSET(&set, &sc->sc_mask)) | 199 | if (GET_SIGSET(&set, &sc->sc_mask)) |
201 | goto give_sigsegv; | 200 | goto give_sigsegv; |
202 | 201 | ||
203 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
204 | set_current_blocked(&set); | 202 | set_current_blocked(&set); |
205 | 203 | ||
206 | if (restore_sigcontext(sc, scr)) | 204 | if (restore_sigcontext(sc, scr)) |
@@ -415,18 +413,13 @@ setup_frame (int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set, | |||
415 | } | 413 | } |
416 | 414 | ||
417 | static long | 415 | static long |
418 | handle_signal (unsigned long sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *oldset, | 416 | handle_signal (unsigned long sig, struct k_sigaction *ka, siginfo_t *info, |
419 | struct sigscratch *scr) | 417 | struct sigscratch *scr) |
420 | { | 418 | { |
421 | if (!setup_frame(sig, ka, info, oldset, scr)) | 419 | if (!setup_frame(sig, ka, info, sigmask_to_save(), scr)) |
422 | return 0; | 420 | return 0; |
423 | 421 | ||
424 | block_sigmask(ka, sig); | 422 | signal_delivered(sig, info, ka, &scr->pt, |
425 | |||
426 | /* | ||
427 | * Let tracing know that we've done the handler setup. | ||
428 | */ | ||
429 | tracehook_signal_handler(sig, info, ka, &scr->pt, | ||
430 | test_thread_flag(TIF_SINGLESTEP)); | 423 | test_thread_flag(TIF_SINGLESTEP)); |
431 | 424 | ||
432 | return 1; | 425 | return 1; |
@@ -440,7 +433,6 @@ void | |||
440 | ia64_do_signal (struct sigscratch *scr, long in_syscall) | 433 | ia64_do_signal (struct sigscratch *scr, long in_syscall) |
441 | { | 434 | { |
442 | struct k_sigaction ka; | 435 | struct k_sigaction ka; |
443 | sigset_t *oldset; | ||
444 | siginfo_t info; | 436 | siginfo_t info; |
445 | long restart = in_syscall; | 437 | long restart = in_syscall; |
446 | long errno = scr->pt.r8; | 438 | long errno = scr->pt.r8; |
@@ -453,11 +445,6 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall) | |||
453 | if (!user_mode(&scr->pt)) | 445 | if (!user_mode(&scr->pt)) |
454 | return; | 446 | return; |
455 | 447 | ||
456 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) | ||
457 | oldset = ¤t->saved_sigmask; | ||
458 | else | ||
459 | oldset = ¤t->blocked; | ||
460 | |||
461 | /* | 448 | /* |
462 | * This only loops in the rare cases of handle_signal() failing, in which case we | 449 | * This only loops in the rare cases of handle_signal() failing, in which case we |
463 | * need to push through a forced SIGSEGV. | 450 | * need to push through a forced SIGSEGV. |
@@ -507,16 +494,8 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall) | |||
507 | * Whee! Actually deliver the signal. If the delivery failed, we need to | 494 | * Whee! Actually deliver the signal. If the delivery failed, we need to |
508 | * continue to iterate in this loop so we can deliver the SIGSEGV... | 495 | * continue to iterate in this loop so we can deliver the SIGSEGV... |
509 | */ | 496 | */ |
510 | if (handle_signal(signr, &ka, &info, oldset, scr)) { | 497 | if (handle_signal(signr, &ka, &info, scr)) |
511 | /* | ||
512 | * A signal was successfully delivered; the saved | ||
513 | * sigmask will have been stored in the signal frame, | ||
514 | * and will be restored by sigreturn, so we can simply | ||
515 | * clear the TS_RESTORE_SIGMASK flag. | ||
516 | */ | ||
517 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
518 | return; | 498 | return; |
519 | } | ||
520 | } | 499 | } |
521 | 500 | ||
522 | /* Did we come from a system call? */ | 501 | /* Did we come from a system call? */ |
@@ -538,8 +517,5 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall) | |||
538 | 517 | ||
539 | /* if there's no signal to deliver, we just put the saved sigmask | 518 | /* if there's no signal to deliver, we just put the saved sigmask |
540 | * back */ | 519 | * back */ |
541 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) { | 520 | restore_saved_sigmask(); |
542 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
543 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
544 | } | ||
545 | } | 521 | } |
diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c index 609d50056a6c..d9439ef2f661 100644 --- a/arch/ia64/kernel/sys_ia64.c +++ b/arch/ia64/kernel/sys_ia64.c | |||
@@ -171,22 +171,9 @@ asmlinkage unsigned long | |||
171 | ia64_mremap (unsigned long addr, unsigned long old_len, unsigned long new_len, unsigned long flags, | 171 | ia64_mremap (unsigned long addr, unsigned long old_len, unsigned long new_len, unsigned long flags, |
172 | unsigned long new_addr) | 172 | unsigned long new_addr) |
173 | { | 173 | { |
174 | extern unsigned long do_mremap (unsigned long addr, | 174 | addr = sys_mremap(addr, old_len, new_len, flags, new_addr); |
175 | unsigned long old_len, | 175 | if (!IS_ERR((void *) addr)) |
176 | unsigned long new_len, | 176 | force_successful_syscall_return(); |
177 | unsigned long flags, | ||
178 | unsigned long new_addr); | ||
179 | |||
180 | down_write(¤t->mm->mmap_sem); | ||
181 | { | ||
182 | addr = do_mremap(addr, old_len, new_len, flags, new_addr); | ||
183 | } | ||
184 | up_write(¤t->mm->mmap_sem); | ||
185 | |||
186 | if (IS_ERR((void *) addr)) | ||
187 | return addr; | ||
188 | |||
189 | force_successful_syscall_return(); | ||
190 | return addr; | 177 | return addr; |
191 | } | 178 | } |
192 | 179 | ||
diff --git a/arch/m32r/include/asm/posix_types.h b/arch/m32r/include/asm/posix_types.h index 0195850e1f88..236de26a409b 100644 --- a/arch/m32r/include/asm/posix_types.h +++ b/arch/m32r/include/asm/posix_types.h | |||
@@ -10,9 +10,6 @@ | |||
10 | typedef unsigned short __kernel_mode_t; | 10 | typedef unsigned short __kernel_mode_t; |
11 | #define __kernel_mode_t __kernel_mode_t | 11 | #define __kernel_mode_t __kernel_mode_t |
12 | 12 | ||
13 | typedef unsigned short __kernel_nlink_t; | ||
14 | #define __kernel_nlink_t __kernel_nlink_t | ||
15 | |||
16 | typedef unsigned short __kernel_ipc_pid_t; | 13 | typedef unsigned short __kernel_ipc_pid_t; |
17 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t | 14 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t |
18 | 15 | ||
diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c index f54d96993ea1..f3fb2c029cfc 100644 --- a/arch/m32r/kernel/signal.c +++ b/arch/m32r/kernel/signal.c | |||
@@ -28,8 +28,6 @@ | |||
28 | 28 | ||
29 | #define DEBUG_SIG 0 | 29 | #define DEBUG_SIG 0 |
30 | 30 | ||
31 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
32 | |||
33 | asmlinkage int | 31 | asmlinkage int |
34 | sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, | 32 | sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, |
35 | unsigned long r2, unsigned long r3, unsigned long r4, | 33 | unsigned long r2, unsigned long r3, unsigned long r4, |
@@ -111,7 +109,6 @@ sys_rt_sigreturn(unsigned long r0, unsigned long r1, | |||
111 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 109 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
112 | goto badframe; | 110 | goto badframe; |
113 | 111 | ||
114 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
115 | set_current_blocked(&set); | 112 | set_current_blocked(&set); |
116 | 113 | ||
117 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &result)) | 114 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &result)) |
@@ -267,9 +264,9 @@ static int prev_insn(struct pt_regs *regs) | |||
267 | * OK, we're invoking a handler | 264 | * OK, we're invoking a handler |
268 | */ | 265 | */ |
269 | 266 | ||
270 | static int | 267 | static void |
271 | handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | 268 | handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, |
272 | sigset_t *oldset, struct pt_regs *regs) | 269 | struct pt_regs *regs) |
273 | { | 270 | { |
274 | /* Are we from a system call? */ | 271 | /* Are we from a system call? */ |
275 | if (regs->syscall_nr >= 0) { | 272 | if (regs->syscall_nr >= 0) { |
@@ -294,11 +291,10 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | |||
294 | } | 291 | } |
295 | 292 | ||
296 | /* Set up the stack frame */ | 293 | /* Set up the stack frame */ |
297 | if (setup_rt_frame(sig, ka, info, oldset, regs)) | 294 | if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs)) |
298 | return -EFAULT; | 295 | return; |
299 | 296 | ||
300 | block_sigmask(ka, sig); | 297 | signal_delivered(sig, info, ka, regs, 0); |
301 | return 0; | ||
302 | } | 298 | } |
303 | 299 | ||
304 | /* | 300 | /* |
@@ -311,7 +307,6 @@ static void do_signal(struct pt_regs *regs) | |||
311 | siginfo_t info; | 307 | siginfo_t info; |
312 | int signr; | 308 | int signr; |
313 | struct k_sigaction ka; | 309 | struct k_sigaction ka; |
314 | sigset_t *oldset; | ||
315 | 310 | ||
316 | /* | 311 | /* |
317 | * We want the common case to go fast, which | 312 | * We want the common case to go fast, which |
@@ -322,14 +317,6 @@ static void do_signal(struct pt_regs *regs) | |||
322 | if (!user_mode(regs)) | 317 | if (!user_mode(regs)) |
323 | return; | 318 | return; |
324 | 319 | ||
325 | if (try_to_freeze()) | ||
326 | goto no_signal; | ||
327 | |||
328 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
329 | oldset = ¤t->saved_sigmask; | ||
330 | else | ||
331 | oldset = ¤t->blocked; | ||
332 | |||
333 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 320 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
334 | if (signr > 0) { | 321 | if (signr > 0) { |
335 | /* Re-enable any watchpoints before delivering the | 322 | /* Re-enable any watchpoints before delivering the |
@@ -339,13 +326,11 @@ static void do_signal(struct pt_regs *regs) | |||
339 | */ | 326 | */ |
340 | 327 | ||
341 | /* Whee! Actually deliver the signal. */ | 328 | /* Whee! Actually deliver the signal. */ |
342 | if (handle_signal(signr, &ka, &info, oldset, regs) == 0) | 329 | handle_signal(signr, &ka, &info, regs); |
343 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
344 | 330 | ||
345 | return; | 331 | return; |
346 | } | 332 | } |
347 | 333 | ||
348 | no_signal: | ||
349 | /* Did we come from a system call? */ | 334 | /* Did we come from a system call? */ |
350 | if (regs->syscall_nr >= 0) { | 335 | if (regs->syscall_nr >= 0) { |
351 | /* Restart the system call - no handlers present */ | 336 | /* Restart the system call - no handlers present */ |
@@ -360,10 +345,7 @@ static void do_signal(struct pt_regs *regs) | |||
360 | prev_insn(regs); | 345 | prev_insn(regs); |
361 | } | 346 | } |
362 | } | 347 | } |
363 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | 348 | restore_saved_sigmask(); |
364 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
365 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
366 | } | ||
367 | } | 349 | } |
368 | 350 | ||
369 | /* | 351 | /* |
@@ -383,8 +365,6 @@ void do_notify_resume(struct pt_regs *regs, __u32 thread_info_flags) | |||
383 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | 365 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { |
384 | clear_thread_flag(TIF_NOTIFY_RESUME); | 366 | clear_thread_flag(TIF_NOTIFY_RESUME); |
385 | tracehook_notify_resume(regs); | 367 | tracehook_notify_resume(regs); |
386 | if (current->replacement_session_keyring) | ||
387 | key_replace_session_keyring(); | ||
388 | } | 368 | } |
389 | 369 | ||
390 | clear_thread_flag(TIF_IRET); | 370 | clear_thread_flag(TIF_IRET); |
diff --git a/arch/m68k/include/asm/posix_types.h b/arch/m68k/include/asm/posix_types.h index 6373093be72b..cf4dbf70fdc7 100644 --- a/arch/m68k/include/asm/posix_types.h +++ b/arch/m68k/include/asm/posix_types.h | |||
@@ -10,9 +10,6 @@ | |||
10 | typedef unsigned short __kernel_mode_t; | 10 | typedef unsigned short __kernel_mode_t; |
11 | #define __kernel_mode_t __kernel_mode_t | 11 | #define __kernel_mode_t __kernel_mode_t |
12 | 12 | ||
13 | typedef unsigned short __kernel_nlink_t; | ||
14 | #define __kernel_nlink_t __kernel_nlink_t | ||
15 | |||
16 | typedef unsigned short __kernel_ipc_pid_t; | 13 | typedef unsigned short __kernel_ipc_pid_t; |
17 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t | 14 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t |
18 | 15 | ||
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c index d9f3d1900eed..710a528b928b 100644 --- a/arch/m68k/kernel/signal.c +++ b/arch/m68k/kernel/signal.c | |||
@@ -51,8 +51,6 @@ | |||
51 | #include <asm/traps.h> | 51 | #include <asm/traps.h> |
52 | #include <asm/ucontext.h> | 52 | #include <asm/ucontext.h> |
53 | 53 | ||
54 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
55 | |||
56 | #ifdef CONFIG_MMU | 54 | #ifdef CONFIG_MMU |
57 | 55 | ||
58 | /* | 56 | /* |
@@ -795,7 +793,6 @@ asmlinkage int do_sigreturn(unsigned long __unused) | |||
795 | sizeof(frame->extramask)))) | 793 | sizeof(frame->extramask)))) |
796 | goto badframe; | 794 | goto badframe; |
797 | 795 | ||
798 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
799 | set_current_blocked(&set); | 796 | set_current_blocked(&set); |
800 | 797 | ||
801 | if (restore_sigcontext(regs, &frame->sc, frame + 1)) | 798 | if (restore_sigcontext(regs, &frame->sc, frame + 1)) |
@@ -820,7 +817,6 @@ asmlinkage int do_rt_sigreturn(unsigned long __unused) | |||
820 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 817 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
821 | goto badframe; | 818 | goto badframe; |
822 | 819 | ||
823 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
824 | set_current_blocked(&set); | 820 | set_current_blocked(&set); |
825 | 821 | ||
826 | if (rt_restore_ucontext(regs, sw, &frame->uc)) | 822 | if (rt_restore_ucontext(regs, sw, &frame->uc)) |
@@ -1123,8 +1119,9 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler) | |||
1123 | */ | 1119 | */ |
1124 | static void | 1120 | static void |
1125 | handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info, | 1121 | handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info, |
1126 | sigset_t *oldset, struct pt_regs *regs) | 1122 | struct pt_regs *regs) |
1127 | { | 1123 | { |
1124 | sigset_t *oldset = sigmask_to_save(); | ||
1128 | int err; | 1125 | int err; |
1129 | /* are we from a system call? */ | 1126 | /* are we from a system call? */ |
1130 | if (regs->orig_d0 >= 0) | 1127 | if (regs->orig_d0 >= 0) |
@@ -1140,14 +1137,12 @@ handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
1140 | if (err) | 1137 | if (err) |
1141 | return; | 1138 | return; |
1142 | 1139 | ||
1143 | block_sigmask(ka, sig); | 1140 | signal_delivered(sig, info, ka, regs, 0); |
1144 | 1141 | ||
1145 | if (test_thread_flag(TIF_DELAYED_TRACE)) { | 1142 | if (test_thread_flag(TIF_DELAYED_TRACE)) { |
1146 | regs->sr &= ~0x8000; | 1143 | regs->sr &= ~0x8000; |
1147 | send_sig(SIGTRAP, current, 1); | 1144 | send_sig(SIGTRAP, current, 1); |
1148 | } | 1145 | } |
1149 | |||
1150 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
1151 | } | 1146 | } |
1152 | 1147 | ||
1153 | /* | 1148 | /* |
@@ -1160,19 +1155,13 @@ static void do_signal(struct pt_regs *regs) | |||
1160 | siginfo_t info; | 1155 | siginfo_t info; |
1161 | struct k_sigaction ka; | 1156 | struct k_sigaction ka; |
1162 | int signr; | 1157 | int signr; |
1163 | sigset_t *oldset; | ||
1164 | 1158 | ||
1165 | current->thread.esp0 = (unsigned long) regs; | 1159 | current->thread.esp0 = (unsigned long) regs; |
1166 | 1160 | ||
1167 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
1168 | oldset = ¤t->saved_sigmask; | ||
1169 | else | ||
1170 | oldset = ¤t->blocked; | ||
1171 | |||
1172 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 1161 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
1173 | if (signr > 0) { | 1162 | if (signr > 0) { |
1174 | /* Whee! Actually deliver the signal. */ | 1163 | /* Whee! Actually deliver the signal. */ |
1175 | handle_signal(signr, &ka, &info, oldset, regs); | 1164 | handle_signal(signr, &ka, &info, regs); |
1176 | return; | 1165 | return; |
1177 | } | 1166 | } |
1178 | 1167 | ||
@@ -1182,10 +1171,7 @@ static void do_signal(struct pt_regs *regs) | |||
1182 | handle_restart(regs, NULL, 0); | 1171 | handle_restart(regs, NULL, 0); |
1183 | 1172 | ||
1184 | /* If there's no signal to deliver, we just restore the saved mask. */ | 1173 | /* If there's no signal to deliver, we just restore the saved mask. */ |
1185 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | 1174 | restore_saved_sigmask(); |
1186 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
1187 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
1188 | } | ||
1189 | } | 1175 | } |
1190 | 1176 | ||
1191 | void do_notify_resume(struct pt_regs *regs) | 1177 | void do_notify_resume(struct pt_regs *regs) |
@@ -1193,9 +1179,6 @@ void do_notify_resume(struct pt_regs *regs) | |||
1193 | if (test_thread_flag(TIF_SIGPENDING)) | 1179 | if (test_thread_flag(TIF_SIGPENDING)) |
1194 | do_signal(regs); | 1180 | do_signal(regs); |
1195 | 1181 | ||
1196 | if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME)) { | 1182 | if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME)) |
1197 | tracehook_notify_resume(regs); | 1183 | tracehook_notify_resume(regs); |
1198 | if (current->replacement_session_keyring) | ||
1199 | key_replace_session_keyring(); | ||
1200 | } | ||
1201 | } | 1184 | } |
diff --git a/arch/microblaze/include/asm/thread_info.h b/arch/microblaze/include/asm/thread_info.h index 1a8ab6a5c03f..6c610234ffab 100644 --- a/arch/microblaze/include/asm/thread_info.h +++ b/arch/microblaze/include/asm/thread_info.h | |||
@@ -166,7 +166,23 @@ static inline void set_restore_sigmask(void) | |||
166 | { | 166 | { |
167 | struct thread_info *ti = current_thread_info(); | 167 | struct thread_info *ti = current_thread_info(); |
168 | ti->status |= TS_RESTORE_SIGMASK; | 168 | ti->status |= TS_RESTORE_SIGMASK; |
169 | set_bit(TIF_SIGPENDING, (unsigned long *)&ti->flags); | 169 | WARN_ON(!test_bit(TIF_SIGPENDING, (unsigned long *)&ti->flags)); |
170 | } | ||
171 | static inline void clear_restore_sigmask(void) | ||
172 | { | ||
173 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
174 | } | ||
175 | static inline bool test_restore_sigmask(void) | ||
176 | { | ||
177 | return current_thread_info()->status & TS_RESTORE_SIGMASK; | ||
178 | } | ||
179 | static inline bool test_and_clear_restore_sigmask(void) | ||
180 | { | ||
181 | struct thread_info *ti = current_thread_info(); | ||
182 | if (!(ti->status & TS_RESTORE_SIGMASK)) | ||
183 | return false; | ||
184 | ti->status &= ~TS_RESTORE_SIGMASK; | ||
185 | return true; | ||
170 | } | 186 | } |
171 | #endif | 187 | #endif |
172 | 188 | ||
diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c index 7f4c7bef1642..76b9722557db 100644 --- a/arch/microblaze/kernel/signal.c +++ b/arch/microblaze/kernel/signal.c | |||
@@ -41,8 +41,6 @@ | |||
41 | #include <asm/cacheflush.h> | 41 | #include <asm/cacheflush.h> |
42 | #include <asm/syscalls.h> | 42 | #include <asm/syscalls.h> |
43 | 43 | ||
44 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
45 | |||
46 | asmlinkage long | 44 | asmlinkage long |
47 | sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, | 45 | sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, |
48 | struct pt_regs *regs) | 46 | struct pt_regs *regs) |
@@ -106,7 +104,6 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) | |||
106 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 104 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
107 | goto badframe; | 105 | goto badframe; |
108 | 106 | ||
109 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
110 | set_current_blocked(&set); | 107 | set_current_blocked(&set); |
111 | 108 | ||
112 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &rval)) | 109 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &rval)) |
@@ -310,10 +307,11 @@ do_restart: | |||
310 | * OK, we're invoking a handler | 307 | * OK, we're invoking a handler |
311 | */ | 308 | */ |
312 | 309 | ||
313 | static int | 310 | static void |
314 | handle_signal(unsigned long sig, struct k_sigaction *ka, | 311 | handle_signal(unsigned long sig, struct k_sigaction *ka, |
315 | siginfo_t *info, sigset_t *oldset, struct pt_regs *regs) | 312 | siginfo_t *info, struct pt_regs *regs) |
316 | { | 313 | { |
314 | sigset_t *oldset = sigmask_to_save(); | ||
317 | int ret; | 315 | int ret; |
318 | 316 | ||
319 | /* Set up the stack frame */ | 317 | /* Set up the stack frame */ |
@@ -323,11 +321,9 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
323 | ret = setup_rt_frame(sig, ka, NULL, oldset, regs); | 321 | ret = setup_rt_frame(sig, ka, NULL, oldset, regs); |
324 | 322 | ||
325 | if (ret) | 323 | if (ret) |
326 | return ret; | 324 | return; |
327 | |||
328 | block_sigmask(ka, sig); | ||
329 | 325 | ||
330 | return 0; | 326 | signal_delivered(sig, info, ka, regs, 0); |
331 | } | 327 | } |
332 | 328 | ||
333 | /* | 329 | /* |
@@ -344,33 +340,18 @@ static void do_signal(struct pt_regs *regs, int in_syscall) | |||
344 | siginfo_t info; | 340 | siginfo_t info; |
345 | int signr; | 341 | int signr; |
346 | struct k_sigaction ka; | 342 | struct k_sigaction ka; |
347 | sigset_t *oldset; | ||
348 | #ifdef DEBUG_SIG | 343 | #ifdef DEBUG_SIG |
349 | printk(KERN_INFO "do signal: %p %d\n", regs, in_syscall); | 344 | printk(KERN_INFO "do signal: %p %d\n", regs, in_syscall); |
350 | printk(KERN_INFO "do signal2: %lx %lx %ld [%lx]\n", regs->pc, regs->r1, | 345 | printk(KERN_INFO "do signal2: %lx %lx %ld [%lx]\n", regs->pc, regs->r1, |
351 | regs->r12, current_thread_info()->flags); | 346 | regs->r12, current_thread_info()->flags); |
352 | #endif | 347 | #endif |
353 | 348 | ||
354 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) | ||
355 | oldset = ¤t->saved_sigmask; | ||
356 | else | ||
357 | oldset = ¤t->blocked; | ||
358 | |||
359 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 349 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
360 | if (signr > 0) { | 350 | if (signr > 0) { |
361 | /* Whee! Actually deliver the signal. */ | 351 | /* Whee! Actually deliver the signal. */ |
362 | if (in_syscall) | 352 | if (in_syscall) |
363 | handle_restart(regs, &ka, 1); | 353 | handle_restart(regs, &ka, 1); |
364 | if (!handle_signal(signr, &ka, &info, oldset, regs)) { | 354 | handle_signal(signr, &ka, &info, regs); |
365 | /* | ||
366 | * A signal was successfully delivered; the saved | ||
367 | * sigmask will have been stored in the signal frame, | ||
368 | * and will be restored by sigreturn, so we can simply | ||
369 | * clear the TS_RESTORE_SIGMASK flag. | ||
370 | */ | ||
371 | current_thread_info()->status &= | ||
372 | ~TS_RESTORE_SIGMASK; | ||
373 | } | ||
374 | return; | 355 | return; |
375 | } | 356 | } |
376 | 357 | ||
@@ -381,10 +362,7 @@ static void do_signal(struct pt_regs *regs, int in_syscall) | |||
381 | * If there's no signal to deliver, we just put the saved sigmask | 362 | * If there's no signal to deliver, we just put the saved sigmask |
382 | * back. | 363 | * back. |
383 | */ | 364 | */ |
384 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) { | 365 | restore_saved_sigmask(); |
385 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
386 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
387 | } | ||
388 | } | 366 | } |
389 | 367 | ||
390 | void do_notify_resume(struct pt_regs *regs, int in_syscall) | 368 | void do_notify_resume(struct pt_regs *regs, int in_syscall) |
@@ -401,9 +379,6 @@ void do_notify_resume(struct pt_regs *regs, int in_syscall) | |||
401 | if (test_thread_flag(TIF_SIGPENDING)) | 379 | if (test_thread_flag(TIF_SIGPENDING)) |
402 | do_signal(regs, in_syscall); | 380 | do_signal(regs, in_syscall); |
403 | 381 | ||
404 | if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME)) { | 382 | if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME)) |
405 | tracehook_notify_resume(regs); | 383 | tracehook_notify_resume(regs); |
406 | if (current->replacement_session_keyring) | ||
407 | key_replace_session_keyring(); | ||
408 | } | ||
409 | } | 384 | } |
diff --git a/arch/mips/include/asm/posix_types.h b/arch/mips/include/asm/posix_types.h index e0308dcca135..fa03ec3fbf89 100644 --- a/arch/mips/include/asm/posix_types.h +++ b/arch/mips/include/asm/posix_types.h | |||
@@ -17,11 +17,6 @@ | |||
17 | * assume GCC is being used. | 17 | * assume GCC is being used. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #if (_MIPS_SZLONG == 64) | ||
21 | typedef unsigned int __kernel_nlink_t; | ||
22 | #define __kernel_nlink_t __kernel_nlink_t | ||
23 | #endif | ||
24 | |||
25 | typedef long __kernel_daddr_t; | 20 | typedef long __kernel_daddr_t; |
26 | #define __kernel_daddr_t __kernel_daddr_t | 21 | #define __kernel_daddr_t __kernel_daddr_t |
27 | 22 | ||
diff --git a/arch/mips/include/asm/stat.h b/arch/mips/include/asm/stat.h index 6e00f751ab6d..fe9a4c3ec5a1 100644 --- a/arch/mips/include/asm/stat.h +++ b/arch/mips/include/asm/stat.h | |||
@@ -20,7 +20,7 @@ struct stat { | |||
20 | long st_pad1[3]; /* Reserved for network id */ | 20 | long st_pad1[3]; /* Reserved for network id */ |
21 | ino_t st_ino; | 21 | ino_t st_ino; |
22 | mode_t st_mode; | 22 | mode_t st_mode; |
23 | nlink_t st_nlink; | 23 | __u32 st_nlink; |
24 | uid_t st_uid; | 24 | uid_t st_uid; |
25 | gid_t st_gid; | 25 | gid_t st_gid; |
26 | unsigned st_rdev; | 26 | unsigned st_rdev; |
@@ -55,7 +55,7 @@ struct stat64 { | |||
55 | unsigned long long st_ino; | 55 | unsigned long long st_ino; |
56 | 56 | ||
57 | mode_t st_mode; | 57 | mode_t st_mode; |
58 | nlink_t st_nlink; | 58 | __u32 st_nlink; |
59 | 59 | ||
60 | uid_t st_uid; | 60 | uid_t st_uid; |
61 | gid_t st_gid; | 61 | gid_t st_gid; |
@@ -96,7 +96,7 @@ struct stat { | |||
96 | unsigned long st_ino; | 96 | unsigned long st_ino; |
97 | 97 | ||
98 | mode_t st_mode; | 98 | mode_t st_mode; |
99 | nlink_t st_nlink; | 99 | __u32 st_nlink; |
100 | 100 | ||
101 | uid_t st_uid; | 101 | uid_t st_uid; |
102 | gid_t st_gid; | 102 | gid_t st_gid; |
diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h index 10263b405981..9c60d09e62a7 100644 --- a/arch/mips/kernel/signal-common.h +++ b/arch/mips/kernel/signal-common.h | |||
@@ -19,8 +19,6 @@ | |||
19 | # define DEBUGP(fmt, args...) | 19 | # define DEBUGP(fmt, args...) |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
23 | |||
24 | /* | 22 | /* |
25 | * Determine which stack to use.. | 23 | * Determine which stack to use.. |
26 | */ | 24 | */ |
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c index 17f6ee30ad0d..f2c09cfc60ac 100644 --- a/arch/mips/kernel/signal.c +++ b/arch/mips/kernel/signal.c | |||
@@ -339,7 +339,6 @@ asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
339 | if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked))) | 339 | if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked))) |
340 | goto badframe; | 340 | goto badframe; |
341 | 341 | ||
342 | sigdelsetmask(&blocked, ~_BLOCKABLE); | ||
343 | set_current_blocked(&blocked); | 342 | set_current_blocked(&blocked); |
344 | 343 | ||
345 | sig = restore_sigcontext(®s, &frame->sf_sc); | 344 | sig = restore_sigcontext(®s, &frame->sf_sc); |
@@ -375,7 +374,6 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
375 | if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) | 374 | if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) |
376 | goto badframe; | 375 | goto badframe; |
377 | 376 | ||
378 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
379 | set_current_blocked(&set); | 377 | set_current_blocked(&set); |
380 | 378 | ||
381 | sig = restore_sigcontext(®s, &frame->rs_uc.uc_mcontext); | 379 | sig = restore_sigcontext(®s, &frame->rs_uc.uc_mcontext); |
@@ -514,9 +512,10 @@ struct mips_abi mips_abi = { | |||
514 | .restart = __NR_restart_syscall | 512 | .restart = __NR_restart_syscall |
515 | }; | 513 | }; |
516 | 514 | ||
517 | static int handle_signal(unsigned long sig, siginfo_t *info, | 515 | static void handle_signal(unsigned long sig, siginfo_t *info, |
518 | struct k_sigaction *ka, sigset_t *oldset, struct pt_regs *regs) | 516 | struct k_sigaction *ka, struct pt_regs *regs) |
519 | { | 517 | { |
518 | sigset_t *oldset = sigmask_to_save(); | ||
520 | int ret; | 519 | int ret; |
521 | struct mips_abi *abi = current->thread.abi; | 520 | struct mips_abi *abi = current->thread.abi; |
522 | void *vdso = current->mm->context.vdso; | 521 | void *vdso = current->mm->context.vdso; |
@@ -550,17 +549,14 @@ static int handle_signal(unsigned long sig, siginfo_t *info, | |||
550 | ka, regs, sig, oldset); | 549 | ka, regs, sig, oldset); |
551 | 550 | ||
552 | if (ret) | 551 | if (ret) |
553 | return ret; | 552 | return; |
554 | |||
555 | block_sigmask(ka, sig); | ||
556 | 553 | ||
557 | return ret; | 554 | signal_delivered(sig, info, ka, regs, 0); |
558 | } | 555 | } |
559 | 556 | ||
560 | static void do_signal(struct pt_regs *regs) | 557 | static void do_signal(struct pt_regs *regs) |
561 | { | 558 | { |
562 | struct k_sigaction ka; | 559 | struct k_sigaction ka; |
563 | sigset_t *oldset; | ||
564 | siginfo_t info; | 560 | siginfo_t info; |
565 | int signr; | 561 | int signr; |
566 | 562 | ||
@@ -572,25 +568,10 @@ static void do_signal(struct pt_regs *regs) | |||
572 | if (!user_mode(regs)) | 568 | if (!user_mode(regs)) |
573 | return; | 569 | return; |
574 | 570 | ||
575 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
576 | oldset = ¤t->saved_sigmask; | ||
577 | else | ||
578 | oldset = ¤t->blocked; | ||
579 | |||
580 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 571 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
581 | if (signr > 0) { | 572 | if (signr > 0) { |
582 | /* Whee! Actually deliver the signal. */ | 573 | /* Whee! Actually deliver the signal. */ |
583 | if (handle_signal(signr, &info, &ka, oldset, regs) == 0) { | 574 | handle_signal(signr, &info, &ka, regs); |
584 | /* | ||
585 | * A signal was successfully delivered; the saved | ||
586 | * sigmask will have been stored in the signal frame, | ||
587 | * and will be restored by sigreturn, so we can simply | ||
588 | * clear the TIF_RESTORE_SIGMASK flag. | ||
589 | */ | ||
590 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
591 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
592 | } | ||
593 | |||
594 | return; | 575 | return; |
595 | } | 576 | } |
596 | 577 | ||
@@ -614,10 +595,7 @@ static void do_signal(struct pt_regs *regs) | |||
614 | * If there's no signal to deliver, we just put the saved sigmask | 595 | * If there's no signal to deliver, we just put the saved sigmask |
615 | * back | 596 | * back |
616 | */ | 597 | */ |
617 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | 598 | restore_saved_sigmask(); |
618 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
619 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
620 | } | ||
621 | } | 599 | } |
622 | 600 | ||
623 | /* | 601 | /* |
@@ -630,14 +608,12 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused, | |||
630 | local_irq_enable(); | 608 | local_irq_enable(); |
631 | 609 | ||
632 | /* deal with pending signal delivery */ | 610 | /* deal with pending signal delivery */ |
633 | if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) | 611 | if (thread_info_flags & _TIF_SIGPENDING) |
634 | do_signal(regs); | 612 | do_signal(regs); |
635 | 613 | ||
636 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | 614 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { |
637 | clear_thread_flag(TIF_NOTIFY_RESUME); | 615 | clear_thread_flag(TIF_NOTIFY_RESUME); |
638 | tracehook_notify_resume(regs); | 616 | tracehook_notify_resume(regs); |
639 | if (current->replacement_session_keyring) | ||
640 | key_replace_session_keyring(); | ||
641 | } | 617 | } |
642 | } | 618 | } |
643 | 619 | ||
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c index b4fe2eacbd5d..da1b56a39ac7 100644 --- a/arch/mips/kernel/signal32.c +++ b/arch/mips/kernel/signal32.c | |||
@@ -465,7 +465,6 @@ asmlinkage void sys32_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
465 | if (__copy_conv_sigset_from_user(&blocked, &frame->sf_mask)) | 465 | if (__copy_conv_sigset_from_user(&blocked, &frame->sf_mask)) |
466 | goto badframe; | 466 | goto badframe; |
467 | 467 | ||
468 | sigdelsetmask(&blocked, ~_BLOCKABLE); | ||
469 | set_current_blocked(&blocked); | 468 | set_current_blocked(&blocked); |
470 | 469 | ||
471 | sig = restore_sigcontext32(®s, &frame->sf_sc); | 470 | sig = restore_sigcontext32(®s, &frame->sf_sc); |
@@ -503,7 +502,6 @@ asmlinkage void sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
503 | if (__copy_conv_sigset_from_user(&set, &frame->rs_uc.uc_sigmask)) | 502 | if (__copy_conv_sigset_from_user(&set, &frame->rs_uc.uc_sigmask)) |
504 | goto badframe; | 503 | goto badframe; |
505 | 504 | ||
506 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
507 | set_current_blocked(&set); | 505 | set_current_blocked(&set); |
508 | 506 | ||
509 | sig = restore_sigcontext32(®s, &frame->rs_uc.uc_mcontext); | 507 | sig = restore_sigcontext32(®s, &frame->rs_uc.uc_mcontext); |
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c index 63ffac9af7c5..3574c145511b 100644 --- a/arch/mips/kernel/signal_n32.c +++ b/arch/mips/kernel/signal_n32.c | |||
@@ -109,7 +109,6 @@ asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
109 | if (__copy_conv_sigset_from_user(&set, &frame->rs_uc.uc_sigmask)) | 109 | if (__copy_conv_sigset_from_user(&set, &frame->rs_uc.uc_sigmask)) |
110 | goto badframe; | 110 | goto badframe; |
111 | 111 | ||
112 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
113 | set_current_blocked(&set); | 112 | set_current_blocked(&set); |
114 | 113 | ||
115 | sig = restore_sigcontext(®s, &frame->rs_uc.uc_mcontext); | 114 | sig = restore_sigcontext(®s, &frame->rs_uc.uc_mcontext); |
diff --git a/arch/mn10300/include/asm/posix_types.h b/arch/mn10300/include/asm/posix_types.h index ab506181ec31..d31eeea480cf 100644 --- a/arch/mn10300/include/asm/posix_types.h +++ b/arch/mn10300/include/asm/posix_types.h | |||
@@ -20,9 +20,6 @@ | |||
20 | typedef unsigned short __kernel_mode_t; | 20 | typedef unsigned short __kernel_mode_t; |
21 | #define __kernel_mode_t __kernel_mode_t | 21 | #define __kernel_mode_t __kernel_mode_t |
22 | 22 | ||
23 | typedef unsigned short __kernel_nlink_t; | ||
24 | #define __kernel_nlink_t __kernel_nlink_t | ||
25 | |||
26 | typedef unsigned short __kernel_ipc_pid_t; | 23 | typedef unsigned short __kernel_ipc_pid_t; |
27 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t | 24 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t |
28 | 25 | ||
diff --git a/arch/mn10300/kernel/signal.c b/arch/mn10300/kernel/signal.c index 890cf91767cc..6ab0bee2a54f 100644 --- a/arch/mn10300/kernel/signal.c +++ b/arch/mn10300/kernel/signal.c | |||
@@ -31,8 +31,6 @@ | |||
31 | 31 | ||
32 | #define DEBUG_SIG 0 | 32 | #define DEBUG_SIG 0 |
33 | 33 | ||
34 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
35 | |||
36 | /* | 34 | /* |
37 | * atomically swap in the new signal mask, and wait for a signal. | 35 | * atomically swap in the new signal mask, and wait for a signal. |
38 | */ | 36 | */ |
@@ -163,7 +161,6 @@ asmlinkage long sys_sigreturn(void) | |||
163 | sizeof(frame->extramask))) | 161 | sizeof(frame->extramask))) |
164 | goto badframe; | 162 | goto badframe; |
165 | 163 | ||
166 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
167 | set_current_blocked(&set); | 164 | set_current_blocked(&set); |
168 | 165 | ||
169 | if (restore_sigcontext(current_frame(), &frame->sc, &d0)) | 166 | if (restore_sigcontext(current_frame(), &frame->sc, &d0)) |
@@ -191,7 +188,6 @@ asmlinkage long sys_rt_sigreturn(void) | |||
191 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 188 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
192 | goto badframe; | 189 | goto badframe; |
193 | 190 | ||
194 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
195 | set_current_blocked(&set); | 191 | set_current_blocked(&set); |
196 | 192 | ||
197 | if (restore_sigcontext(current_frame(), &frame->uc.uc_mcontext, &d0)) | 193 | if (restore_sigcontext(current_frame(), &frame->uc.uc_mcontext, &d0)) |
@@ -430,8 +426,9 @@ static inline void stepback(struct pt_regs *regs) | |||
430 | */ | 426 | */ |
431 | static int handle_signal(int sig, | 427 | static int handle_signal(int sig, |
432 | siginfo_t *info, struct k_sigaction *ka, | 428 | siginfo_t *info, struct k_sigaction *ka, |
433 | sigset_t *oldset, struct pt_regs *regs) | 429 | struct pt_regs *regs) |
434 | { | 430 | { |
431 | sigset_t *oldset = sigmask_to_save(); | ||
435 | int ret; | 432 | int ret; |
436 | 433 | ||
437 | /* Are we from a system call? */ | 434 | /* Are we from a system call? */ |
@@ -461,11 +458,11 @@ static int handle_signal(int sig, | |||
461 | ret = setup_rt_frame(sig, ka, info, oldset, regs); | 458 | ret = setup_rt_frame(sig, ka, info, oldset, regs); |
462 | else | 459 | else |
463 | ret = setup_frame(sig, ka, oldset, regs); | 460 | ret = setup_frame(sig, ka, oldset, regs); |
461 | if (ret) | ||
462 | return; | ||
464 | 463 | ||
465 | if (ret == 0) | 464 | signal_delivered(sig, info, ka, regs, |
466 | block_sigmask(ka, sig); | 465 | test_thread_flag(TIF_SINGLESTEP)); |
467 | |||
468 | return ret; | ||
469 | } | 466 | } |
470 | 467 | ||
471 | /* | 468 | /* |
@@ -475,7 +472,6 @@ static void do_signal(struct pt_regs *regs) | |||
475 | { | 472 | { |
476 | struct k_sigaction ka; | 473 | struct k_sigaction ka; |
477 | siginfo_t info; | 474 | siginfo_t info; |
478 | sigset_t *oldset; | ||
479 | int signr; | 475 | int signr; |
480 | 476 | ||
481 | /* we want the common case to go fast, which is why we may in certain | 477 | /* we want the common case to go fast, which is why we may in certain |
@@ -483,23 +479,9 @@ static void do_signal(struct pt_regs *regs) | |||
483 | if (!user_mode(regs)) | 479 | if (!user_mode(regs)) |
484 | return; | 480 | return; |
485 | 481 | ||
486 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
487 | oldset = ¤t->saved_sigmask; | ||
488 | else | ||
489 | oldset = ¤t->blocked; | ||
490 | |||
491 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 482 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
492 | if (signr > 0) { | 483 | if (signr > 0) { |
493 | if (handle_signal(signr, &info, &ka, oldset, regs) == 0) { | 484 | if (handle_signal(signr, &info, &ka, regs) == 0) { |
494 | /* a signal was successfully delivered; the saved | ||
495 | * sigmask will have been stored in the signal frame, | ||
496 | * and will be restored by sigreturn, so we can simply | ||
497 | * clear the TIF_RESTORE_SIGMASK flag */ | ||
498 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
499 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
500 | |||
501 | tracehook_signal_handler(signr, &info, &ka, regs, | ||
502 | test_thread_flag(TIF_SINGLESTEP)); | ||
503 | } | 485 | } |
504 | 486 | ||
505 | return; | 487 | return; |
@@ -525,10 +507,7 @@ static void do_signal(struct pt_regs *regs) | |||
525 | 507 | ||
526 | /* if there's no signal to deliver, we just put the saved sigmask | 508 | /* if there's no signal to deliver, we just put the saved sigmask |
527 | * back */ | 509 | * back */ |
528 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | 510 | restore_saved_sigmask(); |
529 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
530 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
531 | } | ||
532 | } | 511 | } |
533 | 512 | ||
534 | /* | 513 | /* |
@@ -548,13 +527,11 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, u32 thread_info_flags) | |||
548 | } | 527 | } |
549 | 528 | ||
550 | /* deal with pending signal delivery */ | 529 | /* deal with pending signal delivery */ |
551 | if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) | 530 | if (thread_info_flags & _TIF_SIGPENDING) |
552 | do_signal(regs); | 531 | do_signal(regs); |
553 | 532 | ||
554 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | 533 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { |
555 | clear_thread_flag(TIF_NOTIFY_RESUME); | 534 | clear_thread_flag(TIF_NOTIFY_RESUME); |
556 | tracehook_notify_resume(current_frame()); | 535 | tracehook_notify_resume(current_frame()); |
557 | if (current->replacement_session_keyring) | ||
558 | key_replace_session_keyring(); | ||
559 | } | 536 | } |
560 | } | 537 | } |
diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c index e970743251ae..30110297f4f9 100644 --- a/arch/openrisc/kernel/signal.c +++ b/arch/openrisc/kernel/signal.c | |||
@@ -33,8 +33,6 @@ | |||
33 | 33 | ||
34 | #define DEBUG_SIG 0 | 34 | #define DEBUG_SIG 0 |
35 | 35 | ||
36 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
37 | |||
38 | asmlinkage long | 36 | asmlinkage long |
39 | _sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs *regs) | 37 | _sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs *regs) |
40 | { | 38 | { |
@@ -101,7 +99,6 @@ asmlinkage long _sys_rt_sigreturn(struct pt_regs *regs) | |||
101 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 99 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
102 | goto badframe; | 100 | goto badframe; |
103 | 101 | ||
104 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
105 | set_current_blocked(&set); | 102 | set_current_blocked(&set); |
106 | 103 | ||
107 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) | 104 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) |
@@ -251,20 +248,19 @@ give_sigsegv: | |||
251 | return -EFAULT; | 248 | return -EFAULT; |
252 | } | 249 | } |
253 | 250 | ||
254 | static inline int | 251 | static inline void |
255 | handle_signal(unsigned long sig, | 252 | handle_signal(unsigned long sig, |
256 | siginfo_t *info, struct k_sigaction *ka, | 253 | siginfo_t *info, struct k_sigaction *ka, |
257 | sigset_t *oldset, struct pt_regs *regs) | 254 | struct pt_regs *regs) |
258 | { | 255 | { |
259 | int ret; | 256 | int ret; |
260 | 257 | ||
261 | ret = setup_rt_frame(sig, ka, info, oldset, regs); | 258 | ret = setup_rt_frame(sig, ka, info, sigmask_to_save(), regs); |
262 | if (ret) | 259 | if (ret) |
263 | return ret; | 260 | return; |
264 | |||
265 | block_sigmask(ka, sig); | ||
266 | 261 | ||
267 | return 0; | 262 | signal_delivered(sig, info, ka, regs, |
263 | test_thread_flag(TIF_SINGLESTEP)); | ||
268 | } | 264 | } |
269 | 265 | ||
270 | /* | 266 | /* |
@@ -339,30 +335,10 @@ void do_signal(struct pt_regs *regs) | |||
339 | if (signr <= 0) { | 335 | if (signr <= 0) { |
340 | /* no signal to deliver so we just put the saved sigmask | 336 | /* no signal to deliver so we just put the saved sigmask |
341 | * back */ | 337 | * back */ |
342 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | 338 | restore_saved_sigmask(); |
343 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
344 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
345 | } | ||
346 | |||
347 | } else { /* signr > 0 */ | 339 | } else { /* signr > 0 */ |
348 | sigset_t *oldset; | ||
349 | |||
350 | if (current_thread_info()->flags & _TIF_RESTORE_SIGMASK) | ||
351 | oldset = ¤t->saved_sigmask; | ||
352 | else | ||
353 | oldset = ¤t->blocked; | ||
354 | |||
355 | /* Whee! Actually deliver the signal. */ | 340 | /* Whee! Actually deliver the signal. */ |
356 | if (!handle_signal(signr, &info, &ka, oldset, regs)) { | 341 | handle_signal(signr, &info, &ka, regs); |
357 | /* a signal was successfully delivered; the saved | ||
358 | * sigmask will have been stored in the signal frame, | ||
359 | * and will be restored by sigreturn, so we can simply | ||
360 | * clear the TIF_RESTORE_SIGMASK flag */ | ||
361 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
362 | } | ||
363 | |||
364 | tracehook_signal_handler(signr, &info, &ka, regs, | ||
365 | test_thread_flag(TIF_SINGLESTEP)); | ||
366 | } | 342 | } |
367 | 343 | ||
368 | return; | 344 | return; |
@@ -376,7 +352,5 @@ asmlinkage void do_notify_resume(struct pt_regs *regs) | |||
376 | if (current_thread_info()->flags & _TIF_NOTIFY_RESUME) { | 352 | if (current_thread_info()->flags & _TIF_NOTIFY_RESUME) { |
377 | clear_thread_flag(TIF_NOTIFY_RESUME); | 353 | clear_thread_flag(TIF_NOTIFY_RESUME); |
378 | tracehook_notify_resume(regs); | 354 | tracehook_notify_resume(regs); |
379 | if (current->replacement_session_keyring) | ||
380 | key_replace_session_keyring(); | ||
381 | } | 355 | } |
382 | } | 356 | } |
diff --git a/arch/parisc/include/asm/posix_types.h b/arch/parisc/include/asm/posix_types.h index 5212b0357daf..b9344256f76b 100644 --- a/arch/parisc/include/asm/posix_types.h +++ b/arch/parisc/include/asm/posix_types.h | |||
@@ -10,9 +10,6 @@ | |||
10 | typedef unsigned short __kernel_mode_t; | 10 | typedef unsigned short __kernel_mode_t; |
11 | #define __kernel_mode_t __kernel_mode_t | 11 | #define __kernel_mode_t __kernel_mode_t |
12 | 12 | ||
13 | typedef unsigned short __kernel_nlink_t; | ||
14 | #define __kernel_nlink_t __kernel_nlink_t | ||
15 | |||
16 | typedef unsigned short __kernel_ipc_pid_t; | 13 | typedef unsigned short __kernel_ipc_pid_t; |
17 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t | 14 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t |
18 | 15 | ||
diff --git a/arch/parisc/include/asm/stat.h b/arch/parisc/include/asm/stat.h index 9d5fbbc5c31f..d76fbda5d62c 100644 --- a/arch/parisc/include/asm/stat.h +++ b/arch/parisc/include/asm/stat.h | |||
@@ -7,7 +7,7 @@ struct stat { | |||
7 | unsigned int st_dev; /* dev_t is 32 bits on parisc */ | 7 | unsigned int st_dev; /* dev_t is 32 bits on parisc */ |
8 | ino_t st_ino; /* 32 bits */ | 8 | ino_t st_ino; /* 32 bits */ |
9 | mode_t st_mode; /* 16 bits */ | 9 | mode_t st_mode; /* 16 bits */ |
10 | nlink_t st_nlink; /* 16 bits */ | 10 | unsigned short st_nlink; /* 16 bits */ |
11 | unsigned short st_reserved1; /* old st_uid */ | 11 | unsigned short st_reserved1; /* old st_uid */ |
12 | unsigned short st_reserved2; /* old st_gid */ | 12 | unsigned short st_reserved2; /* old st_gid */ |
13 | unsigned int st_rdev; | 13 | unsigned int st_rdev; |
@@ -42,7 +42,7 @@ struct hpux_stat64 { | |||
42 | unsigned int st_dev; /* dev_t is 32 bits on parisc */ | 42 | unsigned int st_dev; /* dev_t is 32 bits on parisc */ |
43 | ino_t st_ino; /* 32 bits */ | 43 | ino_t st_ino; /* 32 bits */ |
44 | mode_t st_mode; /* 16 bits */ | 44 | mode_t st_mode; /* 16 bits */ |
45 | nlink_t st_nlink; /* 16 bits */ | 45 | unsigned short st_nlink; /* 16 bits */ |
46 | unsigned short st_reserved1; /* old st_uid */ | 46 | unsigned short st_reserved1; /* old st_uid */ |
47 | unsigned short st_reserved2; /* old st_gid */ | 47 | unsigned short st_reserved2; /* old st_gid */ |
48 | unsigned int st_rdev; | 48 | unsigned int st_rdev; |
diff --git a/arch/parisc/include/asm/thread_info.h b/arch/parisc/include/asm/thread_info.h index 83ae7dd4d99e..22b4726dee49 100644 --- a/arch/parisc/include/asm/thread_info.h +++ b/arch/parisc/include/asm/thread_info.h | |||
@@ -74,7 +74,7 @@ struct thread_info { | |||
74 | #define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP) | 74 | #define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP) |
75 | 75 | ||
76 | #define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \ | 76 | #define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \ |
77 | _TIF_NEED_RESCHED | _TIF_RESTORE_SIGMASK) | 77 | _TIF_NEED_RESCHED) |
78 | 78 | ||
79 | #endif /* __KERNEL__ */ | 79 | #endif /* __KERNEL__ */ |
80 | 80 | ||
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S index 07ef351edd57..18670a078849 100644 --- a/arch/parisc/kernel/entry.S +++ b/arch/parisc/kernel/entry.S | |||
@@ -924,7 +924,7 @@ intr_check_sig: | |||
924 | /* As above */ | 924 | /* As above */ |
925 | mfctl %cr30,%r1 | 925 | mfctl %cr30,%r1 |
926 | LDREG TI_FLAGS(%r1),%r19 | 926 | LDREG TI_FLAGS(%r1),%r19 |
927 | ldi (_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK|_TIF_NOTIFY_RESUME), %r20 | 927 | ldi (_TIF_SIGPENDING|_TIF_NOTIFY_RESUME), %r20 |
928 | and,COND(<>) %r19, %r20, %r0 | 928 | and,COND(<>) %r19, %r20, %r0 |
929 | b,n intr_restore /* skip past if we've nothing to do */ | 929 | b,n intr_restore /* skip past if we've nothing to do */ |
930 | 930 | ||
@@ -2032,7 +2032,7 @@ syscall_check_resched: | |||
2032 | .import do_signal,code | 2032 | .import do_signal,code |
2033 | syscall_check_sig: | 2033 | syscall_check_sig: |
2034 | LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19 | 2034 | LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19 |
2035 | ldi (_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK), %r26 | 2035 | ldi (_TIF_SIGPENDING|_TIF_NOTIFY_RESUME), %r26 |
2036 | and,COND(<>) %r19, %r26, %r0 | 2036 | and,COND(<>) %r19, %r26, %r0 |
2037 | b,n syscall_restore /* skip past if we've nothing to do */ | 2037 | b,n syscall_restore /* skip past if we've nothing to do */ |
2038 | 2038 | ||
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c index 4b9cb0d546d1..594459bde14e 100644 --- a/arch/parisc/kernel/signal.c +++ b/arch/parisc/kernel/signal.c | |||
@@ -48,9 +48,6 @@ | |||
48 | #define DBG(LEVEL, ...) | 48 | #define DBG(LEVEL, ...) |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | |||
52 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
53 | |||
54 | /* gcc will complain if a pointer is cast to an integer of different | 51 | /* gcc will complain if a pointer is cast to an integer of different |
55 | * size. If you really need to do this (and we do for an ELF32 user | 52 | * size. If you really need to do this (and we do for an ELF32 user |
56 | * application in an ELF64 kernel) then you have to do a cast to an | 53 | * application in an ELF64 kernel) then you have to do a cast to an |
@@ -131,7 +128,6 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall) | |||
131 | goto give_sigsegv; | 128 | goto give_sigsegv; |
132 | } | 129 | } |
133 | 130 | ||
134 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
135 | set_current_blocked(&set); | 131 | set_current_blocked(&set); |
136 | 132 | ||
137 | /* Good thing we saved the old gr[30], eh? */ | 133 | /* Good thing we saved the old gr[30], eh? */ |
@@ -443,8 +439,9 @@ give_sigsegv: | |||
443 | 439 | ||
444 | static long | 440 | static long |
445 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | 441 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, |
446 | sigset_t *oldset, struct pt_regs *regs, int in_syscall) | 442 | struct pt_regs *regs, int in_syscall) |
447 | { | 443 | { |
444 | sigset_t *oldset = sigmask_to_save(); | ||
448 | DBG(1,"handle_signal: sig=%ld, ka=%p, info=%p, oldset=%p, regs=%p\n", | 445 | DBG(1,"handle_signal: sig=%ld, ka=%p, info=%p, oldset=%p, regs=%p\n", |
449 | sig, ka, info, oldset, regs); | 446 | sig, ka, info, oldset, regs); |
450 | 447 | ||
@@ -452,12 +449,13 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
452 | if (!setup_rt_frame(sig, ka, info, oldset, regs, in_syscall)) | 449 | if (!setup_rt_frame(sig, ka, info, oldset, regs, in_syscall)) |
453 | return 0; | 450 | return 0; |
454 | 451 | ||
455 | block_sigmask(ka, sig); | 452 | signal_delivered(sig, info, ka, regs, |
456 | |||
457 | tracehook_signal_handler(sig, info, ka, regs, | ||
458 | test_thread_flag(TIF_SINGLESTEP) || | 453 | test_thread_flag(TIF_SINGLESTEP) || |
459 | test_thread_flag(TIF_BLOCKSTEP)); | 454 | test_thread_flag(TIF_BLOCKSTEP)); |
460 | 455 | ||
456 | DBG(1,KERN_DEBUG "do_signal: Exit (success), regs->gr[28] = %ld\n", | ||
457 | regs->gr[28]); | ||
458 | |||
461 | return 1; | 459 | return 1; |
462 | } | 460 | } |
463 | 461 | ||
@@ -568,28 +566,17 @@ do_signal(struct pt_regs *regs, long in_syscall) | |||
568 | siginfo_t info; | 566 | siginfo_t info; |
569 | struct k_sigaction ka; | 567 | struct k_sigaction ka; |
570 | int signr; | 568 | int signr; |
571 | sigset_t *oldset; | ||
572 | 569 | ||
573 | DBG(1,"\ndo_signal: oldset=0x%p, regs=0x%p, sr7 %#lx, in_syscall=%d\n", | 570 | DBG(1,"\ndo_signal: regs=0x%p, sr7 %#lx, in_syscall=%d\n", |
574 | oldset, regs, regs->sr[7], in_syscall); | 571 | regs, regs->sr[7], in_syscall); |
575 | 572 | ||
576 | /* Everyone else checks to see if they are in kernel mode at | 573 | /* Everyone else checks to see if they are in kernel mode at |
577 | this point and exits if that's the case. I'm not sure why | 574 | this point and exits if that's the case. I'm not sure why |
578 | we would be called in that case, but for some reason we | 575 | we would be called in that case, but for some reason we |
579 | are. */ | 576 | are. */ |
580 | 577 | ||
581 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
582 | oldset = ¤t->saved_sigmask; | ||
583 | else | ||
584 | oldset = ¤t->blocked; | ||
585 | |||
586 | DBG(1,"do_signal: oldset %08lx / %08lx\n", | ||
587 | oldset->sig[0], oldset->sig[1]); | ||
588 | |||
589 | |||
590 | /* May need to force signal if handle_signal failed to deliver */ | 578 | /* May need to force signal if handle_signal failed to deliver */ |
591 | while (1) { | 579 | while (1) { |
592 | |||
593 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 580 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
594 | DBG(3,"do_signal: signr = %d, regs->gr[28] = %ld\n", signr, regs->gr[28]); | 581 | DBG(3,"do_signal: signr = %d, regs->gr[28] = %ld\n", signr, regs->gr[28]); |
595 | 582 | ||
@@ -603,14 +590,8 @@ do_signal(struct pt_regs *regs, long in_syscall) | |||
603 | /* Whee! Actually deliver the signal. If the | 590 | /* Whee! Actually deliver the signal. If the |
604 | delivery failed, we need to continue to iterate in | 591 | delivery failed, we need to continue to iterate in |
605 | this loop so we can deliver the SIGSEGV... */ | 592 | this loop so we can deliver the SIGSEGV... */ |
606 | if (handle_signal(signr, &info, &ka, oldset, | 593 | if (handle_signal(signr, &info, &ka, regs, in_syscall)) |
607 | regs, in_syscall)) { | ||
608 | DBG(1,KERN_DEBUG "do_signal: Exit (success), regs->gr[28] = %ld\n", | ||
609 | regs->gr[28]); | ||
610 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
611 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
612 | return; | 594 | return; |
613 | } | ||
614 | } | 595 | } |
615 | /* end of while(1) looping forever if we can't force a signal */ | 596 | /* end of while(1) looping forever if we can't force a signal */ |
616 | 597 | ||
@@ -621,24 +602,16 @@ do_signal(struct pt_regs *regs, long in_syscall) | |||
621 | DBG(1,"do_signal: Exit (not delivered), regs->gr[28] = %ld\n", | 602 | DBG(1,"do_signal: Exit (not delivered), regs->gr[28] = %ld\n", |
622 | regs->gr[28]); | 603 | regs->gr[28]); |
623 | 604 | ||
624 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | 605 | restore_saved_sigmask(); |
625 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
626 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
627 | } | ||
628 | |||
629 | return; | ||
630 | } | 606 | } |
631 | 607 | ||
632 | void do_notify_resume(struct pt_regs *regs, long in_syscall) | 608 | void do_notify_resume(struct pt_regs *regs, long in_syscall) |
633 | { | 609 | { |
634 | if (test_thread_flag(TIF_SIGPENDING) || | 610 | if (test_thread_flag(TIF_SIGPENDING)) |
635 | test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
636 | do_signal(regs, in_syscall); | 611 | do_signal(regs, in_syscall); |
637 | 612 | ||
638 | if (test_thread_flag(TIF_NOTIFY_RESUME)) { | 613 | if (test_thread_flag(TIF_NOTIFY_RESUME)) { |
639 | clear_thread_flag(TIF_NOTIFY_RESUME); | 614 | clear_thread_flag(TIF_NOTIFY_RESUME); |
640 | tracehook_notify_resume(regs); | 615 | tracehook_notify_resume(regs); |
641 | if (current->replacement_session_keyring) | ||
642 | key_replace_session_keyring(); | ||
643 | } | 616 | } |
644 | } | 617 | } |
diff --git a/arch/parisc/kernel/signal32.c b/arch/parisc/kernel/signal32.c index e14132430762..fd49aeda9eb8 100644 --- a/arch/parisc/kernel/signal32.c +++ b/arch/parisc/kernel/signal32.c | |||
@@ -47,8 +47,6 @@ | |||
47 | #define DBG(LEVEL, ...) | 47 | #define DBG(LEVEL, ...) |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
51 | |||
52 | inline void | 50 | inline void |
53 | sigset_32to64(sigset_t *s64, compat_sigset_t *s32) | 51 | sigset_32to64(sigset_t *s64, compat_sigset_t *s32) |
54 | { | 52 | { |
diff --git a/arch/powerpc/include/asm/posix_types.h b/arch/powerpc/include/asm/posix_types.h index f1393252bbda..2958c5b97b2d 100644 --- a/arch/powerpc/include/asm/posix_types.h +++ b/arch/powerpc/include/asm/posix_types.h | |||
@@ -16,9 +16,6 @@ typedef int __kernel_ssize_t; | |||
16 | typedef long __kernel_ptrdiff_t; | 16 | typedef long __kernel_ptrdiff_t; |
17 | #define __kernel_size_t __kernel_size_t | 17 | #define __kernel_size_t __kernel_size_t |
18 | 18 | ||
19 | typedef unsigned short __kernel_nlink_t; | ||
20 | #define __kernel_nlink_t __kernel_nlink_t | ||
21 | |||
22 | typedef short __kernel_ipc_pid_t; | 19 | typedef short __kernel_ipc_pid_t; |
23 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t | 20 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t |
24 | #endif | 21 | #endif |
diff --git a/arch/powerpc/include/asm/stat.h b/arch/powerpc/include/asm/stat.h index e4edc510b530..10cfb558e0fd 100644 --- a/arch/powerpc/include/asm/stat.h +++ b/arch/powerpc/include/asm/stat.h | |||
@@ -30,11 +30,11 @@ struct stat { | |||
30 | unsigned long st_dev; | 30 | unsigned long st_dev; |
31 | ino_t st_ino; | 31 | ino_t st_ino; |
32 | #ifdef __powerpc64__ | 32 | #ifdef __powerpc64__ |
33 | nlink_t st_nlink; | 33 | unsigned short st_nlink; |
34 | mode_t st_mode; | 34 | mode_t st_mode; |
35 | #else | 35 | #else |
36 | mode_t st_mode; | 36 | mode_t st_mode; |
37 | nlink_t st_nlink; | 37 | unsigned short st_nlink; |
38 | #endif | 38 | #endif |
39 | uid_t st_uid; | 39 | uid_t st_uid; |
40 | gid_t st_gid; | 40 | gid_t st_gid; |
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h index a556ccc16b58..68831e9cf82f 100644 --- a/arch/powerpc/include/asm/thread_info.h +++ b/arch/powerpc/include/asm/thread_info.h | |||
@@ -140,7 +140,23 @@ static inline void set_restore_sigmask(void) | |||
140 | { | 140 | { |
141 | struct thread_info *ti = current_thread_info(); | 141 | struct thread_info *ti = current_thread_info(); |
142 | ti->local_flags |= _TLF_RESTORE_SIGMASK; | 142 | ti->local_flags |= _TLF_RESTORE_SIGMASK; |
143 | set_bit(TIF_SIGPENDING, &ti->flags); | 143 | WARN_ON(!test_bit(TIF_SIGPENDING, &ti->flags)); |
144 | } | ||
145 | static inline void clear_restore_sigmask(void) | ||
146 | { | ||
147 | current_thread_info()->local_flags &= ~_TLF_RESTORE_SIGMASK; | ||
148 | } | ||
149 | static inline bool test_restore_sigmask(void) | ||
150 | { | ||
151 | return current_thread_info()->local_flags & _TLF_RESTORE_SIGMASK; | ||
152 | } | ||
153 | static inline bool test_and_clear_restore_sigmask(void) | ||
154 | { | ||
155 | struct thread_info *ti = current_thread_info(); | ||
156 | if (!(ti->local_flags & _TLF_RESTORE_SIGMASK)) | ||
157 | return false; | ||
158 | ti->local_flags &= ~_TLF_RESTORE_SIGMASK; | ||
159 | return true; | ||
144 | } | 160 | } |
145 | 161 | ||
146 | static inline bool test_thread_local_flags(unsigned int flags) | 162 | static inline bool test_thread_local_flags(unsigned int flags) |
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c index 651c5963662b..5c023c9cf16e 100644 --- a/arch/powerpc/kernel/signal.c +++ b/arch/powerpc/kernel/signal.c | |||
@@ -51,16 +51,6 @@ void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, | |||
51 | return (void __user *)newsp; | 51 | return (void __user *)newsp; |
52 | } | 52 | } |
53 | 53 | ||
54 | |||
55 | /* | ||
56 | * Restore the user process's signal mask | ||
57 | */ | ||
58 | void restore_sigmask(sigset_t *set) | ||
59 | { | ||
60 | sigdelsetmask(set, ~_BLOCKABLE); | ||
61 | set_current_blocked(set); | ||
62 | } | ||
63 | |||
64 | static void check_syscall_restart(struct pt_regs *regs, struct k_sigaction *ka, | 54 | static void check_syscall_restart(struct pt_regs *regs, struct k_sigaction *ka, |
65 | int has_handler) | 55 | int has_handler) |
66 | { | 56 | { |
@@ -114,30 +104,21 @@ static void check_syscall_restart(struct pt_regs *regs, struct k_sigaction *ka, | |||
114 | 104 | ||
115 | static int do_signal(struct pt_regs *regs) | 105 | static int do_signal(struct pt_regs *regs) |
116 | { | 106 | { |
117 | sigset_t *oldset; | 107 | sigset_t *oldset = sigmask_to_save(); |
118 | siginfo_t info; | 108 | siginfo_t info; |
119 | int signr; | 109 | int signr; |
120 | struct k_sigaction ka; | 110 | struct k_sigaction ka; |
121 | int ret; | 111 | int ret; |
122 | int is32 = is_32bit_task(); | 112 | int is32 = is_32bit_task(); |
123 | 113 | ||
124 | if (current_thread_info()->local_flags & _TLF_RESTORE_SIGMASK) | ||
125 | oldset = ¤t->saved_sigmask; | ||
126 | else | ||
127 | oldset = ¤t->blocked; | ||
128 | |||
129 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 114 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
130 | 115 | ||
131 | /* Is there any syscall restart business here ? */ | 116 | /* Is there any syscall restart business here ? */ |
132 | check_syscall_restart(regs, &ka, signr > 0); | 117 | check_syscall_restart(regs, &ka, signr > 0); |
133 | 118 | ||
134 | if (signr <= 0) { | 119 | if (signr <= 0) { |
135 | struct thread_info *ti = current_thread_info(); | ||
136 | /* No signal to deliver -- put the saved sigmask back */ | 120 | /* No signal to deliver -- put the saved sigmask back */ |
137 | if (ti->local_flags & _TLF_RESTORE_SIGMASK) { | 121 | restore_saved_sigmask(); |
138 | ti->local_flags &= ~_TLF_RESTORE_SIGMASK; | ||
139 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
140 | } | ||
141 | regs->trap = 0; | 122 | regs->trap = 0; |
142 | return 0; /* no signals delivered */ | 123 | return 0; /* no signals delivered */ |
143 | } | 124 | } |
@@ -167,18 +148,7 @@ static int do_signal(struct pt_regs *regs) | |||
167 | 148 | ||
168 | regs->trap = 0; | 149 | regs->trap = 0; |
169 | if (ret) { | 150 | if (ret) { |
170 | block_sigmask(&ka, signr); | 151 | signal_delivered(signr, &info, &ka, regs, |
171 | |||
172 | /* | ||
173 | * A signal was successfully delivered; the saved sigmask is in | ||
174 | * its frame, and we can clear the TLF_RESTORE_SIGMASK flag. | ||
175 | */ | ||
176 | current_thread_info()->local_flags &= ~_TLF_RESTORE_SIGMASK; | ||
177 | |||
178 | /* | ||
179 | * Let tracing know that we've done the handler setup. | ||
180 | */ | ||
181 | tracehook_signal_handler(signr, &info, &ka, regs, | ||
182 | test_thread_flag(TIF_SINGLESTEP)); | 152 | test_thread_flag(TIF_SINGLESTEP)); |
183 | } | 153 | } |
184 | 154 | ||
@@ -193,8 +163,6 @@ void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) | |||
193 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | 163 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { |
194 | clear_thread_flag(TIF_NOTIFY_RESUME); | 164 | clear_thread_flag(TIF_NOTIFY_RESUME); |
195 | tracehook_notify_resume(regs); | 165 | tracehook_notify_resume(regs); |
196 | if (current->replacement_session_keyring) | ||
197 | key_replace_session_keyring(); | ||
198 | } | 166 | } |
199 | } | 167 | } |
200 | 168 | ||
diff --git a/arch/powerpc/kernel/signal.h b/arch/powerpc/kernel/signal.h index 8dde973aaaf5..e00acb413934 100644 --- a/arch/powerpc/kernel/signal.h +++ b/arch/powerpc/kernel/signal.h | |||
@@ -10,13 +10,10 @@ | |||
10 | #ifndef _POWERPC_ARCH_SIGNAL_H | 10 | #ifndef _POWERPC_ARCH_SIGNAL_H |
11 | #define _POWERPC_ARCH_SIGNAL_H | 11 | #define _POWERPC_ARCH_SIGNAL_H |
12 | 12 | ||
13 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
14 | |||
15 | extern void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags); | 13 | extern void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags); |
16 | 14 | ||
17 | extern void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, | 15 | extern void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, |
18 | size_t frame_size, int is_32); | 16 | size_t frame_size, int is_32); |
19 | extern void restore_sigmask(sigset_t *set); | ||
20 | 17 | ||
21 | extern int handle_signal32(unsigned long sig, struct k_sigaction *ka, | 18 | extern int handle_signal32(unsigned long sig, struct k_sigaction *ka, |
22 | siginfo_t *info, sigset_t *oldset, | 19 | siginfo_t *info, sigset_t *oldset, |
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c index 61f6aff25edc..8b4c049aee20 100644 --- a/arch/powerpc/kernel/signal_32.c +++ b/arch/powerpc/kernel/signal_32.c | |||
@@ -919,7 +919,7 @@ static int do_setcontext(struct ucontext __user *ucp, struct pt_regs *regs, int | |||
919 | if (!access_ok(VERIFY_READ, mcp, sizeof(*mcp))) | 919 | if (!access_ok(VERIFY_READ, mcp, sizeof(*mcp))) |
920 | return -EFAULT; | 920 | return -EFAULT; |
921 | #endif | 921 | #endif |
922 | restore_sigmask(&set); | 922 | set_current_blocked(&set); |
923 | if (restore_user_regs(regs, mcp, sig)) | 923 | if (restore_user_regs(regs, mcp, sig)) |
924 | return -EFAULT; | 924 | return -EFAULT; |
925 | 925 | ||
@@ -1273,7 +1273,7 @@ long sys_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8, | |||
1273 | set.sig[0] = sigctx.oldmask; | 1273 | set.sig[0] = sigctx.oldmask; |
1274 | set.sig[1] = sigctx._unused[3]; | 1274 | set.sig[1] = sigctx._unused[3]; |
1275 | #endif | 1275 | #endif |
1276 | restore_sigmask(&set); | 1276 | set_current_blocked(&set); |
1277 | 1277 | ||
1278 | sr = (struct mcontext __user *)from_user_ptr(sigctx.regs); | 1278 | sr = (struct mcontext __user *)from_user_ptr(sigctx.regs); |
1279 | addr = sr; | 1279 | addr = sr; |
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c index 2692efdb154e..d183f8719a50 100644 --- a/arch/powerpc/kernel/signal_64.c +++ b/arch/powerpc/kernel/signal_64.c | |||
@@ -335,7 +335,7 @@ int sys_swapcontext(struct ucontext __user *old_ctx, | |||
335 | 335 | ||
336 | if (__copy_from_user(&set, &new_ctx->uc_sigmask, sizeof(set))) | 336 | if (__copy_from_user(&set, &new_ctx->uc_sigmask, sizeof(set))) |
337 | do_exit(SIGSEGV); | 337 | do_exit(SIGSEGV); |
338 | restore_sigmask(&set); | 338 | set_current_blocked(&set); |
339 | if (restore_sigcontext(regs, NULL, 0, &new_ctx->uc_mcontext)) | 339 | if (restore_sigcontext(regs, NULL, 0, &new_ctx->uc_mcontext)) |
340 | do_exit(SIGSEGV); | 340 | do_exit(SIGSEGV); |
341 | 341 | ||
@@ -364,7 +364,7 @@ int sys_rt_sigreturn(unsigned long r3, unsigned long r4, unsigned long r5, | |||
364 | 364 | ||
365 | if (__copy_from_user(&set, &uc->uc_sigmask, sizeof(set))) | 365 | if (__copy_from_user(&set, &uc->uc_sigmask, sizeof(set))) |
366 | goto badframe; | 366 | goto badframe; |
367 | restore_sigmask(&set); | 367 | set_current_blocked(&set); |
368 | if (restore_sigcontext(regs, NULL, 1, &uc->uc_mcontext)) | 368 | if (restore_sigcontext(regs, NULL, 1, &uc->uc_mcontext)) |
369 | goto badframe; | 369 | goto badframe; |
370 | 370 | ||
diff --git a/arch/powerpc/mm/mmu_context_nohash.c b/arch/powerpc/mm/mmu_context_nohash.c index 5b63bd3da4a9..e779642c25e5 100644 --- a/arch/powerpc/mm/mmu_context_nohash.c +++ b/arch/powerpc/mm/mmu_context_nohash.c | |||
@@ -333,9 +333,7 @@ static int __cpuinit mmu_context_cpu_notify(struct notifier_block *self, | |||
333 | unsigned long action, void *hcpu) | 333 | unsigned long action, void *hcpu) |
334 | { | 334 | { |
335 | unsigned int cpu = (unsigned int)(long)hcpu; | 335 | unsigned int cpu = (unsigned int)(long)hcpu; |
336 | #ifdef CONFIG_HOTPLUG_CPU | 336 | |
337 | struct task_struct *p; | ||
338 | #endif | ||
339 | /* We don't touch CPU 0 map, it's allocated at aboot and kept | 337 | /* We don't touch CPU 0 map, it's allocated at aboot and kept |
340 | * around forever | 338 | * around forever |
341 | */ | 339 | */ |
@@ -358,12 +356,7 @@ static int __cpuinit mmu_context_cpu_notify(struct notifier_block *self, | |||
358 | stale_map[cpu] = NULL; | 356 | stale_map[cpu] = NULL; |
359 | 357 | ||
360 | /* We also clear the cpu_vm_mask bits of CPUs going away */ | 358 | /* We also clear the cpu_vm_mask bits of CPUs going away */ |
361 | read_lock(&tasklist_lock); | 359 | clear_tasks_mm_cpumask(cpu); |
362 | for_each_process(p) { | ||
363 | if (p->mm) | ||
364 | cpumask_clear_cpu(cpu, mm_cpumask(p->mm)); | ||
365 | } | ||
366 | read_unlock(&tasklist_lock); | ||
367 | break; | 360 | break; |
368 | #endif /* CONFIG_HOTPLUG_CPU */ | 361 | #endif /* CONFIG_HOTPLUG_CPU */ |
369 | } | 362 | } |
diff --git a/arch/s390/include/asm/posix_types.h b/arch/s390/include/asm/posix_types.h index edf8527ff08d..7be104c0f192 100644 --- a/arch/s390/include/asm/posix_types.h +++ b/arch/s390/include/asm/posix_types.h | |||
@@ -24,7 +24,6 @@ typedef unsigned short __kernel_old_dev_t; | |||
24 | 24 | ||
25 | typedef unsigned long __kernel_ino_t; | 25 | typedef unsigned long __kernel_ino_t; |
26 | typedef unsigned short __kernel_mode_t; | 26 | typedef unsigned short __kernel_mode_t; |
27 | typedef unsigned short __kernel_nlink_t; | ||
28 | typedef unsigned short __kernel_ipc_pid_t; | 27 | typedef unsigned short __kernel_ipc_pid_t; |
29 | typedef unsigned short __kernel_uid_t; | 28 | typedef unsigned short __kernel_uid_t; |
30 | typedef unsigned short __kernel_gid_t; | 29 | typedef unsigned short __kernel_gid_t; |
@@ -35,7 +34,6 @@ typedef int __kernel_ptrdiff_t; | |||
35 | 34 | ||
36 | typedef unsigned int __kernel_ino_t; | 35 | typedef unsigned int __kernel_ino_t; |
37 | typedef unsigned int __kernel_mode_t; | 36 | typedef unsigned int __kernel_mode_t; |
38 | typedef unsigned int __kernel_nlink_t; | ||
39 | typedef int __kernel_ipc_pid_t; | 37 | typedef int __kernel_ipc_pid_t; |
40 | typedef unsigned int __kernel_uid_t; | 38 | typedef unsigned int __kernel_uid_t; |
41 | typedef unsigned int __kernel_gid_t; | 39 | typedef unsigned int __kernel_gid_t; |
@@ -47,7 +45,6 @@ typedef unsigned long __kernel_sigset_t; /* at least 32 bits */ | |||
47 | 45 | ||
48 | #define __kernel_ino_t __kernel_ino_t | 46 | #define __kernel_ino_t __kernel_ino_t |
49 | #define __kernel_mode_t __kernel_mode_t | 47 | #define __kernel_mode_t __kernel_mode_t |
50 | #define __kernel_nlink_t __kernel_nlink_t | ||
51 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t | 48 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t |
52 | #define __kernel_uid_t __kernel_uid_t | 49 | #define __kernel_uid_t __kernel_uid_t |
53 | #define __kernel_gid_t __kernel_gid_t | 50 | #define __kernel_gid_t __kernel_gid_t |
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c index 377c096ca4a7..3c0c19830c37 100644 --- a/arch/s390/kernel/compat_signal.c +++ b/arch/s390/kernel/compat_signal.c | |||
@@ -32,8 +32,6 @@ | |||
32 | #include "compat_ptrace.h" | 32 | #include "compat_ptrace.h" |
33 | #include "entry.h" | 33 | #include "entry.h" |
34 | 34 | ||
35 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
36 | |||
37 | typedef struct | 35 | typedef struct |
38 | { | 36 | { |
39 | __u8 callee_used_stack[__SIGNAL_FRAMESIZE32]; | 37 | __u8 callee_used_stack[__SIGNAL_FRAMESIZE32]; |
@@ -364,7 +362,6 @@ asmlinkage long sys32_sigreturn(void) | |||
364 | goto badframe; | 362 | goto badframe; |
365 | if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE32)) | 363 | if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE32)) |
366 | goto badframe; | 364 | goto badframe; |
367 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
368 | set_current_blocked(&set); | 365 | set_current_blocked(&set); |
369 | if (restore_sigregs32(regs, &frame->sregs)) | 366 | if (restore_sigregs32(regs, &frame->sregs)) |
370 | goto badframe; | 367 | goto badframe; |
@@ -390,7 +387,6 @@ asmlinkage long sys32_rt_sigreturn(void) | |||
390 | goto badframe; | 387 | goto badframe; |
391 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 388 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
392 | goto badframe; | 389 | goto badframe; |
393 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
394 | set_current_blocked(&set); | 390 | set_current_blocked(&set); |
395 | if (restore_sigregs32(regs, &frame->uc.uc_mcontext)) | 391 | if (restore_sigregs32(regs, &frame->uc.uc_mcontext)) |
396 | goto badframe; | 392 | goto badframe; |
@@ -572,7 +568,7 @@ give_sigsegv: | |||
572 | * OK, we're invoking a handler | 568 | * OK, we're invoking a handler |
573 | */ | 569 | */ |
574 | 570 | ||
575 | int handle_signal32(unsigned long sig, struct k_sigaction *ka, | 571 | void handle_signal32(unsigned long sig, struct k_sigaction *ka, |
576 | siginfo_t *info, sigset_t *oldset, struct pt_regs *regs) | 572 | siginfo_t *info, sigset_t *oldset, struct pt_regs *regs) |
577 | { | 573 | { |
578 | int ret; | 574 | int ret; |
@@ -583,8 +579,8 @@ int handle_signal32(unsigned long sig, struct k_sigaction *ka, | |||
583 | else | 579 | else |
584 | ret = setup_frame32(sig, ka, oldset, regs); | 580 | ret = setup_frame32(sig, ka, oldset, regs); |
585 | if (ret) | 581 | if (ret) |
586 | return ret; | 582 | return; |
587 | block_sigmask(ka, sig); | 583 | signal_delivered(sig, info, ka, regs, |
588 | return 0; | 584 | test_thread_flag(TIF_SINGLE_STEP)); |
589 | } | 585 | } |
590 | 586 | ||
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h index 6cdddac93a2e..f66a229ab0b3 100644 --- a/arch/s390/kernel/entry.h +++ b/arch/s390/kernel/entry.h | |||
@@ -31,7 +31,7 @@ void do_per_trap(struct pt_regs *regs); | |||
31 | void syscall_trace(struct pt_regs *regs, int entryexit); | 31 | void syscall_trace(struct pt_regs *regs, int entryexit); |
32 | void kernel_stack_overflow(struct pt_regs * regs); | 32 | void kernel_stack_overflow(struct pt_regs * regs); |
33 | void do_signal(struct pt_regs *regs); | 33 | void do_signal(struct pt_regs *regs); |
34 | int handle_signal32(unsigned long sig, struct k_sigaction *ka, | 34 | void handle_signal32(unsigned long sig, struct k_sigaction *ka, |
35 | siginfo_t *info, sigset_t *oldset, struct pt_regs *regs); | 35 | siginfo_t *info, sigset_t *oldset, struct pt_regs *regs); |
36 | void do_notify_resume(struct pt_regs *regs); | 36 | void do_notify_resume(struct pt_regs *regs); |
37 | 37 | ||
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c index f626232e216c..ac565b44aabb 100644 --- a/arch/s390/kernel/signal.c +++ b/arch/s390/kernel/signal.c | |||
@@ -33,9 +33,6 @@ | |||
33 | #include <asm/switch_to.h> | 33 | #include <asm/switch_to.h> |
34 | #include "entry.h" | 34 | #include "entry.h" |
35 | 35 | ||
36 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
37 | |||
38 | |||
39 | typedef struct | 36 | typedef struct |
40 | { | 37 | { |
41 | __u8 callee_used_stack[__SIGNAL_FRAMESIZE]; | 38 | __u8 callee_used_stack[__SIGNAL_FRAMESIZE]; |
@@ -169,7 +166,6 @@ SYSCALL_DEFINE0(sigreturn) | |||
169 | goto badframe; | 166 | goto badframe; |
170 | if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE)) | 167 | if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE)) |
171 | goto badframe; | 168 | goto badframe; |
172 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
173 | set_current_blocked(&set); | 169 | set_current_blocked(&set); |
174 | if (restore_sigregs(regs, &frame->sregs)) | 170 | if (restore_sigregs(regs, &frame->sregs)) |
175 | goto badframe; | 171 | goto badframe; |
@@ -189,7 +185,6 @@ SYSCALL_DEFINE0(rt_sigreturn) | |||
189 | goto badframe; | 185 | goto badframe; |
190 | if (__copy_from_user(&set.sig, &frame->uc.uc_sigmask, sizeof(set))) | 186 | if (__copy_from_user(&set.sig, &frame->uc.uc_sigmask, sizeof(set))) |
191 | goto badframe; | 187 | goto badframe; |
192 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
193 | set_current_blocked(&set); | 188 | set_current_blocked(&set); |
194 | if (restore_sigregs(regs, &frame->uc.uc_mcontext)) | 189 | if (restore_sigregs(regs, &frame->uc.uc_mcontext)) |
195 | goto badframe; | 190 | goto badframe; |
@@ -367,7 +362,7 @@ give_sigsegv: | |||
367 | return -EFAULT; | 362 | return -EFAULT; |
368 | } | 363 | } |
369 | 364 | ||
370 | static int handle_signal(unsigned long sig, struct k_sigaction *ka, | 365 | static void handle_signal(unsigned long sig, struct k_sigaction *ka, |
371 | siginfo_t *info, sigset_t *oldset, | 366 | siginfo_t *info, sigset_t *oldset, |
372 | struct pt_regs *regs) | 367 | struct pt_regs *regs) |
373 | { | 368 | { |
@@ -379,9 +374,9 @@ static int handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
379 | else | 374 | else |
380 | ret = setup_frame(sig, ka, oldset, regs); | 375 | ret = setup_frame(sig, ka, oldset, regs); |
381 | if (ret) | 376 | if (ret) |
382 | return ret; | 377 | return; |
383 | block_sigmask(ka, sig); | 378 | signal_delivered(sig, info, ka, regs, |
384 | return 0; | 379 | test_thread_flag(TIF_SINGLE_STEP)); |
385 | } | 380 | } |
386 | 381 | ||
387 | /* | 382 | /* |
@@ -398,12 +393,7 @@ void do_signal(struct pt_regs *regs) | |||
398 | siginfo_t info; | 393 | siginfo_t info; |
399 | int signr; | 394 | int signr; |
400 | struct k_sigaction ka; | 395 | struct k_sigaction ka; |
401 | sigset_t *oldset; | 396 | sigset_t *oldset = sigmask_to_save(); |
402 | |||
403 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
404 | oldset = ¤t->saved_sigmask; | ||
405 | else | ||
406 | oldset = ¤t->blocked; | ||
407 | 397 | ||
408 | /* | 398 | /* |
409 | * Get signal to deliver. When running under ptrace, at this point | 399 | * Get signal to deliver. When running under ptrace, at this point |
@@ -441,24 +431,10 @@ void do_signal(struct pt_regs *regs) | |||
441 | /* No longer in a system call */ | 431 | /* No longer in a system call */ |
442 | clear_thread_flag(TIF_SYSCALL); | 432 | clear_thread_flag(TIF_SYSCALL); |
443 | 433 | ||
444 | if ((is_compat_task() ? | 434 | if (is_compat_task()) |
445 | handle_signal32(signr, &ka, &info, oldset, regs) : | 435 | handle_signal32(signr, &ka, &info, oldset, regs); |
446 | handle_signal(signr, &ka, &info, oldset, regs)) == 0) { | 436 | else |
447 | /* | 437 | handle_signal(signr, &ka, &info, oldset, regs); |
448 | * A signal was successfully delivered; the saved | ||
449 | * sigmask will have been stored in the signal frame, | ||
450 | * and will be restored by sigreturn, so we can simply | ||
451 | * clear the TIF_RESTORE_SIGMASK flag. | ||
452 | */ | ||
453 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
454 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
455 | |||
456 | /* | ||
457 | * Let tracing know that we've done the handler setup. | ||
458 | */ | ||
459 | tracehook_signal_handler(signr, &info, &ka, regs, | ||
460 | test_thread_flag(TIF_SINGLE_STEP)); | ||
461 | } | ||
462 | return; | 438 | return; |
463 | } | 439 | } |
464 | 440 | ||
@@ -484,16 +460,11 @@ void do_signal(struct pt_regs *regs) | |||
484 | /* | 460 | /* |
485 | * If there's no signal to deliver, we just put the saved sigmask back. | 461 | * If there's no signal to deliver, we just put the saved sigmask back. |
486 | */ | 462 | */ |
487 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | 463 | restore_saved_sigmask(); |
488 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
489 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
490 | } | ||
491 | } | 464 | } |
492 | 465 | ||
493 | void do_notify_resume(struct pt_regs *regs) | 466 | void do_notify_resume(struct pt_regs *regs) |
494 | { | 467 | { |
495 | clear_thread_flag(TIF_NOTIFY_RESUME); | 468 | clear_thread_flag(TIF_NOTIFY_RESUME); |
496 | tracehook_notify_resume(regs); | 469 | tracehook_notify_resume(regs); |
497 | if (current->replacement_session_keyring) | ||
498 | key_replace_session_keyring(); | ||
499 | } | 470 | } |
diff --git a/arch/score/kernel/signal.c b/arch/score/kernel/signal.c index d4a49011c48a..e382c52ca0d9 100644 --- a/arch/score/kernel/signal.c +++ b/arch/score/kernel/signal.c | |||
@@ -34,8 +34,6 @@ | |||
34 | #include <asm/syscalls.h> | 34 | #include <asm/syscalls.h> |
35 | #include <asm/ucontext.h> | 35 | #include <asm/ucontext.h> |
36 | 36 | ||
37 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
38 | |||
39 | struct rt_sigframe { | 37 | struct rt_sigframe { |
40 | u32 rs_ass[4]; /* argument save space */ | 38 | u32 rs_ass[4]; /* argument save space */ |
41 | u32 rs_code[2]; /* signal trampoline */ | 39 | u32 rs_code[2]; /* signal trampoline */ |
@@ -162,7 +160,6 @@ score_rt_sigreturn(struct pt_regs *regs) | |||
162 | if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) | 160 | if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) |
163 | goto badframe; | 161 | goto badframe; |
164 | 162 | ||
165 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
166 | set_current_blocked(&set); | 163 | set_current_blocked(&set); |
167 | 164 | ||
168 | sig = restore_sigcontext(regs, &frame->rs_uc.uc_mcontext); | 165 | sig = restore_sigcontext(regs, &frame->rs_uc.uc_mcontext); |
@@ -241,11 +238,9 @@ give_sigsegv: | |||
241 | return -EFAULT; | 238 | return -EFAULT; |
242 | } | 239 | } |
243 | 240 | ||
244 | static int handle_signal(unsigned long sig, siginfo_t *info, | 241 | static void handle_signal(unsigned long sig, siginfo_t *info, |
245 | struct k_sigaction *ka, sigset_t *oldset, struct pt_regs *regs) | 242 | struct k_sigaction *ka, struct pt_regs *regs) |
246 | { | 243 | { |
247 | int ret; | ||
248 | |||
249 | if (regs->is_syscall) { | 244 | if (regs->is_syscall) { |
250 | switch (regs->regs[4]) { | 245 | switch (regs->regs[4]) { |
251 | case ERESTART_RESTARTBLOCK: | 246 | case ERESTART_RESTARTBLOCK: |
@@ -269,18 +264,15 @@ static int handle_signal(unsigned long sig, siginfo_t *info, | |||
269 | /* | 264 | /* |
270 | * Set up the stack frame | 265 | * Set up the stack frame |
271 | */ | 266 | */ |
272 | ret = setup_rt_frame(ka, regs, sig, oldset, info); | 267 | if (setup_rt_frame(ka, regs, sig, sigmask_to_save(), info) < 0) |
273 | 268 | return; | |
274 | if (ret == 0) | ||
275 | block_sigmask(ka, sig); | ||
276 | 269 | ||
277 | return ret; | 270 | signal_delivered(sig, info, ka, regs, 0); |
278 | } | 271 | } |
279 | 272 | ||
280 | static void do_signal(struct pt_regs *regs) | 273 | static void do_signal(struct pt_regs *regs) |
281 | { | 274 | { |
282 | struct k_sigaction ka; | 275 | struct k_sigaction ka; |
283 | sigset_t *oldset; | ||
284 | siginfo_t info; | 276 | siginfo_t info; |
285 | int signr; | 277 | int signr; |
286 | 278 | ||
@@ -292,25 +284,10 @@ static void do_signal(struct pt_regs *regs) | |||
292 | if (!user_mode(regs)) | 284 | if (!user_mode(regs)) |
293 | return; | 285 | return; |
294 | 286 | ||
295 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
296 | oldset = ¤t->saved_sigmask; | ||
297 | else | ||
298 | oldset = ¤t->blocked; | ||
299 | |||
300 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 287 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
301 | if (signr > 0) { | 288 | if (signr > 0) { |
302 | /* Actually deliver the signal. */ | 289 | /* Actually deliver the signal. */ |
303 | if (handle_signal(signr, &info, &ka, oldset, regs) == 0) { | 290 | handle_signal(signr, &info, &ka, regs); |
304 | /* | ||
305 | * A signal was successfully delivered; the saved | ||
306 | * sigmask will have been stored in the signal frame, | ||
307 | * and will be restored by sigreturn, so we can simply | ||
308 | * clear the TIF_RESTORE_SIGMASK flag. | ||
309 | */ | ||
310 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
311 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
312 | } | ||
313 | |||
314 | return; | 291 | return; |
315 | } | 292 | } |
316 | 293 | ||
@@ -337,10 +314,7 @@ static void do_signal(struct pt_regs *regs) | |||
337 | * If there's no signal to deliver, we just put the saved sigmask | 314 | * If there's no signal to deliver, we just put the saved sigmask |
338 | * back | 315 | * back |
339 | */ | 316 | */ |
340 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | 317 | restore_saved_sigmask(); |
341 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
342 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
343 | } | ||
344 | } | 318 | } |
345 | 319 | ||
346 | /* | 320 | /* |
@@ -356,7 +330,5 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused, | |||
356 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | 330 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { |
357 | clear_thread_flag(TIF_NOTIFY_RESUME); | 331 | clear_thread_flag(TIF_NOTIFY_RESUME); |
358 | tracehook_notify_resume(regs); | 332 | tracehook_notify_resume(regs); |
359 | if (current->replacement_session_keyring) | ||
360 | key_replace_session_keyring(); | ||
361 | } | 333 | } |
362 | } | 334 | } |
diff --git a/arch/sh/include/asm/posix_types_32.h b/arch/sh/include/asm/posix_types_32.h index abda58467ece..ba0bdc423b07 100644 --- a/arch/sh/include/asm/posix_types_32.h +++ b/arch/sh/include/asm/posix_types_32.h | |||
@@ -3,8 +3,6 @@ | |||
3 | 3 | ||
4 | typedef unsigned short __kernel_mode_t; | 4 | typedef unsigned short __kernel_mode_t; |
5 | #define __kernel_mode_t __kernel_mode_t | 5 | #define __kernel_mode_t __kernel_mode_t |
6 | typedef unsigned short __kernel_nlink_t; | ||
7 | #define __kernel_nlink_t __kernel_nlink_t | ||
8 | typedef unsigned short __kernel_ipc_pid_t; | 6 | typedef unsigned short __kernel_ipc_pid_t; |
9 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t | 7 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t |
10 | typedef unsigned short __kernel_uid_t; | 8 | typedef unsigned short __kernel_uid_t; |
diff --git a/arch/sh/include/asm/posix_types_64.h b/arch/sh/include/asm/posix_types_64.h index fcda07b4a616..244f7e950e17 100644 --- a/arch/sh/include/asm/posix_types_64.h +++ b/arch/sh/include/asm/posix_types_64.h | |||
@@ -3,8 +3,6 @@ | |||
3 | 3 | ||
4 | typedef unsigned short __kernel_mode_t; | 4 | typedef unsigned short __kernel_mode_t; |
5 | #define __kernel_mode_t __kernel_mode_t | 5 | #define __kernel_mode_t __kernel_mode_t |
6 | typedef unsigned short __kernel_nlink_t; | ||
7 | #define __kernel_nlink_t __kernel_nlink_t | ||
8 | typedef unsigned short __kernel_ipc_pid_t; | 6 | typedef unsigned short __kernel_ipc_pid_t; |
9 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t | 7 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t |
10 | typedef unsigned short __kernel_uid_t; | 8 | typedef unsigned short __kernel_uid_t; |
diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h index 0c04ffc4f12c..bc13b57cdc83 100644 --- a/arch/sh/include/asm/thread_info.h +++ b/arch/sh/include/asm/thread_info.h | |||
@@ -169,7 +169,7 @@ static inline void set_restore_sigmask(void) | |||
169 | { | 169 | { |
170 | struct thread_info *ti = current_thread_info(); | 170 | struct thread_info *ti = current_thread_info(); |
171 | ti->status |= TS_RESTORE_SIGMASK; | 171 | ti->status |= TS_RESTORE_SIGMASK; |
172 | set_bit(TIF_SIGPENDING, (unsigned long *)&ti->flags); | 172 | WARN_ON(!test_bit(TIF_SIGPENDING, (unsigned long *)&ti->flags)); |
173 | } | 173 | } |
174 | 174 | ||
175 | #define TI_FLAG_FAULT_CODE_SHIFT 24 | 175 | #define TI_FLAG_FAULT_CODE_SHIFT 24 |
@@ -189,6 +189,23 @@ static inline unsigned int get_thread_fault_code(void) | |||
189 | struct thread_info *ti = current_thread_info(); | 189 | struct thread_info *ti = current_thread_info(); |
190 | return ti->flags >> TI_FLAG_FAULT_CODE_SHIFT; | 190 | return ti->flags >> TI_FLAG_FAULT_CODE_SHIFT; |
191 | } | 191 | } |
192 | |||
193 | static inline void clear_restore_sigmask(void) | ||
194 | { | ||
195 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
196 | } | ||
197 | static inline bool test_restore_sigmask(void) | ||
198 | { | ||
199 | return current_thread_info()->status & TS_RESTORE_SIGMASK; | ||
200 | } | ||
201 | static inline bool test_and_clear_restore_sigmask(void) | ||
202 | { | ||
203 | struct thread_info *ti = current_thread_info(); | ||
204 | if (!(ti->status & TS_RESTORE_SIGMASK)) | ||
205 | return false; | ||
206 | ti->status &= ~TS_RESTORE_SIGMASK; | ||
207 | return true; | ||
208 | } | ||
192 | #endif /* !__ASSEMBLY__ */ | 209 | #endif /* !__ASSEMBLY__ */ |
193 | 210 | ||
194 | #endif /* __KERNEL__ */ | 211 | #endif /* __KERNEL__ */ |
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c index cb4172c8af7d..d6b7b6154f87 100644 --- a/arch/sh/kernel/signal_32.c +++ b/arch/sh/kernel/signal_32.c | |||
@@ -32,8 +32,6 @@ | |||
32 | #include <asm/syscalls.h> | 32 | #include <asm/syscalls.h> |
33 | #include <asm/fpu.h> | 33 | #include <asm/fpu.h> |
34 | 34 | ||
35 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
36 | |||
37 | struct fdpic_func_descriptor { | 35 | struct fdpic_func_descriptor { |
38 | unsigned long text; | 36 | unsigned long text; |
39 | unsigned long GOT; | 37 | unsigned long GOT; |
@@ -226,7 +224,6 @@ asmlinkage int sys_sigreturn(unsigned long r4, unsigned long r5, | |||
226 | sizeof(frame->extramask)))) | 224 | sizeof(frame->extramask)))) |
227 | goto badframe; | 225 | goto badframe; |
228 | 226 | ||
229 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
230 | set_current_blocked(&set); | 227 | set_current_blocked(&set); |
231 | 228 | ||
232 | if (restore_sigcontext(regs, &frame->sc, &r0)) | 229 | if (restore_sigcontext(regs, &frame->sc, &r0)) |
@@ -256,7 +253,6 @@ asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5, | |||
256 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 253 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
257 | goto badframe; | 254 | goto badframe; |
258 | 255 | ||
259 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
260 | set_current_blocked(&set); | 256 | set_current_blocked(&set); |
261 | 257 | ||
262 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0)) | 258 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0)) |
@@ -522,10 +518,11 @@ handle_syscall_restart(unsigned long save_r0, struct pt_regs *regs, | |||
522 | /* | 518 | /* |
523 | * OK, we're invoking a handler | 519 | * OK, we're invoking a handler |
524 | */ | 520 | */ |
525 | static int | 521 | static void |
526 | handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | 522 | handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, |
527 | sigset_t *oldset, struct pt_regs *regs, unsigned int save_r0) | 523 | struct pt_regs *regs, unsigned int save_r0) |
528 | { | 524 | { |
525 | sigset_t *oldset = sigmask_to_save(); | ||
529 | int ret; | 526 | int ret; |
530 | 527 | ||
531 | /* Set up the stack frame */ | 528 | /* Set up the stack frame */ |
@@ -534,10 +531,10 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | |||
534 | else | 531 | else |
535 | ret = setup_frame(sig, ka, oldset, regs); | 532 | ret = setup_frame(sig, ka, oldset, regs); |
536 | 533 | ||
537 | if (ret == 0) | 534 | if (ret) |
538 | block_sigmask(ka, sig); | 535 | return; |
539 | 536 | signal_delivered(sig, info, ka, regs, | |
540 | return ret; | 537 | test_thread_flag(TIF_SINGLESTEP)); |
541 | } | 538 | } |
542 | 539 | ||
543 | /* | 540 | /* |
@@ -554,7 +551,6 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0) | |||
554 | siginfo_t info; | 551 | siginfo_t info; |
555 | int signr; | 552 | int signr; |
556 | struct k_sigaction ka; | 553 | struct k_sigaction ka; |
557 | sigset_t *oldset; | ||
558 | 554 | ||
559 | /* | 555 | /* |
560 | * We want the common case to go fast, which | 556 | * We want the common case to go fast, which |
@@ -565,30 +561,12 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0) | |||
565 | if (!user_mode(regs)) | 561 | if (!user_mode(regs)) |
566 | return; | 562 | return; |
567 | 563 | ||
568 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) | ||
569 | oldset = ¤t->saved_sigmask; | ||
570 | else | ||
571 | oldset = ¤t->blocked; | ||
572 | |||
573 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 564 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
574 | if (signr > 0) { | 565 | if (signr > 0) { |
575 | handle_syscall_restart(save_r0, regs, &ka.sa); | 566 | handle_syscall_restart(save_r0, regs, &ka.sa); |
576 | 567 | ||
577 | /* Whee! Actually deliver the signal. */ | 568 | /* Whee! Actually deliver the signal. */ |
578 | if (handle_signal(signr, &ka, &info, oldset, | 569 | handle_signal(signr, &ka, &info, regs, save_r0); |
579 | regs, save_r0) == 0) { | ||
580 | /* | ||
581 | * A signal was successfully delivered; the saved | ||
582 | * sigmask will have been stored in the signal frame, | ||
583 | * and will be restored by sigreturn, so we can simply | ||
584 | * clear the TS_RESTORE_SIGMASK flag | ||
585 | */ | ||
586 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
587 | |||
588 | tracehook_signal_handler(signr, &info, &ka, regs, | ||
589 | test_thread_flag(TIF_SINGLESTEP)); | ||
590 | } | ||
591 | |||
592 | return; | 570 | return; |
593 | } | 571 | } |
594 | 572 | ||
@@ -610,10 +588,7 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0) | |||
610 | * If there's no signal to deliver, we just put the saved sigmask | 588 | * If there's no signal to deliver, we just put the saved sigmask |
611 | * back. | 589 | * back. |
612 | */ | 590 | */ |
613 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) { | 591 | restore_saved_sigmask(); |
614 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
615 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
616 | } | ||
617 | } | 592 | } |
618 | 593 | ||
619 | asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0, | 594 | asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0, |
@@ -626,7 +601,5 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0, | |||
626 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | 601 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { |
627 | clear_thread_flag(TIF_NOTIFY_RESUME); | 602 | clear_thread_flag(TIF_NOTIFY_RESUME); |
628 | tracehook_notify_resume(regs); | 603 | tracehook_notify_resume(regs); |
629 | if (current->replacement_session_keyring) | ||
630 | key_replace_session_keyring(); | ||
631 | } | 604 | } |
632 | } | 605 | } |
diff --git a/arch/sh/kernel/signal_64.c b/arch/sh/kernel/signal_64.c index b589a354c069..6b5b3dfe886b 100644 --- a/arch/sh/kernel/signal_64.c +++ b/arch/sh/kernel/signal_64.c | |||
@@ -41,11 +41,9 @@ | |||
41 | 41 | ||
42 | #define DEBUG_SIG 0 | 42 | #define DEBUG_SIG 0 |
43 | 43 | ||
44 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | 44 | static void |
45 | |||
46 | static int | ||
47 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | 45 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, |
48 | sigset_t *oldset, struct pt_regs * regs); | 46 | struct pt_regs * regs); |
49 | 47 | ||
50 | static inline void | 48 | static inline void |
51 | handle_syscall_restart(struct pt_regs *regs, struct sigaction *sa) | 49 | handle_syscall_restart(struct pt_regs *regs, struct sigaction *sa) |
@@ -88,7 +86,6 @@ static void do_signal(struct pt_regs *regs) | |||
88 | siginfo_t info; | 86 | siginfo_t info; |
89 | int signr; | 87 | int signr; |
90 | struct k_sigaction ka; | 88 | struct k_sigaction ka; |
91 | sigset_t *oldset; | ||
92 | 89 | ||
93 | /* | 90 | /* |
94 | * We want the common case to go fast, which | 91 | * We want the common case to go fast, which |
@@ -99,28 +96,13 @@ static void do_signal(struct pt_regs *regs) | |||
99 | if (!user_mode(regs)) | 96 | if (!user_mode(regs)) |
100 | return; | 97 | return; |
101 | 98 | ||
102 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) | ||
103 | oldset = ¤t->saved_sigmask; | ||
104 | else | ||
105 | oldset = ¤t->blocked; | ||
106 | |||
107 | signr = get_signal_to_deliver(&info, &ka, regs, 0); | 99 | signr = get_signal_to_deliver(&info, &ka, regs, 0); |
108 | if (signr > 0) { | 100 | if (signr > 0) { |
109 | handle_syscall_restart(regs, &ka.sa); | 101 | handle_syscall_restart(regs, &ka.sa); |
110 | 102 | ||
111 | /* Whee! Actually deliver the signal. */ | 103 | /* Whee! Actually deliver the signal. */ |
112 | if (handle_signal(signr, &info, &ka, oldset, regs) == 0) { | 104 | handle_signal(signr, &info, &ka, regs); |
113 | /* | 105 | return; |
114 | * If a signal was successfully delivered, the | ||
115 | * saved sigmask is in its frame, and we can | ||
116 | * clear the TS_RESTORE_SIGMASK flag. | ||
117 | */ | ||
118 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
119 | |||
120 | tracehook_signal_handler(signr, &info, &ka, regs, | ||
121 | test_thread_flag(TIF_SINGLESTEP)); | ||
122 | return; | ||
123 | } | ||
124 | } | 106 | } |
125 | 107 | ||
126 | /* Did we come from a system call? */ | 108 | /* Did we come from a system call? */ |
@@ -143,12 +125,7 @@ static void do_signal(struct pt_regs *regs) | |||
143 | } | 125 | } |
144 | 126 | ||
145 | /* No signal to deliver -- put the saved sigmask back */ | 127 | /* No signal to deliver -- put the saved sigmask back */ |
146 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) { | 128 | restore_saved_sigmask(); |
147 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
148 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
149 | } | ||
150 | |||
151 | return; | ||
152 | } | 129 | } |
153 | 130 | ||
154 | /* | 131 | /* |
@@ -351,7 +328,6 @@ asmlinkage int sys_sigreturn(unsigned long r2, unsigned long r3, | |||
351 | sizeof(frame->extramask)))) | 328 | sizeof(frame->extramask)))) |
352 | goto badframe; | 329 | goto badframe; |
353 | 330 | ||
354 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
355 | set_current_blocked(&set); | 331 | set_current_blocked(&set); |
356 | 332 | ||
357 | if (restore_sigcontext(regs, &frame->sc, &ret)) | 333 | if (restore_sigcontext(regs, &frame->sc, &ret)) |
@@ -384,7 +360,6 @@ asmlinkage int sys_rt_sigreturn(unsigned long r2, unsigned long r3, | |||
384 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 360 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
385 | goto badframe; | 361 | goto badframe; |
386 | 362 | ||
387 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
388 | set_current_blocked(&set); | 363 | set_current_blocked(&set); |
389 | 364 | ||
390 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ret)) | 365 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ret)) |
@@ -659,10 +634,11 @@ give_sigsegv: | |||
659 | /* | 634 | /* |
660 | * OK, we're invoking a handler | 635 | * OK, we're invoking a handler |
661 | */ | 636 | */ |
662 | static int | 637 | static void |
663 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | 638 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, |
664 | sigset_t *oldset, struct pt_regs * regs) | 639 | struct pt_regs * regs) |
665 | { | 640 | { |
641 | sigset_t *oldset = sigmask_to_save(); | ||
666 | int ret; | 642 | int ret; |
667 | 643 | ||
668 | /* Set up the stack frame */ | 644 | /* Set up the stack frame */ |
@@ -671,10 +647,11 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
671 | else | 647 | else |
672 | ret = setup_frame(sig, ka, oldset, regs); | 648 | ret = setup_frame(sig, ka, oldset, regs); |
673 | 649 | ||
674 | if (ret == 0) | 650 | if (ret) |
675 | block_sigmask(ka, sig); | 651 | return; |
676 | 652 | ||
677 | return ret; | 653 | signal_delivered(sig, info, ka, regs, |
654 | test_thread_flag(TIF_SINGLESTEP)); | ||
678 | } | 655 | } |
679 | 656 | ||
680 | asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) | 657 | asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) |
@@ -685,7 +662,5 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned long thread_info | |||
685 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | 662 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { |
686 | clear_thread_flag(TIF_NOTIFY_RESUME); | 663 | clear_thread_flag(TIF_NOTIFY_RESUME); |
687 | tracehook_notify_resume(regs); | 664 | tracehook_notify_resume(regs); |
688 | if (current->replacement_session_keyring) | ||
689 | key_replace_session_keyring(); | ||
690 | } | 665 | } |
691 | } | 666 | } |
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c index b86e9ca79455..2062aa88af41 100644 --- a/arch/sh/kernel/smp.c +++ b/arch/sh/kernel/smp.c | |||
@@ -123,7 +123,6 @@ void native_play_dead(void) | |||
123 | int __cpu_disable(void) | 123 | int __cpu_disable(void) |
124 | { | 124 | { |
125 | unsigned int cpu = smp_processor_id(); | 125 | unsigned int cpu = smp_processor_id(); |
126 | struct task_struct *p; | ||
127 | int ret; | 126 | int ret; |
128 | 127 | ||
129 | ret = mp_ops->cpu_disable(cpu); | 128 | ret = mp_ops->cpu_disable(cpu); |
@@ -153,11 +152,7 @@ int __cpu_disable(void) | |||
153 | flush_cache_all(); | 152 | flush_cache_all(); |
154 | local_flush_tlb_all(); | 153 | local_flush_tlb_all(); |
155 | 154 | ||
156 | read_lock(&tasklist_lock); | 155 | clear_tasks_mm_cpumask(cpu); |
157 | for_each_process(p) | ||
158 | if (p->mm) | ||
159 | cpumask_clear_cpu(cpu, mm_cpumask(p->mm)); | ||
160 | read_unlock(&tasklist_lock); | ||
161 | 156 | ||
162 | return 0; | 157 | return 0; |
163 | } | 158 | } |
diff --git a/arch/sparc/include/asm/posix_types.h b/arch/sparc/include/asm/posix_types.h index 3070f25ae90a..156220ed99eb 100644 --- a/arch/sparc/include/asm/posix_types.h +++ b/arch/sparc/include/asm/posix_types.h | |||
@@ -9,8 +9,6 @@ | |||
9 | 9 | ||
10 | #if defined(__sparc__) && defined(__arch64__) | 10 | #if defined(__sparc__) && defined(__arch64__) |
11 | /* sparc 64 bit */ | 11 | /* sparc 64 bit */ |
12 | typedef unsigned int __kernel_nlink_t; | ||
13 | #define __kernel_nlink_t __kernel_nlink_t | ||
14 | 12 | ||
15 | typedef unsigned short __kernel_old_uid_t; | 13 | typedef unsigned short __kernel_old_uid_t; |
16 | typedef unsigned short __kernel_old_gid_t; | 14 | typedef unsigned short __kernel_old_gid_t; |
@@ -38,9 +36,6 @@ typedef unsigned short __kernel_gid_t; | |||
38 | typedef unsigned short __kernel_mode_t; | 36 | typedef unsigned short __kernel_mode_t; |
39 | #define __kernel_mode_t __kernel_mode_t | 37 | #define __kernel_mode_t __kernel_mode_t |
40 | 38 | ||
41 | typedef short __kernel_nlink_t; | ||
42 | #define __kernel_nlink_t __kernel_nlink_t | ||
43 | |||
44 | typedef long __kernel_daddr_t; | 39 | typedef long __kernel_daddr_t; |
45 | #define __kernel_daddr_t __kernel_daddr_t | 40 | #define __kernel_daddr_t __kernel_daddr_t |
46 | 41 | ||
diff --git a/arch/sparc/include/asm/thread_info_32.h b/arch/sparc/include/asm/thread_info_32.h index 5af664932452..e6cd224506a9 100644 --- a/arch/sparc/include/asm/thread_info_32.h +++ b/arch/sparc/include/asm/thread_info_32.h | |||
@@ -131,8 +131,7 @@ register struct thread_info *current_thread_info_reg asm("g6"); | |||
131 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | 131 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) |
132 | 132 | ||
133 | #define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | \ | 133 | #define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | \ |
134 | _TIF_SIGPENDING | \ | 134 | _TIF_SIGPENDING) |
135 | _TIF_RESTORE_SIGMASK) | ||
136 | 135 | ||
137 | #endif /* __KERNEL__ */ | 136 | #endif /* __KERNEL__ */ |
138 | 137 | ||
diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h index 7f0981b09451..cfa8c38fb9c8 100644 --- a/arch/sparc/include/asm/thread_info_64.h +++ b/arch/sparc/include/asm/thread_info_64.h | |||
@@ -238,7 +238,23 @@ static inline void set_restore_sigmask(void) | |||
238 | { | 238 | { |
239 | struct thread_info *ti = current_thread_info(); | 239 | struct thread_info *ti = current_thread_info(); |
240 | ti->status |= TS_RESTORE_SIGMASK; | 240 | ti->status |= TS_RESTORE_SIGMASK; |
241 | set_bit(TIF_SIGPENDING, &ti->flags); | 241 | WARN_ON(!test_bit(TIF_SIGPENDING, &ti->flags)); |
242 | } | ||
243 | static inline void clear_restore_sigmask(void) | ||
244 | { | ||
245 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
246 | } | ||
247 | static inline bool test_restore_sigmask(void) | ||
248 | { | ||
249 | return current_thread_info()->status & TS_RESTORE_SIGMASK; | ||
250 | } | ||
251 | static inline bool test_and_clear_restore_sigmask(void) | ||
252 | { | ||
253 | struct thread_info *ti = current_thread_info(); | ||
254 | if (!(ti->status & TS_RESTORE_SIGMASK)) | ||
255 | return false; | ||
256 | ti->status &= ~TS_RESTORE_SIGMASK; | ||
257 | return true; | ||
242 | } | 258 | } |
243 | #endif /* !__ASSEMBLY__ */ | 259 | #endif /* !__ASSEMBLY__ */ |
244 | 260 | ||
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c index bb1513e45f1a..a53e0a5fd3a3 100644 --- a/arch/sparc/kernel/signal32.c +++ b/arch/sparc/kernel/signal32.c | |||
@@ -32,8 +32,6 @@ | |||
32 | 32 | ||
33 | #include "sigutil.h" | 33 | #include "sigutil.h" |
34 | 34 | ||
35 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
36 | |||
37 | /* This magic should be in g_upper[0] for all upper parts | 35 | /* This magic should be in g_upper[0] for all upper parts |
38 | * to be valid. | 36 | * to be valid. |
39 | */ | 37 | */ |
@@ -274,7 +272,6 @@ void do_sigreturn32(struct pt_regs *regs) | |||
274 | case 2: set.sig[1] = seta[2] + (((long)seta[3]) << 32); | 272 | case 2: set.sig[1] = seta[2] + (((long)seta[3]) << 32); |
275 | case 1: set.sig[0] = seta[0] + (((long)seta[1]) << 32); | 273 | case 1: set.sig[0] = seta[0] + (((long)seta[1]) << 32); |
276 | } | 274 | } |
277 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
278 | set_current_blocked(&set); | 275 | set_current_blocked(&set); |
279 | return; | 276 | return; |
280 | 277 | ||
@@ -376,7 +373,6 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs) | |||
376 | case 2: set.sig[1] = seta.sig[2] + (((long)seta.sig[3]) << 32); | 373 | case 2: set.sig[1] = seta.sig[2] + (((long)seta.sig[3]) << 32); |
377 | case 1: set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32); | 374 | case 1: set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32); |
378 | } | 375 | } |
379 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
380 | set_current_blocked(&set); | 376 | set_current_blocked(&set); |
381 | return; | 377 | return; |
382 | segv: | 378 | segv: |
@@ -775,7 +771,7 @@ sigsegv: | |||
775 | return -EFAULT; | 771 | return -EFAULT; |
776 | } | 772 | } |
777 | 773 | ||
778 | static inline int handle_signal32(unsigned long signr, struct k_sigaction *ka, | 774 | static inline void handle_signal32(unsigned long signr, struct k_sigaction *ka, |
779 | siginfo_t *info, | 775 | siginfo_t *info, |
780 | sigset_t *oldset, struct pt_regs *regs) | 776 | sigset_t *oldset, struct pt_regs *regs) |
781 | { | 777 | { |
@@ -787,12 +783,9 @@ static inline int handle_signal32(unsigned long signr, struct k_sigaction *ka, | |||
787 | err = setup_frame32(ka, regs, signr, oldset); | 783 | err = setup_frame32(ka, regs, signr, oldset); |
788 | 784 | ||
789 | if (err) | 785 | if (err) |
790 | return err; | 786 | return; |
791 | |||
792 | block_sigmask(ka, signr); | ||
793 | tracehook_signal_handler(signr, info, ka, regs, 0); | ||
794 | 787 | ||
795 | return 0; | 788 | signal_delivered(signr, info, ka, regs, 0); |
796 | } | 789 | } |
797 | 790 | ||
798 | static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs, | 791 | static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs, |
@@ -841,14 +834,7 @@ void do_signal32(sigset_t *oldset, struct pt_regs * regs) | |||
841 | if (signr > 0) { | 834 | if (signr > 0) { |
842 | if (restart_syscall) | 835 | if (restart_syscall) |
843 | syscall_restart32(orig_i0, regs, &ka.sa); | 836 | syscall_restart32(orig_i0, regs, &ka.sa); |
844 | if (handle_signal32(signr, &ka, &info, oldset, regs) == 0) { | 837 | handle_signal32(signr, &ka, &info, oldset, regs); |
845 | /* A signal was successfully delivered; the saved | ||
846 | * sigmask will have been stored in the signal frame, | ||
847 | * and will be restored by sigreturn, so we can simply | ||
848 | * clear the TS_RESTORE_SIGMASK flag. | ||
849 | */ | ||
850 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
851 | } | ||
852 | return; | 838 | return; |
853 | } | 839 | } |
854 | if (restart_syscall && | 840 | if (restart_syscall && |
@@ -872,10 +858,7 @@ void do_signal32(sigset_t *oldset, struct pt_regs * regs) | |||
872 | /* If there's no signal to deliver, we just put the saved sigmask | 858 | /* If there's no signal to deliver, we just put the saved sigmask |
873 | * back | 859 | * back |
874 | */ | 860 | */ |
875 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) { | 861 | restore_saved_sigmask(); |
876 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
877 | set_current_blocked(¤t->saved_sigmask); | ||
878 | } | ||
879 | } | 862 | } |
880 | 863 | ||
881 | struct sigstack32 { | 864 | struct sigstack32 { |
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c index 2b7e849f7c65..68f9c8650af4 100644 --- a/arch/sparc/kernel/signal_32.c +++ b/arch/sparc/kernel/signal_32.c | |||
@@ -29,8 +29,6 @@ | |||
29 | 29 | ||
30 | #include "sigutil.h" | 30 | #include "sigutil.h" |
31 | 31 | ||
32 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
33 | |||
34 | extern void fpsave(unsigned long *fpregs, unsigned long *fsr, | 32 | extern void fpsave(unsigned long *fpregs, unsigned long *fsr, |
35 | void *fpqueue, unsigned long *fpqdepth); | 33 | void *fpqueue, unsigned long *fpqdepth); |
36 | extern void fpload(unsigned long *fpregs, unsigned long *fsr); | 34 | extern void fpload(unsigned long *fpregs, unsigned long *fsr); |
@@ -130,7 +128,6 @@ asmlinkage void do_sigreturn(struct pt_regs *regs) | |||
130 | if (err) | 128 | if (err) |
131 | goto segv_and_exit; | 129 | goto segv_and_exit; |
132 | 130 | ||
133 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
134 | set_current_blocked(&set); | 131 | set_current_blocked(&set); |
135 | return; | 132 | return; |
136 | 133 | ||
@@ -197,7 +194,6 @@ asmlinkage void do_rt_sigreturn(struct pt_regs *regs) | |||
197 | goto segv; | 194 | goto segv; |
198 | } | 195 | } |
199 | 196 | ||
200 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
201 | set_current_blocked(&set); | 197 | set_current_blocked(&set); |
202 | return; | 198 | return; |
203 | segv: | 199 | segv: |
@@ -449,10 +445,11 @@ sigsegv: | |||
449 | return -EFAULT; | 445 | return -EFAULT; |
450 | } | 446 | } |
451 | 447 | ||
452 | static inline int | 448 | static inline void |
453 | handle_signal(unsigned long signr, struct k_sigaction *ka, | 449 | handle_signal(unsigned long signr, struct k_sigaction *ka, |
454 | siginfo_t *info, sigset_t *oldset, struct pt_regs *regs) | 450 | siginfo_t *info, struct pt_regs *regs) |
455 | { | 451 | { |
452 | sigset_t *oldset = sigmask_to_save(); | ||
456 | int err; | 453 | int err; |
457 | 454 | ||
458 | if (ka->sa.sa_flags & SA_SIGINFO) | 455 | if (ka->sa.sa_flags & SA_SIGINFO) |
@@ -461,12 +458,9 @@ handle_signal(unsigned long signr, struct k_sigaction *ka, | |||
461 | err = setup_frame(ka, regs, signr, oldset); | 458 | err = setup_frame(ka, regs, signr, oldset); |
462 | 459 | ||
463 | if (err) | 460 | if (err) |
464 | return err; | 461 | return; |
465 | |||
466 | block_sigmask(ka, signr); | ||
467 | tracehook_signal_handler(signr, info, ka, regs, 0); | ||
468 | 462 | ||
469 | return 0; | 463 | signal_delivered(signr, info, ka, regs, 0); |
470 | } | 464 | } |
471 | 465 | ||
472 | static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, | 466 | static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, |
@@ -498,7 +492,6 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | |||
498 | { | 492 | { |
499 | struct k_sigaction ka; | 493 | struct k_sigaction ka; |
500 | int restart_syscall; | 494 | int restart_syscall; |
501 | sigset_t *oldset; | ||
502 | siginfo_t info; | 495 | siginfo_t info; |
503 | int signr; | 496 | int signr; |
504 | 497 | ||
@@ -523,11 +516,6 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | |||
523 | if (pt_regs_is_syscall(regs) && (regs->psr & PSR_C)) | 516 | if (pt_regs_is_syscall(regs) && (regs->psr & PSR_C)) |
524 | regs->u_regs[UREG_G6] = orig_i0; | 517 | regs->u_regs[UREG_G6] = orig_i0; |
525 | 518 | ||
526 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
527 | oldset = ¤t->saved_sigmask; | ||
528 | else | ||
529 | oldset = ¤t->blocked; | ||
530 | |||
531 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 519 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
532 | 520 | ||
533 | /* If the debugger messes with the program counter, it clears | 521 | /* If the debugger messes with the program counter, it clears |
@@ -544,15 +532,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | |||
544 | if (signr > 0) { | 532 | if (signr > 0) { |
545 | if (restart_syscall) | 533 | if (restart_syscall) |
546 | syscall_restart(orig_i0, regs, &ka.sa); | 534 | syscall_restart(orig_i0, regs, &ka.sa); |
547 | if (handle_signal(signr, &ka, &info, oldset, regs) == 0) { | 535 | handle_signal(signr, &ka, &info, regs); |
548 | /* a signal was successfully delivered; the saved | ||
549 | * sigmask will have been stored in the signal frame, | ||
550 | * and will be restored by sigreturn, so we can simply | ||
551 | * clear the TIF_RESTORE_SIGMASK flag. | ||
552 | */ | ||
553 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
554 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
555 | } | ||
556 | return; | 536 | return; |
557 | } | 537 | } |
558 | if (restart_syscall && | 538 | if (restart_syscall && |
@@ -576,22 +556,17 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | |||
576 | /* if there's no signal to deliver, we just put the saved sigmask | 556 | /* if there's no signal to deliver, we just put the saved sigmask |
577 | * back | 557 | * back |
578 | */ | 558 | */ |
579 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | 559 | restore_saved_sigmask(); |
580 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
581 | set_current_blocked(¤t->saved_sigmask); | ||
582 | } | ||
583 | } | 560 | } |
584 | 561 | ||
585 | void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, | 562 | void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, |
586 | unsigned long thread_info_flags) | 563 | unsigned long thread_info_flags) |
587 | { | 564 | { |
588 | if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) | 565 | if (thread_info_flags & _TIF_SIGPENDING) |
589 | do_signal(regs, orig_i0); | 566 | do_signal(regs, orig_i0); |
590 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | 567 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { |
591 | clear_thread_flag(TIF_NOTIFY_RESUME); | 568 | clear_thread_flag(TIF_NOTIFY_RESUME); |
592 | tracehook_notify_resume(regs); | 569 | tracehook_notify_resume(regs); |
593 | if (current->replacement_session_keyring) | ||
594 | key_replace_session_keyring(); | ||
595 | } | 570 | } |
596 | } | 571 | } |
597 | 572 | ||
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c index eafaab486b2d..867de2f8189c 100644 --- a/arch/sparc/kernel/signal_64.c +++ b/arch/sparc/kernel/signal_64.c | |||
@@ -38,8 +38,6 @@ | |||
38 | #include "systbls.h" | 38 | #include "systbls.h" |
39 | #include "sigutil.h" | 39 | #include "sigutil.h" |
40 | 40 | ||
41 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
42 | |||
43 | /* {set, get}context() needed for 64-bit SparcLinux userland. */ | 41 | /* {set, get}context() needed for 64-bit SparcLinux userland. */ |
44 | asmlinkage void sparc64_set_context(struct pt_regs *regs) | 42 | asmlinkage void sparc64_set_context(struct pt_regs *regs) |
45 | { | 43 | { |
@@ -71,7 +69,6 @@ asmlinkage void sparc64_set_context(struct pt_regs *regs) | |||
71 | if (__copy_from_user(&set, &ucp->uc_sigmask, sizeof(sigset_t))) | 69 | if (__copy_from_user(&set, &ucp->uc_sigmask, sizeof(sigset_t))) |
72 | goto do_sigsegv; | 70 | goto do_sigsegv; |
73 | } | 71 | } |
74 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
75 | set_current_blocked(&set); | 72 | set_current_blocked(&set); |
76 | } | 73 | } |
77 | if (test_thread_flag(TIF_32BIT)) { | 74 | if (test_thread_flag(TIF_32BIT)) { |
@@ -315,7 +312,6 @@ void do_rt_sigreturn(struct pt_regs *regs) | |||
315 | /* Prevent syscall restart. */ | 312 | /* Prevent syscall restart. */ |
316 | pt_regs_clear_syscall(regs); | 313 | pt_regs_clear_syscall(regs); |
317 | 314 | ||
318 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
319 | set_current_blocked(&set); | 315 | set_current_blocked(&set); |
320 | return; | 316 | return; |
321 | segv: | 317 | segv: |
@@ -466,7 +462,7 @@ sigsegv: | |||
466 | return -EFAULT; | 462 | return -EFAULT; |
467 | } | 463 | } |
468 | 464 | ||
469 | static inline int handle_signal(unsigned long signr, struct k_sigaction *ka, | 465 | static inline void handle_signal(unsigned long signr, struct k_sigaction *ka, |
470 | siginfo_t *info, | 466 | siginfo_t *info, |
471 | sigset_t *oldset, struct pt_regs *regs) | 467 | sigset_t *oldset, struct pt_regs *regs) |
472 | { | 468 | { |
@@ -475,12 +471,9 @@ static inline int handle_signal(unsigned long signr, struct k_sigaction *ka, | |||
475 | err = setup_rt_frame(ka, regs, signr, oldset, | 471 | err = setup_rt_frame(ka, regs, signr, oldset, |
476 | (ka->sa.sa_flags & SA_SIGINFO) ? info : NULL); | 472 | (ka->sa.sa_flags & SA_SIGINFO) ? info : NULL); |
477 | if (err) | 473 | if (err) |
478 | return err; | 474 | return; |
479 | |||
480 | block_sigmask(ka, signr); | ||
481 | tracehook_signal_handler(signr, info, ka, regs, 0); | ||
482 | 475 | ||
483 | return 0; | 476 | signal_delivered(signr, info, ka, regs, 0); |
484 | } | 477 | } |
485 | 478 | ||
486 | static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, | 479 | static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, |
@@ -512,7 +505,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | |||
512 | { | 505 | { |
513 | struct k_sigaction ka; | 506 | struct k_sigaction ka; |
514 | int restart_syscall; | 507 | int restart_syscall; |
515 | sigset_t *oldset; | 508 | sigset_t *oldset = sigmask_to_save(); |
516 | siginfo_t info; | 509 | siginfo_t info; |
517 | int signr; | 510 | int signr; |
518 | 511 | ||
@@ -538,11 +531,6 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | |||
538 | (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) | 531 | (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) |
539 | regs->u_regs[UREG_G6] = orig_i0; | 532 | regs->u_regs[UREG_G6] = orig_i0; |
540 | 533 | ||
541 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) | ||
542 | oldset = ¤t->saved_sigmask; | ||
543 | else | ||
544 | oldset = ¤t->blocked; | ||
545 | |||
546 | #ifdef CONFIG_COMPAT | 534 | #ifdef CONFIG_COMPAT |
547 | if (test_thread_flag(TIF_32BIT)) { | 535 | if (test_thread_flag(TIF_32BIT)) { |
548 | extern void do_signal32(sigset_t *, struct pt_regs *); | 536 | extern void do_signal32(sigset_t *, struct pt_regs *); |
@@ -563,14 +551,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | |||
563 | if (signr > 0) { | 551 | if (signr > 0) { |
564 | if (restart_syscall) | 552 | if (restart_syscall) |
565 | syscall_restart(orig_i0, regs, &ka.sa); | 553 | syscall_restart(orig_i0, regs, &ka.sa); |
566 | if (handle_signal(signr, &ka, &info, oldset, regs) == 0) { | 554 | handle_signal(signr, &ka, &info, oldset, regs); |
567 | /* A signal was successfully delivered; the saved | ||
568 | * sigmask will have been stored in the signal frame, | ||
569 | * and will be restored by sigreturn, so we can simply | ||
570 | * clear the TS_RESTORE_SIGMASK flag. | ||
571 | */ | ||
572 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
573 | } | ||
574 | return; | 555 | return; |
575 | } | 556 | } |
576 | if (restart_syscall && | 557 | if (restart_syscall && |
@@ -594,10 +575,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | |||
594 | /* If there's no signal to deliver, we just put the saved sigmask | 575 | /* If there's no signal to deliver, we just put the saved sigmask |
595 | * back | 576 | * back |
596 | */ | 577 | */ |
597 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) { | 578 | restore_saved_sigmask(); |
598 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
599 | set_current_blocked(¤t->saved_sigmask); | ||
600 | } | ||
601 | } | 579 | } |
602 | 580 | ||
603 | void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long thread_info_flags) | 581 | void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long thread_info_flags) |
@@ -607,8 +585,6 @@ void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long | |||
607 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | 585 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { |
608 | clear_thread_flag(TIF_NOTIFY_RESUME); | 586 | clear_thread_flag(TIF_NOTIFY_RESUME); |
609 | tracehook_notify_resume(regs); | 587 | tracehook_notify_resume(regs); |
610 | if (current->replacement_session_keyring) | ||
611 | key_replace_session_keyring(); | ||
612 | } | 588 | } |
613 | } | 589 | } |
614 | 590 | ||
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c index 3ee51f189a55..275f74fd6f6a 100644 --- a/arch/sparc/kernel/sys_sparc_64.c +++ b/arch/sparc/kernel/sys_sparc_64.c | |||
@@ -580,16 +580,9 @@ SYSCALL_DEFINE5(64_mremap, unsigned long, addr, unsigned long, old_len, | |||
580 | unsigned long, new_len, unsigned long, flags, | 580 | unsigned long, new_len, unsigned long, flags, |
581 | unsigned long, new_addr) | 581 | unsigned long, new_addr) |
582 | { | 582 | { |
583 | unsigned long ret = -EINVAL; | ||
584 | |||
585 | if (test_thread_flag(TIF_32BIT)) | 583 | if (test_thread_flag(TIF_32BIT)) |
586 | goto out; | 584 | return -EINVAL; |
587 | 585 | return sys_mremap(addr, old_len, new_len, flags, new_addr); | |
588 | down_write(¤t->mm->mmap_sem); | ||
589 | ret = do_mremap(addr, old_len, new_len, flags, new_addr); | ||
590 | up_write(¤t->mm->mmap_sem); | ||
591 | out: | ||
592 | return ret; | ||
593 | } | 586 | } |
594 | 587 | ||
595 | /* we come to here via sys_nis_syscall so it can setup the regs argument */ | 588 | /* we come to here via sys_nis_syscall so it can setup the regs argument */ |
diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h index 69adc08d36a5..6e74450ff0a1 100644 --- a/arch/tile/include/asm/compat.h +++ b/arch/tile/include/asm/compat.h | |||
@@ -44,7 +44,6 @@ typedef __kernel_uid32_t __compat_gid32_t; | |||
44 | typedef __kernel_mode_t compat_mode_t; | 44 | typedef __kernel_mode_t compat_mode_t; |
45 | typedef __kernel_dev_t compat_dev_t; | 45 | typedef __kernel_dev_t compat_dev_t; |
46 | typedef __kernel_loff_t compat_loff_t; | 46 | typedef __kernel_loff_t compat_loff_t; |
47 | typedef __kernel_nlink_t compat_nlink_t; | ||
48 | typedef __kernel_ipc_pid_t compat_ipc_pid_t; | 47 | typedef __kernel_ipc_pid_t compat_ipc_pid_t; |
49 | typedef __kernel_daddr_t compat_daddr_t; | 48 | typedef __kernel_daddr_t compat_daddr_t; |
50 | typedef __kernel_fsid_t compat_fsid_t; | 49 | typedef __kernel_fsid_t compat_fsid_t; |
diff --git a/arch/tile/include/asm/thread_info.h b/arch/tile/include/asm/thread_info.h index 656c486e64fa..7e1fef36bde6 100644 --- a/arch/tile/include/asm/thread_info.h +++ b/arch/tile/include/asm/thread_info.h | |||
@@ -166,7 +166,23 @@ static inline void set_restore_sigmask(void) | |||
166 | { | 166 | { |
167 | struct thread_info *ti = current_thread_info(); | 167 | struct thread_info *ti = current_thread_info(); |
168 | ti->status |= TS_RESTORE_SIGMASK; | 168 | ti->status |= TS_RESTORE_SIGMASK; |
169 | set_bit(TIF_SIGPENDING, &ti->flags); | 169 | WARN_ON(!test_bit(TIF_SIGPENDING, &ti->flags)); |
170 | } | ||
171 | static inline void clear_restore_sigmask(void) | ||
172 | { | ||
173 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
174 | } | ||
175 | static inline bool test_restore_sigmask(void) | ||
176 | { | ||
177 | return current_thread_info()->status & TS_RESTORE_SIGMASK; | ||
178 | } | ||
179 | static inline bool test_and_clear_restore_sigmask(void) | ||
180 | { | ||
181 | struct thread_info *ti = current_thread_info(); | ||
182 | if (!(ti->status & TS_RESTORE_SIGMASK)) | ||
183 | return false; | ||
184 | ti->status &= ~TS_RESTORE_SIGMASK; | ||
185 | return true; | ||
170 | } | 186 | } |
171 | #endif /* !__ASSEMBLY__ */ | 187 | #endif /* !__ASSEMBLY__ */ |
172 | 188 | ||
diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c index cdef6e5ec022..474571b84085 100644 --- a/arch/tile/kernel/compat_signal.c +++ b/arch/tile/kernel/compat_signal.c | |||
@@ -118,8 +118,6 @@ struct compat_rt_sigframe { | |||
118 | struct compat_ucontext uc; | 118 | struct compat_ucontext uc; |
119 | }; | 119 | }; |
120 | 120 | ||
121 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
122 | |||
123 | long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act, | 121 | long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act, |
124 | struct compat_sigaction __user *oact, | 122 | struct compat_sigaction __user *oact, |
125 | size_t sigsetsize) | 123 | size_t sigsetsize) |
@@ -302,7 +300,6 @@ long compat_sys_rt_sigreturn(struct pt_regs *regs) | |||
302 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 300 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
303 | goto badframe; | 301 | goto badframe; |
304 | 302 | ||
305 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
306 | set_current_blocked(&set); | 303 | set_current_blocked(&set); |
307 | 304 | ||
308 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) | 305 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) |
diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c index ba1023d8a021..6be799150501 100644 --- a/arch/tile/kernel/process.c +++ b/arch/tile/kernel/process.c | |||
@@ -565,8 +565,6 @@ int do_work_pending(struct pt_regs *regs, u32 thread_info_flags) | |||
565 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | 565 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { |
566 | clear_thread_flag(TIF_NOTIFY_RESUME); | 566 | clear_thread_flag(TIF_NOTIFY_RESUME); |
567 | tracehook_notify_resume(regs); | 567 | tracehook_notify_resume(regs); |
568 | if (current->replacement_session_keyring) | ||
569 | key_replace_session_keyring(); | ||
570 | return 1; | 568 | return 1; |
571 | } | 569 | } |
572 | if (thread_info_flags & _TIF_SINGLESTEP) { | 570 | if (thread_info_flags & _TIF_SINGLESTEP) { |
diff --git a/arch/tile/kernel/signal.c b/arch/tile/kernel/signal.c index f79d4b88c747..e29b0553211d 100644 --- a/arch/tile/kernel/signal.c +++ b/arch/tile/kernel/signal.c | |||
@@ -37,8 +37,6 @@ | |||
37 | 37 | ||
38 | #define DEBUG_SIG 0 | 38 | #define DEBUG_SIG 0 |
39 | 39 | ||
40 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
41 | |||
42 | SYSCALL_DEFINE3(sigaltstack, const stack_t __user *, uss, | 40 | SYSCALL_DEFINE3(sigaltstack, const stack_t __user *, uss, |
43 | stack_t __user *, uoss, struct pt_regs *, regs) | 41 | stack_t __user *, uoss, struct pt_regs *, regs) |
44 | { | 42 | { |
@@ -96,7 +94,6 @@ SYSCALL_DEFINE1(rt_sigreturn, struct pt_regs *, regs) | |||
96 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 94 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
97 | goto badframe; | 95 | goto badframe; |
98 | 96 | ||
99 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
100 | set_current_blocked(&set); | 97 | set_current_blocked(&set); |
101 | 98 | ||
102 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) | 99 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) |
@@ -242,10 +239,11 @@ give_sigsegv: | |||
242 | * OK, we're invoking a handler | 239 | * OK, we're invoking a handler |
243 | */ | 240 | */ |
244 | 241 | ||
245 | static int handle_signal(unsigned long sig, siginfo_t *info, | 242 | static void handle_signal(unsigned long sig, siginfo_t *info, |
246 | struct k_sigaction *ka, sigset_t *oldset, | 243 | struct k_sigaction *ka, |
247 | struct pt_regs *regs) | 244 | struct pt_regs *regs) |
248 | { | 245 | { |
246 | sigset_t *oldset = sigmask_to_save(); | ||
249 | int ret; | 247 | int ret; |
250 | 248 | ||
251 | /* Are we from a system call? */ | 249 | /* Are we from a system call? */ |
@@ -278,15 +276,9 @@ static int handle_signal(unsigned long sig, siginfo_t *info, | |||
278 | else | 276 | else |
279 | #endif | 277 | #endif |
280 | ret = setup_rt_frame(sig, ka, info, oldset, regs); | 278 | ret = setup_rt_frame(sig, ka, info, oldset, regs); |
281 | if (ret == 0) { | 279 | if (ret) |
282 | /* This code is only called from system calls or from | 280 | return; |
283 | * the work_pending path in the return-to-user code, and | 281 | signal_delivered(sig, info, ka, regs, 0); |
284 | * either way we can re-enable interrupts unconditionally. | ||
285 | */ | ||
286 | block_sigmask(ka, sig); | ||
287 | } | ||
288 | |||
289 | return ret; | ||
290 | } | 282 | } |
291 | 283 | ||
292 | /* | 284 | /* |
@@ -299,7 +291,6 @@ void do_signal(struct pt_regs *regs) | |||
299 | siginfo_t info; | 291 | siginfo_t info; |
300 | int signr; | 292 | int signr; |
301 | struct k_sigaction ka; | 293 | struct k_sigaction ka; |
302 | sigset_t *oldset; | ||
303 | 294 | ||
304 | /* | 295 | /* |
305 | * i386 will check if we're coming from kernel mode and bail out | 296 | * i386 will check if we're coming from kernel mode and bail out |
@@ -308,24 +299,10 @@ void do_signal(struct pt_regs *regs) | |||
308 | * helpful, we can reinstate the check on "!user_mode(regs)". | 299 | * helpful, we can reinstate the check on "!user_mode(regs)". |
309 | */ | 300 | */ |
310 | 301 | ||
311 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) | ||
312 | oldset = ¤t->saved_sigmask; | ||
313 | else | ||
314 | oldset = ¤t->blocked; | ||
315 | |||
316 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 302 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
317 | if (signr > 0) { | 303 | if (signr > 0) { |
318 | /* Whee! Actually deliver the signal. */ | 304 | /* Whee! Actually deliver the signal. */ |
319 | if (handle_signal(signr, &info, &ka, oldset, regs) == 0) { | 305 | handle_signal(signr, &info, &ka, regs); |
320 | /* | ||
321 | * A signal was successfully delivered; the saved | ||
322 | * sigmask will have been stored in the signal frame, | ||
323 | * and will be restored by sigreturn, so we can simply | ||
324 | * clear the TS_RESTORE_SIGMASK flag. | ||
325 | */ | ||
326 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
327 | } | ||
328 | |||
329 | goto done; | 306 | goto done; |
330 | } | 307 | } |
331 | 308 | ||
@@ -350,10 +327,7 @@ void do_signal(struct pt_regs *regs) | |||
350 | } | 327 | } |
351 | 328 | ||
352 | /* If there's no signal to deliver, just put the saved sigmask back. */ | 329 | /* If there's no signal to deliver, just put the saved sigmask back. */ |
353 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) { | 330 | restore_saved_sigmask(); |
354 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
355 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
356 | } | ||
357 | 331 | ||
358 | done: | 332 | done: |
359 | /* Avoid double syscall restart if there are nested signals. */ | 333 | /* Avoid double syscall restart if there are nested signals. */ |
diff --git a/arch/um/include/shared/frame_kern.h b/arch/um/include/shared/frame_kern.h index 76078490c258..e584e40ee832 100644 --- a/arch/um/include/shared/frame_kern.h +++ b/arch/um/include/shared/frame_kern.h | |||
@@ -6,9 +6,6 @@ | |||
6 | #ifndef __FRAME_KERN_H_ | 6 | #ifndef __FRAME_KERN_H_ |
7 | #define __FRAME_KERN_H_ | 7 | #define __FRAME_KERN_H_ |
8 | 8 | ||
9 | #define _S(nr) (1<<((nr)-1)) | ||
10 | #define _BLOCKABLE (~(_S(SIGKILL) | _S(SIGSTOP))) | ||
11 | |||
12 | extern int setup_signal_stack_sc(unsigned long stack_top, int sig, | 9 | extern int setup_signal_stack_sc(unsigned long stack_top, int sig, |
13 | struct k_sigaction *ka, | 10 | struct k_sigaction *ka, |
14 | struct pt_regs *regs, | 11 | struct pt_regs *regs, |
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index 3a2235e0abc3..ccb9a9d283f1 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c | |||
@@ -117,11 +117,8 @@ void interrupt_end(void) | |||
117 | schedule(); | 117 | schedule(); |
118 | if (test_thread_flag(TIF_SIGPENDING)) | 118 | if (test_thread_flag(TIF_SIGPENDING)) |
119 | do_signal(); | 119 | do_signal(); |
120 | if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME)) { | 120 | if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME)) |
121 | tracehook_notify_resume(¤t->thread.regs); | 121 | tracehook_notify_resume(¤t->thread.regs); |
122 | if (current->replacement_session_keyring) | ||
123 | key_replace_session_keyring(); | ||
124 | } | ||
125 | } | 122 | } |
126 | 123 | ||
127 | void exit_thread(void) | 124 | void exit_thread(void) |
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c index 4d93dff6b371..3d15243ce692 100644 --- a/arch/um/kernel/reboot.c +++ b/arch/um/kernel/reboot.c | |||
@@ -4,7 +4,9 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "linux/sched.h" | 6 | #include "linux/sched.h" |
7 | #include "linux/spinlock.h" | ||
7 | #include "linux/slab.h" | 8 | #include "linux/slab.h" |
9 | #include "linux/oom.h" | ||
8 | #include "kern_util.h" | 10 | #include "kern_util.h" |
9 | #include "os.h" | 11 | #include "os.h" |
10 | #include "skas.h" | 12 | #include "skas.h" |
@@ -22,13 +24,18 @@ static void kill_off_processes(void) | |||
22 | struct task_struct *p; | 24 | struct task_struct *p; |
23 | int pid; | 25 | int pid; |
24 | 26 | ||
27 | read_lock(&tasklist_lock); | ||
25 | for_each_process(p) { | 28 | for_each_process(p) { |
26 | if (p->mm == NULL) | 29 | struct task_struct *t; |
27 | continue; | ||
28 | 30 | ||
29 | pid = p->mm->context.id.u.pid; | 31 | t = find_lock_task_mm(p); |
32 | if (!t) | ||
33 | continue; | ||
34 | pid = t->mm->context.id.u.pid; | ||
35 | task_unlock(t); | ||
30 | os_kill_ptraced_process(pid, 1); | 36 | os_kill_ptraced_process(pid, 1); |
31 | } | 37 | } |
38 | read_unlock(&tasklist_lock); | ||
32 | } | 39 | } |
33 | } | 40 | } |
34 | 41 | ||
diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c index 292e706016c5..7362d58efc29 100644 --- a/arch/um/kernel/signal.c +++ b/arch/um/kernel/signal.c | |||
@@ -15,17 +15,13 @@ | |||
15 | EXPORT_SYMBOL(block_signals); | 15 | EXPORT_SYMBOL(block_signals); |
16 | EXPORT_SYMBOL(unblock_signals); | 16 | EXPORT_SYMBOL(unblock_signals); |
17 | 17 | ||
18 | #define _S(nr) (1<<((nr)-1)) | ||
19 | |||
20 | #define _BLOCKABLE (~(_S(SIGKILL) | _S(SIGSTOP))) | ||
21 | |||
22 | /* | 18 | /* |
23 | * OK, we're invoking a handler | 19 | * OK, we're invoking a handler |
24 | */ | 20 | */ |
25 | static int handle_signal(struct pt_regs *regs, unsigned long signr, | 21 | static void handle_signal(struct pt_regs *regs, unsigned long signr, |
26 | struct k_sigaction *ka, siginfo_t *info, | 22 | struct k_sigaction *ka, siginfo_t *info) |
27 | sigset_t *oldset) | ||
28 | { | 23 | { |
24 | sigset_t *oldset = sigmask_to_save(); | ||
29 | unsigned long sp; | 25 | unsigned long sp; |
30 | int err; | 26 | int err; |
31 | 27 | ||
@@ -65,9 +61,7 @@ static int handle_signal(struct pt_regs *regs, unsigned long signr, | |||
65 | if (err) | 61 | if (err) |
66 | force_sigsegv(signr, current); | 62 | force_sigsegv(signr, current); |
67 | else | 63 | else |
68 | block_sigmask(ka, signr); | 64 | signal_delivered(signr, info, ka, regs, 0); |
69 | |||
70 | return err; | ||
71 | } | 65 | } |
72 | 66 | ||
73 | static int kern_do_signal(struct pt_regs *regs) | 67 | static int kern_do_signal(struct pt_regs *regs) |
@@ -77,24 +71,9 @@ static int kern_do_signal(struct pt_regs *regs) | |||
77 | int sig, handled_sig = 0; | 71 | int sig, handled_sig = 0; |
78 | 72 | ||
79 | while ((sig = get_signal_to_deliver(&info, &ka_copy, regs, NULL)) > 0) { | 73 | while ((sig = get_signal_to_deliver(&info, &ka_copy, regs, NULL)) > 0) { |
80 | sigset_t *oldset; | ||
81 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
82 | oldset = ¤t->saved_sigmask; | ||
83 | else | ||
84 | oldset = ¤t->blocked; | ||
85 | handled_sig = 1; | 74 | handled_sig = 1; |
86 | /* Whee! Actually deliver the signal. */ | 75 | /* Whee! Actually deliver the signal. */ |
87 | if (!handle_signal(regs, sig, &ka_copy, &info, oldset)) { | 76 | handle_signal(regs, sig, &ka_copy, &info); |
88 | /* | ||
89 | * a signal was successfully delivered; the saved | ||
90 | * sigmask will have been stored in the signal frame, | ||
91 | * and will be restored by sigreturn, so we can simply | ||
92 | * clear the TIF_RESTORE_SIGMASK flag | ||
93 | */ | ||
94 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
95 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
96 | break; | ||
97 | } | ||
98 | } | 77 | } |
99 | 78 | ||
100 | /* Did we come from a system call? */ | 79 | /* Did we come from a system call? */ |
@@ -130,10 +109,8 @@ static int kern_do_signal(struct pt_regs *regs) | |||
130 | * if there's no signal to deliver, we just put the saved sigmask | 109 | * if there's no signal to deliver, we just put the saved sigmask |
131 | * back | 110 | * back |
132 | */ | 111 | */ |
133 | if (!handled_sig && test_thread_flag(TIF_RESTORE_SIGMASK)) { | 112 | if (!handled_sig) |
134 | clear_thread_flag(TIF_RESTORE_SIGMASK); | 113 | restore_saved_sigmask(); |
135 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
136 | } | ||
137 | return handled_sig; | 114 | return handled_sig; |
138 | } | 115 | } |
139 | 116 | ||
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c index dafc94715950..3be60765c0e2 100644 --- a/arch/um/kernel/trap.c +++ b/arch/um/kernel/trap.c | |||
@@ -30,6 +30,8 @@ int handle_page_fault(unsigned long address, unsigned long ip, | |||
30 | pmd_t *pmd; | 30 | pmd_t *pmd; |
31 | pte_t *pte; | 31 | pte_t *pte; |
32 | int err = -EFAULT; | 32 | int err = -EFAULT; |
33 | unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE | | ||
34 | (is_write ? FAULT_FLAG_WRITE : 0); | ||
33 | 35 | ||
34 | *code_out = SEGV_MAPERR; | 36 | *code_out = SEGV_MAPERR; |
35 | 37 | ||
@@ -40,6 +42,7 @@ int handle_page_fault(unsigned long address, unsigned long ip, | |||
40 | if (in_atomic()) | 42 | if (in_atomic()) |
41 | goto out_nosemaphore; | 43 | goto out_nosemaphore; |
42 | 44 | ||
45 | retry: | ||
43 | down_read(&mm->mmap_sem); | 46 | down_read(&mm->mmap_sem); |
44 | vma = find_vma(mm, address); | 47 | vma = find_vma(mm, address); |
45 | if (!vma) | 48 | if (!vma) |
@@ -65,7 +68,11 @@ good_area: | |||
65 | do { | 68 | do { |
66 | int fault; | 69 | int fault; |
67 | 70 | ||
68 | fault = handle_mm_fault(mm, vma, address, is_write ? FAULT_FLAG_WRITE : 0); | 71 | fault = handle_mm_fault(mm, vma, address, flags); |
72 | |||
73 | if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) | ||
74 | goto out_nosemaphore; | ||
75 | |||
69 | if (unlikely(fault & VM_FAULT_ERROR)) { | 76 | if (unlikely(fault & VM_FAULT_ERROR)) { |
70 | if (fault & VM_FAULT_OOM) { | 77 | if (fault & VM_FAULT_OOM) { |
71 | goto out_of_memory; | 78 | goto out_of_memory; |
@@ -75,10 +82,17 @@ good_area: | |||
75 | } | 82 | } |
76 | BUG(); | 83 | BUG(); |
77 | } | 84 | } |
78 | if (fault & VM_FAULT_MAJOR) | 85 | if (flags & FAULT_FLAG_ALLOW_RETRY) { |
79 | current->maj_flt++; | 86 | if (fault & VM_FAULT_MAJOR) |
80 | else | 87 | current->maj_flt++; |
81 | current->min_flt++; | 88 | else |
89 | current->min_flt++; | ||
90 | if (fault & VM_FAULT_RETRY) { | ||
91 | flags &= ~FAULT_FLAG_ALLOW_RETRY; | ||
92 | |||
93 | goto retry; | ||
94 | } | ||
95 | } | ||
82 | 96 | ||
83 | pgd = pgd_offset(mm, address); | 97 | pgd = pgd_offset(mm, address); |
84 | pud = pud_offset(pgd, address); | 98 | pud = pud_offset(pgd, address); |
diff --git a/arch/unicore32/kernel/signal.c b/arch/unicore32/kernel/signal.c index 7754df6ef7d4..8adedb37720a 100644 --- a/arch/unicore32/kernel/signal.c +++ b/arch/unicore32/kernel/signal.c | |||
@@ -21,8 +21,6 @@ | |||
21 | #include <asm/cacheflush.h> | 21 | #include <asm/cacheflush.h> |
22 | #include <asm/ucontext.h> | 22 | #include <asm/ucontext.h> |
23 | 23 | ||
24 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
25 | |||
26 | /* | 24 | /* |
27 | * For UniCore syscalls, we encode the syscall number into the instruction. | 25 | * For UniCore syscalls, we encode the syscall number into the instruction. |
28 | */ | 26 | */ |
@@ -61,10 +59,8 @@ static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf) | |||
61 | int err; | 59 | int err; |
62 | 60 | ||
63 | err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set)); | 61 | err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set)); |
64 | if (err == 0) { | 62 | if (err == 0) |
65 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
66 | set_current_blocked(&set); | 63 | set_current_blocked(&set); |
67 | } | ||
68 | 64 | ||
69 | err |= __get_user(regs->UCreg_00, &sf->uc.uc_mcontext.regs.UCreg_00); | 65 | err |= __get_user(regs->UCreg_00, &sf->uc.uc_mcontext.regs.UCreg_00); |
70 | err |= __get_user(regs->UCreg_01, &sf->uc.uc_mcontext.regs.UCreg_01); | 66 | err |= __get_user(regs->UCreg_01, &sf->uc.uc_mcontext.regs.UCreg_01); |
@@ -312,13 +308,12 @@ static inline void setup_syscall_restart(struct pt_regs *regs) | |||
312 | /* | 308 | /* |
313 | * OK, we're invoking a handler | 309 | * OK, we're invoking a handler |
314 | */ | 310 | */ |
315 | static int handle_signal(unsigned long sig, struct k_sigaction *ka, | 311 | static void handle_signal(unsigned long sig, struct k_sigaction *ka, |
316 | siginfo_t *info, sigset_t *oldset, | 312 | siginfo_t *info, struct pt_regs *regs, int syscall) |
317 | struct pt_regs *regs, int syscall) | ||
318 | { | 313 | { |
319 | struct thread_info *thread = current_thread_info(); | 314 | struct thread_info *thread = current_thread_info(); |
320 | struct task_struct *tsk = current; | 315 | struct task_struct *tsk = current; |
321 | sigset_t blocked; | 316 | sigset_t *oldset = sigmask_to_save(); |
322 | int usig = sig; | 317 | int usig = sig; |
323 | int ret; | 318 | int ret; |
324 | 319 | ||
@@ -364,15 +359,10 @@ static int handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
364 | 359 | ||
365 | if (ret != 0) { | 360 | if (ret != 0) { |
366 | force_sigsegv(sig, tsk); | 361 | force_sigsegv(sig, tsk); |
367 | return ret; | 362 | return; |
368 | } | 363 | } |
369 | 364 | ||
370 | /* | 365 | signal_delivered(sig, info, ka, regs, 0); |
371 | * Block the signal if we were successful. | ||
372 | */ | ||
373 | block_sigmask(ka, sig); | ||
374 | |||
375 | return 0; | ||
376 | } | 366 | } |
377 | 367 | ||
378 | /* | 368 | /* |
@@ -399,32 +389,12 @@ static void do_signal(struct pt_regs *regs, int syscall) | |||
399 | if (!user_mode(regs)) | 389 | if (!user_mode(regs)) |
400 | return; | 390 | return; |
401 | 391 | ||
402 | if (try_to_freeze()) | ||
403 | goto no_signal; | ||
404 | |||
405 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 392 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
406 | if (signr > 0) { | 393 | if (signr > 0) { |
407 | sigset_t *oldset; | 394 | handle_signal(signr, &ka, &info, regs, syscall); |
408 | |||
409 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
410 | oldset = ¤t->saved_sigmask; | ||
411 | else | ||
412 | oldset = ¤t->blocked; | ||
413 | if (handle_signal(signr, &ka, &info, oldset, regs, syscall) | ||
414 | == 0) { | ||
415 | /* | ||
416 | * A signal was successfully delivered; the saved | ||
417 | * sigmask will have been stored in the signal frame, | ||
418 | * and will be restored by sigreturn, so we can simply | ||
419 | * clear the TIF_RESTORE_SIGMASK flag. | ||
420 | */ | ||
421 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
422 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
423 | } | ||
424 | return; | 395 | return; |
425 | } | 396 | } |
426 | 397 | ||
427 | no_signal: | ||
428 | /* | 398 | /* |
429 | * No signal to deliver to the process - restart the syscall. | 399 | * No signal to deliver to the process - restart the syscall. |
430 | */ | 400 | */ |
@@ -451,8 +421,7 @@ static void do_signal(struct pt_regs *regs, int syscall) | |||
451 | /* If there's no signal to deliver, we just put the saved | 421 | /* If there's no signal to deliver, we just put the saved |
452 | * sigmask back. | 422 | * sigmask back. |
453 | */ | 423 | */ |
454 | if (test_and_clear_thread_flag(TIF_RESTORE_SIGMASK)) | 424 | restore_saved_sigmask(); |
455 | set_current_blocked(¤t->saved_sigmask); | ||
456 | } | 425 | } |
457 | 426 | ||
458 | asmlinkage void do_notify_resume(struct pt_regs *regs, | 427 | asmlinkage void do_notify_resume(struct pt_regs *regs, |
@@ -464,8 +433,6 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, | |||
464 | if (thread_flags & _TIF_NOTIFY_RESUME) { | 433 | if (thread_flags & _TIF_NOTIFY_RESUME) { |
465 | clear_thread_flag(TIF_NOTIFY_RESUME); | 434 | clear_thread_flag(TIF_NOTIFY_RESUME); |
466 | tracehook_notify_resume(regs); | 435 | tracehook_notify_resume(regs); |
467 | if (current->replacement_session_keyring) | ||
468 | key_replace_session_keyring(); | ||
469 | } | 436 | } |
470 | } | 437 | } |
471 | 438 | ||
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c index 98bd70faccc5..daeca56211e3 100644 --- a/arch/x86/ia32/ia32_signal.c +++ b/arch/x86/ia32/ia32_signal.c | |||
@@ -273,7 +273,6 @@ asmlinkage long sys32_sigreturn(struct pt_regs *regs) | |||
273 | sizeof(frame->extramask)))) | 273 | sizeof(frame->extramask)))) |
274 | goto badframe; | 274 | goto badframe; |
275 | 275 | ||
276 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
277 | set_current_blocked(&set); | 276 | set_current_blocked(&set); |
278 | 277 | ||
279 | if (ia32_restore_sigcontext(regs, &frame->sc, &ax)) | 278 | if (ia32_restore_sigcontext(regs, &frame->sc, &ax)) |
@@ -299,7 +298,6 @@ asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs) | |||
299 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 298 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
300 | goto badframe; | 299 | goto badframe; |
301 | 300 | ||
302 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
303 | set_current_blocked(&set); | 301 | set_current_blocked(&set); |
304 | 302 | ||
305 | if (ia32_restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax)) | 303 | if (ia32_restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax)) |
diff --git a/arch/x86/include/asm/posix_types_32.h b/arch/x86/include/asm/posix_types_32.h index 99f262e04b91..8e525059e7d8 100644 --- a/arch/x86/include/asm/posix_types_32.h +++ b/arch/x86/include/asm/posix_types_32.h | |||
@@ -10,9 +10,6 @@ | |||
10 | typedef unsigned short __kernel_mode_t; | 10 | typedef unsigned short __kernel_mode_t; |
11 | #define __kernel_mode_t __kernel_mode_t | 11 | #define __kernel_mode_t __kernel_mode_t |
12 | 12 | ||
13 | typedef unsigned short __kernel_nlink_t; | ||
14 | #define __kernel_nlink_t __kernel_nlink_t | ||
15 | |||
16 | typedef unsigned short __kernel_ipc_pid_t; | 13 | typedef unsigned short __kernel_ipc_pid_t; |
17 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t | 14 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t |
18 | 15 | ||
diff --git a/arch/x86/include/asm/sighandling.h b/arch/x86/include/asm/sighandling.h index ada93b3b8c66..beff97f7df37 100644 --- a/arch/x86/include/asm/sighandling.h +++ b/arch/x86/include/asm/sighandling.h | |||
@@ -7,8 +7,6 @@ | |||
7 | 7 | ||
8 | #include <asm/processor-flags.h> | 8 | #include <asm/processor-flags.h> |
9 | 9 | ||
10 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
11 | |||
12 | #define __FIX_EFLAGS (X86_EFLAGS_AC | X86_EFLAGS_OF | \ | 10 | #define __FIX_EFLAGS (X86_EFLAGS_AC | X86_EFLAGS_OF | \ |
13 | X86_EFLAGS_DF | X86_EFLAGS_TF | X86_EFLAGS_SF | \ | 11 | X86_EFLAGS_DF | X86_EFLAGS_TF | X86_EFLAGS_SF | \ |
14 | X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \ | 12 | X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \ |
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index 5c25de07cba8..89f794f007ec 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h | |||
@@ -248,7 +248,23 @@ static inline void set_restore_sigmask(void) | |||
248 | { | 248 | { |
249 | struct thread_info *ti = current_thread_info(); | 249 | struct thread_info *ti = current_thread_info(); |
250 | ti->status |= TS_RESTORE_SIGMASK; | 250 | ti->status |= TS_RESTORE_SIGMASK; |
251 | set_bit(TIF_SIGPENDING, (unsigned long *)&ti->flags); | 251 | WARN_ON(!test_bit(TIF_SIGPENDING, (unsigned long *)&ti->flags)); |
252 | } | ||
253 | static inline void clear_restore_sigmask(void) | ||
254 | { | ||
255 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
256 | } | ||
257 | static inline bool test_restore_sigmask(void) | ||
258 | { | ||
259 | return current_thread_info()->status & TS_RESTORE_SIGMASK; | ||
260 | } | ||
261 | static inline bool test_and_clear_restore_sigmask(void) | ||
262 | { | ||
263 | struct thread_info *ti = current_thread_info(); | ||
264 | if (!(ti->status & TS_RESTORE_SIGMASK)) | ||
265 | return false; | ||
266 | ti->status &= ~TS_RESTORE_SIGMASK; | ||
267 | return true; | ||
252 | } | 268 | } |
253 | 269 | ||
254 | static inline bool is_ia32_task(void) | 270 | static inline bool is_ia32_task(void) |
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index 01ccf9b71473..623f28837476 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
@@ -316,7 +316,6 @@ ret_from_exception: | |||
316 | preempt_stop(CLBR_ANY) | 316 | preempt_stop(CLBR_ANY) |
317 | ret_from_intr: | 317 | ret_from_intr: |
318 | GET_THREAD_INFO(%ebp) | 318 | GET_THREAD_INFO(%ebp) |
319 | resume_userspace_sig: | ||
320 | #ifdef CONFIG_VM86 | 319 | #ifdef CONFIG_VM86 |
321 | movl PT_EFLAGS(%esp), %eax # mix EFLAGS and CS | 320 | movl PT_EFLAGS(%esp), %eax # mix EFLAGS and CS |
322 | movb PT_CS(%esp), %al | 321 | movb PT_CS(%esp), %al |
@@ -615,9 +614,13 @@ work_notifysig: # deal with pending signals and | |||
615 | # vm86-space | 614 | # vm86-space |
616 | TRACE_IRQS_ON | 615 | TRACE_IRQS_ON |
617 | ENABLE_INTERRUPTS(CLBR_NONE) | 616 | ENABLE_INTERRUPTS(CLBR_NONE) |
617 | movb PT_CS(%esp), %bl | ||
618 | andb $SEGMENT_RPL_MASK, %bl | ||
619 | cmpb $USER_RPL, %bl | ||
620 | jb resume_kernel | ||
618 | xorl %edx, %edx | 621 | xorl %edx, %edx |
619 | call do_notify_resume | 622 | call do_notify_resume |
620 | jmp resume_userspace_sig | 623 | jmp resume_userspace |
621 | 624 | ||
622 | ALIGN | 625 | ALIGN |
623 | work_notifysig_v86: | 626 | work_notifysig_v86: |
@@ -630,9 +633,13 @@ work_notifysig_v86: | |||
630 | #endif | 633 | #endif |
631 | TRACE_IRQS_ON | 634 | TRACE_IRQS_ON |
632 | ENABLE_INTERRUPTS(CLBR_NONE) | 635 | ENABLE_INTERRUPTS(CLBR_NONE) |
636 | movb PT_CS(%esp), %bl | ||
637 | andb $SEGMENT_RPL_MASK, %bl | ||
638 | cmpb $USER_RPL, %bl | ||
639 | jb resume_kernel | ||
633 | xorl %edx, %edx | 640 | xorl %edx, %edx |
634 | call do_notify_resume | 641 | call do_notify_resume |
635 | jmp resume_userspace_sig | 642 | jmp resume_userspace |
636 | END(work_pending) | 643 | END(work_pending) |
637 | 644 | ||
638 | # perform syscall exit tracing | 645 | # perform syscall exit tracing |
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c index 965dfda0fd5e..21af737053aa 100644 --- a/arch/x86/kernel/signal.c +++ b/arch/x86/kernel/signal.c | |||
@@ -555,7 +555,6 @@ unsigned long sys_sigreturn(struct pt_regs *regs) | |||
555 | sizeof(frame->extramask)))) | 555 | sizeof(frame->extramask)))) |
556 | goto badframe; | 556 | goto badframe; |
557 | 557 | ||
558 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
559 | set_current_blocked(&set); | 558 | set_current_blocked(&set); |
560 | 559 | ||
561 | if (restore_sigcontext(regs, &frame->sc, &ax)) | 560 | if (restore_sigcontext(regs, &frame->sc, &ax)) |
@@ -581,7 +580,6 @@ long sys_rt_sigreturn(struct pt_regs *regs) | |||
581 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 580 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
582 | goto badframe; | 581 | goto badframe; |
583 | 582 | ||
584 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
585 | set_current_blocked(&set); | 583 | set_current_blocked(&set); |
586 | 584 | ||
587 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax)) | 585 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax)) |
@@ -647,42 +645,28 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
647 | struct pt_regs *regs) | 645 | struct pt_regs *regs) |
648 | { | 646 | { |
649 | int usig = signr_convert(sig); | 647 | int usig = signr_convert(sig); |
650 | sigset_t *set = ¤t->blocked; | 648 | sigset_t *set = sigmask_to_save(); |
651 | int ret; | ||
652 | |||
653 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) | ||
654 | set = ¤t->saved_sigmask; | ||
655 | 649 | ||
656 | /* Set up the stack frame */ | 650 | /* Set up the stack frame */ |
657 | if (is_ia32) { | 651 | if (is_ia32) { |
658 | if (ka->sa.sa_flags & SA_SIGINFO) | 652 | if (ka->sa.sa_flags & SA_SIGINFO) |
659 | ret = ia32_setup_rt_frame(usig, ka, info, set, regs); | 653 | return ia32_setup_rt_frame(usig, ka, info, set, regs); |
660 | else | 654 | else |
661 | ret = ia32_setup_frame(usig, ka, set, regs); | 655 | return ia32_setup_frame(usig, ka, set, regs); |
662 | #ifdef CONFIG_X86_X32_ABI | 656 | #ifdef CONFIG_X86_X32_ABI |
663 | } else if (is_x32) { | 657 | } else if (is_x32) { |
664 | ret = x32_setup_rt_frame(usig, ka, info, | 658 | return x32_setup_rt_frame(usig, ka, info, |
665 | (compat_sigset_t *)set, regs); | 659 | (compat_sigset_t *)set, regs); |
666 | #endif | 660 | #endif |
667 | } else { | 661 | } else { |
668 | ret = __setup_rt_frame(sig, ka, info, set, regs); | 662 | return __setup_rt_frame(sig, ka, info, set, regs); |
669 | } | ||
670 | |||
671 | if (ret) { | ||
672 | force_sigsegv(sig, current); | ||
673 | return -EFAULT; | ||
674 | } | 663 | } |
675 | |||
676 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
677 | return ret; | ||
678 | } | 664 | } |
679 | 665 | ||
680 | static int | 666 | static void |
681 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | 667 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, |
682 | struct pt_regs *regs) | 668 | struct pt_regs *regs) |
683 | { | 669 | { |
684 | int ret; | ||
685 | |||
686 | /* Are we from a system call? */ | 670 | /* Are we from a system call? */ |
687 | if (syscall_get_nr(current, regs) >= 0) { | 671 | if (syscall_get_nr(current, regs) >= 0) { |
688 | /* If so, check system call restarting.. */ | 672 | /* If so, check system call restarting.. */ |
@@ -713,10 +697,10 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
713 | likely(test_and_clear_thread_flag(TIF_FORCED_TF))) | 697 | likely(test_and_clear_thread_flag(TIF_FORCED_TF))) |
714 | regs->flags &= ~X86_EFLAGS_TF; | 698 | regs->flags &= ~X86_EFLAGS_TF; |
715 | 699 | ||
716 | ret = setup_rt_frame(sig, ka, info, regs); | 700 | if (setup_rt_frame(sig, ka, info, regs) < 0) { |
717 | 701 | force_sigsegv(sig, current); | |
718 | if (ret) | 702 | return; |
719 | return ret; | 703 | } |
720 | 704 | ||
721 | /* | 705 | /* |
722 | * Clear the direction flag as per the ABI for function entry. | 706 | * Clear the direction flag as per the ABI for function entry. |
@@ -731,12 +715,8 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
731 | */ | 715 | */ |
732 | regs->flags &= ~X86_EFLAGS_TF; | 716 | regs->flags &= ~X86_EFLAGS_TF; |
733 | 717 | ||
734 | block_sigmask(ka, sig); | 718 | signal_delivered(sig, info, ka, regs, |
735 | 719 | test_thread_flag(TIF_SINGLESTEP)); | |
736 | tracehook_signal_handler(sig, info, ka, regs, | ||
737 | test_thread_flag(TIF_SINGLESTEP)); | ||
738 | |||
739 | return 0; | ||
740 | } | 720 | } |
741 | 721 | ||
742 | #ifdef CONFIG_X86_32 | 722 | #ifdef CONFIG_X86_32 |
@@ -757,16 +737,6 @@ static void do_signal(struct pt_regs *regs) | |||
757 | siginfo_t info; | 737 | siginfo_t info; |
758 | int signr; | 738 | int signr; |
759 | 739 | ||
760 | /* | ||
761 | * We want the common case to go fast, which is why we may in certain | ||
762 | * cases get here from kernel mode. Just return without doing anything | ||
763 | * if so. | ||
764 | * X86_32: vm86 regs switched out by assembly code before reaching | ||
765 | * here, so testing against kernel CS suffices. | ||
766 | */ | ||
767 | if (!user_mode(regs)) | ||
768 | return; | ||
769 | |||
770 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 740 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
771 | if (signr > 0) { | 741 | if (signr > 0) { |
772 | /* Whee! Actually deliver the signal. */ | 742 | /* Whee! Actually deliver the signal. */ |
@@ -796,10 +766,7 @@ static void do_signal(struct pt_regs *regs) | |||
796 | * If there's no signal to deliver, we just put the saved sigmask | 766 | * If there's no signal to deliver, we just put the saved sigmask |
797 | * back. | 767 | * back. |
798 | */ | 768 | */ |
799 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) { | 769 | restore_saved_sigmask(); |
800 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
801 | set_current_blocked(¤t->saved_sigmask); | ||
802 | } | ||
803 | } | 770 | } |
804 | 771 | ||
805 | /* | 772 | /* |
@@ -827,8 +794,6 @@ do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags) | |||
827 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | 794 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { |
828 | clear_thread_flag(TIF_NOTIFY_RESUME); | 795 | clear_thread_flag(TIF_NOTIFY_RESUME); |
829 | tracehook_notify_resume(regs); | 796 | tracehook_notify_resume(regs); |
830 | if (current->replacement_session_keyring) | ||
831 | key_replace_session_keyring(); | ||
832 | } | 797 | } |
833 | if (thread_info_flags & _TIF_USER_RETURN_NOTIFY) | 798 | if (thread_info_flags & _TIF_USER_RETURN_NOTIFY) |
834 | fire_user_return_notifiers(); | 799 | fire_user_return_notifiers(); |
@@ -936,7 +901,6 @@ asmlinkage long sys32_x32_rt_sigreturn(struct pt_regs *regs) | |||
936 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 901 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
937 | goto badframe; | 902 | goto badframe; |
938 | 903 | ||
939 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
940 | set_current_blocked(&set); | 904 | set_current_blocked(&set); |
941 | 905 | ||
942 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax)) | 906 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax)) |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 72102e0ab7cb..be3cea4407ff 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -2595,8 +2595,7 @@ static void transparent_hugepage_adjust(struct kvm_vcpu *vcpu, | |||
2595 | *gfnp = gfn; | 2595 | *gfnp = gfn; |
2596 | kvm_release_pfn_clean(pfn); | 2596 | kvm_release_pfn_clean(pfn); |
2597 | pfn &= ~mask; | 2597 | pfn &= ~mask; |
2598 | if (!get_page_unless_zero(pfn_to_page(pfn))) | 2598 | kvm_get_pfn(pfn); |
2599 | BUG(); | ||
2600 | *pfnp = pfn; | 2599 | *pfnp = pfn; |
2601 | } | 2600 | } |
2602 | } | 2601 | } |
diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl index 29f9f0554f7d..7a35a6e71d44 100644 --- a/arch/x86/syscalls/syscall_32.tbl +++ b/arch/x86/syscalls/syscall_32.tbl | |||
@@ -355,3 +355,4 @@ | |||
355 | 346 i386 setns sys_setns | 355 | 346 i386 setns sys_setns |
356 | 347 i386 process_vm_readv sys_process_vm_readv compat_sys_process_vm_readv | 356 | 347 i386 process_vm_readv sys_process_vm_readv compat_sys_process_vm_readv |
357 | 348 i386 process_vm_writev sys_process_vm_writev compat_sys_process_vm_writev | 357 | 348 i386 process_vm_writev sys_process_vm_writev compat_sys_process_vm_writev |
358 | 349 i386 kcmp sys_kcmp | ||
diff --git a/arch/x86/syscalls/syscall_64.tbl b/arch/x86/syscalls/syscall_64.tbl index dd29a9ea27c5..51171aeff0dc 100644 --- a/arch/x86/syscalls/syscall_64.tbl +++ b/arch/x86/syscalls/syscall_64.tbl | |||
@@ -318,6 +318,8 @@ | |||
318 | 309 common getcpu sys_getcpu | 318 | 309 common getcpu sys_getcpu |
319 | 310 64 process_vm_readv sys_process_vm_readv | 319 | 310 64 process_vm_readv sys_process_vm_readv |
320 | 311 64 process_vm_writev sys_process_vm_writev | 320 | 311 64 process_vm_writev sys_process_vm_writev |
321 | 312 64 kcmp sys_kcmp | ||
322 | |||
321 | # | 323 | # |
322 | # x32-specific system call numbers start at 512 to avoid cache impact | 324 | # x32-specific system call numbers start at 512 to avoid cache impact |
323 | # for native 64-bit operation. | 325 | # for native 64-bit operation. |
diff --git a/arch/x86/um/signal.c b/arch/x86/um/signal.c index bb0fb03b9f85..a508cea13503 100644 --- a/arch/x86/um/signal.c +++ b/arch/x86/um/signal.c | |||
@@ -486,7 +486,6 @@ long sys_sigreturn(struct pt_regs *regs) | |||
486 | copy_from_user(&set.sig[1], extramask, sig_size)) | 486 | copy_from_user(&set.sig[1], extramask, sig_size)) |
487 | goto segfault; | 487 | goto segfault; |
488 | 488 | ||
489 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
490 | set_current_blocked(&set); | 489 | set_current_blocked(&set); |
491 | 490 | ||
492 | if (copy_sc_from_user(¤t->thread.regs, sc)) | 491 | if (copy_sc_from_user(¤t->thread.regs, sc)) |
@@ -600,7 +599,6 @@ long sys_rt_sigreturn(struct pt_regs *regs) | |||
600 | if (copy_from_user(&set, &uc->uc_sigmask, sizeof(set))) | 599 | if (copy_from_user(&set, &uc->uc_sigmask, sizeof(set))) |
601 | goto segfault; | 600 | goto segfault; |
602 | 601 | ||
603 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
604 | set_current_blocked(&set); | 602 | set_current_blocked(&set); |
605 | 603 | ||
606 | if (copy_sc_from_user(¤t->thread.regs, &uc->uc_mcontext)) | 604 | if (copy_sc_from_user(¤t->thread.regs, &uc->uc_mcontext)) |
diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c index c5e4ec0598d2..b9f8e5850d3a 100644 --- a/arch/xtensa/kernel/signal.c +++ b/arch/xtensa/kernel/signal.c | |||
@@ -30,8 +30,6 @@ | |||
30 | 30 | ||
31 | #define DEBUG_SIG 0 | 31 | #define DEBUG_SIG 0 |
32 | 32 | ||
33 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
34 | |||
35 | extern struct task_struct *coproc_owners[]; | 33 | extern struct task_struct *coproc_owners[]; |
36 | 34 | ||
37 | struct rt_sigframe | 35 | struct rt_sigframe |
@@ -261,7 +259,6 @@ asmlinkage long xtensa_rt_sigreturn(long a0, long a1, long a2, long a3, | |||
261 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 259 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
262 | goto badframe; | 260 | goto badframe; |
263 | 261 | ||
264 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
265 | set_current_blocked(&set); | 262 | set_current_blocked(&set); |
266 | 263 | ||
267 | if (restore_sigcontext(regs, frame)) | 264 | if (restore_sigcontext(regs, frame)) |
@@ -452,15 +449,6 @@ static void do_signal(struct pt_regs *regs) | |||
452 | siginfo_t info; | 449 | siginfo_t info; |
453 | int signr; | 450 | int signr; |
454 | struct k_sigaction ka; | 451 | struct k_sigaction ka; |
455 | sigset_t oldset; | ||
456 | |||
457 | if (try_to_freeze()) | ||
458 | goto no_signal; | ||
459 | |||
460 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
461 | oldset = ¤t->saved_sigmask; | ||
462 | else | ||
463 | oldset = ¤t->blocked; | ||
464 | 452 | ||
465 | task_pt_regs(current)->icountlevel = 0; | 453 | task_pt_regs(current)->icountlevel = 0; |
466 | 454 | ||
@@ -501,19 +489,17 @@ static void do_signal(struct pt_regs *regs) | |||
501 | 489 | ||
502 | /* Whee! Actually deliver the signal. */ | 490 | /* Whee! Actually deliver the signal. */ |
503 | /* Set up the stack frame */ | 491 | /* Set up the stack frame */ |
504 | ret = setup_frame(signr, &ka, &info, oldset, regs); | 492 | ret = setup_frame(signr, &ka, &info, sigmask_to_save(), regs); |
505 | if (ret) | 493 | if (ret) |
506 | return; | 494 | return; |
507 | 495 | ||
508 | clear_thread_flag(TIF_RESTORE_SIGMASK); | 496 | signal_delivered(signr, info, ka, regs, 0); |
509 | block_sigmask(&ka, signr); | ||
510 | if (current->ptrace & PT_SINGLESTEP) | 497 | if (current->ptrace & PT_SINGLESTEP) |
511 | task_pt_regs(current)->icountlevel = 1; | 498 | task_pt_regs(current)->icountlevel = 1; |
512 | 499 | ||
513 | return; | 500 | return; |
514 | } | 501 | } |
515 | 502 | ||
516 | no_signal: | ||
517 | /* Did we come from a system call? */ | 503 | /* Did we come from a system call? */ |
518 | if ((signed) regs->syscall >= 0) { | 504 | if ((signed) regs->syscall >= 0) { |
519 | /* Restart the system call - no handlers present */ | 505 | /* Restart the system call - no handlers present */ |
@@ -532,8 +518,7 @@ no_signal: | |||
532 | } | 518 | } |
533 | 519 | ||
534 | /* If there's no signal to deliver, we just restore the saved mask. */ | 520 | /* If there's no signal to deliver, we just restore the saved mask. */ |
535 | if (test_and_clear_thread_flag(TIF_RESTORE_SIGMASK)) | 521 | restore_saved_sigmask(); |
536 | set_current_blocked(¤t->saved_sigmask); | ||
537 | 522 | ||
538 | if (current->ptrace & PT_SINGLESTEP) | 523 | if (current->ptrace & PT_SINGLESTEP) |
539 | task_pt_regs(current)->icountlevel = 1; | 524 | task_pt_regs(current)->icountlevel = 1; |
@@ -548,9 +533,6 @@ void do_notify_resume(struct pt_regs *regs) | |||
548 | if (test_thread_flag(TIF_SIGPENDING)) | 533 | if (test_thread_flag(TIF_SIGPENDING)) |
549 | do_signal(regs); | 534 | do_signal(regs); |
550 | 535 | ||
551 | if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME)) { | 536 | if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME)) |
552 | tracehook_notify_resume(regs); | 537 | tracehook_notify_resume(regs); |
553 | if (current->replacement_session_keyring) | ||
554 | key_replace_session_keyring(); | ||
555 | } | ||
556 | } | 538 | } |