aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-18 16:10:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-18 16:10:36 -0400
commit547af560ddbfe469ada2cad3009cbcfde313d73c (patch)
tree1f97e215de2d88d90ed34db24212dab69eb300b2
parentb0579fc089808b68c53a6a95d043db034468116c (diff)
parenta35bee8a2748abe9a40865f477aba0a9b85965fd (diff)
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus: MIPS: Enable ISA_DMA_API config to fix build failure MIPS: 32-bit: Fix build failure in asm/fcntl.h MIPS: Remove all generated vmlinuz* files on "make clean" MIPS: do_sigaltstack() expects userland pointers MIPS: Fix error values in case of bad_stack MIPS: Sanitize restart logics MIPS: secure_computing, syscall audit: syscall number should in r2, not r0. MIPS: Don't block signals if we'd failed to setup a sigframe
-rw-r--r--arch/mips/Kconfig4
-rw-r--r--arch/mips/boot/compressed/Makefile2
-rw-r--r--arch/mips/include/asm/fcntl.h1
-rw-r--r--arch/mips/kernel/branch.c1
-rw-r--r--arch/mips/kernel/ptrace.c4
-rw-r--r--arch/mips/kernel/scall32-o32.S11
-rw-r--r--arch/mips/kernel/scall64-64.S7
-rw-r--r--arch/mips/kernel/scall64-n32.S6
-rw-r--r--arch/mips/kernel/scall64-o32.S9
-rw-r--r--arch/mips/kernel/signal.c45
-rw-r--r--arch/mips/kernel/signal_n32.c5
-rw-r--r--arch/mips/kernel/unaligned.c2
12 files changed, 53 insertions, 44 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 5526faabfc21..4c9f402295dd 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -881,11 +881,15 @@ config NO_IOPORT
881config GENERIC_ISA_DMA 881config GENERIC_ISA_DMA
882 bool 882 bool
883 select ZONE_DMA if GENERIC_ISA_DMA_SUPPORT_BROKEN=n 883 select ZONE_DMA if GENERIC_ISA_DMA_SUPPORT_BROKEN=n
884 select ISA_DMA_API
884 885
885config GENERIC_ISA_DMA_SUPPORT_BROKEN 886config GENERIC_ISA_DMA_SUPPORT_BROKEN
886 bool 887 bool
887 select GENERIC_ISA_DMA 888 select GENERIC_ISA_DMA
888 889
890config ISA_DMA_API
891 bool
892
889config GENERIC_GPIO 893config GENERIC_GPIO
890 bool 894 bool
891 895
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index 5fd7f7a58b7e..5042d51b0512 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -105,4 +105,4 @@ OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFLAGS) -S -O srec
105vmlinuz.srec: vmlinuz 105vmlinuz.srec: vmlinuz
106 $(call cmd,objcopy) 106 $(call cmd,objcopy)
107 107
108clean-files := $(objtree)/vmlinuz.* 108clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec}
diff --git a/arch/mips/include/asm/fcntl.h b/arch/mips/include/asm/fcntl.h
index e482fe90fe88..75eddedcfc3e 100644
--- a/arch/mips/include/asm/fcntl.h
+++ b/arch/mips/include/asm/fcntl.h
@@ -56,6 +56,7 @@
56 */ 56 */
57 57
58#ifdef CONFIG_32BIT 58#ifdef CONFIG_32BIT
59#include <linux/types.h>
59 60
60struct flock { 61struct flock {
61 short l_type; 62 short l_type;
diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c
index 0176ed015c89..32103cc2a257 100644
--- a/arch/mips/kernel/branch.c
+++ b/arch/mips/kernel/branch.c
@@ -40,7 +40,6 @@ int __compute_return_epc(struct pt_regs *regs)
40 return -EFAULT; 40 return -EFAULT;
41 } 41 }
42 42
43 regs->regs[0] = 0;
44 switch (insn.i_format.opcode) { 43 switch (insn.i_format.opcode) {
45 /* 44 /*
46 * jr and jalr are in r_format format. 45 * jr and jalr are in r_format format.
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index c51b95ff8644..c8777333e198 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -536,7 +536,7 @@ asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit)
536{ 536{
537 /* do the secure computing check first */ 537 /* do the secure computing check first */
538 if (!entryexit) 538 if (!entryexit)
539 secure_computing(regs->regs[0]); 539 secure_computing(regs->regs[2]);
540 540
541 if (unlikely(current->audit_context) && entryexit) 541 if (unlikely(current->audit_context) && entryexit)
542 audit_syscall_exit(AUDITSC_RESULT(regs->regs[2]), 542 audit_syscall_exit(AUDITSC_RESULT(regs->regs[2]),
@@ -565,7 +565,7 @@ asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit)
565 565
566out: 566out:
567 if (unlikely(current->audit_context) && !entryexit) 567 if (unlikely(current->audit_context) && !entryexit)
568 audit_syscall_entry(audit_arch(), regs->regs[0], 568 audit_syscall_entry(audit_arch(), regs->regs[2],
569 regs->regs[4], regs->regs[5], 569 regs->regs[4], regs->regs[5],
570 regs->regs[6], regs->regs[7]); 570 regs->regs[6], regs->regs[7]);
571} 571}
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 584415eef8c9..fbaabad0e6e2 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -63,9 +63,9 @@ stack_done:
63 sw t0, PT_R7(sp) # set error flag 63 sw t0, PT_R7(sp) # set error flag
64 beqz t0, 1f 64 beqz t0, 1f
65 65
66 lw t1, PT_R2(sp) # syscall number
66 negu v0 # error 67 negu v0 # error
67 sw v0, PT_R0(sp) # set flag for syscall 68 sw t1, PT_R0(sp) # save it for syscall restarting
68 # restarting
691: sw v0, PT_R2(sp) # result 691: sw v0, PT_R2(sp) # result
70 70
71o32_syscall_exit: 71o32_syscall_exit:
@@ -104,9 +104,9 @@ syscall_trace_entry:
104 sw t0, PT_R7(sp) # set error flag 104 sw t0, PT_R7(sp) # set error flag
105 beqz t0, 1f 105 beqz t0, 1f
106 106
107 lw t1, PT_R2(sp) # syscall number
107 negu v0 # error 108 negu v0 # error
108 sw v0, PT_R0(sp) # set flag for syscall 109 sw t1, PT_R0(sp) # save it for syscall restarting
109 # restarting
1101: sw v0, PT_R2(sp) # result 1101: sw v0, PT_R2(sp) # result
111 111
112 j syscall_exit 112 j syscall_exit
@@ -169,8 +169,7 @@ stackargs:
169 * We probably should handle this case a bit more drastic. 169 * We probably should handle this case a bit more drastic.
170 */ 170 */
171bad_stack: 171bad_stack:
172 negu v0 # error 172 li v0, EFAULT
173 sw v0, PT_R0(sp)
174 sw v0, PT_R2(sp) 173 sw v0, PT_R2(sp)
175 li t0, 1 # set error flag 174 li t0, 1 # set error flag
176 sw t0, PT_R7(sp) 175 sw t0, PT_R7(sp)
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 5573f8e4e326..3f4179283207 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -66,9 +66,9 @@ NESTED(handle_sys64, PT_SIZE, sp)
66 sd t0, PT_R7(sp) # set error flag 66 sd t0, PT_R7(sp) # set error flag
67 beqz t0, 1f 67 beqz t0, 1f
68 68
69 ld t1, PT_R2(sp) # syscall number
69 dnegu v0 # error 70 dnegu v0 # error
70 sd v0, PT_R0(sp) # set flag for syscall 71 sd t1, PT_R0(sp) # save it for syscall restarting
71 # restarting
721: sd v0, PT_R2(sp) # result 721: sd v0, PT_R2(sp) # result
73 73
74n64_syscall_exit: 74n64_syscall_exit:
@@ -109,8 +109,9 @@ syscall_trace_entry:
109 sd t0, PT_R7(sp) # set error flag 109 sd t0, PT_R7(sp) # set error flag
110 beqz t0, 1f 110 beqz t0, 1f
111 111
112 ld t1, PT_R2(sp) # syscall number
112 dnegu v0 # error 113 dnegu v0 # error
113 sd v0, PT_R0(sp) # set flag for syscall restarting 114 sd t1, PT_R0(sp) # save it for syscall restarting
1141: sd v0, PT_R2(sp) # result 1151: sd v0, PT_R2(sp) # result
115 116
116 j syscall_exit 117 j syscall_exit
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 1e38ec97672e..38b226938db3 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -65,8 +65,9 @@ NESTED(handle_sysn32, PT_SIZE, sp)
65 sd t0, PT_R7(sp) # set error flag 65 sd t0, PT_R7(sp) # set error flag
66 beqz t0, 1f 66 beqz t0, 1f
67 67
68 ld t1, PT_R2(sp) # syscall number
68 dnegu v0 # error 69 dnegu v0 # error
69 sd v0, PT_R0(sp) # set flag for syscall restarting 70 sd t1, PT_R0(sp) # save it for syscall restarting
701: sd v0, PT_R2(sp) # result 711: sd v0, PT_R2(sp) # result
71 72
72 local_irq_disable # make sure need_resched and 73 local_irq_disable # make sure need_resched and
@@ -106,8 +107,9 @@ n32_syscall_trace_entry:
106 sd t0, PT_R7(sp) # set error flag 107 sd t0, PT_R7(sp) # set error flag
107 beqz t0, 1f 108 beqz t0, 1f
108 109
110 ld t1, PT_R2(sp) # syscall number
109 dnegu v0 # error 111 dnegu v0 # error
110 sd v0, PT_R0(sp) # set flag for syscall restarting 112 sd t1, PT_R0(sp) # save it for syscall restarting
1111: sd v0, PT_R2(sp) # result 1131: sd v0, PT_R2(sp) # result
112 114
113 j syscall_exit 115 j syscall_exit
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 171979fc98e5..42fe14b52a33 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -93,8 +93,9 @@ NESTED(handle_sys, PT_SIZE, sp)
93 sd t0, PT_R7(sp) # set error flag 93 sd t0, PT_R7(sp) # set error flag
94 beqz t0, 1f 94 beqz t0, 1f
95 95
96 ld t1, PT_R2(sp) # syscall number
96 dnegu v0 # error 97 dnegu v0 # error
97 sd v0, PT_R0(sp) # flag for syscall restarting 98 sd t1, PT_R0(sp) # save it for syscall restarting
981: sd v0, PT_R2(sp) # result 991: sd v0, PT_R2(sp) # result
99 100
100o32_syscall_exit: 101o32_syscall_exit:
@@ -142,8 +143,9 @@ trace_a_syscall:
142 sd t0, PT_R7(sp) # set error flag 143 sd t0, PT_R7(sp) # set error flag
143 beqz t0, 1f 144 beqz t0, 1f
144 145
146 ld t1, PT_R2(sp) # syscall number
145 dnegu v0 # error 147 dnegu v0 # error
146 sd v0, PT_R0(sp) # set flag for syscall restarting 148 sd t1, PT_R0(sp) # save it for syscall restarting
1471: sd v0, PT_R2(sp) # result 1491: sd v0, PT_R2(sp) # result
148 150
149 j syscall_exit 151 j syscall_exit
@@ -154,8 +156,7 @@ trace_a_syscall:
154 * The stackpointer for a call with more than 4 arguments is bad. 156 * The stackpointer for a call with more than 4 arguments is bad.
155 */ 157 */
156bad_stack: 158bad_stack:
157 dnegu v0 # error 159 li v0, EFAULT
158 sd v0, PT_R0(sp)
159 sd v0, PT_R2(sp) 160 sd v0, PT_R2(sp)
160 li t0, 1 # set error flag 161 li t0, 1 # set error flag
161 sd t0, PT_R7(sp) 162 sd t0, PT_R7(sp)
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 2099d5a4c4b7..5922342bca39 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -390,7 +390,6 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
390{ 390{
391 struct rt_sigframe __user *frame; 391 struct rt_sigframe __user *frame;
392 sigset_t set; 392 sigset_t set;
393 stack_t st;
394 int sig; 393 int sig;
395 394
396 frame = (struct rt_sigframe __user *) regs.regs[29]; 395 frame = (struct rt_sigframe __user *) regs.regs[29];
@@ -411,11 +410,9 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
411 else if (sig) 410 else if (sig)
412 force_sig(sig, current); 411 force_sig(sig, current);
413 412
414 if (__copy_from_user(&st, &frame->rs_uc.uc_stack, sizeof(st)))
415 goto badframe;
416 /* It is more difficult to avoid calling this function than to 413 /* It is more difficult to avoid calling this function than to
417 call it and ignore errors. */ 414 call it and ignore errors. */
418 do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]); 415 do_sigaltstack(&frame->rs_uc.uc_stack, NULL, regs.regs[29]);
419 416
420 /* 417 /*
421 * Don't let your children do this ... 418 * Don't let your children do this ...
@@ -550,23 +547,26 @@ static int handle_signal(unsigned long sig, siginfo_t *info,
550 struct mips_abi *abi = current->thread.abi; 547 struct mips_abi *abi = current->thread.abi;
551 void *vdso = current->mm->context.vdso; 548 void *vdso = current->mm->context.vdso;
552 549
553 switch(regs->regs[0]) { 550 if (regs->regs[0]) {
554 case ERESTART_RESTARTBLOCK: 551 switch(regs->regs[2]) {
555 case ERESTARTNOHAND: 552 case ERESTART_RESTARTBLOCK:
556 regs->regs[2] = EINTR; 553 case ERESTARTNOHAND:
557 break;
558 case ERESTARTSYS:
559 if (!(ka->sa.sa_flags & SA_RESTART)) {
560 regs->regs[2] = EINTR; 554 regs->regs[2] = EINTR;
561 break; 555 break;
556 case ERESTARTSYS:
557 if (!(ka->sa.sa_flags & SA_RESTART)) {
558 regs->regs[2] = EINTR;
559 break;
560 }
561 /* fallthrough */
562 case ERESTARTNOINTR:
563 regs->regs[7] = regs->regs[26];
564 regs->regs[2] = regs->regs[0];
565 regs->cp0_epc -= 4;
562 } 566 }
563 /* fallthrough */
564 case ERESTARTNOINTR: /* Userland will reload $v0. */
565 regs->regs[7] = regs->regs[26];
566 regs->cp0_epc -= 8;
567 }
568 567
569 regs->regs[0] = 0; /* Don't deal with this again. */ 568 regs->regs[0] = 0; /* Don't deal with this again. */
569 }
570 570
571 if (sig_uses_siginfo(ka)) 571 if (sig_uses_siginfo(ka))
572 ret = abi->setup_rt_frame(vdso + abi->rt_signal_return_offset, 572 ret = abi->setup_rt_frame(vdso + abi->rt_signal_return_offset,
@@ -575,6 +575,9 @@ static int handle_signal(unsigned long sig, siginfo_t *info,
575 ret = abi->setup_frame(vdso + abi->signal_return_offset, 575 ret = abi->setup_frame(vdso + abi->signal_return_offset,
576 ka, regs, sig, oldset); 576 ka, regs, sig, oldset);
577 577
578 if (ret)
579 return ret;
580
578 spin_lock_irq(&current->sighand->siglock); 581 spin_lock_irq(&current->sighand->siglock);
579 sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask); 582 sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask);
580 if (!(ka->sa.sa_flags & SA_NODEFER)) 583 if (!(ka->sa.sa_flags & SA_NODEFER))
@@ -622,17 +625,13 @@ static void do_signal(struct pt_regs *regs)
622 return; 625 return;
623 } 626 }
624 627
625 /*
626 * Who's code doesn't conform to the restartable syscall convention
627 * dies here!!! The li instruction, a single machine instruction,
628 * must directly be followed by the syscall instruction.
629 */
630 if (regs->regs[0]) { 628 if (regs->regs[0]) {
631 if (regs->regs[2] == ERESTARTNOHAND || 629 if (regs->regs[2] == ERESTARTNOHAND ||
632 regs->regs[2] == ERESTARTSYS || 630 regs->regs[2] == ERESTARTSYS ||
633 regs->regs[2] == ERESTARTNOINTR) { 631 regs->regs[2] == ERESTARTNOINTR) {
632 regs->regs[2] = regs->regs[0];
634 regs->regs[7] = regs->regs[26]; 633 regs->regs[7] = regs->regs[26];
635 regs->cp0_epc -= 8; 634 regs->cp0_epc -= 4;
636 } 635 }
637 if (regs->regs[2] == ERESTART_RESTARTBLOCK) { 636 if (regs->regs[2] == ERESTART_RESTARTBLOCK) {
638 regs->regs[2] = current->thread.abi->restart; 637 regs->regs[2] = current->thread.abi->restart;
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c
index 2c5df818c65a..ee24d814d5b9 100644
--- a/arch/mips/kernel/signal_n32.c
+++ b/arch/mips/kernel/signal_n32.c
@@ -109,6 +109,7 @@ asmlinkage int sysn32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
109asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) 109asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
110{ 110{
111 struct rt_sigframe_n32 __user *frame; 111 struct rt_sigframe_n32 __user *frame;
112 mm_segment_t old_fs;
112 sigset_t set; 113 sigset_t set;
113 stack_t st; 114 stack_t st;
114 s32 sp; 115 s32 sp;
@@ -143,7 +144,11 @@ asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
143 144
144 /* It is more difficult to avoid calling this function than to 145 /* It is more difficult to avoid calling this function than to
145 call it and ignore errors. */ 146 call it and ignore errors. */
147 old_fs = get_fs();
148 set_fs(KERNEL_DS);
146 do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]); 149 do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]);
150 set_fs(old_fs);
151
147 152
148 /* 153 /*
149 * Don't let your children do this ... 154 * Don't let your children do this ...
diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
index 69b039ca8d83..33d5a5ce4a29 100644
--- a/arch/mips/kernel/unaligned.c
+++ b/arch/mips/kernel/unaligned.c
@@ -109,8 +109,6 @@ static void emulate_load_store_insn(struct pt_regs *regs,
109 unsigned long value; 109 unsigned long value;
110 unsigned int res; 110 unsigned int res;
111 111
112 regs->regs[0] = 0;
113
114 /* 112 /*
115 * This load never faults. 113 * This load never faults.
116 */ 114 */