Commit 2d2837fa authored by Eric W. Biederman's avatar Eric W. Biederman

signal/arm64: Only perform one esr_to_fault_info call in do_page_fault

As this work is truly common between all of the signal sending cases
there is no need to repeat it between the different cases.
Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Tested-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
parent effb093a
...@@ -424,6 +424,7 @@ static bool is_el0_instruction_abort(unsigned int esr) ...@@ -424,6 +424,7 @@ static bool is_el0_instruction_abort(unsigned int esr)
static int __kprobes do_page_fault(unsigned long addr, unsigned int esr, static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
struct pt_regs *regs) struct pt_regs *regs)
{ {
const struct fault_info *inf;
struct task_struct *tsk; struct task_struct *tsk;
struct mm_struct *mm; struct mm_struct *mm;
struct siginfo si; struct siginfo si;
...@@ -562,6 +563,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr, ...@@ -562,6 +563,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
return 0; return 0;
} }
inf = esr_to_fault_info(esr);
if (fault & VM_FAULT_SIGBUS) { if (fault & VM_FAULT_SIGBUS) {
/* /*
* We had some memory, but were unable to successfully fix up * We had some memory, but were unable to successfully fix up
...@@ -572,7 +574,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr, ...@@ -572,7 +574,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
si.si_code = BUS_ADRERR; si.si_code = BUS_ADRERR;
si.si_addr = (void __user *)addr; si.si_addr = (void __user *)addr;
set_thread_esr(addr, esr); set_thread_esr(addr, esr);
arm64_force_sig_info(&si, esr_to_fault_info(esr)->name); arm64_force_sig_info(&si, inf->name);
} else if (fault & (VM_FAULT_HWPOISON_LARGE | VM_FAULT_HWPOISON)) { } else if (fault & (VM_FAULT_HWPOISON_LARGE | VM_FAULT_HWPOISON)) {
unsigned int lsb; unsigned int lsb;
...@@ -586,7 +588,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr, ...@@ -586,7 +588,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
si.si_addr = (void __user *)addr; si.si_addr = (void __user *)addr;
si.si_addr_lsb = lsb; si.si_addr_lsb = lsb;
set_thread_esr(addr, esr); set_thread_esr(addr, esr);
arm64_force_sig_info(&si, esr_to_fault_info(esr)->name); arm64_force_sig_info(&si, inf->name);
} else { } else {
/* /*
* Something tried to access memory that isn't in our memory * Something tried to access memory that isn't in our memory
...@@ -598,7 +600,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr, ...@@ -598,7 +600,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
SEGV_ACCERR : SEGV_MAPERR; SEGV_ACCERR : SEGV_MAPERR;
si.si_addr = (void __user *)addr; si.si_addr = (void __user *)addr;
set_thread_esr(addr, esr); set_thread_esr(addr, esr);
arm64_force_sig_info(&si, esr_to_fault_info(esr)->name); arm64_force_sig_info(&si, inf->name);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment