[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMe9rOpuf1=LPBJzUHmgb2x6WDu=yUsKE+iZansaPDQfCPaejw@mail.gmail.com>
Date: Mon, 9 Dec 2013 15:53:14 -0800
From: "H.J. Lu" <hjl.tools@...il.com>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: Jiri Kosina <jkosina@...e.cz>, LKML <linux-kernel@...r.kernel.org>,
Josh Boyer <jwboyer@...hat.com>
Subject: Re: [PATCH] binfmt_elf: fix PIE load with randomization disabled
On Mon, Dec 9, 2013 at 3:35 PM, H. Peter Anvin <hpa@...or.com> wrote:
> On 12/09/2013 01:44 PM, H.J. Lu wrote:
>> On Mon, Dec 9, 2013 at 1:39 PM, H. Peter Anvin <hpa@...or.com> wrote:
>>> On 12/09/2013 01:03 PM, H.J. Lu wrote:
>>>>
>>>> No, please don't do that. Normally, PIE has zero load address and kernel
>>>> can load it anywhere. There are multiple reasons why PIE has non-zero
>>>> load address. Saying you need to load a program above 4GB under x86-64,
>>>> you can't do that with normal dynamic executable. PIE with non-zero load
>>>> address is the only way to do that on x86-64.
>>>>
>>>
>>> Why does it have to be PIE?
>>>
>>
>> x86-64 small model is limited to 4GB in size. You can't build
>> a dynamic executable in small model larger than 4GB.
>>
>> There are medium and large models. But they are slower than
>> small models as well as small models in PIE. Also there are
>> no glibc run-times for medium and large models.
>>
>
> Compiling for the small PIC model shouldn't automatically mean
> generating a PIE (ET_DYN) executable, though (and if those are
> inherently linked, that is a fundamental bug IMNSHO.)
PIE uses PIC. But GCC has -fPIE and -fPIC. They aren't
the same. You build PIE with
1. Compile with -fPIE.
2. Link with -pie.
--
H.J.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists