Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix shlib.lds generation
Generate sed command line used to create shlib.lds before invoking it
to prevent buffer overflow in make.

Fixes MER#472

Signed-off-by: Mikko Hurskainen <mikko.hurskainen@nomovok.com>
  • Loading branch information
Mikko Hurskainen committed Jul 16, 2013
1 parent 0c537b1 commit b456f88
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
49 changes: 49 additions & 0 deletions eglibc-2.15-shlib-make.patch
@@ -0,0 +1,49 @@
Index: eglibc-2.15/Makerules
===================================================================
--- eglibc-2.15.orig/Makerules 2011-10-25 03:37:10.000000000 +0300
+++ eglibc-2.15/Makerules 2013-07-16 14:35:52.581191695 +0300
@@ -509,25 +509,19 @@
else
# binutils only position loadable notes into the first page for binaries,
# not for shared objects
-$(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
- $(LINK.o) -shared -Wl,-O1 \
- -nostdlib -nostartfiles \
- $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS.so) \
- -Wl,--verbose 2>&1 | \
- sed > $@T \
- -e '/^=========/,/^=========/!d;/^=========/d' \
+shlib-lds-hash = -e '/^=========/,/^=========/!d;/^=========/d' \
$(if $(filter yes,$(have-hash-style)), \
-e 's/^.*\.gnu\.hash[ ]*:.*$$/ .note.ABI-tag : { *(.note.ABI-tag) } &/' \
-e '/^[ ]*\.hash[ ]*:.*$$/{h;d;}' \
-e '/DATA_SEGMENT_ALIGN/{H;g}' \
, \
-e 's/^.*\.hash[ ]*:.*$$/ .note.ABI-tag : { *(.note.ABI-tag) } &/' \
- ) \
- -e 's/^.*\*(\.dynbss).*$$/& \
+ )
+shlib-lds-dynbss = -e 's/^.*\*(\.dynbss).*$$/& \
PROVIDE(__start___libc_freeres_ptrs = .); \
*(__libc_freeres_ptrs) \
- PROVIDE(__stop___libc_freeres_ptrs = .);/'\
- -e 's@^.*\*(\.jcr).*$$@& \
+ PROVIDE(__stop___libc_freeres_ptrs = .);/'
+shlib-lds-jcr = -e 's@^.*\*(\.jcr).*$$@& \
PROVIDE(__start___libc_subfreeres = .);\
__libc_subfreeres : { *(__libc_subfreeres) }\
PROVIDE(__stop___libc_subfreeres = .);\
@@ -538,6 +532,13 @@
__libc_thread_subfreeres : { *(__libc_thread_subfreeres) }\
PROVIDE(__stop___libc_thread_subfreeres = .);\
/DISCARD/ : { *(.gnu.glibc-stub.*) }@'
+$(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
+ $(LINK.o) -shared -Wl,-O1 \
+ -nostdlib -nostartfiles \
+ $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS.so) \
+ -Wl,--verbose 2>&1 | \
+ sed > $@T \
+ $(shlib-lds-hash) $(shlib-lds-dynbss) $(shlib-lds-jcr)
test -s $@T
mv -f $@T $@
common-generated += shlib.lds
4 changes: 4 additions & 0 deletions glibc.changes
@@ -1,3 +1,7 @@
* Tue Jul 16 2013 Mikko Hurskainen <mikko.hurskainen@nomovok.com> - 2.15
- Fix shlib.lds generation with make 3.81
eglibc-2.15-shlib-make.patch

* Wed Jun 26 2013 Richard Braakman <richard.braakman@jollamobile.com> - 2.15
- Fix crash when linking with libdl on arm with NEON
eglibc-2.15-fix-neon-libdl.patch
Expand Down
2 changes: 2 additions & 0 deletions glibc.spec
Expand Up @@ -37,6 +37,7 @@ Patch11: glibc-2.14-locarchive-fedora.patch
Patch12: eglibc-2.15-disable-multilib.patch
Patch13: eglibc-2.15-use-usrbin-localedef.patch
Patch14: eglibc-2.15-fix-neon-libdl.patch
Patch15: eglibc-2.15-shlib-make.patch

Provides: ldconfig
# The dynamic linker supports DT_GNU_HASH
Expand Down Expand Up @@ -201,6 +202,7 @@ If unsure if you need this, don't install this package.
%patch13 -p1
%patch14 -p1
%endif
%patch15 -p1

# Not well formatted locales --cvm
sed -i "s|^localedata/locale-eo_EO.diff$||g" debian/patches/series
Expand Down

0 comments on commit b456f88

Please sign in to comment.