From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751607AbbCTQXc (ORCPT ); Fri, 20 Mar 2015 12:23:32 -0400 Received: from mail.skyhub.de ([78.46.96.112]:57081 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751064AbbCTQXb (ORCPT ); Fri, 20 Mar 2015 12:23:31 -0400 Date: Fri, 20 Mar 2015 17:21:51 +0100 From: Borislav Petkov To: Denys Vlasenko Cc: Andy Lutomirski , Linus Torvalds , Steven Rostedt , Ingo Molnar , "H. Peter Anvin" , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/5] x86: get rid of KERNEL_STACK_OFFSET Message-ID: <20150320162151.GF17058@pd.tnic> References: <1426785469-15125-1-git-send-email-dvlasenk@redhat.com> <1426785469-15125-2-git-send-email-dvlasenk@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1426785469-15125-2-git-send-email-dvlasenk@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 19, 2015 at 06:17:46PM +0100, Denys Vlasenko wrote: > PER_CPU_VAR(kernel_stack) was set up in a way where it points > five stack slots below the top of stack. > > Presumably, it was done to avoid one "sub $5*8,%rsp" > in syscall/sysenter code paths, where iret frame needs to be > created by hand. > > Ironically, none of them benefits from this optimization, > since all of them need to allocate additional data on stack > (struct pt_regs), so they still have to perform subtraction. > > This patch eliminates KERNEL_STACK_OFFSET. > > PER_CPU_VAR(kernel_stack) now points directly to top of stack. > pt_regs allocations are adjusted to allocate iret frame as well. > Hopefully we can merge it later with 32-bit specific > PER_CPU_VAR(cpu_current_top_of_stack) variable... > > Net result in generated code is that constants in several insns > are changed. > > This change is necessary for changing struct pt_regs creation > in SYSCALL64 code path from MOV to PUSH instructions. > > Signed-off-by: Denys Vlasenko > CC: Linus Torvalds > CC: Steven Rostedt > CC: Ingo Molnar > CC: Borislav Petkov > CC: "H. Peter Anvin" > CC: Andy Lutomirski > CC: Oleg Nesterov > CC: Frederic Weisbecker > CC: Alexei Starovoitov > CC: Will Drewry > CC: Kees Cook > CC: x86@kernel.org > CC: linux-kernel@vger.kernel.org Acked-by: Borislav Petkov -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. --