Re: [PATCH v10 11/27] ima: Move ima_lsm_policy_notifier into ima_namespace

Mimi Zohar
2022-02-17T21:24:38Z

On Thu, 2022-02-17 at 15:59 -0500, Stefan Berger wrote:
> >
> >> Move the ima_lsm_policy_notifier into the ima_namespace. Each IMA
> >> namespace can now register its own LSM policy change notifier callback.
> >> The policy change notifier for the init_ima_ns still remains in init_ima()
> >> and therefore handle the registration of the callback for all other
> >> namespaces in init_ima_namespace().
> >>
> >> Suppress the kernel warning 'rule for LSM is undefined` for all
> >> other IMA namespaces than the init_ima_ns.
> > Instead of ignoring the warnings totally, perhaps use either the
> > "ratelimited" or "once" function options for non init_ima_ns. It would
> > be nice if these functions could be namespace aware, so that each
> > affected IMA namespace would contain at least one warning.
>
> The problem is that any user can now repeatedly create user namespaces
> and with that IMA namespaces and cause the kernel log to fill up with
> these messages and also flood the audit log -- I guess one could
> describe it as an unwanted side-effect. I am afraid that for as long as
> the kernel log is not namespaced it's probably best to just turn them
> off for non-init_ima_ns.

There are functions - pr_warn_once() or pr_warn_ratelimited() - that
limit the number of kernel messages. In addition to the number of
potential kernel messages, there's also the issue of being able to
differentiate between init_ima_ns and other IMA namespaces. I think
that is more of a concern than rate limiting.

--
thanks,

Mimi