Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 53741
b: refs/heads/master
c: d189518
h: refs/heads/master
i:
  53739: 2b1c0c5
v: v3
  • Loading branch information
Andi Kleen authored and Andi Kleen committed May 2, 2007
1 parent 11f0af4 commit f541e7d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 00e065ea587363e538d9624eea8cacad12cb7397
refs/heads/master: d18951834216eae82e2f9112416111b4f55f1849
24 changes: 18 additions & 6 deletions trunk/arch/i386/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,6 @@ static void __kprobes do_trap(int trapnr, int signr, char *str, int vm86,
siginfo_t *info)
{
struct task_struct *tsk = current;
tsk->thread.error_code = error_code;
tsk->thread.trap_no = trapnr;

if (regs->eflags & VM_MASK) {
if (vm86)
Expand All @@ -489,6 +487,18 @@ static void __kprobes do_trap(int trapnr, int signr, char *str, int vm86,
goto kernel_trap;

trap_signal: {
/*
* We want error_code and trap_no set for userspace faults and
* kernelspace faults which result in die(), but not
* kernelspace faults which are fixed up. die() gives the
* process no chance to handle the signal and notice the
* kernel fault information, so that won't result in polluting
* the information about previously queued, but not yet
* delivered, faults. See also do_general_protection below.
*/
tsk->thread.error_code = error_code;
tsk->thread.trap_no = trapnr;

if (info)
force_sig_info(signr, info, tsk);
else
Expand All @@ -497,8 +507,11 @@ static void __kprobes do_trap(int trapnr, int signr, char *str, int vm86,
}

kernel_trap: {
if (!fixup_exception(regs))
if (!fixup_exception(regs)) {
tsk->thread.error_code = error_code;
tsk->thread.trap_no = trapnr;
die(str, regs, error_code);
}
return;
}

Expand Down Expand Up @@ -603,9 +616,6 @@ fastcall void __kprobes do_general_protection(struct pt_regs * regs,
}
put_cpu();

current->thread.error_code = error_code;
current->thread.trap_no = 13;

if (regs->eflags & VM_MASK)
goto gp_in_vm86;

Expand All @@ -624,6 +634,8 @@ fastcall void __kprobes do_general_protection(struct pt_regs * regs,

gp_in_kernel:
if (!fixup_exception(regs)) {
current->thread.error_code = error_code;
current->thread.trap_no = 13;
if (notify_die(DIE_GPF, "general protection fault", regs,
error_code, 13, SIGSEGV) == NOTIFY_STOP)
return;
Expand Down
30 changes: 23 additions & 7 deletions trunk/arch/x86_64/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,10 +581,20 @@ static void __kprobes do_trap(int trapnr, int signr, char *str,
{
struct task_struct *tsk = current;

tsk->thread.error_code = error_code;
tsk->thread.trap_no = trapnr;

if (user_mode(regs)) {
/*
* We want error_code and trap_no set for userspace
* faults and kernelspace faults which result in
* die(), but not kernelspace faults which are fixed
* up. die() gives the process no chance to handle
* the signal and notice the kernel fault information,
* so that won't result in polluting the information
* about previously queued, but not yet delivered,
* faults. See also do_general_protection below.
*/
tsk->thread.error_code = error_code;
tsk->thread.trap_no = trapnr;

if (exception_trace && unhandled_signal(tsk, signr))
printk(KERN_INFO
"%s[%d] trap %s rip:%lx rsp:%lx error:%lx\n",
Expand All @@ -605,8 +615,11 @@ static void __kprobes do_trap(int trapnr, int signr, char *str,
fixup = search_exception_tables(regs->rip);
if (fixup)
regs->rip = fixup->fixup;
else
else {
tsk->thread.error_code = error_code;
tsk->thread.trap_no = trapnr;
die(str, regs, error_code);
}
return;
}
}
Expand Down Expand Up @@ -682,10 +695,10 @@ asmlinkage void __kprobes do_general_protection(struct pt_regs * regs,

conditional_sti(regs);

tsk->thread.error_code = error_code;
tsk->thread.trap_no = 13;

if (user_mode(regs)) {
tsk->thread.error_code = error_code;
tsk->thread.trap_no = 13;

if (exception_trace && unhandled_signal(tsk, SIGSEGV))
printk(KERN_INFO
"%s[%d] general protection rip:%lx rsp:%lx error:%lx\n",
Expand All @@ -704,6 +717,9 @@ asmlinkage void __kprobes do_general_protection(struct pt_regs * regs,
regs->rip = fixup->fixup;
return;
}

tsk->thread.error_code = error_code;
tsk->thread.trap_no = 13;
if (notify_die(DIE_GPF, "general protection fault", regs,
error_code, 13, SIGSEGV) == NOTIFY_STOP)
return;
Expand Down

0 comments on commit f541e7d

Please sign in to comment.