49
49
#include <linux/personality.h>
50
50
#include <linux/tty.h>
51
51
#include <linux/hardirq.h>
52
+ #include <linux/freezer.h>
52
53
53
54
#include <asm/uaccess.h>
54
55
#include <asm/ucontext.h>
@@ -189,7 +190,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka,
189
190
190
191
#if DEBUG_SIG
191
192
printk ("SIG deliver (%s:%d): frame=%p, sp=%p ra=%08lx ea=%08lx, signal(r1)=%d\n" ,
192
- current -> comm , current -> pid , frame , regs -> sp , regs -> ra , regs -> ea , signal );
193
+ current -> comm , current -> pid , frame , regs -> sp , regs -> ra , regs -> ea , sig );
193
194
#endif
194
195
195
196
return regs -> r1 ;
@@ -235,18 +236,28 @@ static int do_signal(int retval, struct pt_regs *regs)
235
236
* kernel mode. Just return without doing anything
236
237
* if so.
237
238
*/
239
+ if (!user_mode (regs ))
240
+ return 0 ;
241
+
242
+ if (try_to_freeze ())
243
+ goto no_signal ;
238
244
239
245
if (test_thread_flag (TIF_RESTORE_SIGMASK ))
240
246
oldset = & current -> saved_sigmask ;
241
247
else
242
248
oldset = & current -> blocked ;
243
249
244
250
signr = get_signal_to_deliver (& info , & ka , regs , NULL );
251
+
245
252
if (signr > 0 ) {
246
253
/* Whee! Actually deliver the signal. */
247
254
handle_signal (signr , & info , & ka , oldset , regs );
255
+ if (test_thread_flag (TIF_RESTORE_SIGMASK ))
256
+ clear_thread_flag (TIF_RESTORE_SIGMASK );
257
+ return signr ;
248
258
}
249
259
260
+ no_signal :
250
261
/* Did we come from a system call? */
251
262
if (regs -> r8 ) {
252
263
/* Restart the system call - no handlers present */
@@ -261,6 +272,10 @@ static int do_signal(int retval, struct pt_regs *regs)
261
272
regs -> ea -= 4 ; /* Size of scall insn. */
262
273
}
263
274
}
275
+ if (test_thread_flag (TIF_RESTORE_SIGMASK )) {
276
+ clear_thread_flag (TIF_RESTORE_SIGMASK );
277
+ sigprocmask (SIG_SETMASK , & current -> saved_sigmask , NULL );
278
+ }
264
279
265
280
return retval ;
266
281
}
0 commit comments