Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix of Linux signals for LM32 arch

  • Loading branch information...
commit c03a5b5ecbe69f0503a3f9c6db3c250382268f9c 1 parent 329e85e
authored March 08, 2012 sbourdeauducq committed March 12, 2012

Showing 1 changed file with 16 additions and 1 deletion. Show diff stats Hide diff stats

  1. 17  arch/lm32/kernel/signal.c
17  arch/lm32/kernel/signal.c
@@ -49,6 +49,7 @@
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,6 +236,11 @@ 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;
@@ -242,11 +248,16 @@ static int do_signal(int retval, struct pt_regs *regs)
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 notes on commit c03a5b5

Please sign in to comment.
Something went wrong with that request. Please try again.