Re: [PATCH v11 25/25] x86/cet/shstk: Add arch_prctl functions for shadow stack

Yu, Yu-cheng
2020-08-25T21:04:05Z

On 8/25/2020 12:19 PM, Dave Hansen wrote:
> On 8/25/20 11:43 AM, Yu, Yu-cheng wrote:
>>>> arch_prctl(ARCH_X86_CET_MMAP_SHSTK, u64 *args)
>>>>      Allocate a new shadow stack.
>>>>
>>>>      The parameter 'args' is a pointer to a user buffer.
>>>>
>>>>      *args = desired size
>>>>      *(args + 1) = MAP_32BIT or MAP_POPULATE
>>>>
>>>>      On returning, *args is the allocated shadow stack address.
>>>
>>> This is hideous.  Would this be better as a new syscall?
>>
>> Could you point out why this is hideous, so that I can modify the
>> arch_prctl?
>
> Passing values in memory is hideous when we don't have to. A syscall
> would let you have separate arguments for size and flags and would also
> let you have a nice return value instead of needing to do that in memory
> too.

That is a good justification.

>
>> I think this is more arch-specific.  Even if it becomes a new syscall,
>> we still need to pass the same parameters.
>
> Right, but without the copying in and out of memory.
>
Linux-api is already on the Cc list. Do we need to add more people to
get some agreements for the syscall?