From dab79f88b138f231c0b30510823917ed0a2d1f97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Fri, 15 Aug 2014 09:51:42 +0300 Subject: main/musl: cherry-pick upstream git fixes --- ...g-of-zero-length-domain-names-in-dn_expan.patch | 29 ----- main/musl/0001-v1.1.4-to-d86af2a0.patch | 137 +++++++++++++++++++++ ...g-of-zero-length-domain-names-in-dn_expan.patch | 29 +++++ main/musl/APKBUILD | 14 ++- 4 files changed, 175 insertions(+), 34 deletions(-) delete mode 100644 main/musl/0001-fix-handling-of-zero-length-domain-names-in-dn_expan.patch create mode 100644 main/musl/0001-v1.1.4-to-d86af2a0.patch create mode 100644 main/musl/1002-fix-handling-of-zero-length-domain-names-in-dn_expan.patch diff --git a/main/musl/0001-fix-handling-of-zero-length-domain-names-in-dn_expan.patch b/main/musl/0001-fix-handling-of-zero-length-domain-names-in-dn_expan.patch deleted file mode 100644 index 266b976c16..0000000000 --- a/main/musl/0001-fix-handling-of-zero-length-domain-names-in-dn_expan.patch +++ /dev/null @@ -1,29 +0,0 @@ -From ea35594b2a54c1652bb8ffb04183180ad7325779 Mon Sep 17 00:00:00 2001 -From: Natanael Copa -Date: Wed, 13 Aug 2014 08:41:38 +0200 -Subject: [PATCH] fix handling of zero length domain names in dn_expand - -Copy a zero length string instead of returning error when trying to -expand a zero lentgh domain name (null terminator). - -This fixes a regression introduced with 56b57f37a46dab432. ---- - src/network/dn_expand.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/network/dn_expand.c b/src/network/dn_expand.c -index 849df19..3264faf 100644 ---- a/src/network/dn_expand.c -+++ b/src/network/dn_expand.c -@@ -6,7 +6,7 @@ int __dn_expand(const unsigned char *base, const unsigned char *end, const unsig - const unsigned char *p = src; - char *dend = dest + (space > 254 ? 254 : space); - int len = -1, i, j; -- if (p==end || !*p) return -1; -+ if (p==end) return -1; - /* detect reference loop using an iteration counter */ - for (i=0; i < end-base; i+=2) { - if (*p & 0xc0) { --- -2.0.4 - diff --git a/main/musl/0001-v1.1.4-to-d86af2a0.patch b/main/musl/0001-v1.1.4-to-d86af2a0.patch new file mode 100644 index 0000000000..e29d0ae981 --- /dev/null +++ b/main/musl/0001-v1.1.4-to-d86af2a0.patch @@ -0,0 +1,137 @@ +diff --git a/include/ctype.h b/include/ctype.h +index 8f0d168..a6f44df 100644 +--- a/include/ctype.h ++++ b/include/ctype.h +@@ -22,13 +22,18 @@ int isxdigit(int); + int tolower(int); + int toupper(int); + ++static __inline int __isspace(int _c) ++{ ++ return _c == ' ' || (unsigned)_c-'\t' < 5; ++} ++ + #define isalpha(a) ((((unsigned)(a)|32)-'a') < 26) + #define isdigit(a) (((unsigned)(a)-'0') < 10) + #define islower(a) (((unsigned)(a)-'a') < 26) + #define isupper(a) (((unsigned)(a)-'A') < 26) + #define isprint(a) (((unsigned)(a)-0x20) < 0x5f) + #define isgraph(a) (((unsigned)(a)-0x21) < 0x5e) +- ++#define isspace(a) __isspace(a) + + + #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ +diff --git a/include/sched.h b/include/sched.h +index 4394b64..3e34a72 100644 +--- a/include/sched.h ++++ b/include/sched.h +@@ -123,7 +123,7 @@ __CPU_op_func_S(XOR, ^) + #define CPU_XOR(d,s1,s2) CPU_XOR_S(sizeof(cpu_set_t),d,s1,s2) + #define CPU_COUNT(set) CPU_COUNT_S(sizeof(cpu_set_t),set) + #define CPU_ZERO(set) CPU_ZERO_S(sizeof(cpu_set_t),set) +-#define CPU_EQUAL(set) CPU_EQUAL_S(sizeof(cpu_set_t),set) ++#define CPU_EQUAL(s1,s2) CPU_EQUAL_S(sizeof(cpu_set_t),s1,s2) + + #endif + +diff --git a/include/stdlib.h b/include/stdlib.h +index f034c6e..db569d9 100644 +--- a/include/stdlib.h ++++ b/include/stdlib.h +@@ -144,12 +144,12 @@ int mkostemps (char *, int, int); + void *valloc (size_t); + void *memalign(size_t, size_t); + int getloadavg(double *, int); ++int clearenv(void); + #define WCOREDUMP(s) ((s) & 0x80) + #define WIFCONTINUED(s) ((s) == 0xffff) + #endif + + #ifdef _GNU_SOURCE +-int clearenv(void); + int ptsname_r(int, char *, size_t); + char *ecvt(double, int, int *, int *); + char *fcvt(double, int, int *, int *); +diff --git a/src/ctype/isspace.c b/src/ctype/isspace.c +index 7dff20d..231e907 100644 +--- a/src/ctype/isspace.c ++++ b/src/ctype/isspace.c +@@ -1,5 +1,6 @@ + #include + #include "libc.h" ++#undef isspace + + int isspace(int c) + { +diff --git a/src/env/__init_tls.c b/src/env/__init_tls.c +index 6cca968..ddc2a73 100644 +--- a/src/env/__init_tls.c ++++ b/src/env/__init_tls.c +@@ -91,12 +91,11 @@ void __init_tls(size_t *aux) + libc.tls_size = 2*sizeof(void *)+T.size+T.align+sizeof(struct pthread); + + if (libc.tls_size > sizeof builtin_tls) { ++#ifndef SYS_mmap2 ++#define SYS_mmap2 SYS_mmap ++#endif + mem = (void *)__syscall( +-#ifdef SYS_mmap2 + SYS_mmap2, +-#else +- SYS_mmap, +-#endif + 0, libc.tls_size, PROT_READ|PROT_WRITE, + MAP_ANONYMOUS|MAP_PRIVATE, -1, 0); + /* -4095...-1 cast to void * will crash on dereference anyway, +diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c +index 12f14f7..c90fe99 100644 +--- a/src/ldso/dynlink.c ++++ b/src/ldso/dynlink.c +@@ -1603,10 +1603,14 @@ static int invalid_dso_handle(void *h) + } + void *dlopen(const char *file, int mode) + { ++ strcpy(errbuf, "Dynamic loading not supported"); ++ errflag = 1; + return 0; + } + void *__dlsym(void *restrict p, const char *restrict s, void *restrict ra) + { ++ errflag = 1; ++ snprintf(errbuf, sizeof errbuf, "Symbol not found: %s", s); + return 0; + } + int __dladdr (const void *addr, Dl_info *info) +diff --git a/src/locale/pleval.c b/src/locale/pleval.c +index 961dabc..d60058d 100644 +--- a/src/locale/pleval.c ++++ b/src/locale/pleval.c +@@ -28,14 +28,6 @@ struct st { + int op; + }; + +-/* TODO: this should go into ctypes.h */ +-#undef isspace +-#define isspace(a) __isspace(a) +-static __inline int __isspace(int _c) +-{ +- return _c == ' ' || (unsigned)_c-'\t' < 5; +-} +- + static const char *skipspace(const char *s) + { + while (isspace(*s)) s++; +diff --git a/src/misc/mntent.c b/src/misc/mntent.c +index 3eafba5..a16d652 100644 +--- a/src/misc/mntent.c ++++ b/src/misc/mntent.c +@@ -10,7 +10,7 @@ FILE *setmntent(const char *name, const char *mode) + + int endmntent(FILE *f) + { +- fclose(f); ++ if (f) fclose(f); + return 1; + } + diff --git a/main/musl/1002-fix-handling-of-zero-length-domain-names-in-dn_expan.patch b/main/musl/1002-fix-handling-of-zero-length-domain-names-in-dn_expan.patch new file mode 100644 index 0000000000..266b976c16 --- /dev/null +++ b/main/musl/1002-fix-handling-of-zero-length-domain-names-in-dn_expan.patch @@ -0,0 +1,29 @@ +From ea35594b2a54c1652bb8ffb04183180ad7325779 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Wed, 13 Aug 2014 08:41:38 +0200 +Subject: [PATCH] fix handling of zero length domain names in dn_expand + +Copy a zero length string instead of returning error when trying to +expand a zero lentgh domain name (null terminator). + +This fixes a regression introduced with 56b57f37a46dab432. +--- + src/network/dn_expand.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/network/dn_expand.c b/src/network/dn_expand.c +index 849df19..3264faf 100644 +--- a/src/network/dn_expand.c ++++ b/src/network/dn_expand.c +@@ -6,7 +6,7 @@ int __dn_expand(const unsigned char *base, const unsigned char *end, const unsig + const unsigned char *p = src; + char *dend = dest + (space > 254 ? 254 : space); + int len = -1, i, j; +- if (p==end || !*p) return -1; ++ if (p==end) return -1; + /* detect reference loop using an iteration counter */ + for (i=0; i < end-base; i+=2) { + if (*p & 0xc0) { +-- +2.0.4 + diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD index 53358d4651..806e37c847 100644 --- a/main/musl/APKBUILD +++ b/main/musl/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Timo Teräs pkgname=musl pkgver=1.1.4 -pkgrel=2 +pkgrel=3 pkgdesc="the musl c library (libc) implementation" url="http://www.musl-libc.org/" arch="all" @@ -13,9 +13,10 @@ makedepends="$depends_dev" install="$pkgname.post-upgrade" subpackages="$pkgname-dev $pkgname-utils $pkgname-dbg" source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz + 0001-v1.1.4-to-d86af2a0.patch 1001-add-basic-dns-record-parsing-functions.patch + 1002-fix-handling-of-zero-length-domain-names-in-dn_expan.patch 1003-remove-ulimit-fiddling-from-setxid.patch - 0001-fix-handling-of-zero-length-domain-names-in-dn_expan.patch ldconfig getopt_long.c @@ -119,9 +120,10 @@ utils() { } md5sums="f18f3bdbe088438cd64a5313c19a7312 musl-1.1.4.tar.gz +7e6f4c4e0992f73d61963959d7fbbaa5 0001-v1.1.4-to-d86af2a0.patch 2371eb1ce057fcb709a0e6a81f0d356c 1001-add-basic-dns-record-parsing-functions.patch +4b0771addf78eb0c4f0210792c99335a 1002-fix-handling-of-zero-length-domain-names-in-dn_expan.patch 71b2a4dcc39c436a6b89173943424043 1003-remove-ulimit-fiddling-from-setxid.patch -4b0771addf78eb0c4f0210792c99335a 0001-fix-handling-of-zero-length-domain-names-in-dn_expan.patch 830d01f7821b978df770b06db3790921 ldconfig 61c6c1e84ed1df82abbe6d75e90cf21c getopt_long.c 0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c @@ -129,9 +131,10 @@ md5sums="f18f3bdbe088438cd64a5313c19a7312 musl-1.1.4.tar.gz 2b941c4251cac44988a4abfc50e21267 getent.c 45f92f8d59cf84d765de698a9578dbf4 iconv.c" sha256sums="658c65ad3c3a9b281a96c5281e75720c758d91fcaae35ab987f2fdfb4f88f5cd musl-1.1.4.tar.gz +2966fe530dfda4affca61375d16a4d03140ddf3beb39df90b9f5f0b10558eb5d 0001-v1.1.4-to-d86af2a0.patch 75053a31f6b84a64846d92c0ec631c76d7f747a9c0dc92a6dc1aa1bddfe2ea76 1001-add-basic-dns-record-parsing-functions.patch +65129391cbc63cda4387f6dae13cc91b346cf5d9a936494dbc4d4a7687af49a0 1002-fix-handling-of-zero-length-domain-names-in-dn_expan.patch fb542c2bd5081ff2f601c519edb3dac8f54ca5c888f44bc6cfb84e6565472025 1003-remove-ulimit-fiddling-from-setxid.patch -65129391cbc63cda4387f6dae13cc91b346cf5d9a936494dbc4d4a7687af49a0 0001-fix-handling-of-zero-length-domain-names-in-dn_expan.patch b4a2c06db38742e8c42c3c9838b285a7d8cdac6c091ff3df5ff9a15f1e41b9c7 ldconfig d9b644ec20bc33e81a7c52b9fcf7973d835923a69faf50f03db45534b811bd96 getopt_long.c 299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c @@ -139,9 +142,10 @@ d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c getconf.c 68373a55e89ce85c562d941ccf588337d6cc6c9c17689d695f65cd7607134bbe getent.c f79a2930a2e5bb0624321589edf8b889d1e9b603e01e6b7ae214616605b3fdd7 iconv.c" sha512sums="a46fb1db23f518beaa959e9bebcb3bf0574e583c197792d30dcd52b3974e3c285594984207043d317859fc5552f1d303a5686e9fbe3b8825df6346de7f917f9f musl-1.1.4.tar.gz +6ef512bd4c05ae3a24493c4cffeac71953bb7383aaf88d2012f95b1e13dfa5f09ad3fc24b7f0d08e0d3788bcdf7195a1a8e639ec56b2ac01551a403398ac003e 0001-v1.1.4-to-d86af2a0.patch 5b8ffa0a50419581adbf6ce2dae5797774022551c6331fa5aa2ff13635eb72b74eedd8a92cb478d45d73e1956af2f588669681ac414f3a255abd4d8ba8579448 1001-add-basic-dns-record-parsing-functions.patch +3ffe3eb575ddc0f17abb952a1effd1545fd8d81c019b2f700f74d811f5c076ae20c332df755866c74dfffa9909e7900e667d3d73992d0ca85279056ce623fee3 1002-fix-handling-of-zero-length-domain-names-in-dn_expan.patch dae010b45419fcab64410568466f659cdc874e63113025e2cbc2fbab047b470fec23851ecbef08886505924482a069caf37c16b483b6922535fbd31832f1c4a3 1003-remove-ulimit-fiddling-from-setxid.patch -3ffe3eb575ddc0f17abb952a1effd1545fd8d81c019b2f700f74d811f5c076ae20c332df755866c74dfffa9909e7900e667d3d73992d0ca85279056ce623fee3 0001-fix-handling-of-zero-length-domain-names-in-dn_expan.patch 8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig 140f3f20d30bd95ebce8c41b8cc7f616c6cbedf4ea06c729c21014e74f6043796825cc40ebc5180620ea38173afdba23f09ebf6d8b11fa05440b14d23764fca9 getopt_long.c 062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c -- cgit v1.2.3