From 746dedd0692115e85edce087178d57893632fd16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Tue, 1 Nov 2016 10:29:29 +0200 Subject: main/musl: cherry-pick various upstream fixes, add pthread_set_attr_default_np --- ...-integer-overflow-checks-in-regexec-buffe.patch | 73 ---- .../0001-use-dynamic-buffer-for-getmntent.patch | 66 ---- ...-ttyname-refers-to-the-same-file-as-the-f.patch | 50 +++ ...8bit-long-double-inverse-trigonometric-fu.patch | 32 ++ .../0003-fix-FFSYNC-by-changing-it-to-O_SYNC.patch | 26 ++ ...ze-fix-returning-hard-instead-of-soft-rli.patch | 24 ++ .../0005-restore-_Noreturn-to-__assert_fail.patch | 48 +++ ...regression-with-alt-form-octal-zero-flag-.patch | 33 ++ ...-ifru_data-and-ifcu_buf-types-in-net-if.h.patch | 36 ++ main/musl/0008-fix-if_indextoname-error-case.patch | 37 ++ ...-_unlocked-and-wcsftime_l-prototypes-to-w.patch | 40 +++ ...factor-fflush-and-make-fflush_unlocked-an.patch | 102 ++++++ ...fined-behavior-in-sched.h-cpu_set_t-usage.patch | 44 +++ ...etservby-_r-result-pointer-value-on-error.patch | 42 +++ .../0013-fix-strftime-y-for-negative-tm_year.patch | 24 ++ ...-integer-overflow-checks-in-regexec-buffe.patch | 73 ++++ ...-with-haystack-strings-longer-than-INT_MA.patch | 190 ++++++++++ ...-overflow-in-float-printf-needed-precisio.patch | 37 ++ ...-overflows-and-uncaught-EOVERFLOW-in-prin.patch | 392 +++++++++++++++++++++ .../musl/0018-fix-clock_nanosleep-error-case.patch | 31 ++ .../0018-use-dynamic-buffer-for-getmntent.patch | 67 ++++ main/musl/0019-add-pthread_setname_np.patch | 59 ++++ ...at-formatting-of-some-exact-halfway-cases.patch | 31 ++ ...pt_long_only-misinterpreting-as-an-option.patch | 25 ++ ...gratuitous-undefined-behavior-in-strptime.patch | 34 ++ ...and-strtof-rounding-with-many-trailing-ze.patch | 37 ++ ...int-optimization-in-non-nearest-rounding-.patch | 40 +++ ...roblem-in-previous-strtod-non-nearest-rou.patch | 35 ++ ...-for-pthread_-get-set-attr_default_np-GNU.patch | 95 +++++ main/musl/APKBUILD | 120 ++++++- 30 files changed, 1794 insertions(+), 149 deletions(-) delete mode 100644 main/musl/0001-fix-missing-integer-overflow-checks-in-regexec-buffe.patch delete mode 100644 main/musl/0001-use-dynamic-buffer-for-getmntent.patch create mode 100644 main/musl/0001-verify-that-ttyname-refers-to-the-same-file-as-the-f.patch create mode 100644 main/musl/0002-math-fix-128bit-long-double-inverse-trigonometric-fu.patch create mode 100644 main/musl/0003-fix-FFSYNC-by-changing-it-to-O_SYNC.patch create mode 100644 main/musl/0004-getdtablesize-fix-returning-hard-instead-of-soft-rli.patch create mode 100644 main/musl/0005-restore-_Noreturn-to-__assert_fail.patch create mode 100644 main/musl/0006-fix-printf-regression-with-alt-form-octal-zero-flag-.patch create mode 100644 main/musl/0007-fix-ifru_data-and-ifcu_buf-types-in-net-if.h.patch create mode 100644 main/musl/0008-fix-if_indextoname-error-case.patch create mode 100644 main/musl/0009-add-missing-_unlocked-and-wcsftime_l-prototypes-to-w.patch create mode 100644 main/musl/0010-simplify-refactor-fflush-and-make-fflush_unlocked-an.patch create mode 100644 main/musl/0011-fix-undefined-behavior-in-sched.h-cpu_set_t-usage.patch create mode 100644 main/musl/0012-fix-getservby-_r-result-pointer-value-on-error.patch create mode 100644 main/musl/0013-fix-strftime-y-for-negative-tm_year.patch create mode 100644 main/musl/0014-fix-missing-integer-overflow-checks-in-regexec-buffe.patch create mode 100644 main/musl/0015-fix-regexec-with-haystack-strings-longer-than-INT_MA.patch create mode 100644 main/musl/0016-fix-integer-overflow-in-float-printf-needed-precisio.patch create mode 100644 main/musl/0017-fix-integer-overflows-and-uncaught-EOVERFLOW-in-prin.patch create mode 100644 main/musl/0018-fix-clock_nanosleep-error-case.patch create mode 100644 main/musl/0018-use-dynamic-buffer-for-getmntent.patch create mode 100644 main/musl/0019-add-pthread_setname_np.patch create mode 100644 main/musl/0020-fix-float-formatting-of-some-exact-halfway-cases.patch create mode 100644 main/musl/0021-fix-getopt_long_only-misinterpreting-as-an-option.patch create mode 100644 main/musl/0022-fix-gratuitous-undefined-behavior-in-strptime.patch create mode 100644 main/musl/0023-fix-strtod-and-strtof-rounding-with-many-trailing-ze.patch create mode 100644 main/musl/0024-fix-strtod-int-optimization-in-non-nearest-rounding-.patch create mode 100644 main/musl/0025-fix-minor-problem-in-previous-strtod-non-nearest-rou.patch create mode 100644 main/musl/1001-add-support-for-pthread_-get-set-attr_default_np-GNU.patch (limited to 'main/musl') diff --git a/main/musl/0001-fix-missing-integer-overflow-checks-in-regexec-buffe.patch b/main/musl/0001-fix-missing-integer-overflow-checks-in-regexec-buffe.patch deleted file mode 100644 index 2b8316c389..0000000000 --- a/main/musl/0001-fix-missing-integer-overflow-checks-in-regexec-buffe.patch +++ /dev/null @@ -1,73 +0,0 @@ -From c3edc06d1e1360f3570db9155d6b318ae0d0f0f7 Mon Sep 17 00:00:00 2001 -From: Rich Felker -Date: Thu, 6 Oct 2016 18:34:58 -0400 -Subject: [PATCH] fix missing integer overflow checks in regexec buffer size - computations - -most of the possible overflows were already ruled out in practice by -regcomp having already succeeded performing larger allocations. -however at least the num_states*num_tags multiplication can clearly -overflow in practice. for safety, check them all, and use the proper -type, size_t, rather than int. - -also improve comments, use calloc in place of malloc+memset, and -remove bogus casts. ---- - src/regex/regexec.c | 23 ++++++++++++++++++----- - 1 file changed, 18 insertions(+), 5 deletions(-) - -diff --git a/src/regex/regexec.c b/src/regex/regexec.c -index 16c5d0a..dd52319 100644 ---- a/src/regex/regexec.c -+++ b/src/regex/regexec.c -@@ -34,6 +34,7 @@ - #include - #include - #include -+#include - - #include - -@@ -206,11 +207,24 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, - - /* Allocate memory for temporary data required for matching. This needs to - be done for every matching operation to be thread safe. This allocates -- everything in a single large block from the stack frame using alloca() -- or with malloc() if alloca is unavailable. */ -+ everything in a single large block with calloc(). */ - { -- int tbytes, rbytes, pbytes, xbytes, total_bytes; -+ size_t tbytes, rbytes, pbytes, xbytes, total_bytes; - char *tmp_buf; -+ -+ /* Ensure that tbytes and xbytes*num_states cannot overflow, and that -+ * they don't contribute more than 1/8 of SIZE_MAX to total_bytes. */ -+ if (num_tags > SIZE_MAX/(8 * sizeof(int) * tnfa->num_states)) -+ goto error_exit; -+ -+ /* Likewise check rbytes. */ -+ if (tnfa->num_states+1 > SIZE_MAX/(8 * sizeof(*reach_next))) -+ goto error_exit; -+ -+ /* Likewise check pbytes. */ -+ if (tnfa->num_states > SIZE_MAX/(8 * sizeof(*reach_pos))) -+ goto error_exit; -+ - /* Compute the length of the block we need. */ - tbytes = sizeof(*tmp_tags) * num_tags; - rbytes = sizeof(*reach_next) * (tnfa->num_states + 1); -@@ -221,10 +235,9 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, - + (rbytes + xbytes * tnfa->num_states) * 2 + tbytes + pbytes; - - /* Allocate the memory. */ -- buf = xmalloc((unsigned)total_bytes); -+ buf = calloc(total_bytes, 1); - if (buf == NULL) - return REG_ESPACE; -- memset(buf, 0, (size_t)total_bytes); - - /* Get the various pointers within tmp_buf (properly aligned). */ - tmp_tags = (void *)buf; --- -2.10.0 - diff --git a/main/musl/0001-use-dynamic-buffer-for-getmntent.patch b/main/musl/0001-use-dynamic-buffer-for-getmntent.patch deleted file mode 100644 index 12feaa8266..0000000000 --- a/main/musl/0001-use-dynamic-buffer-for-getmntent.patch +++ /dev/null @@ -1,66 +0,0 @@ -From c0dd2db34a8a5d51699406a90a4f87cb3129d5a1 Mon Sep 17 00:00:00 2001 -From: Natanael Copa -Date: Thu, 8 Sep 2016 09:06:22 +0200 -Subject: [PATCH] use dynamic buffer for getmntent - -overlayfs may have fairly long lines so we use getline to allocate a -buffer dynamically. The buffer will be allocated on first use, expand as -needed, but will never be free'ed. - -Downstream bug: http://bugs.alpinelinux.org/issues/5703 - -Signed-off-by: Natanael Copa ---- - src/misc/mntent.c | 16 ++++++++++++---- - 1 file changed, 12 insertions(+), 4 deletions(-) - -diff --git a/src/misc/mntent.c b/src/misc/mntent.c -index a16d652..722a030 100644 ---- a/src/misc/mntent.c -+++ b/src/misc/mntent.c -@@ -3,6 +3,11 @@ - #include - #include - -+static char *internal_buf = NULL; -+static size_t internal_bufsize = 0; -+ -+#define SENTINEL (char *)&internal_buf -+ - FILE *setmntent(const char *name, const char *mode) - { - return fopen(name, mode); -@@ -16,13 +21,17 @@ int endmntent(FILE *f) - - struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int buflen) - { -- int cnt, n[8]; -+ int cnt, n[8], use_internal = (linebuf == SENTINEL); - - mnt->mnt_freq = 0; - mnt->mnt_passno = 0; - - do { -- fgets(linebuf, buflen, f); -+ if (use_internal) { -+ getline(&internal_buf, &internal_bufsize, f); -+ linebuf = internal_buf; -+ } else -+ fgets(linebuf, buflen, f); - if (feof(f) || ferror(f)) return 0; - if (!strchr(linebuf, '\n')) { - fscanf(f, "%*[^\n]%*[\n]"); -@@ -49,9 +58,8 @@ struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int bufle - - struct mntent *getmntent(FILE *f) - { -- static char linebuf[256]; - static struct mntent mnt; -- return getmntent_r(f, &mnt, linebuf, sizeof linebuf); -+ return getmntent_r(f, &mnt, SENTINEL, 0); - } - - int addmntent(FILE *f, const struct mntent *mnt) --- -2.10.0 - diff --git a/main/musl/0001-verify-that-ttyname-refers-to-the-same-file-as-the-f.patch b/main/musl/0001-verify-that-ttyname-refers-to-the-same-file-as-the-f.patch new file mode 100644 index 0000000000..83b2e2a42d --- /dev/null +++ b/main/musl/0001-verify-that-ttyname-refers-to-the-same-file-as-the-f.patch @@ -0,0 +1,50 @@ +From 0a950dcf15bb9f7274c804dca490e9e20e475f3e Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy +Date: Sat, 20 Aug 2016 21:04:31 +0200 +Subject: [PATCH 1/1] verify that ttyname refers to the same file as the fd + +linux containers use separate mount namespace so the /proc +symlink might not point to the right device if the fd was +opened in the parent namespace, in this case return ENOENT. +--- + src/unistd/ttyname_r.c | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +diff --git a/src/unistd/ttyname_r.c b/src/unistd/ttyname_r.c +index 8bac7b2..a38ba4f 100644 +--- a/src/unistd/ttyname_r.c ++++ b/src/unistd/ttyname_r.c +@@ -1,10 +1,12 @@ + #include + #include ++#include + + void __procfdname(char *, unsigned); + + int ttyname_r(int fd, char *name, size_t size) + { ++ struct stat st1, st2; + char procname[sizeof "/proc/self/fd/" + 3*sizeof(int) + 2]; + ssize_t l; + +@@ -15,8 +17,13 @@ int ttyname_r(int fd, char *name, size_t size) + + if (l < 0) return errno; + else if (l == size) return ERANGE; +- else { +- name[l] = 0; +- return 0; +- } ++ ++ name[l] = 0; ++ ++ if (stat(name, &st1) || fstat(fd, &st2)) ++ return errno; ++ if (st1.st_dev != st2.st_dev || st1.st_ino != st2.st_ino) ++ return ENOENT; ++ ++ return 0; + } +-- +2.10.1 + diff --git a/main/musl/0002-math-fix-128bit-long-double-inverse-trigonometric-fu.patch b/main/musl/0002-math-fix-128bit-long-double-inverse-trigonometric-fu.patch new file mode 100644 index 0000000000..ea9d1f19eb --- /dev/null +++ b/main/musl/0002-math-fix-128bit-long-double-inverse-trigonometric-fu.patch @@ -0,0 +1,32 @@ +From 5b5db97f7e80bde2678aed72336a28375e800354 Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy +Date: Tue, 23 Aug 2016 21:47:53 +0200 +Subject: [PATCH 2/2] math: fix 128bit long double inverse trigonometric + functions + +there was a copy paste error that could cause large ulp errors +in atan2l, atanl, asinl and acosl on aarch64, mips64 and mipsn32. + +(the implementation is from freebsd fdlibm, but the tail end +of the polynomial was wrong. 128 bit long double functions +are not yet tested so this went undetected.) +--- + src/math/__invtrigl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/math/__invtrigl.c b/src/math/__invtrigl.c +index ef7f4e1..48f83aa 100644 +--- a/src/math/__invtrigl.c ++++ b/src/math/__invtrigl.c +@@ -57,7 +57,7 @@ long double __invtrigl_R(long double z) + { + long double p, q; + p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*(pS5+z*(pS6+z*(pS7+z*(pS8+z*pS9))))))))); +- q = 1.0+z*(qS1+z*(qS2+z*(qS3+z*(qS4+z*(qS5+z*(pS6+z*(pS7+z*(pS8+z*pS9)))))))); ++ q = 1.0+z*(qS1+z*(qS2+z*(qS3+z*(qS4+z*(qS5+z*(qS6+z*(qS7+z*(qS8+z*qS9)))))))); + return p/q; + } + #endif +-- +2.10.1 + diff --git a/main/musl/0003-fix-FFSYNC-by-changing-it-to-O_SYNC.patch b/main/musl/0003-fix-FFSYNC-by-changing-it-to-O_SYNC.patch new file mode 100644 index 0000000000..ba0415efba --- /dev/null +++ b/main/musl/0003-fix-FFSYNC-by-changing-it-to-O_SYNC.patch @@ -0,0 +1,26 @@ +From c1f4ed150137d793c9d07356305a89e8785e7e02 Mon Sep 17 00:00:00 2001 +From: Duncan Overbruck +Date: Thu, 18 Aug 2016 17:06:16 +0200 +Subject: [PATCH 3/3] fix FFSYNC by changing it to O_SYNC + +O_FSYNC was never defined and is legacy/wrong, nothing seems to use it. +--- + include/fcntl.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/fcntl.h b/include/fcntl.h +index e683e4d..0e165ca 100644 +--- a/include/fcntl.h ++++ b/include/fcntl.h +@@ -99,7 +99,7 @@ int posix_fallocate(int, off_t, off_t); + #define AT_EMPTY_PATH 0x1000 + + #define FAPPEND O_APPEND +-#define FFSYNC O_FSYNC ++#define FFSYNC O_SYNC + #define FASYNC O_ASYNC + #define FNONBLOCK O_NONBLOCK + #define FNDELAY O_NDELAY +-- +2.10.1 + diff --git a/main/musl/0004-getdtablesize-fix-returning-hard-instead-of-soft-rli.patch b/main/musl/0004-getdtablesize-fix-returning-hard-instead-of-soft-rli.patch new file mode 100644 index 0000000000..1ea0965f7c --- /dev/null +++ b/main/musl/0004-getdtablesize-fix-returning-hard-instead-of-soft-rli.patch @@ -0,0 +1,24 @@ +From 397586625e71d166f493f16bfe04f3005ae464c3 Mon Sep 17 00:00:00 2001 +From: Olivier Brunel +Date: Sat, 13 Aug 2016 20:31:49 +0200 +Subject: [PATCH 4/4] getdtablesize: fix returning hard instead of soft rlimit + +This makes the result consistent with sysconf(_SC_OPEN_MAX). +--- + src/legacy/getdtablesize.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/legacy/getdtablesize.c b/src/legacy/getdtablesize.c +index 682da6d..b30c193 100644 +--- a/src/legacy/getdtablesize.c ++++ b/src/legacy/getdtablesize.c +@@ -7,5 +7,5 @@ int getdtablesize(void) + { + struct rlimit rl; + getrlimit(RLIMIT_NOFILE, &rl); +- return rl.rlim_max < INT_MAX ? rl.rlim_max : INT_MAX; ++ return rl.rlim_cur < INT_MAX ? rl.rlim_cur : INT_MAX; + } +-- +2.10.1 + diff --git a/main/musl/0005-restore-_Noreturn-to-__assert_fail.patch b/main/musl/0005-restore-_Noreturn-to-__assert_fail.patch new file mode 100644 index 0000000000..c02dc267a4 --- /dev/null +++ b/main/musl/0005-restore-_Noreturn-to-__assert_fail.patch @@ -0,0 +1,48 @@ +From e738b8cbe64b6dd3ed9f47b6d4cd7eb2c422b38d Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Tue, 30 Aug 2016 16:39:54 -0400 +Subject: [PATCH 5/5] restore _Noreturn to __assert_fail + +this reverts commit 2c1f8fd5da3306fd7c8a2267467e44eb61f12dd4. without +the _Noreturn attribute, the compiler cannot use asserts to perform +reachability/range analysis. this leads to missed optimizations and +spurious warnings. + +the original backtrace problem that prompted the removal of _Noreturn +was not clearly documented at the time, but it seems to happen only +when libc was built without -g, which also breaks many other +backtracing cases. +--- + include/assert.h | 2 +- + src/exit/assert.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/assert.h b/include/assert.h +index e679adb..d14ec94 100644 +--- a/include/assert.h ++++ b/include/assert.h +@@ -16,7 +16,7 @@ + extern "C" { + #endif + +-void __assert_fail (const char *, const char *, int, const char *); ++_Noreturn void __assert_fail (const char *, const char *, int, const char *); + + #ifdef __cplusplus + } +diff --git a/src/exit/assert.c b/src/exit/assert.c +index e87442a..49b0dc3 100644 +--- a/src/exit/assert.c ++++ b/src/exit/assert.c +@@ -1,7 +1,7 @@ + #include + #include + +-void __assert_fail(const char *expr, const char *file, int line, const char *func) ++_Noreturn void __assert_fail(const char *expr, const char *file, int line, const char *func) + { + fprintf(stderr, "Assertion failed: %s (%s: %s: %d)\n", expr, file, func, line); + fflush(NULL); +-- +2.10.1 + diff --git a/main/musl/0006-fix-printf-regression-with-alt-form-octal-zero-flag-.patch b/main/musl/0006-fix-printf-regression-with-alt-form-octal-zero-flag-.patch new file mode 100644 index 0000000000..918155bb85 --- /dev/null +++ b/main/musl/0006-fix-printf-regression-with-alt-form-octal-zero-flag-.patch @@ -0,0 +1,33 @@ +From 78897b0dc00b7cd5c29af5e0b7eebf2396d8dce0 Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Fri, 16 Sep 2016 17:40:08 -0400 +Subject: [PATCH 06/11] fix printf regression with alt-form octal, zero flag, + and field width + +commit b91cdbe2bc8b626aa04dc6e3e84345accf34e4b1, in fixing another +issue, changed the logic for how alt-form octal adds the leading zero +to adjust the precision rather than using a prefix character. this +wrongly suppressed the zero flag by mimicing an explicit precision +given by the format string. switch back to using a prefix character. + +based on bug report and patch by Dmitry V. Levin, but simplified. +--- + src/stdio/vfprintf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c +index 2ecf769..e439a07 100644 +--- a/src/stdio/vfprintf.c ++++ b/src/stdio/vfprintf.c +@@ -570,7 +570,7 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, + if (0) { + case 'o': + a = fmt_o(arg.i, z); +- if ((fl&ALT_FORM) && p +Date: Fri, 16 Sep 2016 13:34:24 -0400 +Subject: [PATCH 07/11] fix ifru_data and ifcu_buf types in net/if.h + +glibc, freebsd, and openbsd use character pointers (caddr_t) for +these fields. only linux uses void pointer for the ifru_data type. +--- + include/net/if.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/net/if.h b/include/net/if.h +index 1a4059d..2f2fcc1 100644 +--- a/include/net/if.h ++++ b/include/net/if.h +@@ -89,7 +89,7 @@ struct ifreq { + struct ifmap ifru_map; + char ifru_slave[IFNAMSIZ]; + char ifru_newname[IFNAMSIZ]; +- void *ifru_data; ++ char *ifru_data; + } ifr_ifru; + }; + +@@ -116,7 +116,7 @@ struct ifreq { + struct ifconf { + int ifc_len; + union { +- void *ifcu_buf; ++ char *ifcu_buf; + struct ifreq *ifcu_req; + } ifc_ifcu; + }; +-- +2.10.1 + diff --git a/main/musl/0008-fix-if_indextoname-error-case.patch b/main/musl/0008-fix-if_indextoname-error-case.patch new file mode 100644 index 0000000000..e778996366 --- /dev/null +++ b/main/musl/0008-fix-if_indextoname-error-case.patch @@ -0,0 +1,37 @@ +From 32055d52ca43d867d6dbb763dc5213a8d3536a23 Mon Sep 17 00:00:00 2001 +From: Daniel Sabogal +Date: Thu, 15 Sep 2016 11:27:30 -0400 +Subject: [PATCH 08/11] fix if_indextoname error case + +posix requires errno to be set to ENXIO if the interface does not exist. +linux returns ENODEV instead so we handle this. +--- + src/network/if_indextoname.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/network/if_indextoname.c b/src/network/if_indextoname.c +index 6ee7f13..3b368bf 100644 +--- a/src/network/if_indextoname.c ++++ b/src/network/if_indextoname.c +@@ -3,6 +3,7 @@ + #include + #include + #include ++#include + #include "syscall.h" + + char *if_indextoname(unsigned index, char *name) +@@ -14,5 +15,9 @@ char *if_indextoname(unsigned index, char *name) + ifr.ifr_ifindex = index; + r = ioctl(fd, SIOCGIFNAME, &ifr); + __syscall(SYS_close, fd); +- return r < 0 ? 0 : strncpy(name, ifr.ifr_name, IF_NAMESIZE); ++ if (r < 0) { ++ if (errno == ENODEV) errno = ENXIO; ++ return 0; ++ } ++ return strncpy(name, ifr.ifr_name, IF_NAMESIZE); + } +-- +2.10.1 + diff --git a/main/musl/0009-add-missing-_unlocked-and-wcsftime_l-prototypes-to-w.patch b/main/musl/0009-add-missing-_unlocked-and-wcsftime_l-prototypes-to-w.patch new file mode 100644 index 0000000000..fca0fcb406 --- /dev/null +++ b/main/musl/0009-add-missing-_unlocked-and-wcsftime_l-prototypes-to-w.patch @@ -0,0 +1,40 @@ +From 5505f6afae9acf37ef565c68a07ca3df7b1ae2cb Mon Sep 17 00:00:00 2001 +From: Daniel Sabogal +Date: Fri, 9 Sep 2016 21:23:17 -0400 +Subject: [PATCH 09/11] add missing *_unlocked and wcsftime_l prototypes to + wchar.h + +these functions had been implemented, but prototypes were not made available +--- + include/wchar.h | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/include/wchar.h b/include/wchar.h +index 0167dce..3e6db5f 100644 +--- a/include/wchar.h ++++ b/include/wchar.h +@@ -136,6 +136,21 @@ size_t wcsftime (wchar_t *__restrict, size_t, const wchar_t *__restrict, const s + + #undef iswdigit + ++#if defined(_GNU_SOURCE) ++wint_t fgetwc_unlocked (FILE *); ++wint_t getwc_unlocked (FILE *); ++wint_t getwchar_unlocked (void); ++wint_t fputwc_unlocked (wchar_t, FILE *); ++wint_t putwc_unlocked (wchar_t, FILE *); ++wint_t putwchar_unlocked (wchar_t); ++wchar_t *fgetws_unlocked (wchar_t *__restrict, int, FILE *__restrict); ++int fputws_unlocked (const wchar_t *__restrict, FILE *__restrict); ++#endif ++ ++#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) ++size_t wcsftime_l (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict, locale_t); ++#endif ++ + #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + FILE *open_wmemstream(wchar_t **, size_t *); +-- +2.10.1 + diff --git a/main/musl/0010-simplify-refactor-fflush-and-make-fflush_unlocked-an.patch b/main/musl/0010-simplify-refactor-fflush-and-make-fflush_unlocked-an.patch new file mode 100644 index 0000000000..ba6483bb78 --- /dev/null +++ b/main/musl/0010-simplify-refactor-fflush-and-make-fflush_unlocked-an.patch @@ -0,0 +1,102 @@ +From c002668eb0352e619ea7064e4940b397b4a6e68d Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Sun, 18 Sep 2016 21:45:47 -0400 +Subject: [PATCH 10/11] simplify/refactor fflush and make fflush_unlocked an + alias for fflush + +previously, fflush_unlocked was an alias for an internal backend that +was called by fflush, either for its argument or in a loop for each +file if a null pointer was passed. since the logic for the latter was +in the main fflush function, fflush_unlocked crashed when passed a +null pointer, rather than flushing all open files. since +fflush_unlocked is not a standard function and has no specification, +it's not clear whether it should be expected to accept null pointers +like fflush does, but a reasonable argument could be made that it +should. + +this patch eliminates the helper function, simplifying fflush, and +makes fflush_unlocked an alias for fflush, which is valid because the +two functions agree in their behavior in all cases where their +behavior is defined (the unlocked version has undefined behavior if +another thread could hold locks). +--- + src/stdio/fflush.c | 53 +++++++++++++++++++++++------------------------------ + 1 file changed, 23 insertions(+), 30 deletions(-) + +diff --git a/src/stdio/fflush.c b/src/stdio/fflush.c +index 3f462c8..c288106 100644 +--- a/src/stdio/fflush.c ++++ b/src/stdio/fflush.c +@@ -1,11 +1,30 @@ + #include "stdio_impl.h" + +-static int __fflush_unlocked(FILE *f) ++/* stdout.c will override this if linked */ ++static FILE *volatile dummy = 0; ++weak_alias(dummy, __stdout_used); ++ ++int fflush(FILE *f) + { ++ if (!f) { ++ int r = __stdout_used ? fflush(__stdout_used) : 0; ++ ++ for (f=*__ofl_lock(); f; f=f->next) ++ if (f->wpos > f->wbase) r |= fflush(f); ++ __ofl_unlock(); ++ ++ return r; ++ } ++ ++ FLOCK(f); ++ + /* If writing, flush output */ + if (f->wpos > f->wbase) { + f->write(f, 0, 0); +- if (!f->wpos) return EOF; ++ if (!f->wpos) { ++ FUNLOCK(f); ++ return EOF; ++ } + } + + /* If reading, sync position, per POSIX */ +@@ -15,34 +34,8 @@ static int __fflush_unlocked(FILE *f) + f->wpos = f->wbase = f->wend = 0; + f->rpos = f->rend = 0; + ++ FUNLOCK(f); + return 0; + } + +-/* stdout.c will override this if linked */ +-static FILE *volatile dummy = 0; +-weak_alias(dummy, __stdout_used); +- +-int fflush(FILE *f) +-{ +- int r; +- +- if (f) { +- FLOCK(f); +- r = __fflush_unlocked(f); +- FUNLOCK(f); +- return r; +- } +- +- r = __stdout_used ? fflush(__stdout_used) : 0; +- +- for (f=*__ofl_lock(); f; f=f->next) { +- FLOCK(f); +- if (f->wpos > f->wbase) r |= __fflush_unlocked(f); +- FUNLOCK(f); +- } +- __ofl_unlock(); +- +- return r; +-} +- +-weak_alias(__fflush_unlocked, fflush_unlocked); ++weak_alias(fflush, fflush_unlocked); +-- +2.10.1 + diff --git a/main/musl/0011-fix-undefined-behavior-in-sched.h-cpu_set_t-usage.patch b/main/musl/0011-fix-undefined-behavior-in-sched.h-cpu_set_t-usage.patch new file mode 100644 index 0000000000..7295743ed0 --- /dev/null +++ b/main/musl/0011-fix-undefined-behavior-in-sched.h-cpu_set_t-usage.patch @@ -0,0 +1,44 @@ +From 66570ec9c465e3c6c5d6dbd7dd42e45041a39288 Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Mon, 19 Sep 2016 11:15:51 -0400 +Subject: [PATCH 11/11] fix undefined behavior in sched.h cpu_set_t usage + +since cpu sets can be dynamically allocated and have variable size, +accessing their contents via ->__bits is not valid; performing pointer +arithmetic outside the range of the size of the declared __bits array +results in undefined beahavior. instead, only use cpu_set_t for +fixed-size cpu set objects (instantiated by the caller) and as an +abstract pointer type for dynamically allocated ones. perform all +accesses simply by casting the abstract pointer type cpuset_t * back +to unsigned long *. +--- + include/sched.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/include/sched.h b/include/sched.h +index af82d6c..d1cccb7 100644 +--- a/include/sched.h ++++ b/include/sched.h +@@ -82,7 +82,7 @@ int sched_getaffinity(pid_t, size_t, cpu_set_t *); + int sched_setaffinity(pid_t, size_t, const cpu_set_t *); + + #define __CPU_op_S(i, size, set, op) ( (i)/8U >= (size) ? 0 : \ +- ((set)->__bits[(i)/8/sizeof(long)] op (1UL<<((i)%(8*sizeof(long))))) ) ++ (((unsigned long *)(set))[(i)/8/sizeof(long)] op (1UL<<((i)%(8*sizeof(long))))) ) + + #define CPU_SET_S(i, size, set) __CPU_op_S(i, size, set, |=) + #define CPU_CLR_S(i, size, set) __CPU_op_S(i, size, set, &=~) +@@ -94,8 +94,8 @@ static __inline void __CPU_##func##_S(size_t __size, cpu_set_t *__dest, \ + { \ + size_t __i; \ + for (__i=0; __i<__size/sizeof(long); __i++) \ +- __dest->__bits[__i] = __src1->__bits[__i] \ +- op __src2->__bits[__i] ; \ ++ ((unsigned long *)__dest)[__i] = ((unsigned long *)__src1)[__i] \ ++ op ((unsigned long *)__src2)[__i] ; \ + } + + __CPU_op_func_S(AND, &) +-- +2.10.1 + diff --git a/main/musl/0012-fix-getservby-_r-result-pointer-value-on-error.patch b/main/musl/0012-fix-getservby-_r-result-pointer-value-on-error.patch new file mode 100644 index 0000000000..4b258dbfdd --- /dev/null +++ b/main/musl/0012-fix-getservby-_r-result-pointer-value-on-error.patch @@ -0,0 +1,42 @@ +From 8d7a3f40c8de414122eb8eb2131291782ee8ed15 Mon Sep 17 00:00:00 2001 +From: Daniel Sabogal +Date: Fri, 23 Sep 2016 21:10:07 -0400 +Subject: [PATCH 12/18] fix getservby*_r result pointer value on error + +this is a clone of the fix to the gethostby*_r functions in +commit fe82bb9b921be34370e6b71a1c6f062c20999ae0. the man pages +document that the getservby*_r functions set this pointer to +NULL if there was an error or if no record was found. +--- + src/network/getservbyname_r.c | 2 ++ + src/network/getservbyport_r.c | 1 + + 2 files changed, 3 insertions(+) + +diff --git a/src/network/getservbyname_r.c b/src/network/getservbyname_r.c +index 056c2f3..ad3d616 100644 +--- a/src/network/getservbyname_r.c ++++ b/src/network/getservbyname_r.c +@@ -15,6 +15,8 @@ int getservbyname_r(const char *name, const char *prots, + struct service servs[MAXSERVS]; + int cnt, proto, align; + ++ *res = 0; ++ + /* Align buffer */ + align = -(uintptr_t)buf & ALIGN-1; + if (buflen < 2*sizeof(char *)+align) +diff --git a/src/network/getservbyport_r.c b/src/network/getservbyport_r.c +index a0a7cae..0ae0e41 100644 +--- a/src/network/getservbyport_r.c ++++ b/src/network/getservbyport_r.c +@@ -20,6 +20,7 @@ int getservbyport_r(int port, const char *prots, + if (r) r = getservbyport_r(port, "udp", se, buf, buflen, res); + return r; + } ++ *res = 0; + + /* Align buffer */ + i = (uintptr_t)buf & sizeof(char *)-1; +-- +2.10.1 + diff --git a/main/musl/0013-fix-strftime-y-for-negative-tm_year.patch b/main/musl/0013-fix-strftime-y-for-negative-tm_year.patch new file mode 100644 index 0000000000..f8fbc635c1 --- /dev/null +++ b/main/musl/0013-fix-strftime-y-for-negative-tm_year.patch @@ -0,0 +1,24 @@ +From 583ea83541dcc6481c7a1bd1a9b485526bad84a1 Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy +Date: Tue, 4 Oct 2016 17:14:57 +0000 +Subject: [PATCH 13/18] fix strftime %y for negative tm_year + +--- + src/time/strftime.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/time/strftime.c b/src/time/strftime.c +index f1ccc4d..e103e02 100644 +--- a/src/time/strftime.c ++++ b/src/time/strftime.c +@@ -167,6 +167,7 @@ const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm * + goto nl_strftime; + case 'y': + val = tm->tm_year % 100; ++ if (val<0) val += 100; + goto number; + case 'Y': + val = tm->tm_year + 1900LL; +-- +2.10.1 + diff --git a/main/musl/0014-fix-missing-integer-overflow-checks-in-regexec-buffe.patch b/main/musl/0014-fix-missing-integer-overflow-checks-in-regexec-buffe.patch new file mode 100644 index 0000000000..b358278715 --- /dev/null +++ b/main/musl/0014-fix-missing-integer-overflow-checks-in-regexec-buffe.patch @@ -0,0 +1,73 @@ +From c3edc06d1e1360f3570db9155d6b318ae0d0f0f7 Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Thu, 6 Oct 2016 18:34:58 -0400 +Subject: [PATCH 14/18] fix missing integer overflow checks in regexec buffer + size computations + +most of the possible overflows were already ruled out in practice by +regcomp having already succeeded performing larger allocations. +however at least the num_states*num_tags multiplication can clearly +overflow in practice. for safety, check them all, and use the proper +type, size_t, rather than int. + +also improve comments, use calloc in place of malloc+memset, and +remove bogus casts. +--- + src/regex/regexec.c | 23 ++++++++++++++++++----- + 1 file changed, 18 insertions(+), 5 deletions(-) + +diff --git a/src/regex/regexec.c b/src/regex/regexec.c +index 16c5d0a..dd52319 100644 +--- a/src/regex/regexec.c ++++ b/src/regex/regexec.c +@@ -34,6 +34,7 @@ + #include + #include + #include ++#include + + #include + +@@ -206,11 +207,24 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, + + /* Allocate memory for temporary data required for matching. This needs to + be done for every matching operation to be thread safe. This allocates +- everything in a single large block from the stack frame using alloca() +- or with malloc() if alloca is unavailable. */ ++ everything in a single large block with calloc(). */ + { +- int tbytes, rbytes, pbytes, xbytes, total_bytes; ++ size_t tbytes, rbytes, pbytes, xbytes, total_bytes; + char *tmp_buf; ++ ++ /* Ensure that tbytes and xbytes*num_states cannot overflow, and that ++ * they don't contribute more than 1/8 of SIZE_MAX to total_bytes. */ ++ if (num_tags > SIZE_MAX/(8 * sizeof(int) * tnfa->num_states)) ++ goto error_exit; ++ ++ /* Likewise check rbytes. */ ++ if (tnfa->num_states+1 > SIZE_MAX/(8 * sizeof(*reach_next))) ++ goto error_exit; ++ ++ /* Likewise check pbytes. */ ++ if (tnfa->num_states > SIZE_MAX/(8 * sizeof(*reach_pos))) ++ goto error_exit; ++ + /* Compute the length of the block we need. */ + tbytes = sizeof(*tmp_tags) * num_tags; + rbytes = sizeof(*reach_next) * (tnfa->num_states + 1); +@@ -221,10 +235,9 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, + + (rbytes + xbytes * tnfa->num_states) * 2 + tbytes + pbytes; + + /* Allocate the memory. */ +- buf = xmalloc((unsigned)total_bytes); ++ buf = calloc(total_bytes, 1); + if (buf == NULL) + return REG_ESPACE; +- memset(buf, 0, (size_t)total_bytes); + + /* Get the various pointers within tmp_buf (properly aligned). */ + tmp_tags = (void *)buf; +-- +2.10.1 + diff --git a/main/musl/0015-fix-regexec-with-haystack-strings-longer-than-INT_MA.patch b/main/musl/0015-fix-regexec-with-haystack-strings-longer-than-INT_MA.patch new file mode 100644 index 0000000000..e78fe0bd54 --- /dev/null +++ b/main/musl/0015-fix-regexec-with-haystack-strings-longer-than-INT_MA.patch @@ -0,0 +1,190 @@ +From aee6abb2400b9a955c2b41166db1c22f63ad42ef Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Thu, 6 Oct 2016 12:15:47 -0400 +Subject: [PATCH 15/18] fix regexec with haystack strings longer than INT_MAX + +we inherited from TRE regexec code that's utterly wrong with respect +to the integer types it's using. while it doesn't appear that +compilers are producing unsafe output, signed integer overflows seem +to happen, and regexec fails to find matches past offset INT_MAX. + +this patch fixes the type of all variables/fields used to store +offsets in the string from int to regoff_t. after the changes, basic +testing showed that regexec can now find matches past 2GB (INT_MAX) +and past 4GB on x86_64, and code generation is unchanged on i386. +--- + src/regex/regexec.c | 54 +++++++++++++++++++++++++++-------------------------- + 1 file changed, 28 insertions(+), 26 deletions(-) + +diff --git a/src/regex/regexec.c b/src/regex/regexec.c +index dd52319..5c4cb92 100644 +--- a/src/regex/regexec.c ++++ b/src/regex/regexec.c +@@ -44,7 +44,7 @@ + + static void + tre_fill_pmatch(size_t nmatch, regmatch_t pmatch[], int cflags, +- const tre_tnfa_t *tnfa, int *tags, int match_eo); ++ const tre_tnfa_t *tnfa, regoff_t *tags, regoff_t match_eo); + + /*********************************************************************** + from tre-match-utils.h +@@ -97,7 +97,7 @@ tre_fill_pmatch(size_t nmatch, regmatch_t pmatch[], int cflags, + /* Returns 1 if `t1' wins `t2', 0 otherwise. */ + static int + tre_tag_order(int num_tags, tre_tag_direction_t *tag_directions, +- int *t1, int *t2) ++ regoff_t *t1, regoff_t *t2) + { + int i; + for (i = 0; i < num_tags; i++) +@@ -157,25 +157,25 @@ tre_neg_char_classes_match(tre_ctype_t *classes, tre_cint_t wc, int icase) + + typedef struct { + tre_tnfa_transition_t *state; +- int *tags; ++ regoff_t *tags; + } tre_tnfa_reach_t; + + typedef struct { +- int pos; +- int **tags; ++ regoff_t pos; ++ regoff_t **tags; + } tre_reach_pos_t; + + + static reg_errcode_t + tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, +- int *match_tags, int eflags, +- int *match_end_ofs) ++ regoff_t *match_tags, int eflags, ++ regoff_t *match_end_ofs) + { + /* State variables required by GET_NEXT_WCHAR. */ + tre_char_t prev_c = 0, next_c = 0; + const char *str_byte = string; +- int pos = -1; +- int pos_add_next = 1; ++ regoff_t pos = -1; ++ regoff_t pos_add_next = 1; + #ifdef TRE_MBSTATE + mbstate_t mbstate; + #endif /* TRE_MBSTATE */ +@@ -191,10 +191,10 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, + int *tag_i; + int num_tags, i; + +- int match_eo = -1; /* end offset of match (-1 if no match found yet) */ ++ regoff_t match_eo = -1; /* end offset of match (-1 if no match found yet) */ + int new_match = 0; +- int *tmp_tags = NULL; +- int *tmp_iptr; ++ regoff_t *tmp_tags = NULL; ++ regoff_t *tmp_iptr; + + #ifdef TRE_MBSTATE + memset(&mbstate, '\0', sizeof(mbstate)); +@@ -214,7 +214,7 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, + + /* Ensure that tbytes and xbytes*num_states cannot overflow, and that + * they don't contribute more than 1/8 of SIZE_MAX to total_bytes. */ +- if (num_tags > SIZE_MAX/(8 * sizeof(int) * tnfa->num_states)) ++ if (num_tags > SIZE_MAX/(8 * sizeof(regoff_t) * tnfa->num_states)) + goto error_exit; + + /* Likewise check rbytes. */ +@@ -229,7 +229,7 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, + tbytes = sizeof(*tmp_tags) * num_tags; + rbytes = sizeof(*reach_next) * (tnfa->num_states + 1); + pbytes = sizeof(*reach_pos) * tnfa->num_states; +- xbytes = sizeof(int) * num_tags; ++ xbytes = sizeof(regoff_t) * num_tags; + total_bytes = + (sizeof(long) - 1) * 4 /* for alignment paddings */ + + (rbytes + xbytes * tnfa->num_states) * 2 + tbytes + pbytes; +@@ -490,12 +490,12 @@ error_exit: + */ + + typedef struct { +- int pos; ++ regoff_t pos; + const char *str_byte; + tre_tnfa_transition_t *state; + int state_id; + int next_c; +- int *tags; ++ regoff_t *tags; + #ifdef TRE_MBSTATE + mbstate_t mbstate; + #endif /* TRE_MBSTATE */ +@@ -591,13 +591,13 @@ typedef struct tre_backtrack_struct { + + static reg_errcode_t + tre_tnfa_run_backtrack(const tre_tnfa_t *tnfa, const void *string, +- int *match_tags, int eflags, int *match_end_ofs) ++ regoff_t *match_tags, int eflags, regoff_t *match_end_ofs) + { + /* State variables required by GET_NEXT_WCHAR. */ + tre_char_t prev_c = 0, next_c = 0; + const char *str_byte = string; +- int pos = 0; +- int pos_add_next = 1; ++ regoff_t pos = 0; ++ regoff_t pos_add_next = 1; + #ifdef TRE_MBSTATE + mbstate_t mbstate; + #endif /* TRE_MBSTATE */ +@@ -610,15 +610,16 @@ tre_tnfa_run_backtrack(const tre_tnfa_t *tnfa, const void *string, + started from. */ + int next_c_start; + const char *str_byte_start; +- int pos_start = -1; ++ regoff_t pos_start = -1; + #ifdef TRE_MBSTATE + mbstate_t mbstate_start; + #endif /* TRE_MBSTATE */ + + /* End offset of best match so far, or -1 if no match found yet. */ +- int match_eo = -1; ++ regoff_t match_eo = -1; + /* Tag arrays. */ +- int *next_tags, *tags = NULL; ++ int *next_tags; ++ regoff_t *tags = NULL; + /* Current TNFA state. */ + tre_tnfa_transition_t *state; + int *states_seen = NULL; +@@ -768,8 +769,9 @@ tre_tnfa_run_backtrack(const tre_tnfa_t *tnfa, const void *string, + /* This is a back reference state. All transitions leaving from + this state have the same back reference "assertion". Instead + of reading the next character, we match the back reference. */ +- int so, eo, bt = trans_i->u.backref; +- int bt_len; ++ regoff_t so, eo; ++ int bt = trans_i->u.backref; ++ regoff_t bt_len; + int result; + + /* Get the substring we need to match against. Remember to +@@ -926,7 +928,7 @@ tre_tnfa_run_backtrack(const tre_tnfa_t *tnfa, const void *string, + endpoint values. */ + static void + tre_fill_pmatch(size_t nmatch, regmatch_t pmatch[], int cflags, +- const tre_tnfa_t *tnfa, int *tags, int match_eo) ++ const tre_tnfa_t *tnfa, regoff_t *tags, regoff_t match_eo) + { + tre_submatch_data_t *submatch_data; + unsigned int i, j; +@@ -996,7 +998,7 @@ regexec(const regex_t *restrict preg, const char *restrict string, + { + tre_tnfa_t *tnfa = (void *)preg->TRE_REGEX_T_FIELD; + reg_errcode_t status; +- int *tags = NULL, eo; ++ regoff_t *tags = NULL, eo; + if (tnfa->cflags & REG_NOSUB) nmatch = 0; + if (tnfa->num_tags > 0 && nmatch > 0) + { +-- +2.10.1 + diff --git a/main/musl/0016-fix-integer-overflow-in-float-printf-needed-precisio.patch b/main/musl/0016-fix-integer-overflow-in-float-printf-needed-precisio.patch new file mode 100644 index 0000000000..fcadc040d2 --- /dev/null +++ b/main/musl/0016-fix-integer-overflow-in-float-printf-needed-precisio.patch @@ -0,0 +1,37 @@ +From 70d2687d85c314963cf280759b23fd4573ff0d82 Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Wed, 19 Oct 2016 20:17:16 -0400 +Subject: [PATCH 16/18] fix integer overflow in float printf needed-precision + computation + +if the requested precision is close to INT_MAX, adding +LDBL_MANT_DIG/3+8 overflows. in practice the resulting undefined +behavior manifests as a large negative result, which is then used to +compute the new end pointer (z) with a wildly out-of-bounds value +(more overflow, more undefined behavior). the end result is at least +incorrect output and character count (return value); worse things do +not seem to happen, but detailed analysis has not been done. + +this patch fixes the overflow by performing the intermediate +computation as unsigned; after division by 9, the final result +necessarily fits in int. +--- + src/stdio/vfprintf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c +index e439a07..cd17ad7 100644 +--- a/src/stdio/vfprintf.c ++++ b/src/stdio/vfprintf.c +@@ -312,7 +312,7 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t) + } + while (e2<0) { + uint32_t carry=0, *b; +- int sh=MIN(9,-e2), need=1+(p+LDBL_MANT_DIG/3+8)/9; ++ int sh=MIN(9,-e2), need=1+(p+LDBL_MANT_DIG/3U+8)/9; + for (d=a; d>sh) + carry; +-- +2.10.1 + diff --git a/main/musl/0017-fix-integer-overflows-and-uncaught-EOVERFLOW-in-prin.patch b/main/musl/0017-fix-integer-overflows-and-uncaught-EOVERFLOW-in-prin.patch new file mode 100644 index 0000000000..c8fb63f1d1 --- /dev/null +++ b/main/musl/0017-fix-integer-overflows-and-uncaught-EOVERFLOW-in-prin.patch @@ -0,0 +1,392 @@ +From 167dfe9672c116b315e72e57a55c7769f180dffa Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Thu, 20 Oct 2016 00:22:09 -0400 +Subject: [PATCH 17/18] fix integer overflows and uncaught EOVERFLOW in printf + core + +this patch fixes a large number of missed internal signed-overflow +checks and errors in determining when the return value (output length) +would exceed INT_MAX, which should result in EOVERFLOW. some of the +issues fixed were reported by Alexander Cherepanov; others were found +in subsequent review of the code. + +aside from the signed overflows being undefined behavior, the +following specific bugs were found to exist in practice: + +- overflows computing length of floating point formats with huge + explicit precisions, integer formats with prefix characters and huge + explicit precisions, or string arguments or format strings longer + than INT_MAX, resulted in wrong return value and wrong %n results. + +- literal width and precision values outside the range of int were + misinterpreted, yielding wrong behavior in at least one well-defined + case: string formats with precision greater than INT_MAX were + sometimes truncated. + +- in cases where EOVERFLOW is produced, incorrect values could be + written for %n specifiers past the point of exceeding INT_MAX. + +in addition to fixing these bugs, we now stop producing output +immediately when output length would exceed INT_MAX, rather than +continuing and returning an error only at the end. +--- + src/stdio/vfprintf.c | 72 +++++++++++++++++++++++++++++++++++---------------- + src/stdio/vfwprintf.c | 63 +++++++++++++++++++++++++++----------------- + 2 files changed, 89 insertions(+), 46 deletions(-) + +diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c +index cd17ad7..e2ab2dc 100644 +--- a/src/stdio/vfprintf.c ++++ b/src/stdio/vfprintf.c +@@ -272,6 +272,8 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t) + if (s-buf==1 && (y||p>0||(fl&ALT_FORM))) *s++='.'; + } while (y); + ++ if (p > INT_MAX-2-(ebuf-estr)-pl) ++ return -1; + if (p && s-buf-2 < p) + l = (p+2) + (ebuf-estr); + else +@@ -383,17 +385,22 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t) + p = MIN(p,MAX(0,9*(z-r-1)+e-j)); + } + } ++ if (p > INT_MAX-1-(p || (fl&ALT_FORM))) ++ return -1; + l = 1 + p + (p || (fl&ALT_FORM)); + if ((t|32)=='f') { ++ if (e > INT_MAX-l) return -1; + if (e>0) l+=e; + } else { + estr=fmt_u(e<0 ? -e : e, ebuf); + while(ebuf-estr<2) *--estr='0'; + *--estr = (e<0 ? '-' : '+'); + *--estr = t; ++ if (ebuf-estr > INT_MAX-l) return -1; + l += ebuf-estr; + } + ++ if (l > INT_MAX-pl) return -1; + pad(f, ' ', w, pl+l, fl); + out(f, prefix, pl); + pad(f, '0', w, pl+l, fl^ZERO_PAD); +@@ -437,8 +444,10 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t) + + static int getint(char **s) { + int i; +- for (i=0; isdigit(**s); (*s)++) +- i = 10*i + (**s-'0'); ++ for (i=0; isdigit(**s); (*s)++) { ++ if (i > INT_MAX/10U || **s-'0' > INT_MAX-10*i) i = -1; ++ else i = 10*i + (**s-'0'); ++ } + return i; + } + +@@ -446,12 +455,12 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, + { + char *a, *z, *s=(char *)fmt; + unsigned l10n=0, fl; +- int w, p; ++ int w, p, xp; + union arg arg; + int argpos; + unsigned st, ps; + int cnt=0, l=0; +- int i; ++ size_t i; + char buf[sizeof(uintmax_t)*3+3+LDBL_MANT_DIG/4]; + const char *prefix; + int t, pl; +@@ -459,18 +468,19 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, + char mb[4]; + + for (;;) { ++ /* This error is only specified for snprintf, but since it's ++ * unspecified for other forms, do the same. Stop immediately ++ * on overflow; otherwise %n could produce wrong results. */ ++ if (l > INT_MAX - cnt) goto overflow; ++ + /* Update output count, end loop when fmt is exhausted */ +- if (cnt >= 0) { +- if (l > INT_MAX - cnt) { +- errno = EOVERFLOW; +- cnt = -1; +- } else cnt += l; +- } ++ cnt += l; + if (!*s) break; + + /* Handle literal text and %% format specifiers */ + for (a=s; *s && *s!='%'; s++); + for (z=s; s[0]=='%' && s[1]=='%'; z++, s+=2); ++ if (z-a > INT_MAX-cnt) goto overflow; + l = z-a; + if (f) out(f, a, l); + if (l) continue; +@@ -498,9 +508,9 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, + } else if (!l10n) { + w = f ? va_arg(*ap, int) : 0; + s++; +- } else return -1; ++ } else goto inval; + if (w<0) fl|=LEFT_ADJ, w=-w; +- } else if ((w=getint(&s))<0) return -1; ++ } else if ((w=getint(&s))<0) goto overflow; + + /* Read precision */ + if (*s=='.' && s[1]=='*') { +@@ -511,24 +521,29 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, + } else if (!l10n) { + p = f ? va_arg(*ap, int) : 0; + s+=2; +- } else return -1; ++ } else goto inval; ++ xp = (p>=0); + } else if (*s=='.') { + s++; + p = getint(&s); +- } else p = -1; ++ xp = 1; ++ } else { ++ p = -1; ++ xp = 0; ++ } + + /* Format specifier state machine */ + st=0; + do { +- if (OOB(*s)) return -1; ++ if (OOB(*s)) goto inval; + ps=st; + st=states[st]S(*s++); + } while (st-1=0) return -1; ++ if (argpos>=0) goto inval; + } else { + if (argpos>=0) nl_type[argpos]=st, arg=nl_arg[argpos]; + else if (f) pop_arg(&arg, st, ap); +@@ -584,6 +599,7 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, + case 'u': + a = fmt_u(arg.i, z); + } ++ if (xp && p<0) goto overflow; + if (p>=0) fl &= ~ZERO_PAD; + if (!arg.i && !p) { + a=z; +@@ -599,9 +615,9 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, + if (1) a = strerror(errno); else + case 's': + a = arg.p ? arg.p : "(null)"; +- z = memchr(a, 0, p); +- if (!z) z=a+p; +- else p=z-a; ++ z = a + strnlen(a, p<0 ? INT_MAX : p); ++ if (p<0 && *z) goto overflow; ++ p = z-a; + fl &= ~ZERO_PAD; + break; + case 'C': +@@ -611,8 +627,9 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, + p = -1; + case 'S': + ws = arg.p; +- for (i=l=0; i<0U+p && *ws && (l=wctomb(mb, *ws++))>=0 && l<=0U+p-i; i+=l); ++ for (i=l=0; i

