diff options
Diffstat (limited to 'packages/glibc/2.22')
13 files changed, 1371 insertions, 0 deletions
diff --git a/packages/glibc/2.22/100-sparc32-sem_open-missing-include.patch b/packages/glibc/2.22/100-sparc32-sem_open-missing-include.patch new file mode 100644 index 0000000..b481046 --- /dev/null +++ b/packages/glibc/2.22/100-sparc32-sem_open-missing-include.patch @@ -0,0 +1,21 @@ +commit 3f512ca79fda7854da188df0585e71467119206e +Author: Brett Neumeier <brett@neumeier.us> +Date: Mon Aug 31 15:27:21 2015 -0700 + + Fix non-v9 32-bit sparc build. + + [BZ #18870] + * sysdeps/sparc/sparc32/sem_open.c: Add missing #include + +diff --git a/sysdeps/sparc/sparc32/sem_open.c b/sysdeps/sparc/sparc32/sem_open.c +index 16cb9ad..59df2d7 100644 +--- a/sysdeps/sparc/sparc32/sem_open.c ++++ b/sysdeps/sparc/sparc32/sem_open.c +@@ -29,6 +29,7 @@ + #include <sys/mman.h> + #include <sys/stat.h> + #include "semaphoreP.h" ++#include <futex-internal.h> + #include <shm-directory.h> + + diff --git a/packages/glibc/2.22/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch b/packages/glibc/2.22/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch new file mode 100644 index 0000000..6fd663a --- /dev/null +++ b/packages/glibc/2.22/101-Suppress-GCC-6-warning-about-ambiguous-else-with-Wpa.patch @@ -0,0 +1,84 @@ +From df1cf48777fe4cd81ad7fb09ecbe5b31432b7c1c Mon Sep 17 00:00:00 2001 +From: Yvan Roux <yvan.roux@linaro.org> +Date: Fri, 15 Apr 2016 13:29:26 +0200 +Subject: [PATCH] Suppress GCC 6 warning about ambiguous 'else' with + -Wparentheses + +--- + ChangeLog | 5 +++++ + nis/nis_call.c | 20 +++++++++++--------- + stdlib/setenv.c | 26 ++++++++++++++------------ + 3 files changed, 30 insertions(+), 21 deletions(-) + +diff --git a/nis/nis_call.c b/nis/nis_call.c +index 3fa37e4..cb7839a 100644 +--- a/nis/nis_call.c ++++ b/nis/nis_call.c +@@ -680,16 +680,18 @@ nis_server_cache_add (const_nis_name name, int search_parent, + /* Choose which entry should be evicted from the cache. */ + loc = &nis_server_cache[0]; + if (*loc != NULL) +- for (i = 1; i < 16; ++i) +- if (nis_server_cache[i] == NULL) +- { ++ { ++ for (i = 1; i < 16; ++i) ++ if (nis_server_cache[i] == NULL) ++ { ++ loc = &nis_server_cache[i]; ++ break; ++ } ++ else if ((*loc)->uses > nis_server_cache[i]->uses ++ || ((*loc)->uses == nis_server_cache[i]->uses ++ && (*loc)->expires > nis_server_cache[i]->expires)) + loc = &nis_server_cache[i]; +- break; +- } +- else if ((*loc)->uses > nis_server_cache[i]->uses +- || ((*loc)->uses == nis_server_cache[i]->uses +- && (*loc)->expires > nis_server_cache[i]->expires)) +- loc = &nis_server_cache[i]; ++ } + old = *loc; + *loc = new; + +diff --git a/stdlib/setenv.c b/stdlib/setenv.c +index da61ee0..e66045f 100644 +--- a/stdlib/setenv.c ++++ b/stdlib/setenv.c +@@ -278,18 +278,20 @@ unsetenv (const char *name) + ep = __environ; + if (ep != NULL) + while (*ep != NULL) +- if (!strncmp (*ep, name, len) && (*ep)[len] == '=') +- { +- /* Found it. Remove this pointer by moving later ones back. */ +- char **dp = ep; +- +- do +- dp[0] = dp[1]; +- while (*dp++); +- /* Continue the loop in case NAME appears again. */ +- } +- else +- ++ep; ++ { ++ if (!strncmp (*ep, name, len) && (*ep)[len] == '=') ++ { ++ /* Found it. Remove this pointer by moving later ones back. */ ++ char **dp = ep; ++ ++ do ++ dp[0] = dp[1]; ++ while (*dp++); ++ /* Continue the loop in case NAME appears again. */ ++ } ++ else ++ ++ep; ++ } + + UNLOCK; + +-- +2.7.4 + diff --git a/packages/glibc/2.22/102-fix-signed-shift-overlow.patch b/packages/glibc/2.22/102-fix-signed-shift-overlow.patch new file mode 100644 index 0000000..ef49f83 --- /dev/null +++ b/packages/glibc/2.22/102-fix-signed-shift-overlow.patch @@ -0,0 +1,98 @@ +commit 5542236837c5c41435f8282ec92799f480c36f18 +Author: Paul Eggert <eggert@cs.ucla.edu> +Date: Tue Jul 21 22:50:29 2015 -0700 + + Port the 0x7efe...feff pattern to GCC 6. + + See Steve Ellcey's bug report in: + https://sourceware.org/ml/libc-alpha/2015-07/msg00673.html + * string/memrchr.c (MEMRCHR): + * string/rawmemchr.c (RAWMEMCHR): + * string/strchr.c (strchr): + * string/strchrnul.c (STRCHRNUL): + Rewrite code to avoid issues with signed shift overflow. + +diff --git a/string/memrchr.c b/string/memrchr.c +index 0c8fd84..86cd5b9 100644 +--- a/string/memrchr.c ++++ b/string/memrchr.c +@@ -96,15 +96,8 @@ MEMRCHR + + The 1-bits make sure that carries propagate to the next 0-bit. + The 0-bits provide holes for carries to fall into. */ +- +- if (sizeof (longword) != 4 && sizeof (longword) != 8) +- abort (); +- +-#if LONG_MAX <= LONG_MAX_32_BITS +- magic_bits = 0x7efefeff; +-#else +- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff; +-#endif ++ magic_bits = -1; ++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1; + + /* Set up a longword, each of whose bytes is C. */ + charmask = c | (c << 8); +diff --git a/string/rawmemchr.c b/string/rawmemchr.c +index 05b22be..228ca9d 100644 +--- a/string/rawmemchr.c ++++ b/string/rawmemchr.c +@@ -86,15 +86,8 @@ RAWMEMCHR (s, c_in) + + The 1-bits make sure that carries propagate to the next 0-bit. + The 0-bits provide holes for carries to fall into. */ +- +- if (sizeof (longword) != 4 && sizeof (longword) != 8) +- abort (); +- +-#if LONG_MAX <= LONG_MAX_32_BITS +- magic_bits = 0x7efefeff; +-#else +- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff; +-#endif ++ magic_bits = -1; ++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1; + + /* Set up a longword, each of whose bytes is C. */ + charmask = c | (c << 8); +diff --git a/string/strchr.c b/string/strchr.c +index 5f90075..f13b2b3 100644 +--- a/string/strchr.c ++++ b/string/strchr.c +@@ -60,13 +60,8 @@ strchr (const char *s, int c_in) + + The 1-bits make sure that carries propagate to the next 0-bit. + The 0-bits provide holes for carries to fall into. */ +- switch (sizeof (longword)) +- { +- case 4: magic_bits = 0x7efefeffL; break; +- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break; +- default: +- abort (); +- } ++ magic_bits = -1; ++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1; + + /* Set up a longword, each of whose bytes is C. */ + charmask = c | (c << 8); +diff --git a/string/strchrnul.c b/string/strchrnul.c +index 2678f1d..daf0b3f 100644 +--- a/string/strchrnul.c ++++ b/string/strchrnul.c +@@ -66,13 +66,8 @@ STRCHRNUL (s, c_in) + + The 1-bits make sure that carries propagate to the next 0-bit. + The 0-bits provide holes for carries to fall into. */ +- switch (sizeof (longword)) +- { +- case 4: magic_bits = 0x7efefeffL; break; +- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break; +- default: +- abort (); +- } ++ magic_bits = -1; ++ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1; + + /* Set up a longword, each of whose bytes is C. */ + charmask = c | (c << 8); diff --git a/packages/glibc/2.22/103-dl-openat64-variadic.patch b/packages/glibc/2.22/103-dl-openat64-variadic.patch new file mode 100644 index 0000000..302088e --- /dev/null +++ b/packages/glibc/2.22/103-dl-openat64-variadic.patch @@ -0,0 +1,195 @@ +commit 9dd346ff431fc761f1b748bd4da8bb59f7652094 +Author: Joseph Myers <joseph@codesourcery.com> +Date: Tue Oct 20 11:54:09 2015 +0000 + + Convert 113 more function definitions to prototype style (files with assertions). + + This mostly automatically-generated patch converts 113 function + definitions in glibc from old-style K&R to prototype-style. Following + my other recent such patches, this one deals with the case of function + definitions in files that either contain assertions or where grep + suggested they might contain assertions - and thus where it isn't + possible to use a simple object code comparison as a sanity check on + the correctness of the patch, because line numbers are changed. + + A few such automatically-generated changes needed to be supplemented + by manual changes for the result to compile. openat64 had a prototype + declaration with "..." but an old-style definition in + sysdeps/unix/sysv/linux/dl-openat64.c, and "..." needed adding to the + generated prototype in the definition (I've filed + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68024> for diagnosing + such cases in GCC; the old state was undefined behavior not requiring + a diagnostic, but one seems a good idea). In addition, as Florian has + noted regparm attribute mismatches between declaration and definition + are only diagnosed for prototype definitions, and five functions + needed internal_function added to their definitions (in the case of + __pthread_mutex_cond_lock, via the macro definition of + __pthread_mutex_lock) to compile on i386. + + After this patch is in, remaining old-style definitions are probably + most readily fixed manually before we can turn on + -Wold-style-definition for all builds. + + Tested for x86_64 and x86 (testsuite). + + * crypt/md5-crypt.c (__md5_crypt_r): Convert to prototype-style + function definition. + * crypt/sha256-crypt.c (__sha256_crypt_r): Likewise. + * crypt/sha512-crypt.c (__sha512_crypt_r): Likewise. + * debug/backtracesyms.c (__backtrace_symbols): Likewise. + * elf/dl-minimal.c (_itoa): Likewise. + * hurd/hurdmalloc.c (malloc): Likewise. + (free): Likewise. + (realloc): Likewise. + * inet/inet6_option.c (inet6_option_space): Likewise. + (inet6_option_init): Likewise. + (inet6_option_append): Likewise. + (inet6_option_alloc): Likewise. + (inet6_option_next): Likewise. + (inet6_option_find): Likewise. + * io/ftw.c (FTW_NAME): Likewise. + (NFTW_NAME): Likewise. + (NFTW_NEW_NAME): Likewise. + (NFTW_OLD_NAME): Likewise. + * libio/iofwide.c (_IO_fwide): Likewise. + * libio/strops.c (_IO_str_init_static_internal): Likewise. + (_IO_str_init_static): Likewise. + (_IO_str_init_readonly): Likewise. + (_IO_str_overflow): Likewise. + (_IO_str_underflow): Likewise. + (_IO_str_count): Likewise. + (_IO_str_seekoff): Likewise. + (_IO_str_pbackfail): Likewise. + (_IO_str_finish): Likewise. + * libio/wstrops.c (_IO_wstr_init_static): Likewise. + (_IO_wstr_overflow): Likewise. + (_IO_wstr_underflow): Likewise. + (_IO_wstr_count): Likewise. + (_IO_wstr_seekoff): Likewise. + (_IO_wstr_pbackfail): Likewise. + (_IO_wstr_finish): Likewise. + * locale/programs/localedef.c (normalize_codeset): Likewise. + * locale/programs/locarchive.c (add_locale_to_archive): Likewise. + (add_locales_to_archive): Likewise. + (delete_locales_from_archive): Likewise. + * malloc/malloc.c (__libc_mallinfo): Likewise. + * math/gen-auto-libm-tests.c (init_fp_formats): Likewise. + * misc/tsearch.c (__tfind): Likewise. + * nptl/pthread_attr_destroy.c (__pthread_attr_destroy): Likewise. + * nptl/pthread_attr_getdetachstate.c + (__pthread_attr_getdetachstate): Likewise. + * nptl/pthread_attr_getguardsize.c (pthread_attr_getguardsize): + Likewise. + * nptl/pthread_attr_getinheritsched.c + (__pthread_attr_getinheritsched): Likewise. + * nptl/pthread_attr_getschedparam.c + (__pthread_attr_getschedparam): Likewise. + * nptl/pthread_attr_getschedpolicy.c + (__pthread_attr_getschedpolicy): Likewise. + * nptl/pthread_attr_getscope.c (__pthread_attr_getscope): + Likewise. + * nptl/pthread_attr_getstack.c (__pthread_attr_getstack): + Likewise. + * nptl/pthread_attr_getstackaddr.c (__pthread_attr_getstackaddr): + Likewise. + * nptl/pthread_attr_getstacksize.c (__pthread_attr_getstacksize): + Likewise. + * nptl/pthread_attr_init.c (__pthread_attr_init_2_1): Likewise. + (__pthread_attr_init_2_0): Likewise. + * nptl/pthread_attr_setdetachstate.c + (__pthread_attr_setdetachstate): Likewise. + * nptl/pthread_attr_setguardsize.c (pthread_attr_setguardsize): + Likewise. + * nptl/pthread_attr_setinheritsched.c + (__pthread_attr_setinheritsched): Likewise. + * nptl/pthread_attr_setschedparam.c + (__pthread_attr_setschedparam): Likewise. + * nptl/pthread_attr_setschedpolicy.c + (__pthread_attr_setschedpolicy): Likewise. + * nptl/pthread_attr_setscope.c (__pthread_attr_setscope): + Likewise. + * nptl/pthread_attr_setstack.c (__pthread_attr_setstack): + Likewise. + * nptl/pthread_attr_setstackaddr.c (__pthread_attr_setstackaddr): + Likewise. + * nptl/pthread_attr_setstacksize.c (__pthread_attr_setstacksize): + Likewise. + * nptl/pthread_condattr_setclock.c (pthread_condattr_setclock): + Likewise. + * nptl/pthread_create.c (__find_in_stack_list): Likewise. + * nptl/pthread_getattr_np.c (pthread_getattr_np): Likewise. + * nptl/pthread_mutex_cond_lock.c (__pthread_mutex_lock): Define to + use internal_function. + * nptl/pthread_mutex_init.c (__pthread_mutex_init): Convert to + prototype-style function definition. + * nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise. + (__pthread_mutex_cond_lock_adjust): Likewise. Use + internal_function. + * nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock): + Convert to prototype-style function definition. + * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock): + Likewise. + * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt): + Likewise. + (__pthread_mutex_unlock): Likewise. + * nptl_db/td_ta_clear_event.c (td_ta_clear_event): Likewise. + * nptl_db/td_ta_set_event.c (td_ta_set_event): Likewise. + * nptl_db/td_thr_clear_event.c (td_thr_clear_event): Likewise. + * nptl_db/td_thr_event_enable.c (td_thr_event_enable): Likewise. + * nptl_db/td_thr_set_event.c (td_thr_set_event): Likewise. + * nss/makedb.c (process_input): Likewise. + * posix/fnmatch.c (__strchrnul): Likewise. + (__wcschrnul): Likewise. + (fnmatch): Likewise. + * posix/fnmatch_loop.c (FCT): Likewise. + * posix/glob.c (globfree): Likewise. + (__glob_pattern_type): Likewise. + (__glob_pattern_p): Likewise. + * posix/regcomp.c (re_compile_pattern): Likewise. + (re_set_syntax): Likewise. + (re_compile_fastmap): Likewise. + (regcomp): Likewise. + (regerror): Likewise. + (regfree): Likewise. + * posix/regexec.c (regexec): Likewise. + (re_match): Likewise. + (re_search): Likewise. + (re_match_2): Likewise. + (re_search_2): Likewise. + (re_search_stub): Likewise. Use internal_function + (re_copy_regs): Likewise. + (re_set_registers): Convert to prototype-style function + definition. + (prune_impossible_nodes): Likewise. Use internal_function. + * resolv/inet_net_pton.c (inet_net_pton): Convert to + prototype-style function definition. + (inet_net_pton_ipv4): Likewise. + * stdlib/strtod_l.c (____STRTOF_INTERNAL): Likewise. + * sysdeps/pthread/aio_cancel.c (aio_cancel): Likewise. + * sysdeps/pthread/aio_suspend.c (aio_suspend): Likewise. + * sysdeps/pthread/timer_delete.c (timer_delete): Likewise. + * sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise. + Make variadic. + * time/strptime_l.c (localtime_r): Convert to prototype-style + function definition. + * wcsmbs/mbsnrtowcs.c (__mbsnrtowcs): Likewise. + * wcsmbs/mbsrtowcs_l.c (__mbsrtowcs_l): Likewise. + * wcsmbs/wcsnrtombs.c (__wcsnrtombs): Likewise. + * wcsmbs/wcsrtombs.c (__wcsrtombs): Likewise. + +diff --git a/sysdeps/unix/sysv/linux/dl-openat64.c b/sysdeps/unix/sysv/linux/dl-openat64.c +index 7d100bb..7eea0ca 100644 +--- a/sysdeps/unix/sysv/linux/dl-openat64.c ++++ b/sysdeps/unix/sysv/linux/dl-openat64.c +@@ -23,10 +23,7 @@ + + + int +-openat64 (dfd, file, oflag) +- int dfd; +- const char *file; +- int oflag; ++openat64 (int dfd, const char *file, int oflag, ...) + { + assert (!__OPEN_NEEDS_MODE (oflag)); + diff --git a/packages/glibc/2.22/104-unused-variables.patch b/packages/glibc/2.22/104-unused-variables.patch new file mode 100644 index 0000000..fd4def0 --- /dev/null +++ b/packages/glibc/2.22/104-unused-variables.patch @@ -0,0 +1,178 @@ +commit 6565fcb6e189d67b5a3f321453daebb805056d73 +Author: Wilco Dijkstra <wdijkstr@arm.com> +Date: Fri Sep 18 20:27:20 2015 +0100 + + Fix several build failures with GCC6 due to unused static variables. + + 2015-09-18 Wilco Dijkstra <wdijkstr@arm.com> + + * resolv/base64.c (rcsid): Remove unused static. + * sysdeps/ieee754/dbl-64/atnat2.h (qpi1): Remove unused + static. (tqpi1): Likewise. + * sysdeps/ieee754/dbl-64/uexp.h (one): Likewise. + * sysdeps/ieee754/dbl-64/upow.h (sqrt_2): Likewise. + * sysdeps/ieee754/flt-32/e_log10f.c (one): Likewise. + * sysdeps/ieee754/flt-32/s_cosf.c (one): Likewise. + * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (zero): Likewise. + * sysdeps/ieee754/ldbl-128/s_erfl.c (half): Likewise. + * sysdeps/ieee754/ldbl-128/s_log1pl.c (maxlog): Likewise. + * timezone/private.h (time_t_min): Likewise. (time_t_max): + Likewise. + +diff --git a/resolv/base64.c b/resolv/base64.c +index ea584ed..519e5d2 100644 +--- a/resolv/base64.c ++++ b/resolv/base64.c +@@ -40,10 +40,6 @@ + * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +-#if !defined(LINT) && !defined(CODECENTER) +-static const char rcsid[] = "$BINDId: base64.c,v 8.7 1999/10/13 16:39:33 vixie Exp $"; +-#endif /* not lint */ +- + #include <sys/types.h> + #include <sys/param.h> + #include <sys/socket.h> +diff --git a/sysdeps/ieee754/dbl-64/atnat2.h b/sysdeps/ieee754/dbl-64/atnat2.h +index e0d65af..82943f9 100644 +--- a/sysdeps/ieee754/dbl-64/atnat2.h ++++ b/sysdeps/ieee754/dbl-64/atnat2.h +@@ -65,10 +65,8 @@ + /**/ hpi1 = {{0x3c91a626, 0x33145c07} }, /* pi/2-hpi */ + /**/ mhpi = {{0xbff921fb, 0x54442d18} }, /* -pi/2 */ + /**/ qpi = {{0x3fe921fb, 0x54442d18} }, /* pi/4 */ +-/**/ qpi1 = {{0x3c81a626, 0x33145c07} }, /* pi/4-qpi */ + /**/ mqpi = {{0xbfe921fb, 0x54442d18} }, /* -pi/4 */ + /**/ tqpi = {{0x4002d97c, 0x7f3321d2} }, /* 3pi/4 */ +-/**/ tqpi1 = {{0x3c9a7939, 0x4c9e8a0a} }, /* 3pi/4-tqpi */ + /**/ mtqpi = {{0xc002d97c, 0x7f3321d2} }, /* -3pi/4 */ + /**/ u1 = {{0x3c314c2a, 0x00000000} }, /* 9.377e-19 */ + /**/ u2 = {{0x3bf955e4, 0x00000000} }, /* 8.584e-20 */ +@@ -129,10 +127,8 @@ + /**/ hpi1 = {{0x33145c07, 0x3c91a626} }, /* pi/2-hpi */ + /**/ mhpi = {{0x54442d18, 0xbff921fb} }, /* -pi/2 */ + /**/ qpi = {{0x54442d18, 0x3fe921fb} }, /* pi/4 */ +-/**/ qpi1 = {{0x33145c07, 0x3c81a626} }, /* pi/4-qpi */ + /**/ mqpi = {{0x54442d18, 0xbfe921fb} }, /* -pi/4 */ + /**/ tqpi = {{0x7f3321d2, 0x4002d97c} }, /* 3pi/4 */ +-/**/ tqpi1 = {{0x4c9e8a0a, 0x3c9a7939} }, /* 3pi/4-tqpi */ + /**/ mtqpi = {{0x7f3321d2, 0xc002d97c} }, /* -3pi/4 */ + /**/ u1 = {{0x00000000, 0x3c314c2a} }, /* 9.377e-19 */ + /**/ u2 = {{0x00000000, 0x3bf955e4} }, /* 8.584e-20 */ +diff --git a/sysdeps/ieee754/dbl-64/uexp.h b/sysdeps/ieee754/dbl-64/uexp.h +index 6817eaf..42b21f2 100644 +--- a/sysdeps/ieee754/dbl-64/uexp.h ++++ b/sysdeps/ieee754/dbl-64/uexp.h +@@ -29,7 +29,7 @@ + + #include "mydefs.h" + +-const static double one = 1.0, zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300, ++const static double zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300, + err_0 = 1.000014, err_1 = 0.000016; + const static int4 bigint = 0x40862002, + badint = 0x40876000,smallint = 0x3C8fffff; +diff --git a/sysdeps/ieee754/dbl-64/upow.h b/sysdeps/ieee754/dbl-64/upow.h +index c8569a9..b4911e5 100644 +--- a/sysdeps/ieee754/dbl-64/upow.h ++++ b/sysdeps/ieee754/dbl-64/upow.h +@@ -34,7 +34,6 @@ + /**/ nZERO = {{0x80000000, 0}}, /* -0.0 */ + /**/ INF = {{0x7ff00000, 0x00000000}}, /* INF */ + /**/ nINF = {{0xfff00000, 0x00000000}}, /* -INF */ +-/**/ sqrt_2 = {{0x3ff6a09e, 0x667f3bcc}}, /* sqrt(2) */ + /**/ ln2a = {{0x3fe62e42, 0xfefa3800}}, /* ln(2) 43 bits */ + /**/ ln2b = {{0x3d2ef357, 0x93c76730}}, /* ln(2)-ln2a */ + /**/ bigu = {{0x4297ffff, 0xfffffd2c}}, /* 1.5*2**42 -724*2**-10 */ +@@ -48,7 +47,6 @@ + /**/ nZERO = {{0, 0x80000000}}, /* -0.0 */ + /**/ INF = {{0x00000000, 0x7ff00000}}, /* INF */ + /**/ nINF = {{0x00000000, 0xfff00000}}, /* -INF */ +-/**/ sqrt_2 = {{0x667f3bcc, 0x3ff6a09e}}, /* sqrt(2) */ + /**/ ln2a = {{0xfefa3800, 0x3fe62e42}}, /* ln(2) 43 bits */ + /**/ ln2b = {{0x93c76730, 0x3d2ef357}}, /* ln(2)-ln2a */ + /**/ bigu = {{0xfffffd2c, 0x4297ffff}}, /* 1.5*2**42 -724*2**-10 */ +diff --git a/sysdeps/ieee754/flt-32/e_log10f.c b/sysdeps/ieee754/flt-32/e_log10f.c +index 96f0e81..1daeef7 100644 +--- a/sysdeps/ieee754/flt-32/e_log10f.c ++++ b/sysdeps/ieee754/flt-32/e_log10f.c +@@ -22,8 +22,6 @@ ivln10 = 4.3429449201e-01, /* 0x3ede5bd9 */ + log10_2hi = 3.0102920532e-01, /* 0x3e9a2080 */ + log10_2lo = 7.9034151668e-07; /* 0x355427db */ + +-static const float zero = 0.0; +- + float + __ieee754_log10f(float x) + { +diff --git a/sysdeps/ieee754/flt-32/s_cosf.c b/sysdeps/ieee754/flt-32/s_cosf.c +index 864ab27..0affd40 100644 +--- a/sysdeps/ieee754/flt-32/s_cosf.c ++++ b/sysdeps/ieee754/flt-32/s_cosf.c +@@ -21,8 +21,6 @@ static char rcsid[] = "$NetBSD: s_cosf.c,v 1.4 1995/05/10 20:47:03 jtc Exp $"; + #include <math.h> + #include <math_private.h> + +-static const float one=1.0; +- + #ifndef COSF + # define COSF_FUNC __cosf + #else +diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c +index 500aacc..ab5a96e 100644 +--- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c ++++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c +@@ -82,7 +82,6 @@ DIAG_IGNORE_NEEDS_COMMENT (4.6, "-Woverflow"); + static const long double MAXLGM = 1.0485738685148938358098967157129705071571E4928L; + DIAG_POP_NEEDS_COMMENT; + static const long double one = 1.0L; +-static const long double zero = 0.0L; + static const long double huge = LDBL_MAX; + + /* log gamma(x) = ( x - 0.5 ) * log(x) - x + LS2PI + 1/x P(1/x^2) +diff --git a/sysdeps/ieee754/ldbl-128/s_erfl.c b/sysdeps/ieee754/ldbl-128/s_erfl.c +index fa4609f..08c80a3 100644 +--- a/sysdeps/ieee754/ldbl-128/s_erfl.c ++++ b/sysdeps/ieee754/ldbl-128/s_erfl.c +@@ -140,7 +140,6 @@ deval (long double x, const long double *p, int n) + + static const long double + tiny = 1e-4931L, +- half = 0.5L, + one = 1.0L, + two = 2.0L, + /* 2/sqrt(pi) - 1 */ +diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c +index ff759bc..9609550 100644 +--- a/sysdeps/ieee754/ldbl-128/s_log1pl.c ++++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c +@@ -117,7 +117,6 @@ static const long double C2 = 1.428606820309417232121458176568075500134E-6L; + + static const long double sqrth = 0.7071067811865475244008443621048490392848L; + /* ln (2^16384 * (1 - 2^-113)) */ +-static const long double maxlog = 1.1356523406294143949491931077970764891253E4L; + static const long double zero = 0.0L; + + long double +diff --git a/timezone/private.h b/timezone/private.h +index 4e8f4ae..ed19e06 100644 +--- a/timezone/private.h ++++ b/timezone/private.h +@@ -326,16 +326,6 @@ const char * scheck(const char * string, const char * format); + #define TYPE_SIGNED(type) (((type) -1) < 0) + #endif /* !defined TYPE_SIGNED */ + +-/* The minimum and maximum finite time values. */ +-static time_t const time_t_min = +- (TYPE_SIGNED(time_t) +- ? (time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1) +- : 0); +-static time_t const time_t_max = +- (TYPE_SIGNED(time_t) +- ? - (~ 0 < 0) - ((time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1)) +- : -1); +- + #ifndef INT_STRLEN_MAXIMUM + /* + ** 302 / 1000 is log10(2.0) rounded up. diff --git a/packages/glibc/2.22/105-misleading-indentation.patch b/packages/glibc/2.22/105-misleading-indentation.patch new file mode 100644 index 0000000..1dd8d85 --- /dev/null +++ b/packages/glibc/2.22/105-misleading-indentation.patch @@ -0,0 +1,24 @@ +commit 976ef870542580cf5fed896c2c652b3e1a95f9da +Author: Steve Ellcey <sellcey@mips.com> +Date: Fri Dec 11 09:19:37 2015 -0800 + + Fix indentation. + + * sysdeps/ieee754/flt-32/k_rem_pio2f.c (__kernel_rem_pio2f): + Fix indentation. + +diff --git a/sysdeps/ieee754/flt-32/k_rem_pio2f.c b/sysdeps/ieee754/flt-32/k_rem_pio2f.c +index 0c7685c..392afdb 100644 +--- a/sysdeps/ieee754/flt-32/k_rem_pio2f.c ++++ b/sysdeps/ieee754/flt-32/k_rem_pio2f.c +@@ -65,7 +65,9 @@ int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const int32 + + /* compute q[0],q[1],...q[jk] */ + for (i=0;i<=jk;i++) { +- for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw; ++ for(j=0,fw=0.0;j<=jx;j++) ++ fw += x[j]*f[jx+i-j]; ++ q[i] = fw; + } + + jz = jk; diff --git a/packages/glibc/2.22/120-cve-2105-7547-getaddrinfo-stack.patch b/packages/glibc/2.22/120-cve-2105-7547-getaddrinfo-stack.patch new file mode 100644 index 0000000..257c5f2 --- /dev/null +++ b/packages/glibc/2.22/120-cve-2105-7547-getaddrinfo-stack.patch @@ -0,0 +1,551 @@ +diff -ruN glibc-2.22.orig/resolv/nss_dns/dns-host.c glibc-2.22/resolv/nss_dns/dns-host.c +--- glibc-2.22.orig/resolv/nss_dns/dns-host.c 2015-08-04 23:42:21.000000000 -0700 ++++ glibc-2.22/resolv/nss_dns/dns-host.c 2016-02-16 13:38:38.000000000 -0800 +@@ -1031,7 +1031,10 @@ + int h_namelen = 0; + + if (ancount == 0) +- return NSS_STATUS_NOTFOUND; ++ { ++ *h_errnop = HOST_NOT_FOUND; ++ return NSS_STATUS_NOTFOUND; ++ } + + while (ancount-- > 0 && cp < end_of_message && had_error == 0) + { +@@ -1208,7 +1211,14 @@ + /* Special case here: if the resolver sent a result but it only + contains a CNAME while we are looking for a T_A or T_AAAA record, + we fail with NOTFOUND instead of TRYAGAIN. */ +- return canon == NULL ? NSS_STATUS_TRYAGAIN : NSS_STATUS_NOTFOUND; ++ if (canon != NULL) ++ { ++ *h_errnop = HOST_NOT_FOUND; ++ return NSS_STATUS_NOTFOUND; ++ } ++ ++ *h_errnop = NETDB_INTERNAL; ++ return NSS_STATUS_TRYAGAIN; + } + + +@@ -1222,11 +1232,101 @@ + + enum nss_status status = NSS_STATUS_NOTFOUND; + ++ /* Combining the NSS status of two distinct queries requires some ++ compromise and attention to symmetry (A or AAAA queries can be ++ returned in any order). What follows is a breakdown of how this ++ code is expected to work and why. We discuss only SUCCESS, ++ TRYAGAIN, NOTFOUND and UNAVAIL, since they are the only returns ++ that apply (though RETURN and MERGE exist). We make a distinction ++ between TRYAGAIN (recoverable) and TRYAGAIN' (not-recoverable). ++ A recoverable TRYAGAIN is almost always due to buffer size issues ++ and returns ERANGE in errno and the caller is expected to retry ++ with a larger buffer. ++ ++ Lastly, you may be tempted to make significant changes to the ++ conditions in this code to bring about symmetry between responses. ++ Please don't change anything without due consideration for ++ expected application behaviour. Some of the synthesized responses ++ aren't very well thought out and sometimes appear to imply that ++ IPv4 responses are always answer 1, and IPv6 responses are always ++ answer 2, but that's not true (see the implemetnation of send_dg ++ and send_vc to see response can arrive in any order, particlarly ++ for UDP). However, we expect it holds roughly enough of the time ++ that this code works, but certainly needs to be fixed to make this ++ a more robust implementation. ++ ++ ---------------------------------------------- ++ | Answer 1 Status / | Synthesized | Reason | ++ | Answer 2 Status | Status | | ++ |--------------------------------------------| ++ | SUCCESS/SUCCESS | SUCCESS | [1] | ++ | SUCCESS/TRYAGAIN | TRYAGAIN | [5] | ++ | SUCCESS/TRYAGAIN' | SUCCESS | [1] | ++ | SUCCESS/NOTFOUND | SUCCESS | [1] | ++ | SUCCESS/UNAVAIL | SUCCESS | [1] | ++ | TRYAGAIN/SUCCESS | TRYAGAIN | [2] | ++ | TRYAGAIN/TRYAGAIN | TRYAGAIN | [2] | ++ | TRYAGAIN/TRYAGAIN' | TRYAGAIN | [2] | ++ | TRYAGAIN/NOTFOUND | TRYAGAIN | [2] | ++ | TRYAGAIN/UNAVAIL | TRYAGAIN | [2] | ++ | TRYAGAIN'/SUCCESS | SUCCESS | [3] | ++ | TRYAGAIN'/TRYAGAIN | TRYAGAIN | [3] | ++ | TRYAGAIN'/TRYAGAIN' | TRYAGAIN' | [3] | ++ | TRYAGAIN'/NOTFOUND | TRYAGAIN' | [3] | ++ | TRYAGAIN'/UNAVAIL | UNAVAIL | [3] | ++ | NOTFOUND/SUCCESS | SUCCESS | [3] | ++ | NOTFOUND/TRYAGAIN | TRYAGAIN | [3] | ++ | NOTFOUND/TRYAGAIN' | TRYAGAIN' | [3] | ++ | NOTFOUND/NOTFOUND | NOTFOUND | [3] | ++ | NOTFOUND/UNAVAIL | UNAVAIL | [3] | ++ | UNAVAIL/SUCCESS | UNAVAIL | [4] | ++ | UNAVAIL/TRYAGAIN | UNAVAIL | [4] | ++ | UNAVAIL/TRYAGAIN' | UNAVAIL | [4] | ++ | UNAVAIL/NOTFOUND | UNAVAIL | [4] | ++ | UNAVAIL/UNAVAIL | UNAVAIL | [4] | ++ ---------------------------------------------- ++ ++ [1] If the first response is a success we return success. ++ This ignores the state of the second answer and in fact ++ incorrectly sets errno and h_errno to that of the second ++ answer. However because the response is a success we ignore ++ *errnop and *h_errnop (though that means you touched errno on ++ success). We are being conservative here and returning the ++ likely IPv4 response in the first answer as a success. ++ ++ [2] If the first response is a recoverable TRYAGAIN we return ++ that instead of looking at the second response. The ++ expectation here is that we have failed to get an IPv4 response ++ and should retry both queries. ++ ++ [3] If the first response was not a SUCCESS and the second ++ response is not NOTFOUND (had a SUCCESS, need to TRYAGAIN, ++ or failed entirely e.g. TRYAGAIN' and UNAVAIL) then use the ++ result from the second response, otherwise the first responses ++ status is used. Again we have some odd side-effects when the ++ second response is NOTFOUND because we overwrite *errnop and ++ *h_errnop that means that a first answer of NOTFOUND might see ++ its *errnop and *h_errnop values altered. Whether it matters ++ in practice that a first response NOTFOUND has the wrong ++ *errnop and *h_errnop is undecided. ++ ++ [4] If the first response is UNAVAIL we return that instead of ++ looking at the second response. The expectation here is that ++ it will have failed similarly e.g. configuration failure. ++ ++ [5] Testing this code is complicated by the fact that truncated ++ second response buffers might be returned as SUCCESS if the ++ first answer is a SUCCESS. To fix this we add symmetry to ++ TRYAGAIN with the second response. If the second response ++ is a recoverable error we now return TRYAGIN even if the first ++ response was SUCCESS. */ ++ + if (anslen1 > 0) + status = gaih_getanswer_slice(answer1, anslen1, qname, + &pat, &buffer, &buflen, + errnop, h_errnop, ttlp, + &first); ++ + if ((status == NSS_STATUS_SUCCESS || status == NSS_STATUS_NOTFOUND + || (status == NSS_STATUS_TRYAGAIN + /* We want to look at the second answer in case of an +@@ -1242,8 +1342,15 @@ + &pat, &buffer, &buflen, + errnop, h_errnop, ttlp, + &first); ++ /* Use the second response status in some cases. */ + if (status != NSS_STATUS_SUCCESS && status2 != NSS_STATUS_NOTFOUND) + status = status2; ++ /* Do not return a truncated second response (unless it was ++ unavoidable e.g. unrecoverable TRYAGAIN). */ ++ if (status == NSS_STATUS_SUCCESS ++ && (status2 == NSS_STATUS_TRYAGAIN ++ && *errnop == ERANGE && *h_errnop != NO_RECOVERY)) ++ status = NSS_STATUS_TRYAGAIN; + } + + return status; +diff -ruN glibc-2.22.orig/resolv/res_query.c glibc-2.22/resolv/res_query.c +--- glibc-2.22.orig/resolv/res_query.c 2015-08-04 23:42:21.000000000 -0700 ++++ glibc-2.22/resolv/res_query.c 2016-02-16 13:38:38.000000000 -0800 +@@ -396,6 +396,7 @@ + { + free (*answerp2); + *answerp2 = NULL; ++ *nanswerp2 = 0; + *answerp2_malloced = 0; + } + } +@@ -447,6 +448,7 @@ + { + free (*answerp2); + *answerp2 = NULL; ++ *nanswerp2 = 0; + *answerp2_malloced = 0; + } + +@@ -521,6 +523,7 @@ + { + free (*answerp2); + *answerp2 = NULL; ++ *nanswerp2 = 0; + *answerp2_malloced = 0; + } + if (saved_herrno != -1) +diff -ruN glibc-2.22.orig/resolv/res_send.c glibc-2.22/resolv/res_send.c +--- glibc-2.22.orig/resolv/res_send.c 2015-08-04 23:42:21.000000000 -0700 ++++ glibc-2.22/resolv/res_send.c 2016-02-16 13:43:59.000000000 -0800 +@@ -1,3 +1,20 @@ ++/* Copyright (C) 2016 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ <http://www.gnu.org/licenses/>. */ ++ + /* + * Copyright (c) 1985, 1989, 1993 + * The Regents of the University of California. All rights reserved. +@@ -363,6 +380,8 @@ + #ifdef USE_HOOKS + if (__glibc_unlikely (statp->qhook || statp->rhook)) { + if (anssiz < MAXPACKET && ansp) { ++ /* Always allocate MAXPACKET, callers expect ++ this specific size. */ + u_char *buf = malloc (MAXPACKET); + if (buf == NULL) + return (-1); +@@ -638,6 +657,77 @@ + return (struct sockaddr *) (void *) &statp->nsaddr_list[n]; + } + ++/* The send_vc function is responsible for sending a DNS query over TCP ++ to the nameserver numbered NS from the res_state STATP i.e. ++ EXT(statp).nssocks[ns]. The function supports sending both IPv4 and ++ IPv6 queries at the same serially on the same socket. ++ ++ Please note that for TCP there is no way to disable sending both ++ queries, unlike UDP, which honours RES_SNGLKUP and RES_SNGLKUPREOP ++ and sends the queries serially and waits for the result after each ++ sent query. This implemetnation should be corrected to honour these ++ options. ++ ++ Please also note that for TCP we send both queries over the same ++ socket one after another. This technically violates best practice ++ since the server is allowed to read the first query, respond, and ++ then close the socket (to service another client). If the server ++ does this, then the remaining second query in the socket data buffer ++ will cause the server to send the client an RST which will arrive ++ asynchronously and the client's OS will likely tear down the socket ++ receive buffer resulting in a potentially short read and lost ++ response data. This will force the client to retry the query again, ++ and this process may repeat until all servers and connection resets ++ are exhausted and then the query will fail. It's not known if this ++ happens with any frequency in real DNS server implementations. This ++ implementation should be corrected to use two sockets by default for ++ parallel queries. ++ ++ The query stored in BUF of BUFLEN length is sent first followed by ++ the query stored in BUF2 of BUFLEN2 length. Queries are sent ++ serially on the same socket. ++ ++ Answers to the query are stored firstly in *ANSP up to a max of ++ *ANSSIZP bytes. If more than *ANSSIZP bytes are needed and ANSCP ++ is non-NULL (to indicate that modifying the answer buffer is allowed) ++ then malloc is used to allocate a new response buffer and ANSCP and ++ ANSP will both point to the new buffer. If more than *ANSSIZP bytes ++ are needed but ANSCP is NULL, then as much of the response as ++ possible is read into the buffer, but the results will be truncated. ++ When truncation happens because of a small answer buffer the DNS ++ packets header feild TC will bet set to 1, indicating a truncated ++ message and the rest of the socket data will be read and discarded. ++ ++ Answers to the query are stored secondly in *ANSP2 up to a max of ++ *ANSSIZP2 bytes, with the actual response length stored in ++ *RESPLEN2. If more than *ANSSIZP bytes are needed and ANSP2 ++ is non-NULL (required for a second query) then malloc is used to ++ allocate a new response buffer, *ANSSIZP2 is set to the new buffer ++ size and *ANSP2_MALLOCED is set to 1. ++ ++ The ANSP2_MALLOCED argument will eventually be removed as the ++ change in buffer pointer can be used to detect the buffer has ++ changed and that the caller should use free on the new buffer. ++ ++ Note that the answers may arrive in any order from the server and ++ therefore the first and second answer buffers may not correspond to ++ the first and second queries. ++ ++ It is not supported to call this function with a non-NULL ANSP2 ++ but a NULL ANSCP. Put another way, you can call send_vc with a ++ single unmodifiable buffer or two modifiable buffers, but no other ++ combination is supported. ++ ++ It is the caller's responsibility to free the malloc allocated ++ buffers by detecting that the pointers have changed from their ++ original values i.e. *ANSCP or *ANSP2 has changed. ++ ++ If errors are encountered then *TERRNO is set to an appropriate ++ errno value and a zero result is returned for a recoverable error, ++ and a less-than zero result is returned for a non-recoverable error. ++ ++ If no errors are encountered then *TERRNO is left unmodified and ++ a the length of the first response in bytes is returned. */ + static int + send_vc(res_state statp, + const u_char *buf, int buflen, const u_char *buf2, int buflen2, +@@ -647,11 +737,7 @@ + { + const HEADER *hp = (HEADER *) buf; + const HEADER *hp2 = (HEADER *) buf2; +- u_char *ans = *ansp; +- int orig_anssizp = *anssizp; +- // XXX REMOVE +- // int anssiz = *anssizp; +- HEADER *anhp = (HEADER *) ans; ++ HEADER *anhp = (HEADER *) *ansp; + struct sockaddr *nsap = get_nsaddr (statp, ns); + int truncating, connreset, n; + /* On some architectures compiler might emit a warning indicating +@@ -743,6 +829,8 @@ + * Receive length & response + */ + int recvresp1 = 0; ++ /* Skip the second response if there is no second query. ++ To do that we mark the second response as received. */ + int recvresp2 = buf2 == NULL; + uint16_t rlen16; + read_len: +@@ -779,40 +867,14 @@ + u_char **thisansp; + int *thisresplenp; + if ((recvresp1 | recvresp2) == 0 || buf2 == NULL) { ++ /* We have not received any responses ++ yet or we only have one response to ++ receive. */ + thisanssizp = anssizp; + thisansp = anscp ?: ansp; + assert (anscp != NULL || ansp2 == NULL); + thisresplenp = &resplen; + } else { +- if (*anssizp != MAXPACKET) { +- /* No buffer allocated for the first +- reply. We can try to use the rest +- of the user-provided buffer. */ +-#if __GNUC_PREREQ (4, 7) +- DIAG_PUSH_NEEDS_COMMENT; +- DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized"); +-#endif +-#if _STRING_ARCH_unaligned +- *anssizp2 = orig_anssizp - resplen; +- *ansp2 = *ansp + resplen; +-#else +- int aligned_resplen +- = ((resplen + __alignof__ (HEADER) - 1) +- & ~(__alignof__ (HEADER) - 1)); +- *anssizp2 = orig_anssizp - aligned_resplen; +- *ansp2 = *ansp + aligned_resplen; +-#endif +-#if __GNUC_PREREQ (4, 7) +- DIAG_POP_NEEDS_COMMENT; +-#endif +- } else { +- /* The first reply did not fit into the +- user-provided buffer. Maybe the second +- answer will. */ +- *anssizp2 = orig_anssizp; +- *ansp2 = *ansp; +- } +- + thisanssizp = anssizp2; + thisansp = ansp2; + thisresplenp = resplen2; +@@ -820,10 +882,14 @@ + anhp = (HEADER *) *thisansp; + + *thisresplenp = rlen; +- if (rlen > *thisanssizp) { +- /* Yes, we test ANSCP here. If we have two buffers +- both will be allocatable. */ +- if (__glibc_likely (anscp != NULL)) { ++ /* Is the answer buffer too small? */ ++ if (*thisanssizp < rlen) { ++ /* If the current buffer is not the the static ++ user-supplied buffer then we can reallocate ++ it. */ ++ if (thisansp != NULL && thisansp != ansp) { ++ /* Always allocate MAXPACKET, callers expect ++ this specific size. */ + u_char *newp = malloc (MAXPACKET); + if (newp == NULL) { + *terrno = ENOMEM; +@@ -835,6 +901,9 @@ + if (thisansp == ansp2) + *ansp2_malloced = 1; + anhp = (HEADER *) newp; ++ /* A uint16_t can't be larger than MAXPACKET ++ thus it's safe to allocate MAXPACKET but ++ read RLEN bytes instead. */ + len = rlen; + } else { + Dprint(statp->options & RES_DEBUG, +@@ -997,6 +1066,66 @@ + return 1; + } + ++/* The send_dg function is responsible for sending a DNS query over UDP ++ to the nameserver numbered NS from the res_state STATP i.e. ++ EXT(statp).nssocks[ns]. The function supports IPv4 and IPv6 queries ++ along with the ability to send the query in parallel for both stacks ++ (default) or serially (RES_SINGLKUP). It also supports serial lookup ++ with a close and reopen of the socket used to talk to the server ++ (RES_SNGLKUPREOP) to work around broken name servers. ++ ++ The query stored in BUF of BUFLEN length is sent first followed by ++ the query stored in BUF2 of BUFLEN2 length. Queries are sent ++ in parallel (default) or serially (RES_SINGLKUP or RES_SNGLKUPREOP). ++ ++ Answers to the query are stored firstly in *ANSP up to a max of ++ *ANSSIZP bytes. If more than *ANSSIZP bytes are needed and ANSCP ++ is non-NULL (to indicate that modifying the answer buffer is allowed) ++ then malloc is used to allocate a new response buffer and ANSCP and ++ ANSP will both point to the new buffer. If more than *ANSSIZP bytes ++ are needed but ANSCP is NULL, then as much of the response as ++ possible is read into the buffer, but the results will be truncated. ++ When truncation happens because of a small answer buffer the DNS ++ packets header feild TC will bet set to 1, indicating a truncated ++ message, while the rest of the UDP packet is discarded. ++ ++ Answers to the query are stored secondly in *ANSP2 up to a max of ++ *ANSSIZP2 bytes, with the actual response length stored in ++ *RESPLEN2. If more than *ANSSIZP bytes are needed and ANSP2 ++ is non-NULL (required for a second query) then malloc is used to ++ allocate a new response buffer, *ANSSIZP2 is set to the new buffer ++ size and *ANSP2_MALLOCED is set to 1. ++ ++ The ANSP2_MALLOCED argument will eventually be removed as the ++ change in buffer pointer can be used to detect the buffer has ++ changed and that the caller should use free on the new buffer. ++ ++ Note that the answers may arrive in any order from the server and ++ therefore the first and second answer buffers may not correspond to ++ the first and second queries. ++ ++ It is not supported to call this function with a non-NULL ANSP2 ++ but a NULL ANSCP. Put another way, you can call send_vc with a ++ single unmodifiable buffer or two modifiable buffers, but no other ++ combination is supported. ++ ++ It is the caller's responsibility to free the malloc allocated ++ buffers by detecting that the pointers have changed from their ++ original values i.e. *ANSCP or *ANSP2 has changed. ++ ++ If an answer is truncated because of UDP datagram DNS limits then ++ *V_CIRCUIT is set to 1 and the return value non-zero to indicate to ++ the caller to retry with TCP. The value *GOTSOMEWHERE is set to 1 ++ if any progress was made reading a response from the nameserver and ++ is used by the caller to distinguish between ECONNREFUSED and ++ ETIMEDOUT (the latter if *GOTSOMEWHERE is 1). ++ ++ If errors are encountered then *TERRNO is set to an appropriate ++ errno value and a zero result is returned for a recoverable error, ++ and a less-than zero result is returned for a non-recoverable error. ++ ++ If no errors are encountered then *TERRNO is left unmodified and ++ a the length of the first response in bytes is returned. */ + static int + send_dg(res_state statp, + const u_char *buf, int buflen, const u_char *buf2, int buflen2, +@@ -1006,8 +1135,6 @@ + { + const HEADER *hp = (HEADER *) buf; + const HEADER *hp2 = (HEADER *) buf2; +- u_char *ans = *ansp; +- int orig_anssizp = *anssizp; + struct timespec now, timeout, finish; + struct pollfd pfd[1]; + int ptimeout; +@@ -1040,6 +1167,8 @@ + int need_recompute = 0; + int nwritten = 0; + int recvresp1 = 0; ++ /* Skip the second response if there is no second query. ++ To do that we mark the second response as received. */ + int recvresp2 = buf2 == NULL; + pfd[0].fd = EXT(statp).nssocks[ns]; + pfd[0].events = POLLOUT; +@@ -1203,55 +1332,56 @@ + int *thisresplenp; + + if ((recvresp1 | recvresp2) == 0 || buf2 == NULL) { ++ /* We have not received any responses ++ yet or we only have one response to ++ receive. */ + thisanssizp = anssizp; + thisansp = anscp ?: ansp; + assert (anscp != NULL || ansp2 == NULL); + thisresplenp = &resplen; + } else { +- if (*anssizp != MAXPACKET) { +- /* No buffer allocated for the first +- reply. We can try to use the rest +- of the user-provided buffer. */ +-#if _STRING_ARCH_unaligned +- *anssizp2 = orig_anssizp - resplen; +- *ansp2 = *ansp + resplen; +-#else +- int aligned_resplen +- = ((resplen + __alignof__ (HEADER) - 1) +- & ~(__alignof__ (HEADER) - 1)); +- *anssizp2 = orig_anssizp - aligned_resplen; +- *ansp2 = *ansp + aligned_resplen; +-#endif +- } else { +- /* The first reply did not fit into the +- user-provided buffer. Maybe the second +- answer will. */ +- *anssizp2 = orig_anssizp; +- *ansp2 = *ansp; +- } +- + thisanssizp = anssizp2; + thisansp = ansp2; + thisresplenp = resplen2; + } + + if (*thisanssizp < MAXPACKET +- /* Yes, we test ANSCP here. If we have two buffers +- both will be allocatable. */ +- && anscp ++ /* If the current buffer is not the the static ++ user-supplied buffer then we can reallocate ++ it. */ ++ && (thisansp != NULL && thisansp != ansp) + #ifdef FIONREAD ++ /* Is the size too small? */ + && (ioctl (pfd[0].fd, FIONREAD, thisresplenp) < 0 + || *thisanssizp < *thisresplenp) + #endif + ) { ++ /* Always allocate MAXPACKET, callers expect ++ this specific size. */ + u_char *newp = malloc (MAXPACKET); + if (newp != NULL) { +- *anssizp = MAXPACKET; +- *thisansp = ans = newp; ++ *thisanssizp = MAXPACKET; ++ *thisansp = newp; + if (thisansp == ansp2) + *ansp2_malloced = 1; + } + } ++ /* We could end up with truncation if anscp was NULL ++ (not allowed to change caller's buffer) and the ++ response buffer size is too small. This isn't a ++ reliable way to detect truncation because the ioctl ++ may be an inaccurate report of the UDP message size. ++ Therefore we use this only to issue debug output. ++ To do truncation accurately with UDP we need ++ MSG_TRUNC which is only available on Linux. We ++ can abstract out the Linux-specific feature in the ++ future to detect truncation. */ ++ if (__glibc_unlikely (*thisanssizp < *thisresplenp)) { ++ Dprint(statp->options & RES_DEBUG, ++ (stdout, ";; response may be truncated (UDP)\n") ++ ); ++ } ++ + HEADER *anhp = (HEADER *) *thisansp; + socklen_t fromlen = sizeof(struct sockaddr_in6); + assert (sizeof(from) <= fromlen); diff --git a/packages/glibc/2.22/140-Fix-combreloc-test-BSD-grep.patch b/packages/glibc/2.22/140-Fix-combreloc-test-BSD-grep.patch new file mode 100644 index 0000000..fdc3a60 --- /dev/null +++ b/packages/glibc/2.22/140-Fix-combreloc-test-BSD-grep.patch @@ -0,0 +1,49 @@ +From 61d5f9c09b3157db76bd1a393e248c262a8d9dd4 Mon Sep 17 00:00:00 2001 +From: Alexey Neyman <stilor@att.net> +Date: Wed, 8 Mar 2017 14:31:10 -0800 +Subject: [PATCH] Fix combreloc test with BSD grep + +The test for "-z combreloc" fails when cross-compiling on a machine +that uses BSD grep (e.g. on macos). grep complains about empty +subexpression and exits with non-zero status, which is interpreted +by configure as "not found". As a result, support for "-z combreloc" +(HAVE_Z_COMBRELOC) is not detected, leading to link failure on SPARC. + + * configure.ac: Avoid empty subexpression in grep. + +Signed-off-by: Alexey Neyman <stilor@att.net> +--- + ChangeLog | 5 +++++ + configure | 2 +- + configure.ac | 2 +- + 3 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/configure b/configure +index eecd0ac..0118bd1 100755 +--- a/configure ++++ b/configure +@@ -5804,7 +5804,7 @@ if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then +- if $READELF -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then ++ if $READELF -S conftest.so | grep '\.\(rel\|rela\)\.dyn' > /dev/null; then + libc_cv_z_combreloc=yes + else + libc_cv_z_combreloc=no +diff --git a/configure.ac b/configure.ac +index 4a77411..19f6d87 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1391,7 +1391,7 @@ dnl cross-platform since the gcc used can be a cross compiler. Without + dnl introducing new options this is not easily doable. Instead use a tool + dnl which always is cross-platform: readelf. To detect whether -z combreloc + dnl look for a section named .rel.dyn. +- if $READELF -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then ++ if $READELF -S conftest.so | grep '\.\(rel\|rela\)\.dyn' > /dev/null; then + libc_cv_z_combreloc=yes + else + libc_cv_z_combreloc=no +-- +2.9.3 + diff --git a/packages/glibc/2.22/910-typedef-caddr.patch b/packages/glibc/2.22/910-typedef-caddr.patch new file mode 100644 index 0000000..fc7979b --- /dev/null +++ b/packages/glibc/2.22/910-typedef-caddr.patch @@ -0,0 +1,15 @@ +diff -urN glibc-2.23-orig/posix/sys/types.h glibc-2.23/posix/sys/types.h +--- glibc-2.23-orig/posix/sys/types.h 2016-02-18 12:54:00.000000000 -0500 ++++ glibc-2.23/posix/sys/types.h 2017-01-06 11:40:05.842147165 -0500 +@@ -113,7 +113,10 @@ + #ifdef __USE_MISC + # ifndef __daddr_t_defined + typedef __daddr_t daddr_t; ++# if ! defined(caddr_t) && ! defined(__caddr_t_defined) + typedef __caddr_t caddr_t; ++# define __caddr_t_defined ++# endif + # define __daddr_t_defined + # endif + #endif + diff --git a/packages/glibc/2.22/920-fix-rpc_parse-format.patch b/packages/glibc/2.22/920-fix-rpc_parse-format.patch new file mode 100644 index 0000000..37e58da --- /dev/null +++ b/packages/glibc/2.22/920-fix-rpc_parse-format.patch @@ -0,0 +1,60 @@ +commit 5874510faaf3cbd0bb112aaacab9f225002beed1 +Author: Joseph Myers <joseph@codesourcery.com> +Date: Tue Nov 8 23:44:51 2016 +0000 + + Fix rpcgen buffer overrun (bug 20790). + + Building with GCC 7 produces an error building rpcgen: + + rpc_parse.c: In function 'get_prog_declaration': + rpc_parse.c:543:25: error: may write a terminating nul past the end of the destination [-Werror=format-length=] + sprintf (name, "%s%d", ARGNAME, num); /* default name of argument */ + ~~~~^ + rpc_parse.c:543:5: note: format output between 5 and 14 bytes into a destination of size 10 + sprintf (name, "%s%d", ARGNAME, num); /* default name of argument */ + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + That buffer overrun is for the case where the .x file declares a + program with a million arguments. The strcpy two lines above can + generate a buffer overrun much more simply for a long argument name. + + The limit on length of line read by rpcgen (MAXLINESIZE == 1024) + provides a bound on the buffer size needed, so this patch just changes + the buffer size to MAXLINESIZE to avoid both possible buffer + overruns. A testcase is added that rpcgen does not crash with a + 500-character argument name, where it previously crashed. + + It would not at all surprise me if there are many other ways of + crashing rpcgen with either valid or invalid input; fuzz testing would + likely find various such bugs, though I don't think they are that + important to fix (rpcgen is not that likely to be used with untrusted + .x files as input). (As well as fuzz-findable bugs there are probably + also issues when various int variables get overflowed on very large + input.) The test infrastructure for rpcgen-not-crashing tests would + need extending if tests are to be added for cases where rpcgen should + produce an error, as opposed to cases where it should succeed. + + Tested for x86_64 and x86. + + [BZ #20790] + * sunrpc/rpc_parse.c (get_prog_declaration): Increase buffer size + to MAXLINESIZE. + * sunrpc/bug20790.x: New file. + * sunrpc/Makefile [$(run-built-tests) = yes] (rpcgen-tests): New + variable. + [$(run-built-tests) = yes] (tests-special): Add $(rpcgen-tests). + [$(run-built-tests) = yes] ($(rpcgen-tests)): New rule. + +diff --git a/sunrpc/rpc_parse.c b/sunrpc/rpc_parse.c +index 1a1df6d8c2..505a6554cf 100644 +--- a/sunrpc/rpc_parse.c ++++ b/sunrpc/rpc_parse.c +@@ -521,7 +521,7 @@ static void + get_prog_declaration (declaration * dec, defkind dkind, int num /* arg number */ ) + { + token tok; +- char name[10]; /* argument name */ ++ char name[MAXLINESIZE]; /* argument name */ + + if (dkind == DEF_PROGRAM) + { diff --git a/packages/glibc/2.22/930-explicit-boolean.patch b/packages/glibc/2.22/930-explicit-boolean.patch new file mode 100644 index 0000000..780fae6 --- /dev/null +++ b/packages/glibc/2.22/930-explicit-boolean.patch @@ -0,0 +1,33 @@ +commit e223d1fe72e820d96f43831412ab267a1ace04d0 +Author: steve ellcey-CA Eng-Software <sellcey@sellcey-thinkpad.caveonetworks.com> +Date: Fri Oct 14 12:53:27 2016 -0700 + + Fix warnings from latest GCC. + + * sysdeps/ieee754/dbl-64/e_pow.c (checkint) Make conditions explicitly + boolean. + +diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c +index 663fa392c2..bd758b5979 100644 +--- a/sysdeps/ieee754/dbl-64/e_pow.c ++++ b/sysdeps/ieee754/dbl-64/e_pow.c +@@ -466,15 +466,15 @@ checkint (double x) + return (n & 1) ? -1 : 1; /* odd or even */ + if (k > 20) + { +- if (n << (k - 20)) ++ if (n << (k - 20) != 0) + return 0; /* if not integer */ +- return (n << (k - 21)) ? -1 : 1; ++ return (n << (k - 21) != 0) ? -1 : 1; + } + if (n) + return 0; /*if not integer */ + if (k == 20) + return (m & 1) ? -1 : 1; +- if (m << (k + 12)) ++ if (m << (k + 12) != 0) + return 0; +- return (m << (k + 11)) ? -1 : 1; ++ return (m << (k + 11) != 0) ? -1 : 1; + } diff --git a/packages/glibc/2.22/940-nis-bogus-conditional.patch b/packages/glibc/2.22/940-nis-bogus-conditional.patch new file mode 100644 index 0000000..09b38cf --- /dev/null +++ b/packages/glibc/2.22/940-nis-bogus-conditional.patch @@ -0,0 +1,62 @@ +commit f88759ea9bd3c8d8fef28f123ba9767cb0e421a3 +Author: Joseph Myers <joseph@codesourcery.com> +Date: Wed Dec 21 23:44:01 2016 +0000 + + Fix nss_nisplus build with mainline GCC (bug 20978). + + glibc build with current mainline GCC fails because + nis/nss_nisplus/nisplus-alias.c contains code + + if (name != NULL) + { + *errnop = EINVAL; + return NSS_STATUS_UNAVAIL; + } + + char buf[strlen (name) + 9 + tablename_len]; + + producing an error about strlen being called on a pointer that is + always NULL (and a subsequent use of that pointer with a %s format in + snprintf). + + As Andreas noted, the bogus conditional comes from a 1997 change: + + - if (name == NULL || strlen(name) > 8) + - return NSS_STATUS_NOTFOUND; + - else + + if (name != NULL || strlen(name) <= 8) + + So the intention is clearly to return an error for NULL name. + + This patch duly inverts the sense of the conditional. It fixes the + build with GCC mainline, and passes usual glibc testsuite testing for + x86_64. However, I have not tried any actual substantive nisplus + testing, do not have an environment for such testing, and do not know + whether it is possible that strlen (name) or tablename_len might be + large so that the VLA for buf is actually a security issue. However, + if it is a security issue, there are plenty of other similar instances + in the nisplus code (that haven't been hidden by a bogus comparison + with NULL) - and nis_table.c:__create_ib_request uses strdupa on the + string passed to nis_list, so a local fix in the caller wouldn't + suffice anyway (see bug 20987). (Calls to strdupa and other such + macros that use alloca must be considered equally questionable + regarding stack overflow issues as direct calls to alloca and VLA + declarations.) + + [BZ #20978] + * nis/nss_nisplus/nisplus-alias.c (_nss_nisplus_getaliasbyname_r): + Compare name == NULL, not name != NULL. + +diff --git a/nis/nss_nisplus/nisplus-alias.c b/nis/nss_nisplus/nisplus-alias.c +index 7f698b4e6d..cb5acce01d 100644 +--- a/nis/nss_nisplus/nisplus-alias.c ++++ b/nis/nss_nisplus/nisplus-alias.c +@@ -291,7 +291,7 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias, + return status; + } + +- if (name != NULL) ++ if (name == NULL) + { + *errnop = EINVAL; + return NSS_STATUS_UNAVAIL; diff --git a/packages/glibc/2.22/version.desc b/packages/glibc/2.22/version.desc new file mode 100644 index 0000000..026d275 --- /dev/null +++ b/packages/glibc/2.22/version.desc @@ -0,0 +1 @@ +obsolete="yes" |