Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp728667pxa; Wed, 19 Aug 2020 13:13:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5v5ErAPtlPSB4jloYCJbFvEdzrZNeer+WLY1CqLc59wY2UnxI+W7mXSVVZ2o3w6IFbIYZ X-Received: by 2002:a05:6402:33a:: with SMTP id q26mr27824695edw.8.1597867986572; Wed, 19 Aug 2020 13:13:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597867986; cv=none; d=google.com; s=arc-20160816; b=zzebIq0T6xZ5CVoZq5CBvq9609xBD/7qRDAuBqzIQASFjeYAVrP1cr88HV2iNSdwci AS2OfQSWE3MUKTHj6jNFsgEtt9A2/IS6HPmld/SWaMcLil7iStuiyXtrMGbcnlElqq0U RLB5yPITEs8+Q82DcP5Mufpo2Q9C7gSqW76aQfMPYIWis42QgtJIDMi1nP+14a6u+Z7r /q1o3GMlZL1n1HAEq3ZJDWfFT5CfJXN2phVWAhRjy9r4ihi1cn0GHnXRZUERELCu7BqY mTFEW2a2v3nNDZxvd5L6FTHrG+KAH1FwEFtRXwdWUWweDwLfS18F1OWs3JcvcFSYd7Ns ejsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ysEscVWILmvmykMxg8+0n31+wodeRoaMfoU6oDZTo84=; b=pPzXPZ35ix9DRSGCvn82JVbggaZy9KNBcRpqJL7eH+b/nf22VWvtQB00xJ0yvO8WlF rFfOovtdyMk5qUdbF7lsluSybRwLFJmsUAbA6d5n14nliUh+TEgHemvXdYMhom9b79FD QYzI7wNNhAZRwO0nr4LuawnTUbxsS80shYYtNxTaz0+hFe/RQuh9cWEPCJ3DOTlWauBD sUI9Y9jq3DZSkvZcr63nPffkyGtxsgaVdn4UHNWU1EUbL0RibDGJWFQ5brhSzPVjGz1V EgPnbRqQV7wmwR2eNnCHfeJlKM9xclfdb1fFbxecvaBQVrepG24MK+F00vL7ks73gUTf 0CFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=W0qzDu0d; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id du22si20440182ejc.24.2020.08.19.13.12.42; Wed, 19 Aug 2020 13:13:06 -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=@google.com header.s=20161025 header.b=W0qzDu0d; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727075AbgHSULd (ORCPT + 99 others); Wed, 19 Aug 2020 16:11:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725275AbgHSUL3 (ORCPT ); Wed, 19 Aug 2020 16:11:29 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8709EC061757 for ; Wed, 19 Aug 2020 13:11:29 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id h12so4603pgm.7 for ; Wed, 19 Aug 2020 13:11:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ysEscVWILmvmykMxg8+0n31+wodeRoaMfoU6oDZTo84=; b=W0qzDu0dz/vFLIgmwd1kjxLHoxU+UwI1bE9+a5gGd+09ufPzSS4iMaaJ+O1+MrnJgc 2ms7ld15axXbGMV4cveW2c13TbR98YkSq+qPYMrtJvudgciopq2AQu+mo9MNykDpBsLy cTCA7w3gv+vTyr9GoMzmF7vXnZ+QNO1kQaS6x8Oqt/tJL6o+wcQRhDcZv3TZ8EIpOMF2 MrqQACaFUfPnHEfC0vNTlCJUepNtOyEf4z99vf9/dUNx1HcJBNzpMZSSSx3IM/X/Pj+3 abAtZWj7BSlh/omOuXiBBmjiQnN7kgR1tg93rDtfc+pfQLx61XrLLnxwifrHUzsNmM0T Vz0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ysEscVWILmvmykMxg8+0n31+wodeRoaMfoU6oDZTo84=; b=BoRWITBiVZZaj9MSEYfYDuPUQcryLdT+uK0DvXPkVN+ODqAJE38rIsHkVqCJeLvdxB 8a51jmsbyeWNNzXD7/E6K6zS4wxErI2FjOGMHVD+NnIG4sCr6h+CL90PsC/FGB4JEsgv c+WG7M7GmTEpamOyTG4w5fq7uP9Op9NRmCokfA8EPW4zb7w+Ud2TiAwulgShU4EWMb0A 0MvRJkbKjtv7AzeS6pdE/AFnhovF9hxZY5MZFgqDOdyRTZRJEF3ltWrNPLXzK+Q6bKBt 294gcChsc1/tKmI0dC8vACHaBI+g2wk+HmvvLrhGSPFGxTmyWLvoeOCx3BWP6WY/CluI Pz1Q== X-Gm-Message-State: AOAM533WWN2XW3v3tZTq+wHJhukTfIXb3xudPL6cZeKprucyaEbzGul2 tu4wcH3Fj8EnEX3NAa3xLC6w0elMx4xGSwt2YyhdWQ== X-Received: by 2002:a05:6a00:14d0:: with SMTP id w16mr20101130pfu.39.1597867888865; Wed, 19 Aug 2020 13:11:28 -0700 (PDT) MIME-Version: 1.0 References: <20200819191654.1130563-1-ndesaulniers@google.com> <20200819191654.1130563-5-ndesaulniers@google.com> <20200819192932.GA58968@rani.riverdale.lan> In-Reply-To: <20200819192932.GA58968@rani.riverdale.lan> From: Nick Desaulniers Date: Wed, 19 Aug 2020 13:11:17 -0700 Message-ID: Subject: Re: [PATCH v2 4/5] x86/boot: use -fno-builtin-bcmp To: Arvind Sankar Cc: Masahiro Yamada , Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Michal Marek , Linux Kbuild mailing list , LKML , Kees Cook , Tony Luck , Dmitry Vyukov , Michael Ellerman , Joe Perches , Joel Fernandes , Daniel Axtens , Andy Shevchenko , Alexandru Ardelean , Yury Norov , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H . Peter Anvin" , Ard Biesheuvel , "Paul E . McKenney" , Daniel Kiper , Bruce Ashfield , Marco Elver , Vamshi K Sthambamkadi , Andi Kleen , Linus Torvalds , =?UTF-8?B?RMOhdmlkIEJvbHZhbnNrw70=?= , Eli Friedman Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 19, 2020 at 12:29 PM Arvind Sankar wrote: > > On Wed, Aug 19, 2020 at 12:16:53PM -0700, Nick Desaulniers wrote: > > We're reverting > > commit 5f074f3e192f ("lib/string.c: implement a basic bcmp") > > in favor of -fno-builtin-bcmp. Remove the additional definition here, > > too. > > > > arch/x86/purgatory/Makefile uses -ffreestanding, so there's no risk of > > this libcall optimization occurring for arch/x86/boot/purgatory.ro. > > > > arch/x86/boot/Makefile resets KBUILD_CFLAGS, so make sure to reset this > > flag that was set for the top level Makefile. > > > > Fixes: 4ce97317f41d ("x86/purgatory: Do not use __builtin_memcpy and __builtin_memset") > > Reviewed-by: Kees Cook > > Signed-off-by: Nick Desaulniers > > --- > > arch/x86/boot/Makefile | 1 + > > arch/x86/boot/string.c | 8 -------- > > 2 files changed, 1 insertion(+), 8 deletions(-) > > > > diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile > > index fe605205b4ce..ef7f15bfceab 100644 > > --- a/arch/x86/boot/Makefile > > +++ b/arch/x86/boot/Makefile > > @@ -70,6 +70,7 @@ KBUILD_CFLAGS := $(REALMODE_CFLAGS) -D_SETUP > > KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ > > KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=) > > KBUILD_CFLAGS += -fno-asynchronous-unwind-tables > > +KBUILD_CFLAGS += -fno-builtin-bcmp > > GCOV_PROFILE := n > > UBSAN_SANITIZE := n > > > > This should be unnecessary: KBUILD_CFLAGS in arch/x86/boot/Makefile is > set to REALMODE_CFLAGS (defined in arch/x86/Makefile), which includes > -ffreestanding. I triple checked by grepping the disassemblies of ./arch/x86/purgatory/purgatory.ro, arch/x86/purgatory/*.o, and arch/x86/boot/*.o for bcmp; should be fine to drop that hunk. Will wait a bit to see if there's other feedback, and whether folks are on board with the plan to merge the series proposed in the cover letter or not. -- Thanks, ~Nick Desaulniers