From 5bbce521b82bfc60328df0a1118bf15c3719d090 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Fri, 19 Jul 2019 15:49:07 +0000 Subject: system/musl: bump to 1.1.23 --- system/musl/APKBUILD | 16 ++---- system/musl/amalgamation.patch | 18 +----- system/musl/arm64-tls.patch | 116 -------------------------------------- system/musl/powerpc-wchar_t.patch | 26 +++++++++ 4 files changed, 33 insertions(+), 143 deletions(-) delete mode 100644 system/musl/arm64-tls.patch create mode 100644 system/musl/powerpc-wchar_t.patch diff --git a/system/musl/APKBUILD b/system/musl/APKBUILD index 1c30abdfb..7028f21ec 100644 --- a/system/musl/APKBUILD +++ b/system/musl/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: A. Wilcox pkgname=musl -pkgver=1.1.22 -pkgrel=1 +pkgver=1.1.23 +pkgrel=0 pkgdesc="System library (libc) implementation" url="https://www.musl-libc.org/" arch="all" @@ -23,10 +23,10 @@ nolibc) ;; esac source="https://www.musl-libc.org/releases/musl-$pkgver.tar.gz amalgamation.patch - arm64-tls.patch 3001-make-real-lastlog-h.patch handle-aux-at_base.patch fgetspent_r.patch + powerpc-wchar_t.patch strftime-add-l-support.patch ldconfig @@ -39,8 +39,6 @@ source="https://www.musl-libc.org/releases/musl-$pkgver.tar.gz # - CVE-2016-8859 build() { - cd "$builddir" - [ "$BOOTSTRAP" = "nocc" ] && return 0 if [ "$BOOTSTRAP" != "nolibc" ]; then @@ -65,8 +63,6 @@ build() { } package() { - cd "$builddir" - if [ "$BOOTSTRAP" = "nocc" ]; then case "$CARCH" in aarch64*) ARCH="aarch64" ;; @@ -120,12 +116,12 @@ utils() { install -D -m755 "$srcdir"/ldconfig "$subpkgdir"/sbin } -sha512sums="08a40d722672504427238e71c9e52a723c6a14735abe9581d6d4bb3f86662d5d51a3f32a6aed6420c1f9680e22a3a554a9b87ae342635be971e2db49cc9fdb87 musl-1.1.22.tar.gz -8eadf9933e729e8a6d99f667257284eaf06cb0160b40e6307ed69159c03ba4ed3c67a2943c71b5abc258bbc6c9ff321a34aa55357ebb460be9363dd605e18144 amalgamation.patch -a1127de160cbf820875d415f8fdda3c894e03748070070e282e1cf0604c883db3f8e1c311dd8c3f318ac8a158cb2183c757bcbbbd666b63676074bdec6a29983 arm64-tls.patch +sha512sums="a2278de9903852b08352d3e734a39d4616caa602496997ba843e8fea0e1c481761776745faf04536a149d1c4af416b68df681b6fbc9ae2de8794e18c2e853b09 musl-1.1.23.tar.gz +ef532aebeaa89b3274f7f75f1adaa4d1eea60f4e2822a6711c748768cc3a65a77ebd218d7a8ab41157684f7855dd4c5c2cdea7461b7569264d3517deba0ef9b2 amalgamation.patch 88ae443dbb8e0a4368235bdc3a1c5c7b718495afa75e06deb8e01becc76cb1f0d6964589e2204fc749c9c1b3190b8b9ac1ae2c0099cab8e2ce3ec877103d4332 3001-make-real-lastlog-h.patch 6a7ff16d95b5d1be77e0a0fbb245491817db192176496a57b22ab037637d97a185ea0b0d19da687da66c2a2f5578e4343d230f399d49fe377d8f008410974238 handle-aux-at_base.patch ded41235148930f8cf781538f7d63ecb0c65ea4e8ce792565f3649ee2523592a76b2a166785f0b145fc79f5852fd1fb1729a7a09110b3b8f85cba3912e790807 fgetspent_r.patch +fda015fad0d0a65efb192c08d201b2f5b2bfff18c43b551855b119a1d63213bd417a93a6b2965e68243884c5b17b34a585795cc4cace603788d37149e933cfb1 powerpc-wchar_t.patch 7ed6c620a5ea5585c323936b1ff01eb7f01a1192240706a0d0470b661a7a03ea10ed17507c59678aaedce51b7a5ea839c2f528f19f12de02119bf4e47f7c3998 strftime-add-l-support.patch cce2f1eeb61e55674469c26871a573cce61d739c3defe9c8f56f2b774f6ba5435849ad542a6714120efddc98c297098e9c98a1a424ac593df2243d4aa479f9a9 ldconfig 378d70e65bcc65bb4e1415354cecfa54b0c1146dfb24474b69e418cdbf7ad730472cd09f6f103e1c99ba6c324c9560bccdf287f5889bbc3ef0bdf0e08da47413 getent.c diff --git a/system/musl/amalgamation.patch b/system/musl/amalgamation.patch index bd8e6a141..e53290e21 100644 --- a/system/musl/amalgamation.patch +++ b/system/musl/amalgamation.patch @@ -141,7 +141,7 @@ diff --git a/src/locale/setlocale.c b/src/locale/setlocale.c index 40bc7ece..4d51cdfe 100644 --- a/src/locale/setlocale.c +++ b/src/locale/setlocale.c -@@ -25,6 +25,8 @@ char *setlocale(int cat, const char *name) +@@ -11,6 +11,8 @@ char *setlocale(int cat, const char *name) if ((unsigned)cat > LC_ALL) return 0; @@ -386,19 +386,3 @@ index 76bbd4c7..d5e70608 100644 #include #include #include -diff --git a/include/fcntl.h b/include/fcntl.h -index 4d91338b..04321887 100644 ---- a/include/fcntl.h -+++ b/include/fcntl.h -@@ -36,8 +36,9 @@ int openat(int, const char *, int, ...); - int posix_fadvise(int, off_t, off_t, int); - int posix_fallocate(int, off_t, off_t); - --#define O_SEARCH O_PATH --#define O_EXEC O_PATH -+#define O_SEARCH O_PATH -+#define O_EXEC O_PATH -+#define O_TTY_INIT 0 - - #define O_ACCMODE (03|O_SEARCH) - #define O_RDONLY 00 diff --git a/system/musl/arm64-tls.patch b/system/musl/arm64-tls.patch deleted file mode 100644 index 4a6d7f7a4..000000000 --- a/system/musl/arm64-tls.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 6104dae9088da7ffd9346671be867a43a4b03295 Mon Sep 17 00:00:00 2001 -From: Szabolcs Nagy -Date: Thu, 16 May 2019 17:15:33 +0000 -Subject: fix static tls offsets of shared libs on TLS_ABOVE_TP targets - -tls_offset should always point to the end of the allocated static tls -area, but this was not handled correctly on "tls variant 1" targets -in the dynamic linker: - -after application tls was allocated, tls_offset was aligned up, -potentially wasting tls space. (alignment may be needed at the -begining of the tls area, not at the end, but that will be fixed -separately as it is unlikely to affect real binaries.) - -when static tls was allocated for a shared library, tls_offset was -only updated with the size of the tls segment which does not include -alignment gaps, which can easily happen if the tls size update for -one library leaves tls_offset misaligned for the next one. this can -cause oob access in __copy_tls or arbitrary breakage at tls access. -(the issue was observed on aarch64 with rust binaries) ---- - ldso/dynlink.c | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - -diff --git a/ldso/dynlink.c b/ldso/dynlink.c -index ad0cdba2..967f1fd9 100644 ---- a/ldso/dynlink.c -+++ b/ldso/dynlink.c -@@ -1127,7 +1127,7 @@ static struct dso *load_library(const char *name, struct dso *needed_by) - #ifdef TLS_ABOVE_TP - p->tls.offset = tls_offset + ( (tls_align-1) & - -(tls_offset + (uintptr_t)p->tls.image) ); -- tls_offset += p->tls.size; -+ tls_offset = p->tls.offset + p->tls.size; - #else - tls_offset += p->tls.size + p->tls.align - 1; - tls_offset -= (tls_offset + (uintptr_t)p->tls.image) -@@ -1797,9 +1797,7 @@ _Noreturn void __dls3(size_t *sp) - #ifdef TLS_ABOVE_TP - app.tls.offset = GAP_ABOVE_TP; - app.tls.offset += -GAP_ABOVE_TP & (app.tls.align-1); -- tls_offset = app.tls.offset + app.tls.size -- + ( -((uintptr_t)app.tls.image + app.tls.size) -- & (app.tls.align-1) ); -+ tls_offset = app.tls.offset + app.tls.size; - #else - tls_offset = app.tls.offset = app.tls.size - + ( -((uintptr_t)app.tls.image + app.tls.size) --- -cgit v1.2.1 - -From a60b9e06861e56c0810bae0249b421e1758d281a Mon Sep 17 00:00:00 2001 -From: Szabolcs Nagy -Date: Mon, 13 May 2019 18:47:11 +0000 -Subject: fix tls offsets when p_vaddr%p_align != 0 on TLS_ABOVE_TP targets - -currently the bfd linker does not seem to create tls segments where -p_vaddr%p_align != 0, but this is valid in ELF and then the runtime -computed tls offset must satisfy - - offset%p_align == (base+p_vaddr)%p_align - -and in case of local exec tls (main executable) the smallest such -offset must be used (otherwise it is incompatible with the offset -computed by the static linker). the !TLS_ABOVE_TP case is handled -correctly (the offset is negative then in the formula). - -the ldso code for TLS_ABOVE_TP is changed so the static tls offset -of each module satisfies the formula. ---- - ldso/dynlink.c | 7 ++++--- - src/env/__init_tls.c | 3 ++- - 2 files changed, 6 insertions(+), 4 deletions(-) - -diff --git a/ldso/dynlink.c b/ldso/dynlink.c -index 967f1fd9..1398ff45 100644 ---- a/ldso/dynlink.c -+++ b/ldso/dynlink.c -@@ -1125,8 +1125,8 @@ static struct dso *load_library(const char *name, struct dso *needed_by) - p->tls_id = ++tls_cnt; - tls_align = MAXP2(tls_align, p->tls.align); - #ifdef TLS_ABOVE_TP -- p->tls.offset = tls_offset + ( (tls_align-1) & -- -(tls_offset + (uintptr_t)p->tls.image) ); -+ p->tls.offset = tls_offset + ( (p->tls.align-1) & -+ (-tls_offset + (uintptr_t)p->tls.image) ); - tls_offset = p->tls.offset + p->tls.size; - #else - tls_offset += p->tls.size + p->tls.align - 1; -@@ -1796,7 +1796,8 @@ _Noreturn void __dls3(size_t *sp) - app.tls_id = tls_cnt = 1; - #ifdef TLS_ABOVE_TP - app.tls.offset = GAP_ABOVE_TP; -- app.tls.offset += -GAP_ABOVE_TP & (app.tls.align-1); -+ app.tls.offset += (-GAP_ABOVE_TP + (uintptr_t)app.tls.image) -+ & (app.tls.align-1); - tls_offset = app.tls.offset + app.tls.size; - #else - tls_offset = app.tls.offset = app.tls.size -diff --git a/src/env/__init_tls.c b/src/env/__init_tls.c -index 5f12500c..772baba3 100644 ---- a/src/env/__init_tls.c -+++ b/src/env/__init_tls.c -@@ -115,7 +115,8 @@ static void static_init_tls(size_t *aux) - & (main_tls.align-1); - #ifdef TLS_ABOVE_TP - main_tls.offset = GAP_ABOVE_TP; -- main_tls.offset += -GAP_ABOVE_TP & (main_tls.align-1); -+ main_tls.offset += (-GAP_ABOVE_TP + (uintptr_t)main_tls.image) -+ & (main_tls.align-1); - #else - main_tls.offset = main_tls.size; - #endif --- -cgit v1.2.1 - diff --git a/system/musl/powerpc-wchar_t.patch b/system/musl/powerpc-wchar_t.patch new file mode 100644 index 000000000..62b24a5f1 --- /dev/null +++ b/system/musl/powerpc-wchar_t.patch @@ -0,0 +1,26 @@ +From 0da9cc40f861293db7baba3854b44d73658b168d Mon Sep 17 00:00:00 2001 +From: q66 +Date: Wed, 22 May 2019 13:18:53 +0200 +Subject: [PATCH] properly deal with wchar_t definition on 32-bit powerpc + +Clang defines it to be int, gcc defines it to be long. The old +code results in conflicts when building things with clang. This +same change is already incorporated for i386 in musl upstream, +so apply it to powerpc as well. + +diff --git a/arch/powerpc/bits/alltypes.h.in b/arch/powerpc/bits/alltypes.h.in +--- a/arch/powerpc/bits/alltypes.h.in ++++ b/arch/powerpc/bits/alltypes.h.in +@@ -6,8 +6,12 @@ TYPEDEF __builtin_va_list va_list; + TYPEDEF __builtin_va_list __isoc_va_list; + + #ifndef __cplusplus ++#ifdef __WCHAR_TYPE__ ++TYPEDEF __WCHAR_TYPE__ wchar_t; ++#else + TYPEDEF long wchar_t; + #endif ++#endif + + TYPEDEF float float_t; + TYPEDEF double double_t; -- cgit v1.2.3-60-g2f50