On Thu, Aug 29, 2024 at 10:03:04AM +1000, Alistair Francis wrote:
On Thu, Aug 29, 2024 at 9:45 AM Deepak Gupta <de...@rivosinc.com> wrote:

On Thu, Aug 29, 2024 at 09:29:49AM +1000, Alistair Francis wrote:
>On Thu, Aug 29, 2024 at 3:49 AM Deepak Gupta <de...@rivosinc.com> wrote:
>>
>>          prot |= PAGE_WRITE;
>>      }
>> -    if (pte & PTE_X) {
>> +    if (rwx & PTE_X) {
>>          bool mxr = false;
>>
>>          /*
>> @@ -1160,7 +1177,7 @@ restart:
>>
>>      if (!((prot >> access_type) & 1)) {
>>          /* Access check failed */
>> -        return TRANSLATE_FAIL;
>> +        return sstack_page ? TRANSLATE_PMP_FAIL : TRANSLATE_FAIL;
>
>Why is it a PMP error if it's a shadow stack page?

A shadow stack page is readable by regular loads.
We are making sure of that in `case PTE_W` in above switch case.
But shadow stack page is not writeable via regular stores. And must raise
access fault. return code `TRANSLATE_PMP_FAIL` is translated to access fault
while raising fault.

Ah, ok. It's worth commenting that we are returning TRANSLATE_PMP_FAIL
as that will be translated to an access fault

Ack.


Alistair


>
>Alistair

Reply via email to