From 019e6343e3b6242f74e35d0e0a7bfafb11fc6880 Mon Sep 17 00:00:00 2001 From: Shiz Date: Wed, 12 Apr 2017 03:55:18 +0000 Subject: main/musl: fix unwinding breakage on static PIE binaries --- ...or-dl_iterate_phdr-in-static-pie-binaries.patch | 36 ++++++++++++++++++++++ main/musl/APKBUILD | 4 ++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 main/musl/0032-fix-support-for-dl_iterate_phdr-in-static-pie-binaries.patch (limited to 'main') diff --git a/main/musl/0032-fix-support-for-dl_iterate_phdr-in-static-pie-binaries.patch b/main/musl/0032-fix-support-for-dl_iterate_phdr-in-static-pie-binaries.patch new file mode 100644 index 0000000000..5d1957e059 --- /dev/null +++ b/main/musl/0032-fix-support-for-dl_iterate_phdr-in-static-pie-binaries.patch @@ -0,0 +1,36 @@ +From: Shiz +Date: Wed, 12 Apr 2017 05:50:14 +0200 +Subject: [PATCH] Fix support for dl_iterate_phdr in static PIE binaries + +Commit 5bf7eba213cacc4c1220627c91c28deff2ffecda in musl upstream fixes TLS +initialisation for static PIE binaries, but a similar fix is needed for the +dl_iterate_phdr function. This fixes, among others, exception unwinding +breakage on static PIE binaries. +--- + src/ldso/dl_iterate_phdr.c + 1 file changed, 5 insertions(+) + +diff --git a/src/ldso/dl_iterate_phdr.c b/src/ldso/dl_iterate_phdr.c +--- a/src/ldso/dl_iterate_phdr.c 2017-01-01 04:27:17.000000000 +0100 ++++ b/src/ldso/dl_iterate_phdr.c 2017-04-12 03:19:44.000000000 +0200 +@@ -4,6 +4,9 @@ + + #define AUX_CNT 38 + ++__attribute__((__weak__, __visibility__("hidden"))) ++extern const size_t _DYNAMIC[]; ++ + static int static_dl_iterate_phdr(int(*callback)(struct dl_phdr_info *info, size_t size, void *data), void *data) + { + unsigned char *p; +@@ -20,6 +23,8 @@ + phdr = (void *)p; + if (phdr->p_type == PT_PHDR) + base = aux[AT_PHDR] - phdr->p_vaddr; ++ if (phdr->p_type == PT_DYNAMIC && _DYNAMIC) ++ base = (size_t)_DYNAMIC - phdr->p_vaddr; + if (phdr->p_type == PT_TLS) + tls_phdr = phdr; + } +--- +2.12.2 diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD index a39d071f5f..cad502a1b6 100644 --- a/main/musl/APKBUILD +++ b/main/musl/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Timo Teräs pkgname=musl pkgver=1.1.16 -pkgrel=7 +pkgrel=8 pkgdesc="the musl c library (libc) implementation" url="http://www.musl-libc.org/" arch="all" @@ -48,6 +48,7 @@ source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz 0029-fix-POSIX-format-TZ-dst-transition-times-for-souther.patch 0030-fix-dlopen-dlsym-regression-opening-libs-already-loa.patch 0031-s390x-provide-a-working-sigcontext-struct-definition.patch + 0032-fix-support-for-dl_iterate_phdr-in-static-pie-binaries.patch ldconfig __stack_chk_fail_local.c @@ -199,6 +200,7 @@ dad1ed979898ddaa0a49c601160a948ba229b251307210a14240e4ebf6230b16ffc0138f396fc226 33c24b895bcf1b84d90a522328b39d5b0a4aff822d0701f2f9db07a6c44c49bb3a8b16a19150c550b4fe04fad40e9af43fdf5e1fda0201e9779a471088fe9f23 0029-fix-POSIX-format-TZ-dst-transition-times-for-souther.patch adcb5b213ebd9fc5d50cc46d4444ed64a4f928a6b4767428d7d720c6a563ba1d4a3173d6546b41379356b155a26eaad652d7b831776cc3f31e942f155db9239d 0030-fix-dlopen-dlsym-regression-opening-libs-already-loa.patch 15ad590306829d196ecdb076d0491a822f80a46fac8179c30e29ea6b9138ebf5e1501796c8b116f8182c4ad6d1216e9702d407b7d29aeff35479f6ef568638bc 0031-s390x-provide-a-working-sigcontext-struct-definition.patch +690daa7f4c7ba0d24e103299406226849ad1314e2f3ea32cc571a6cdf0bac097b24fa3efa228b03ea495d9d437c9dd90eebe7b0268f94b7e19861100f84fa66e 0032-fix-support-for-dl_iterate_phdr-in-static-pie-binaries.patch 8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig 062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c 0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c -- cgit v1.2.3