Commit c4aba4a8 authored by Harvey Harrison's avatar Harvey Harrison Committed by Ingo Molnar

x86: introduce force_sig_info_fault helper to X86_64

Use the force_sig_info_fault helper from X86_32 in X86_64.
Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 1dc85be0
...@@ -249,7 +249,7 @@ static int is_prefetch(struct pt_regs *regs, unsigned long addr, ...@@ -249,7 +249,7 @@ static int is_prefetch(struct pt_regs *regs, unsigned long addr,
return prefetch; return prefetch;
} }
static noinline void force_sig_info_fault(int si_signo, int si_code, static void force_sig_info_fault(int si_signo, int si_code,
unsigned long address, struct task_struct *tsk) unsigned long address, struct task_struct *tsk)
{ {
siginfo_t info; siginfo_t info;
......
...@@ -252,6 +252,18 @@ static int is_prefetch(struct pt_regs *regs, unsigned long addr, ...@@ -252,6 +252,18 @@ static int is_prefetch(struct pt_regs *regs, unsigned long addr,
return prefetch; return prefetch;
} }
static void force_sig_info_fault(int si_signo, int si_code,
unsigned long address, struct task_struct *tsk)
{
siginfo_t info;
info.si_signo = si_signo;
info.si_errno = 0;
info.si_code = si_code;
info.si_addr = (void __user *)address;
force_sig_info(si_signo, &info, tsk);
}
static int bad_address(void *p) static int bad_address(void *p)
{ {
unsigned long dummy; unsigned long dummy;
...@@ -415,7 +427,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, ...@@ -415,7 +427,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
unsigned long address; unsigned long address;
int write, fault; int write, fault;
unsigned long flags; unsigned long flags;
siginfo_t info; int si_code;
/* /*
* We can fault from pretty much anywhere, with unknown IRQ state. * We can fault from pretty much anywhere, with unknown IRQ state.
...@@ -429,7 +441,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, ...@@ -429,7 +441,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
/* get the address */ /* get the address */
address = read_cr2(); address = read_cr2();
info.si_code = SEGV_MAPERR; si_code = SEGV_MAPERR;
/* /*
...@@ -532,7 +544,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, ...@@ -532,7 +544,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
* we can handle it.. * we can handle it..
*/ */
good_area: good_area:
info.si_code = SEGV_ACCERR; si_code = SEGV_ACCERR;
write = 0; write = 0;
switch (error_code & (PF_PROT|PF_WRITE)) { switch (error_code & (PF_PROT|PF_WRITE)) {
default: /* 3: write, present */ default: /* 3: write, present */
...@@ -611,11 +623,8 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, ...@@ -611,11 +623,8 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
/* Kernel addresses are always protection faults */ /* Kernel addresses are always protection faults */
tsk->thread.error_code = error_code | (address >= TASK_SIZE); tsk->thread.error_code = error_code | (address >= TASK_SIZE);
tsk->thread.trap_no = 14; tsk->thread.trap_no = 14;
info.si_signo = SIGSEGV;
info.si_errno = 0; force_sig_info_fault(SIGSEGV, si_code, address, tsk);
/* info.si_code has been set above */
info.si_addr = (void __user *)address;
force_sig_info(SIGSEGV, &info, tsk);
return; return;
} }
...@@ -682,11 +691,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, ...@@ -682,11 +691,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
tsk->thread.cr2 = address; tsk->thread.cr2 = address;
tsk->thread.error_code = error_code; tsk->thread.error_code = error_code;
tsk->thread.trap_no = 14; tsk->thread.trap_no = 14;
info.si_signo = SIGBUS; force_sig_info_fault(SIGBUS, BUS_ADRERR, address, tsk);
info.si_errno = 0;
info.si_code = BUS_ADRERR;
info.si_addr = (void __user *)address;
force_sig_info(SIGBUS, &info, tsk);
return; return;
} }
......
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