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

- From: Yu, Yu-cheng \<hidden\>
- Date: 2021-07-20 17:16:22 
- List: linux-arch
- Page: https://ratatoskr.run/linux-arch/2021/07/1452651
- Thread: https://ratatoskr.run/linux-arch/2021/05/1388103/t.md

```text
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 <redacted>
>> Cc: Kees Cook <redacted>

[...]

>> 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
```
