Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f442be2 authored by Andy Lutomirski's avatar Andy Lutomirski Committed by Linus Torvalds
Browse files

x86_64, traps: Stop using IST for #SS



On a 32-bit kernel, this has no effect, since there are no IST stacks.

On a 64-bit kernel, #SS can only happen in user code, on a failed iret
to user space, a canonical violation on access via RSP or RBP, or a
genuine stack segment violation in 32-bit kernel code.  The first two
cases don't need IST, and the latter two cases are unlikely fatal bugs,
and promoting them to double faults would be fine.

This fixes a bug in which the espfix64 code mishandles a stack segment
violation.

This saves 4k of memory per CPU and a tiny bit of code.

Signed-off-by: default avatarAndy Lutomirski <luto@amacapital.net>
Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent af726f21
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -20,7 +20,6 @@
#define THREAD_SIZE_ORDER	1
#define THREAD_SIZE_ORDER	1
#define THREAD_SIZE		(PAGE_SIZE << THREAD_SIZE_ORDER)
#define THREAD_SIZE		(PAGE_SIZE << THREAD_SIZE_ORDER)


#define STACKFAULT_STACK 0
#define DOUBLEFAULT_STACK 1
#define DOUBLEFAULT_STACK 1
#define NMI_STACK 0
#define NMI_STACK 0
#define DEBUG_STACK 0
#define DEBUG_STACK 0
+5 −6
Original line number Original line Diff line number Diff line
@@ -14,12 +14,11 @@
#define IRQ_STACK_ORDER 2
#define IRQ_STACK_ORDER 2
#define IRQ_STACK_SIZE (PAGE_SIZE << IRQ_STACK_ORDER)
#define IRQ_STACK_SIZE (PAGE_SIZE << IRQ_STACK_ORDER)


#define STACKFAULT_STACK 1
#define DOUBLEFAULT_STACK 1
#define DOUBLEFAULT_STACK 2
#define NMI_STACK 2
#define NMI_STACK 3
#define DEBUG_STACK 3
#define DEBUG_STACK 4
#define MCE_STACK 4
#define MCE_STACK 5
#define N_EXCEPTION_STACKS 4  /* hw limit: 7 */
#define N_EXCEPTION_STACKS 5  /* hw limit: 7 */


#define PUD_PAGE_SIZE		(_AC(1, UL) << PUD_SHIFT)
#define PUD_PAGE_SIZE		(_AC(1, UL) << PUD_SHIFT)
#define PUD_PAGE_MASK		(~(PUD_PAGE_SIZE-1))
#define PUD_PAGE_MASK		(~(PUD_PAGE_SIZE-1))
+1 −0
Original line number Original line Diff line number Diff line
@@ -39,6 +39,7 @@ asmlinkage void simd_coprocessor_error(void);


#ifdef CONFIG_TRACING
#ifdef CONFIG_TRACING
asmlinkage void trace_page_fault(void);
asmlinkage void trace_page_fault(void);
#define trace_stack_segment stack_segment
#define trace_divide_error divide_error
#define trace_divide_error divide_error
#define trace_bounds bounds
#define trace_bounds bounds
#define trace_invalid_op invalid_op
#define trace_invalid_op invalid_op
+0 −1
Original line number Original line Diff line number Diff line
@@ -24,7 +24,6 @@ static char x86_stack_ids[][8] = {
		[ DEBUG_STACK-1			]	= "#DB",
		[ DEBUG_STACK-1			]	= "#DB",
		[ NMI_STACK-1			]	= "NMI",
		[ NMI_STACK-1			]	= "NMI",
		[ DOUBLEFAULT_STACK-1		]	= "#DF",
		[ DOUBLEFAULT_STACK-1		]	= "#DF",
		[ STACKFAULT_STACK-1		]	= "#SS",
		[ MCE_STACK-1			]	= "#MC",
		[ MCE_STACK-1			]	= "#MC",
#if DEBUG_STKSZ > EXCEPTION_STKSZ
#if DEBUG_STKSZ > EXCEPTION_STKSZ
		[ N_EXCEPTION_STACKS ...
		[ N_EXCEPTION_STACKS ...
+1 −1
Original line number Original line Diff line number Diff line
@@ -1259,7 +1259,7 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \


idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
idtentry int3 do_int3 has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
idtentry int3 do_int3 has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
idtentry stack_segment do_stack_segment has_error_code=1 paranoid=1
idtentry stack_segment do_stack_segment has_error_code=1
#ifdef CONFIG_XEN
#ifdef CONFIG_XEN
idtentry xen_debug do_debug has_error_code=0
idtentry xen_debug do_debug has_error_code=0
idtentry xen_int3 do_int3 has_error_code=0
idtentry xen_int3 do_int3 has_error_code=0
Loading