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=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 75CCEC433DF for ; Tue, 18 Aug 2020 07:33:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3814B20786 for ; Tue, 18 Aug 2020 07:33:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597736027; bh=+l8ZIHYYdE8RD9Qj/I64++AlJvGHPOqSiV3mJ2HpmNQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=iQG3eumx+7CCevlhyEJHwmrIgv/M2cplT3pX+NcPf9/sMqyOwhhXrSfDA0ov8wK4D liJ8JXKulwtG9SMS8BJBQHobqYOpgvO2TTciBMd0LrJ/fzKn7eFNcJawLsJKSNWxRE HVSdvv4OFvdCmK11TV/qvoZNWAERwPuGbgRp/XL0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726593AbgHRHdp (ORCPT ); Tue, 18 Aug 2020 03:33:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:59130 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726401AbgHRHdp (ORCPT ); Tue, 18 Aug 2020 03:33:45 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 00D2B206B5; Tue, 18 Aug 2020 07:33:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597736024; bh=+l8ZIHYYdE8RD9Qj/I64++AlJvGHPOqSiV3mJ2HpmNQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=adtLg8XGFdMJbAYwQ+USeWVHO6NJasnpN07UEjD5SyBJk/l55Cyn+jXV7Zsbuyfsf 9swaGL4dFOyfw4m8JELBW45/YfY66lEL1n7z1a8qWfDnRwyNp8SVu/X/LOUKv+5Qnw kZSl+rMuFLYRfnbJywcZ11LdpXjqXbOoyo0hqsmA= Date: Tue, 18 Aug 2020 09:34:08 +0200 From: Greg KH To: Ard Biesheuvel Cc: Nick Desaulniers , Masahiro Yamada , Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Michal Marek , linux-kbuild@vger.kernel.org, Linux Kernel Mailing List , Kees Cook , Tony Luck , Dmitry Vyukov , Michael Ellerman , Joe Perches , Joel Fernandes , Daniel Axtens , Arvind Sankar , Andy Shevchenko , Alexandru Ardelean , Yury Norov , X86 ML , "H . Peter Anvin" , "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 , "# 3.4.x" , Sami Tolvanen Subject: Re: [PATCH 1/4] Makefile: add -fno-builtin-stpcpy Message-ID: <20200818073408.GA12514@kroah.com> References: <20200817220212.338670-1-ndesaulniers@google.com> <20200817220212.338670-2-ndesaulniers@google.com> <20200818072531.GC9254@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 18, 2020 at 09:29:39AM +0200, Ard Biesheuvel wrote: > On Tue, 18 Aug 2020 at 09:25, Greg KH wrote: > > > > On Tue, Aug 18, 2020 at 09:10:01AM +0200, Ard Biesheuvel wrote: > > > On Tue, 18 Aug 2020 at 00:02, Nick Desaulniers wrote: > > > > > > > > LLVM implemented a recent "libcall optimization" that lowers calls to > > > > `sprintf(dest, "%s", str)` where the return value is used to > > > > `stpcpy(dest, str) - dest`. This generally avoids the machinery involved > > > > in parsing format strings. This optimization was introduced into > > > > clang-12. Because the kernel does not provide an implementation of > > > > stpcpy, we observe linkage failures for almost all targets when building > > > > with ToT clang. > > > > > > > > The interface is unsafe as it does not perform any bounds checking. > > > > Disable this "libcall optimization" via `-fno-builtin-stpcpy`. > > > > > > > > Unlike > > > > commit 5f074f3e192f ("lib/string.c: implement a basic bcmp") > > > > which cited failures with `-fno-builtin-*` flags being retained in LLVM > > > > LTO, that bug seems to have been fixed by > > > > https://reviews.llvm.org/D71193, so the above sha can now be reverted in > > > > favor of `-fno-builtin-bcmp`. > > > > > > > > Cc: stable@vger.kernel.org # 4.4 > > > > > > Why does a fix for Clang-12 have to be backported all the way to v4.4? > > > How does that meet the requirements for stable patches? > > > > Because people like to build older kernels with new compliler versions. > > > > And those "people" include me, who doesn't want to keep around old > > compilers just because my distro moved to the latest one... > > > > We've been doing this for the past 4+ years, for new versions of gcc, > > keeping 4.4.y building properly with the bleeding edge of that compiler, > > why is clang any different here? > > > > Fair enough. I am just struggling to match stable-kernel-rules.rst > with the actual practices - perhaps it is time to update that > document? The rules are tiny and simple for 99% of the issues involved. Stuff like "add patches to fix build failures and warnings for newer compiler versions" are so rare (they only happen every 2 years or so), it's not worth it. thanks, greg k-h