.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
1 | 2 | /* |
---|
2 | 3 | * 'traps.c' handles hardware traps and faults after we have saved some |
---|
3 | 4 | * state in 'entry.S'. |
---|
.. | .. |
---|
6 | 7 | * Copyright (C) 2000 Philipp Rumpf |
---|
7 | 8 | * Copyright (C) 2000 David Howells |
---|
8 | 9 | * Copyright (C) 2002 - 2010 Paul Mundt |
---|
9 | | - * |
---|
10 | | - * This file is subject to the terms and conditions of the GNU General Public |
---|
11 | | - * License. See the file "COPYING" in the main directory of this archive |
---|
12 | | - * for more details. |
---|
13 | 10 | */ |
---|
14 | 11 | #include <linux/kernel.h> |
---|
15 | 12 | #include <linux/ptrace.h> |
---|
.. | .. |
---|
485 | 482 | error_code = lookup_exception_vector(); |
---|
486 | 483 | #endif |
---|
487 | 484 | |
---|
488 | | - oldfs = get_fs(); |
---|
489 | | - |
---|
490 | 485 | if (user_mode(regs)) { |
---|
491 | 486 | int si_code = BUS_ADRERR; |
---|
492 | 487 | unsigned int user_action; |
---|
.. | .. |
---|
494 | 489 | local_irq_enable(); |
---|
495 | 490 | inc_unaligned_user_access(); |
---|
496 | 491 | |
---|
497 | | - set_fs(USER_DS); |
---|
| 492 | + oldfs = force_uaccess_begin(); |
---|
498 | 493 | if (copy_from_user(&instruction, (insn_size_t *)(regs->pc & ~1), |
---|
499 | 494 | sizeof(instruction))) { |
---|
500 | | - set_fs(oldfs); |
---|
| 495 | + force_uaccess_end(oldfs); |
---|
501 | 496 | goto uspace_segv; |
---|
502 | 497 | } |
---|
503 | | - set_fs(oldfs); |
---|
| 498 | + force_uaccess_end(oldfs); |
---|
504 | 499 | |
---|
505 | 500 | /* shout about userspace fixups */ |
---|
506 | 501 | unaligned_fixups_notify(current, instruction, regs); |
---|
.. | .. |
---|
523 | 518 | goto uspace_segv; |
---|
524 | 519 | } |
---|
525 | 520 | |
---|
526 | | - set_fs(USER_DS); |
---|
| 521 | + oldfs = force_uaccess_begin(); |
---|
527 | 522 | tmp = handle_unaligned_access(instruction, regs, |
---|
528 | 523 | &user_mem_access, 0, |
---|
529 | 524 | address); |
---|
530 | | - set_fs(oldfs); |
---|
| 525 | + force_uaccess_end(oldfs); |
---|
531 | 526 | |
---|
532 | 527 | if (tmp == 0) |
---|
533 | 528 | return; /* sorted */ |
---|
.. | .. |
---|
536 | 531 | "access (PC %lx PR %lx)\n", current->comm, regs->pc, |
---|
537 | 532 | regs->pr); |
---|
538 | 533 | |
---|
539 | | - force_sig_fault(SIGBUS, si_code, (void __user *)address, current); |
---|
| 534 | + force_sig_fault(SIGBUS, si_code, (void __user *)address); |
---|
540 | 535 | } else { |
---|
541 | 536 | inc_unaligned_kernel_access(); |
---|
542 | 537 | |
---|
.. | .. |
---|
606 | 601 | /* Let gcc know unhandled cases don't make it past here */ |
---|
607 | 602 | return; |
---|
608 | 603 | } |
---|
609 | | - force_sig_fault(SIGFPE, code, NULL, current); |
---|
| 604 | + force_sig_fault(SIGFPE, code, NULL); |
---|
610 | 605 | } |
---|
611 | 606 | #endif |
---|
612 | 607 | |
---|
.. | .. |
---|
614 | 609 | { |
---|
615 | 610 | struct pt_regs *regs = current_pt_regs(); |
---|
616 | 611 | unsigned long error_code; |
---|
617 | | - struct task_struct *tsk = current; |
---|
618 | 612 | |
---|
619 | 613 | #ifdef CONFIG_SH_FPU_EMU |
---|
620 | 614 | unsigned short inst = 0; |
---|
.. | .. |
---|
636 | 630 | /* Enable DSP mode, and restart instruction. */ |
---|
637 | 631 | regs->sr |= SR_DSP; |
---|
638 | 632 | /* Save DSP mode */ |
---|
639 | | - tsk->thread.dsp_status.status |= SR_DSP; |
---|
| 633 | + current->thread.dsp_status.status |= SR_DSP; |
---|
640 | 634 | return; |
---|
641 | 635 | } |
---|
642 | 636 | #endif |
---|
.. | .. |
---|
644 | 638 | error_code = lookup_exception_vector(); |
---|
645 | 639 | |
---|
646 | 640 | local_irq_enable(); |
---|
647 | | - force_sig(SIGILL, tsk); |
---|
| 641 | + force_sig(SIGILL); |
---|
648 | 642 | die_if_no_fixup("reserved instruction", regs, error_code); |
---|
649 | 643 | } |
---|
650 | 644 | |
---|
.. | .. |
---|
700 | 694 | { |
---|
701 | 695 | struct pt_regs *regs = current_pt_regs(); |
---|
702 | 696 | unsigned long inst; |
---|
703 | | - struct task_struct *tsk = current; |
---|
704 | 697 | |
---|
705 | 698 | if (kprobe_handle_illslot(regs->pc) == 0) |
---|
706 | 699 | return; |
---|
.. | .. |
---|
719 | 712 | inst = lookup_exception_vector(); |
---|
720 | 713 | |
---|
721 | 714 | local_irq_enable(); |
---|
722 | | - force_sig(SIGILL, tsk); |
---|
| 715 | + force_sig(SIGILL); |
---|
723 | 716 | die_if_no_fixup("illegal slot instruction", regs, inst); |
---|
724 | 717 | } |
---|
725 | 718 | |
---|