aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/fault.c
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/x86/mm/fault.c
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/x86/mm/fault.c')
-rw-r--r--arch/x86/mm/fault.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 58e4f1f00bbc..794f364cb882 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -760,8 +760,7 @@ no_context(struct pt_regs *regs, unsigned long error_code,
760 set_signal_archinfo(address, error_code); 760 set_signal_archinfo(address, error_code);
761 761
762 /* XXX: hwpoison faults will set the wrong code. */ 762 /* XXX: hwpoison faults will set the wrong code. */
763 force_sig_fault(signal, si_code, (void __user *)address, 763 force_sig_fault(signal, si_code, (void __user *)address);
764 tsk);
765 } 764 }
766 765
767 /* 766 /*
@@ -922,7 +921,7 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,
922 if (si_code == SEGV_PKUERR) 921 if (si_code == SEGV_PKUERR)
923 force_sig_pkuerr((void __user *)address, pkey); 922 force_sig_pkuerr((void __user *)address, pkey);
924 923
925 force_sig_fault(SIGSEGV, si_code, (void __user *)address, tsk); 924 force_sig_fault(SIGSEGV, si_code, (void __user *)address);
926 925
927 return; 926 return;
928 } 927 }
@@ -1019,8 +1018,6 @@ static void
1019do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address, 1018do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
1020 vm_fault_t fault) 1019 vm_fault_t fault)
1021{ 1020{
1022 struct task_struct *tsk = current;
1023
1024 /* Kernel mode? Handle exceptions or die: */ 1021 /* Kernel mode? Handle exceptions or die: */
1025 if (!(error_code & X86_PF_USER)) { 1022 if (!(error_code & X86_PF_USER)) {
1026 no_context(regs, error_code, address, SIGBUS, BUS_ADRERR); 1023 no_context(regs, error_code, address, SIGBUS, BUS_ADRERR);
@@ -1035,6 +1032,7 @@ do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
1035 1032
1036#ifdef CONFIG_MEMORY_FAILURE 1033#ifdef CONFIG_MEMORY_FAILURE
1037 if (fault & (VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) { 1034 if (fault & (VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) {
1035 struct task_struct *tsk = current;
1038 unsigned lsb = 0; 1036 unsigned lsb = 0;
1039 1037
1040 pr_err( 1038 pr_err(
@@ -1044,11 +1042,11 @@ do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
1044 lsb = hstate_index_to_shift(VM_FAULT_GET_HINDEX(fault)); 1042 lsb = hstate_index_to_shift(VM_FAULT_GET_HINDEX(fault));
1045 if (fault & VM_FAULT_HWPOISON) 1043 if (fault & VM_FAULT_HWPOISON)
1046 lsb = PAGE_SHIFT; 1044 lsb = PAGE_SHIFT;
1047 force_sig_mceerr(BUS_MCEERR_AR, (void __user *)address, lsb, tsk); 1045 force_sig_mceerr(BUS_MCEERR_AR, (void __user *)address, lsb);
1048 return; 1046 return;
1049 } 1047 }
1050#endif 1048#endif
1051 force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, tsk); 1049 force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address);
1052} 1050}
1053 1051
1054static noinline void 1052static noinline void