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=-4.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,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 99186C04E87 for ; Fri, 17 May 2019 03:38:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6786B20862 for ; Fri, 17 May 2019 03:38:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nifty.com header.i=@nifty.com header.b="2J8eWrbp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727788AbfEQDiq (ORCPT ); Thu, 16 May 2019 23:38:46 -0400 Received: from conssluserg-03.nifty.com ([210.131.2.82]:22897 "EHLO conssluserg-03.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726783AbfEQDip (ORCPT ); Thu, 16 May 2019 23:38:45 -0400 Received: from mail-ua1-f51.google.com (mail-ua1-f51.google.com [209.85.222.51]) (authenticated) by conssluserg-03.nifty.com with ESMTP id x4H3cN1D032721; Fri, 17 May 2019 12:38:23 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com x4H3cN1D032721 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1558064304; bh=srN3/L+Kx9Et/22233UjKG5aslu8L3GpgixAoCxQ5yM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=2J8eWrbpwFM7LwNHSWsazJJFrN5fl01HfReLlbmiilaQfPechGIKeZlsWTeya4CFM MZEanIsQXaJaHoOfn5k7faFhGNhcoR/l+dEB3Qw8+Bm1ZJO4QbL9ceOX+tLCqy90I9 Qmu+a8rVPNplx2tOmLANdrfvcWqigsbyZwkrWAFij3uGe4Vjpr8ZrFX+XxancqmhR2 +39LaUHIK3my8MBHGe+1J9aftycL/czcjV5Qa+aPIOJZZvm1s5DLzi2feDq3lx/Fmd u4W9VtunapeEo7/SD1blIryCl5O/O6shSzBgayIf4i9moqu20qBBUlptVvUMhYwC3z uf5iZ+0pVWFDw== X-Nifty-SrcIP: [209.85.222.51] Received: by mail-ua1-f51.google.com with SMTP id n7so2140654uap.12; Thu, 16 May 2019 20:38:23 -0700 (PDT) X-Gm-Message-State: APjAAAUkqtag2YS5RKdEfhMfOWWbZ6Z5o2cn+3hy1cFRWYn8J8EhHSec Rygm+h7KCxG5EdcjicbB8JBfvvIl4K2iU9BmxWQ= X-Google-Smtp-Source: APXvYqy+E3KgmeybTo+0K8ZSAolNzMC/m2XGEox38LXflIwOHcq9J7NMqQNWklD80zDReYHBoxwzEJczldJfvWFYxXw= X-Received: by 2002:ab0:3058:: with SMTP id x24mr23025836ual.95.1558064302467; Thu, 16 May 2019 20:38:22 -0700 (PDT) MIME-Version: 1.0 References: <20190515073818.22486-1-yamada.masahiro@socionext.com> <201905151130.87CDB73C0@keescook> In-Reply-To: <201905151130.87CDB73C0@keescook> From: Masahiro Yamada Date: Fri, 17 May 2019 12:37:46 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH] kbuild: check uniqueness of basename of modules To: Kees Cook Cc: Linux Kbuild mailing list , Andrew Morton , Sam Ravnborg , Arnd Bergmann , Greg KH , Jessica Yu , Lucas De Marchi , Linus Torvalds , Rusty Russell , Michal Marek , Linux Kernel Mailing List 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 Hi Kees, On Thu, May 16, 2019 at 3:31 AM Kees Cook wrote: > > On Thu, May 16, 2019 at 03:07:54AM +0900, Masahiro Yamada wrote: > > On Wed, May 15, 2019 at 4:40 PM Masahiro Yamada > > wrote: > > > > > $(Q)$(AWK) '!x[$$0]++' $^ > $(objtree)/modules.builtin > > > diff --git a/scripts/modules-check.sh b/scripts/modules-check.sh > > > new file mode 100755 > > > index 000000000000..944e68bd22b0 > > > --- /dev/null > > > +++ b/scripts/modules-check.sh > > > @@ -0,0 +1,18 @@ > > > +#!/bin/sh > > > +# SPDX-License-Identifier: GPL-2.0 > > > + > > > +# Warn if two or more modules have the same basename > > > +check_same_name_modules() > > > +{ > > > + same_name_modules=$(cat modules.order modules.builtin | \ > > > + xargs basename -a | sort | uniq -d) > > > > > > I noticed a bug here. > > > > > > allnoconfig + CONFIG_MODULES=y > > will create empty modules.order and modules.builtin. > > > > Then, 'basename -a' will emit the error messages > > since it receives zero arguments. > > You can skip running it by adding "-r" to xargs: > > -r, --no-run-if-empty > If the standard input does not contain any nonblanks, do not run > the command. Normally, the command is run once even if there is > no input. This option is a GNU extension. Good idea! I will use this in v2. Thanks. -- Best Regards Masahiro Yamada