glibc/0007-resolv-Track-single-request-fallback-via-_res._flags.patch
liqingqing_1229 8ead2a5406 sync from glibc upstream 2.38 branch.
here are the patches:
9184c13681 resolv: Fix tst-resolv-short-response for older GCC (bug 32042)
3ac7ba61d2 Update syscall lists for Linux 6.5
6bb75212e6 Add mremap tests
f0e2114535 mremap: Update manual entry
0301637b99 linux: Update the mremap C implementation [BZ #31968]
1bed6acf50 resolv: Track single-request fallback via _res._flags (bug 31476)
6cad0f543c resolv: Do not wait for non-existing second DNS response after error (bug 30081)
dc512364e8 resolv: Allow short error responses to match any query (bug 31890)
bb30bd2162 Linux: Make __rseq_size useful for feature detection (bug 31965)
d9d019d674 elf: Make dl-rseq-symbols Linux only
7bfc35959d nptl: fix potential merge of __rseq_* relro symbols
712453634c s390x: Fix segfault in wcsncmp [BZ #31934]

(cherry picked from commit bfffcbf6ae59fd90403d1a40103b2a61ba4aaf6b)
2024-08-06 19:37:39 +08:00

82 lines
3.1 KiB
Diff

From 1bed6acf50f6fdedf5a501cbd6a8225e5c13b886 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Thu, 13 Jun 2024 18:56:30 +0200
Subject: [PATCH 07/12] resolv: Track single-request fallback via _res._flags
(bug 31476)
This avoids changing _res.options, which inteferes with change
detection as part of automatic reloading of /etc/resolv.conf.
Reviewed-by: DJ Delorie <dj@redhat.com>
(cherry picked from commit 868ab8923a2ec977faafec97ecafac0c3159c1b2)
---
NEWS | 1 +
resolv/res_send.c | 12 +++++++-----
resolv/resolv-internal.h | 2 ++
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/NEWS b/NEWS
index 4156a017ac..3b252c96b4 100644
--- a/NEWS
+++ b/NEWS
@@ -52,6 +52,7 @@ The following bugs are resolved with this release:
[31183] Wide stream buffer size reduced MB_LEN_MAX bytes after bug 17522 fix
[31184] FAIL: elf/tst-tlsgap
[31185] Incorrect thread point access in _dl_tlsdesc_undefweak and _dl_tlsdesc_dynamic
+ [31476] resolv: Track single-request fallback via _res._flags
[31890] resolv: Allow short error responses to match any DNS query
[31965] rseq extension mechanism does not work as intended
diff --git a/resolv/res_send.c b/resolv/res_send.c
index b741b42cae..1b130b4df4 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -947,9 +947,11 @@ send_dg(res_state statp,
seconds /= statp->nscount;
if (seconds <= 0)
seconds = 1;
- bool single_request_reopen = (statp->options & RES_SNGLKUPREOP) != 0;
- bool single_request = (((statp->options & RES_SNGLKUP) != 0)
- | single_request_reopen);
+ bool single_request_reopen = ((statp->options & RES_SNGLKUPREOP)
+ || (statp->_flags & RES_F_SNGLKUPREOP));
+ bool single_request = ((statp->options & RES_SNGLKUP)
+ || (statp->_flags & RES_F_SNGLKUP)
+ || single_request_reopen);
int save_gotsomewhere = *gotsomewhere;
int retval;
@@ -1006,14 +1008,14 @@ send_dg(res_state statp,
have received the first answer. */
if (!single_request)
{
- statp->options |= RES_SNGLKUP;
+ statp->_flags |= RES_F_SNGLKUP;
single_request = true;
*gotsomewhere = save_gotsomewhere;
goto retry;
}
else if (!single_request_reopen)
{
- statp->options |= RES_SNGLKUPREOP;
+ statp->_flags |= RES_F_SNGLKUPREOP;
single_request_reopen = true;
*gotsomewhere = save_gotsomewhere;
__res_iclose (statp, false);
diff --git a/resolv/resolv-internal.h b/resolv/resolv-internal.h
index 2b98ac4920..3fa81d784f 100644
--- a/resolv/resolv-internal.h
+++ b/resolv/resolv-internal.h
@@ -26,6 +26,8 @@
#define RES_F_VC 0x00000001 /* Socket is TCP. */
#define RES_F_CONN 0x00000002 /* Socket is connected. */
#define RES_F_EDNS0ERR 0x00000004 /* EDNS0 caused errors. */
+#define RES_F_SNGLKUP 0x00200000 /* Private version of RES_SNGLKUP. */
+#define RES_F_SNGLKUPREOP 0x00400000 /* Private version of RES_SNGLKUPREOP. */
/* The structure HEADER is normally aligned on a word boundary. In
some code, we need to access this structure when it may be aligned
--
2.33.0