From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752517AbdJ0SVm (ORCPT ); Fri, 27 Oct 2017 14:21:42 -0400 Received: from mga07.intel.com ([134.134.136.100]:17988 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751167AbdJ0SVl (ORCPT ); Fri, 27 Oct 2017 14:21:41 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,304,1505804400"; d="scan'208";a="1236264836" Subject: Re: [PATCH 14/18] x86/boot/64: Stop initializing TSS.sp0 at boot To: Andy Lutomirski , X86 ML References: Cc: Borislav Petkov , "linux-kernel@vger.kernel.org" , Brian Gerst , Linus Torvalds From: Dave Hansen Message-ID: <2d640c9e-56cf-5425-1c94-682bebd18fcd@intel.com> Date: Fri, 27 Oct 2017 11:21:34 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/26/2017 01:26 AM, Andy Lutomirski wrote: > --- a/arch/x86/kernel/process.c > +++ b/arch/x86/kernel/process.c > @@ -48,7 +48,8 @@ > */ > __visible DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, cpu_tss) = { > .x86_tss = { > - .sp0 = TOP_OF_INIT_STACK, > + /* Initialize sp0 to a value that is definitely invalid. */ > + .sp0 = (1UL << (BITS_PER_LONG-1)) + 1, This confused me at first: How does this not poison the init task's stack? Should the comment maybe say something like: The hardware only uses .sp0 (or sp1 or sp2 for that matter) when doing ring transitions. Since the init task never runs anything other than ring 0, it has no need for a valid value here. Poison it. to clarify what's going on?