Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp4006569pxb; Tue, 7 Sep 2021 12:26:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypn4924BSmv0KAXpFW6DfLZdcIfHmL2zJPS5VoTfK5K+PW5gnd4rfW0UIMwsAbwZ3GRz0N X-Received: by 2002:a92:c56e:: with SMTP id b14mr13188938ilj.6.1631042769731; Tue, 07 Sep 2021 12:26:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631042769; cv=none; d=google.com; s=arc-20160816; b=eWGkLwr0ghikGT+jNOHw8ZQqtjTHaJcwugJNEnfxwgzlh1eLDE35iAYwQ318QR2Onm 6cXm+9tdKqLbI9e89dXKbWBwu7hk29tuk6+Q4/n7GB4Y1JzRi5VeulDtOEcTJ++GWNuE uTnbsLjbs6U3Xpl28dKwdmKoj6gmoGkgJf7uVLDti8fgSLGiTzfU8a9mrl+YGccju2pQ KgMn/JMIiSZdFfa6UjgqGuyc+uZHmEkIDT432lFPGa08OTPzxK2rXCaepySzUtMGI5V9 +UK+WOm3XjiLpzD/5HgX1U0XlcyMnYVs1VzixfqoP+/Aj3+kyF2RHXcshMfxaEsGzji2 ZLig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=i2AA8IYk7sWif5BHJvP2n9h67eD95Nlj2o/omSM1etA=; b=DVJVf6qa7bbiViHqCfr2hr3pQ2DT8jcwF4tKsmb1Aidb2bXzdxSDmSSa2DuE6/7jJq 5OCKdre0z8/skEJv7DKAeOQ0UmJNETPcE7fhp6LDxQRypBnnhCOr34ATrtXXE6yqPLJm z3Gu2N6z6JecNIWR9dEnVEaO8t9ZySTlJ3aChvbqjmEaIkTktfAs+E/NgzYi7gPP9SeV 9QdfcErvPkXjgt/dorFDIU1l4p1jJgLvcz3vZskYm+ARW5EraFALYgFCN9wHBXm5s/hk R1voAZ/GAudzCBq39ZNMbC0rZa32A2hG3z/eAPU5MKWiaNzDgzXbDUkdDytI4XvToiP5 ZOAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ofXwwCmM; 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 l3si10927691ioq.2.2021.09.07.12.25.58; Tue, 07 Sep 2021 12:26:09 -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=20210112 header.b=ofXwwCmM; 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 S240131AbhIGS4w (ORCPT + 99 others); Tue, 7 Sep 2021 14:56:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235343AbhIGS4v (ORCPT ); Tue, 7 Sep 2021 14:56:51 -0400 Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50B26C06175F for ; Tue, 7 Sep 2021 11:55:45 -0700 (PDT) Received: by mail-yb1-xb2e.google.com with SMTP id c206so415975ybb.12 for ; Tue, 07 Sep 2021 11:55:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=i2AA8IYk7sWif5BHJvP2n9h67eD95Nlj2o/omSM1etA=; b=ofXwwCmMxAb+RfZSyGPBtR293F5k2kTWAF/Y8cL9HguLjwcO2nMnY3UHBYcnh/Z7Sc 5sLfzPVm7FSU63bFRGf17/HSOtZfRvu9ydZr9hSplNLOSA/dXGKyf4BDjyyO/55tNHQJ UYuQUaq4rtD06pJup2V0skki4uxEHdDXPk03Ia0imkepTIIKdv6HtAc4qs6BmQbiUkmS H1iz8119rok2ScFCqERvLpTsvno3Sn5G74A4IDJxjAm4jnMyIkyba3oqfSjSaxv0INzC Iiyh4xUOqvW1o8zQdtBE+DtTjLqBgfSZz++ttzLzghFIXgKm9p7oR4u6d03vOqzHAefT y8CQ== 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:content-transfer-encoding; bh=i2AA8IYk7sWif5BHJvP2n9h67eD95Nlj2o/omSM1etA=; b=h9Mq6Rl5Jj7ycv2XIoTWhblsJD77rKMFTUNylngbV4lG13nahkoaE8eoB3AqVh3FsE i+JH7LkPJ9SMabIWuI2twQzVLRmX94Uk0xMQAmuXlR8Ow88ePSgz28stSNHMGduH67u/ 3UucoVXHi4STJ/5Kew4iB3t5SW3bw0mGwZNszOeQ2dj6ntFNJd8yiJEJvv11rM7hPbdt RahO7TChWKzebjq46K5pij+QmQ9xO6CwLwitC+V7CmkbE0A7hDm37WISMdPtKNk0qef1 4GiIpIxWQQ9VnjbbunA5aj9G90JszQNKm7b6RH3RMCvI/saITCb+Nc1EjwSPxeo66FqS a7Vg== X-Gm-Message-State: AOAM533TyWD8ImpmOGCP6RhfTYz8EeNd4D5d9QUKFVUvXh184Zjxkvon +N3mc+Xu9beQV+htTjQ2QZunYW3uGng/5JLCCgn19Q== X-Received: by 2002:a25:bdc6:: with SMTP id g6mr24252084ybk.310.1631040944203; Tue, 07 Sep 2021 11:55:44 -0700 (PDT) MIME-Version: 1.0 References: <20210907183843.33028-1-ndesaulniers@google.com> In-Reply-To: <20210907183843.33028-1-ndesaulniers@google.com> From: =?UTF-8?B?RsSBbmctcnXDrCBTw7JuZw==?= Date: Tue, 7 Sep 2021 11:55:32 -0700 Message-ID: Subject: Re: [PATCH] Revert "Enable '-Werror' by default for all kernel builds" To: Nick Desaulniers Cc: Linus Torvalds , llvm@lists.linux.dev, linux-security-module@vger.kernel.org, linux-toolchains@vger.kernel.org, Arnd Bergmann , Greg Kroah-Hartman , Guenter Roeck , Kees Cook , Mark Brown , Masahiro Yamada , Nathan Chancellor , Michal Marek , Andrew Morton , Vipin Sharma , Chris Down , Rasmus Villemoes , Daniel Borkmann , Vlastimil Babka , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 7, 2021 at 11:39 AM Nick Desaulniers wrote: > > This reverts commit 3fe617ccafd6f5bb33c2391d6f4eeb41c1fd0151. > > The above commit seems as though it was merged in response to > https://lore.kernel.org/linux-hardening/CAHk-=3Dwj4EG=3DkCOaqyPEq5VXa97ky= UHsBpBn3DWwE91qcnDytOQ@mail.gmail.com/. > > While I can appreciate the intent of enabling -Werror, I don't think it > is the right tool to address the root cause of developers not testing > certain toolchains or configurations, or taking existing reports they're > getting serious enough. > > Having more appropriate CI or processes in place to prevent untested > patches from being merged into mainline may also be worth discussing. I agree that -Werror by default needs more discussion. Default WERROR makes building old kernels with new compilers more painful. CI systems could do a better job surfacing compiler warnings if they don't do it currently. > I'd also like to see such a patch sent formally to the list for > discussion and have time to soak in next rather than be merged directly > into mainline without either. > > -Werror is great for preventing new errors from creeping in when a > codebase is free of warnings for all configs and all targets and the > toolchain is never updated. Unfortunately, none of the above is the case > for the Linux kernel at this time. > > The addition of new compiler diagnostic flags in the -W group to -Wall > make toolchain updates excessively more painful. This can lead to > commits that disable warnings rather than work towards addressing them. > Some diagnostics are useful but take incredible work or churn to > completely free a codebase from them. > > Warning can be upgraded to errors with -Werror=3Dfoo or downgraded from > errors back to warnings via -Wno-error=3Dfoo. -Wno-error=3Dfoo is a doubl= e > edged sword; it doesn't help you spot the introduction of additional > instances of that warning easily. > > This change has caused nearly all of our CI to go red, and requires us > to now disable CONFIG_WERROR until every last target and every last > config is addressed. Rather than require everyone to disable the above > config to keep builds going, perhaps certain CI systems should instead > set CFLAGS_KERNEL=3D-Werror. > > Why don't we just fix every warning? We have been, for years, and we're > still not done yet. See our issue tracker below, contributors wanted. > > With more time/active discussion, we can probably land something more > appropriate. It should involve the Kbuild maintainer and list. > > For instance, I have questions around how should such a config interact > with randconfigs and allconfigs. This config also seems to duplicate the > existing CONFIG_PPC_DISABLE_WERROR without merging the two. > > I do recognize the irony of someone who's spent a lot of time cleaning > up warnings to be advocating for disabling -Werror...it's not lost on > me. Our Pixel (n=C3=A9e Nexus) team has been effectively carrying an out = of > tree patch enabling -Werror since before I ever contributed to the > kernel. > > Cc: Arnd Bergmann > Cc: Greg Kroah-Hartman > Cc: Guenter Roeck > Cc: Kees Cook > Cc: Mark Brown > Cc: Masahiro Yamada > Cc: Nathan Chancellor > Link: https://github.com/ClangBuiltLinux/linux/issues/1449 > Signed-off-by: Nick Desaulniers > --- > Makefile | 3 --- > init/Kconfig | 14 -------------- > 2 files changed, 17 deletions(-) > > diff --git a/Makefile b/Makefile > index d45fc2edf186..6bc1c5b17a62 100644 > --- a/Makefile > +++ b/Makefile > @@ -785,9 +785,6 @@ stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG) := =3D -fstack-protector-strong > > KBUILD_CFLAGS +=3D $(stackp-flags-y) > > -KBUILD_CFLAGS-$(CONFIG_WERROR) +=3D -Werror > -KBUILD_CFLAGS +=3D $(KBUILD_CFLAGS-y) > - > ifdef CONFIG_CC_IS_CLANG > KBUILD_CPPFLAGS +=3D -Qunused-arguments > # The kernel builds with '-std=3Dgnu89' so use of GNU extensions is acce= ptable. > diff --git a/init/Kconfig b/init/Kconfig > index 8cb97f141b70..e708180e9a59 100644 > --- a/init/Kconfig > +++ b/init/Kconfig > @@ -137,20 +137,6 @@ config COMPILE_TEST > here. If you are a user/distributor, say N here to exclude usel= ess > drivers to be distributed. > > -config WERROR > - bool "Compile the kernel with warnings as errors" > - default y > - help > - A kernel build should not cause any compiler warnings, and this > - enables the '-Werror' flag to enforce that rule by default. > - > - However, if you have a new (or very old) compiler with odd and > - unusual warnings, or you have some architecture with problems, > - you may need to disable this config option in order to > - successfully build the kernel. > - > - If in doubt, say Y. > - > config UAPI_HEADER_TEST > bool "Compile test UAPI headers" > depends on HEADERS_INSTALL && CC_CAN_LINK > > base-commit: 4b93c544e90e2b28326182d31ee008eb80e02074 > -- > 2.33.0.153.gba50c8fa24-goog > --=20 =E5=AE=8B=E6=96=B9=E7=9D=BF