diff options
Diffstat (limited to 'arch/x86/mm')
-rw-r--r-- | arch/x86/mm/extable_32.c | 6 | ||||
-rw-r--r-- | arch/x86/mm/fault_32.c | 38 | ||||
-rw-r--r-- | arch/x86/mm/fault_64.c | 22 |
3 files changed, 33 insertions, 33 deletions
diff --git a/arch/x86/mm/extable_32.c b/arch/x86/mm/extable_32.c index 0ce4f22a2635..41685461f8b2 100644 --- a/arch/x86/mm/extable_32.c +++ b/arch/x86/mm/extable_32.c | |||
@@ -11,7 +11,7 @@ int fixup_exception(struct pt_regs *regs) | |||
11 | const struct exception_table_entry *fixup; | 11 | const struct exception_table_entry *fixup; |
12 | 12 | ||
13 | #ifdef CONFIG_PNPBIOS | 13 | #ifdef CONFIG_PNPBIOS |
14 | if (unlikely(SEGMENT_IS_PNP_CODE(regs->xcs))) | 14 | if (unlikely(SEGMENT_IS_PNP_CODE(regs->cs))) |
15 | { | 15 | { |
16 | extern u32 pnp_bios_fault_eip, pnp_bios_fault_esp; | 16 | extern u32 pnp_bios_fault_eip, pnp_bios_fault_esp; |
17 | extern u32 pnp_bios_is_utter_crap; | 17 | extern u32 pnp_bios_is_utter_crap; |
@@ -25,9 +25,9 @@ int fixup_exception(struct pt_regs *regs) | |||
25 | } | 25 | } |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | fixup = search_exception_tables(regs->eip); | 28 | fixup = search_exception_tables(regs->ip); |
29 | if (fixup) { | 29 | if (fixup) { |
30 | regs->eip = fixup->fixup; | 30 | regs->ip = fixup->fixup; |
31 | return 1; | 31 | return 1; |
32 | } | 32 | } |
33 | 33 | ||
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]; |
diff --git a/arch/x86/mm/fault_64.c b/arch/x86/mm/fault_64.c index 0e26230669ca..88a7abda29ce 100644 --- a/arch/x86/mm/fault_64.c +++ b/arch/x86/mm/fault_64.c | |||
@@ -198,7 +198,7 @@ KERN_ERR "******* Disabling USB legacy in the BIOS may also help.\n"; | |||
198 | static int is_errata93(struct pt_regs *regs, unsigned long address) | 198 | static int is_errata93(struct pt_regs *regs, unsigned long address) |
199 | { | 199 | { |
200 | static int warned; | 200 | static int warned; |
201 | if (address != regs->rip) | 201 | if (address != regs->ip) |
202 | return 0; | 202 | return 0; |
203 | if ((address >> 32) != 0) | 203 | if ((address >> 32) != 0) |
204 | return 0; | 204 | return 0; |
@@ -209,7 +209,7 @@ static int is_errata93(struct pt_regs *regs, unsigned long address) | |||
209 | printk(errata93_warning); | 209 | printk(errata93_warning); |
210 | warned = 1; | 210 | warned = 1; |
211 | } | 211 | } |
212 | regs->rip = address; | 212 | regs->ip = address; |
213 | return 1; | 213 | return 1; |
214 | } | 214 | } |
215 | return 0; | 215 | return 0; |
@@ -355,7 +355,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, | |||
355 | if (notify_page_fault(regs)) | 355 | if (notify_page_fault(regs)) |
356 | return; | 356 | return; |
357 | 357 | ||
358 | if (likely(regs->eflags & X86_EFLAGS_IF)) | 358 | if (likely(regs->flags & X86_EFLAGS_IF)) |
359 | local_irq_enable(); | 359 | local_irq_enable(); |
360 | 360 | ||
361 | if (unlikely(error_code & PF_RSVD)) | 361 | if (unlikely(error_code & PF_RSVD)) |
@@ -393,7 +393,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, | |||
393 | */ | 393 | */ |
394 | if (!down_read_trylock(&mm->mmap_sem)) { | 394 | if (!down_read_trylock(&mm->mmap_sem)) { |
395 | if ((error_code & PF_USER) == 0 && | 395 | if ((error_code & PF_USER) == 0 && |
396 | !search_exception_tables(regs->rip)) | 396 | !search_exception_tables(regs->ip)) |
397 | goto bad_area_nosemaphore; | 397 | goto bad_area_nosemaphore; |
398 | down_read(&mm->mmap_sem); | 398 | down_read(&mm->mmap_sem); |
399 | } | 399 | } |
@@ -409,7 +409,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, | |||
409 | /* Allow userspace just enough access below the stack pointer | 409 | /* Allow userspace just enough access below the stack pointer |
410 | * to let the 'enter' instruction work. | 410 | * to let the 'enter' instruction work. |
411 | */ | 411 | */ |
412 | if (address + 65536 + 32 * sizeof(unsigned long) < regs->rsp) | 412 | if (address + 65536 + 32 * sizeof(unsigned long) < regs->sp) |
413 | goto bad_area; | 413 | goto bad_area; |
414 | } | 414 | } |
415 | if (expand_stack(vma, address)) | 415 | if (expand_stack(vma, address)) |
@@ -488,10 +488,10 @@ bad_area_nosemaphore: | |||
488 | if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && | 488 | if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && |
489 | printk_ratelimit()) { | 489 | printk_ratelimit()) { |
490 | printk( | 490 | printk( |
491 | "%s%s[%d]: segfault at %lx rip %lx rsp %lx error %lx\n", | 491 | "%s%s[%d]: segfault at %lx ip %lx sp %lx error %lx\n", |
492 | tsk->pid > 1 ? KERN_INFO : KERN_EMERG, | 492 | tsk->pid > 1 ? KERN_INFO : KERN_EMERG, |
493 | tsk->comm, tsk->pid, address, regs->rip, | 493 | tsk->comm, tsk->pid, address, regs->ip, |
494 | regs->rsp, error_code); | 494 | regs->sp, error_code); |
495 | } | 495 | } |
496 | 496 | ||
497 | tsk->thread.cr2 = address; | 497 | tsk->thread.cr2 = address; |
@@ -509,9 +509,9 @@ bad_area_nosemaphore: | |||
509 | no_context: | 509 | no_context: |
510 | 510 | ||
511 | /* Are we prepared to handle this kernel fault? */ | 511 | /* Are we prepared to handle this kernel fault? */ |
512 | fixup = search_exception_tables(regs->rip); | 512 | fixup = search_exception_tables(regs->ip); |
513 | if (fixup) { | 513 | if (fixup) { |
514 | regs->rip = fixup->fixup; | 514 | regs->ip = fixup->fixup; |
515 | return; | 515 | return; |
516 | } | 516 | } |
517 | 517 | ||
@@ -537,7 +537,7 @@ no_context: | |||
537 | else | 537 | else |
538 | printk(KERN_ALERT "Unable to handle kernel paging request"); | 538 | printk(KERN_ALERT "Unable to handle kernel paging request"); |
539 | printk(" at %016lx RIP: \n" KERN_ALERT,address); | 539 | printk(" at %016lx RIP: \n" KERN_ALERT,address); |
540 | printk_address(regs->rip); | 540 | printk_address(regs->ip); |
541 | dump_pagetable(address); | 541 | dump_pagetable(address); |
542 | tsk->thread.cr2 = address; | 542 | tsk->thread.cr2 = address; |
543 | tsk->thread.trap_no = 14; | 543 | tsk->thread.trap_no = 14; |