=0 && l<=p-i; i+=l); + if (l<0) return -1; ++ if (i > INT_MAX) goto overflow; + p = i; + pad(f, ' ', w, p, fl); + ws = arg.p; +@@ -623,12 +640,16 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, + continue; + case 'e': case 'f': case 'g': case 'a': + case 'E': case 'F': case 'G': case 'A': ++ if (xp && p<0) goto overflow; + l = fmt_fp(f, arg.f, w, p, fl, t); ++ if (l<0) goto overflow; + continue; + } + + if (p < z-a) p = z-a; ++ if (p > INT_MAX-pl) goto overflow; + if (w < pl+p) w = pl+p; ++ if (w > INT_MAX-cnt) goto overflow; + + pad(f, ' ', w, pl+p, fl); + out(f, prefix, pl); +@@ -646,8 +667,15 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, + for (i=1; i<=NL_ARGMAX && nl_type[i]; i++) + pop_arg(nl_arg+i, nl_type[i], ap); + for (; i<=NL_ARGMAX && !nl_type[i]; i++); +- if (i<=NL_ARGMAX) return -1; ++ if (i<=NL_ARGMAX) goto inval; + return 1; ++ ++inval: ++ errno = EINVAL; ++ return -1; ++overflow: ++ errno = EOVERFLOW; ++ return -1; + } + + int vfprintf(FILE *restrict f, const char *restrict fmt, va_list ap) +diff --git a/src/stdio/vfwprintf.c b/src/stdio/vfwprintf.c +index f9f1ecf..b8fff20 100644 +--- a/src/stdio/vfwprintf.c ++++ b/src/stdio/vfwprintf.c +@@ -154,8 +154,10 @@ static void out(FILE *f, const wchar_t *s, size_t l) + + static int getint(wchar_t **s) { + int i; +- for (i=0; iswdigit(**s); (*s)++) +- i = 10*i + (**s-'0'); ++ for (i=0; iswdigit(**s); (*s)++) { ++ if (i > INT_MAX/10U || **s-'0' > INT_MAX-10*i) i = -1; ++ else i = 10*i + (**s-'0'); ++ } + return i; + } + +@@ -168,8 +170,8 @@ static const char sizeprefix['y'-'a'] = { + static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_arg, int *nl_type) + { + wchar_t *a, *z, *s=(wchar_t *)fmt; +- unsigned l10n=0, litpct, fl; +- int w, p; ++ unsigned l10n=0, fl; ++ int w, p, xp; + union arg arg; + int argpos; + unsigned st, ps; +@@ -181,20 +183,19 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_ + wchar_t wc; + + for (;;) { ++ /* This error is only specified for snprintf, but since it's ++ * unspecified for other forms, do the same. Stop immediately ++ * on overflow; otherwise %n could produce wrong results. */ ++ if (l > INT_MAX - cnt) goto overflow; ++ + /* Update output count, end loop when fmt is exhausted */ +- if (cnt >= 0) { +- if (l > INT_MAX - cnt) { +- if (!ferror(f)) errno = EOVERFLOW; +- cnt = -1; +- } else cnt += l; +- } ++ cnt += l; + if (!*s) break; + + /* Handle literal text and %% format specifiers */ + for (a=s; *s && *s!='%'; s++); +- litpct = wcsspn(s, L"%")/2; /* Optimize %%%% runs */ +- z = s+litpct; +- s += 2*litpct; ++ for (z=s; s[0]=='%' && s[1]=='%'; z++, s+=2); ++ if (z-a > INT_MAX-cnt) goto overflow; + l = z-a; + if (f) out(f, a, l); + if (l) continue; +@@ -222,9 +223,9 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_ + } else if (!l10n) { + w = f ? va_arg(*ap, int) : 0; + s++; +- } else return -1; ++ } else goto inval; + if (w<0) fl|=LEFT_ADJ, w=-w; +- } else if ((w=getint(&s))<0) return -1; ++ } else if ((w=getint(&s))<0) goto overflow; + + /* Read precision */ + if (*s=='.' && s[1]=='*') { +@@ -235,24 +236,29 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_ + } else if (!l10n) { + p = f ? va_arg(*ap, int) : 0; + s+=2; +- } else return -1; ++ } else goto inval; ++ xp = (p>=0); + } else if (*s=='.') { + s++; + p = getint(&s); +- } else p = -1; ++ xp = 1; ++ } else { ++ p = -1; ++ xp = 0; ++ } + + /* Format specifier state machine */ + st=0; + do { +- if (OOB(*s)) return -1; ++ if (OOB(*s)) goto inval; + ps=st; + st=states[st]S(*s++); + } while (st-1=0) return -1; ++ if (argpos>=0) goto inval; + } else { + if (argpos>=0) nl_type[argpos]=st, arg=nl_arg[argpos]; + else if (f) pop_arg(&arg, st, ap); +@@ -285,8 +291,9 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_ + continue; + case 'S': + a = arg.p; +- z = wmemchr(a, 0, p); +- if (z) p=z-a; ++ z = a + wcsnlen(a, p<0 ? INT_MAX : p); ++ if (p<0 && *z) goto overflow; ++ p = z-a; + if (w0; bs+=i, l++); ++ for (i=l=0; l<(p<0?INT_MAX:p) && (i=mbtowc(&wc, bs, MB_LEN_MAX))>0; bs+=i, l++); + if (i<0) return -1; ++ if (p<0 && *bs) goto overflow; + p=l; + if (w +Date: Sat, 17 Sep 2016 12:05:45 -0400 +Subject: [PATCH 18/25] fix clock_nanosleep error case + +posix requires that EINVAL be returned if the first parameter specifies +the cpu-time clock of the calling thread (CLOCK_THREAD_CPUTIME_ID). +linux returns ENOTSUP instead so we handle this. +--- + src/time/clock_nanosleep.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/time/clock_nanosleep.c b/src/time/clock_nanosleep.c +index ec87b9e..9e4d9f1 100644 +--- a/src/time/clock_nanosleep.c ++++ b/src/time/clock_nanosleep.c +@@ -1,8 +1,10 @@ + #include ++#include + #include "syscall.h" + #include "libc.h" + + int clock_nanosleep(clockid_t clk, int flags, const struct timespec *req, struct timespec *rem) + { +- return -__syscall_cp(SYS_clock_nanosleep, clk, flags, req, rem); ++ int r = -__syscall_cp(SYS_clock_nanosleep, clk, flags, req, rem); ++ return clk == CLOCK_THREAD_CPUTIME_ID ? EINVAL : r; + } +-- +2.10.1 + diff --git a/main/musl/0018-use-dynamic-buffer-for-getmntent.patch b/main/musl/0018-use-dynamic-buffer-for-getmntent.patch new file mode 100644 index 0000000000..7178a00a4a --- /dev/null +++ b/main/musl/0018-use-dynamic-buffer-for-getmntent.patch @@ -0,0 +1,67 @@ +From 05973dc3bbc1aca9b3c8347de6879ed72147ab3b Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Thu, 8 Sep 2016 19:07:31 +0200 +Subject: [PATCH 18/18] use dynamic buffer for getmntent + +overlayfs may have fairly long lines so we use getline to allocate a +buffer dynamically. The buffer will be allocated on first use, expand as +needed, but will never be free'ed. + +Downstream bug: http://bugs.alpinelinux.org/issues/5703 + +Signed-off-by: Natanael Copa +--- + src/misc/mntent.c | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +diff --git a/src/misc/mntent.c b/src/misc/mntent.c +index a16d652..eabb820 100644 +--- a/src/misc/mntent.c ++++ b/src/misc/mntent.c +@@ -3,6 +3,11 @@ + #include + #include + ++static char *internal_buf; ++static size_t internal_bufsize; ++ ++#define SENTINEL (char *)&internal_buf ++ + FILE *setmntent(const char *name, const char *mode) + { + return fopen(name, mode); +@@ -16,13 +21,18 @@ int endmntent(FILE *f) + + struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int buflen) + { +- int cnt, n[8]; ++ int cnt, n[8], use_internal = (linebuf == SENTINEL); + + mnt->mnt_freq = 0; + mnt->mnt_passno = 0; + + do { +- fgets(linebuf, buflen, f); ++ if (use_internal) { ++ getline(&internal_buf, &internal_bufsize, f); ++ linebuf = internal_buf; ++ } else { ++ fgets(linebuf, buflen, f); ++ } + if (feof(f) || ferror(f)) return 0; + if (!strchr(linebuf, '\n')) { + fscanf(f, "%*[^\n]%*[\n]"); +@@ -49,9 +59,8 @@ struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int bufle + + struct mntent *getmntent(FILE *f) + { +- static char linebuf[256]; + static struct mntent mnt; +- return getmntent_r(f, &mnt, linebuf, sizeof linebuf); ++ return getmntent_r(f, &mnt, SENTINEL, 0); + } + + int addmntent(FILE *f, const struct mntent *mnt) +-- +2.10.1 + diff --git a/main/musl/0019-add-pthread_setname_np.patch b/main/musl/0019-add-pthread_setname_np.patch new file mode 100644 index 0000000000..1f02497dd3 --- /dev/null +++ b/main/musl/0019-add-pthread_setname_np.patch @@ -0,0 +1,59 @@ +From 8fb28b0b3e7a5e958fb844722a4b2ef9bc244af1 Mon Sep 17 00:00:00 2001 +From: Felix Janda +Date: Fri, 16 Sep 2016 20:54:00 -0400 +Subject: [PATCH 19/25] add pthread_setname_np + +the thread name is displayed by gdb's "info threads". +--- + include/pthread.h | 1 + + src/thread/pthread_setname_np.c | 26 ++++++++++++++++++++++++++ + 2 files changed, 27 insertions(+) + create mode 100644 src/thread/pthread_setname_np.c + +diff --git a/include/pthread.h b/include/pthread.h +index 3d2e0c4..94ef919 100644 +--- a/include/pthread.h ++++ b/include/pthread.h +@@ -214,6 +214,7 @@ struct cpu_set_t; + int pthread_getaffinity_np(pthread_t, size_t, struct cpu_set_t *); + int pthread_setaffinity_np(pthread_t, size_t, const struct cpu_set_t *); + int pthread_getattr_np(pthread_t, pthread_attr_t *); ++int pthread_setname_np(pthread_t, const char *); + int pthread_tryjoin_np(pthread_t, void **); + int pthread_timedjoin_np(pthread_t, void **, const struct timespec *); + #endif +diff --git a/src/thread/pthread_setname_np.c b/src/thread/pthread_setname_np.c +new file mode 100644 +index 0000000..82d35e1 +--- /dev/null ++++ b/src/thread/pthread_setname_np.c +@@ -0,0 +1,26 @@ ++#define _GNU_SOURCE ++#include ++#include ++#include ++#include ++ ++#include "pthread_impl.h" ++ ++int pthread_setname_np(pthread_t thread, const char *name) ++{ ++ int fd, cs, status = 0; ++ char f[sizeof "/proc/self/task//comm" + 3*sizeof(int)]; ++ size_t len; ++ ++ if ((len = strnlen(name, 16)) > 15) return ERANGE; ++ ++ if (thread == pthread_self()) ++ return prctl(PR_SET_NAME, (unsigned long)name, 0UL, 0UL, 0UL) ? errno : 0; ++ ++ snprintf(f, sizeof f, "/proc/self/task/%d/comm", thread->tid); ++ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs); ++ if ((fd = open(f, O_WRONLY)) < 0 || write(fd, name, len) < 0) status = errno; ++ if (fd >= 0) close(fd); ++ pthread_setcancelstate(cs, 0); ++ return status; ++} +-- +2.10.1 + diff --git a/main/musl/0020-fix-float-formatting-of-some-exact-halfway-cases.patch b/main/musl/0020-fix-float-formatting-of-some-exact-halfway-cases.patch new file mode 100644 index 0000000000..1e7284e622 --- /dev/null +++ b/main/musl/0020-fix-float-formatting-of-some-exact-halfway-cases.patch @@ -0,0 +1,31 @@ +From 51ab6db4ed115d079d7131975e4adb074ba9ef9d Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy +Date: Wed, 12 Oct 2016 00:49:59 +0200 +Subject: [PATCH 20/25] fix float formatting of some exact halfway cases + +in nearest rounding mode exact halfway cases were not following the +round to even rule if the rounding happened at a base 1000000000 digit +boundary of the internal representation and the previous digit was odd. + +e.g. printf("%.0f", 1.5) printed 1 instead of 2. +--- + src/stdio/vfprintf.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c +index e2ab2dc..60da14d 100644 +--- a/src/stdio/vfprintf.c ++++ b/src/stdio/vfprintf.c +@@ -345,7 +345,8 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t) + if (x || d+1!=z) { + long double round = 2/LDBL_EPSILON; + long double small; +- if (*d/i & 1) round += 2; ++ if ((*d/i & 1) || (i==1000000000 && d>a && (d[-1]&1))) ++ round += 2; + if (x +Date: Thu, 20 Oct 2016 12:13:33 -0400 +Subject: [PATCH 21/25] fix getopt_long_only misinterpreting "--" as an option + +--- + src/misc/getopt_long.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/misc/getopt_long.c b/src/misc/getopt_long.c +index 480c001..c6e1462 100644 +--- a/src/misc/getopt_long.c ++++ b/src/misc/getopt_long.c +@@ -53,7 +53,7 @@ static int __getopt_long_core(int argc, char *const *argv, const char *optstring + { + optarg = 0; + if (longopts && argv[optind][0] == '-' && +- ((longonly && argv[optind][1]) || ++ ((longonly && argv[optind][1] && argv[optind][1] != '-') || + (argv[optind][1] == '-' && argv[optind][2]))) + { + int colon = optstring[optstring[0]=='+'||optstring[0]=='-']==':'; +-- +2.10.1 + diff --git a/main/musl/0022-fix-gratuitous-undefined-behavior-in-strptime.patch b/main/musl/0022-fix-gratuitous-undefined-behavior-in-strptime.patch new file mode 100644 index 0000000000..6da625dd76 --- /dev/null +++ b/main/musl/0022-fix-gratuitous-undefined-behavior-in-strptime.patch @@ -0,0 +1,34 @@ +From f33b17585058381491e6fda08f491b8e48c7980c Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Thu, 20 Oct 2016 13:22:20 -0400 +Subject: [PATCH 22/25] fix gratuitous undefined behavior in strptime + +accessing an object of type const char *restrict as if it had type +char * is not defined. +--- + src/time/strptime.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/src/time/strptime.c b/src/time/strptime.c +index f41f55f..55c7ed1 100644 +--- a/src/time/strptime.c ++++ b/src/time/strptime.c +@@ -22,8 +22,13 @@ char *strptime(const char *restrict s, const char *restrict f, struct tm *restri + } + f++; + if (*f == '+') f++; +- if (isdigit(*f)) w=strtoul(f, (void *)&f, 10); +- else w=-1; ++ if (isdigit(*f)) { ++ char *new_f; ++ w=strtoul(f, &new_f, 10); ++ f = new_f; ++ } else { ++ w=-1; ++ } + adj=0; + switch (*f++) { + case 'a': case 'A': +-- +2.10.1 + diff --git a/main/musl/0023-fix-strtod-and-strtof-rounding-with-many-trailing-ze.patch b/main/musl/0023-fix-strtod-and-strtof-rounding-with-many-trailing-ze.patch new file mode 100644 index 0000000000..f81bc76940 --- /dev/null +++ b/main/musl/0023-fix-strtod-and-strtof-rounding-with-many-trailing-ze.patch @@ -0,0 +1,37 @@ +From d184a09e0529f33d8ddddb8825039133483a2c41 Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy +Date: Sun, 4 Sep 2016 04:46:00 +0200 +Subject: [PATCH 23/25] fix strtod and strtof rounding with many trailing zeros + +in certain cases excessive trailing zeros could cause incorrect +rounding from long double to double or float in decfloat. + +e.g. in strtof("9444733528689243848704.000000", 0) the argument +is 0x1.000001p+73, exactly halfway between two representible floats, +this incorrectly got rounded to 0x1.000002p+73 instead of 0x1p+73, +but with less trailing 0 the rounding was fine. + +the fix makes sure that the z index always points one past the last +non-zero digit in the base 10^9 representation, this way trailing +zeros don't affect the rounding logic. +--- + src/internal/floatscan.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/internal/floatscan.c b/src/internal/floatscan.c +index eef70df..80305ee 100644 +--- a/src/internal/floatscan.c ++++ b/src/internal/floatscan.c +@@ -172,6 +172,9 @@ static long double decfloat(FILE *f, int c, int bits, int emin, int sign, int po + return sign * (long double)x[0] * p10s[rp-10]; + } + ++ /* Drop trailing zeros */ ++ for (; !x[z-1]; z--); ++ + /* Align radix point to B1B digit boundary */ + if (rp % 9) { + int rpm9 = rp>=0 ? rp%9 : rp%9+9; +-- +2.10.1 + diff --git a/main/musl/0024-fix-strtod-int-optimization-in-non-nearest-rounding-.patch b/main/musl/0024-fix-strtod-int-optimization-in-non-nearest-rounding-.patch new file mode 100644 index 0000000000..2d6def1957 --- /dev/null +++ b/main/musl/0024-fix-strtod-int-optimization-in-non-nearest-rounding-.patch @@ -0,0 +1,40 @@ +From 6ffdc4579ffb34f4aab69ab4c081badabc7c0a9a Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy +Date: Sun, 4 Sep 2016 04:51:03 +0200 +Subject: [PATCH 24/25] fix strtod int optimization in non-nearest rounding + mode + +the mid-sized integer optimization relies on lnz set up properly +to mark the last non-zero decimal digit, but this was not done +if the non-zero digit lied outside the KMAX digits of the base +10^9 number representation. + +so if the fractional part was a very long list of zeros (>2048*9 on +x86) followed by non-zero digits then the integer optimization could +kick in discarding the tiny non-zero fraction which can mean wrong +result on non-nearest rounding mode. + +strtof, strtod and strtold were all affected. +--- + src/internal/floatscan.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/internal/floatscan.c b/src/internal/floatscan.c +index 80305ee..ae09852 100644 +--- a/src/internal/floatscan.c ++++ b/src/internal/floatscan.c +@@ -110,7 +110,10 @@ static long double decfloat(FILE *f, int c, int bits, int emin, int sign, int po + gotdig=1; + } else { + dc++; +- if (c!='0') x[KMAX-4] |= 1; ++ if (c!='0') { ++ lnz = dc; ++ x[KMAX-4] |= 1; ++ } + } + } + if (!gotrad) lrp=dc; +-- +2.10.1 + diff --git a/main/musl/0025-fix-minor-problem-in-previous-strtod-non-nearest-rou.patch b/main/musl/0025-fix-minor-problem-in-previous-strtod-non-nearest-rou.patch new file mode 100644 index 0000000000..623729e37a --- /dev/null +++ b/main/musl/0025-fix-minor-problem-in-previous-strtod-non-nearest-rou.patch @@ -0,0 +1,35 @@ +From e314258e2fe75b7443db84d2927315dea0f337c8 Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Thu, 20 Oct 2016 14:40:59 -0400 +Subject: [PATCH 25/25] fix minor problem in previous strtod non-nearest + rounding bug fix + +commit 6ffdc4579ffb34f4aab69ab4c081badabc7c0a9a set lnz in the code +path for non-zero digits after a huge string of zeros, but the +assignment of dc to lnz truncates if the value of dc does not fit in +int; this is possible for some pathologically long inputs, either via +strings on 64-bit systems or via scanf-family functions. + +instead, simply set lnz to match the point at which we add the +artificial trailing 1 bit to simulate nonzero digits after a huge +run of zeros. +--- + src/internal/floatscan.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/internal/floatscan.c b/src/internal/floatscan.c +index ae09852..278bf25 100644 +--- a/src/internal/floatscan.c ++++ b/src/internal/floatscan.c +@@ -111,7 +111,7 @@ static long double decfloat(FILE *f, int c, int bits, int emin, int sign, int po + } else { + dc++; + if (c!='0') { +- lnz = dc; ++ lnz = (KMAX-4)*9; + x[KMAX-4] |= 1; + } + } +-- +2.10.1 + diff --git a/main/musl/1001-add-support-for-pthread_-get-set-attr_default_np-GNU.patch b/main/musl/1001-add-support-for-pthread_-get-set-attr_default_np-GNU.patch new file mode 100644 index 0000000000..93d939df76 --- /dev/null +++ b/main/musl/1001-add-support-for-pthread_-get-set-attr_default_np-GNU.patch @@ -0,0 +1,95 @@ +From 8c9088d0fc253a0f53f206832714e9e5138a4438 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Timo=20Ter=C3=A4s?= +Date: Tue, 25 Oct 2016 17:00:54 +0300 +Subject: [PATCH 1001/1001] add support for pthread_{get,set}attr_default_np + GNU extension + +While generally this is a bad API, it is the only existing API to +affect c++ (std::thread) and c11 (thrd_create) thread stack size. +This patch allows applications only to increate stack and guard +page sizes. +--- + include/pthread.h | 2 ++ + src/thread/pthread_create.c | 7 +++++++ + src/thread/pthread_setattr_default_np.c | 31 +++++++++++++++++++++++++++++++ + 3 files changed, 40 insertions(+) + create mode 100644 src/thread/pthread_setattr_default_np.c + +diff --git a/include/pthread.h b/include/pthread.h +index 94ef919..bba9587 100644 +--- a/include/pthread.h ++++ b/include/pthread.h +@@ -215,6 +215,8 @@ int pthread_getaffinity_np(pthread_t, size_t, struct cpu_set_t *); + int pthread_setaffinity_np(pthread_t, size_t, const struct cpu_set_t *); + int pthread_getattr_np(pthread_t, pthread_attr_t *); + int pthread_setname_np(pthread_t, const char *); ++int pthread_getattr_default_np(pthread_attr_t *); ++int pthread_setattr_default_np(const pthread_attr_t *); + int pthread_tryjoin_np(pthread_t, void **); + int pthread_timedjoin_np(pthread_t, void **, const struct timespec *); + #endif +diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c +index 9f6b98e..28cf6d4 100644 +--- a/src/thread/pthread_create.c ++++ b/src/thread/pthread_create.c +@@ -163,6 +163,8 @@ static void *dummy_tsd[1] = { 0 }; + weak_alias(dummy_tsd, __pthread_tsd_main); + + volatile int __block_new_threads = 0; ++size_t __default_stacksize = 0; ++size_t __default_guardsize = 0; + + static FILE *volatile dummy_file = 0; + weak_alias(dummy_file, __stdin_used); +@@ -204,6 +206,11 @@ int __pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict att + if (attrp && !c11) attr = *attrp; + + __acquire_ptc(); ++ if (!attrp || c11) { ++ attr._a_stacksize = __default_stacksize; ++ attr._a_guardsize = __default_guardsize; ++ } ++ + if (__block_new_threads) __wait(&__block_new_threads, 0, 1, 1); + + if (attr._a_stackaddr) { +diff --git a/src/thread/pthread_setattr_default_np.c b/src/thread/pthread_setattr_default_np.c +new file mode 100644 +index 0000000..21cd0f3 +--- /dev/null ++++ b/src/thread/pthread_setattr_default_np.c +@@ -0,0 +1,31 @@ ++#include "pthread_impl.h" ++ ++extern size_t __default_stacksize; ++extern size_t __default_guardsize; ++ ++int pthread_setattr_default_np(const pthread_attr_t *attrp) ++{ ++ if (attrp->_a_stackaddr || attrp->_a_detach || ++ attrp->_a_sched || attrp->_a_policy || attrp->_a_prio) ++ return EINVAL; ++ ++ __inhibit_ptc(); ++ if (DEFAULT_STACK_SIZE+attrp->_a_stacksize >= DEFAULT_STACK_SIZE+__default_stacksize) ++ __default_stacksize = attrp->_a_stacksize; ++ if (DEFAULT_GUARD_SIZE+attrp->_a_guardsize >= DEFAULT_GUARD_SIZE+__default_guardsize) ++ __default_guardsize = attrp->_a_guardsize; ++ __release_ptc(); ++ ++ return 0; ++} ++ ++int pthread_getattr_default_np(pthread_attr_t *attrp) ++{ ++ __acquire_ptc(); ++ *attrp = (pthread_attr_t) { ++ ._a_stacksize = __default_stacksize, ++ ._a_guardsize = __default_guardsize, ++ }; ++ __release_ptc(); ++ return 0; ++} +-- +2.10.1 + diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD index 9b0510fc05..2e4632c0de 100644 --- a/main/musl/APKBUILD +++ b/main/musl/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Timo Teräs pkgname=musl pkgver=1.1.15 -pkgrel=4 +pkgrel=5 pkgdesc="the musl c library (libc) implementation" url="http://www.musl-libc.org/" arch="all" @@ -10,12 +10,37 @@ license="MIT" depends="" depends_dev="!uclibc-dev" makedepends="$depends_dev" -subpackages="$pkgname-dev $pkgname-dbg libc6-compat:compat" +subpackages="$pkgname-dev $pkgname-dbg libc6-compat:compat:noarch" [ "$BOOTSTRAP" != "nolibc" ] && subpackages="$subpackages $pkgname-utils" source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz 0001-fix-asctime-day-month-names-not-to-vary-by-locale.patch - 0001-use-dynamic-buffer-for-getmntent.patch - 0001-fix-missing-integer-overflow-checks-in-regexec-buffe.patch + 0001-verify-that-ttyname-refers-to-the-same-file-as-the-f.patch + 0002-math-fix-128bit-long-double-inverse-trigonometric-fu.patch + 0003-fix-FFSYNC-by-changing-it-to-O_SYNC.patch + 0004-getdtablesize-fix-returning-hard-instead-of-soft-rli.patch + 0005-restore-_Noreturn-to-__assert_fail.patch + 0006-fix-printf-regression-with-alt-form-octal-zero-flag-.patch + 0007-fix-ifru_data-and-ifcu_buf-types-in-net-if.h.patch + 0008-fix-if_indextoname-error-case.patch + 0009-add-missing-_unlocked-and-wcsftime_l-prototypes-to-w.patch + 0010-simplify-refactor-fflush-and-make-fflush_unlocked-an.patch + 0011-fix-undefined-behavior-in-sched.h-cpu_set_t-usage.patch + 0012-fix-getservby-_r-result-pointer-value-on-error.patch + 0013-fix-strftime-y-for-negative-tm_year.patch + 0014-fix-missing-integer-overflow-checks-in-regexec-buffe.patch + 0015-fix-regexec-with-haystack-strings-longer-than-INT_MA.patch + 0016-fix-integer-overflow-in-float-printf-needed-precisio.patch + 0017-fix-integer-overflows-and-uncaught-EOVERFLOW-in-prin.patch + 0018-fix-clock_nanosleep-error-case.patch + 0018-use-dynamic-buffer-for-getmntent.patch + 0019-add-pthread_setname_np.patch + 0020-fix-float-formatting-of-some-exact-halfway-cases.patch + 0021-fix-getopt_long_only-misinterpreting-as-an-option.patch + 0022-fix-gratuitous-undefined-behavior-in-strptime.patch + 0023-fix-strtod-and-strtof-rounding-with-many-trailing-ze.patch + 0024-fix-strtod-int-optimization-in-non-nearest-rounding-.patch + 0025-fix-minor-problem-in-previous-strtod-non-nearest-rou.patch + 1001-add-support-for-pthread_-get-set-attr_default_np-GNU.patch ldconfig __stack_chk_fail_local.c @@ -129,8 +154,33 @@ compat() { md5sums="9590a9d47ee64f220b3c12f7afb864ca musl-1.1.15.tar.gz c08825383e41e5dbcd3ffdfd2062dd47 0001-fix-asctime-day-month-names-not-to-vary-by-locale.patch -c6b8732eea4642112c56f45ff00e356a 0001-use-dynamic-buffer-for-getmntent.patch -fe6de41e930775994f64b772f1fdc45c 0001-fix-missing-integer-overflow-checks-in-regexec-buffe.patch +361341eafbd9df0537ae0c3c82ac62fb 0001-verify-that-ttyname-refers-to-the-same-file-as-the-f.patch +c5ab949b2cbfee521e1ac63eee7fdcde 0002-math-fix-128bit-long-double-inverse-trigonometric-fu.patch +adadb0b34060acb834cc7d6b02ecba2a 0003-fix-FFSYNC-by-changing-it-to-O_SYNC.patch +24d2150154f19dbd27303389ce17b525 0004-getdtablesize-fix-returning-hard-instead-of-soft-rli.patch +3449436c98bc888b84273eeb9cd2f3bb 0005-restore-_Noreturn-to-__assert_fail.patch +31e1eb80acc738f6a036f01b2df20b61 0006-fix-printf-regression-with-alt-form-octal-zero-flag-.patch +f62c94f99b4bc7d3ee098ecc96d2a1e6 0007-fix-ifru_data-and-ifcu_buf-types-in-net-if.h.patch +56cd68a29e0ce52fea65f28f5a785c83 0008-fix-if_indextoname-error-case.patch +a50530618bf95834f8219e822e6901a5 0009-add-missing-_unlocked-and-wcsftime_l-prototypes-to-w.patch +77b27159df61008af0bcb86d0986465f 0010-simplify-refactor-fflush-and-make-fflush_unlocked-an.patch +7c642b601ce81d5418f0666fc12a5fdd 0011-fix-undefined-behavior-in-sched.h-cpu_set_t-usage.patch +2394217798cfa65458c0d29e4dc5459d 0012-fix-getservby-_r-result-pointer-value-on-error.patch +de027daccdff4efee5d2801158eeedfd 0013-fix-strftime-y-for-negative-tm_year.patch +0b601e844bedd6b9af1da515bb40a0d5 0014-fix-missing-integer-overflow-checks-in-regexec-buffe.patch +8248da439e4a7489ead6213501e0dfc9 0015-fix-regexec-with-haystack-strings-longer-than-INT_MA.patch +47e54b3d82053d4a7d3eb7cd2c87fd97 0016-fix-integer-overflow-in-float-printf-needed-precisio.patch +dc76f0b70aa56c2f1284d3a79d04ca23 0017-fix-integer-overflows-and-uncaught-EOVERFLOW-in-prin.patch +17e6c4d84396cff82418b6860d499c2b 0018-fix-clock_nanosleep-error-case.patch +a679721e73f778d34a5f357fa884b49d 0018-use-dynamic-buffer-for-getmntent.patch +4fdc7b428e93213d28293a04344054c2 0019-add-pthread_setname_np.patch +df48f35ff1e8084b5b01223917a11c32 0020-fix-float-formatting-of-some-exact-halfway-cases.patch +499cf72f3ce881609130411ebb757be6 0021-fix-getopt_long_only-misinterpreting-as-an-option.patch +2507ca119bad0b33713a886e7ccba72a 0022-fix-gratuitous-undefined-behavior-in-strptime.patch +0169f80be7c767e3f8cd736bbf773bde 0023-fix-strtod-and-strtof-rounding-with-many-trailing-ze.patch +e9ef5ab7879cc113895d37783b217a70 0024-fix-strtod-int-optimization-in-non-nearest-rounding-.patch +2019fe5ed6214ff647d499fcd00fdb66 0025-fix-minor-problem-in-previous-strtod-non-nearest-rou.patch +62806d6be9fa3aedc99831d948abca65 1001-add-support-for-pthread_-get-set-attr_default_np-GNU.patch 830d01f7821b978df770b06db3790921 ldconfig 0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c 57ef2c63b9ec6a2041694ace97d4ffa2 getconf.c @@ -138,8 +188,33 @@ fe6de41e930775994f64b772f1fdc45c 0001-fix-missing-integer-overflow-checks-in-re 45f92f8d59cf84d765de698a9578dbf4 iconv.c" sha256sums="97e447c7ee2a7f613186ec54a93054fe15469fe34d7d323080f7ef38f5ecb0fa musl-1.1.15.tar.gz d157100aeed5b0866eb6d50288f63f26ea9900f1d4c7b8a1492294c912b5cc19 0001-fix-asctime-day-month-names-not-to-vary-by-locale.patch -e1671e2436954f2eec0d2f49dd53e9e66ff0106c9c017a7ff69d35bdb7051055 0001-use-dynamic-buffer-for-getmntent.patch -cec3fdd3a90f153a2c5a5d22ffd7429c14ecb105259a9c2540e46db6cfe71b55 0001-fix-missing-integer-overflow-checks-in-regexec-buffe.patch +c75f8433b499ecd7812423e8bd69e9262d36207f519c79afaa47651cd9924ab9 0001-verify-that-ttyname-refers-to-the-same-file-as-the-f.patch +a2bec5ce9121c02a38a71c9bccac06bda5fa0b6504f67ba78b994b0882ec25e8 0002-math-fix-128bit-long-double-inverse-trigonometric-fu.patch +81efc557cc27dc5d6f93431250703fbeb40682e06524f41eb07b3e3204a439b0 0003-fix-FFSYNC-by-changing-it-to-O_SYNC.patch +83b6ba4869f15f462011d891165de4b7a786d719c3315890a6ddd5d2709e91e0 0004-getdtablesize-fix-returning-hard-instead-of-soft-rli.patch +47bad5028c0d00a03736df33069eb8d3de803608ef7b790a594c0fe09f4d1ac1 0005-restore-_Noreturn-to-__assert_fail.patch +4ea253b510122665f51b9fd0c154c946374749c28359488e19000fd40e6c7e4e 0006-fix-printf-regression-with-alt-form-octal-zero-flag-.patch +95c4c747a12dcfeff9ea1c0a0fe5ea34921617dbc0bde9571237cab67803256f 0007-fix-ifru_data-and-ifcu_buf-types-in-net-if.h.patch +2f09325fe3e0a74c36c47df68799f31364ca687d6d5425282cb1cedb66683b88 0008-fix-if_indextoname-error-case.patch +b3472e284d5846ea22cc50d6ebae533c70babb9e6dce9200aef8f52a67e45461 0009-add-missing-_unlocked-and-wcsftime_l-prototypes-to-w.patch +88cfa5eb1f964fe821d1b67f43cf21849f9d8473a59cb91a702e04d564a59c8d 0010-simplify-refactor-fflush-and-make-fflush_unlocked-an.patch +e3d2642bf119577e68c651e7406e1d6c1201a0b8a8a9d972fda792f31bf4e6ea 0011-fix-undefined-behavior-in-sched.h-cpu_set_t-usage.patch +11b3e53d4a80d854667602c8b2daa6af81a95feea0e8c0c8c8a3cc86169b9197 0012-fix-getservby-_r-result-pointer-value-on-error.patch +df3b0c794c65b228c2f1246244ee913fbf5be1c20529ca7a3f87aceea4f8756f 0013-fix-strftime-y-for-negative-tm_year.patch +992d3f9cf5e380bdf31bb2fe52c6ed34642073539930023e1e964a23f498d73a 0014-fix-missing-integer-overflow-checks-in-regexec-buffe.patch +cbd3d60695a46c51e48d59260702029211c09be54b97ed73172e5c46f9604ec3 0015-fix-regexec-with-haystack-strings-longer-than-INT_MA.patch +79ac2d68335a42289783b0fe54e4634b23950ccd24c3a21b51f1243a985f18f3 0016-fix-integer-overflow-in-float-printf-needed-precisio.patch +ad4be27fa0bfbfc655d3d697457f64a785dcddb29784391891b612356c4a85f3 0017-fix-integer-overflows-and-uncaught-EOVERFLOW-in-prin.patch +6362fdd50e7a36d4a640d84faa5f65b4837f1c70ed0441076e59d596f7c839fe 0018-fix-clock_nanosleep-error-case.patch +f252aba723f2438ee1e9ee0940aed0017511dcb6d749bf6be7afdeaea4c782a5 0018-use-dynamic-buffer-for-getmntent.patch +a85b33f81034e3d801f2bdee5bc5ed85226dce49a652df59e436a45ed35a4701 0019-add-pthread_setname_np.patch +532dbff98f04ab4e76195ecbfce3e10bd4cc3df9f1e4f4080ad1090345f8c584 0020-fix-float-formatting-of-some-exact-halfway-cases.patch +1a1ed8134e4f28188a91441862402258618fa68158bc07a7f7b83fb416c12c63 0021-fix-getopt_long_only-misinterpreting-as-an-option.patch +7c33515437030f7bc267376ef910630d7a05e66183473dd3b1cbabca8bf4e538 0022-fix-gratuitous-undefined-behavior-in-strptime.patch +6254a8ec59f756cc044303650c18e55cb0afe9e5a6027f871da6537cdb2b08c5 0023-fix-strtod-and-strtof-rounding-with-many-trailing-ze.patch +8e074fa0f9434a8818951a48df08510b8c10c44ea9732a919f893476618a576d 0024-fix-strtod-int-optimization-in-non-nearest-rounding-.patch +301c1a16a84ec4c071e8a61360e3d3a21eb71cfcda581448938c7f3c40e11c85 0025-fix-minor-problem-in-previous-strtod-non-nearest-rou.patch +0403509c71580be517867be56b984359c3e7c413aba3f5b7f5b29d52561be328 1001-add-support-for-pthread_-get-set-attr_default_np-GNU.patch b4a2c06db38742e8c42c3c9838b285a7d8cdac6c091ff3df5ff9a15f1e41b9c7 ldconfig 299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c getconf.c @@ -147,8 +222,33 @@ d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c getconf.c f79a2930a2e5bb0624321589edf8b889d1e9b603e01e6b7ae214616605b3fdd7 iconv.c" sha512sums="9e923572c0d6bad3dc2d2646d4b0699c10b477ce6300ac6c6224895192a90667f581ddf6eda2ab8c4c16f47bde4bccb03bb90478638d136d9df721430f4d0163 musl-1.1.15.tar.gz 1a74d5f5e0f6f2fe6029ed0f18b4603f80c990f19aa13d83c5d1f40f032b2ffb3819aae13ae1f96415bb08571774eec164e71d09028f2a5db4ae9b77e48cafe7 0001-fix-asctime-day-month-names-not-to-vary-by-locale.patch -a25ff6c640fed110c124f2b12920111befa832202b906649e1d21613dda32b55bada0d59b310f4af2d4ae27c9ce2c92079ba1c919b4898c002f271c7a0c04878 0001-use-dynamic-buffer-for-getmntent.patch -6376167c67fdd22c0c4476fc38ff89ae3ce46435f72d7c506460944dd8f7d9153eed9696738dff5b320f09b474964f2a57394530eb40197ad58a6956e87e68ff 0001-fix-missing-integer-overflow-checks-in-regexec-buffe.patch +6ed71298ce739a4bc150a2e5f26a1c7fd285474d6fc919ef46b62e558cce0b6e81230b1cdfede461b0986644dcabec5c2380da9eeac8d97a15c5dd28d1cde9bf 0001-verify-that-ttyname-refers-to-the-same-file-as-the-f.patch +7a3e572ea60930ac4d177461c07bedaaa1dfcc7de946c17e0b588eb7bffb7295500aec4b723090cbbb49b1a941717ada7578e09d5590b121b4472135bc5d4dd5 0002-math-fix-128bit-long-double-inverse-trigonometric-fu.patch +e9fb5df57a21936c3b5036ffdb07cc0573b8ef131354645ba9014105daec14255deaf9595bd7e1bc900105a8feb80338daafb45b4a17406477a330d2946ad0a8 0003-fix-FFSYNC-by-changing-it-to-O_SYNC.patch +03e088bd22bfa2f88331bcdf0f00e2d77dea75352bded6d4770c3c57d3cfe35803c158e102fa46f12659422cb04fdf77dc2f1906191e6b242d43cf38fbd9e65b 0004-getdtablesize-fix-returning-hard-instead-of-soft-rli.patch +d0c5e3e51513073c56f859ca56b99402be0e7166a008be5c1d5ef2ceda9f2fb22e21d5da151aa0ba2656662fd14e0ec733779b3701183295760f7e2d3e3d794f 0005-restore-_Noreturn-to-__assert_fail.patch +f48e2abfc8283762b975c659825b71314252da645a184a8caede542fd12e331943c24abda4f6530d2756ff2403e25587957b41acbb563a2a8b8e5f4e5b24cbf3 0006-fix-printf-regression-with-alt-form-octal-zero-flag-.patch +057a424aea8dd74bea86d1d19bfe51a928e317931e00703467f8f7e4d1ab4df1993bb6309b41e124ca91cb52846bcb6f828b949413dcc80163aee3b22e662442 0007-fix-ifru_data-and-ifcu_buf-types-in-net-if.h.patch +2780f433c74a812362f38c6259a9c0df7ac95fe45c619dfe4cf1dd65059cfc146e7cadb75659840fdf4217bc558a72dcbe3a6fa19a7936c676c01f054b25df53 0008-fix-if_indextoname-error-case.patch +4713bc28f805ce6b4d9752aaf3c1e263ab62398ec062ba5f36201d3a5095b180a412262056c6d8bc43880bdc64a83017350a86c8bc64bedf1d0c44267bb715af 0009-add-missing-_unlocked-and-wcsftime_l-prototypes-to-w.patch +6ad28ad6e60a2574b7b233af5ffe36c958a00ccda9c12d1ce94d3e8ac25647da34c7238962858d1aa6a3639bc24238f7adff202e6e69e3f9cf51bd73c4a53036 0010-simplify-refactor-fflush-and-make-fflush_unlocked-an.patch +68cd55a3d8a3f003675f296980d28cd4724ce30f86c46f8ec0054e65c6e78810e42c8e8a01d392493be0c925b3049bbc5855fd00618380daea16985077a8c85a 0011-fix-undefined-behavior-in-sched.h-cpu_set_t-usage.patch +aa3f86355ec1a66405219308aa5ee21860e033020f7c73371da25e6e9bdf582d5c92b9afc9fc421cb9102a7903d7366fe55bcd38e0ec35e24c2b295f2fdf442d 0012-fix-getservby-_r-result-pointer-value-on-error.patch +542fa5545bacc2801f0ee24cbdd66a8b6f20543ef4c7f20df78a6d5f9fc59bbebad8e0a7debe43e1cae93642c093e55900b77e372fc2d9ad67559bc61ed6730b 0013-fix-strftime-y-for-negative-tm_year.patch +589b14e47395acfcb8a0958f94fc28af1cbbc2c7fb51a0789a2520ffdd0d40cd6cfebef748cf395080d5988c2be204036d72d717f938eefa4630db98db2273c2 0014-fix-missing-integer-overflow-checks-in-regexec-buffe.patch +5c8fe2d829f57d652307fe9bba3e834bfdc2fbd8d3e39cd4b37317af7c432df9ca91036ca201cc6360044785c56103e949efc835aae607c0ba26f3deba037687 0015-fix-regexec-with-haystack-strings-longer-than-INT_MA.patch +fb8eb9533b4104dba23e07761d5a86c0820b4836b4cb42084dec87e9c445548e61f108a4a03249665d381d41adc6a67e8ea89ddcdbdec842ab95a17a147b52e9 0016-fix-integer-overflow-in-float-printf-needed-precisio.patch +c70434513ae1543392d5cd2ccd9ddee0537aa591d284a9911eb9e7a6c0cbb0b801dcb88a876aeffb48d034b5cd4d825ee4ae1ae2e4ff37155b5c09cc98ce2475 0017-fix-integer-overflows-and-uncaught-EOVERFLOW-in-prin.patch +e2f824959524453faeab09cff815e5885ed2d9a68a42ad3c605800daf514754715f52dd22d84146841f70be14fb79feb0ee7dbc51ce03e168db1c49f93dc96f6 0018-fix-clock_nanosleep-error-case.patch +1c5a27a75be2220cb9b63074a4730f219d3cbef1d4a2e6b68f96340c5b7bf838390f3526df7654226ac3eae4381db3f63261fb9ac3efc837cec0bde4e3615fb1 0018-use-dynamic-buffer-for-getmntent.patch +5e905b988bae134083bea9487781207ec1fc42e6d2ca16f73cd545f3a4eb15108aa60c7dba47a73147d2bf90377a870c5b912e69381754eff8e424df887bc6a8 0019-add-pthread_setname_np.patch +1a22787f197fcdaf484391f659b033ece296c3e8c3faa92411acd8b7f6f859bda8bc19abdd15fcb5840abe4da32c51ac57691e3c78b8717a96795f765fe8de6e 0020-fix-float-formatting-of-some-exact-halfway-cases.patch +ffada28865028b059ca64dc24538db8786465830a227443a410ee7ba7ea06e8dae352a26e268be5ba4a91059d2fe2dfacdfb9ce03c4df08a98df76aa1c4f7ca8 0021-fix-getopt_long_only-misinterpreting-as-an-option.patch +d8aeffd16ca5df51d34341f92a452941daf94c69b112d74f4759773301c2753f9dde5858b0b102954202a8af568a9f8193d775260da75d6389fe50dd8c15d57b 0022-fix-gratuitous-undefined-behavior-in-strptime.patch +fe86988734ce3817182c25023ed2739c67f3d4c226570c1162713ea5849112cb98b6f9b778ecedafd086366b01392dbc0a871e427a51a8421949a64a97fd8214 0023-fix-strtod-and-strtof-rounding-with-many-trailing-ze.patch +3df8546a37467b716509bc0bbccef47aaf431e861442267aba0c08e19980d411f515d6a9c09c86b055dc709e83bcfab5f8bbfcb34d5c4b62e201a555839ff1fb 0024-fix-strtod-int-optimization-in-non-nearest-rounding-.patch +cc15bb90009ae546f3de75457fef6ea8bdccee2bacae9a1c3860a18120cbd610f2f1d4a358a41da25b7d16f3ae03fe9b40b235c9028af5319dc1bcc28d3a956f 0025-fix-minor-problem-in-previous-strtod-non-nearest-rou.patch +dc15dcb71e576f42268721c1caa036d91f3f67ab628a8527cd80d5689acea326b27e73013c02383b432027bed4c68c2cba75020088b760fae64d1680febf7a7d 1001-add-support-for-pthread_-get-set-attr_default_np-GNU.patch 8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig 062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c 0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c -- cgit v1.2.3