[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <EB0D8B9E-0646-4D27-8F3D-750AF09BFAE4@zytor.com>
Date: Thu, 24 May 2018 14:38:21 -0700
From: hpa@...or.com
To: Nick Desaulniers <ndesaulniers@...gle.com>
CC: Alistair Strachan <astrachan@...gle.com>,
Manoj Gupta <manojgupta@...gle.com>,
Matthias Kaehlcke <mka@...gle.com>,
Greg Hackmann <ghackmann@...gle.com>, sedat.dilek@...il.com,
tstellar@...hat.com, LKML <linux-kernel@...r.kernel.org>,
Kees Cook <keescook@...gle.com>
Subject: Re: [clang] stack protector and f1f029c7bf
On May 24, 2018 1:52:16 PM PDT, Nick Desaulniers <ndesaulniers@...gle.com> wrote:
>On Thu, May 24, 2018 at 1:26 PM Nick Desaulniers
><ndesaulniers@...gle.com>
>wrote:
>> On Thu, May 24, 2018 at 11:59 AM <hpa@...or.com> wrote:
>> > Issue 3: Let's face it, reading and writing the flags should be
>builtins,
>> exactly because it has to do stack operations, which really means the
>> compiler should be involved.
>
>> I'm happy to propose that as a feature request to llvm+gcc.
>
>Oh, looks like both clang and gcc have:
>__builtin_ia32_readeflags_u64()
>
>https://godbolt.org/g/SwPjhq
>
>Maybe native_save_fl() and native_restore_fl() should be replaced in
>the
>kernel with
>__builtin_ia32_readeflags_u64() and __builtin_ia32_writeeflags_u64()?
It should, at least when the compiler supports them (we keep support in for old compilers back to about gcc 3.4 or 4.1 or so for x86, but they are intently special cases.)
For the PV case, I think we should create it as an explicit assembly function, meaning it should be an extern inline in C code. That way we're fixing the kernel right.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Powered by blists - more mailing lists