diff options
author | Andi Kleen <ak@suse.de> | 2006-01-15 19:56:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-16 14:27:58 -0500 |
commit | 5f8efbb96f4b2679dcbd2c115380a47bd2089dcd (patch) | |
tree | 09b8c0684ee8e943d6199e2e4ebc21e5ce0062c9 | |
parent | aa41eb9915de74fc6935792973bac4bd777ce218 (diff) |
[PATCH] x86_64: Allow nesting of int3 by default for kprobes
This unbreaks recursive kprobes which didn't work anymore
due to an earlier patch which converted the debug entry point
to use an IST.
This also allows nesting of the debug entry point too.
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | arch/x86_64/kernel/asm-offsets.c | 5 | ||||
-rw-r--r-- | arch/x86_64/kernel/entry.S | 12 | ||||
-rw-r--r-- | include/asm-x86_64/page.h | 7 | ||||
-rw-r--r-- | include/asm-x86_64/processor.h | 7 |
4 files changed, 14 insertions, 17 deletions
diff --git a/arch/x86_64/kernel/asm-offsets.c b/arch/x86_64/kernel/asm-offsets.c index cfb4f9cebea4..38834bbbae11 100644 --- a/arch/x86_64/kernel/asm-offsets.c +++ b/arch/x86_64/kernel/asm-offsets.c | |||
@@ -43,6 +43,7 @@ int main(void) | |||
43 | ENTRY(irqcount); | 43 | ENTRY(irqcount); |
44 | ENTRY(cpunumber); | 44 | ENTRY(cpunumber); |
45 | ENTRY(irqstackptr); | 45 | ENTRY(irqstackptr); |
46 | ENTRY(data_offset); | ||
46 | BLANK(); | 47 | BLANK(); |
47 | #undef ENTRY | 48 | #undef ENTRY |
48 | #ifdef CONFIG_IA32_EMULATION | 49 | #ifdef CONFIG_IA32_EMULATION |
@@ -66,8 +67,6 @@ int main(void) | |||
66 | DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address)); | 67 | DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address)); |
67 | DEFINE(pbe_next, offsetof(struct pbe, next)); | 68 | DEFINE(pbe_next, offsetof(struct pbe, next)); |
68 | BLANK(); | 69 | BLANK(); |
69 | #if DEBUG_STKSZ > EXCEPTION_STKSZ | 70 | DEFINE(TSS_ist, offsetof(struct tss_struct, ist)); |
70 | DEFINE(DEBUG_IST, DEBUG_STACK); | ||
71 | #endif | ||
72 | return 0; | 71 | return 0; |
73 | } | 72 | } |
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S index 632fc0f59fcc..dbdba56e8faa 100644 --- a/arch/x86_64/kernel/entry.S +++ b/arch/x86_64/kernel/entry.S | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <asm/unistd.h> | 41 | #include <asm/unistd.h> |
42 | #include <asm/thread_info.h> | 42 | #include <asm/thread_info.h> |
43 | #include <asm/hw_irq.h> | 43 | #include <asm/hw_irq.h> |
44 | #include <asm/page.h> | ||
44 | 45 | ||
45 | .code64 | 46 | .code64 |
46 | 47 | ||
@@ -674,9 +675,6 @@ ENTRY(spurious_interrupt) | |||
674 | 675 | ||
675 | /* error code is on the stack already */ | 676 | /* error code is on the stack already */ |
676 | /* handle NMI like exceptions that can happen everywhere */ | 677 | /* handle NMI like exceptions that can happen everywhere */ |
677 | #ifndef DEBUG_IST | ||
678 | # define DEBUG_IST 0 | ||
679 | #endif | ||
680 | .macro paranoidentry sym, ist=0 | 678 | .macro paranoidentry sym, ist=0 |
681 | SAVE_ALL | 679 | SAVE_ALL |
682 | cld | 680 | cld |
@@ -695,11 +693,11 @@ ENTRY(spurious_interrupt) | |||
695 | movq ORIG_RAX(%rsp),%rsi | 693 | movq ORIG_RAX(%rsp),%rsi |
696 | movq $-1,ORIG_RAX(%rsp) | 694 | movq $-1,ORIG_RAX(%rsp) |
697 | .if \ist | 695 | .if \ist |
698 | subq $EXCEPTION_STACK_SIZE, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp) | 696 | subq $EXCEPTION_STKSZ, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp) |
699 | .endif | 697 | .endif |
700 | call \sym | 698 | call \sym |
701 | .if \ist | 699 | .if \ist |
702 | addq $EXCEPTION_STACK_SIZE, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp) | 700 | addq $EXCEPTION_STKSZ, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp) |
703 | .endif | 701 | .endif |
704 | cli | 702 | cli |
705 | .endm | 703 | .endm |
@@ -918,7 +916,7 @@ KPROBE_ENTRY(debug) | |||
918 | INTR_FRAME | 916 | INTR_FRAME |
919 | pushq $0 | 917 | pushq $0 |
920 | CFI_ADJUST_CFA_OFFSET 8 | 918 | CFI_ADJUST_CFA_OFFSET 8 |
921 | paranoidentry do_debug, DEBUG_IST | 919 | paranoidentry do_debug, DEBUG_STACK |
922 | jmp paranoid_exit | 920 | jmp paranoid_exit |
923 | CFI_ENDPROC | 921 | CFI_ENDPROC |
924 | .previous .text | 922 | .previous .text |
@@ -976,7 +974,7 @@ KPROBE_ENTRY(int3) | |||
976 | INTR_FRAME | 974 | INTR_FRAME |
977 | pushq $0 | 975 | pushq $0 |
978 | CFI_ADJUST_CFA_OFFSET 8 | 976 | CFI_ADJUST_CFA_OFFSET 8 |
979 | paranoidentry do_int3, DEBUG_IST | 977 | paranoidentry do_int3, DEBUG_STACK |
980 | jmp paranoid_exit | 978 | jmp paranoid_exit |
981 | CFI_ENDPROC | 979 | CFI_ENDPROC |
982 | .previous .text | 980 | .previous .text |
diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h index dcbb4fcd9a18..615e3e494929 100644 --- a/include/asm-x86_64/page.h +++ b/include/asm-x86_64/page.h | |||
@@ -26,6 +26,13 @@ | |||
26 | #define IRQSTACK_ORDER 2 | 26 | #define IRQSTACK_ORDER 2 |
27 | #define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER) | 27 | #define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER) |
28 | 28 | ||
29 | #define STACKFAULT_STACK 1 | ||
30 | #define DOUBLEFAULT_STACK 2 | ||
31 | #define NMI_STACK 3 | ||
32 | #define DEBUG_STACK 4 | ||
33 | #define MCE_STACK 5 | ||
34 | #define N_EXCEPTION_STACKS 5 /* hw limit: 7 */ | ||
35 | |||
29 | #define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1)) | 36 | #define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1)) |
30 | #define LARGE_PAGE_SIZE (1UL << PMD_SHIFT) | 37 | #define LARGE_PAGE_SIZE (1UL << PMD_SHIFT) |
31 | 38 | ||
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h index 87a282b1043a..a1ba7c97465a 100644 --- a/include/asm-x86_64/processor.h +++ b/include/asm-x86_64/processor.h | |||
@@ -273,13 +273,6 @@ struct thread_struct { | |||
273 | #define INIT_MMAP \ | 273 | #define INIT_MMAP \ |
274 | { &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } | 274 | { &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } |
275 | 275 | ||
276 | #define STACKFAULT_STACK 1 | ||
277 | #define DOUBLEFAULT_STACK 2 | ||
278 | #define NMI_STACK 3 | ||
279 | #define DEBUG_STACK 4 | ||
280 | #define MCE_STACK 5 | ||
281 | #define N_EXCEPTION_STACKS 5 /* hw limit: 7 */ | ||
282 | |||
283 | #define start_thread(regs,new_rip,new_rsp) do { \ | 276 | #define start_thread(regs,new_rip,new_rsp) do { \ |
284 | asm volatile("movl %0,%%fs; movl %0,%%es; movl %0,%%ds": :"r" (0)); \ | 277 | asm volatile("movl %0,%%fs; movl %0,%%es; movl %0,%%ds": :"r" (0)); \ |
285 | load_gs_index(0); \ | 278 | load_gs_index(0); \ |