Re: [PATCH] kmod: don't load module unless req process has CAP_SYS_MODULE

David Miller
2017-05-15T13:48:29Z

From: Mahesh Bandewar (महेश बंडेवार) <maheshb@google.com>
Date: Sun, 14 May 2017 19:42:08 -0700

> Any module when loaded gets loaded system-wide as we can't allow
> module loading per-ns. To validate the behavior I was comparing it
> with insmod/modprobe, if that doesn't allow because of lack of this
> capability in default-ns, then this *indirect* method of loading
> module should not allow the same action and the behavior should be
> consistent. So with that logic if userspace asks for a random
> char-device if insmod/modprobe cannot load it, then this method should
> not load it either for the consistency, right?

A lot of us worry that the are decades of precedence for the current
behavior.

If the user asks for bridge statistics and the bridge module isn't
loaded, it does get loaded and they see the statistics.

Same goes for opening socket types of various protocols.

Things really can break if we stop doing this.