x86: move struct bug_frame instances out of line
PATCH 1/1 x86: move struct bug_frame instances out of line
Just like Linux did many years ago, move them into a separate (data) section, such that they no longer pollute instruction caches and TLBs.
Assertion frames, requiring two pointers to be stored, occupy two slots in the array, with the second slot mimicking a frame the location pointer of which doesn't match any address within .text or .init.text (it effectively points back to the slot itself, which - being in a data section - can't be reached by non-buggy execution).
xen/arch/x86/efi/stub.c +1 -1
@@ -1,7 +1,7 @@#include <xen/efi.h> #include <xen/errno.h> #include <xen/init.h> -#include <asm/bug.h> +#include <xen/lib.h> #ifndef efi_enabledconst bool_t efi_enabled =0 ;
xen/arch/x86/traps.c +45 -43
126 lines not on this page · raw message
xen/include/asm-x86/bug.h +47 -29
89 lines not on this page · raw message
xen/include/asm-x86/x86_64/bug.h deleted +0 -11
@@ -1,11 +0,0 @@ -#ifndef __X86_64_BUG_H__ -#define __X86_64_BUG_H__ - -struct bug_frame_str { -unsigned char mov; -signed int str_disp; -} __attribute__((packed)); -#define bug_str (b, rip) ((const char *)(rip) + (b).str_disp) -#define BUG_STR (n) "; movl %" #n " - ., %%esp" - -#endif /* __X86_64_BUG_H__ */
xen/arch/x86/xen.lds.S +12 -0
@@ -51,6 +51,18 @@ SECTIONS } :text = 0x9090 .rodata : { + /* Bug frames table */ + . = ALIGN(4); + __start_bug_frames = .; + *(.bug_frames.0) + __stop_bug_frames_0 = .; + *(.bug_frames.1) + __stop_bug_frames_1 = .; + *(.bug_frames.2) + __stop_bug_frames_2 = .; + *(.bug_frames.3) + __stop_bug_frames_3 = .; + *(.rodata) *(.rodata.*) } :text
x86: move struct bug_frame instances out of line
Just like Linux did many years ago, move them into a separate (data) section, such that they no longer pollute instruction caches and TLBs.
Assertion frames, requiring two pointers to be stored, occupy two slots in the array, with the second slot mimicking a frame the location pointer of which doesn't match any address within .text or .init.text (it effectively points back to the slot itself, which - being in a data section - can't be reached by non-buggy execution).
xen/arch/x86/efi/stub.c +1 -1
@@ -1,7 +1,7 @@#include <xen/efi.h> #include <xen/errno.h> #include <xen/init.h> -#include <asm/bug.h> +#include <xen/lib.h> #ifndef efi_enabledconst bool_t efi_enabled =0 ;
xen/arch/x86/traps.c +45 -43
126 lines not on this page · raw message
xen/include/asm-x86/bug.h +47 -29
89 lines not on this page · raw message
xen/include/asm-x86/x86_64/bug.h deleted +0 -11
@@ -1,11 +0,0 @@ -#ifndef __X86_64_BUG_H__ -#define __X86_64_BUG_H__ - -struct bug_frame_str { -unsigned char mov; -signed int str_disp; -} __attribute__((packed)); -#define bug_str (b, rip) ((const char *)(rip) + (b).str_disp) -#define BUG_STR (n) "; movl %" #n " - ., %%esp" - -#endif /* __X86_64_BUG_H__ */
xen/arch/x86/xen.lds.S +12 -0
@@ -51,6 +51,18 @@ SECTIONS } :text = 0x9090 .rodata : { + /* Bug frames table */ + . = ALIGN(4); + __start_bug_frames = .; + *(.bug_frames.0) + __stop_bug_frames_0 = .; + *(.bug_frames.1) + __stop_bug_frames_1 = .; + *(.bug_frames.2) + __stop_bug_frames_2 = .; + *(.bug_frames.3) + __stop_bug_frames_3 = .; + *(.rodata) *(.rodata.*) } :text
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 10 lines · Jan Beulich
Just like Linux did many years ago, move them into a separate (data) section, such that they no longer pollute instruction caches and TLBs.
Assertion frames, requiring two pointers to be stored, occupy two slots in the array, with the second slot mimicking a frame the location pointer of which doesn't match any address within .text or .init.text (it effectively points back to the slot itself, which - being in a data section - can't be reached by non-buggy execution).
Signed-off-by Jan Beulich <[email protected]>