Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7304967rwi; Mon, 24 Oct 2022 12:40:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5kTRMBdnIaiXejCK/aCVfOuvKqYfwsReNUomYtJZqS37hU7AnA5QDHuRAQoiB5VD4J52V0 X-Received: by 2002:a05:6402:11ce:b0:45c:a2a2:4207 with SMTP id j14-20020a05640211ce00b0045ca2a24207mr31976332edw.3.1666640410655; Mon, 24 Oct 2022 12:40:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640410; cv=none; d=google.com; s=arc-20160816; b=wvrV/bxm95f484avCmSmtNg8y/7XDIVU3ZK56NXPG1Q3WehtR82GkMC/Cj6j3fS5Xn fGIhVOQBr1l+XCLmNRd9TpVoqrcGAUpfnkUYBa6R1sDLwXdDvIYSkAgtoxsS/MnWUnG2 DEpU+dr0yeHPUOjlhEO0BziTxePURsvBeXhYyU2p9vNj1uPIZHemfoIDWRoaVyZATu/u Jsfa8pTPJ950qYvMplERvp3yk7z/JYRF4L+xns0SICGjWkVKglXG8zXHTj+v4LL6/2Ox EKCy60fL3sz4puHtZ1CK5EurKGALsEFNzFTF/am+NTfWprJN/zu/Y61Y3VGmzYp1jwVg 6jWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=GDEbqRU8sq/kF2yRisiLgzU2HDxDOJoWb1vd6nz9uGU=; b=T7+cuPhgCGgJjioUr3k2WJM0ZSpphG/4mLW0XIRTQgUNGmrsitH6IE6ta3cd8WV61y BPlem1Ap+UbUBtftfPLfra7xdX/vWVez72wpTRFHhxj99/VAEP9RSuiYPEAUp53DtwX+ N7G1fE9/9HCM+C5fq+CX754oSHRGNo+YuKej5rbeNDbC1ce5WiMWW3n7yzwdQ4WJn0EB IDxpjXTW/eIFHttIcmNNInuMfZnDA6XeURLWce0nrUl79Tr4MdoNEro+UOZzo4MFwvCs oA1tHjMHGwtgE5pvvmc9OwDcY+2qS3c9jwR1wK8gWkITNL7fTIXd2j/iIKADDGNr5MFG JnCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="HnE1HY/l"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y20-20020a1709060a9400b0079ca59305a6si523452ejf.354.2022.10.24.12.39.45; Mon, 24 Oct 2022 12:40:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="HnE1HY/l"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229833AbiJXTDC (ORCPT + 99 others); Mon, 24 Oct 2022 15:03:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232252AbiJXTCl (ORCPT ); Mon, 24 Oct 2022 15:02:41 -0400 Received: from mail-oa1-x36.google.com (mail-oa1-x36.google.com [IPv6:2001:4860:4864:20::36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BCC33AE42 for ; Mon, 24 Oct 2022 10:41:50 -0700 (PDT) Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-13ae8117023so12671117fac.9 for ; Mon, 24 Oct 2022 10:41:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=GDEbqRU8sq/kF2yRisiLgzU2HDxDOJoWb1vd6nz9uGU=; b=HnE1HY/lybPVFDB3zY/UJbK9AFVb+TSrUcgGvtOeU6QkvpRGeROW6dXTcNAUBtN+0l hyLL+Sxv44XqoB8Y3JQfHrkdy9RJKCOukBkjNycRA+DXPZKbEIEXMTPx1qX9l+OP1Iln Ci9XvTon4wufg6WV5poCy+kcBC4Jq9mWMkp/w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=GDEbqRU8sq/kF2yRisiLgzU2HDxDOJoWb1vd6nz9uGU=; b=KF1btakuk5iy05IC4Lu85YX27igQKqiiD5BLIgpLyy3+2GwknQ89dzaiL5bnzBRYMY pa6NPSgcdVEWa2x2ygZg2DM2BQ63jHU0fiNmHnlwaoOl2qnc7XP/fZ/PcS5RhoNhio0W QxOiXOfjUSU3ccDBo+WHWW9Eg3BdTmjw4Y+VXXbzQ4qR6L7Bkx1ZTFyseg9UP8kAB28a o/OvMw3fbl1cF29A4wrPD4toslxKrS7+D5u011IzmfPFu5OYwOX+7yVuLzu0iW7svuLR RYNghMnne/s+MEjvGDaf4EUhCcNNgou3LY/Dm++BjYciGHkk76dRNw0S/9E2IRMBOl3A FMtA== X-Gm-Message-State: ACrzQf1cnTWFMpuXfIeKXRR+C6W7GL1qbcBjtFCQF61O41VUAASTV6lP DOUnOBx/o7h0YdPWAzQ0ZfX99gxYxmBdWw== X-Received: by 2002:a17:90b:38d1:b0:20d:8f2a:c4c4 with SMTP id nn17-20020a17090b38d100b0020d8f2ac4c4mr73462283pjb.192.1666632780418; Mon, 24 Oct 2022 10:33:00 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id a65-20020a624d44000000b00540f96b7936sm87029pfb.30.2022.10.24.10.32.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 10:32:59 -0700 (PDT) Date: Mon, 24 Oct 2022 10:32:58 -0700 From: Kees Cook To: Nathan Chancellor Cc: Xin Li , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-kbuild@vger.kernel.org, x86@kernel.org, andrew.cooper3@citrix.com, hpa@zytor.com, peterz@infradead.org Subject: Re: [PATCH 1/1] kbuild: upgrade the orphan section warning to an error if CONFIG_WERROR is set Message-ID: <202210241031.4BB6E70FB@keescook> References: <20221022030519.9505-1-xin3.li@intel.com> <20221022030519.9505-2-xin3.li@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 24, 2022 at 10:29:55AM -0700, Nathan Chancellor wrote: > On Fri, Oct 21, 2022 at 08:05:19PM -0700, Xin Li wrote: > > Andrew Cooper suggested upgrading the orphan section warning to a hard link > > error. However Nathan Chancellor said outright turning the warning into an > > error with no escape hatch might be too aggressive, as we have had these > > warnings triggered by new compiler generated sections, and suggested turning > > orphan sections into an error only if CONFIG_WERROR is set. Kees Cook echoed > > and emphasized that the mandate from Linus is that we should avoid breaking > > builds. It wrecks bisection, it causes problems across compiler versions, etc. > > > > Thus upgrade the orphan section warning to a hard link error only if > > CONFIG_WERROR is set. > > > > Suggested-by: Andrew Cooper > > Suggested-by: Nathan Chancellor > > Signed-off-by: Xin Li > > Thanks for the patch! > > Reviewed-by: Nathan Chancellor > Tested-by: Nathan Chancellor > > We could deduplicate the '$(if $(CONFIG_WERROR),error,warn)' logic if we > hoisted it into Kconfig by having something like > > config LD_ORPHAN_WARN_LEVEL > string > depends on LD_ORPHAN_WARN > default "error" if WERROR > default "warn" > > in init/Kconfig then using it everywhere like > > --orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL) > > but I will let others decide if they would prefer that over the > direction we went here. I think this makes it look cleaner, yeah. -- Kees Cook