Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 100025
b: refs/heads/master
c: 13485ab
h: refs/heads/master
i:
  100023: 522ff56
v: v3
  • Loading branch information
Alexander van Heukelum authored and Ingo Molnar committed Jul 9, 2008
1 parent 5eb7609 commit 89e1425
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 36 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: a7bbb0ce1d1f956c8491b925c74767adf654f373
refs/heads/master: 13485ab55bc77f02024e80bcca0374950b0becb3
36 changes: 20 additions & 16 deletions trunk/arch/x86/kernel/traps_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,10 @@ DO_ERROR(12, SIGBUS, "stack segment", stack_segment)
DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0, 0)
DO_ERROR_INFO(32, SIGILL, "iret exception", iret_error, ILL_BADSTK, 0, 1)

void __kprobes do_general_protection(struct pt_regs *regs, long error_code)
void __kprobes
do_general_protection(struct pt_regs *regs, long error_code)
{
struct task_struct *tsk;
struct thread_struct *thread;
struct tss_struct *tss;
int cpu;
Expand Down Expand Up @@ -640,23 +642,24 @@ void __kprobes do_general_protection(struct pt_regs *regs, long error_code)
if (regs->flags & X86_VM_MASK)
goto gp_in_vm86;

tsk = current;
if (!user_mode(regs))
goto gp_in_kernel;

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

if (show_unhandled_signals && unhandled_signal(current, SIGSEGV) &&
printk_ratelimit()) {
if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
printk_ratelimit()) {
printk(KERN_INFO
"%s[%d] general protection ip:%lx sp:%lx error:%lx",
current->comm, task_pid_nr(current),
regs->ip, regs->sp, error_code);
"%s[%d] general protection ip:%lx sp:%lx error:%lx",
tsk->comm, task_pid_nr(tsk),
regs->ip, regs->sp, error_code);
print_vma_addr(" in ", regs->ip);
printk("\n");
}

force_sig(SIGSEGV, current);
force_sig(SIGSEGV, tsk);
return;

gp_in_vm86:
Expand All @@ -665,14 +668,15 @@ void __kprobes do_general_protection(struct pt_regs *regs, long error_code)
return;

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,
if (fixup_exception(regs))
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;
die("general protection fault", regs, error_code);
}
return;
die("general protection fault", regs, error_code);
}

static notrace __kprobes void
Expand Down
41 changes: 22 additions & 19 deletions trunk/arch/x86/kernel/traps_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,31 +733,34 @@ asmlinkage void do_double_fault(struct pt_regs * regs, long error_code)
die(str, regs, error_code);
}

asmlinkage void __kprobes do_general_protection(struct pt_regs * regs,
long error_code)
asmlinkage void __kprobes
do_general_protection(struct pt_regs *regs, long error_code)
{
struct task_struct *tsk = current;
struct task_struct *tsk;

conditional_sti(regs);

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

if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
printk_ratelimit()) {
printk(KERN_INFO
"%s[%d] general protection ip:%lx sp:%lx error:%lx",
tsk->comm, tsk->pid,
regs->ip, regs->sp, error_code);
print_vma_addr(" in ", regs->ip);
printk("\n");
}
tsk = current;
if (!user_mode(regs))
goto gp_in_kernel;

force_sig(SIGSEGV, tsk);
return;
}
tsk->thread.error_code = error_code;
tsk->thread.trap_no = 13;

if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
printk_ratelimit()) {
printk(KERN_INFO
"%s[%d] general protection ip:%lx sp:%lx error:%lx",
tsk->comm, tsk->pid,
regs->ip, regs->sp, error_code);
print_vma_addr(" in ", regs->ip);
printk("\n");
}

force_sig(SIGSEGV, tsk);
return;

gp_in_kernel:
if (fixup_exception(regs))
return;

Expand Down

0 comments on commit 89e1425

Please sign in to comment.