From: Thomas Garnier <thgarnie@google.com>
To: Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: "Ard Biesheuvel" <ard.biesheuvel@linaro.org>,
"Ingo Molnar" <mingo@kernel.org>,
"Herbert Xu" <herbert@gondor.apana.org.au>,
"David S . Miller" <davem@davemloft.net>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"H . Peter Anvin" <hpa@zytor.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Josh Poimboeuf" <jpoimboe@redhat.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Matthias Kaehlcke" <mka@chromium.org>,
"Boris Ostrovsky" <boris.ostrovsky@oracle.com>,
"Juergen Gross" <jgross@suse.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Joerg Roedel" <joro@8bytes.org>,
"Tom Lendacky" <thomas.lendacky@amd.com>,
"Andy Lutomirski" <luto@kernel.org>,
"Borislav Petkov" <bp@suse.de>, "Brian Gerst" <brgerst@gmail.com>,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
"Rafael J . Wysocki" <rjw@rjwysocki.net>,
"Len Brown" <len.brown@intel.com>, "Pavel Machek" <pavel@ucw.cz>,
"Tejun Heo" <tj@kernel.org>, "Christoph Lameter" <cl@linux.com>,
"Paul Gortmaker" <paul.gortmaker@windriver.com>,
"Chris Metcalf" <cmetcalf@mellanox.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Paul E . McKenney" <paulmck@linux.vnet.ibm.com>,
"Nicolas Pitre" <nicolas.pitre@linaro.org>,
"Christopher Li" <sparse@chrisli.org>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
"Lukas Wunner" <lukas@wunner.de>,
"Mika Westerberg" <mika.westerberg@linux.intel.com>,
"Dou Liyang" <douly.fnst@cn.fujitsu.com>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Alexei Starovoitov" <ast@kernel.org>,
"Masahiro Yamada" <yamada.masahiro@socionext.com>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Kees Cook" <keescook@chromium.org>,
"Rik van Riel" <riel@redhat.com>,
"David Howells" <dhowells@redhat.com>,
"Waiman Long" <longman@redhat.com>, "Kyle Huey" <me@kylehuey.com>,
"Peter Foley" <pefoley2@pefoley.com>,
"Tim Chen" <tim.c.chen@linux.intel.com>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Michal Hocko" <mhocko@suse.com>,
"Matthew Wilcox" <mawilcox@microsoft.com>,
"H . J . Lu" <hjl.tools@gmail.com>,
"Paul Bolle" <pebolle@tiscali.nl>,
"Rob Landley" <rob@landley.net>, "Baoquan He" <bhe@redhat.com>,
"Daniel Micay" <danielmicay@gmail.com>,
"the arch/x86 maintainers" <x86@kernel.org>,
"Linux Crypto Mailing List" <linux-crypto@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
xen-devel <xen-devel@lists.xenproject.org>,
"kvm list" <kvm@vger.kernel.org>,
"Linux PM list" <linux-pm@vger.kernel.org>,
linux-arch <linux-arch@vger.kernel.org>,
"Sparse Mailing-list" <linux-sparse@vger.kernel.org>,
"Kernel Hardening" <kernel-hardening@lists.openwall.com>,
"Linus Torvalds" <torvalds@linux-foundation.org>,
"Peter Zijlstra" <a.p.zijlstra@chello.nl>,
"Borislav Petkov" <bp@alien8.de>
Subject: [kernel-hardening] Re: x86: PIE support and option to extend KASLR randomization
Date: Fri, 22 Sep 2017 07:38:30 -0700 [thread overview]
Message-ID: <CAJcbSZEqDCwJyNFJkK-XSdKQNTdrvJCZO=vDPCqaORKyAM2QLQ@mail.gmail.com> (raw)
In-Reply-To: <20170922042444.GA235@x4>
On Thu, Sep 21, 2017 at 9:24 PM, Markus Trippelsdorf
<markus@trippelsdorf.de> wrote:
> On 2017.09.21 at 14:21 -0700, Thomas Garnier wrote:
>> On Thu, Sep 21, 2017 at 9:10 AM, Ard Biesheuvel
>> <ard.biesheuvel@linaro.org> wrote:
>> >
>> > On 21 September 2017 at 08:59, Ingo Molnar <mingo@kernel.org> wrote:
>> > >
>> > > ( Sorry about the delay in answering this. I could blame the delay on the merge
>> > > window, but in reality I've been procrastinating this is due to the permanent,
>> > > non-trivial impact PIE has on generated C code. )
>> > >
>> > > * Thomas Garnier <thgarnie@google.com> wrote:
>> > >
>> > >> 1) PIE sometime needs two instructions to represent a single
>> > >> instruction on mcmodel=kernel.
>> > >
>> > > What again is the typical frequency of this occurring in an x86-64 defconfig
>> > > kernel, with the very latest GCC?
>> > >
>> > > Also, to make sure: which unwinder did you use for your measurements,
>> > > frame-pointers or ORC? Please use ORC only for future numbers, as
>> > > frame-pointers is obsolete from a performance measurement POV.
>> > >
>> > >> 2) GCC does not optimize switches in PIE in order to reduce relocations:
>> > >
>> > > Hopefully this can either be fixed in GCC or at least influenced via a compiler
>> > > switch in the future.
>> > >
>> >
>> > There are somewhat related concerns in the ARM world, so it would be
>> > good if we could work with the GCC developers to get a more high level
>> > and arch neutral command line option (-mkernel-pie? sounds yummy!)
>> > that stops the compiler from making inferences that only hold for
>> > shared libraries and/or other hosted executables (GOT indirections,
>> > avoiding text relocations etc). That way, we will also be able to drop
>> > the 'hidden' visibility override at some point, which we currently
>> > need to prevent the compiler from redirecting all global symbol
>> > references via entries in the GOT.
>>
>> My plan was to add a -mtls-reg=<fs|gs> to switch the default segment
>> register for stack cookies but I can see great benefits in having a
>> more general kernel flag that would allow to get rid of the GOT and
>> PLT when you are building position independent code for the kernel. It
>> could also include optimizations like folding switch tables etc...
>>
>> Should we start a separate discussion on that? Anyone that would be
>> more experienced than I to push that to gcc & clang upstream?
>
> Just open a gcc bug. See
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81708 as an example.
Make sense, I will look into this. Thanks Andy for the stack cookie bug!
>
> --
> Markus
--
Thomas
next prev parent reply other threads:[~2017-09-22 14:38 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-10 17:25 [kernel-hardening] x86: PIE support and option to extend KASLR randomization Thomas Garnier
2017-08-10 17:25 ` [kernel-hardening] [RFC v2 01/23] x86/crypto: Adapt assembly for PIE support Thomas Garnier
2017-08-10 17:25 ` [kernel-hardening] [RFC v2 02/23] x86: Use symbol name on bug table " Thomas Garnier
2017-08-10 17:25 ` [kernel-hardening] [RFC v2 03/23] x86: Use symbol name in jump " Thomas Garnier
2017-08-10 17:25 ` [kernel-hardening] [RFC v2 04/23] x86: Add macro to get symbol address " Thomas Garnier
2017-08-10 17:25 ` [kernel-hardening] [RFC v2 05/23] xen: Adapt assembly " Thomas Garnier
2017-08-10 17:25 ` [kernel-hardening] [RFC v2 06/23] kvm: " Thomas Garnier
2017-08-10 17:25 ` [kernel-hardening] [RFC v2 07/23] x86: relocate_kernel - " Thomas Garnier
2017-08-10 17:26 ` [kernel-hardening] [RFC v2 08/23] x86/entry/64: " Thomas Garnier
2017-08-10 17:26 ` [kernel-hardening] [RFC v2 09/23] x86: pm-trace - " Thomas Garnier
2017-08-10 17:26 ` [kernel-hardening] [RFC v2 10/23] x86/CPU: " Thomas Garnier
2017-08-10 17:26 ` [kernel-hardening] [RFC v2 11/23] x86/acpi: " Thomas Garnier
2017-08-10 17:26 ` [kernel-hardening] [RFC v2 12/23] x86/boot/64: " Thomas Garnier
2017-08-10 17:26 ` [kernel-hardening] [RFC v2 13/23] x86/power/64: " Thomas Garnier
2017-08-11 12:36 ` [kernel-hardening] " Pavel Machek
2017-08-11 15:09 ` Thomas Garnier
2017-08-10 17:26 ` [kernel-hardening] [RFC v2 14/23] x86/paravirt: " Thomas Garnier
2017-08-10 17:26 ` [kernel-hardening] [RFC v2 15/23] x86/boot/64: Use _text in a global " Thomas Garnier
2017-08-10 17:26 ` [kernel-hardening] [RFC v2 16/23] x86/percpu: Adapt percpu " Thomas Garnier
2017-08-10 17:26 ` [kernel-hardening] [RFC v2 17/23] compiler: Option to default to hidden symbols Thomas Garnier
2017-08-10 17:26 ` [kernel-hardening] [RFC v2 18/23] x86/relocs: Handle DYN relocations for PIE support Thomas Garnier
2017-08-10 17:26 ` [kernel-hardening] [RFC v2 19/23] x86: Support global stack cookie Thomas Garnier
2017-08-10 17:26 ` [kernel-hardening] [RFC v2 20/23] x86/pie: Add option to build the kernel as PIE for x86_64 Thomas Garnier
2017-08-10 17:26 ` [kernel-hardening] [RFC v2 21/23] x86/relocs: Add option to generate 64-bit relocations Thomas Garnier
2017-08-10 17:26 ` [kernel-hardening] [RFC v2 22/23] x86/module: Add support for mcmodel large and PLTs Thomas Garnier
2017-08-10 17:26 ` [kernel-hardening] [RFC v2 23/23] x86/kaslr: Add option to extend KASLR range from 1GB to 3GB Thomas Garnier
2017-08-11 12:41 ` [kernel-hardening] Re: x86: PIE support and option to extend KASLR randomization Ingo Molnar
2017-08-11 15:09 ` Thomas Garnier
2017-08-15 7:56 ` Ingo Molnar
2017-08-15 12:15 ` Jordan Glover
2017-08-15 13:42 ` Rik van Riel
2017-08-15 14:20 ` Thomas Garnier
2017-08-15 14:47 ` Daniel Micay
2017-08-15 14:58 ` Thomas Garnier
2017-08-16 15:12 ` Ingo Molnar
2017-08-16 16:09 ` Christopher Lameter
2017-08-16 16:26 ` Daniel Micay
2017-08-16 16:32 ` Ard Biesheuvel
2017-08-16 16:57 ` Thomas Garnier
2017-08-17 8:09 ` Ingo Molnar
2017-08-17 14:10 ` Thomas Garnier
2017-08-24 21:13 ` Thomas Garnier
2017-08-24 21:42 ` Linus Torvalds
2017-08-25 15:35 ` Thomas Garnier
2017-08-25 1:07 ` Steven Rostedt
2017-08-25 8:04 ` Ingo Molnar
2017-08-25 15:05 ` Thomas Garnier
2017-08-29 19:34 ` Thomas Garnier
2017-09-21 15:59 ` Ingo Molnar
2017-09-21 16:10 ` Ard Biesheuvel
2017-09-21 21:21 ` Thomas Garnier
2017-09-22 4:24 ` Markus Trippelsdorf
2017-09-22 14:38 ` Thomas Garnier [this message]
2017-09-22 23:55 ` Thomas Garnier
2017-09-21 21:16 ` Thomas Garnier
2017-09-22 0:06 ` Thomas Garnier
2017-09-22 16:32 ` Ingo Molnar
2017-09-22 18:08 ` Thomas Garnier
2017-09-23 9:43 ` Ingo Molnar
2017-10-02 20:28 ` Thomas Garnier
2017-09-22 18:38 ` H. Peter Anvin
2017-09-22 18:57 ` Kees Cook
2017-09-22 19:06 ` H. Peter Anvin
2017-09-22 18:59 ` Thomas Garnier
2017-09-23 9:49 ` Ingo Molnar
2017-08-17 14:12 ` Boris Lukashev
2017-08-25 15:38 ` Christopher Lameter
2017-08-27 22:39 ` Boris Lukashev
2017-08-28 9:59 ` Pavel Machek
2017-08-21 13:32 ` Peter Zijlstra
2017-08-21 14:28 ` Peter Zijlstra
2017-09-22 18:27 ` H. Peter Anvin
2017-09-23 10:00 ` Ingo Molnar
2017-09-24 22:37 ` Pavel Machek
2017-09-25 7:33 ` Ingo Molnar
2017-10-06 10:39 ` Pavel Machek
2017-10-20 8:13 ` Ingo Molnar
2017-08-21 14:31 ` Peter Zijlstra
2017-08-21 15:57 ` Thomas Garnier
2017-08-28 1:26 ` H. Peter Anvin
-- strict thread matches above, loose matches on Subject: below --
2017-07-18 22:33 [kernel-hardening] " Thomas Garnier
2017-07-19 14:08 ` [kernel-hardening] " Christopher Lameter
2017-07-19 19:21 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJcbSZEqDCwJyNFJkK-XSdKQNTdrvJCZO=vDPCqaORKyAM2QLQ@mail.gmail.com' \
--to=thgarnie@google.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=ard.biesheuvel@linaro.org \
--cc=arnd@arndb.de \
--cc=ast@kernel.org \
--cc=bhe@redhat.com \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=bp@suse.de \
--cc=brgerst@gmail.com \
--cc=catalin.marinas@arm.com \
--cc=cl@linux.com \
--cc=cmetcalf@mellanox.com \
--cc=daniel@iogearbox.net \
--cc=danielmicay@gmail.com \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=douly.fnst@cn.fujitsu.com \
--cc=herbert@gondor.apana.org.au \
--cc=hjl.tools@gmail.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=joro@8bytes.org \
--cc=jpoimboe@redhat.com \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=len.brown@intel.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=longman@redhat.com \
--cc=lukas@wunner.de \
--cc=luto@kernel.org \
--cc=markus@trippelsdorf.de \
--cc=mawilcox@microsoft.com \
--cc=me@kylehuey.com \
--cc=mhocko@suse.com \
--cc=mika.westerberg@linux.intel.com \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=mka@chromium.org \
--cc=nicolas.pitre@linaro.org \
--cc=paul.gortmaker@windriver.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=pavel@ucw.cz \
--cc=pbonzini@redhat.com \
--cc=pebolle@tiscali.nl \
--cc=pefoley2@pefoley.com \
--cc=peterz@infradead.org \
--cc=rafael.j.wysocki@intel.com \
--cc=riel@redhat.com \
--cc=rjw@rjwysocki.net \
--cc=rkrcmar@redhat.com \
--cc=rob@landley.net \
--cc=rostedt@goodmis.org \
--cc=sparse@chrisli.org \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=tim.c.chen@linux.intel.com \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.org \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).