From: Thomas Garnier Subject: Re: x86: PIE support and option to extend KASLR randomization Date: Fri, 22 Sep 2017 11:59:00 -0700 Message-ID: References: <20170816151235.oamkdva6cwpc4cex@gmail.com> <20170817080920.5ljlkktngw2cisfg@gmail.com> <20170825080443.tvvr6wzs362cjcuu@gmail.com> <20170921155919.skpyt7dutod5ul4t@gmail.com> <20170922163225.bfrd5myl6d7deiim@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: Ingo Molnar , Herbert Xu , "David S . Miller" , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Josh Poimboeuf , Arnd Bergmann , Matthias Kaehlcke , Boris Ostrovsky , Juergen Gross , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Joerg Roedel , Tom Lendacky , Andy Lutomirski , Borislav Petkov , Brian Gerst , "Kirill A . Shutemov" , "Rafael J . Wysocki" , Len Brown , Pavel Machek , Tejun Heo , Christoph Lamet To: "H. Peter Anvin" Return-path: List-Post: List-Help: List-Unsubscribe: List-Subscribe: In-Reply-To: List-Id: linux-crypto.vger.kernel.org On Fri, Sep 22, 2017 at 11:38 AM, H. Peter Anvin wrote: > On 09/22/17 09:32, Ingo Molnar wrote: >> >> BTW., I think things improved with ORC because with ORC we have RBP as an extra >> register and with PIE we lose RBX - so register pressure in code generation is >> lower. >> > > We lose EBX on 32 bits, but we don't lose RBX on 64 bits - since x86-64 > has RIP-relative addressing there is no need for a dedicated PIC register. > > I'm somewhat confused how we can have as much as almost 1% overhead. I > suspect that we end up making a GOT and maybe even a PLT for no good reason. We have a GOT with very few entries, mainly linker script globals that I think we can work to reduce or remove. We have a PLT but it is empty. On latest iteration (not sent yet), modules have PLT32 relocations but no PLT entry. I got rid of mcmodel=large for modules and instead I move the beginning of the module section just after the kernel so relative relocations work. > > -hpa -- Thomas