Re: [PATCH V32 01/27] Add the ability to lock down access to the running kernel image

From: James Morris
Date: Thu May 02 2019 - 17:07:47 EST

On Mon, 29 Apr 2019, Matthew Garrett wrote:

> Hi James,
> What's the best way forward with this? I'm still not entirely clear on
> how it can be implemented purely as an LSM, but if you have ideas on
> what sort of implementation you'd prefer I'm happy to work on that.

It can't be implemented purely as an LSM.

The concerns I have are:

o Mixing of mechanism and policy (they are hardcoded together)
o Too-coarse policy (all or nothing, which will lead many to choose
o Lack of integration with LSM
o Completeness
o Maintenance (including adding new lockdowns without breaking existing

One possible direction is to (as previously mentioned) assign IDs to each
callsite and be able to check this ID against a simple policy array
(allow/deny). The default policy choices could be reduced to 'all' or
'none' during kconfig, and allow a custom policy to be loaded later if

Within the policy check hook, we could add a new LSM hook, which would
allow an LSM to restrictively override the lockdown policy with its own
(so e.g. SELinux could utilize the context of the current process to
determine if a lockdown feature should be enforced).

This doesn't really address the completeness / maintenance issue (i.e. "do
we have everything covered and how do we ensure this on an ongoing
basis?", and "what will this new lockdown feature break?"), although it
should make it easier to add new lockdown callsites as they don't have to
be enabled by the user.


James Morris