From: "H. Peter Anvin" Subject: Re: x86: PIE support and option to extend KASLR randomization Date: Fri, 22 Sep 2017 12:06:16 -0700 Message-ID: <0c04349a-b9f1-5aae-517b-bd057705ae2e@zytor.com> 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 Content-Transfer-Encoding: 7bit Cc: Ingo Molnar , Thomas Garnier , 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 . Wys To: Kees Cook Return-path: List-Post: List-Help: List-Unsubscribe: List-Subscribe: In-Reply-To: Content-Language: en-US List-Id: linux-crypto.vger.kernel.org On 09/22/17 11:57, Kees Cook wrote: > On Fri, Sep 22, 2017 at 11:38 AM, H. Peter Anvin wrote: >> 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. > > FWIW, since gcc 5, the PIC register isn't totally lost. It is now > reusable, and that seems to have improved performance: > https://gcc.gnu.org/gcc-5/changes.html It still talks about a PIC register on x86-64, which confuses me. Perhaps older gcc's would allocate a PIC register under certain circumstances, and then lose it for the entire function? For i386, the PIC register is required by the ABI to be %ebx at the point any PLT entry is called. Not an issue with -mno-plt which goes straight to the GOT, although in most cases there needs to be a PIC register to find the GOT unless load-time relocation is permitted. -hpa