Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp3987862pxb; Tue, 7 Sep 2021 11:59:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfWrsyvTFOtQ3IP0XC1UJPpW4HI+sErpWeKlsfGtkp+Cnk/viyMwXYV869U+VjIZhUDM53 X-Received: by 2002:a17:906:4fd6:: with SMTP id i22mr20204800ejw.92.1631041151787; Tue, 07 Sep 2021 11:59:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631041151; cv=none; d=google.com; s=arc-20160816; b=G5Zt6D6SkTg3IX6XxDQoKZnG+qGVgOEYnWFsPOLocb6BJplcolS+ZxLKXu4jZJiYmH Z6iNzll9mXaQZXhdAls4NtMkriffD6P29nSaBw9aDyr4n1HMeKurj8d1Q4jEGFoECg3a vXmiOppZ5/T0CDkJiBp4ZueG+07D0Yixc5rVtDSvnIfzMLOKX/xNTGz3JSNJJlNiEZZz PGzgv1jruWtPkGnevMZR2ktK89d4uGLD6N1qY46KGfnJ/ODMjaZSz7GAqBx+BCym8Mzo 3tve5XduqwgSwKLesip0PC9kRlqlTqDqN6rN0I9gbsKfn2pElNM0CZ6Riu+pvhsxjcww 9sKQ== 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:from:subject :mime-version:message-id:date:dkim-signature; bh=301LxysQcBJybm7Zr97WzyGah9Mc2jXduBLK47CHcWo=; b=fEIR4Qc9JeTPB7Nv0kPT0OPJyHaXjPkPf3YwmRkoPNydnkFRCHam1LP54pDkynNrWT JqjgHBVcMxJVDw7lutSz4BeptHnzchNGhkGiSVfRU358iYypH3z4yFt2Oh4K+g0p1vAk dIo9ZD+FlsNEJAiGk63rWj10/U0hbo+4GVSfGW6YFH+lT9dTDft2NdM3oSnwh2uw4Jw3 V8X5cY+We/Lc7pLra10+CSewIPUM/M8rQr7TDd+Xsy2FYhXkYz9p1c28ydsPLnik5IEG tXUXqqpEodzzjC0aqe+Z8PcGH5jJJuDYOtu0Txn58Hj0dzAF+hIxwfzMRrYnpi9YxJTN Kgdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=RcR05aOO; 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 m7si3108589edq.520.2021.09.07.11.58.42; Tue, 07 Sep 2021 11:59:11 -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=RcR05aOO; 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 S1345979AbhIGSkK (ORCPT + 99 others); Tue, 7 Sep 2021 14:40:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345980AbhIGSkJ (ORCPT ); Tue, 7 Sep 2021 14:40:09 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ECFAC0613C1 for ; Tue, 7 Sep 2021 11:39:02 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 63-20020a250d42000000b0059dc43162c9so180095ybn.23 for ; Tue, 07 Sep 2021 11:39:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc :content-transfer-encoding; bh=301LxysQcBJybm7Zr97WzyGah9Mc2jXduBLK47CHcWo=; b=RcR05aOOHxdnTig8jgiJJEPJhTOos2LGSimPmkVE/3L47H13fID1nKMh/mI2poArf4 ro9K1CMQ9tBTrhMVg04sQqsAQXxHSokaBagbXWKwzc43mqPe1ObOnPQaBFrnm1zcm1WB jF0JT1E2Ev4t8GJ/4vO6CSGJZckEbrtG8YM2DvUZpicvuvNtTO6ZD15+RKwCxXI/iTXE sU5CznyUlSOjOydJu7yXa0dKPNzsVve6lEoRLpFgTAgm2jck/EZLtM1ZWEIa9nLJQJFG Uyxl/nDiQ9GXQBJXP24uwLxbfeHUuPRICLxic57w9JeBMhQVOnWq9DpBjlat3qxslGir 6sIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc :content-transfer-encoding; bh=301LxysQcBJybm7Zr97WzyGah9Mc2jXduBLK47CHcWo=; b=C+Xh310VO4PQIHSBynvxpUfHdpKVQx1INr+znzOLVYHzP4ntDNW1B5H0pN709Xii+l oyf+kaXC7sagfqA6acK1J358IUKTXCnY6/fSB+X18qbwFENu5Xc2jkNeJw6yvd34lo2E Xi5FVYTBUPLVVJMqwGFxvapUq/B0ICusImfx9PBeL05UK71a/cJxKoQfmk/PjRPmEobs +zRyPwLwW2YQMUAUcZFnIOJWIIL2flFWoPXGw0TkW4g6UeZFuEv1OpNcylNnbJjNPMG7 bUt2mbtpxNf2idkMvUqT19ZAGOnIgckVlelzDMAHHGLoS2mYQNRvYGdvNeXp98QMGbsm SWfg== X-Gm-Message-State: AOAM532RKUz7XpPhhY42nfqHcG75+6t4yKCo/mg+742eMZSCjr7Rxduv JEmRq7ryLLVkjR/2MrR7ds19QEk+IXEvMtzQi70= X-Received: from ndesaulniers1.mtv.corp.google.com ([2620:15c:211:202:329a:8c54:7706:34e2]) (user=ndesaulniers job=sendgmr) by 2002:a25:b941:: with SMTP id s1mr24246390ybm.304.1631039941767; Tue, 07 Sep 2021 11:39:01 -0700 (PDT) Date: Tue, 7 Sep 2021 11:38:40 -0700 Message-Id: <20210907183843.33028-1-ndesaulniers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.33.0.153.gba50c8fa24-goog Subject: [PATCH] Revert "Enable '-Werror' by default for all kernel builds" From: Nick Desaulniers To: Linus Torvalds Cc: llvm@lists.linux.dev, linux-security-module@vger.kernel.org, linux-toolchains@vger.kernel.org, Nick Desaulniers , 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 This reverts commit 3fe617ccafd6f5bb33c2391d6f4eeb41c1fd0151. The above commit seems as though it was merged in response to https://lore.kernel.org/linux-hardening/CAHk-=3Dwj4EG=3DkCOaqyPEq5VXa97kyUH= sBpBn3DWwE91qcnDytOQ@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'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 double 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 =20 KBUILD_CFLAGS +=3D $(stackp-flags-y) =20 -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 accept= able. 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 useless drivers to be distributed. =20 -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 --=20 2.33.0.153.gba50c8fa24-goog