From: Borislav Petkov <bp@alien8.de>
To: Jiri Slaby <jslaby@suse.cz>, Andy Lutomirski <luto@amacapital.net>
Cc: stable@vger.kernel.org, linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 3.12 14/66] x86_64, traps: Stop using IST for #SS
Date: Wed, 17 Dec 2014 16:56:22 +0100 [thread overview]
Message-ID: <20141217155622.GA9416@pd.tnic> (raw)
In-Reply-To: <e40598270a40040461c8b8d3a8656d54fb59b9cd.1417878427.git.jslaby@suse.cz>
On Sat, Dec 06, 2014 at 04:07:06PM +0100, Jiri Slaby wrote:
> From: Andy Lutomirski <luto@amacapital.net>
>
> 3.12-stable review patch. If anyone has any objections, please let me know.
>
> ===============
>
> commit 6f442be2fb22be02cafa606f1769fa1e6f894441 upstream.
>
> 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: Andy Lutomirski <luto@amacapital.net>
> Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> ---
> arch/x86/include/asm/page_32_types.h | 1 -
> arch/x86/include/asm/page_64_types.h | 11 +++++------
> arch/x86/kernel/dumpstack_64.c | 1 -
> arch/x86/kernel/entry_64.S | 2 +-
> arch/x86/kernel/traps.c | 18 +-----------------
> 5 files changed, 7 insertions(+), 26 deletions(-)
>
> diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h
> index f48b17df4224..3a52ee0e726d 100644
> --- a/arch/x86/include/asm/page_32_types.h
> +++ b/arch/x86/include/asm/page_32_types.h
> @@ -20,7 +20,6 @@
> #define THREAD_SIZE_ORDER 1
> #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
>
> -#define STACKFAULT_STACK 0
> #define DOUBLEFAULT_STACK 1
> #define NMI_STACK 0
> #define DEBUG_STACK 0
> diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h
> index 43dcd804ebd5..d1d2972a54db 100644
> --- a/arch/x86/include/asm/page_64_types.h
> +++ b/arch/x86/include/asm/page_64_types.h
> @@ -14,12 +14,11 @@
> #define IRQ_STACK_ORDER 2
> #define IRQ_STACK_SIZE (PAGE_SIZE << IRQ_STACK_ORDER)
>
> -#define STACKFAULT_STACK 1
> -#define DOUBLEFAULT_STACK 2
> -#define NMI_STACK 3
> -#define DEBUG_STACK 4
> -#define MCE_STACK 5
> -#define N_EXCEPTION_STACKS 5 /* hw limit: 7 */
> +#define DOUBLEFAULT_STACK 1
> +#define NMI_STACK 2
> +#define DEBUG_STACK 3
> +#define MCE_STACK 4
> +#define N_EXCEPTION_STACKS 4 /* hw limit: 7 */
>
> #define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT)
> #define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1))
> diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
> index addb207dab92..66e274a3d968 100644
> --- a/arch/x86/kernel/dumpstack_64.c
> +++ b/arch/x86/kernel/dumpstack_64.c
> @@ -24,7 +24,6 @@ static char x86_stack_ids[][8] = {
> [ DEBUG_STACK-1 ] = "#DB",
> [ NMI_STACK-1 ] = "NMI",
> [ DOUBLEFAULT_STACK-1 ] = "#DF",
> - [ STACKFAULT_STACK-1 ] = "#SS",
> [ MCE_STACK-1 ] = "#MC",
> #if DEBUG_STKSZ > EXCEPTION_STKSZ
> [ N_EXCEPTION_STACKS ...
> diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
> index c2ab43484b5d..e310e82de5e6 100644
> --- a/arch/x86/kernel/entry_64.S
> +++ b/arch/x86/kernel/entry_64.S
> @@ -1510,7 +1510,7 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
>
> paranoidzeroentry_ist debug do_debug DEBUG_STACK
> paranoidzeroentry_ist int3 do_int3 DEBUG_STACK
> -paranoiderrorentry stack_segment do_stack_segment
> +errorentry stack_segment do_stack_segment
> #ifdef CONFIG_XEN
> zeroentry xen_debug do_debug
> zeroentry xen_int3 do_int3
> diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
> index 8a2684f938b9..b2d6c58b28b0 100644
> --- a/arch/x86/kernel/traps.c
> +++ b/arch/x86/kernel/traps.c
> @@ -221,28 +221,12 @@ DO_ERROR(X86_TRAP_OLD_MF, SIGFPE, "coprocessor segment overrun",
> coprocessor_segment_overrun)
> DO_ERROR(X86_TRAP_TS, SIGSEGV, "invalid TSS", invalid_TSS)
> DO_ERROR(X86_TRAP_NP, SIGBUS, "segment not present", segment_not_present)
> -#ifdef CONFIG_X86_32
> DO_ERROR(X86_TRAP_SS, SIGBUS, "stack segment", stack_segment)
> -#endif
> DO_ERROR_INFO(X86_TRAP_AC, SIGBUS, "alignment check", alignment_check,
> BUS_ADRALN, 0)
>
> #ifdef CONFIG_X86_64
> /* Runs on IST stack */
> -dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code)
> -{
> - enum ctx_state prev_state;
> -
> - prev_state = exception_enter();
> - if (notify_die(DIE_TRAP, "stack segment", regs, error_code,
> - X86_TRAP_SS, SIGBUS) != NOTIFY_STOP) {
> - preempt_conditional_sti(regs);
> - do_trap(X86_TRAP_SS, SIGBUS, "stack segment", regs, error_code, NULL);
> - preempt_conditional_cli(regs);
> - }
> - exception_exit(prev_state);
> -}
> -
> dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code)
> {
> static const char str[] = "double fault";
> @@ -776,7 +760,7 @@ void __init trap_init(void)
> set_intr_gate(X86_TRAP_OLD_MF, &coprocessor_segment_overrun);
> set_intr_gate(X86_TRAP_TS, &invalid_TSS);
> set_intr_gate(X86_TRAP_NP, &segment_not_present);
> - set_intr_gate_ist(X86_TRAP_SS, &stack_segment, STACKFAULT_STACK);
> + set_intr_gate(X86_TRAP_SS, stack_segment);
I guess this should say "&stack_segment" in order for it to be
consistent with the rest of the set_intr_gate() calls here.
Fortunately, this is not an issue as function designators are
automatically promoted to function pointers, as the identical asm shows:
.loc 1 792 0
movq $stack_segment, %rsi #,
movl $12, %edi #,
call set_intr_gate #
.loc 1 792 0
movq $stack_segment, %rsi #,
movl $12, %edi #,
call set_intr_gate #
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
next prev parent reply other threads:[~2014-12-17 15:56 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-06 15:07 [PATCH 3.12 00/66] 3.12.35-stable review Jiri Slaby
2014-12-06 15:06 ` [PATCH 3.12 01/66] Input: serio - add firmware_id sysfs attribute Jiri Slaby
2014-12-06 15:06 ` [PATCH 3.12 02/66] Input: i8042 - add firmware_id support Jiri Slaby
2014-12-06 15:06 ` [PATCH 3.12 03/66] Input: Add INPUT_PROP_TOPBUTTONPAD device property Jiri Slaby
2014-12-06 15:06 ` [PATCH 3.12 04/66] Input: synaptics - report INPUT_PROP_TOPBUTTONPAD property Jiri Slaby
2014-12-06 15:06 ` [PATCH 3.12 05/66] Input: synaptics - add a matches_pnp_id helper function Jiri Slaby
2014-12-06 15:06 ` [PATCH 3.12 06/66] Input: synaptics - change min/max quirk table to pnp-id matching Jiri Slaby
2014-12-06 15:06 ` [PATCH 3.12 07/66] Input: synaptics - fix resolution for manually provided min/max Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 08/66] Input: synaptics - add min/max quirk for pnp-id LEN2002 (Edge E531) Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 09/66] Input: synaptics - add min/max quirk for Lenovo T440s Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 10/66] PCI/MSI: Return msix_capability_init() failure if populate_msi_sysfs() fails Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 11/66] MIPS: oprofile: Fix backtrace on 64-bit kernel Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 12/66] MIPS: Loongson: Make platform serial setup always built-in Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 13/66] x86_64, traps: Fix the espfix64 #DF fixup and rewrite it in C Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 14/66] x86_64, traps: Stop using IST for #SS Jiri Slaby
2014-12-17 15:56 ` Borislav Petkov [this message]
2014-12-06 15:07 ` [PATCH 3.12 15/66] x86_64, traps: Rework bad_iret Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 16/66] x86: Require exact match for 'noxsave' command line option Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 17/66] x86, mm: Set NX across entire PMD at boot Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 18/66] uprobes, x86: Fix _TIF_UPROBE vs _TIF_NOTIFY_RESUME Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 19/66] PCI/MSI: Add device flag indicating that 64-bit MSIs don't work Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 20/66] clockevent: sun4i: Fix race condition in the probe code Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 21/66] IB/isert: Adjust CQ size to HW limits Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 22/66] ib_isert: Add max_send_sge=2 minimum for control PDU responses Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 23/66] ASoC: rsnd: remove unsupported PAUSE flag Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 24/66] ASoC: fsi: " Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 25/66] ASoC: sgtl5000: Fix SMALL_POP bit definition Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 26/66] ASoC: wm_adsp: Avoid attempt to free buffers that might still be in use Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 27/66] ASoC: dpcm: Fix race between FE/BE updates and trigger Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 28/66] ath9k: Fix RTC_DERIVED_CLK usage Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 29/66] of/base: Fix PowerPC address parsing hack Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 30/66] powerpc/pseries: Honor the generic "no_64bit_msi" flag Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 31/66] powerpc/pseries: Fix endiannes issue in RTAS call from xmon Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 32/66] iio: Fix IIO_EVENT_CODE_EXTRACT_DIR bit mask Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 33/66] staging: r8188eu: Add new device ID for DLink GO-USB-N150 Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 34/66] USB: ssu100: fix overrun-error reporting Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 35/66] USB: keyspan: " Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 36/66] USB: keyspan: fix tty line-status reporting Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 37/66] USB: serial: cp210x: add IDs for CEL MeshConnect USB Stick Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 38/66] usb: serial: ftdi_sio: add PIDs for Matrix Orbital products Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 39/66] usb-quirks: Add reset-resume quirk for MS Wireless Laser Mouse 6000 Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 40/66] USB: xhci: don't start a halted endpoint before its new dequeue is set Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 41/66] usb: xhci: rework root port wake bits if controller isn't allowed to wakeup Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 42/66] can: esd_usb2: fix memory leak on disconnect Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 43/66] ALSA: usb-audio: Add ctrl message delay quirk for Marantz/Denon devices Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 44/66] aio: fix uncorrent dirty pages accouting when truncating AIO ring buffer Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 45/66] ARM: 8216/1: xscale: correct auxiliary register in suspend/resume Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 46/66] ARM: 8222/1: mvebu: enable strex backoff delay Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 47/66] ARM: 8226/1: cacheflush: get rid of restarting block Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 48/66] Input: synaptics - adjust min/max on Thinkpad E540 Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 49/66] Input: xpad - use proper endpoint type Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 50/66] srp-target: Retry when QP creation fails with ENOMEM Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 51/66] target: Don't call TFO->write_pending if data_length == 0 Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 52/66] iser-target: Handle DEVICE_REMOVAL event on network portal listener correctly Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 53/66] spi: dw: Fix dynamic speed change Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 54/66] vhost-scsi: Take configfs group dependency during VHOST_SCSI_SET_ENDPOINT Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 55/66] scsi: add Intel Multi-Flex to scsi scan blacklist Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 56/66] can: dev: avoid calling kfree_skb() from interrupt context Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 57/66] rt2x00: do not align payload on modern H/W Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 58/66] nfsd: correctly define v4.2 support attributes Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 59/66] nfsd: Fix slot wake up race in the nfsv4.1 callback code Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 60/66] net/ping: handle protocol mismatching scenario Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 61/66] bnx2fc: do not add shared skbs to the fcoe_rx_list Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 62/66] drm/radeon: fix endian swapping in vbios fetch for tdp table Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 63/66] gpu/radeon: Set flag to indicate broken 64-bit MSI Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 64/66] locks: eliminate BUG() call when there's an unexpected lock on file close Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 65/66] powerpc/powernv: Honor the generic "no_64bit_msi" flag Jiri Slaby
2014-12-06 15:07 ` [PATCH 3.12 66/66] batman: fix a bogus warning from batadv_is_on_batman_iface() Jiri Slaby
2014-12-07 0:09 ` [PATCH 3.12 00/66] 3.12.35-stable review Guenter Roeck
2014-12-11 9:57 ` Jiri Slaby
2014-12-08 17:04 ` Shuah Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141217155622.GA9416@pd.tnic \
--to=bp@alien8.de \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.