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=-9.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable 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 B29E1C433E7 for ; Thu, 15 Oct 2020 01:20:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 53E2322257 for ; Thu, 15 Oct 2020 01:20:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="hr4N6hwj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388578AbgJOBUK (ORCPT ); Wed, 14 Oct 2020 21:20:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388007AbgJOBTi (ORCPT ); Wed, 14 Oct 2020 21:19:38 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2450AC05BD34 for ; Wed, 14 Oct 2020 15:50:31 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id y14so690552pfp.13 for ; Wed, 14 Oct 2020 15:50:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=3VrWtG2Nzyu2csFSOGvGre3/3hIZgGNscPNIfDNpl2k=; b=hr4N6hwj+08gozMcwrEdmSN1/DHjJ1wV/rjoECw8Rb2Lo+XQgEYgDpitXER6aen3HX eXkJa61f3G1/5SOO7jrmjCFOzgysn3m/odJ4K0c9h+p6mhA72fUnwN1sijYXM89+e5/y E6EY2141rat0DkfG+cb3u9htDo0fyWs7u+jCA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=3VrWtG2Nzyu2csFSOGvGre3/3hIZgGNscPNIfDNpl2k=; b=ht73ruXR+j9BiGfHBib7+UyDrLXhwi4P1iGbtvRnkc49mkcJlkJzhFUW6f4ps9FVQ4 oJ1hFL5ErlrUkAlHIedNjcNICWA6WT1+ibeS/FwiPLgKTAG0wv+oDecvjaMR+tCOQLL2 ImkYbDRcm/1X3t94gMhetq2yPLdvsRgLiLPrxAbRWDTYVbGZoQIHa2uHz6KjXAXT9u2z 9poq4//BTYkogda7u0rLPMMtNkVan2F1GNZ5G1VzD7/wMAF9r5l+9FaPmXxdu+hAfzcw C/B40u86HX394mZ2hdZMmURLeztzdnLnoZNcJoLvNfEDsqza22ivn0t+ehXzRtYZpQQk XZCg== X-Gm-Message-State: AOAM531G4ECWEDOOuRfhSl36j+yrPF0OqJ5ShLF2gxwHMnucKqdQGEK7 riIw1WSD6XK3QT7HTknn3C7CoQ== X-Google-Smtp-Source: ABdhPJy3mXoDsP85zSkY2lnijaDX4p6o9n8i+9WfyCkbfe3bfD5GCGw8G2jBei5i1UDoglc5TJDPQA== X-Received: by 2002:a62:1856:0:b029:155:1718:91a3 with SMTP id 83-20020a6218560000b0290155171891a3mr1359345pfy.66.1602715830672; Wed, 14 Oct 2020 15:50:30 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 143sm704359pfw.13.2020.10.14.15.50.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 15:50:29 -0700 (PDT) Date: Wed, 14 Oct 2020 15:50:28 -0700 From: Kees Cook To: Masahiro Yamada Cc: Sami Tolvanen , Steven Rostedt , Will Deacon , Peter Zijlstra , Greg Kroah-Hartman , "Paul E. McKenney" , Nick Desaulniers , clang-built-linux@googlegroups.com, kernel-hardening@lists.openwall.com, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH v6 14/25] kbuild: lto: remove duplicate dependencies from .mod files Message-ID: <202010141549.412F2BF0@keescook> References: <20201013003203.4168817-1-samitolvanen@google.com> <20201013003203.4168817-15-samitolvanen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201013003203.4168817-15-samitolvanen@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 12, 2020 at 05:31:52PM -0700, Sami Tolvanen wrote: > With LTO, llvm-nm prints out symbols for each archive member > separately, which results in a lot of duplicate dependencies in the > .mod file when CONFIG_TRIM_UNUSED_SYMS is enabled. When a module > consists of several compilation units, the output can exceed the > default xargs command size limit and split the dependency list to > multiple lines, which results in used symbols getting trimmed. > > This change removes duplicate dependencies, which will reduce the > probability of this happening and makes .mod files smaller and > easier to read. > > Signed-off-by: Sami Tolvanen > Reviewed-by: Kees Cook Hi Masahiro, This appears to be a general improvement as well. This looks like it can land without depending on the rest of the series. -Kees > --- > scripts/Makefile.build | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/Makefile.build b/scripts/Makefile.build > index ab0ddf4884fd..96d6c9e18901 100644 > --- a/scripts/Makefile.build > +++ b/scripts/Makefile.build > @@ -266,7 +266,7 @@ endef > > # List module undefined symbols (or empty line if not enabled) > ifdef CONFIG_TRIM_UNUSED_KSYMS > -cmd_undef_syms = $(NM) $< | sed -n 's/^ *U //p' | xargs echo > +cmd_undef_syms = $(NM) $< | sed -n 's/^ *U //p' | sort -u | xargs echo > else > cmd_undef_syms = echo > endif > -- > 2.28.0.1011.ga647a8990f-goog > -- Kees Cook 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=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 DC2FAC433E7 for ; Wed, 14 Oct 2020 22:51:48 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6B8DE2223F for ; Wed, 14 Oct 2020 22:51:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="xL3BSI7A"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="hr4N6hwj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6B8DE2223F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6tBCfmJeEUHI82kW7pSzmr12ScsRJYGMKfMS0JENpi0=; b=xL3BSI7AeD0BCSUGkUvq5n/RE 2KImD3/tr1IjGPjkifxoNtiNFMAyJTJoUyQzltRRyv44EbHhe8L5KUoPWugox2AS0QrwjfWHgNufh Ay3ENQ9nyFqy+nZhelT70rF3nFvGjKFjA6HXrWNEdOtccrA+S7Jlm0h8n3VsmSOZ8tjmESfVc+yS0 sQjVnqn8RiJJ4QMej6z4mTzM3jwB40WXEo9M5U8lIXK7pHTab0dgEyMAlSXW6cbWY6w2AsJjJelTG JX4HtU/LJozEFKqoa6YBoCSwoFzw5qTr8aGJ8M9+U1hl8ILhHmKpdwjoK51OU+MAyXT0S9OEDwmTy CgksajLnw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kSpbP-0004pP-Tt; Wed, 14 Oct 2020 22:50:35 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kSpbN-0004o5-2j for linux-arm-kernel@lists.infradead.org; Wed, 14 Oct 2020 22:50:33 +0000 Received: by mail-pg1-x542.google.com with SMTP id b23so584670pgb.3 for ; Wed, 14 Oct 2020 15:50:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=3VrWtG2Nzyu2csFSOGvGre3/3hIZgGNscPNIfDNpl2k=; b=hr4N6hwj+08gozMcwrEdmSN1/DHjJ1wV/rjoECw8Rb2Lo+XQgEYgDpitXER6aen3HX eXkJa61f3G1/5SOO7jrmjCFOzgysn3m/odJ4K0c9h+p6mhA72fUnwN1sijYXM89+e5/y E6EY2141rat0DkfG+cb3u9htDo0fyWs7u+jCA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=3VrWtG2Nzyu2csFSOGvGre3/3hIZgGNscPNIfDNpl2k=; b=ALUf0z9Guo30xpcj2m7j/vrKZMi5DIX67YvHVBY5SL8K+1gvBag3s5hFlN7YKTaSzz 0ZdM1ABSYQ9tOKXLf9ZZ0I2ZceVkIReZkMHvRmTgPIuBnxk7fkBLIyO8/92yA29K0Ju1 G+CtNPfZoxEmiZRy+S2++QvnvBwpKgxeILRrRGwKQkRHgV1CYJsQ8awxZWpbMFO/eAIM v+9iY1weMLOdOX/N80IJns9yRqHAt7RQOry6XrvFRuze6kJ5mO0wVqZTOB166nY+iQlw XFVF+3WPTS2ROXif3ciyqfPr2Bqzpmv2ZqU+E7atyuhRzTlzOpjbig7Qnf/rP6lUJ6fb 4Tcw== X-Gm-Message-State: AOAM531ds4/Oxm0wQmq90jcT906xSGu9830vrrXHYL+cWJpDU6tsvvxX S9BfNAlzNfMX1N51vqB+qmMjaw== X-Google-Smtp-Source: ABdhPJy3mXoDsP85zSkY2lnijaDX4p6o9n8i+9WfyCkbfe3bfD5GCGw8G2jBei5i1UDoglc5TJDPQA== X-Received: by 2002:a62:1856:0:b029:155:1718:91a3 with SMTP id 83-20020a6218560000b0290155171891a3mr1359345pfy.66.1602715830672; Wed, 14 Oct 2020 15:50:30 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 143sm704359pfw.13.2020.10.14.15.50.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 15:50:29 -0700 (PDT) Date: Wed, 14 Oct 2020 15:50:28 -0700 From: Kees Cook To: Masahiro Yamada Subject: Re: [PATCH v6 14/25] kbuild: lto: remove duplicate dependencies from .mod files Message-ID: <202010141549.412F2BF0@keescook> References: <20201013003203.4168817-1-samitolvanen@google.com> <20201013003203.4168817-15-samitolvanen@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201013003203.4168817-15-samitolvanen@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201014_185033_133011_57916B0D X-CRM114-Status: GOOD ( 23.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, x86@kernel.org, "Paul E. McKenney" , kernel-hardening@lists.openwall.com, Peter Zijlstra , Greg Kroah-Hartman , linux-kbuild@vger.kernel.org, Nick Desaulniers , linux-kernel@vger.kernel.org, Steven Rostedt , clang-built-linux@googlegroups.com, Sami Tolvanen , linux-pci@vger.kernel.org, Will Deacon , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Oct 12, 2020 at 05:31:52PM -0700, Sami Tolvanen wrote: > With LTO, llvm-nm prints out symbols for each archive member > separately, which results in a lot of duplicate dependencies in the > .mod file when CONFIG_TRIM_UNUSED_SYMS is enabled. When a module > consists of several compilation units, the output can exceed the > default xargs command size limit and split the dependency list to > multiple lines, which results in used symbols getting trimmed. > > This change removes duplicate dependencies, which will reduce the > probability of this happening and makes .mod files smaller and > easier to read. > > Signed-off-by: Sami Tolvanen > Reviewed-by: Kees Cook Hi Masahiro, This appears to be a general improvement as well. This looks like it can land without depending on the rest of the series. -Kees > --- > scripts/Makefile.build | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/Makefile.build b/scripts/Makefile.build > index ab0ddf4884fd..96d6c9e18901 100644 > --- a/scripts/Makefile.build > +++ b/scripts/Makefile.build > @@ -266,7 +266,7 @@ endef > > # List module undefined symbols (or empty line if not enabled) > ifdef CONFIG_TRIM_UNUSED_KSYMS > -cmd_undef_syms = $(NM) $< | sed -n 's/^ *U //p' | xargs echo > +cmd_undef_syms = $(NM) $< | sed -n 's/^ *U //p' | sort -u | xargs echo > else > cmd_undef_syms = echo > endif > -- > 2.28.0.1011.ga647a8990f-goog > -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel