Patchwork user_only: compile everything with -fpie

login
register
mail settings
Submitter Kirill A. Shutemov
Date Dec. 16, 2009, 2:20 p.m.
Message ID <1260973234-12601-1-git-send-email-kirill@shutemov.name>
Download mbox | patch
Permalink /patch/41271/
State New
Headers show

Comments

Kirill A. Shutemov - Dec. 16, 2009, 2:20 p.m.
We really need compile _all_ sources for user target with -fpie when
use --enable-user-pie.

It's regression introduced by commit add16157d72454.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 Makefile.user |    7 ++++++-
 configure     |    3 +++
 2 files changed, 9 insertions(+), 1 deletions(-)
Kirill A. Shutemov - Dec. 19, 2009, 12:26 a.m.
ping?

On Wed, Dec 16, 2009 at 4:20 PM, Kirill A. Shutemov
<kirill@shutemov.name> wrote:
> We really need compile _all_ sources for user target with -fpie when
> use --enable-user-pie.
>
> It's regression introduced by commit add16157d72454.
>
> Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
> Cc: Blue Swirl <blauwirbel@gmail.com>
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  Makefile.user |    7 ++++++-
>  configure     |    3 +++
>  2 files changed, 9 insertions(+), 1 deletions(-)
>
> diff --git a/Makefile.user b/Makefile.user
> index 907e74b..9e4f040 100644
> --- a/Makefile.user
> +++ b/Makefile.user
> @@ -2,10 +2,15 @@
>
>  include ../config-host.mak
>  include $(SRC_PATH)/rules.mak
> +include config.mak
>
>  .PHONY: all
>
> -VPATH=$(SRC_PATH)
> +# Do not take %.o from $(SRC_PATH), only %.c and %.h
> +# All %.o for user targets should be built with -fpie, when
> +# configured with --enable-user-pie, so we don't want to
> +# take %.o from $(SRC_PATH), since they built without -fpie
> +vpath %.c %.h $(SRC_PATH)
>
>  QEMU_CFLAGS+=-I..
>
> diff --git a/configure b/configure
> index 273b6b7..5f463b0 100755
> --- a/configure
> +++ b/configure
> @@ -2652,3 +2652,6 @@ d=libuser
>  mkdir -p $d
>  rm -f $d/Makefile
>  ln -s $source_path/Makefile.user $d/Makefile
> +if test "$static" = "no" -a "$user_pie" = "yes" ; then
> +  echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
> +fi
> --
> 1.6.5.6
>
>
Juan Quintela - Dec. 19, 2009, 12:44 a.m.
"Kirill A. Shutemov" <kirill@shutemov.name> wrote:
> ping?

Blue or Anthony, please apply.
Patch is needed to get libuser + pie working well.

Later, Juan.

> On Wed, Dec 16, 2009 at 4:20 PM, Kirill A. Shutemov
> <kirill@shutemov.name> wrote:
>> We really need compile _all_ sources for user target with -fpie when
>> use --enable-user-pie.
>>
>> It's regression introduced by commit add16157d72454.
>>
>> Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
>> Cc: Blue Swirl <blauwirbel@gmail.com>
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  Makefile.user |    7 ++++++-
>>  configure     |    3 +++
>>  2 files changed, 9 insertions(+), 1 deletions(-)
>>
>> diff --git a/Makefile.user b/Makefile.user
>> index 907e74b..9e4f040 100644
>> --- a/Makefile.user
>> +++ b/Makefile.user
>> @@ -2,10 +2,15 @@
>>
>>  include ../config-host.mak
>>  include $(SRC_PATH)/rules.mak
>> +include config.mak
>>
>>  .PHONY: all
>>
>> -VPATH=$(SRC_PATH)
>> +# Do not take %.o from $(SRC_PATH), only %.c and %.h
>> +# All %.o for user targets should be built with -fpie, when
>> +# configured with --enable-user-pie, so we don't want to
>> +# take %.o from $(SRC_PATH), since they built without -fpie
>> +vpath %.c %.h $(SRC_PATH)
>>
>>  QEMU_CFLAGS+=-I..
>>
>> diff --git a/configure b/configure
>> index 273b6b7..5f463b0 100755
>> --- a/configure
>> +++ b/configure
>> @@ -2652,3 +2652,6 @@ d=libuser
>>  mkdir -p $d
>>  rm -f $d/Makefile
>>  ln -s $source_path/Makefile.user $d/Makefile
>> +if test "$static" = "no" -a "$user_pie" = "yes" ; then
>> +  echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
>> +fi
>> --
>> 1.6.5.6
>>
>>
Blue Swirl - Dec. 19, 2009, 10:08 a.m.
On Sat, Dec 19, 2009 at 12:44 AM, Juan Quintela <quintela@redhat.com> wrote:
> "Kirill A. Shutemov" <kirill@shutemov.name> wrote:
>> ping?
>
> Blue or Anthony, please apply.
> Patch is needed to get libuser + pie working well.

