[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <AE81FEF5-ECC5-46AA-804D-9D64E656D16E@amacapital.net>
Date: Mon, 9 Mar 2020 13:16:14 -0700
From: Andy Lutomirski <luto@...capital.net>
To: "H.J. Lu" <hjl.tools@...il.com>
Cc: Dave Hansen <dave.hansen@...el.com>,
Yu-cheng Yu <yu-cheng.yu@...el.com>,
the arch/x86 maintainers <x86@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
LKML <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@...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>,
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>, x86-patch-review@...el.com
Subject: Re: [RFC PATCH v9 01/27] Documentation/x86: Add CET description
> On Mar 9, 2020, at 12:50 PM, H.J. Lu <hjl.tools@...il.com> wrote:
>
> On Mon, Mar 9, 2020 at 12:35 PM Dave Hansen <dave.hansen@...el.com> wrote:
>>
>>> On 3/9/20 12:27 PM, Yu-cheng Yu wrote:
>>> On Mon, 2020-03-09 at 10:21 -0700, Dave Hansen wrote:
>>>> On 3/9/20 10:00 AM, Yu-cheng Yu wrote:
>>>>> On Wed, 2020-02-26 at 09:57 -0800, Dave Hansen wrote>>>>> +Note:
>>>>>>> + There is no CET-enabling arch_prctl function. By design, CET is
>>>>>>> + enabled automatically if the binary and the system can support it.
>>>>>>
>>>>>> This is kinda interesting. It means that a JIT couldn't choose to
>>>>>> protect the code it generates and have different rules from itself?
>>>>>
>>>>> JIT needs to be updated for CET first. Once that is done, it runs with CET
>>>>> enabled. It can use the NOTRACK prefix, for example.
>>>>
>>>> Am I missing something?
>>>>
>>>> What's the direct connection between shadow stacks and Indirect Branch
>>>> Tracking other than Intel marketing umbrellas?
>>>
>>> What I meant is that JIT code needs to be updated first; if it skips RETs,
>>> it needs to unwind the stack, and if it does indirect JMPs somewhere it
>>> needs to fix up the branch target or use NOTRACK.
>>
>> I'm totally lost. I think we have very different models of how a JIT
>> might generate and run code.
>>
>> I can totally see a scenario where a JIT goes and generates a bunch of
>> code, then forks a new thread to go run that code. The control flow of
>> the JIT thread itself *NEVER* interacts with the control flow of the
>> program it writes. They never share a stack and nothing ever jumps or
>> rets between the two worlds.
>>
>> Does anything actually do that? I've got no idea. But, I can clearly
>> see a world where the entirety of Chrome and Firefox and the entire rust
>> runtime might not be fully recompiled and CET-enabled for a while. But,
>> we still want the JIT-generated code to be CET-protected since it has
>> the most exposed attack surface.
>>
>> I don't think that's too far-fetched.
>
> CET support is all or nothing. You can mix and match, but you will get
> no CET protection, similar to NX feature.
>
Can you explain?
If a program with the magic ELF CET flags missing can’t make a thread with IBT and/or SHSTK enabled, then I think we’ve made an error and should fix it.
> --
> H.J.
Powered by blists - more mailing lists