aboutsummaryrefslogtreecommitdiff
path: root/NEWS
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2014-04-30 11:48:43 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2014-04-30 11:48:43 +0530
commit16b293a7a6f65d8ff348a603d19e8fd4372fa3a9 (patch)
tree87f859ee0e33d5f2492f732bc0a12e3bd7bc1921 /NEWS
parent136785eacd13f0c05fefd92b029269efec35dc0a (diff)
downloadglibc-16b293a7a6f65d8ff348a603d19e8fd4372fa3a9.tar
glibc-16b293a7a6f65d8ff348a603d19e8fd4372fa3a9.tar.gz
glibc-16b293a7a6f65d8ff348a603d19e8fd4372fa3a9.tar.bz2
glibc-16b293a7a6f65d8ff348a603d19e8fd4372fa3a9.zip
Do not fail if one of the two responses to AF_UNSPEC fails (BZ #14308)
[Fixes BZ #14308, #12994, #13651] AF_UNSPEC results in sending two queries in parallel, one for the A record and the other for the AAAA record. If one of these is a referral, then the query fails, which is wrong. It should return at least the one successful response. The fix has two parts. The first part makes the referral fall back to the SERVFAIL path, which results in using the successful response. There is a bug in that path however, due to which the second part is necessary. The bug here is that if the first response is a failure and the second succeeds, __libc_res_nsearch does not detect that and assumes a failure. The case where the first response is a success and the second fails, works correctly. This condition is produced by buggy routers, so here's a crude interposable library that can simulate such a condition. The library overrides the recvfrom syscall and modifies the header of the packet received to reproduce this scenario. It has two key variables: mod_packet and first_error. The mod_packet variable when set to 0, results in odd packets being modified to be a referral. When set to 1, even packets are modified to be a referral. The first_error causes the first response to be a failure so that a domain-appended search is performed to test the second part of the __libc_nsearch fix. The driver for this fix is a simple getaddrinfo program that does an AF_UNSPEC query. I have omitted this since it should be easy to implement. I have tested this on x86_64. The interceptor library source: /* Override recvfrom and modify the header of the first DNS response to make it a referral and reproduce bz #845218. We have to resort to this ugly hack because we cannot make bind return the buggy response of a referral for the AAAA record and an authoritative response for the A record. */ #define _GNU_SOURCE #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <stdio.h> #include <stdbool.h> #include <endian.h> #include <dlfcn.h> #include <stdlib.h> /* Lifted from resolv/arpa/nameser_compat.h. */ typedef struct { unsigned id :16; /*%< query identification number */ #if BYTE_ORDER == BIG_ENDIAN /* fields in third byte */ unsigned qr: 1; /*%< response flag */ unsigned opcode: 4; /*%< purpose of message */ unsigned aa: 1; /*%< authoritive answer */ unsigned tc: 1; /*%< truncated message */ unsigned rd: 1; /*%< recursion desired */ /* fields * in * fourth * byte * */ unsigned ra: 1; /*%< recursion available */ unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */ unsigned ad: 1; /*%< authentic data from named */ unsigned cd: 1; /*%< checking disabled by resolver */ unsigned rcode :4; /*%< response code */ #endif #if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN /* fields * in * third * byte * */ unsigned rd :1; /*%< recursion desired */ unsigned tc :1; /*%< truncated message */ unsigned aa :1; /*%< authoritive answer */ unsigned opcode :4; /*%< purpose of message */ unsigned qr :1; /*%< response flag */ /* fields * in * fourth * byte * */ unsigned rcode :4; /*%< response code */ unsigned cd: 1; /*%< checking disabled by resolver */ unsigned ad: 1; /*%< authentic data from named */ unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */ unsigned ra :1; /*%< recursion available */ #endif /* remaining * bytes * */ unsigned qdcount :16; /*%< number of question entries */ unsigned ancount :16; /*%< number of answer entries */ unsigned nscount :16; /*%< number of authority entries */ unsigned arcount :16; /*%< number of resource entries */ } HEADER; static int done = 0; /* Packets to modify. 0 for the odd packets and 1 for even packets. */ static const int mod_packet = 0; /* Set to true if the first request should result in an error, resulting in a search query. */ static bool first_error = true; static ssize_t (*real_recvfrom) (int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen); void __attribute__ ((constructor)) init (void) { real_recvfrom = dlsym (RTLD_NEXT, "recvfrom"); if (real_recvfrom == NULL) { printf ("Failed to get reference to recvfrom: %s\n", dlerror ()); printf ("Cannot simulate test\n"); abort (); } } /* Modify the second packet that we receive to set the header in a manner as to reproduce BZ #845218. */ static void mod_buf (HEADER *h, int port) { if (done % 2 == mod_packet || (first_error && done == 1)) { printf ("(Modifying header)"); if (first_error && done == 1) h->rcode = 3; else h->rcode = 0; /* NOERROR == 0. */ h->ancount = 0; h->aa = 0; h->ra = 0; h->arcount = 0; } done++; } ssize_t recvfrom (int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen) { ssize_t ret = real_recvfrom (sockfd, buf, len, flags, src_addr, addrlen); int port = htons (((struct sockaddr_in *) src_addr)->sin_port); struct in_addr addr = ((struct sockaddr_in *) src_addr)->sin_addr; const char *host = inet_ntoa (addr); printf ("\n*** From %s:%d: ", host, port); mod_buf (buf, port); printf ("returned %zd\n", ret); return ret; }
Diffstat (limited to 'NEWS')
-rw-r--r--NEWS14
1 files changed, 7 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index c890a2618f..10d2626088 100644
--- a/NEWS
+++ b/NEWS
@@ -9,13 +9,13 @@ Version 2.20
* The following bugs are resolved with this release:
- 6804, 13347, 14770, 15347, 15514, 15804, 15894, 16002, 16198, 16284,
- 16348, 16349, 16357, 16362, 16447, 16532, 16545, 16574, 16599, 16600,
- 16609, 16610, 16611, 16613, 16619, 16623, 16629, 16632, 16634, 16639,
- 16642, 16648, 16649, 16670, 16674, 16677, 16680, 16683, 16689, 16695,
- 16701, 16706, 16707, 16712, 16713, 16714, 16731, 16739, 16740, 16743,
- 16754, 16758, 16759, 16760, 16770, 16786, 16789, 16799, 16800, 16815,
- 16823, 16824, 16831, 16838, 16854.
+ 6804, 12994, 13347, 13651, 14308, 14770, 15347, 15514, 15804, 15894,
+ 16002, 16198, 16284, 16348, 16349, 16357, 16362, 16447, 16532, 16545,
+ 16574, 16599, 16600, 16609, 16610, 16611, 16613, 16619, 16623, 16629,
+ 16632, 16634, 16639, 16642, 16648, 16649, 16670, 16674, 16677, 16680,
+ 16683, 16689, 16695, 16701, 16706, 16707, 16712, 16713, 16714, 16731,
+ 16739, 16740, 16743, 16754, 16758, 16759, 16760, 16770, 16786, 16789,
+ 16799, 16800, 16815, 16823, 16824, 16831, 16838, 16854.
* Running the testsuite no longer terminates as soon as a test fails.
Instead, a file tests.sum (xtests.sum from "make xcheck") is generated,