0.12.0 has been tagged, but I think this is still good candidate
material for 0.12.1.
Aurelien Jarno - Dec. 19, 2009, 1:05 p.m.
On Sat, Dec 19, 2009 at 10:08:43AM +0000, Blue Swirl wrote:
> On Sat, Dec 19, 2009 at 12:44 AM, Juan Quintela <quintela@redhat.com> wrote:
> > "Kirill A. Shutemov" <kirill@shutemov.name> wrote:
> >> ping?
> >
> > Blue or Anthony, please apply.
> > Patch is needed to get libuser + pie working well.
> 
> 0.12.0 has been tagged, but I think this is still good candidate
> material for 0.12.1.
> 

It doesn't seems to have been tagged yet.
Blue Swirl - Dec. 19, 2009, 3:19 p.m.
On Sat, Dec 19, 2009 at 1:05 PM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> On Sat, Dec 19, 2009 at 10:08:43AM +0000, Blue Swirl wrote:
>> On Sat, Dec 19, 2009 at 12:44 AM, Juan Quintela <quintela@redhat.com> wrote:
>> > "Kirill A. Shutemov" <kirill@shutemov.name> wrote:
>> >> ping?
>> >
>> > Blue or Anthony, please apply.
>> > Patch is needed to get libuser + pie working well.
>>
>> 0.12.0 has been tagged, but I think this is still good candidate
>> material for 0.12.1.
>>
>
> It doesn't seems to have been tagged yet.

It's now. Anyway, I committed it to HEAD, please take it from there for 0.12.1.
Aurelien Jarno - Dec. 19, 2009, 3:34 p.m.
On Sat, Dec 19, 2009 at 03:19:02PM +0000, Blue Swirl wrote:
> On Sat, Dec 19, 2009 at 1:05 PM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> > On Sat, Dec 19, 2009 at 10:08:43AM +0000, Blue Swirl wrote:
> >> On Sat, Dec 19, 2009 at 12:44 AM, Juan Quintela <quintela@redhat.com> wrote:
> >> > "Kirill A. Shutemov" <kirill@shutemov.name> wrote:
> >> >> ping?
> >> >
> >> > Blue or Anthony, please apply.
> >> > Patch is needed to get libuser + pie working well.
> >>
> >> 0.12.0 has been tagged, but I think this is still good candidate
> >> material for 0.12.1.
> >>
> >
> > It doesn't seems to have been tagged yet.
> 
> It's now. Anyway, I committed it to HEAD, please take it from there for 0.12.1.
> 

Then the best is to commit it to stable-0.12, this will ensure it is in
0.12.1.
Blue Swirl - Dec. 19, 2009, 3:48 p.m.
On Sat, Dec 19, 2009 at 3:34 PM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> On Sat, Dec 19, 2009 at 03:19:02PM +0000, Blue Swirl wrote:
>> On Sat, Dec 19, 2009 at 1:05 PM, Aurelien Jarno <aurelien@aurel32.net> wrote:
>> > On Sat, Dec 19, 2009 at 10:08:43AM +0000, Blue Swirl wrote:
>> >> On Sat, Dec 19, 2009 at 12:44 AM, Juan Quintela <quintela@redhat.com> wrote:
>> >> > "Kirill A. Shutemov" <kirill@shutemov.name> wrote:
>> >> >> ping?
>> >> >
>> >> > Blue or Anthony, please apply.
>> >> > Patch is needed to get libuser + pie working well.
>> >>
>> >> 0.12.0 has been tagged, but I think this is still good candidate
>> >> material for 0.12.1.
>> >>
>> >
>> > It doesn't seems to have been tagged yet.
>>
>> It's now. Anyway, I committed it to HEAD, please take it from there for 0.12.1.
>>
>
> Then the best is to commit it to stable-0.12, this will ensure it is in
> 0.12.1.

Actually, it broke compilation without -fpie, so I had to commit also
a fix. For 0.12.1 I think we want only one fixed commit. Does this
need a new patch with SoB etc. or can I just fix the patch?
Aurelien Jarno - Dec. 19, 2009, 3:58 p.m.
On Sat, Dec 19, 2009 at 04:34:22PM +0100, Aurelien Jarno wrote:
> On Sat, Dec 19, 2009 at 03:19:02PM +0000, Blue Swirl wrote:
> > On Sat, Dec 19, 2009 at 1:05 PM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> > > On Sat, Dec 19, 2009 at 10:08:43AM +0000, Blue Swirl wrote:
> > >> On Sat, Dec 19, 2009 at 12:44 AM, Juan Quintela <quintela@redhat.com> wrote:
> > >> > "Kirill A. Shutemov" <kirill@shutemov.name> wrote:
> > >> >> ping?
> > >> >
> > >> > Blue or Anthony, please apply.
> > >> > Patch is needed to get libuser + pie working well.
> > >>
> > >> 0.12.0 has been tagged, but I think this is still good candidate
> > >> material for 0.12.1.
> > >>
> > >
> > > It doesn't seems to have been tagged yet.
> > 
> > It's now. Anyway, I committed it to HEAD, please take it from there for 0.12.1.
> > 
> 
> Then the best is to commit it to stable-0.12, this will ensure it is in
> 0.12.1.

