diff options
-rw-r--r-- | arch/x86_64/mm/fault.c | 12 | ||||
-rw-r--r-- | include/asm-x86_64/ptrace.h | 5 |
2 files changed, 10 insertions, 7 deletions
diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c index d4676ca09144..e03309216764 100644 --- a/arch/x86_64/mm/fault.c +++ b/arch/x86_64/mm/fault.c | |||
@@ -62,21 +62,19 @@ void bust_spinlocks(int yes) | |||
62 | static noinline int is_prefetch(struct pt_regs *regs, unsigned long addr, | 62 | static noinline int is_prefetch(struct pt_regs *regs, unsigned long addr, |
63 | unsigned long error_code) | 63 | unsigned long error_code) |
64 | { | 64 | { |
65 | unsigned char *instr = (unsigned char *)(regs->rip); | 65 | unsigned char *instr; |
66 | int scan_more = 1; | 66 | int scan_more = 1; |
67 | int prefetch = 0; | 67 | int prefetch = 0; |
68 | unsigned char *max_instr = instr + 15; | 68 | unsigned char *max_instr; |
69 | 69 | ||
70 | /* If it was a exec fault ignore */ | 70 | /* If it was a exec fault ignore */ |
71 | if (error_code & (1<<4)) | 71 | if (error_code & (1<<4)) |
72 | return 0; | 72 | return 0; |
73 | 73 | ||
74 | /* Code segments in LDT could have a non zero base. Don't check | 74 | instr = (unsigned char *)convert_rip_to_linear(current, regs); |
75 | when that's possible */ | 75 | max_instr = instr + 15; |
76 | if (regs->cs & (1<<2)) | ||
77 | return 0; | ||
78 | 76 | ||
79 | if ((regs->cs & 3) != 0 && regs->rip >= TASK_SIZE) | 77 | if ((regs->cs & 3) != 0 && instr >= (unsigned char *)TASK_SIZE) |
80 | return 0; | 78 | return 0; |
81 | 79 | ||
82 | while (scan_more && instr < max_instr) { | 80 | while (scan_more && instr < max_instr) { |
diff --git a/include/asm-x86_64/ptrace.h b/include/asm-x86_64/ptrace.h index c7865cfedc1f..5bbc8d3141c8 100644 --- a/include/asm-x86_64/ptrace.h +++ b/include/asm-x86_64/ptrace.h | |||
@@ -86,6 +86,11 @@ struct pt_regs { | |||
86 | extern unsigned long profile_pc(struct pt_regs *regs); | 86 | extern unsigned long profile_pc(struct pt_regs *regs); |
87 | void signal_fault(struct pt_regs *regs, void __user *frame, char *where); | 87 | void signal_fault(struct pt_regs *regs, void __user *frame, char *where); |
88 | 88 | ||
89 | struct task_struct; | ||
90 | |||
91 | extern unsigned long | ||
92 | convert_rip_to_linear(struct task_struct *child, struct pt_regs *regs); | ||
93 | |||
89 | enum { | 94 | enum { |
90 | EF_CF = 0x00000001, | 95 | EF_CF = 0x00000001, |
91 | EF_PF = 0x00000004, | 96 | EF_PF = 0x00000004, |