From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754037AbbCIR7j (ORCPT ); Mon, 9 Mar 2015 13:59:39 -0400 Received: from mail-ie0-f179.google.com ([209.85.223.179]:37387 "EHLO mail-ie0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753904AbbCIR7g (ORCPT ); Mon, 9 Mar 2015 13:59:36 -0400 MIME-Version: 1.0 In-Reply-To: References: <1425909943-14687-1-git-send-email-dvlasenk@redhat.com> <54FDDB90.9010706@zytor.com> Date: Mon, 9 Mar 2015 10:59:35 -0700 X-Google-Sender-Auth: mlB4D_lNksWj2BPnqvyt0NWnccQ Message-ID: Subject: Re: [PATCH] x86: entry_32.S: change ESPFIX test to not touch PT_OLDSS(%esp) From: Linus Torvalds To: Andy Lutomirski Cc: "H. Peter Anvin" , Denys Vlasenko , Steven Rostedt , Ingo Molnar , Borislav Petkov , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , "the arch/x86 maintainers" , Linux Kernel Mailing List Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 9, 2015 at 10:45 AM, Andy Lutomirski wrote: > > If sp0 is set to the very top of the stack, then an NMI immediately > after sysenter will have OLDSS off the top of the stack, and reading > it can crash. This is why 32-bit kernels have a (buggy!) 8 byte > offset in sp0. So I think that for sysenter, we *should* have that 8-byte buffer. Not in general for sp0, but for MSR_IA32_SYSENTER_ESP (which is sp1, afaik). Just make the rule be that you can never ever have a kernel stack frame that doesn't contain room for ss/sp at the top. We have various code that looks at and touches "pt_regs" anyway, and accesses things out for debugging/oopsing/tracing etc. Let's not make the rule be that you cannot look at regs->ss without checking various random other fields first. Linus