Patch: use .pushsection/.popsection
I think this might fix the X bug...
arch/i386/kernel/entry.S +23 -23
@@ -162,17 +162,17 @@ 2: popl %es; \ 2: popl %es; \ CFI_ADJUST_CFA_OFFSET -4;\ /*CFI_RESTORE es;*/\ -.section .fixup,"ax"; \ +.pushsection .fixup,"ax"; \ 3: movl $0,(%esp); \ jmp 1b; \ 4: movl $0,(%esp); \ jmp 2b; \ -.previous; \ -.section __ex_table,"a";\ +.popsection \ +.pushsection __ex_table,"a";\ .align 4; \ .long 1b,3b; \ .long 2b,4b; \ -.previous +.popsection #define RING0_INT_FRAME \ CFI_STARTPROC simple;\
@@ -300,10 +300,10 @@ sysenter_past_esp: cmpl $__PAGE_OFFSET-3,%ebp jae syscall_fault 1: movl (%ebp),%ebp -.section __ex_table,"a" +.pushsection __ex_table,"a" .align 4 .long 1b,syscall_fault -.previous +.popsection pushl %eax CFI_ADJUST_CFA_OFFSET 4
@@ -378,18 +378,18 @@ restore_nocheck_notrace: addl $4, %esp CFI_ADJUST_CFA_OFFSET -4 1: INTERRUPT_RETURN -.section .fixup,"ax" +.pushsection .fixup,"ax" iret_exc: TRACE_IRQS_ON ENABLE_INTERRUPTS pushl $0 # no error code pushl $do_iret_error jmp error_code -.previous -.section __ex_table,"a" +.popsection +.pushsection __ex_table,"a" .align 4 .long 1b,iret_exc -.previous +.popsection CFI_RESTORE_STATE ldt_ss:
@@ -415,11 +415,11 @@ ldt_ss: TRACE_IRQS_IRET RESTORE_REGS lss 20+4(%esp), %esp # switch to 16bit stack -1: INTERRUPT_RETURN -.section __ex_table,"a" +1: iret +.pushsection __ex_table,"a" .align 4 .long 1b,iret_exc -.previous +.popsection CFI_ENDPROC # perform work that needs to be done immediately before resumption
@@ -525,14 +525,14 @@ syscall_badsys: je 28f; \ 27: popl %eax; \ CFI_ADJUST_CFA_OFFSET -4; \ -.section .fixup,"ax"; \ +.pushsection .fixup,"ax"; \ 28: movl $__KERNEL_DS, %eax; \ movl %eax, %ds; \ movl %eax, %es; \ /* switch to 32bit stack */ \ FIXUP_ESPFIX_STACK; \ jmp 27b; \ -.previous +.popsection /* * Build the entry stubs and pointer table with
@@ -639,7 +639,7 @@ error_code: call *%edi jmp ret_from_exception CFI_ENDPROC -.previous +KPROBE_EXIT ENTRY(coprocessor_error) RING0_INT_FRAME
@@ -715,7 +715,7 @@ debug_stack_correct: call do_debug jmp ret_from_exception CFI_ENDPROC -.previous +KPROBE_EXIT /* * NMI is doubly nasty. It can happen _while_ we're handling
@@ -795,12 +795,12 @@ nmi_16bit_stack: call do_nmi RESTORE_REGS lss 12+4(%esp), %esp # back to 16bit stack -1: INTERRUPT_RETURN - CFI_ENDPROC -.section __ex_table,"a" +1: iret + CFI_ENDPROC +.pushsection __ex_table,"a" .align 4 .long 1b,iret_exc -.previous +.popsection #ifdef CONFIG_PARAVIRT ENTRY(nopara_iret)
@@ -821,7 +821,7 @@ KPROBE_ENTRY(int3) call do_int3 jmp ret_from_exception CFI_ENDPROC -.previous +KPROBE_EXIT ENTRY(overflow) RING0_INT_FRAME
@@ -886,7 +886,7 @@ KPROBE_ENTRY(general_protection) CFI_ADJUST_CFA_OFFSET 4 jmp error_code CFI_ENDPROC -.previous +KPROBE_EXIT ENTRY(alignment_check) RING0_EC_FRAME
include/asm-i386/alternative-asm.i +2 -2
@@ -3,10 +3,10 @@ #ifdef CONFIG_SMP .macro LOCK_PREFIX 1: lock - .section .smp_locks,"a" + .pushsection .smp_locks,"a" .align 4 .long 1b - .previous + .popsection .endm #else .macro LOCK_PREFIX
include/linux/linkage.h +4 -1
@@ -35,8 +35,11 @@#endif #define KPROBE_ENTRY (name) \ - .section .kprobes.text, "ax"; \ + .pushsection .kprobes.text, "ax"; \ ENTRY(name) + +#define KPROBE_EXIT \ + .popsection#ifndef END #define END (name) \
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/virtualization
Quoted 1 line · Zachary Amsden
I think this might fix the X bug...
I just posted an equivalent patch to Andi Kleen/AKPM/LKML. I haven't tested to see if it actually helps yet, but it certainly makes entry.o look a lot cleaner.
J
Quoted 5 lines · Jeremy Fitzhardinge
Quoted 1 line · Zachary Amsden
I think this might fix the X bug...
I just posted an equivalent patch to Andi Kleen/AKPM/LKML. I haven't tested to see if it actually helps yet, but it certainly makes entry.o look a lot cleaner.
I have already merged it.
But in theory all code should run fine in .fixup, so it shouldn't actually unbreak anything.
-Andi
Quoted 5 lines · Andi Kleen
I have already merged it.
But in theory all code should run fine in .fixup, so it shouldn't actually unbreak anything.
No, it makes actual broken code without this:
#define RESTORE_REGS \ RESTORE_INT_REGS; \ 1: popl %ds; \ CFI_ADJUST_CFA_OFFSET -4;\ /*CFI_RESTORE ds;*/\ 2: popl %es; \ CFI_ADJUST_CFA_OFFSET -4;\ /*CFI_RESTORE es;*/\ .section .fixup,"ax"; \ 3: movl $0,(%esp); \ jmp 1b; \ 4: movl $0,(%esp); \ jmp 2b; \
.previous; \
...
Those jmp 1b's look a lot like infinite loops if 1: is in the same section as 3:.
J