Re: [PATCH V8 18/44] x86/fault: Add a PKS test fault hook

Ira Weiny
2022-02-11T20:40:32Z

On Mon, Jan 31, 2022 at 11:56:57AM -0800, Edgecombe, Rick P wrote:
> On Thu, 2022-01-27 at 09:54 -0800, ira.weiny@intel.com wrote:
> > + * If a protection key exception occurs it could be
> > because a PKS test
> > + * is running. If so, pks_test_callback() will clear
> > the protection
> > + * mechanism and return true to indicate the fault
> > was handled.
> > + */
> > + if (pks_test_callback())
> > + return;
>
> Why do we need both this and pks_handle_key_fault()?

I debated this. And I convinced myself that it was worth the extra code.

For this series, when testing pks_handle_key_fault() this may get called if
something goes wrong. And when the test code is not configured it is a no-op.
So I don't see any harm in keeping this as a general handler.

I mentioned this when adding pks_handle_key_fault().[1] I could make a note of
it in this patch if that would help.

Ira

[1] https://lore.kernel.org/lkml/20220127175505.851391-30-ira.weiny@intel.com/