Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2898786pxa; Tue, 18 Aug 2020 00:30:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBaU+IeqY5hFNd7us7Xf3bvhBXVKqqxfTnhcEvUTXH1tGbiU30yA39kE0pq+2mTuBr+AFZ X-Received: by 2002:a17:906:6d54:: with SMTP id a20mr19707732ejt.501.1597735851576; Tue, 18 Aug 2020 00:30:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597735851; cv=none; d=google.com; s=arc-20160816; b=ugm6c5AK2oYaMQig0ZKjMZonhJUnRNOWTS44lxdJ/H0J9mg06MliWuEVNjQsTZHINZ KuBzwJRe9QyJOvKbu5807i2wavKaErqJJ6SByViIj1RRBo3Hk3vaaF+rs2kP2G//mbKV Nq97IqJ1wZ7XnV1ePfPDd0/TGPnqrthSqqoqBVGvLTDskhtnzOjuYUY/tjr3xOb1VeH+ D6pfQBnxYdJNr16S+L6WzUftjJRkVEhmgxoe3CF7dLmKy+M1Ewg+IH+imVB7PcrbtvXe OgN+uFKJvlBAcRJWpv3UvMsGwhAXzbSg4v9zTn31Qg9GOqbOetjbpPtaQnj4tweAAJzT PC6w== 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=dWTUC1fFQYcq9xj79KofFxMFTVMIj82URXFAR3kd498=; b=O6qjY4UUTBQUI+KSAsu7CYaBBpcQgMtxlaPiOEmebqN0Xd/Q/uHLEzv0hHR4s8DrDS VFR+eJKsfOrF0rgNDuD2c0jykRBYupqW5sczqM1N5LDHwSR1rgyWeeT1xfhv5WE/7SYS FCf767ZKvOIkqdEA2e8tzs5XMg6MAmgkZ0N8TjLy2oZVsHcHEdGlfFvw4CKwJNRcQVX8 Tfgh4SuiULKaOAFxzgQqentSLTs6dN9eY1ZZsgqFjH7ORYN1Y6V+XJd8D6Ky9GY2qJTL g4ADWR95k8hJjJfFP75qquIBnsXMrbMq+EnCVkwYFGStw75BqgPf0QjJDIFd8wCIREEs XdLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mebGcVMe; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd10si798669ejb.100.2020.08.18.00.30.27; Tue, 18 Aug 2020 00:30:51 -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=@kernel.org header.s=default header.b=mebGcVMe; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726535AbgHRH3x (ORCPT + 99 others); Tue, 18 Aug 2020 03:29:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:57052 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726203AbgHRH3w (ORCPT ); Tue, 18 Aug 2020 03:29:52 -0400 Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 86FC7208B3; Tue, 18 Aug 2020 07:29:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597735791; bh=dWTUC1fFQYcq9xj79KofFxMFTVMIj82URXFAR3kd498=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=mebGcVMemOIARqitXyHsXvB1+ymMhvaDQ2dhbGfkbf2zo9fxLpInApPYAKZqjHbQ8 wxZ3h2VTPF6CxlEa5dcZAnJyT5Tll3eynk2NFC5OuYypVx075W82G7bfmujqRWvZIY J2SrEWZ2+r6j5/YDP8iQfu7Eai61sCiVt1OzS92E= Received: by mail-ot1-f51.google.com with SMTP id q9so15527515oth.5; Tue, 18 Aug 2020 00:29:51 -0700 (PDT) X-Gm-Message-State: AOAM531Xm2+HmisYsLQ+SVKPdDuQumWOfJ6dexJdHv0FElfLLwKmKCBq wRf1oIaYT6MK5v0AFHgwha+Dt1UnWXVZb8YmIso= X-Received: by 2002:a9d:774d:: with SMTP id t13mr13589334otl.108.1597735790648; Tue, 18 Aug 2020 00:29:50 -0700 (PDT) MIME-Version: 1.0 References: <20200817220212.338670-1-ndesaulniers@google.com> <20200817220212.338670-2-ndesaulniers@google.com> <20200818072531.GC9254@kroah.com> In-Reply-To: <20200818072531.GC9254@kroah.com> From: Ard Biesheuvel Date: Tue, 18 Aug 2020 09:29:39 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/4] Makefile: add -fno-builtin-stpcpy To: Greg KH 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 , =?UTF-8?B?RMOhdmlkIEJvbHZhbnNrw70=?= , Eli Friedman , "# 3.4.x" , Sami Tolvanen 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 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?