Re: [kernel-hardening] Re: [PATCH v5 next 5/5] net: modules: use request_module_cap() to load 'netdev-%s' modules

From: Kees Cook
Date: Tue Nov 28 2017 - 19:26:47 EST


On Tue, Nov 28, 2017 at 4:17 PM, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> But at the same time, if people can't even be bothered to try to
> improve the general case, and only do things that you have to opt in
> for, it really isn't much of an improvement. We had this whole

Right, and I'm fine to help with those general improvements. As I
mentioned in another reply, we've been steadily narrowing the
exposures by keeping request_module() from being exposed to "all
possible modules" in many of the places it's been exposed to
userspace:

7f78e0351394 ("fs: Limit sys_mount to only request filesystem modules.")
5d26a105b5a7 ("crypto: prefix module autoloading with "crypto-"")
4943ba16bbc2 ("crypto: include crypto- module prefix in template")

I don't want you to think this is an area where work hasn't already
been done to try to improve things.

> The model that I am a proponent of is to take a softer approach
> initially: don't forbid module loading (because that breaks users),
> but instead _warn_ about non-root module loading. And then we can
> start fixing the cases that we find.

I am totally fine with this. The question I'm hoping to have answered
is, "then what?" We already have concrete examples of module
autoloading that will still be need to stay unprivileged and as-is in
the kernel (even if we remove others). What do you see as the way to
allow an admin to turn those off?

-Kees

--
Kees Cook
Pixel Security