diff options
Diffstat (limited to 'arch/x86/mm/fault_32.c')
-rw-r--r-- | arch/x86/mm/fault_32.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/arch/x86/mm/fault_32.c b/arch/x86/mm/fault_32.c index a2273d44aa27..6056c6d71835 100644 --- a/arch/x86/mm/fault_32.c +++ b/arch/x86/mm/fault_32.c | |||
@@ -72,15 +72,15 @@ static inline int notify_page_fault(struct pt_regs *regs) | |||
72 | static inline unsigned long get_segment_eip(struct pt_regs *regs, | 72 | static inline unsigned long get_segment_eip(struct pt_regs *regs, |
73 | unsigned long *eip_limit) | 73 | unsigned long *eip_limit) |
74 | { | 74 | { |
75 | unsigned long eip = regs->eip; | 75 | unsigned long ip = regs->ip; |
76 | unsigned seg = regs->xcs & 0xffff; | 76 | unsigned seg = regs->cs & 0xffff; |
77 | u32 seg_ar, seg_limit, base, *desc; | 77 | u32 seg_ar, seg_limit, base, *desc; |
78 | 78 | ||
79 | /* Unlikely, but must come before segment checks. */ | 79 | /* Unlikely, but must come before segment checks. */ |
80 | if (unlikely(regs->eflags & VM_MASK)) { | 80 | if (unlikely(regs->flags & VM_MASK)) { |
81 | base = seg << 4; | 81 | base = seg << 4; |
82 | *eip_limit = base + 0xffff; | 82 | *eip_limit = base + 0xffff; |
83 | return base + (eip & 0xffff); | 83 | return base + (ip & 0xffff); |
84 | } | 84 | } |
85 | 85 | ||
86 | /* The standard kernel/user address space limit. */ | 86 | /* The standard kernel/user address space limit. */ |
@@ -88,16 +88,16 @@ static inline unsigned long get_segment_eip(struct pt_regs *regs, | |||
88 | 88 | ||
89 | /* By far the most common cases. */ | 89 | /* By far the most common cases. */ |
90 | if (likely(SEGMENT_IS_FLAT_CODE(seg))) | 90 | if (likely(SEGMENT_IS_FLAT_CODE(seg))) |
91 | return eip; | 91 | return ip; |
92 | 92 | ||
93 | /* Check the segment exists, is within the current LDT/GDT size, | 93 | /* Check the segment exists, is within the current LDT/GDT size, |
94 | that kernel/user (ring 0..3) has the appropriate privilege, | 94 | that kernel/user (ring 0..3) has the appropriate privilege, |
95 | that it's a code segment, and get the limit. */ | 95 | that it's a code segment, and get the limit. */ |
96 | __asm__ ("larl %3,%0; lsll %3,%1" | 96 | __asm__ ("larl %3,%0; lsll %3,%1" |
97 | : "=&r" (seg_ar), "=r" (seg_limit) : "0" (0), "rm" (seg)); | 97 | : "=&r" (seg_ar), "=r" (seg_limit) : "0" (0), "rm" (seg)); |
98 | if ((~seg_ar & 0x9800) || eip > seg_limit) { | 98 | if ((~seg_ar & 0x9800) || ip > seg_limit) { |
99 | *eip_limit = 0; | 99 | *eip_limit = 0; |
100 | return 1; /* So that returned eip > *eip_limit. */ | 100 | return 1; /* So that returned ip > *eip_limit. */ |
101 | } | 101 | } |
102 | 102 | ||
103 | /* Get the GDT/LDT descriptor base. | 103 | /* Get the GDT/LDT descriptor base. |
@@ -127,7 +127,7 @@ static inline unsigned long get_segment_eip(struct pt_regs *regs, | |||
127 | seg_limit += base; | 127 | seg_limit += base; |
128 | if (seg_limit < *eip_limit && seg_limit >= base) | 128 | if (seg_limit < *eip_limit && seg_limit >= base) |
129 | *eip_limit = seg_limit; | 129 | *eip_limit = seg_limit; |
130 | return eip + base; | 130 | return ip + base; |
131 | } | 131 | } |
132 | 132 | ||
133 | /* | 133 | /* |
@@ -345,7 +345,7 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs, | |||
345 | 345 | ||
346 | /* It's safe to allow irq's after cr2 has been saved and the vmalloc | 346 | /* It's safe to allow irq's after cr2 has been saved and the vmalloc |
347 | fault has been handled. */ | 347 | fault has been handled. */ |
348 | if (regs->eflags & (X86_EFLAGS_IF|VM_MASK)) | 348 | if (regs->flags & (X86_EFLAGS_IF|VM_MASK)) |
349 | local_irq_enable(); | 349 | local_irq_enable(); |
350 | 350 | ||
351 | mm = tsk->mm; | 351 | mm = tsk->mm; |
@@ -374,7 +374,7 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs, | |||
374 | */ | 374 | */ |
375 | if (!down_read_trylock(&mm->mmap_sem)) { | 375 | if (!down_read_trylock(&mm->mmap_sem)) { |
376 | if ((error_code & 4) == 0 && | 376 | if ((error_code & 4) == 0 && |
377 | !search_exception_tables(regs->eip)) | 377 | !search_exception_tables(regs->ip)) |
378 | goto bad_area_nosemaphore; | 378 | goto bad_area_nosemaphore; |
379 | down_read(&mm->mmap_sem); | 379 | down_read(&mm->mmap_sem); |
380 | } | 380 | } |
@@ -388,12 +388,12 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs, | |||
388 | goto bad_area; | 388 | goto bad_area; |
389 | if (error_code & 4) { | 389 | if (error_code & 4) { |
390 | /* | 390 | /* |
391 | * Accessing the stack below %esp is always a bug. | 391 | * Accessing the stack below %sp is always a bug. |
392 | * The large cushion allows instructions like enter | 392 | * The large cushion allows instructions like enter |
393 | * and pusha to work. ("enter $65535,$31" pushes | 393 | * and pusha to work. ("enter $65535,$31" pushes |
394 | * 32 pointers and then decrements %esp by 65535.) | 394 | * 32 pointers and then decrements %sp by 65535.) |
395 | */ | 395 | */ |
396 | if (address + 65536 + 32 * sizeof(unsigned long) < regs->esp) | 396 | if (address + 65536 + 32 * sizeof(unsigned long) < regs->sp) |
397 | goto bad_area; | 397 | goto bad_area; |
398 | } | 398 | } |
399 | if (expand_stack(vma, address)) | 399 | if (expand_stack(vma, address)) |
@@ -442,7 +442,7 @@ good_area: | |||
442 | /* | 442 | /* |
443 | * Did it hit the DOS screen memory VA from vm86 mode? | 443 | * Did it hit the DOS screen memory VA from vm86 mode? |
444 | */ | 444 | */ |
445 | if (regs->eflags & VM_MASK) { | 445 | if (regs->flags & VM_MASK) { |
446 | unsigned long bit = (address - 0xA0000) >> PAGE_SHIFT; | 446 | unsigned long bit = (address - 0xA0000) >> PAGE_SHIFT; |
447 | if (bit < 32) | 447 | if (bit < 32) |
448 | tsk->thread.screen_bitmap |= 1 << bit; | 448 | tsk->thread.screen_bitmap |= 1 << bit; |
@@ -474,11 +474,11 @@ bad_area_nosemaphore: | |||
474 | 474 | ||
475 | if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && | 475 | if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && |
476 | printk_ratelimit()) { | 476 | printk_ratelimit()) { |
477 | printk("%s%s[%d]: segfault at %08lx eip %08lx " | 477 | printk("%s%s[%d]: segfault at %08lx ip %08lx " |
478 | "esp %08lx error %lx\n", | 478 | "sp %08lx error %lx\n", |
479 | task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, | 479 | task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, |
480 | tsk->comm, task_pid_nr(tsk), address, regs->eip, | 480 | tsk->comm, task_pid_nr(tsk), address, regs->ip, |
481 | regs->esp, error_code); | 481 | regs->sp, error_code); |
482 | } | 482 | } |
483 | tsk->thread.cr2 = address; | 483 | tsk->thread.cr2 = address; |
484 | /* Kernel addresses are always protection faults */ | 484 | /* Kernel addresses are always protection faults */ |
@@ -544,7 +544,7 @@ no_context: | |||
544 | printk(KERN_ALERT "BUG: unable to handle kernel paging" | 544 | printk(KERN_ALERT "BUG: unable to handle kernel paging" |
545 | " request"); | 545 | " request"); |
546 | printk(" at virtual address %08lx\n",address); | 546 | printk(" at virtual address %08lx\n",address); |
547 | printk(KERN_ALERT "printing eip: %08lx ", regs->eip); | 547 | printk(KERN_ALERT "printing ip: %08lx ", regs->ip); |
548 | 548 | ||
549 | page = read_cr3(); | 549 | page = read_cr3(); |
550 | page = ((__typeof__(page) *) __va(page))[address >> PGDIR_SHIFT]; | 550 | page = ((__typeof__(page) *) __va(page))[address >> PGDIR_SHIFT]; |