aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2015-02-03 15:52:47 -0500
committerHelge Deller <deller@gmx.de>2015-02-16 16:31:21 -0500
commit0bd1e94bf3da386510186cb2acd3e91f0ea59bc6 (patch)
tree7245097bc5cbe6f211db48ec230a3712b33201ca /arch/parisc
parentfb96a796f2b42eb20cfad80c5e7e2702948a0794 (diff)
parisc: Add error checks when building up signal trampoline handler
Add checks if the userspace trampoline code was correctly generated by the signal trampoline generation code. In addition only flush caches as needed and fix the old flushing code which didn't flushed all generated instructions. Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'arch/parisc')
-rw-r--r--arch/parisc/kernel/signal.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c
index 9b910a0251b8..1fd300c00a80 100644
--- a/arch/parisc/kernel/signal.c
+++ b/arch/parisc/kernel/signal.c
@@ -476,6 +476,9 @@ insert_restart_trampoline(struct pt_regs *regs)
476 case -ERESTART_RESTARTBLOCK: { 476 case -ERESTART_RESTARTBLOCK: {
477 /* Restart the system call - no handlers present */ 477 /* Restart the system call - no handlers present */
478 unsigned int *usp = (unsigned int *)regs->gr[30]; 478 unsigned int *usp = (unsigned int *)regs->gr[30];
479 unsigned long start = (unsigned long) &usp[2];
480 unsigned long end = (unsigned long) &usp[5];
481 long err = 0;
479 482
480 /* Setup a trampoline to restart the syscall 483 /* Setup a trampoline to restart the syscall
481 * with __NR_restart_syscall 484 * with __NR_restart_syscall
@@ -487,23 +490,21 @@ insert_restart_trampoline(struct pt_regs *regs)
487 * 16: ldi __NR_restart_syscall, %r20 490 * 16: ldi __NR_restart_syscall, %r20
488 */ 491 */
489#ifdef CONFIG_64BIT 492#ifdef CONFIG_64BIT
490 put_user(regs->gr[31] >> 32, &usp[0]); 493 err |= put_user(regs->gr[31] >> 32, &usp[0]);
491 put_user(regs->gr[31] & 0xffffffff, &usp[1]); 494 err |= put_user(regs->gr[31] & 0xffffffff, &usp[1]);
492 put_user(0x0fc010df, &usp[2]); 495 err |= put_user(0x0fc010df, &usp[2]);
493#else 496#else
494 put_user(regs->gr[31], &usp[0]); 497 err |= put_user(regs->gr[31], &usp[0]);
495 put_user(0x0fc0109f, &usp[2]); 498 err |= put_user(0x0fc0109f, &usp[2]);
496#endif 499#endif
497 put_user(0xe0008200, &usp[3]); 500 err |= put_user(0xe0008200, &usp[3]);
498 put_user(0x34140000, &usp[4]); 501 err |= put_user(0x34140000, &usp[4]);
499 502
500 /* Stack is 64-byte aligned, and we only need 503 WARN_ON(err);
501 * to flush 1 cache line. 504
502 * Flushing one cacheline is cheap. 505 /* flush data/instruction cache for new insns */
503 * "sync" on bigger (> 4 way) boxes is not. 506 flush_user_dcache_range(start, end);
504 */ 507 flush_user_icache_range(start, end);
505 flush_user_dcache_range(regs->gr[30], regs->gr[30] + 4);
506 flush_user_icache_range(regs->gr[30], regs->gr[30] + 4);
507 508
508 regs->gr[31] = regs->gr[30] + 8; 509 regs->gr[31] = regs->gr[30] + 8;
509 return; 510 return;