From 387c8d8e2c89d94d41c76479ee9571c60e824ac3 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Sat, 12 May 2018 13:00:41 -0700 Subject: First batch of fixes - Incompatible function type for ifunc alias - Multiple statements macro expansion in strftime - if_nametoindex size checking Signed-off-by: Alexey Neyman diff --git a/config/libc/glibc.in b/config/libc/glibc.in index a297bb1..00fffa7 100644 --- a/config/libc/glibc.in +++ b/config/libc/glibc.in @@ -112,6 +112,12 @@ config GLIBC_HAS_OBSOLETE_RPC def_bool y depends on GLIBC_2_14_or_later +# New GCC versions don't like the ifunc implementation in GCC, producing a warning. +# We can either require old GCC for those versions, or disable erroring out on warnings. +config GLIBC_HAS_NEW_IFUNC + def_bool y + depends on GLIBC_2_25_or_later + config GLIBC_EXTRA_CONFIG_ARRAY string prompt "extra config" diff --git a/packages/glibc-linaro/2.20-2014.11/0011-strftime-multiple-stmts.patch b/packages/glibc-linaro/2.20-2014.11/0011-strftime-multiple-stmts.patch new file mode 100644 index 0000000..0f97e7d --- /dev/null +++ b/packages/glibc-linaro/2.20-2014.11/0011-strftime-multiple-stmts.patch @@ -0,0 +1,73 @@ +commit e4043b84c49e1cf9bcf1e8320233343ecc34f8eb +Author: Joseph Myers +Date: Tue Jun 27 17:12:13 2017 +0000 + + Fix strftime build with GCC 8. + + Building with current GCC mainline fails with: + + strftime_l.c: In function '__strftime_internal': + strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros] + digits = d > width ? d : width; \ + ^ + strftime_l.c:1260:6: note: in expansion of macro 'DO_NUMBER' + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + ^~~~~~~~~ + strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this 'else' clause + else + ^~~~ + + In fact this particular instance is harmless; the code looks like: + + if (modifier == L_('O')) + goto bad_format; + else + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + + and because of the goto, it doesn't matter that part of the expansion + isn't under the "else" conditional. But it's also clearly bad style + to rely on that. This patch changes DO_NUMBER and DO_NUMBER_SPACEPAD + to use do { } while (0) to avoid such problems. + + Tested (full testsuite) for x86_64 (GCC 6), and with + build-many-glibcs.py with GCC mainline, in conjunction with my libgcc + patch . + + * time/strftime_l.c (DO_NUMBER): Define using do { } while (0). + (DO_NUMBER_SPACEPAD): Likewise. + +--- + time/strftime_l.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +--- a/time/strftime_l.c ++++ b/time/strftime_l.c +@@ -738,12 +738,22 @@ + format_char = *f; + switch (format_char) + { +-#define DO_NUMBER(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number +-#define DO_NUMBER_SPACEPAD(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number_spacepad ++#define DO_NUMBER(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number; \ ++ } \ ++ while (0) ++#define DO_NUMBER_SPACEPAD(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number_spacepad; \ ++ } \ ++ while (0) + + case L_('%'): + if (modifier != 0) diff --git a/packages/glibc-linaro/2.20-2014.11/0012-if_nametoindex-size-check.patch b/packages/glibc-linaro/2.20-2014.11/0012-if_nametoindex-size-check.patch new file mode 100644 index 0000000..7976fdd --- /dev/null +++ b/packages/glibc-linaro/2.20-2014.11/0012-if_nametoindex-size-check.patch @@ -0,0 +1,29 @@ +commit 2180fee114b778515b3f560e5ff1e795282e60b0 +Author: Steve Ellcey +Date: Wed Nov 15 08:58:48 2017 -0800 + + Check length of ifname before copying it into to ifreq structure. + + [BZ #22442] + * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): + Check if ifname is too long. + +--- + sysdeps/unix/sysv/linux/if_index.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/sysdeps/unix/sysv/linux/if_index.c ++++ b/sysdeps/unix/sysv/linux/if_index.c +@@ -43,6 +43,12 @@ + if (fd < 0) + return 0; + ++ if (strlen (ifname) >= IFNAMSIZ) ++ { ++ __set_errno (ENODEV); ++ return 0; ++ } ++ + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) + { diff --git a/packages/glibc/2.12.1/0045-strftime-multiple-stmts.patch b/packages/glibc/2.12.1/0045-strftime-multiple-stmts.patch new file mode 100644 index 0000000..e544b33 --- /dev/null +++ b/packages/glibc/2.12.1/0045-strftime-multiple-stmts.patch @@ -0,0 +1,73 @@ +commit e4043b84c49e1cf9bcf1e8320233343ecc34f8eb +Author: Joseph Myers +Date: Tue Jun 27 17:12:13 2017 +0000 + + Fix strftime build with GCC 8. + + Building with current GCC mainline fails with: + + strftime_l.c: In function '__strftime_internal': + strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros] + digits = d > width ? d : width; \ + ^ + strftime_l.c:1260:6: note: in expansion of macro 'DO_NUMBER' + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + ^~~~~~~~~ + strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this 'else' clause + else + ^~~~ + + In fact this particular instance is harmless; the code looks like: + + if (modifier == L_('O')) + goto bad_format; + else + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + + and because of the goto, it doesn't matter that part of the expansion + isn't under the "else" conditional. But it's also clearly bad style + to rely on that. This patch changes DO_NUMBER and DO_NUMBER_SPACEPAD + to use do { } while (0) to avoid such problems. + + Tested (full testsuite) for x86_64 (GCC 6), and with + build-many-glibcs.py with GCC mainline, in conjunction with my libgcc + patch . + + * time/strftime_l.c (DO_NUMBER): Define using do { } while (0). + (DO_NUMBER_SPACEPAD): Likewise. + +--- + time/strftime_l.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +--- a/time/strftime_l.c ++++ b/time/strftime_l.c +@@ -742,12 +742,22 @@ + format_char = *f; + switch (format_char) + { +-#define DO_NUMBER(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number +-#define DO_NUMBER_SPACEPAD(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number_spacepad ++#define DO_NUMBER(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number; \ ++ } \ ++ while (0) ++#define DO_NUMBER_SPACEPAD(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number_spacepad; \ ++ } \ ++ while (0) + + case L_('%'): + if (modifier != 0) diff --git a/packages/glibc/2.12.1/0046-if_nametoindex-size-check.patch b/packages/glibc/2.12.1/0046-if_nametoindex-size-check.patch new file mode 100644 index 0000000..5803db5 --- /dev/null +++ b/packages/glibc/2.12.1/0046-if_nametoindex-size-check.patch @@ -0,0 +1,29 @@ +commit 2180fee114b778515b3f560e5ff1e795282e60b0 +Author: Steve Ellcey +Date: Wed Nov 15 08:58:48 2017 -0800 + + Check length of ifname before copying it into to ifreq structure. + + [BZ #22442] + * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): + Check if ifname is too long. + +--- + sysdeps/unix/sysv/linux/if_index.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/sysdeps/unix/sysv/linux/if_index.c ++++ b/sysdeps/unix/sysv/linux/if_index.c +@@ -54,6 +54,12 @@ + if (fd < 0) + return 0; + ++ if (strlen (ifname) >= IFNAMSIZ) ++ { ++ __set_errno (ENODEV); ++ return 0; ++ } ++ + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) + { diff --git a/packages/glibc/2.12.2/0008-strftime-multiple-stmts.patch b/packages/glibc/2.12.2/0008-strftime-multiple-stmts.patch new file mode 100644 index 0000000..e544b33 --- /dev/null +++ b/packages/glibc/2.12.2/0008-strftime-multiple-stmts.patch @@ -0,0 +1,73 @@ +commit e4043b84c49e1cf9bcf1e8320233343ecc34f8eb +Author: Joseph Myers +Date: Tue Jun 27 17:12:13 2017 +0000 + + Fix strftime build with GCC 8. + + Building with current GCC mainline fails with: + + strftime_l.c: In function '__strftime_internal': + strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros] + digits = d > width ? d : width; \ + ^ + strftime_l.c:1260:6: note: in expansion of macro 'DO_NUMBER' + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + ^~~~~~~~~ + strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this 'else' clause + else + ^~~~ + + In fact this particular instance is harmless; the code looks like: + + if (modifier == L_('O')) + goto bad_format; + else + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + + and because of the goto, it doesn't matter that part of the expansion + isn't under the "else" conditional. But it's also clearly bad style + to rely on that. This patch changes DO_NUMBER and DO_NUMBER_SPACEPAD + to use do { } while (0) to avoid such problems. + + Tested (full testsuite) for x86_64 (GCC 6), and with + build-many-glibcs.py with GCC mainline, in conjunction with my libgcc + patch . + + * time/strftime_l.c (DO_NUMBER): Define using do { } while (0). + (DO_NUMBER_SPACEPAD): Likewise. + +--- + time/strftime_l.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +--- a/time/strftime_l.c ++++ b/time/strftime_l.c +@@ -742,12 +742,22 @@ + format_char = *f; + switch (format_char) + { +-#define DO_NUMBER(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number +-#define DO_NUMBER_SPACEPAD(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number_spacepad ++#define DO_NUMBER(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number; \ ++ } \ ++ while (0) ++#define DO_NUMBER_SPACEPAD(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number_spacepad; \ ++ } \ ++ while (0) + + case L_('%'): + if (modifier != 0) diff --git a/packages/glibc/2.12.2/0009-if_nametoindex-size-check.patch b/packages/glibc/2.12.2/0009-if_nametoindex-size-check.patch new file mode 100644 index 0000000..5803db5 --- /dev/null +++ b/packages/glibc/2.12.2/0009-if_nametoindex-size-check.patch @@ -0,0 +1,29 @@ +commit 2180fee114b778515b3f560e5ff1e795282e60b0 +Author: Steve Ellcey +Date: Wed Nov 15 08:58:48 2017 -0800 + + Check length of ifname before copying it into to ifreq structure. + + [BZ #22442] + * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): + Check if ifname is too long. + +--- + sysdeps/unix/sysv/linux/if_index.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/sysdeps/unix/sysv/linux/if_index.c ++++ b/sysdeps/unix/sysv/linux/if_index.c +@@ -54,6 +54,12 @@ + if (fd < 0) + return 0; + ++ if (strlen (ifname) >= IFNAMSIZ) ++ { ++ __set_errno (ENODEV); ++ return 0; ++ } ++ + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) + { diff --git a/packages/glibc/2.13/0044-strftime-multiple-stmts.patch b/packages/glibc/2.13/0044-strftime-multiple-stmts.patch new file mode 100644 index 0000000..e544b33 --- /dev/null +++ b/packages/glibc/2.13/0044-strftime-multiple-stmts.patch @@ -0,0 +1,73 @@ +commit e4043b84c49e1cf9bcf1e8320233343ecc34f8eb +Author: Joseph Myers +Date: Tue Jun 27 17:12:13 2017 +0000 + + Fix strftime build with GCC 8. + + Building with current GCC mainline fails with: + + strftime_l.c: In function '__strftime_internal': + strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros] + digits = d > width ? d : width; \ + ^ + strftime_l.c:1260:6: note: in expansion of macro 'DO_NUMBER' + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + ^~~~~~~~~ + strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this 'else' clause + else + ^~~~ + + In fact this particular instance is harmless; the code looks like: + + if (modifier == L_('O')) + goto bad_format; + else + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + + and because of the goto, it doesn't matter that part of the expansion + isn't under the "else" conditional. But it's also clearly bad style + to rely on that. This patch changes DO_NUMBER and DO_NUMBER_SPACEPAD + to use do { } while (0) to avoid such problems. + + Tested (full testsuite) for x86_64 (GCC 6), and with + build-many-glibcs.py with GCC mainline, in conjunction with my libgcc + patch . + + * time/strftime_l.c (DO_NUMBER): Define using do { } while (0). + (DO_NUMBER_SPACEPAD): Likewise. + +--- + time/strftime_l.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +--- a/time/strftime_l.c ++++ b/time/strftime_l.c +@@ -742,12 +742,22 @@ + format_char = *f; + switch (format_char) + { +-#define DO_NUMBER(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number +-#define DO_NUMBER_SPACEPAD(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number_spacepad ++#define DO_NUMBER(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number; \ ++ } \ ++ while (0) ++#define DO_NUMBER_SPACEPAD(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number_spacepad; \ ++ } \ ++ while (0) + + case L_('%'): + if (modifier != 0) diff --git a/packages/glibc/2.13/0045-if_nametoindex-size-check.patch b/packages/glibc/2.13/0045-if_nametoindex-size-check.patch new file mode 100644 index 0000000..5803db5 --- /dev/null +++ b/packages/glibc/2.13/0045-if_nametoindex-size-check.patch @@ -0,0 +1,29 @@ +commit 2180fee114b778515b3f560e5ff1e795282e60b0 +Author: Steve Ellcey +Date: Wed Nov 15 08:58:48 2017 -0800 + + Check length of ifname before copying it into to ifreq structure. + + [BZ #22442] + * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): + Check if ifname is too long. + +--- + sysdeps/unix/sysv/linux/if_index.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/sysdeps/unix/sysv/linux/if_index.c ++++ b/sysdeps/unix/sysv/linux/if_index.c +@@ -54,6 +54,12 @@ + if (fd < 0) + return 0; + ++ if (strlen (ifname) >= IFNAMSIZ) ++ { ++ __set_errno (ENODEV); ++ return 0; ++ } ++ + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) + { diff --git a/packages/glibc/2.14.1/0044-strftime-multiple-stmts.patch b/packages/glibc/2.14.1/0044-strftime-multiple-stmts.patch new file mode 100644 index 0000000..e544b33 --- /dev/null +++ b/packages/glibc/2.14.1/0044-strftime-multiple-stmts.patch @@ -0,0 +1,73 @@ +commit e4043b84c49e1cf9bcf1e8320233343ecc34f8eb +Author: Joseph Myers +Date: Tue Jun 27 17:12:13 2017 +0000 + + Fix strftime build with GCC 8. + + Building with current GCC mainline fails with: + + strftime_l.c: In function '__strftime_internal': + strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros] + digits = d > width ? d : width; \ + ^ + strftime_l.c:1260:6: note: in expansion of macro 'DO_NUMBER' + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + ^~~~~~~~~ + strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this 'else' clause + else + ^~~~ + + In fact this particular instance is harmless; the code looks like: + + if (modifier == L_('O')) + goto bad_format; + else + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + + and because of the goto, it doesn't matter that part of the expansion + isn't under the "else" conditional. But it's also clearly bad style + to rely on that. This patch changes DO_NUMBER and DO_NUMBER_SPACEPAD + to use do { } while (0) to avoid such problems. + + Tested (full testsuite) for x86_64 (GCC 6), and with + build-many-glibcs.py with GCC mainline, in conjunction with my libgcc + patch . + + * time/strftime_l.c (DO_NUMBER): Define using do { } while (0). + (DO_NUMBER_SPACEPAD): Likewise. + +--- + time/strftime_l.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +--- a/time/strftime_l.c ++++ b/time/strftime_l.c +@@ -742,12 +742,22 @@ + format_char = *f; + switch (format_char) + { +-#define DO_NUMBER(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number +-#define DO_NUMBER_SPACEPAD(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number_spacepad ++#define DO_NUMBER(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number; \ ++ } \ ++ while (0) ++#define DO_NUMBER_SPACEPAD(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number_spacepad; \ ++ } \ ++ while (0) + + case L_('%'): + if (modifier != 0) diff --git a/packages/glibc/2.14.1/0045-if_nametoindex-size-check.patch b/packages/glibc/2.14.1/0045-if_nametoindex-size-check.patch new file mode 100644 index 0000000..5803db5 --- /dev/null +++ b/packages/glibc/2.14.1/0045-if_nametoindex-size-check.patch @@ -0,0 +1,29 @@ +commit 2180fee114b778515b3f560e5ff1e795282e60b0 +Author: Steve Ellcey +Date: Wed Nov 15 08:58:48 2017 -0800 + + Check length of ifname before copying it into to ifreq structure. + + [BZ #22442] + * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): + Check if ifname is too long. + +--- + sysdeps/unix/sysv/linux/if_index.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/sysdeps/unix/sysv/linux/if_index.c ++++ b/sysdeps/unix/sysv/linux/if_index.c +@@ -54,6 +54,12 @@ + if (fd < 0) + return 0; + ++ if (strlen (ifname) >= IFNAMSIZ) ++ { ++ __set_errno (ENODEV); ++ return 0; ++ } ++ + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) + { diff --git a/packages/glibc/2.14/998-obstack-common.patch b/packages/glibc/2.14/998-obstack-common.patch deleted file mode 100644 index 4b95f06..0000000 --- a/packages/glibc/2.14/998-obstack-common.patch +++ /dev/null @@ -1,30 +0,0 @@ -commit 39b1f6172a2f9ddc74a8f82d6e84dd13b22dbaf2 -Author: Peter Collingbourne -Date: Wed May 15 20:28:08 2013 +0200 - - Move _obstack_compat out of common - - it is impossible to create an alias of a common symbol (as - compat_symbol does), because common symbols do not have a section or - an offset until linked. GNU as tolerates aliases of common symbols by - simply creating another common symbol, but other assemblers (notably - LLVM's integrated assembler) are less tolerant. - - 2013-05-15 Peter Collingbourne - - * malloc/obstack.c (_obstack_compat): Add initializer. - - - -diff --git a/malloc/obstack.c b/malloc/obstack.c -index 25a90514f7..c3c7db4a96 100644 ---- a/malloc/obstack.c -+++ b/malloc/obstack.c -@@ -115,7 +115,7 @@ int obstack_exit_failure = EXIT_FAILURE; - /* A looong time ago (before 1994, anyway; we're not sure) this global variable - was used by non-GNU-C macros to avoid multiple evaluation. The GNU C - library still exports it because somebody might use it. */ --struct obstack *_obstack_compat; -+struct obstack *_obstack_compat = 0; - compat_symbol (libc, _obstack_compat, _obstack, GLIBC_2_0); - # endif - # endif diff --git a/packages/glibc/2.15/0045-strftime-multiple-stmts.patch b/packages/glibc/2.15/0045-strftime-multiple-stmts.patch new file mode 100644 index 0000000..e544b33 --- /dev/null +++ b/packages/glibc/2.15/0045-strftime-multiple-stmts.patch @@ -0,0 +1,73 @@ +commit e4043b84c49e1cf9bcf1e8320233343ecc34f8eb +Author: Joseph Myers +Date: Tue Jun 27 17:12:13 2017 +0000 + + Fix strftime build with GCC 8. + + Building with current GCC mainline fails with: + + strftime_l.c: In function '__strftime_internal': + strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros] + digits = d > width ? d : width; \ + ^ + strftime_l.c:1260:6: note: in expansion of macro 'DO_NUMBER' + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + ^~~~~~~~~ + strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this 'else' clause + else + ^~~~ + + In fact this particular instance is harmless; the code looks like: + + if (modifier == L_('O')) + goto bad_format; + else + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + + and because of the goto, it doesn't matter that part of the expansion + isn't under the "else" conditional. But it's also clearly bad style + to rely on that. This patch changes DO_NUMBER and DO_NUMBER_SPACEPAD + to use do { } while (0) to avoid such problems. + + Tested (full testsuite) for x86_64 (GCC 6), and with + build-many-glibcs.py with GCC mainline, in conjunction with my libgcc + patch . + + * time/strftime_l.c (DO_NUMBER): Define using do { } while (0). + (DO_NUMBER_SPACEPAD): Likewise. + +--- + time/strftime_l.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +--- a/time/strftime_l.c ++++ b/time/strftime_l.c +@@ -742,12 +742,22 @@ + format_char = *f; + switch (format_char) + { +-#define DO_NUMBER(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number +-#define DO_NUMBER_SPACEPAD(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number_spacepad ++#define DO_NUMBER(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number; \ ++ } \ ++ while (0) ++#define DO_NUMBER_SPACEPAD(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number_spacepad; \ ++ } \ ++ while (0) + + case L_('%'): + if (modifier != 0) diff --git a/packages/glibc/2.15/0046-if_nametoindex-size-check.patch b/packages/glibc/2.15/0046-if_nametoindex-size-check.patch new file mode 100644 index 0000000..5803db5 --- /dev/null +++ b/packages/glibc/2.15/0046-if_nametoindex-size-check.patch @@ -0,0 +1,29 @@ +commit 2180fee114b778515b3f560e5ff1e795282e60b0 +Author: Steve Ellcey +Date: Wed Nov 15 08:58:48 2017 -0800 + + Check length of ifname before copying it into to ifreq structure. + + [BZ #22442] + * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): + Check if ifname is too long. + +--- + sysdeps/unix/sysv/linux/if_index.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/sysdeps/unix/sysv/linux/if_index.c ++++ b/sysdeps/unix/sysv/linux/if_index.c +@@ -54,6 +54,12 @@ + if (fd < 0) + return 0; + ++ if (strlen (ifname) >= IFNAMSIZ) ++ { ++ __set_errno (ENODEV); ++ return 0; ++ } ++ + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) + { diff --git a/packages/glibc/2.16.0/0037-strftime-multiple-stmts.patch b/packages/glibc/2.16.0/0037-strftime-multiple-stmts.patch new file mode 100644 index 0000000..88e658b --- /dev/null +++ b/packages/glibc/2.16.0/0037-strftime-multiple-stmts.patch @@ -0,0 +1,73 @@ +commit e4043b84c49e1cf9bcf1e8320233343ecc34f8eb +Author: Joseph Myers +Date: Tue Jun 27 17:12:13 2017 +0000 + + Fix strftime build with GCC 8. + + Building with current GCC mainline fails with: + + strftime_l.c: In function '__strftime_internal': + strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros] + digits = d > width ? d : width; \ + ^ + strftime_l.c:1260:6: note: in expansion of macro 'DO_NUMBER' + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + ^~~~~~~~~ + strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this 'else' clause + else + ^~~~ + + In fact this particular instance is harmless; the code looks like: + + if (modifier == L_('O')) + goto bad_format; + else + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + + and because of the goto, it doesn't matter that part of the expansion + isn't under the "else" conditional. But it's also clearly bad style + to rely on that. This patch changes DO_NUMBER and DO_NUMBER_SPACEPAD + to use do { } while (0) to avoid such problems. + + Tested (full testsuite) for x86_64 (GCC 6), and with + build-many-glibcs.py with GCC mainline, in conjunction with my libgcc + patch . + + * time/strftime_l.c (DO_NUMBER): Define using do { } while (0). + (DO_NUMBER_SPACEPAD): Likewise. + +--- + time/strftime_l.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +--- a/time/strftime_l.c ++++ b/time/strftime_l.c +@@ -737,12 +737,22 @@ + format_char = *f; + switch (format_char) + { +-#define DO_NUMBER(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number +-#define DO_NUMBER_SPACEPAD(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number_spacepad ++#define DO_NUMBER(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number; \ ++ } \ ++ while (0) ++#define DO_NUMBER_SPACEPAD(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number_spacepad; \ ++ } \ ++ while (0) + + case L_('%'): + if (modifier != 0) diff --git a/packages/glibc/2.16.0/0038-if_nametoindex-size-check.patch b/packages/glibc/2.16.0/0038-if_nametoindex-size-check.patch new file mode 100644 index 0000000..375bb95 --- /dev/null +++ b/packages/glibc/2.16.0/0038-if_nametoindex-size-check.patch @@ -0,0 +1,29 @@ +commit 2180fee114b778515b3f560e5ff1e795282e60b0 +Author: Steve Ellcey +Date: Wed Nov 15 08:58:48 2017 -0800 + + Check length of ifname before copying it into to ifreq structure. + + [BZ #22442] + * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): + Check if ifname is too long. + +--- + sysdeps/unix/sysv/linux/if_index.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/sysdeps/unix/sysv/linux/if_index.c ++++ b/sysdeps/unix/sysv/linux/if_index.c +@@ -44,6 +44,12 @@ + if (fd < 0) + return 0; + ++ if (strlen (ifname) >= IFNAMSIZ) ++ { ++ __set_errno (ENODEV); ++ return 0; ++ } ++ + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) + { diff --git a/packages/glibc/2.17/0013-strftime-multiple-stmts.patch b/packages/glibc/2.17/0013-strftime-multiple-stmts.patch new file mode 100644 index 0000000..88e658b --- /dev/null +++ b/packages/glibc/2.17/0013-strftime-multiple-stmts.patch @@ -0,0 +1,73 @@ +commit e4043b84c49e1cf9bcf1e8320233343ecc34f8eb +Author: Joseph Myers +Date: Tue Jun 27 17:12:13 2017 +0000 + + Fix strftime build with GCC 8. + + Building with current GCC mainline fails with: + + strftime_l.c: In function '__strftime_internal': + strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros] + digits = d > width ? d : width; \ + ^ + strftime_l.c:1260:6: note: in expansion of macro 'DO_NUMBER' + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + ^~~~~~~~~ + strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this 'else' clause + else + ^~~~ + + In fact this particular instance is harmless; the code looks like: + + if (modifier == L_('O')) + goto bad_format; + else + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + + and because of the goto, it doesn't matter that part of the expansion + isn't under the "else" conditional. But it's also clearly bad style + to rely on that. This patch changes DO_NUMBER and DO_NUMBER_SPACEPAD + to use do { } while (0) to avoid such problems. + + Tested (full testsuite) for x86_64 (GCC 6), and with + build-many-glibcs.py with GCC mainline, in conjunction with my libgcc + patch . + + * time/strftime_l.c (DO_NUMBER): Define using do { } while (0). + (DO_NUMBER_SPACEPAD): Likewise. + +--- + time/strftime_l.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +--- a/time/strftime_l.c ++++ b/time/strftime_l.c +@@ -737,12 +737,22 @@ + format_char = *f; + switch (format_char) + { +-#define DO_NUMBER(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number +-#define DO_NUMBER_SPACEPAD(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number_spacepad ++#define DO_NUMBER(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number; \ ++ } \ ++ while (0) ++#define DO_NUMBER_SPACEPAD(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number_spacepad; \ ++ } \ ++ while (0) + + case L_('%'): + if (modifier != 0) diff --git a/packages/glibc/2.17/0014-if_nametoindex-size-check.patch b/packages/glibc/2.17/0014-if_nametoindex-size-check.patch new file mode 100644 index 0000000..375bb95 --- /dev/null +++ b/packages/glibc/2.17/0014-if_nametoindex-size-check.patch @@ -0,0 +1,29 @@ +commit 2180fee114b778515b3f560e5ff1e795282e60b0 +Author: Steve Ellcey +Date: Wed Nov 15 08:58:48 2017 -0800 + + Check length of ifname before copying it into to ifreq structure. + + [BZ #22442] + * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): + Check if ifname is too long. + +--- + sysdeps/unix/sysv/linux/if_index.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/sysdeps/unix/sysv/linux/if_index.c ++++ b/sysdeps/unix/sysv/linux/if_index.c +@@ -44,6 +44,12 @@ + if (fd < 0) + return 0; + ++ if (strlen (ifname) >= IFNAMSIZ) ++ { ++ __set_errno (ENODEV); ++ return 0; ++ } ++ + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) + { diff --git a/packages/glibc/2.18/0014-strftime-multiple-stmts.patch b/packages/glibc/2.18/0014-strftime-multiple-stmts.patch new file mode 100644 index 0000000..88e658b --- /dev/null +++ b/packages/glibc/2.18/0014-strftime-multiple-stmts.patch @@ -0,0 +1,73 @@ +commit e4043b84c49e1cf9bcf1e8320233343ecc34f8eb +Author: Joseph Myers +Date: Tue Jun 27 17:12:13 2017 +0000 + + Fix strftime build with GCC 8. + + Building with current GCC mainline fails with: + + strftime_l.c: In function '__strftime_internal': + strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros] + digits = d > width ? d : width; \ + ^ + strftime_l.c:1260:6: note: in expansion of macro 'DO_NUMBER' + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + ^~~~~~~~~ + strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this 'else' clause + else + ^~~~ + + In fact this particular instance is harmless; the code looks like: + + if (modifier == L_('O')) + goto bad_format; + else + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + + and because of the goto, it doesn't matter that part of the expansion + isn't under the "else" conditional. But it's also clearly bad style + to rely on that. This patch changes DO_NUMBER and DO_NUMBER_SPACEPAD + to use do { } while (0) to avoid such problems. + + Tested (full testsuite) for x86_64 (GCC 6), and with + build-many-glibcs.py with GCC mainline, in conjunction with my libgcc + patch . + + * time/strftime_l.c (DO_NUMBER): Define using do { } while (0). + (DO_NUMBER_SPACEPAD): Likewise. + +--- + time/strftime_l.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +--- a/time/strftime_l.c ++++ b/time/strftime_l.c +@@ -737,12 +737,22 @@ + format_char = *f; + switch (format_char) + { +-#define DO_NUMBER(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number +-#define DO_NUMBER_SPACEPAD(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number_spacepad ++#define DO_NUMBER(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number; \ ++ } \ ++ while (0) ++#define DO_NUMBER_SPACEPAD(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number_spacepad; \ ++ } \ ++ while (0) + + case L_('%'): + if (modifier != 0) diff --git a/packages/glibc/2.18/0015-if_nametoindex-size-check.patch b/packages/glibc/2.18/0015-if_nametoindex-size-check.patch new file mode 100644 index 0000000..375bb95 --- /dev/null +++ b/packages/glibc/2.18/0015-if_nametoindex-size-check.patch @@ -0,0 +1,29 @@ +commit 2180fee114b778515b3f560e5ff1e795282e60b0 +Author: Steve Ellcey +Date: Wed Nov 15 08:58:48 2017 -0800 + + Check length of ifname before copying it into to ifreq structure. + + [BZ #22442] + * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): + Check if ifname is too long. + +--- + sysdeps/unix/sysv/linux/if_index.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/sysdeps/unix/sysv/linux/if_index.c ++++ b/sysdeps/unix/sysv/linux/if_index.c +@@ -44,6 +44,12 @@ + if (fd < 0) + return 0; + ++ if (strlen (ifname) >= IFNAMSIZ) ++ { ++ __set_errno (ENODEV); ++ return 0; ++ } ++ + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) + { diff --git a/packages/glibc/2.19/0012-strftime-multiple-stmts.patch b/packages/glibc/2.19/0012-strftime-multiple-stmts.patch new file mode 100644 index 0000000..88e658b --- /dev/null +++ b/packages/glibc/2.19/0012-strftime-multiple-stmts.patch @@ -0,0 +1,73 @@ +commit e4043b84c49e1cf9bcf1e8320233343ecc34f8eb +Author: Joseph Myers +Date: Tue Jun 27 17:12:13 2017 +0000 + + Fix strftime build with GCC 8. + + Building with current GCC mainline fails with: + + strftime_l.c: In function '__strftime_internal': + strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros] + digits = d > width ? d : width; \ + ^ + strftime_l.c:1260:6: note: in expansion of macro 'DO_NUMBER' + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + ^~~~~~~~~ + strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this 'else' clause + else + ^~~~ + + In fact this particular instance is harmless; the code looks like: + + if (modifier == L_('O')) + goto bad_format; + else + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + + and because of the goto, it doesn't matter that part of the expansion + isn't under the "else" conditional. But it's also clearly bad style + to rely on that. This patch changes DO_NUMBER and DO_NUMBER_SPACEPAD + to use do { } while (0) to avoid such problems. + + Tested (full testsuite) for x86_64 (GCC 6), and with + build-many-glibcs.py with GCC mainline, in conjunction with my libgcc + patch . + + * time/strftime_l.c (DO_NUMBER): Define using do { } while (0). + (DO_NUMBER_SPACEPAD): Likewise. + +--- + time/strftime_l.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +--- a/time/strftime_l.c ++++ b/time/strftime_l.c +@@ -737,12 +737,22 @@ + format_char = *f; + switch (format_char) + { +-#define DO_NUMBER(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number +-#define DO_NUMBER_SPACEPAD(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number_spacepad ++#define DO_NUMBER(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number; \ ++ } \ ++ while (0) ++#define DO_NUMBER_SPACEPAD(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number_spacepad; \ ++ } \ ++ while (0) + + case L_('%'): + if (modifier != 0) diff --git a/packages/glibc/2.19/0013-if_nametoindex-size-check.patch b/packages/glibc/2.19/0013-if_nametoindex-size-check.patch new file mode 100644 index 0000000..375bb95 --- /dev/null +++ b/packages/glibc/2.19/0013-if_nametoindex-size-check.patch @@ -0,0 +1,29 @@ +commit 2180fee114b778515b3f560e5ff1e795282e60b0 +Author: Steve Ellcey +Date: Wed Nov 15 08:58:48 2017 -0800 + + Check length of ifname before copying it into to ifreq structure. + + [BZ #22442] + * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): + Check if ifname is too long. + +--- + sysdeps/unix/sysv/linux/if_index.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/sysdeps/unix/sysv/linux/if_index.c ++++ b/sysdeps/unix/sysv/linux/if_index.c +@@ -44,6 +44,12 @@ + if (fd < 0) + return 0; + ++ if (strlen (ifname) >= IFNAMSIZ) ++ { ++ __set_errno (ENODEV); ++ return 0; ++ } ++ + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) + { diff --git a/packages/glibc/2.20/0012-strftime-multiple-stmts.patch b/packages/glibc/2.20/0012-strftime-multiple-stmts.patch new file mode 100644 index 0000000..0f97e7d --- /dev/null +++ b/packages/glibc/2.20/0012-strftime-multiple-stmts.patch @@ -0,0 +1,73 @@ +commit e4043b84c49e1cf9bcf1e8320233343ecc34f8eb +Author: Joseph Myers +Date: Tue Jun 27 17:12:13 2017 +0000 + + Fix strftime build with GCC 8. + + Building with current GCC mainline fails with: + + strftime_l.c: In function '__strftime_internal': + strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros] + digits = d > width ? d : width; \ + ^ + strftime_l.c:1260:6: note: in expansion of macro 'DO_NUMBER' + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + ^~~~~~~~~ + strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this 'else' clause + else + ^~~~ + + In fact this particular instance is harmless; the code looks like: + + if (modifier == L_('O')) + goto bad_format; + else + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + + and because of the goto, it doesn't matter that part of the expansion + isn't under the "else" conditional. But it's also clearly bad style + to rely on that. This patch changes DO_NUMBER and DO_NUMBER_SPACEPAD + to use do { } while (0) to avoid such problems. + + Tested (full testsuite) for x86_64 (GCC 6), and with + build-many-glibcs.py with GCC mainline, in conjunction with my libgcc + patch . + + * time/strftime_l.c (DO_NUMBER): Define using do { } while (0). + (DO_NUMBER_SPACEPAD): Likewise. + +--- + time/strftime_l.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +--- a/time/strftime_l.c ++++ b/time/strftime_l.c +@@ -738,12 +738,22 @@ + format_char = *f; + switch (format_char) + { +-#define DO_NUMBER(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number +-#define DO_NUMBER_SPACEPAD(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number_spacepad ++#define DO_NUMBER(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number; \ ++ } \ ++ while (0) ++#define DO_NUMBER_SPACEPAD(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number_spacepad; \ ++ } \ ++ while (0) + + case L_('%'): + if (modifier != 0) diff --git a/packages/glibc/2.20/0013-if_nametoindex-size-check.patch b/packages/glibc/2.20/0013-if_nametoindex-size-check.patch new file mode 100644 index 0000000..7976fdd --- /dev/null +++ b/packages/glibc/2.20/0013-if_nametoindex-size-check.patch @@ -0,0 +1,29 @@ +commit 2180fee114b778515b3f560e5ff1e795282e60b0 +Author: Steve Ellcey +Date: Wed Nov 15 08:58:48 2017 -0800 + + Check length of ifname before copying it into to ifreq structure. + + [BZ #22442] + * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): + Check if ifname is too long. + +--- + sysdeps/unix/sysv/linux/if_index.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/sysdeps/unix/sysv/linux/if_index.c ++++ b/sysdeps/unix/sysv/linux/if_index.c +@@ -43,6 +43,12 @@ + if (fd < 0) + return 0; + ++ if (strlen (ifname) >= IFNAMSIZ) ++ { ++ __set_errno (ENODEV); ++ return 0; ++ } ++ + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) + { diff --git a/packages/glibc/2.21/0012-strftime-multiple-stmts.patch b/packages/glibc/2.21/0012-strftime-multiple-stmts.patch new file mode 100644 index 0000000..0f97e7d --- /dev/null +++ b/packages/glibc/2.21/0012-strftime-multiple-stmts.patch @@ -0,0 +1,73 @@ +commit e4043b84c49e1cf9bcf1e8320233343ecc34f8eb +Author: Joseph Myers +Date: Tue Jun 27 17:12:13 2017 +0000 + + Fix strftime build with GCC 8. + + Building with current GCC mainline fails with: + + strftime_l.c: In function '__strftime_internal': + strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros] + digits = d > width ? d : width; \ + ^ + strftime_l.c:1260:6: note: in expansion of macro 'DO_NUMBER' + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + ^~~~~~~~~ + strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this 'else' clause + else + ^~~~ + + In fact this particular instance is harmless; the code looks like: + + if (modifier == L_('O')) + goto bad_format; + else + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + + and because of the goto, it doesn't matter that part of the expansion + isn't under the "else" conditional. But it's also clearly bad style + to rely on that. This patch changes DO_NUMBER and DO_NUMBER_SPACEPAD + to use do { } while (0) to avoid such problems. + + Tested (full testsuite) for x86_64 (GCC 6), and with + build-many-glibcs.py with GCC mainline, in conjunction with my libgcc + patch . + + * time/strftime_l.c (DO_NUMBER): Define using do { } while (0). + (DO_NUMBER_SPACEPAD): Likewise. + +--- + time/strftime_l.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +--- a/time/strftime_l.c ++++ b/time/strftime_l.c +@@ -738,12 +738,22 @@ + format_char = *f; + switch (format_char) + { +-#define DO_NUMBER(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number +-#define DO_NUMBER_SPACEPAD(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number_spacepad ++#define DO_NUMBER(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number; \ ++ } \ ++ while (0) ++#define DO_NUMBER_SPACEPAD(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number_spacepad; \ ++ } \ ++ while (0) + + case L_('%'): + if (modifier != 0) diff --git a/packages/glibc/2.21/0013-if_nametoindex-size-check.patch b/packages/glibc/2.21/0013-if_nametoindex-size-check.patch new file mode 100644 index 0000000..7976fdd --- /dev/null +++ b/packages/glibc/2.21/0013-if_nametoindex-size-check.patch @@ -0,0 +1,29 @@ +commit 2180fee114b778515b3f560e5ff1e795282e60b0 +Author: Steve Ellcey +Date: Wed Nov 15 08:58:48 2017 -0800 + + Check length of ifname before copying it into to ifreq structure. + + [BZ #22442] + * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): + Check if ifname is too long. + +--- + sysdeps/unix/sysv/linux/if_index.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/sysdeps/unix/sysv/linux/if_index.c ++++ b/sysdeps/unix/sysv/linux/if_index.c +@@ -43,6 +43,12 @@ + if (fd < 0) + return 0; + ++ if (strlen (ifname) >= IFNAMSIZ) ++ { ++ __set_errno (ENODEV); ++ return 0; ++ } ++ + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) + { diff --git a/packages/glibc/2.22/0012-strftime-multiple-stmts.patch b/packages/glibc/2.22/0012-strftime-multiple-stmts.patch new file mode 100644 index 0000000..0f97e7d --- /dev/null +++ b/packages/glibc/2.22/0012-strftime-multiple-stmts.patch @@ -0,0 +1,73 @@ +commit e4043b84c49e1cf9bcf1e8320233343ecc34f8eb +Author: Joseph Myers +Date: Tue Jun 27 17:12:13 2017 +0000 + + Fix strftime build with GCC 8. + + Building with current GCC mainline fails with: + + strftime_l.c: In function '__strftime_internal': + strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros] + digits = d > width ? d : width; \ + ^ + strftime_l.c:1260:6: note: in expansion of macro 'DO_NUMBER' + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + ^~~~~~~~~ + strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this 'else' clause + else + ^~~~ + + In fact this particular instance is harmless; the code looks like: + + if (modifier == L_('O')) + goto bad_format; + else + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + + and because of the goto, it doesn't matter that part of the expansion + isn't under the "else" conditional. But it's also clearly bad style + to rely on that. This patch changes DO_NUMBER and DO_NUMBER_SPACEPAD + to use do { } while (0) to avoid such problems. + + Tested (full testsuite) for x86_64 (GCC 6), and with + build-many-glibcs.py with GCC mainline, in conjunction with my libgcc + patch . + + * time/strftime_l.c (DO_NUMBER): Define using do { } while (0). + (DO_NUMBER_SPACEPAD): Likewise. + +--- + time/strftime_l.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +--- a/time/strftime_l.c ++++ b/time/strftime_l.c +@@ -738,12 +738,22 @@ + format_char = *f; + switch (format_char) + { +-#define DO_NUMBER(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number +-#define DO_NUMBER_SPACEPAD(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number_spacepad ++#define DO_NUMBER(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number; \ ++ } \ ++ while (0) ++#define DO_NUMBER_SPACEPAD(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number_spacepad; \ ++ } \ ++ while (0) + + case L_('%'): + if (modifier != 0) diff --git a/packages/glibc/2.22/0013-if_nametoindex-size-check.patch b/packages/glibc/2.22/0013-if_nametoindex-size-check.patch new file mode 100644 index 0000000..7976fdd --- /dev/null +++ b/packages/glibc/2.22/0013-if_nametoindex-size-check.patch @@ -0,0 +1,29 @@ +commit 2180fee114b778515b3f560e5ff1e795282e60b0 +Author: Steve Ellcey +Date: Wed Nov 15 08:58:48 2017 -0800 + + Check length of ifname before copying it into to ifreq structure. + + [BZ #22442] + * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): + Check if ifname is too long. + +--- + sysdeps/unix/sysv/linux/if_index.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/sysdeps/unix/sysv/linux/if_index.c ++++ b/sysdeps/unix/sysv/linux/if_index.c +@@ -43,6 +43,12 @@ + if (fd < 0) + return 0; + ++ if (strlen (ifname) >= IFNAMSIZ) ++ { ++ __set_errno (ENODEV); ++ return 0; ++ } ++ + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) + { diff --git a/packages/glibc/2.23/0008-strftime-multiple-stmts.patch b/packages/glibc/2.23/0008-strftime-multiple-stmts.patch new file mode 100644 index 0000000..51983e4 --- /dev/null +++ b/packages/glibc/2.23/0008-strftime-multiple-stmts.patch @@ -0,0 +1,73 @@ +commit e4043b84c49e1cf9bcf1e8320233343ecc34f8eb +Author: Joseph Myers +Date: Tue Jun 27 17:12:13 2017 +0000 + + Fix strftime build with GCC 8. + + Building with current GCC mainline fails with: + + strftime_l.c: In function '__strftime_internal': + strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros] + digits = d > width ? d : width; \ + ^ + strftime_l.c:1260:6: note: in expansion of macro 'DO_NUMBER' + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + ^~~~~~~~~ + strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this 'else' clause + else + ^~~~ + + In fact this particular instance is harmless; the code looks like: + + if (modifier == L_('O')) + goto bad_format; + else + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + + and because of the goto, it doesn't matter that part of the expansion + isn't under the "else" conditional. But it's also clearly bad style + to rely on that. This patch changes DO_NUMBER and DO_NUMBER_SPACEPAD + to use do { } while (0) to avoid such problems. + + Tested (full testsuite) for x86_64 (GCC 6), and with + build-many-glibcs.py with GCC mainline, in conjunction with my libgcc + patch . + + * time/strftime_l.c (DO_NUMBER): Define using do { } while (0). + (DO_NUMBER_SPACEPAD): Likewise. + +--- + time/strftime_l.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +--- a/time/strftime_l.c ++++ b/time/strftime_l.c +@@ -715,12 +715,22 @@ + format_char = *f; + switch (format_char) + { +-#define DO_NUMBER(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number +-#define DO_NUMBER_SPACEPAD(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number_spacepad ++#define DO_NUMBER(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number; \ ++ } \ ++ while (0) ++#define DO_NUMBER_SPACEPAD(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number_spacepad; \ ++ } \ ++ while (0) + + case L_('%'): + if (modifier != 0) diff --git a/packages/glibc/2.23/0009-if_nametoindex-size-check.patch b/packages/glibc/2.23/0009-if_nametoindex-size-check.patch new file mode 100644 index 0000000..7976fdd --- /dev/null +++ b/packages/glibc/2.23/0009-if_nametoindex-size-check.patch @@ -0,0 +1,29 @@ +commit 2180fee114b778515b3f560e5ff1e795282e60b0 +Author: Steve Ellcey +Date: Wed Nov 15 08:58:48 2017 -0800 + + Check length of ifname before copying it into to ifreq structure. + + [BZ #22442] + * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): + Check if ifname is too long. + +--- + sysdeps/unix/sysv/linux/if_index.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/sysdeps/unix/sysv/linux/if_index.c ++++ b/sysdeps/unix/sysv/linux/if_index.c +@@ -43,6 +43,12 @@ + if (fd < 0) + return 0; + ++ if (strlen (ifname) >= IFNAMSIZ) ++ { ++ __set_errno (ENODEV); ++ return 0; ++ } ++ + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) + { diff --git a/packages/glibc/2.24/0008-strftime-multiple-stmts.patch b/packages/glibc/2.24/0008-strftime-multiple-stmts.patch new file mode 100644 index 0000000..51983e4 --- /dev/null +++ b/packages/glibc/2.24/0008-strftime-multiple-stmts.patch @@ -0,0 +1,73 @@ +commit e4043b84c49e1cf9bcf1e8320233343ecc34f8eb +Author: Joseph Myers +Date: Tue Jun 27 17:12:13 2017 +0000 + + Fix strftime build with GCC 8. + + Building with current GCC mainline fails with: + + strftime_l.c: In function '__strftime_internal': + strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros] + digits = d > width ? d : width; \ + ^ + strftime_l.c:1260:6: note: in expansion of macro 'DO_NUMBER' + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + ^~~~~~~~~ + strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this 'else' clause + else + ^~~~ + + In fact this particular instance is harmless; the code looks like: + + if (modifier == L_('O')) + goto bad_format; + else + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + + and because of the goto, it doesn't matter that part of the expansion + isn't under the "else" conditional. But it's also clearly bad style + to rely on that. This patch changes DO_NUMBER and DO_NUMBER_SPACEPAD + to use do { } while (0) to avoid such problems. + + Tested (full testsuite) for x86_64 (GCC 6), and with + build-many-glibcs.py with GCC mainline, in conjunction with my libgcc + patch . + + * time/strftime_l.c (DO_NUMBER): Define using do { } while (0). + (DO_NUMBER_SPACEPAD): Likewise. + +--- + time/strftime_l.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +--- a/time/strftime_l.c ++++ b/time/strftime_l.c +@@ -715,12 +715,22 @@ + format_char = *f; + switch (format_char) + { +-#define DO_NUMBER(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number +-#define DO_NUMBER_SPACEPAD(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number_spacepad ++#define DO_NUMBER(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number; \ ++ } \ ++ while (0) ++#define DO_NUMBER_SPACEPAD(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number_spacepad; \ ++ } \ ++ while (0) + + case L_('%'): + if (modifier != 0) diff --git a/packages/glibc/2.24/0009-if_nametoindex-size-check.patch b/packages/glibc/2.24/0009-if_nametoindex-size-check.patch new file mode 100644 index 0000000..7976fdd --- /dev/null +++ b/packages/glibc/2.24/0009-if_nametoindex-size-check.patch @@ -0,0 +1,29 @@ +commit 2180fee114b778515b3f560e5ff1e795282e60b0 +Author: Steve Ellcey +Date: Wed Nov 15 08:58:48 2017 -0800 + + Check length of ifname before copying it into to ifreq structure. + + [BZ #22442] + * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): + Check if ifname is too long. + +--- + sysdeps/unix/sysv/linux/if_index.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/sysdeps/unix/sysv/linux/if_index.c ++++ b/sysdeps/unix/sysv/linux/if_index.c +@@ -43,6 +43,12 @@ + if (fd < 0) + return 0; + ++ if (strlen (ifname) >= IFNAMSIZ) ++ { ++ __set_errno (ENODEV); ++ return 0; ++ } ++ + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) + { diff --git a/packages/glibc/2.25/0007-strftime-multiple-stmts.patch b/packages/glibc/2.25/0007-strftime-multiple-stmts.patch new file mode 100644 index 0000000..51983e4 --- /dev/null +++ b/packages/glibc/2.25/0007-strftime-multiple-stmts.patch @@ -0,0 +1,73 @@ +commit e4043b84c49e1cf9bcf1e8320233343ecc34f8eb +Author: Joseph Myers +Date: Tue Jun 27 17:12:13 2017 +0000 + + Fix strftime build with GCC 8. + + Building with current GCC mainline fails with: + + strftime_l.c: In function '__strftime_internal': + strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros] + digits = d > width ? d : width; \ + ^ + strftime_l.c:1260:6: note: in expansion of macro 'DO_NUMBER' + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + ^~~~~~~~~ + strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this 'else' clause + else + ^~~~ + + In fact this particular instance is harmless; the code looks like: + + if (modifier == L_('O')) + goto bad_format; + else + DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE); + + and because of the goto, it doesn't matter that part of the expansion + isn't under the "else" conditional. But it's also clearly bad style + to rely on that. This patch changes DO_NUMBER and DO_NUMBER_SPACEPAD + to use do { } while (0) to avoid such problems. + + Tested (full testsuite) for x86_64 (GCC 6), and with + build-many-glibcs.py with GCC mainline, in conjunction with my libgcc + patch . + + * time/strftime_l.c (DO_NUMBER): Define using do { } while (0). + (DO_NUMBER_SPACEPAD): Likewise. + +--- + time/strftime_l.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +--- a/time/strftime_l.c ++++ b/time/strftime_l.c +@@ -715,12 +715,22 @@ + format_char = *f; + switch (format_char) + { +-#define DO_NUMBER(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number +-#define DO_NUMBER_SPACEPAD(d, v) \ +- digits = d > width ? d : width; \ +- number_value = v; goto do_number_spacepad ++#define DO_NUMBER(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number; \ ++ } \ ++ while (0) ++#define DO_NUMBER_SPACEPAD(d, v) \ ++ do \ ++ { \ ++ digits = d > width ? d : width; \ ++ number_value = v; \ ++ goto do_number_spacepad; \ ++ } \ ++ while (0) + + case L_('%'): + if (modifier != 0) diff --git a/packages/glibc/2.25/0008-if_nametoindex-size-check.patch b/packages/glibc/2.25/0008-if_nametoindex-size-check.patch new file mode 100644 index 0000000..7976fdd --- /dev/null +++ b/packages/glibc/2.25/0008-if_nametoindex-size-check.patch @@ -0,0 +1,29 @@ +commit 2180fee114b778515b3f560e5ff1e795282e60b0 +Author: Steve Ellcey +Date: Wed Nov 15 08:58:48 2017 -0800 + + Check length of ifname before copying it into to ifreq structure. + + [BZ #22442] + * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): + Check if ifname is too long. + +--- + sysdeps/unix/sysv/linux/if_index.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/sysdeps/unix/sysv/linux/if_index.c ++++ b/sysdeps/unix/sysv/linux/if_index.c +@@ -43,6 +43,12 @@ + if (fd < 0) + return 0; + ++ if (strlen (ifname) >= IFNAMSIZ) ++ { ++ __set_errno (ENODEV); ++ return 0; ++ } ++ + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) + { diff --git a/packages/glibc/2.26/0002-if_nametoindex-size-check.patch b/packages/glibc/2.26/0002-if_nametoindex-size-check.patch new file mode 100644 index 0000000..7976fdd --- /dev/null +++ b/packages/glibc/2.26/0002-if_nametoindex-size-check.patch @@ -0,0 +1,29 @@ +commit 2180fee114b778515b3f560e5ff1e795282e60b0 +Author: Steve Ellcey +Date: Wed Nov 15 08:58:48 2017 -0800 + + Check length of ifname before copying it into to ifreq structure. + + [BZ #22442] + * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): + Check if ifname is too long. + +--- + sysdeps/unix/sysv/linux/if_index.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/sysdeps/unix/sysv/linux/if_index.c ++++ b/sysdeps/unix/sysv/linux/if_index.c +@@ -43,6 +43,12 @@ + if (fd < 0) + return 0; + ++ if (strlen (ifname) >= IFNAMSIZ) ++ { ++ __set_errno (ENODEV); ++ return 0; ++ } ++ + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) + { diff --git a/packages/glibc/package.desc b/packages/glibc/package.desc index 71ea200..158e637 100644 --- a/packages/glibc/package.desc +++ b/packages/glibc/package.desc @@ -1,6 +1,6 @@ origin='GNU' repository='git git://sourceware.org/git/glibc.git' mirrors='$(CT_Mirrors GNU glibc)' -milestones='2.14 2.17 2.20 2.23 2.24 2.26' +milestones='2.14 2.17 2.20 2.23 2.24 2.25 2.26' archive_formats='.tar.xz .tar.bz2 .tar.gz' signature_format='packed/.sig' diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh index 3b4b626..4b1c688 100644 --- a/scripts/build/libc/glibc.sh +++ b/scripts/build/libc/glibc.sh @@ -200,6 +200,13 @@ do_libc_backend_once() { glibc_cflags+=" ${CT_GLIBC_EXTRA_CFLAGS}" glibc_cflags+=" ${multi_flags}" + # Before 2.25, glibc didn't use GCC's ifunc attribute, instead creating + # the resolvers through some clever assembly. This had the resolver function + # aliased with an incompatible type, and GCC8 now complains about it. + if [ "${CT_GLIBC_HAS_NEW_IFUNC}" != "y" ]; then + glibc_cflags+=" -Wno-error=attribute-alias" + fi + # Analyze the resulting options for any extra configure switches to throw in. for opt in ${glibc_cflags}; do case ${opt} in -- cgit v0.10.2-6-g49f6