Re: [PATCH v27 23/31] x86/cet/shstk: Add user-mode shadow stack support

Yu, Yu-cheng
2021-07-20T17:16:22Z

On 7/19/2021 11:23 AM, Edgecombe, Rick P wrote:
> On Fri, 2021-05-21 at 15:12 -0700, Yu-cheng Yu wrote:
>> Introduce basic shadow stack enabling/disabling/allocation routines.
>> A task's shadow stack is allocated from memory with VM_SHADOW_STACK
>> flag
>> and has a fixed size of min(RLIMIT_STACK, 4GB).
>>
>> Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com>
>> Cc: Kees Cook <keescook@chromium.org>

[...]

>> diff --git a/arch/x86/kernel/shstk.c b/arch/x86/kernel/shstk.c
>> new file mode 100644
>> index 000000000000..5ea2b494e9f9
>> --- /dev/null
>> +++ b/arch/x86/kernel/shstk.c

[...]

>> +int shstk_setup(void)
>> +{
>> +       struct thread_shstk *shstk = &current->thread.shstk;
>> +       unsigned long addr, size;
>> +
>> +       if (!cpu_feature_enabled(X86_FEATURE_SHSTK))
>> +               return -EOPNOTSUPP;
> The only caller of this will skip it if
> !cpu_feature_enabled(X86_FEATURE_SHSTK), so this is dead logic. Same
> pattern in the IBT patch.
>

Indeed that is the case. We can simply remove the test of
X86_FEATURE_SHSTK.

Thanks,
Yu-cheng