Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2852361pxa; Mon, 17 Aug 2020 22:47:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7sMpKuonWo4hOgQAq79Cr5x+NGriNmrV6S/1jpWvrFV6Bn8qeNUhKcJMGY/JrC+jc17vX X-Received: by 2002:a50:d655:: with SMTP id c21mr17824739edj.49.1597729639380; Mon, 17 Aug 2020 22:47:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597729639; cv=none; d=google.com; s=arc-20160816; b=aVLxdEww8V6usrb42ZF157K1/HUoV791mQAIH2PWkaX1UQtLIWF1QynRYz54Jryl3C 0QLe93kEzOgnD6pa9fefSvJhyyImxtxGqkxqfCiIu7gZb0Q7LKgCQ1ILneWgg9dFVmTf X+HL5cHb2wGqX+h8CZJ2lgEFK6jmP7H8k3YcbzU+DkMbikFJXEk3e6PkOa3g1M3ytXOW 51gzfrZOW59Lqp1YzUmVCv1hYf3dpvB3+yrTshEbZGB12jkarPpWnoz3oliPKsb5ZWRV s4ediL1ad6gbqD0JjkbiBgxA2lqf0wZ8gfcmssRckGZO5Ko2vBOoMF2VYM7/eSsuRqPc 0IeQ== 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=QntzPrOLLfJzsd4iLjQzQgU+MiMIJO0uA0wns6X4c7E=; b=BIx1Bub1/ddv2A20JD5zjqPzcADwvMMIs69Pu4xFZKMCM5DU0Nuu/rsGrNR9wXOVT2 mwPGAML7ueQ50yk/vgLt/kNzFPh1uR4eup5NmzrjzKMYhWgfwwfCtfV/pzfzKAjlp1ud Qki1sD8TuJ7Q7nOLbiMBSD+kEoa8aka5els/pbaqq9C5N0tZuh81FqtUIM/VFSvcmYxe I3LgYYLqIAa0E3g0DDPNgYoGwO8pxc7UtOlp5obpGea0dCM3T3+RBub3277qt1BQSNo4 uR7qirqPurQuGHDMJey328NzSrqfoa1rKvXg7SajWXJCs4lWbl3/PBuVNCmRTbLVsSe9 d6SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=eL7dtsSM; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id do5si16003162ejc.612.2020.08.17.22.46.55; Mon, 17 Aug 2020 22:47:19 -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=@gmail.com header.s=20161025 header.b=eL7dtsSM; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726736AbgHRFod (ORCPT + 99 others); Tue, 18 Aug 2020 01:44:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726228AbgHRFod (ORCPT ); Tue, 18 Aug 2020 01:44:33 -0400 Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49683C061389; Mon, 17 Aug 2020 22:44:31 -0700 (PDT) Received: by mail-qk1-x744.google.com with SMTP id m7so17224575qki.12; Mon, 17 Aug 2020 22:44:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=QntzPrOLLfJzsd4iLjQzQgU+MiMIJO0uA0wns6X4c7E=; b=eL7dtsSMDWjrZxIuwHIPBo3xk60D7EtZRCBpQNsZqEUQOk0cIiE9DztISG54k/kQHj 7qhLA66zMTr/eGlkShLIvRH4WQdsVwY2purFz2BTUsc7246BAgb0ISXC/mu/LfdqPvqo JH2yYRUoufiZNiq6h5Pu/EKAlL8GLXqy4R69udndLq4gxu11Lb83xsuSEwDYyQW6zaUb o7RmoLz0mtB+yNAV++PqOQG5zJiwHFMrF7i+W0lN/OhWHE+cEFU7vaok04IP7gwOimTJ 92jldJojQt45UW27pUrLyyk6xjP5VyOiX9UgZEJoUk9r6EvUcgdWgnH4EYmM41U8TJTO uOQg== 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=QntzPrOLLfJzsd4iLjQzQgU+MiMIJO0uA0wns6X4c7E=; b=cAYQs9Lt3N93F/lWoP1s5Rt9fdBhtTnlwzplBOj1cHbicBTndcldhNRI7GYmG2KDPS Q+kFRr0DxHfT3k8AhPW8EZGT1lTeINPXklmu5si9dRUDbHV+kKvZeeqV/isqttUKuuNJ yMEqrteG9lWbm11AG+U48nDGeiOgQMsOC5U4M1iYGc26AxOtIp/TSy49tV9PyVeUhxak Z7NgRxW6M2Xash8C7YvSIH+z+6MfKhpt3LNcUjWjrbjHLBtvV1mOtxbVntpKNuADv3b4 kzjKlXblxqRphVHavCP7zIAT6WBLwqvYip4bpFdxUw2W+EwU1r/ZxinMPhOj4DsvXF2F PyoA== X-Gm-Message-State: AOAM533E5HE1SMBEFi+lMpUKxQQulzWTdUECBYgjt4fgKcnzEgLbxWP+ /Hns1IvtuWgLVnq+f1D/E2o= X-Received: by 2002:a37:61ce:: with SMTP id v197mr16077683qkb.44.1597729470594; Mon, 17 Aug 2020 22:44:30 -0700 (PDT) Received: from ubuntu-n2-xlarge-x86 ([2604:1380:45d1:2600::1]) by smtp.gmail.com with ESMTPSA id i20sm19279855qka.17.2020.08.17.22.44.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 22:44:29 -0700 (PDT) Date: Mon, 17 Aug 2020 22:44:28 -0700 From: Nathan Chancellor To: Nick Desaulniers Cc: Masahiro Yamada , Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Michal Marek , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Kees Cook , Tony Luck , Dmitry Vyukov , Michael Ellerman , Joe Perches , Joel Fernandes , Daniel Axtens , Arvind Sankar , Andy Shevchenko , Alexandru Ardelean , Yury Norov , x86@kernel.org, "H . Peter Anvin" , Ard Biesheuvel , "Paul E . McKenney" , Daniel Kiper , Bruce Ashfield , Marco Elver , Vamshi K Sthambamkadi , Andi Kleen , Linus Torvalds , =?iso-8859-1?Q?D=E1vid_Bolvansk=FD?= , Eli Friedman Subject: Re: [PATCH 2/4] Revert "lib/string.c: implement a basic bcmp" Message-ID: <20200818054428.GA2540870@ubuntu-n2-xlarge-x86> References: <20200817220212.338670-1-ndesaulniers@google.com> <20200817220212.338670-3-ndesaulniers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200817220212.338670-3-ndesaulniers@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 17, 2020 at 03:02:10PM -0700, Nick Desaulniers wrote: > This reverts commit 5f074f3e192f10c9fade898b9b3b8812e3d83342. > > Use `-fno-builtin-bcmp` instead. > > The issue with using `-fno-builtin-*` flags was that they were not > retained during an LTO link with LLVM. This was fixed in clang-11 by > https://reviews.llvm.org/D71193 > (0508c994f0b14144041f2cfd3ba9f9a80f03de08), which is also the minimum > supported version of clang for LTO. > > Signed-off-by: Nick Desaulniers > --- > Makefile | 1 + > include/linux/string.h | 3 --- > lib/string.c | 20 -------------------- > 3 files changed, 1 insertion(+), 23 deletions(-) > > diff --git a/Makefile b/Makefile > index 211a1b6f6478..722ff5864275 100644 > --- a/Makefile > +++ b/Makefile > @@ -964,6 +964,7 @@ endif > # to provide implementations of these routines, then prevent the compiler from > # emitting calls to what will be undefined symbols. > KBUILD_CFLAGS += -fno-builtin-stpcpy > +KBUILD_CFLAGS += -fno-builtin-bcmp I personally think that this hunk should be its own patch before this one then have this patch just be the revert, that way there is no regression across a bisect (if one were to ever occur) and so the revert is a straight 'git revert', rather than have something else mixed in that requires reading the actual changelog text. No objections if you disagree though. > # include additional Makefiles when needed > include-y := scripts/Makefile.extrawarn > diff --git a/include/linux/string.h b/include/linux/string.h > index b1f3894a0a3e..f3bdb74bc230 100644 > --- a/include/linux/string.h > +++ b/include/linux/string.h > @@ -155,9 +155,6 @@ extern void * memscan(void *,int,__kernel_size_t); > #ifndef __HAVE_ARCH_MEMCMP > extern int memcmp(const void *,const void *,__kernel_size_t); > #endif > -#ifndef __HAVE_ARCH_BCMP > -extern int bcmp(const void *,const void *,__kernel_size_t); > -#endif > #ifndef __HAVE_ARCH_MEMCHR > extern void * memchr(const void *,int,__kernel_size_t); > #endif > diff --git a/lib/string.c b/lib/string.c > index 6012c385fb31..69328b8353e1 100644 > --- a/lib/string.c > +++ b/lib/string.c > @@ -922,26 +922,6 @@ __visible int memcmp(const void *cs, const void *ct, size_t count) > EXPORT_SYMBOL(memcmp); > #endif > > -#ifndef __HAVE_ARCH_BCMP > -/** > - * bcmp - returns 0 if and only if the buffers have identical contents. > - * @a: pointer to first buffer. > - * @b: pointer to second buffer. > - * @len: size of buffers. > - * > - * The sign or magnitude of a non-zero return value has no particular > - * meaning, and architectures may implement their own more efficient bcmp(). So > - * while this particular implementation is a simple (tail) call to memcmp, do > - * not rely on anything but whether the return value is zero or non-zero. > - */ > -#undef bcmp > -int bcmp(const void *a, const void *b, size_t len) > -{ > - return memcmp(a, b, len); > -} > -EXPORT_SYMBOL(bcmp); > -#endif > - > #ifndef __HAVE_ARCH_MEMSCAN > /** > * memscan - Find a character in an area of memory. > -- > 2.28.0.220.ged08abb693-goog > Cheers, Nathan