lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Thu, 30 Aug 2018 18:10:17 +0200 From: Jann Horn <jannh@...gle.com> To: yu-cheng.yu@...el.com Cc: "the arch/x86 maintainers" <x86@...nel.org>, "H . Peter Anvin" <hpa@...or.com>, Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, kernel list <linux-kernel@...r.kernel.org>, linux-doc@...r.kernel.org, Linux-MM <linux-mm@...ck.org>, linux-arch <linux-arch@...r.kernel.org>, Linux API <linux-api@...r.kernel.org>, Arnd Bergmann <arnd@...db.de>, Andy Lutomirski <luto@...capital.net>, Balbir Singh <bsingharora@...il.com>, Cyrill Gorcunov <gorcunov@...il.com>, Dave Hansen <dave.hansen@...ux.intel.com>, Florian Weimer <fweimer@...hat.com>, hjl.tools@...il.com, Jonathan Corbet <corbet@....net>, keescook@...omiun.org, Mike Kravetz <mike.kravetz@...cle.com>, Nadav Amit <nadav.amit@...il.com>, Oleg Nesterov <oleg@...hat.com>, Pavel Machek <pavel@....cz>, Peter Zijlstra <peterz@...radead.org>, ravi.v.shankar@...el.com, vedvyas.shanbhogue@...el.com Subject: Re: [RFC PATCH v3 18/24] x86/cet/shstk: User-mode shadow stack support On Thu, Aug 30, 2018 at 4:44 PM Yu-cheng Yu <yu-cheng.yu@...el.com> wrote: > > This patch adds basic shadow stack enabling/disabling routines. > A task's shadow stack is allocated from memory with VM_SHSTK > flag set and read-only protection. The shadow stack is > allocated to a fixed size of RLIMIT_STACK. > > Signed-off-by: Yu-cheng Yu <yu-cheng.yu@...el.com> [...] > +static int set_shstk_ptr(unsigned long addr) > +{ > + u64 r; > + > + if (!cpu_feature_enabled(X86_FEATURE_SHSTK)) > + return -1; > + > + if ((addr >= TASK_SIZE_MAX) || (!IS_ALIGNED(addr, 4))) > + return -1; > + > + rdmsrl(MSR_IA32_U_CET, r); > + wrmsrl(MSR_IA32_PL3_SSP, addr); > + wrmsrl(MSR_IA32_U_CET, r | MSR_IA32_CET_SHSTK_EN); > + return 0; > +} Here's a really stupid question: Where is the logic for switching those MSRs on task switch? MSR_IA32_PL3_SSP contains a userspace pointer, so it has to be switched on task switch, right? I'm sure I'm missing something obvious, but grepping for places that set MSR_IA32_PL3_SSP to nonzero values through the entire patchset, I only see set_shstk_ptr(), which is called from: - cet_setup_shstk() (called from arch_setup_features(), which is called from load_elf_binary()) - cet_restore_signal() (called on signal handler return) - cet_setup_signal() (called from signal handling code)
Powered by blists - more mailing lists