[PATCH] selftests: powerpc: Add test for execute-disabled pkeys
Michael Ellerman
mpe at ellerman.id.au
Wed May 27 10:17:22 AEST 2020
Sandipan Das <sandipan at linux.ibm.com> writes:
> Hi Michael,
>
> On 26/05/20 6:05 pm, Michael Ellerman wrote:
>> [...]
>>> +
>>> +/* Override definitions as they might be inconsistent */
>>> +#undef PKEY_DISABLE_ACCESS
>>> +#define PKEY_DISABLE_ACCESS 0x3
>>
>> Why would they be inconsistent?
>>
>
> The definition in sys/mman.h still uses the value specific to
> Intel's implementation i.e. 1, when this should have been 3
> for powerpc. I have seen this on Ubuntu 18.04 and 20.04.
Hmm OK, that's a bug but oh well nothing we can do about it.
>> I think a reasonable solution is to use the absence of SEGV_PKUERR to
>> basically turn the whole test into a nop at build time, eg:
...
>
> Or can I use this from the pkey tests under selftests/vm?
>
> static inline u32 *siginfo_get_pkey_ptr(siginfo_t *si)
> {
> #ifdef si_pkey
> return &si->si_pkey;
> #else
> return (u32 *)(((u8 *)si) + si_pkey_offset);
> #endif
> }
>
> Where si_pkey_offset is 0x20 for powerpc.
Yeah that's fine if it works. Please send a v2 with that change.
cheers
More information about the Linuxppc-dev
mailing list