Re: [PATCH v2 3/5] x86/mm: check exec permissions on fault

From: Dave Hansen
Date: Mon Oct 25 2021 - 10:23:56 EST


On 10/25/21 3:59 AM, Peter Zijlstra wrote:
>> Add a check to prevent access_error() from returning mistakenly that
>> page-faults due to instruction fetch are not allowed. Intel SDM does not
>> indicate whether "instruction fetch" and "write" in the hardware error
>> code are mutual exclusive, so check both before returning whether the
>> access is allowed.
> Dave, can we get that clarified? It seems a bit naf and leads to
> confusing code IMO.

We can, but there are quite a few implicit relationships in those bits.
PF_INSN and PF_PK can't ever be set together, for instance. It's
pretty clear as long as you have fetch==read in your head.