Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp82334ybh; Tue, 14 Jul 2020 18:38:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxo2kGuitENVDvx7rJzl9jqSs4xRNs4pzvzbEz6ZaNJwPWBBSnQpAIUd4r1XfKzNnLWA2FP X-Received: by 2002:a05:6402:2065:: with SMTP id bd5mr7053610edb.67.1594777112089; Tue, 14 Jul 2020 18:38:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594777112; cv=none; d=google.com; s=arc-20160816; b=jWfAk76/pHbPGeMMRY626ZGQZJk3WXS5DxCclYIgBzWE9P493lY8bW5bfajbdTR7mW ad9b3Vw0eZRnDdWIwGrGaMP+K6h8DbFNJDzntPN0xFElSZB/dmXt1h8vbdS0Wa5tviXJ xYp1unSisXU+cNl48q2B2CnXH1widy18SHmk8h6FJk54i2DmTXZTXgt9X/n1yBl3yVbv kc584lYBn9eKRP1MaSKEFiVcMYuBbl4/+OPN2yInwBUyXLGvXL56EJIaraSLU3KvMZeK jUCZaciWKLmiCSBBYI4aj9HAhsuaJfRZNVj9hYo0zaAabMtQJe4S53yadXW9yUyWUVA8 Pj3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=zz6sLV8XJxd0lbywoq+z85UDCAeRpW0uEyFQlztJWmw=; b=xZAH7KHbEuz9GexpDnlrOfU5K3olQ/utR8F6CK0AgQKj3GKAEor2x5W2Q9uqXjP3Ym e8FFzHQhXbIQXw4Vf8zrSvtvBCCu2WY/ZIes9cwoLoKhr5Q/iEfE+PVUl7UKku0tpvsf lKjD9wC8Q17PSW/6XSAmFoKEzV/jJLLi8t9b4weCg+AVU+Yo/4RAdp6NHU9NrTWvn4zL leWw7NE2nMIUDkWoW+4epowkbDAAH0wUVo5Rfh6f3mjceiGnfEALUPbDNhjMK5YcMqXU UV9Oe7MXqzDUv6gUWq4aGUs7wnixN5DMQYcQzpN+Edb5GefqE4GhMavpMdNEBMXDUtcf DU8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KjZxK4Aw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g15si295938edm.229.2020.07.14.18.38.07; Tue, 14 Jul 2020 18:38:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KjZxK4Aw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726736AbgGOBe3 (ORCPT + 99 others); Tue, 14 Jul 2020 21:34:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726356AbgGOBe2 (ORCPT ); Tue, 14 Jul 2020 21:34:28 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAC5FC061755 for ; Tue, 14 Jul 2020 18:34:26 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id o22so1055400pjw.2 for ; Tue, 14 Jul 2020 18:34:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=zz6sLV8XJxd0lbywoq+z85UDCAeRpW0uEyFQlztJWmw=; b=KjZxK4Awqpk1vfXGfBYtI692U7BsBujqOCkBI+QG+yLB2j4Qw3QvteuLd4a70rZ1/c yaDe72GoCa2XdEfwiQXcF8IrP6J+bX89NN+6MR8q9jktHJFEmwVxwDVVvmr+PfDGg7Xe FDl+SZBUCt2yGQdyLb8rU0QxX4PkdOaDCRikM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=zz6sLV8XJxd0lbywoq+z85UDCAeRpW0uEyFQlztJWmw=; b=tRPmmfaISsiZAqSOnUqU6hVDqh3UYOhk3UjahjJvnDKWuTi+mgJM5rsNtWBAcBJlmz z+ka3bgep6xAFX0pglYrcjsFZiNS8KeDCDlOVIv/wt9LiWZw0ENjqhkOb2O5w2EKn+hN Kp40K8/fhQi4GmY9uLh5a2BpIgjRCYjFPhlBd7hIcn39euUwtzzVoRHNV/xaoCDdYWdA 4AoRXmVblhonpWg6daHs6Z+RswiVWQtl09ZX7W03ALN3ePbZJ0vOawkSxhiyKHm/6TRn wToB20aQ964c7u/wBYgL9q8a8w4JccJ9L+GrZndVV8EWZZhyM0eL0gAu1jPiqdU1g4Wz UcvA== X-Gm-Message-State: AOAM533XEWmVtkYn8gtA7Ld8X9pbtwohqxvaZEsPyq5CNHcFDexYzS2i SEnSi1n2pt1/GxXE73Qnurn2KA== X-Received: by 2002:a17:90a:1f87:: with SMTP id x7mr7556364pja.101.1594776866202; Tue, 14 Jul 2020 18:34:26 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id b18sm276216pju.10.2020.07.14.18.34.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 18:34:25 -0700 (PDT) Date: Tue, 14 Jul 2020 18:34:24 -0700 From: Kees Cook To: Joerg Roedel Cc: x86@kernel.org, Joerg Roedel , hpa@zytor.com, Andy Lutomirski , Dave Hansen , Peter Zijlstra , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , David Rientjes , Cfir Cohen , Erdem Aktas , Masami Hiramatsu , Mike Stunes , Sean Christopherson , Martin Radev , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v4 34/75] x86/head/64: Build k/head64.c with -fno-stack-protector Message-ID: <202007141831.F3165F22@keescook> References: <20200714120917.11253-1-joro@8bytes.org> <20200714120917.11253-35-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200714120917.11253-35-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 14, 2020 at 02:08:36PM +0200, Joerg Roedel wrote: > From: Joerg Roedel > > The code inserted by the stack protector does not work in the early > boot environment because it uses the GS segment, at least with memory > encryption enabled. Make sure the early code is compiled without this > feature enabled. > > Signed-off-by: Joerg Roedel > --- > arch/x86/kernel/Makefile | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile > index e77261db2391..1b166b866059 100644 > --- a/arch/x86/kernel/Makefile > +++ b/arch/x86/kernel/Makefile > @@ -39,6 +39,10 @@ ifdef CONFIG_FRAME_POINTER > OBJECT_FILES_NON_STANDARD_ftrace_$(BITS).o := y > endif > > +# make sure head64.c is built without stack protector > +nostackp := $(call cc-option, -fno-stack-protector) > +CFLAGS_head64.o := $(nostackp) Recent refactoring[1] for stack protector suggests this should just unconditionally be: CFLAGS_head64.o += -fno-stack-protector But otherwise, yeah, this should be fine here -- it's all early init stuff. Reviewed-by: Kees Cook [1] https://lore.kernel.org/lkml/20200626185913.92890-1-masahiroy@kernel.org/ > + > # If instrumentation of this dir is enabled, boot hangs during first second. > # Probably could be more selective here, but note that files related to irqs, > # boot, dumpstack/stacktrace, etc are either non-interesting or can lead to > -- > 2.27.0 > -- Kees Cook