Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp777438ybl; Wed, 14 Aug 2019 05:56:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwdzSVdO24BmpJ5emLtYYpIhmv0VNE5dW6rXSr7zRO6VBF4h+PsQtKsLEIwVR0RGWZKV7K X-Received: by 2002:a62:7912:: with SMTP id u18mr24785516pfc.254.1565787374075; Wed, 14 Aug 2019 05:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565787374; cv=none; d=google.com; s=arc-20160816; b=E1IPl5FPZJUxWTPGkI0poIe0nMRMoIxK533oiA7aX1jslxANNcaVW4w/K3Vmlkj9sM cUww42054tddk+N/0WDH+75e+f1BSOQ/ztUMrWkuP7N4sIwSGvp4JZJKnL9nNvp7C6Nj +Oen86YDOXi/SIjkyQmAY53Yny1zwHhISGmGTxT24HxXxp7L1/EFzkGxZMpPcY4eSHBB WMDYnGNBiHGRlevNBO1YQow/d61cE+KKv+obuNG01wo/PzTnizNKYxtq78MiCRb6ifZw vyloYzp3PovJ7Sm3ItMbYdOIYy3E/vv0xbEdjFWG0wttg5eLLgzRxa8l09v4TSLlhRYJ 2HyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/HqwVHo+/VGU/O3Ao2yHcSMYTRRkF5dGkjofFJ4lQDI=; b=N+GVM5u4WrWVbOHFFeKSkaI3fNEZp+MfATYqoHS5/LujqlZsX9NFowl7KNy8HofRUy Vv+iRWgyMaZWP53tFuFjt/AgJnQsp9LhPVxR3YCOgmGCQnNr1H2AknjBZAi1Ea+mEKGE 6XxOFBbeFjD4IzXObP7YkFXL5e6U7265szaR+SKnwBilk7kIbQLD0Zv3R2VjBnpXDO7u cuZy4RT0aAgNM5qYETw+4+bqlO5AwmamhWXxzwsBPkIa3fJaFIGdz2dL7xyyts2JHrWW i4EwYX4PJ/RBb8jbMioXQL5AygFYRZ2np5+k8xy3mRY0/x+jy8/fNpH6YITp+ZiFRkad CaSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=a214pvbW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id e10si33323169pgt.431.2019.08.14.05.55.57; Wed, 14 Aug 2019 05:56:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=a214pvbW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728128AbfHNMyg (ORCPT + 99 others); Wed, 14 Aug 2019 08:54:36 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:37008 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727993AbfHNMyf (ORCPT ); Wed, 14 Aug 2019 08:54:35 -0400 Received: by mail-wr1-f66.google.com with SMTP id z11so9056985wrt.4 for ; Wed, 14 Aug 2019 05:54:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=/HqwVHo+/VGU/O3Ao2yHcSMYTRRkF5dGkjofFJ4lQDI=; b=a214pvbWsUYqE7gFah0NDcz7JM2UYBy76uQcdIF2EkF002SXmrJWUGewBWbFk/2SA+ YUtGYjT48o6iTu5GykHi2ODU4FThxYcbsQdQc0xdD7uHoB8yf+oispewNpo8rzLPOUio S67e2fNzvfOzCGAN9Y6qxipWccwRr5vHIR8ykTNcwP3KsJhc3d9k17Tds78XuI66px6+ D8rNX2s/Jnk2pVrAQoCAj5Am5Y/TyHPkOKoTomK0JdBDMU0ioLWBdoNAlfKE3cTYNcsP rKem4Pk+x1q2rKdqQ87as+E/PkdUnfo7GDTHbDBG7fkMACdUIM/tx9rjyww93IMEH/TV 8lGw== 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:user-agent; bh=/HqwVHo+/VGU/O3Ao2yHcSMYTRRkF5dGkjofFJ4lQDI=; b=rIhzRmxZb37nAnX2/60fwRZVqi3rNA1hXeQbjIhPIUNRFAHGdZeyaNVJepSsnliQ4+ 5YQ2V2b75slvYuwoYdTeU2hGbQsDcvUxyrO8oq35vp78LFG4RJLZVEXzXtXwOpmunrlY mJcquhCdd+GPqos2S3u2rRvsLFJT/MC2HDBs93a0oemIRkuKLAZYydpYuxOvTlLc6Fua yO34hoSz+/fPQP/olcXAOSHfuOW7t65mjs2NziAIx7Ytg+/tb1s81+xm8u45geJFjazK qIcqRBXpg6HmAG8RItx7h33OCmX8uc3ABdvmRs1OTFXxu9UcUlUJARZnGNcRPeeNUbNi DGZg== X-Gm-Message-State: APjAAAUQwehRTS3EYtRLqm0ga+eN7TQvzX7c2Nz3f5LIWWqkyAte0XZc hPh6hfSSSHZ3B0owjCwed77H+g== X-Received: by 2002:adf:d1b4:: with SMTP id w20mr46171829wrc.301.1565787272814; Wed, 14 Aug 2019 05:54:32 -0700 (PDT) Received: from google.com ([2a00:79e0:d:210:e8f7:125b:61e9:733d]) by smtp.gmail.com with ESMTPSA id n9sm163817113wrp.54.2019.08.14.05.54.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2019 05:54:32 -0700 (PDT) Date: Wed, 14 Aug 2019 13:54:27 +0100 From: Matthias Maennich To: Saravana Kannan Cc: LKML , maco@android.com, Android Kernel Team , arnd@arndb.de, geert@linux-m68k.org, Greg Kroah-Hartman , hpa@zytor.com, jeyu@kernel.org, "Joel Fernandes (Google)" , kstewart@linuxfoundation.org, linux-arch@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-modules@vger.kernel.org, linux-scsi@vger.kernel.org, linux-usb@vger.kernel.org, lucas.de.marchi@gmail.com, maco@google.com, michal.lkml@markovi.net, mingo@redhat.com, oneukum@suse.com, pombredanne@nexb.com, sam@ravnborg.org, Sandeep Patil , stern@rowland.harvard.edu, tglx@linutronix.de, usb-storage@lists.one-eyed-alien.net, x86@kernel.org, yamada.masahiro@socionext.com, Andrew Morton , Johannes Weiner , "Peter Zijlstra (Intel)" , Mauro Carvalho Chehab , David Howells , Patrick Bellasi , Dan Williams , Adrian Reber , Richard Guy Briggs Subject: Re: [PATCH v2 05/10] module: add config option MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS Message-ID: <20190814125427.GA72826@google.com> References: <20180716122125.175792-1-maco@android.com> <20190813121733.52480-1-maennich@google.com> <20190813121733.52480-6-maennich@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 13, 2019 at 01:15:44PM -0700, Saravana Kannan wrote: >On Tue, Aug 13, 2019 at 5:19 AM 'Matthias Maennich' via kernel-team > wrote: >> >> If MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS is enabled (default=n), the >> requirement for modules to import all namespaces that are used by >> the module is relaxed. >> >> Enabling this option effectively allows (invalid) modules to be loaded >> while only a warning is emitted. >> >> Disabling this option keeps the enforcement at module loading time and >> loading is denied if the module's imports are not satisfactory. >> >> Reviewed-by: Martijn Coenen >> Signed-off-by: Matthias Maennich >> --- >> init/Kconfig | 14 ++++++++++++++ >> kernel/module.c | 11 +++++++++-- >> 2 files changed, 23 insertions(+), 2 deletions(-) >> >> diff --git a/init/Kconfig b/init/Kconfig >> index bd7d650d4a99..b3373334cdf1 100644 >> --- a/init/Kconfig >> +++ b/init/Kconfig >> @@ -2119,6 +2119,20 @@ config MODULE_COMPRESS_XZ >> >> endchoice >> >> +config MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS >> + bool "Allow loading of modules with missing namespace imports" >> + default n >> + help >> + Symbols exported with EXPORT_SYMBOL_NS*() are considered exported in >> + a namespace. A module that makes use of a symbol exported with such a >> + namespace is required to import the namespace via MODULE_IMPORT_NS(). >> + This option relaxes this requirement when loading a module. > >> While >> + technically there is no reason to enforce correct namespace imports, >> + it creates consistency between symbols defining namespaces and users >> + importing namespaces they make use of. > >I'm confused by this sentence. It sounds like it's the opposite of >what the config is doing? Can you please reword it for clarify? How about: Symbols exported with EXPORT_SYMBOL_NS*() are considered exported in a namespace. A module that makes use of a symbol exported with such a namespace is required to import the namespace via MODULE_IMPORT_NS(). There is no technical reason to enforce correct namespace imports, but it creates consistency between symbols defining namespaces and users importing namespaces they make use of. This option relaxes this requirement and lifts the enforcement when loading a module. -- Cheers, Matthias