[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4f8d98ac-69a9-273f-bf23-bb5e06dd0ec9@intel.com>
Date: Fri, 23 Jul 2021 11:01:24 -0700
From: "Yu, Yu-cheng" <yu-cheng.yu@...el.com>
To: Dave Hansen <dave.hansen@...el.com>, <x86@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, <linux-kernel@...r.kernel.org>,
<linux-doc@...r.kernel.org>, <linux-mm@...ck.org>,
<linux-arch@...r.kernel.org>, <linux-api@...r.kernel.org>,
Arnd Bergmann <arnd@...db.de>,
Andy Lutomirski <luto@...nel.org>,
Balbir Singh <bsingharora@...il.com>,
Borislav Petkov <bp@...en8.de>,
Cyrill Gorcunov <gorcunov@...il.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"Eugene Syromiatnikov" <esyr@...hat.com>,
Florian Weimer <fweimer@...hat.com>,
"H.J. Lu" <hjl.tools@...il.com>, Jann Horn <jannh@...gle.com>,
Jonathan Corbet <corbet@....net>,
Kees Cook <keescook@...omium.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>,
Randy Dunlap <rdunlap@...radead.org>,
"Ravi V. Shankar" <ravi.v.shankar@...el.com>,
Vedvyas Shanbhogue <vedvyas.shanbhogue@...el.com>,
Dave Martin <Dave.Martin@....com>,
"Weijiang Yang" <weijiang.yang@...el.com>,
Pengfei Xu <pengfei.xu@...el.com>,
"Haitao Huang" <haitao.huang@...el.com>,
Rick P Edgecombe <rick.p.edgecombe@...el.com>
Subject: Re: [PATCH v28 26/32] x86/cet/shstk: Introduce shadow stack token
setup/verify routines
On 7/22/2021 2:15 PM, Dave Hansen wrote:
> On 7/22/21 1:52 PM, Yu-cheng Yu wrote:
>> + if (fpregs_state_valid(fpu, smp_processor_id())) {
>> + rdmsrl(MSR_IA32_PL3_SSP, ssp);
>> + } else {
>> + struct cet_user_state *p;
>> +
>> + /*
>> + * When !fpregs_state_valid() and get_xsave_addr() returns
>> + * null, XFEAUTRE_CET_USER is in init state. Shadow stack
>> + * pointer is null in this case, so return zero.
>> + */
>> + p = get_xsave_addr(&fpu->state.xsave, XFEATURE_CET_USER);
>> + if (p)
>> + ssp = p->user_ssp;
>> + }
>> +
>> + fpregs_unlock();
>
> Why are we even calling into this code if shadow stacks might be
> disabled? Seems like we should have just errored out long before
> getting here.
>
That is true. When this function is called, shadow stack is enabled.
If get_xsave_addr() returns null, it is possible xstates is messed up.
Maybe I can update the comments to explain it?
Thanks,
Yu-cheng
Powered by blists - more mailing lists