Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754166AbbBZPV7 (ORCPT ); Thu, 26 Feb 2015 10:21:59 -0500 Received: from mail-la0-f45.google.com ([209.85.215.45]:37363 "EHLO mail-la0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753725AbbBZPV6 (ORCPT ); Thu, 26 Feb 2015 10:21:58 -0500 MIME-Version: 1.0 In-Reply-To: <20150226114252.GA4593@gmail.com> References: <1424803895-4420-1-git-send-email-dvlasenk@redhat.com> <1424803895-4420-2-git-send-email-dvlasenk@redhat.com> <20150225094550.GB6676@gmail.com> <20150226114252.GA4593@gmail.com> From: Andy Lutomirski Date: Thu, 26 Feb 2015 07:21:36 -0800 Message-ID: Subject: Re: [PATCH 2/4] x86: get rid of KERNEL_STACK_OFFSET To: Ingo Molnar Cc: Denys Vlasenko , Linus Torvalds , Steven Rostedt , Borislav Petkov , "H. Peter Anvin" , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , X86 ML , "linux-kernel@vger.kernel.org" , Tony Luck Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1888 Lines: 48 On Thu, Feb 26, 2015 at 3:42 AM, Ingo Molnar wrote: > > * Andy Lutomirski wrote: > >> >> I added that in and applied this patch. >> > >> > So this is not just slightly buggy, it's fundamentally >> > wrong as well as it removes the possibility of an RSP >> > value optimization from the 64-bit path, see my >> > previous mail. >> >> This is just trying to check that the function is >> executing on the per-thread stack. It was correct (and >> fairly heavily tested by Tony) wither KERNEL_STACK_OFFSET >> being nonzero, but we're checking the wrong page if >> KERNEL_STACK_OFFSET becomes zero. >> >> I don't think I understand your objection to this bit. > > I object to the KERNEL_STACK_OFFSET removal patch you fixed > here, not to the add-on fix in particular (which is correct > in the context of that patch). > Aha. I misunderstood. I would object, too, except that I think that a better improvement would be to build the entire frame using pushes, including the "top of stack" part, even on fast-path syscalls. That would have KERNEL_STACK_OFFSET=0. Actually, I want an even bigger change. kernel_stack seems entirely pointless to me, since we could just as easily be using tss.sp0 (I think), as long as there's no useful offset. So maybe the right way to handle this patch would be to first clean up the ia32entry code and all the non-asm users to use tss.sp0, and then to figure out what to do about the syscall64 path. I'd be happy to defer this patch until the FIXUP_TOP_OF_STACK cleanups later on, assuming it can be easily extricated, which I haven't checked yet. Thoughts? --Andy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/