Skip to content

Commit c03a5b5

Browse files
Sergey KoulikSebastien Bourdeauducq
Sergey Koulik
authored and
Sebastien Bourdeauducq
committedMar 12, 2012
Fix of Linux signals for LM32 arch
1 parent 329e85e commit c03a5b5

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed
 

‎arch/lm32/kernel/signal.c

+16-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include <linux/personality.h>
5050
#include <linux/tty.h>
5151
#include <linux/hardirq.h>
52+
#include <linux/freezer.h>
5253

5354
#include <asm/uaccess.h>
5455
#include <asm/ucontext.h>
@@ -189,7 +190,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka,
189190

190191
#if DEBUG_SIG
191192
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);
193194
#endif
194195

195196
return regs->r1;
@@ -235,18 +236,28 @@ static int do_signal(int retval, struct pt_regs *regs)
235236
* kernel mode. Just return without doing anything
236237
* if so.
237238
*/
239+
if (!user_mode(regs))
240+
return 0;
241+
242+
if (try_to_freeze())
243+
goto no_signal;
238244

239245
if (test_thread_flag(TIF_RESTORE_SIGMASK))
240246
oldset = &current->saved_sigmask;
241247
else
242248
oldset = &current->blocked;
243249

244250
signr = get_signal_to_deliver(&info, &ka, regs, NULL);
251+
245252
if (signr > 0) {
246253
/* Whee! Actually deliver the signal. */
247254
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;
248258
}
249259

260+
no_signal:
250261
/* Did we come from a system call? */
251262
if (regs->r8) {
252263
/* Restart the system call - no handlers present */
@@ -261,6 +272,10 @@ static int do_signal(int retval, struct pt_regs *regs)
261272
regs->ea -= 4; /* Size of scall insn. */
262273
}
263274
}
275+
if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
276+
clear_thread_flag(TIF_RESTORE_SIGMASK);
277+
sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
278+
}
264279

265280
return retval;
266281
}

0 commit comments

Comments
 (0)
Please sign in to comment.