Actually it is not a good idea, as this patch breaks parallel building.
It has to be fixed first:

$ make -j2
Makefile:5: config.mak: No such file or directory
make[1]: *** No rule to make target `config.mak'.  Stop.
make: *** [libuser.a] Error 2
make: *** Waiting for unfinished jobs....
Blue Swirl - Dec. 19, 2009, 4 p.m.
On Sat, Dec 19, 2009 at 3:58 PM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> On Sat, Dec 19, 2009 at 04:34:22PM +0100, Aurelien Jarno wrote:
>> On Sat, Dec 19, 2009 at 03:19:02PM +0000, Blue Swirl wrote:
>> > On Sat, Dec 19, 2009 at 1:05 PM, Aurelien Jarno <aurelien@aurel32.net> wrote:
>> > > On Sat, Dec 19, 2009 at 10:08:43AM +0000, Blue Swirl wrote:
>> > >> On Sat, Dec 19, 2009 at 12:44 AM, Juan Quintela <quintela@redhat.com> wrote:
>> > >> > "Kirill A. Shutemov" <kirill@shutemov.name> wrote:
>> > >> >> ping?
>> > >> >
>> > >> > Blue or Anthony, please apply.
>> > >> > Patch is needed to get libuser + pie working well.
>> > >>
>> > >> 0.12.0 has been tagged, but I think this is still good candidate
>> > >> material for 0.12.1.
>> > >>
>> > >
>> > > It doesn't seems to have been tagged yet.
>> >
>> > It's now. Anyway, I committed it to HEAD, please take it from there for 0.12.1.
>> >
>>
>> Then the best is to commit it to stable-0.12, this will ensure it is in
>> 0.12.1.
>
> Actually it is not a good idea, as this patch breaks parallel building.
> It has to be fixed first:
>
> $ make -j2
> Makefile:5: config.mak: No such file or directory
> make[1]: *** No rule to make target `config.mak'.  Stop.
> make: *** [libuser.a] Error 2
> make: *** Waiting for unfinished jobs....

It's not parallel build (I thought so too at first) but any build
without -fpie. I committed a fix.
Aurelien Jarno - Dec. 19, 2009, 4:03 p.m.
On Sat, Dec 19, 2009 at 03:48:52PM +0000, Blue Swirl wrote:
> On Sat, Dec 19, 2009 at 3:34 PM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> > On Sat, Dec 19, 2009 at 03:19:02PM +0000, Blue Swirl wrote:
> >> On Sat, Dec 19, 2009 at 1:05 PM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> >> > On Sat, Dec 19, 2009 at 10:08:43AM +0000, Blue Swirl wrote:
> >> >> On Sat, Dec 19, 2009 at 12:44 AM, Juan Quintela <quintela@redhat.com> wrote:
> >> >> > "Kirill A. Shutemov" <kirill@shutemov.name> wrote:
> >> >> >> ping?
> >> >> >
> >> >> > Blue or Anthony, please apply.
> >> >> > Patch is needed to get libuser + pie working well.
> >> >>
> >> >> 0.12.0 has been tagged, but I think this is still good candidate
> >> >> material for 0.12.1.
> >> >>
> >> >
> >> > It doesn't seems to have been tagged yet.
> >>
> >> It's now. Anyway, I committed it to HEAD, please take it from there for 0.12.1.
> >>
> >
> > Then the best is to commit it to stable-0.12, this will ensure it is in
> > 0.12.1.
> 
> Actually, it broke compilation without -fpie, so I had to commit also
> a fix. For 0.12.1 I think we want only one fixed commit. Does this
> need a new patch with SoB etc. or can I just fix the patch?
> 

I think you can simplify fix the patch, maybe mentioning it in the
comment.

Patch

diff --git a/Makefile.user b/Makefile.user
index 907e74b..9e4f040 100644
--- a/Makefile.user
+++ b/Makefile.user
@@ -2,10 +2,15 @@ 
 
 include ../config-host.mak
 include $(SRC_PATH)/rules.mak
+include config.mak
 
 .PHONY: all
 
-VPATH=$(SRC_PATH)
+# Do not take %.o from $(SRC_PATH), only %.c and %.h
+# All %.o for user targets should be built with -fpie, when
+# configured with --enable-user-pie, so we don't want to
+# take %.o from $(SRC_PATH), since they built without -fpie
+vpath %.c %.h $(SRC_PATH)
 
 QEMU_CFLAGS+=-I..
 
diff --git a/configure b/configure
index 273b6b7..5f463b0 100755
--- a/configure
+++ b/configure
@@ -2652,3 +2652,6 @@  d=libuser
 mkdir -p $d
 rm -f $d/Makefile
 ln -s $source_path/Makefile.user $d/Makefile
+if test "$static" = "no" -a "$user_pie" = "yes" ; then
+  echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
+fi