[LIBREPORT PATCH] fixed relro flags rhbz#812283
Jakub Filak
jfilak at redhat.com
Thu Jun 6 10:17:34 UTC 2013
I'm afraid that we have to add ' -Wl,-z,now' to the LDFLAGS and not to the CPPFLAGS because
the flag is used only for generating an executable or shared library
See 'man ld'
I'm not sure about '-Wl,-z,relro' it is not neccessary to have it in the CPPFLAGS but it should
be added to the LDFLAGS (but nothing has changed when I moved the flag from
the CPPFLAGS to the LDFLAGS)
See http://post-office.corp.redhat.com/archives/os-devel-list/2011-July/msg00162.html
I tweaked your version and the library has the desired properties according to
https://bugzilla.redhat.com/show_bug.cgi?id=812283#c11
$ git diff
diff --git a/src/client-python/Makefile.am b/src/client-python/Makefile.am
index 67e3b7a..768c518 100644
--- a/src/client-python/Makefile.am
+++ b/src/client-python/Makefile.am
@@ -19,11 +19,12 @@ _reportclient_la_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(PYTHON_CFLAGS) \
-D_GNU_SOURCE \
- -fPIE \
- -Wl,-z,relro -Wl,-z,now
+ -fPIE
_reportclient_la_LDFLAGS = \
-module \
-avoid-version \
- -export-symbols-regex init_reportclient
+ -export-symbols-regex init_reportclient \
+ -Wl,-z,relro \
+ -Wl,-z,now
_reportclient_la_LIBADD = \
../lib/libreport.la
$ readelf -ld src/client-python/.libs/_reportclient.so | grep -i -e "NOW" -e "RELRO"
GNU_RELRO 0x0000000000001d18 0x0000000000201d18 0x0000000000201d18
0x0000000000000018 (BIND_NOW)
0x000000006ffffffb (FLAGS_1) Flags: NOW
Note:
And I'd say that adding -fPIE is not enought to enable PIE:
> To enable PIE, you would pass -fPIE -DPIE in the CFLAGS and -pie in the
> LDFLAGS.
See http://post-office.corp.redhat.com/archives/os-devel-list/2011-July/msg00162.html
Regards
Jakub
On Thursday 06 of June 2013 10:34:56 Jiri Moskovcak wrote:
> Signed-off-by: Jiri Moskovcak <jmoskovc at redhat.com>
> ---
> src/client-python/Makefile.am | 3 ++-
> src/report-python/Makefile.am | 3 ++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/client-python/Makefile.am b/src/client-python/Makefile.am
> index c3ce8c6..67e3b7a 100644
> --- a/src/client-python/Makefile.am
> +++ b/src/client-python/Makefile.am
> @@ -19,7 +19,8 @@ _reportclient_la_CPPFLAGS = \
> $(GLIB_CFLAGS) \
> $(PYTHON_CFLAGS) \
> -D_GNU_SOURCE \
> - -fPIE -Wl,-z,relro,now
> + -fPIE \
> + -Wl,-z,relro -Wl,-z,now
> _reportclient_la_LDFLAGS = \
> -module \
> -avoid-version \
> diff --git a/src/report-python/Makefile.am b/src/report-python/Makefile.am
> index 5dc0b54..2afdf34 100644
> --- a/src/report-python/Makefile.am
> +++ b/src/report-python/Makefile.am
> @@ -24,7 +24,8 @@ _pyreport_la_CPPFLAGS = \
> $(GLIB_CFLAGS) \
> $(PYTHON_CFLAGS) \
> -D_GNU_SOURCE \
> - -fPIE -Wl,-z,relro,now
> + -fPIE \
> + -Wl,-z,relro -Wl,-z,now
> _pyreport_la_LDFLAGS = \
> -module \
> -avoid-version \
More information about the Crash-catcher
mailing list