Re: [PATCH 33/35] selftests/x86: Add map_shadow_stack syscall test
From: Edgecombe, Rick P
Date: Thu Feb 03 2022 - 20:23:00 EST
On Thu, 2022-02-03 at 14:42 -0800, Dave Hansen wrote:
> This is a good start for the selftest. But, it would be really nice
> to
> see a few additional smoke tests in here that are independent of the
> library support.
Sure. I had actually included this just because the "adding a syscall"
docs said to make sure to include a test for the syscall. There are
some other tests that were being planned as a follow up.
>
> For instance, it would be nice to have tests that:
>
> 1. Write to the shadow stack with normal instructions (and recover
> from
> the inevitable SEGV). Make sure the siginfo looks like we expect.
> 2. Corrupt the regular stack, or maybe just use a retpoline
> do induce a shadow stack exception. Ditto on checking the siginfo
> 3. Do enough CALLs that will likely trigger a fault and an on-demand
> shadow stack page allocation.
>
> That will test the *basics* and should be pretty simple to write.
Most of this already exists in the private tests. I'll combine it into
a single selftest. Having wrss now nicely made it a bit easier because
those writes are treated as shadow stack accesses, so we can do these
operations directly without too much calling acrobatics.
Thanks,
Rick