From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 116EDC433E1 for ; Wed, 15 Jul 2020 01:34:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DE20E2074B for ; Wed, 15 Jul 2020 01:34:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="KjZxK4Aw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726609AbgGOBe2 (ORCPT ); Tue, 14 Jul 2020 21:34:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726356AbgGOBe1 (ORCPT ); Tue, 14 Jul 2020 21:34:27 -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 E16CCC061794 for ; Tue, 14 Jul 2020 18:34:26 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id k5so1052138pjg.3 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=k2K1FmXS6KXX7eAf5dJ4PgKgw5gXmOxb8vkviMcHLiqqqB4p8CtgE2ATJrcXMhxh6H WJCeCxqp84/V1HzL5v6RUyaLZpYoVyUUB/oQKqjaXvCps3/s79xd6nX0+HkR3V+pSljP scQCS8wHJRI0qSMXmVBQm0OB9Xl1mTQOPYdBH8MDXzl1SlRcDQpmUentA19A+Z/qFNSX Xe0E4MZzAM7116stEuNzYGrqCQUSGyyj1x3QOaiOP+EmWy9GLG+BzucoS6CBrQLf0Pw3 IM31H9HDe4qZ9FiWA0xLXcIAQN/ARZxBq/zR020on0XgI0NtE1WSCNCBJE1bKFBJtLL+ OfxQ== X-Gm-Message-State: AOAM531zqFRPHh5xL9TGgobgqC3La6QvbO67+kL8Z2QPgi8GGefYedqu ml+47q92fO76N6lI+k8e0OH6mA== X-Google-Smtp-Source: ABdhPJyNqRvX4HpWN93/opBS43GZlWTdZSRq6ybyZkwfnv39UPGj+ErGvx/2WaJfYSwsGuR1sTBmcw== 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: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@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