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 95740C433DF for ; Tue, 18 Aug 2020 07:25:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6639620786 for ; Tue, 18 Aug 2020 07:25:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597735511; bh=N2APiQQepxSYCzop4Qp1o77O54Y1HK1//Wr9CEjh4fI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=aeTzT1Sr2P7Nzew9Qp4l3Iom46OMlYAkYi0x38ss5AkgZQ9EkZoQ/RfS+Z4jFhCVk AU1hGTQyd+eqh6hN2RdeunF0amjNruc3QL/rKCqqd2ic3hRf7Elt7QAHApPUB3M89h 5G1rw/rn709atqdI85BSkeHuhYtkgo8MbQ2b3bL4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726519AbgHRHZJ (ORCPT ); Tue, 18 Aug 2020 03:25:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:52576 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726370AbgHRHZI (ORCPT ); Tue, 18 Aug 2020 03:25:08 -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 2C541205CB; Tue, 18 Aug 2020 07:25:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597735507; bh=N2APiQQepxSYCzop4Qp1o77O54Y1HK1//Wr9CEjh4fI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ULGeP8jyfskRDwys6jK46JZVSeX56BII0NNgpCECczBC+KpvIXPogM4Q1HVJvnADo 5VJmaLBVinajow8/gOPXYUYoWqwOFTjugqSa6fvNspRq57ArW7izT0hMBa8h9/oTks 9tKe1cHeVM/V49yQNG2ZlweKwPAq5Xr04bK10aFs= Date: Tue, 18 Aug 2020 09:25:31 +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: <20200818072531.GC9254@kroah.com> References: <20200817220212.338670-1-ndesaulniers@google.com> <20200817220212.338670-2-ndesaulniers@google.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: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? thanks, greg k-h