Re: [PATCH RFC RFT v2 5/5] kselftest/clone3: Test shadow stack support

2023-11-20 Thread Mark Brown
On Fri, Nov 17, 2023 at 01:12:46PM -0800, Deepak Gupta wrote: > On Tue, Nov 14, 2023 at 11:11:58PM +, Edgecombe, Rick P wrote: > > It seems like there will be a need for some generic method of checking > > if shadow stack is enabled. Maybe a more generic compiler > > intrinsic/builtin or glibc

Re: [PATCH RFC RFT v2 5/5] kselftest/clone3: Test shadow stack support

2023-11-17 Thread Deepak Gupta
On Tue, Nov 14, 2023 at 11:11:58PM +, Edgecombe, Rick P wrote: On Tue, 2023-11-14 at 20:05 +, Mark Brown wrote: +static void test_shadow_stack_supported(void) +{ +    long shadow_stack; + +   shadow_stack = syscall(__NR_map_shadow_stack, 0, getpagesize(), 0); Hmm, x86 fails thi

Re: [PATCH RFC RFT v2 5/5] kselftest/clone3: Test shadow stack support

2023-11-17 Thread Edgecombe, Rick P
On Tue, 2023-11-14 at 15:11 -0800, Rick Edgecombe wrote: > The other tests passed in both cases. I'm going to dig into the other > parts now but can circle back if it's not obvious what's going on > there. Finally got back to this. I think it's just a problem with the shadow stack detection logic

Re: [PATCH RFC RFT v2 5/5] kselftest/clone3: Test shadow stack support

2023-11-15 Thread Mark Brown
On Tue, Nov 14, 2023 at 11:11:58PM +, Edgecombe, Rick P wrote: > On Tue, 2023-11-14 at 20:05 +, Mark Brown wrote: > > +   shadow_stack = syscall(__NR_map_shadow_stack, 0, > > getpagesize(), 0); > Hmm, x86 fails this call if user shadow stack is not supported in the > HW or the kernel,

Re: [PATCH RFC RFT v2 5/5] kselftest/clone3: Test shadow stack support

2023-11-14 Thread Edgecombe, Rick P
On Tue, 2023-11-14 at 20:05 +, Mark Brown wrote: > +static void test_shadow_stack_supported(void) > +{ > +    long shadow_stack; > + > +   shadow_stack = syscall(__NR_map_shadow_stack, 0, > getpagesize(), 0); Hmm, x86 fails this call if user shadow stack is not supported in the HW or t

[PATCH RFC RFT v2 5/5] kselftest/clone3: Test shadow stack support

2023-11-14 Thread Mark Brown
Add basic test coverage for specifying the shadow stack for a newly created thread via clone3(), including coverage of the newly extended argument structure. We detect support for shadow stacks on the running system by attempting to allocate a shadow stack page during initialisation using map_shado