Re: [Xen-devel] [RFC 16/22] x86/percpu: Adapt percpu for PIE support

2017-08-02 Thread Thomas Garnier
On Wed, Aug 2, 2017 at 9:56 AM, Kees Cook wrote: > On Wed, Aug 2, 2017 at 9:42 AM, Thomas Garnier wrote: >> I noticed that not only we have the problem of gs:0x40 not being >> accessible. The compiler will default to the fs register if >> mcmodel=kernel is not set. >> >> On the next patch set, I

Re: [Xen-devel] [RFC 16/22] x86/percpu: Adapt percpu for PIE support

2017-08-02 Thread Kees Cook
On Wed, Aug 2, 2017 at 9:42 AM, Thomas Garnier wrote: > I noticed that not only we have the problem of gs:0x40 not being > accessible. The compiler will default to the fs register if > mcmodel=kernel is not set. > > On the next patch set, I am going to add support for > -mstack-protector-guard=glo

Re: [Xen-devel] [RFC 16/22] x86/percpu: Adapt percpu for PIE support

2017-08-02 Thread Thomas Garnier
On Thu, Jul 20, 2017 at 7:26 AM, Thomas Garnier wrote: > On Wed, Jul 19, 2017 at 4:33 PM, H. Peter Anvin wrote: >> On 07/19/17 11:26, Thomas Garnier wrote: >>> On Tue, Jul 18, 2017 at 8:08 PM, Brian Gerst wrote: On Tue, Jul 18, 2017 at 6:33 PM, Thomas Garnier wrote: > Perpcu uses

Re: [Xen-devel] [RFC 16/22] x86/percpu: Adapt percpu for PIE support

2017-07-20 Thread Thomas Garnier
On Wed, Jul 19, 2017 at 4:33 PM, H. Peter Anvin wrote: > On 07/19/17 11:26, Thomas Garnier wrote: >> On Tue, Jul 18, 2017 at 8:08 PM, Brian Gerst wrote: >>> On Tue, Jul 18, 2017 at 6:33 PM, Thomas Garnier wrote: Perpcu uses a clever design where the .percu ELF section has a virtual add

Re: [Xen-devel] [RFC 16/22] x86/percpu: Adapt percpu for PIE support

2017-07-19 Thread H. Peter Anvin
On 07/19/17 19:21, H. Peter Anvin wrote: > On 07/19/17 16:33, H. Peter Anvin wrote: >>> >>> I agree that it is odd but that's how the compiler generates code. I >>> will re-explore PIC options with mcmodel=small or medium, as mentioned >>> on other threads. >> >> Why should the way compiler generat

Re: [Xen-devel] [RFC 16/22] x86/percpu: Adapt percpu for PIE support

2017-07-19 Thread H. Peter Anvin
On 07/19/17 16:33, H. Peter Anvin wrote: >> >> I agree that it is odd but that's how the compiler generates code. I >> will re-explore PIC options with mcmodel=small or medium, as mentioned >> on other threads. > > Why should the way compiler generates code affect the way we do things > in assembl

Re: [Xen-devel] [RFC 16/22] x86/percpu: Adapt percpu for PIE support

2017-07-19 Thread H. Peter Anvin
On 07/19/17 11:26, Thomas Garnier wrote: > On Tue, Jul 18, 2017 at 8:08 PM, Brian Gerst wrote: >> On Tue, Jul 18, 2017 at 6:33 PM, Thomas Garnier wrote: >>> Perpcu uses a clever design where the .percu ELF section has a virtual >>> address of zero and the relocation code avoid relocating specific

Re: [Xen-devel] [RFC 16/22] x86/percpu: Adapt percpu for PIE support

2017-07-19 Thread Thomas Garnier
On Tue, Jul 18, 2017 at 8:08 PM, Brian Gerst wrote: > On Tue, Jul 18, 2017 at 6:33 PM, Thomas Garnier wrote: >> Perpcu uses a clever design where the .percu ELF section has a virtual >> address of zero and the relocation code avoid relocating specific >> symbols. It makes the code simple and easi

Re: [Xen-devel] [RFC 16/22] x86/percpu: Adapt percpu for PIE support

2017-07-18 Thread Brian Gerst
On Tue, Jul 18, 2017 at 6:33 PM, Thomas Garnier wrote: > Perpcu uses a clever design where the .percu ELF section has a virtual > address of zero and the relocation code avoid relocating specific > symbols. It makes the code simple and easily adaptable with or without > SMP support. > > This desig

[Xen-devel] [RFC 16/22] x86/percpu: Adapt percpu for PIE support

2017-07-18 Thread Thomas Garnier
Perpcu uses a clever design where the .percu ELF section has a virtual address of zero and the relocation code avoid relocating specific symbols. It makes the code simple and easily adaptable with or without SMP support. This design is incompatible with PIE because generated code always try to acc