Re: [PATCH 2/3] libnvdimm/security: Tighten scope of nvdimm->busy vs security operations

From: Dan Williams
Date: Fri Aug 16 2019 - 17:02:33 EST

On Fri, Aug 16, 2019 at 1:49 PM Jeff Moyer <jmoyer@xxxxxxxxxx> wrote:
> Dan Williams <dan.j.williams@xxxxxxxxx> writes:
> > The blanket blocking of all security operations while the DIMM is in
> > active use in a region is too restrictive. The only security operations
> > that need to be aware of the ->busy state are those that mutate the
> > state of data, i.e. erase and overwrite.
> >
> > Refactor the ->busy checks to be applied at the entry common entry point
> > in __security_store() rather than each of the helper routines.
> I'm not sure this buys you much. Did you test this on actual hardware
> to make sure your assumptions are correct? I guess the worst case is we
> get an "invalid security state" error back from the firmware....
> Still, what's the motivation for this?

The motivation was when I went to test setting the frozen state and
found that it complained about the DIMM being active. There's nothing
wrong with freezing security while the DIMM is mapped. ...but then I
somehow managed to write this generalized commit message that left out
the explicit failure I was worried about. Yes, moved too fast, but the
motivation is "allow freeze while active" and centralize the ->busy
check so it's just one function to review that common constraint.