From: Matthias Maennich <maennich@google.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: kstewart@linuxfoundation.org, oneukum@suse.com,
linux-aspeed@lists.ozlabs.org,
Peter Zijlstra <peterz@infradead.org>,
Toru Komatsu <k0ma@utam0k.jp>,
Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
David Howells <dhowells@redhat.com>,
yamada.masahiro@socionext.com, Will Deacon <will@kernel.org>,
patches@opensource.cirrus.com,
Michael Ellerman <mpe@ellerman.id.au>,
hpa@zytor.com, joel@joelfernandes.org,
bcm-kernel-feedback-list@broadcom.com, sam@ravnborg.org,
cocci@systeme.lip6.fr, linux-arch@vger.kernel.org,
linux-samsung-soc@vger.kernel.org,
Benjamin Fair <benjaminfair@google.com>,
linux-scsi@vger.kernel.org, Nancy Yuen <yuenn@google.com>,
Fabio Estevam <festevam@gmail.com>,
openbmc@lists.ozlabs.org, x86@kernel.org,
lucas.de.marchi@gmail.com, usb-storage@lists.one-eyed-alien.net,
mingo@redhat.com, geert@linux-m68k.org,
NXP Linux Team <linux-imx@nxp.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Patrick Venture <venture@google.com>,
stern@rowland.harvard.edu, kernel-team@android.com,
Ingo Molnar <mingo@kernel.org>,
linux-rtc@vger.kernel.org,
Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>,
sspatil@google.com, linux-watchdog@vger.kernel.org,
arnd@arndb.de, linux-kbuild@vger.kernel.org,
Jani Nikula <jani.nikula@intel.com>,
linux-arm-msm@vger.kernel.org, pombredanne@nexb.com,
Dan Williams <dan.j.williams@intel.com>,
Julia Lawall <julia.lawall@lip6.fr>,
linux-m68k@lists.linux-m68k.org,
linux-mediatek@lists.infradead.org,
linux-rpi-kernel@lists.infradead.org,
linux-tegra@vger.kernel.org, linux-amlogic@lists.infradead.org,
tglx@linutronix.de, maco@android.com,
linux-arm-kernel@lists.infradead.org,
Adrian Reber <adrian@lisas.de>,
linux-hwmon@vger.kernel.org, michal.lkml@markovi.net,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Andrew Jeffery <andrew@aj.id.au>,
Alexey Gladkov <gladkov.alexey@gmail.com>,
linux-usb@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-kernel@vger.kernel.org, Nicolas Pitre <nico@fluxnic.net>,
Patrick Bellasi <patrick.bellasi@arm.com>,
Richard Guy Briggs <rgb@redhat.com>,
maco@google.com, Pengutronix Kernel Team <kernel@pengutronix.de>,
jeyu@kernel.org, Tejun Heo <tj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
"David S. Miller" <davem@davemloft.net>,
linux-modules@vger.kernel.org
Subject: Re: [PATCH v3 00/11] Symbol Namespaces
Date: Wed, 21 Aug 2019 15:03:41 +0100 [thread overview]
Message-ID: <20190821140341.GA126314@google.com> (raw)
In-Reply-To: <20190821133846.GC4890@kroah.com>
On Wed, 21 Aug, 06:38, Greg Kroah-Hartman wrote:
>On Wed, Aug 21, 2019 at 03:11:40PM +0200, Peter Zijlstra wrote:
>> On Wed, Aug 21, 2019 at 12:49:15PM +0100, Matthias Maennich wrote:
>> > As of Linux 5.3-rc5, there are 31205 [1] exported symbols in the kernel.
>> > That is a growth of roughly 1000 symbols since 4.17 (30206 [2]). There
>> > seems to be some consensus amongst kernel devs that the export surface
>> > is too large, and hard to reason about.
>> >
>> > Generally, these symbols fall in one of these categories:
>> > 1) Symbols actually meant for drivers
>> > 2) Symbols that are only exported because functionality is split over
>> > multiple modules, yet they really shouldn't be used by modules outside
>> > of their own subsystem
>> > 3) Symbols really only meant for in-tree use
>> >
>> > When module developers try to upstream their code, it regularly turns
>> > out that they are using exported symbols that they really shouldn't be
>> > using. This problem is even bigger for drivers that are currently
>> > out-of-tree, which may be using many symbols that they shouldn't be
>> > using, and that break when those symbols are removed or modified.
>> >
>> > This patch allows subsystem maintainers to partition their exported
>> > symbols into separate namespaces, and module authors to import such
>> > namespaces only when needed.
>> >
>> > This allows subsystem maintainers to more easily limit availability of
>> > these namespaced symbols to other parts of the kernel. It can also be
>> > used to partition the set of exported symbols for documentation
>> > purposes; for example, a set of symbols that is really only used for
>> > debugging could be in a "SUBSYSTEM_DEBUG" namespace.
>>
>> I'm missing how one can prohibit these random out of tree modules from
>> doing MODULE_IMPORT_NS().
>
>Nothing, but then they are explicitly being "bad" :)
>
As a side effect of this implementation (namespace imports via modinfo
tags), imports are very visible for (out-of-tree) modules, e.g.
$ modinfo drivers/usb/storage/ums-usbat.ko
filename: drivers/usb/storage/ums-usbat.ko
import_ns: USB_STORAGE
license: GPL
author: ...
...
>> That is; suppose I stick all the preempt_notifier symbols in a KVM
>> namespace, how do I enforce no out-of-tree modules ever do
>> MODULE_IMPORT_NS(KVM) and gain access?
>>
That is actually a feature worth following up: Restricting the
namespaces that can be imported by modules. I am afraid it is not part
of this series, but should not be too hard once agreed how such a list
will be defined.
>> (the above would basically break virtualbox, which I knows uses preempt
>> notifiers too, but I don't give a rats arse about that)
>
>It's a huge red flag for anyone reviewing the code that this module is
>doing something it probably really should not be doing at all. It will
>make reviewing code easier, this isn't there to try to "prevent bad
>actors" at all, sorry.
>
Cheers,
Matthias
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
prev parent reply other threads:[~2019-08-21 14:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190813121733.52480-1-maennich@google.com>
2019-08-21 11:49 ` [PATCH v3 00/11] Symbol Namespaces Matthias Maennich
2019-08-21 11:49 ` [PATCH v3 11/11] RFC: watchdog: export core symbols in WATCHDOG_CORE namespace Matthias Maennich
2019-08-21 12:39 ` Greg KH
2019-08-21 14:59 ` Guenter Roeck
2019-08-21 16:28 ` Matthias Maennich
2019-08-21 12:46 ` [PATCH v3 00/11] Symbol Namespaces Nicolas Pitre
2019-08-21 13:37 ` Greg KH
2019-08-21 20:48 ` Nicolas Pitre
2019-08-21 13:11 ` Peter Zijlstra
2019-08-21 13:38 ` Greg KH
2019-08-21 14:03 ` Matthias Maennich [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190821140341.GA126314@google.com \
--to=maennich@google.com \
--cc=adrian@lisas.de \
--cc=akpm@linux-foundation.org \
--cc=andrew@aj.id.au \
--cc=ard.biesheuvel@linaro.org \
--cc=arnd@arndb.de \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=benjaminfair@google.com \
--cc=cocci@systeme.lip6.fr \
--cc=dan.j.williams@intel.com \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=festevam@gmail.com \
--cc=geert@linux-m68k.org \
--cc=gladkov.alexey@gmail.com \
--cc=glebfm@altlinux.org \
--cc=gregkh@linuxfoundation.org \
--cc=hannes@cmpxchg.org \
--cc=hpa@zytor.com \
--cc=jani.nikula@intel.com \
--cc=jeyu@kernel.org \
--cc=joel@joelfernandes.org \
--cc=julia.lawall@lip6.fr \
--cc=k0ma@utam0k.jp \
--cc=kernel-team@android.com \
--cc=kernel@pengutronix.de \
--cc=kstewart@linuxfoundation.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-modules@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=linux-rtc@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux-tegra@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=lucas.de.marchi@gmail.com \
--cc=maco@android.com \
--cc=maco@google.com \
--cc=mchehab+samsung@kernel.org \
--cc=michal.lkml@markovi.net \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=nico@fluxnic.net \
--cc=nicolas.ferre@microchip.com \
--cc=oneukum@suse.com \
--cc=openbmc@lists.ozlabs.org \
--cc=patches@opensource.cirrus.com \
--cc=patrick.bellasi@arm.com \
--cc=peterz@infradead.org \
--cc=pombredanne@nexb.com \
--cc=rgb@redhat.com \
--cc=sam@ravnborg.org \
--cc=sspatil@google.com \
--cc=stern@rowland.harvard.edu \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
--cc=usb-storage@lists.one-eyed-alien.net \
--cc=venture@google.com \
--cc=will@kernel.org \
--cc=x86@kernel.org \
--cc=yamada.masahiro@socionext.com \
--cc=yuenn@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox