summaryrefslogtreecommitdiffstats
path: root/arch/ia64
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-07-09 00:48:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-09 00:48:15 -0400
commit5ad18b2e60b75c7297a998dea702451d33a052ed (patch)
treec47fb503b4cfc8d3e99ad425aadede9832e96dc4 /arch/ia64
parent92c1d6522135050cb377a18cc6e30d08dfb87efb (diff)
parent318759b4737c3b3789e2fd64d539f437d52386f5 (diff)
Merge branch 'siginfo-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
Pull force_sig() argument change from Eric Biederman: "A source of error over the years has been that force_sig has taken a task parameter when it is only safe to use force_sig with the current task. The force_sig function is built for delivering synchronous signals such as SIGSEGV where the userspace application caused a synchronous fault (such as a page fault) and the kernel responded with a signal. Because the name force_sig does not make this clear, and because the force_sig takes a task parameter the function force_sig has been abused for sending other kinds of signals over the years. Slowly those have been fixed when the oopses have been tracked down. This set of changes fixes the remaining abusers of force_sig and carefully rips out the task parameter from force_sig and friends making this kind of error almost impossible in the future" * 'siginfo-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace: (27 commits) signal/x86: Move tsk inside of CONFIG_MEMORY_FAILURE in do_sigbus signal: Remove the signal number and task parameters from force_sig_info signal: Factor force_sig_info_to_task out of force_sig_info signal: Generate the siginfo in force_sig signal: Move the computation of force into send_signal and correct it. signal: Properly set TRACE_SIGNAL_LOSE_INFO in __send_signal signal: Remove the task parameter from force_sig_fault signal: Use force_sig_fault_to_task for the two calls that don't deliver to current signal: Explicitly call force_sig_fault on current signal/unicore32: Remove tsk parameter from __do_user_fault signal/arm: Remove tsk parameter from __do_user_fault signal/arm: Remove tsk parameter from ptrace_break signal/nds32: Remove tsk parameter from send_sigtrap signal/riscv: Remove tsk parameter from do_trap signal/sh: Remove tsk parameter from force_sig_info_fault signal/um: Remove task parameter from send_sigtrap signal/x86: Remove task parameter from send_sigtrap signal: Remove task parameter from force_sig_mceerr signal: Remove task parameter from force_sig signal: Remove task parameter from force_sigsegv ...
Diffstat (limited to 'arch/ia64')
-rw-r--r--arch/ia64/kernel/brl_emu.c6
-rw-r--r--arch/ia64/kernel/signal.c8
-rw-r--r--arch/ia64/kernel/traps.c24
-rw-r--r--arch/ia64/kernel/unaligned.c2
-rw-r--r--arch/ia64/mm/fault.c2
5 files changed, 21 insertions, 21 deletions
diff --git a/arch/ia64/kernel/brl_emu.c b/arch/ia64/kernel/brl_emu.c
index c0239bf77a09..782c481d7052 100644
--- a/arch/ia64/kernel/brl_emu.c
+++ b/arch/ia64/kernel/brl_emu.c
@@ -197,21 +197,21 @@ ia64_emulate_brl (struct pt_regs *regs, unsigned long ar_ec)
197 */ 197 */
198 printk(KERN_DEBUG "Woah! Unimplemented Instruction Address Trap!\n"); 198 printk(KERN_DEBUG "Woah! Unimplemented Instruction Address Trap!\n");
199 force_sig_fault(SIGILL, ILL_BADIADDR, (void __user *)NULL, 199 force_sig_fault(SIGILL, ILL_BADIADDR, (void __user *)NULL,
200 0, 0, 0, current); 200 0, 0, 0);
201 } else if (ia64_psr(regs)->tb) { 201 } else if (ia64_psr(regs)->tb) {
202 /* 202 /*
203 * Branch Tracing is enabled. 203 * Branch Tracing is enabled.
204 * Force a taken branch signal. 204 * Force a taken branch signal.
205 */ 205 */
206 force_sig_fault(SIGTRAP, TRAP_BRANCH, (void __user *)NULL, 206 force_sig_fault(SIGTRAP, TRAP_BRANCH, (void __user *)NULL,
207 0, 0, 0, current); 207 0, 0, 0);
208 } else if (ia64_psr(regs)->ss) { 208 } else if (ia64_psr(regs)->ss) {
209 /* 209 /*
210 * Single Step is enabled. 210 * Single Step is enabled.
211 * Force a trace signal. 211 * Force a trace signal.
212 */ 212 */
213 force_sig_fault(SIGTRAP, TRAP_TRACE, (void __user *)NULL, 213 force_sig_fault(SIGTRAP, TRAP_TRACE, (void __user *)NULL,
214 0, 0, 0, current); 214 0, 0, 0);
215 } 215 }
216 return rv; 216 return rv;
217} 217}
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
index 6062fd14e34e..e5044aed9452 100644
--- a/arch/ia64/kernel/signal.c
+++ b/arch/ia64/kernel/signal.c
@@ -152,7 +152,7 @@ ia64_rt_sigreturn (struct sigscratch *scr)
152 return retval; 152 return retval;
153 153
154 give_sigsegv: 154 give_sigsegv:
155 force_sig(SIGSEGV, current); 155 force_sig(SIGSEGV);
156 return retval; 156 return retval;
157} 157}
158 158
@@ -257,7 +257,7 @@ setup_frame(struct ksignal *ksig, sigset_t *set, struct sigscratch *scr)
257 */ 257 */
258 check_sp = (new_sp - sizeof(*frame)) & -STACK_ALIGN; 258 check_sp = (new_sp - sizeof(*frame)) & -STACK_ALIGN;
259 if (!likely(on_sig_stack(check_sp))) { 259 if (!likely(on_sig_stack(check_sp))) {
260 force_sigsegv(ksig->sig, current); 260 force_sigsegv(ksig->sig);
261 return 1; 261 return 1;
262 } 262 }
263 } 263 }
@@ -265,7 +265,7 @@ setup_frame(struct ksignal *ksig, sigset_t *set, struct sigscratch *scr)
265 frame = (void __user *) ((new_sp - sizeof(*frame)) & -STACK_ALIGN); 265 frame = (void __user *) ((new_sp - sizeof(*frame)) & -STACK_ALIGN);
266 266
267 if (!access_ok(frame, sizeof(*frame))) { 267 if (!access_ok(frame, sizeof(*frame))) {
268 force_sigsegv(ksig->sig, current); 268 force_sigsegv(ksig->sig);
269 return 1; 269 return 1;
270 } 270 }
271 271
@@ -282,7 +282,7 @@ setup_frame(struct ksignal *ksig, sigset_t *set, struct sigscratch *scr)
282 err |= setup_sigcontext(&frame->sc, set, scr); 282 err |= setup_sigcontext(&frame->sc, set, scr);
283 283
284 if (unlikely(err)) { 284 if (unlikely(err)) {
285 force_sigsegv(ksig->sig, current); 285 force_sigsegv(ksig->sig);
286 return 1; 286 return 1;
287 } 287 }
288 288
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c
index 85d8616ac4f6..e13cb905930f 100644
--- a/arch/ia64/kernel/traps.c
+++ b/arch/ia64/kernel/traps.c
@@ -176,7 +176,7 @@ __kprobes ia64_bad_break (unsigned long break_num, struct pt_regs *regs)
176 } 176 }
177 force_sig_fault(sig, code, 177 force_sig_fault(sig, code,
178 (void __user *) (regs->cr_iip + ia64_psr(regs)->ri), 178 (void __user *) (regs->cr_iip + ia64_psr(regs)->ri),
179 break_num, 0 /* clear __ISR_VALID */, 0, current); 179 break_num, 0 /* clear __ISR_VALID */, 0);
180} 180}
181 181
182/* 182/*
@@ -353,7 +353,7 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr)
353 } 353 }
354 force_sig_fault(SIGFPE, si_code, 354 force_sig_fault(SIGFPE, si_code,
355 (void __user *) (regs->cr_iip + ia64_psr(regs)->ri), 355 (void __user *) (regs->cr_iip + ia64_psr(regs)->ri),
356 0, __ISR_VALID, isr, current); 356 0, __ISR_VALID, isr);
357 } 357 }
358 } else { 358 } else {
359 if (exception == -1) { 359 if (exception == -1) {
@@ -373,7 +373,7 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr)
373 } 373 }
374 force_sig_fault(SIGFPE, si_code, 374 force_sig_fault(SIGFPE, si_code,
375 (void __user *) (regs->cr_iip + ia64_psr(regs)->ri), 375 (void __user *) (regs->cr_iip + ia64_psr(regs)->ri),
376 0, __ISR_VALID, isr, current); 376 0, __ISR_VALID, isr);
377 } 377 }
378 } 378 }
379 return 0; 379 return 0;
@@ -408,7 +408,7 @@ ia64_illegal_op_fault (unsigned long ec, long arg1, long arg2, long arg3,
408 408
409 force_sig_fault(SIGILL, ILL_ILLOPC, 409 force_sig_fault(SIGILL, ILL_ILLOPC,
410 (void __user *) (regs.cr_iip + ia64_psr(&regs)->ri), 410 (void __user *) (regs.cr_iip + ia64_psr(&regs)->ri),
411 0, 0, 0, current); 411 0, 0, 0);
412 return rv; 412 return rv;
413} 413}
414 414
@@ -483,7 +483,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
483 + ia64_psr(&regs)->ri); 483 + ia64_psr(&regs)->ri);
484 } 484 }
485 force_sig_fault(sig, code, addr, 485 force_sig_fault(sig, code, addr,
486 vector, __ISR_VALID, isr, current); 486 vector, __ISR_VALID, isr);
487 return; 487 return;
488 } else if (ia64_done_with_exception(&regs)) 488 } else if (ia64_done_with_exception(&regs))
489 return; 489 return;
@@ -493,7 +493,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
493 case 31: /* Unsupported Data Reference */ 493 case 31: /* Unsupported Data Reference */
494 if (user_mode(&regs)) { 494 if (user_mode(&regs)) {
495 force_sig_fault(SIGILL, ILL_ILLOPN, (void __user *) iip, 495 force_sig_fault(SIGILL, ILL_ILLOPN, (void __user *) iip,
496 vector, __ISR_VALID, isr, current); 496 vector, __ISR_VALID, isr);
497 return; 497 return;
498 } 498 }
499 sprintf(buf, "Unsupported data reference"); 499 sprintf(buf, "Unsupported data reference");
@@ -542,7 +542,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
542 == NOTIFY_STOP) 542 == NOTIFY_STOP)
543 return; 543 return;
544 force_sig_fault(SIGTRAP, si_code, (void __user *) ifa, 544 force_sig_fault(SIGTRAP, si_code, (void __user *) ifa,
545 0, __ISR_VALID, isr, current); 545 0, __ISR_VALID, isr);
546 return; 546 return;
547 547
548 case 32: /* fp fault */ 548 case 32: /* fp fault */
@@ -550,7 +550,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
550 result = handle_fpu_swa((vector == 32) ? 1 : 0, &regs, isr); 550 result = handle_fpu_swa((vector == 32) ? 1 : 0, &regs, isr);
551 if ((result < 0) || (current->thread.flags & IA64_THREAD_FPEMU_SIGFPE)) { 551 if ((result < 0) || (current->thread.flags & IA64_THREAD_FPEMU_SIGFPE)) {
552 force_sig_fault(SIGFPE, FPE_FLTINV, (void __user *) iip, 552 force_sig_fault(SIGFPE, FPE_FLTINV, (void __user *) iip,
553 0, __ISR_VALID, isr, current); 553 0, __ISR_VALID, isr);
554 } 554 }
555 return; 555 return;
556 556
@@ -578,7 +578,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
578 if (user_mode(&regs)) { 578 if (user_mode(&regs)) {
579 force_sig_fault(SIGILL, ILL_BADIADDR, 579 force_sig_fault(SIGILL, ILL_BADIADDR,
580 (void __user *) iip, 580 (void __user *) iip,
581 0, 0, 0, current); 581 0, 0, 0);
582 return; 582 return;
583 } 583 }
584 sprintf(buf, "Unimplemented Instruction Address fault"); 584 sprintf(buf, "Unimplemented Instruction Address fault");
@@ -589,14 +589,14 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
589 printk(KERN_ERR "Unexpected IA-32 exception (Trap 45)\n"); 589 printk(KERN_ERR "Unexpected IA-32 exception (Trap 45)\n");
590 printk(KERN_ERR " iip - 0x%lx, ifa - 0x%lx, isr - 0x%lx\n", 590 printk(KERN_ERR " iip - 0x%lx, ifa - 0x%lx, isr - 0x%lx\n",
591 iip, ifa, isr); 591 iip, ifa, isr);
592 force_sig(SIGSEGV, current); 592 force_sig(SIGSEGV);
593 return; 593 return;
594 594
595 case 46: 595 case 46:
596 printk(KERN_ERR "Unexpected IA-32 intercept trap (Trap 46)\n"); 596 printk(KERN_ERR "Unexpected IA-32 intercept trap (Trap 46)\n");
597 printk(KERN_ERR " iip - 0x%lx, ifa - 0x%lx, isr - 0x%lx, iim - 0x%lx\n", 597 printk(KERN_ERR " iip - 0x%lx, ifa - 0x%lx, isr - 0x%lx, iim - 0x%lx\n",
598 iip, ifa, isr, iim); 598 iip, ifa, isr, iim);
599 force_sig(SIGSEGV, current); 599 force_sig(SIGSEGV);
600 return; 600 return;
601 601
602 case 47: 602 case 47:
@@ -608,5 +608,5 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
608 break; 608 break;
609 } 609 }
610 if (!die_if_kernel(buf, &regs, error)) 610 if (!die_if_kernel(buf, &regs, error))
611 force_sig(SIGILL, current); 611 force_sig(SIGILL);
612} 612}
diff --git a/arch/ia64/kernel/unaligned.c b/arch/ia64/kernel/unaligned.c
index a167a3824b35..eb7d5df59fa3 100644
--- a/arch/ia64/kernel/unaligned.c
+++ b/arch/ia64/kernel/unaligned.c
@@ -1537,6 +1537,6 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
1537 } 1537 }
1538 force_sigbus: 1538 force_sigbus:
1539 force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) ifa, 1539 force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) ifa,
1540 0, 0, 0, current); 1540 0, 0, 0);
1541 goto done; 1541 goto done;
1542} 1542}
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c
index 5baeb022f474..3c3a283d3172 100644
--- a/arch/ia64/mm/fault.c
+++ b/arch/ia64/mm/fault.c
@@ -249,7 +249,7 @@ retry:
249 } 249 }
250 if (user_mode(regs)) { 250 if (user_mode(regs)) {
251 force_sig_fault(signal, code, (void __user *) address, 251 force_sig_fault(signal, code, (void __user *) address,
252 0, __ISR_VALID, isr, current); 252 0, __ISR_VALID, isr);
253 return; 253 return;
254 } 254 }
255 255