diff --git a/SOURCES/glibc-rh1331283-1.patch b/SOURCES/glibc-rh1331283-1.patch new file mode 100644 index 0000000..1ade53d --- /dev/null +++ b/SOURCES/glibc-rh1331283-1.patch @@ -0,0 +1,34 @@ +commit 3bfff2edbef578746211ba231f3942efffd38f86 +Author: Carlos O'Donell +Date: Thu Feb 6 11:12:48 2014 -0500 + + BZ #16529: Fix pedantic warning with netinet/in.h. + + When compiling with pedantic the following warning is seen: + + gcc -Wall -pedantic -O0 -o test test.c + In file included from test.c:3:0: + /path/inet/netinet/in.h:111:21: warning: comma at end of \ + enumerator list [-Wpedantic] + IPPROTO_MH = 135, /* IPv6 mobility header. */ + ^ + + It is valid C99 to have a trailing comma after the last item in + an enumeration. However it is not valid C90. If possible glibc + attempts to keep all headers C90 + long long without requiring + C99 features. In this case it's easy to fix the headers and it + removes the warning seem with -pedantic. + +diff --git a/inet/netinet/in.h b/inet/netinet/in.h +index ad9ce6c..d8d8e53 100644 +--- a/inet/netinet/in.h ++++ b/inet/netinet/in.h +@@ -108,7 +108,7 @@ enum + #define IPPROTO_NONE IPPROTO_NONE + IPPROTO_DSTOPTS = 60, /* IPv6 destination options. */ + #define IPPROTO_DSTOPTS IPPROTO_DSTOPTS +- IPPROTO_MH = 135, /* IPv6 mobility header. */ ++ IPPROTO_MH = 135 /* IPv6 mobility header. */ + #define IPPROTO_MH IPPROTO_MH + }; + #endif /* !__USE_KERNEL_IPV6_DEFS */ diff --git a/SOURCES/glibc-rh1331283-2.patch b/SOURCES/glibc-rh1331283-2.patch new file mode 100644 index 0000000..a422471 --- /dev/null +++ b/SOURCES/glibc-rh1331283-2.patch @@ -0,0 +1,52 @@ +commit cb43bb0d68f001fc3d6e054d712ab8794b5fd1de +Author: Cong Wang +Date: Tue Jan 6 16:13:19 2015 -0800 + + in.h: Coordinate in6_pktinfo and ip6_mtuinfo for kernel and glibc [BZ #15850] + + Similarly to what we did for in6_addr, we need a macro + to guard in6_pktinfo and ip6_mtuinfo too. + + Cc: Carlos O'Donell + Signed-off-by: Cong Wang + +diff --git a/inet/netinet/in.h b/inet/netinet/in.h +index bf3c8b1..f541c58 100644 +--- a/inet/netinet/in.h ++++ b/inet/netinet/in.h +@@ -530,6 +530,7 @@ extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in) + #ifdef __USE_GNU + struct cmsghdr; /* Forward declaration. */ + ++#ifndef __USE_KERNEL_IPV6_DEFS + /* IPv6 packet information. */ + struct in6_pktinfo + { +@@ -543,7 +544,7 @@ struct ip6_mtuinfo + struct sockaddr_in6 ip6m_addr; /* dst address including zone ID */ + uint32_t ip6m_mtu; /* path MTU in host byte order */ + }; +- ++#endif /* !__USE_KERNEL_IPV6_DEFS */ + + /* Obsolete hop-by-hop and Destination Options Processing (RFC 2292). */ + extern int inet6_option_space (int __nbytes) +diff --git a/sysdeps/unix/sysv/linux/bits/in.h b/sysdeps/unix/sysv/linux/bits/in.h +index b80a27f..b1d2cf6 100644 +--- a/sysdeps/unix/sysv/linux/bits/in.h ++++ b/sysdeps/unix/sysv/linux/bits/in.h +@@ -23,10 +23,10 @@ + + /* If the application has already included linux/in6.h from a linux-based + kernel then we will not define the IPv6 IPPROTO_* defines, in6_addr (nor the +- defines), sockaddr_in6, or ipv6_mreq. The ABI used by the linux-kernel and +- glibc match exactly. Neither the linux kernel nor glibc should break this +- ABI without coordination. */ +-#ifdef _UAPI_LINUX_IN6_H ++ defines), sockaddr_in6, or ipv6_mreq. Same for in6_ptkinfo or ip6_mtuinfo ++ in linux/ipv6.h. The ABI used by the linux-kernel and glibc match exactly. ++ Neither the linux kernel nor glibc should break this ABI without coordination. */ ++#if defined _UAPI_LINUX_IN6_H || defined _UAPI_IPV6_H + /* This is not quite the same API since the kernel always defines s6_addr16 and + s6_addr32. This is not a violation of POSIX since POSIX says "at least the + following member" and that holds true. */ diff --git a/SOURCES/glibc-rh1331283-3.patch b/SOURCES/glibc-rh1331283-3.patch new file mode 100644 index 0000000..444ec36 --- /dev/null +++ b/SOURCES/glibc-rh1331283-3.patch @@ -0,0 +1,89 @@ +commit 1c1e7fb65828c99d6e0f0f3857089b559a0c8189 +Author: Carlos O'Donell +Date: Thu Jun 2 23:30:11 2016 -0400 + + Fix macro API for __USE_KERNEL_IPV6_DEFS. + + The use of __USE_KERNEL_IPV6_DEFS with ifndef is bad + practice per: https://sourceware.org/glibc/wiki/Wundef. + This change moves it to use 'if' and always define the + macro. + + Please note that this is not the only problem with this + code. I have a series of fixes after this one to resolve + breakage with this code and add regression tests for it + via compile-only source testing (to be discussed in another + thread). + + Unfortunately __USE_KERNEL_XATTR_DEFS is set by the kernel + and not glibc, and uses 'define', so we can't fix that yet. + +Index: glibc-2.17-c758a686/inet/netinet/in.h +=================================================================== +--- glibc-2.17-c758a686.orig/inet/netinet/in.h ++++ glibc-2.17-c758a686/inet/netinet/in.h +@@ -91,10 +91,10 @@ enum + IPPROTO_MAX + }; + +-/* If __USER_KERNEL_IPV6_DEFS is defined then the user has included the kernel ++/* If __USE_KERNEL_IPV6_DEFS is 1 then the user has included the kernel + network headers first and we should use those ABI-identical definitions +- instead of our own. */ +-#ifndef __USE_KERNEL_IPV6_DEFS ++ instead of our own, otherwise 0. */ ++#if !__USE_KERNEL_IPV6_DEFS + enum + { + IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */ +@@ -205,7 +205,7 @@ enum + #define INADDR_ALLRTRS_GROUP ((in_addr_t) 0xe0000002) /* 224.0.0.2 */ + #define INADDR_MAX_LOCAL_GROUP ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */ + +-#ifndef __USE_KERNEL_IPV6_DEFS ++#if !__USE_KERNEL_IPV6_DEFS + /* IPv6 address */ + struct in6_addr + { +@@ -248,7 +248,7 @@ struct sockaddr_in + sizeof (struct in_addr)]; + }; + +-#ifndef __USE_KERNEL_IPV6_DEFS ++#if !__USE_KERNEL_IPV6_DEFS + /* Ditto, for IPv6. */ + struct sockaddr_in6 + { +@@ -284,7 +284,7 @@ struct ip_mreq_source + }; + #endif + +-#ifndef __USE_KERNEL_IPV6_DEFS ++#if !__USE_KERNEL_IPV6_DEFS + /* Likewise, for IPv6. */ + struct ipv6_mreq + { +@@ -531,7 +531,7 @@ extern int bindresvport6 (int __sockfd, + #ifdef __USE_GNU + struct cmsghdr; /* Forward declaration. */ + +-#ifndef __USE_KERNEL_IPV6_DEFS ++#if !__USE_KERNEL_IPV6_DEFS + /* IPv6 packet information. */ + struct in6_pktinfo + { +Index: glibc-2.17-c758a686/sysdeps/unix/sysv/linux/bits/in.h +=================================================================== +--- glibc-2.17-c758a686.orig/sysdeps/unix/sysv/linux/bits/in.h ++++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/bits/in.h +@@ -30,7 +30,9 @@ + /* This is not quite the same API since the kernel always defines s6_addr16 and + s6_addr32. This is not a violation of POSIX since POSIX says "at least the + following member" and that holds true. */ +-# define __USE_KERNEL_IPV6_DEFS ++# define __USE_KERNEL_IPV6_DEFS 1 ++#else ++# define __USE_KERNEL_IPV6_DEFS 0 + #endif + + /* Options for use with `getsockopt' and `setsockopt' at the IP level. diff --git a/SOURCES/glibc-rh1331283-4.patch b/SOURCES/glibc-rh1331283-4.patch new file mode 100644 index 0000000..e94581b --- /dev/null +++ b/SOURCES/glibc-rh1331283-4.patch @@ -0,0 +1,62 @@ +commit c9bd40daaee18cf1d9824e4a7ebaebe321e0a5a8 +Author: Carlos O'Donell +Date: Tue Jun 7 04:46:37 2016 -0400 + + Bug 20214: Fix linux/in6.h and netinet/in.h sync. + + In: https://sourceware.org/glibc/wiki/Synchronizing_Headers + we explain how we synchronize our headers with Linux kernel + headers. + + In order to synchronize with the Linux linux/in6.h and + linux/ipv6.h headers we checked for their guard macros and + then defined __USE_KERNEL_IPV6_DEFS and conditionalized code + on this macro. + + In upstream kernel 56c176c9 the _UAPI prefix was stripped and + this broke our synchronized headers again. We now need to check + for _LINUX_IN6_H and _IPV6_H, and keep checking the old versions + of the header guard checks for maximum backwards compatibility + with older Linux headers (the history is actually a bit muddled + here and it appears upstream linus kernel broke this 10 months + *before* our fix was ever applied to glibc, but without glibc + testing we didn't notice and distro kernels have their own + testing to fix this). + + This patch fixes synchronization with linux/in6.h and + with netinet/in.h. + +diff --git a/sysdeps/unix/sysv/linux/bits/in.h b/sysdeps/unix/sysv/linux/bits/in.h +index 9bdadf3..4d70a6b 100644 +--- a/sysdeps/unix/sysv/linux/bits/in.h ++++ b/sysdeps/unix/sysv/linux/bits/in.h +@@ -25,8 +25,14 @@ + kernel then we will not define the IPv6 IPPROTO_* defines, in6_addr (nor the + defines), sockaddr_in6, or ipv6_mreq. Same for in6_ptkinfo or ip6_mtuinfo + in linux/ipv6.h. The ABI used by the linux-kernel and glibc match exactly. +- Neither the linux kernel nor glibc should break this ABI without coordination. */ +-#if defined _UAPI_LINUX_IN6_H || defined _UAPI_IPV6_H ++ Neither the linux kernel nor glibc should break this ABI without coordination. ++ In upstream kernel 56c176c9 the _UAPI prefix was stripped so we need to check ++ for _LINUX_IN6_H and _IPV6_H now, and keep checking the old versions for ++ maximum backwards compatibility. */ ++#if defined _UAPI_LINUX_IN6_H \ ++ || defined _UAPI_IPV6_H \ ++ || defined _LINUX_IN6_H \ ++ || defined _IPV6_H + /* This is not quite the same API since the kernel always defines s6_addr16 and + s6_addr32. This is not a violation of POSIX since POSIX says "at least the + following member" and that holds true. */ +@@ -209,8 +215,10 @@ struct in_pktinfo + #define IPV6_TCLASS 67 + + /* Obsolete synonyms for the above. */ +-#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP +-#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP ++#if !__USE_KERNEL_IPV6_DEFS ++# define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP ++# define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP ++#endif + #define IPV6_RXHOPOPTS IPV6_HOPOPTS + #define IPV6_RXDSTOPTS IPV6_DSTOPTS + diff --git a/SOURCES/glibc-rh1331283.patch b/SOURCES/glibc-rh1331283.patch new file mode 100644 index 0000000..cf9a924 --- /dev/null +++ b/SOURCES/glibc-rh1331283.patch @@ -0,0 +1,201 @@ +commit 6c82a2f8d7c8e21e39237225c819f182ae438db3 +Author: Carlos O'Donell +Date: Fri Sep 6 01:02:30 2013 -0400 + + Coordinate IPv6 definitions for Linux and glibc + + This change synchronizes the glibc headers with the Linux kernel + headers and arranges to coordinate the definition of structures + already defined the Linux kernel UAPI headers. + + It is now safe to include glibc's netinet/in.h or Linux's linux/in6.h + in any order in a userspace application and you will get the same + ABI. The ABI is guaranteed by UAPI and glibc. + +diff --git a/inet/netinet/in.h b/inet/netinet/in.h +index 89e3813..05c77e2 100644 +--- a/inet/netinet/in.h ++++ b/inet/netinet/in.h +@@ -26,13 +26,21 @@ + + __BEGIN_DECLS + ++/* Internet address. */ ++typedef uint32_t in_addr_t; ++struct in_addr ++ { ++ in_addr_t s_addr; ++ }; ++ ++/* Get system-specific definitions. */ ++#include ++ + /* Standard well-defined IP protocols. */ + enum + { + IPPROTO_IP = 0, /* Dummy protocol for TCP. */ + #define IPPROTO_IP IPPROTO_IP +- IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */ +-#define IPPROTO_HOPOPTS IPPROTO_HOPOPTS + IPPROTO_ICMP = 1, /* Internet Control Message Protocol. */ + #define IPPROTO_ICMP IPPROTO_ICMP + IPPROTO_IGMP = 2, /* Internet Group Management Protocol. */ +@@ -55,10 +63,6 @@ enum + #define IPPROTO_DCCP IPPROTO_DCCP + IPPROTO_IPV6 = 41, /* IPv6 header. */ + #define IPPROTO_IPV6 IPPROTO_IPV6 +- IPPROTO_ROUTING = 43, /* IPv6 routing header. */ +-#define IPPROTO_ROUTING IPPROTO_ROUTING +- IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header. */ +-#define IPPROTO_FRAGMENT IPPROTO_FRAGMENT + IPPROTO_RSVP = 46, /* Reservation Protocol. */ + #define IPPROTO_RSVP IPPROTO_RSVP + IPPROTO_GRE = 47, /* General Routing Encapsulation. */ +@@ -67,14 +71,10 @@ enum + #define IPPROTO_ESP IPPROTO_ESP + IPPROTO_AH = 51, /* authentication header. */ + #define IPPROTO_AH IPPROTO_AH +- IPPROTO_ICMPV6 = 58, /* ICMPv6. */ +-#define IPPROTO_ICMPV6 IPPROTO_ICMPV6 +- IPPROTO_NONE = 59, /* IPv6 no next header. */ +-#define IPPROTO_NONE IPPROTO_NONE +- IPPROTO_DSTOPTS = 60, /* IPv6 destination options. */ +-#define IPPROTO_DSTOPTS IPPROTO_DSTOPTS + IPPROTO_MTP = 92, /* Multicast Transport Protocol. */ + #define IPPROTO_MTP IPPROTO_MTP ++ IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET. */ ++#define IPPROTO_BEETPH IPPROTO_BEETPH + IPPROTO_ENCAP = 98, /* Encapsulation Header. */ + #define IPPROTO_ENCAP IPPROTO_ENCAP + IPPROTO_PIM = 103, /* Protocol Independent Multicast. */ +@@ -90,6 +90,28 @@ enum + IPPROTO_MAX + }; + ++/* If __USER_KERNEL_IPV6_DEFS is defined then the user has included the kernel ++ network headers first and we should use those ABI-identical definitions ++ instead of our own. */ ++#ifndef __USE_KERNEL_IPV6_DEFS ++enum ++ { ++ IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */ ++#define IPPROTO_HOPOPTS IPPROTO_HOPOPTS ++ IPPROTO_ROUTING = 43, /* IPv6 routing header. */ ++#define IPPROTO_ROUTING IPPROTO_ROUTING ++ IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header. */ ++#define IPPROTO_FRAGMENT IPPROTO_FRAGMENT ++ IPPROTO_ICMPV6 = 58, /* ICMPv6. */ ++#define IPPROTO_ICMPV6 IPPROTO_ICMPV6 ++ IPPROTO_NONE = 59, /* IPv6 no next header. */ ++#define IPPROTO_NONE IPPROTO_NONE ++ IPPROTO_DSTOPTS = 60, /* IPv6 destination options. */ ++#define IPPROTO_DSTOPTS IPPROTO_DSTOPTS ++ IPPROTO_MH = 135, /* IPv6 mobility header. */ ++#define IPPROTO_MH IPPROTO_MH ++ }; ++#endif /* !__USE_KERNEL_IPV6_DEFS */ + + /* Type to represent a port. */ + typedef uint16_t in_port_t; +@@ -134,15 +156,6 @@ enum + IPPORT_USERRESERVED = 5000 + }; + +- +-/* Internet address. */ +-typedef uint32_t in_addr_t; +-struct in_addr +- { +- in_addr_t s_addr; +- }; +- +- + /* Definitions of the bits in an Internet address integer. + + On subnets, host and network parts are found according to +@@ -191,7 +204,7 @@ struct in_addr + #define INADDR_ALLRTRS_GROUP ((in_addr_t) 0xe0000002) /* 224.0.0.2 */ + #define INADDR_MAX_LOCAL_GROUP ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */ + +- ++#ifndef __USE_KERNEL_IPV6_DEFS + /* IPv6 address */ + struct in6_addr + { +@@ -209,6 +222,7 @@ struct in6_addr + # define s6_addr32 __in6_u.__u6_addr32 + #endif + }; ++#endif /* !__USE_KERNEL_IPV6_DEFS */ + + extern const struct in6_addr in6addr_any; /* :: */ + extern const struct in6_addr in6addr_loopback; /* ::1 */ +@@ -233,6 +247,7 @@ struct sockaddr_in + sizeof (struct in_addr)]; + }; + ++#ifndef __USE_KERNEL_IPV6_DEFS + /* Ditto, for IPv6. */ + struct sockaddr_in6 + { +@@ -242,7 +257,7 @@ struct sockaddr_in6 + struct in6_addr sin6_addr; /* IPv6 address */ + uint32_t sin6_scope_id; /* IPv6 scope-id */ + }; +- ++#endif /* !__USE_KERNEL_IPV6_DEFS */ + + #if defined __USE_MISC || defined __USE_GNU + /* IPv4 multicast request. */ +@@ -268,7 +283,7 @@ struct ip_mreq_source + }; + #endif + +- ++#ifndef __USE_KERNEL_IPV6_DEFS + /* Likewise, for IPv6. */ + struct ipv6_mreq + { +@@ -278,7 +293,7 @@ struct ipv6_mreq + /* local interface */ + unsigned int ipv6mr_interface; + }; +- ++#endif /* !__USE_KERNEL_IPV6_DEFS */ + + #if defined __USE_MISC || defined __USE_GNU + /* Multicast group request. */ +@@ -349,10 +364,6 @@ struct group_filter + * sizeof (struct sockaddr_storage))) + #endif + +- +-/* Get system-specific definitions. */ +-#include +- + /* Functions to convert between host and network byte order. + + Please note that these functions normally take `unsigned long int' or +diff --git a/sysdeps/unix/sysv/linux/bits/in.h b/sysdeps/unix/sysv/linux/bits/in.h +index e959b33..d763ce9 100644 +--- a/sysdeps/unix/sysv/linux/bits/in.h ++++ b/sysdeps/unix/sysv/linux/bits/in.h +@@ -21,6 +21,18 @@ + # error "Never use directly; include instead." + #endif + ++/* If the application has already included linux/in6.h from a linux-based ++ kernel then we will not define the IPv6 IPPROTO_* defines, in6_addr (nor the ++ defines), sockaddr_in6, or ipv6_mreq. The ABI used by the linux-kernel and ++ glibc match exactly. Neither the linux kernel nor glibc should break this ++ ABI without coordination. */ ++#ifdef _UAPI_LINUX_IN6_H ++/* This is not quite the same API since the kernel always defines s6_addr16 and ++ s6_addr32. This is not a violation of POSIX since POSIX says "at least the ++ following member" and that holds true. */ ++# define __USE_KERNEL_IPV6_DEFS ++#endif ++ + /* Options for use with `getsockopt' and `setsockopt' at the IP level. + The first word in the comment at the right is the data type used; + "bool" means a boolean value stored in an `int'. */ diff --git a/SPECS/glibc.spec b/SPECS/glibc.spec index 5a4ec21..86a33fc 100644 --- a/SPECS/glibc.spec +++ b/SPECS/glibc.spec @@ -1,6 +1,6 @@ %define glibcsrcdir glibc-2.17-c758a686 %define glibcversion 2.17 -%define glibcrelease 106%{?dist}.6 +%define glibcrelease 106%{?dist}.8 ############################################################################## # If run_glibc_tests is zero then tests are not run for the build. # You must always set run_glibc_tests to one for production builds. @@ -683,6 +683,13 @@ Patch1622: glibc-rh1310530.patch # name server addresses Patch1623: glibc-rh1320596.patch +# RHBZ #1331283 - Backport "Coordinate IPv6 definitions for Linux and glibc" +Patch1624: glibc-rh1331283.patch +Patch1625: glibc-rh1331283-1.patch +Patch1626: glibc-rh1331283-2.patch +Patch1627: glibc-rh1331283-3.patch +Patch1628: glibc-rh1331283-4.patch + ############################################################################## # # Patches submitted, but not yet approved upstream. @@ -1334,6 +1341,13 @@ package or when debugging this package. %patch1622 -p1 %patch1623 -p1 +# RHBZ #1331283 - Backport "Coordinate IPv6 definitions for Linux and glibc" +%patch1624 -p1 +%patch1625 -p1 +%patch1626 -p1 +%patch1627 -p1 +%patch1628 -p1 + ############################################################################## # %%prep - Additional prep required... ############################################################################## @@ -2402,6 +2416,12 @@ rm -f *.filelist* %endif %changelog +* Thu Jun 16 2016 Carlos O'Donell - 2.17-106.8 +- Fix Linux kernel UAPI header synchronization for IPv6 (#1331283). + +* Fri May 20 2016 Martin Sebor - 2.17-106.7 +- Make minor compatibility adjustments in headers (#1331283). + * Mon Apr 4 2016 Carlos O'Donell - 2.17-106.6 - Fix NULL pointer dereference in stub resolver with unconnectable name server addresses (#1323839).