glibc: Fix CVE-2026-6238
PATCH 1/1 glibc: Fix CVE-2026-6238
From: Deepesh Varatharajan <[email protected]>
Backport six commits from upstream glibc to fix CVE-2026-6238.
4ba0b79b95 resolv: Add test case tst-ns_sprintrr (bug 34033, bug 34069) a7b60d23bb resolv: Fix buffer overreads in ns_sprintrrf (CVE-2026-6238) cd0db208d5 resolv: Check for inet_ntop failure in ns_sprintrrf d58415eb17 resolv: Improve formatting of unknown records in ns_sprintrrf f69b7f95e3 resolv: Fix ns_sprintrrf formatting of class, type values (bug 34289) 360f352c9a resolv: Declare __p_class_syms, __p_type_syms for internal use
The upstream patch series [PATCH 0/5] contains five commits:
1/5: Update GLIBC-SA-2026-0012 to mention A6 records (doc only) 2/5: resolv: Check for inet_ntop failure in ns_sprintrrf 3/5: resolv: Remove incorrect parts of TSIG handling from ns_sprintrrf
(CVE-2026-5435)
4/5: resolv: Fix buffer overreads in ns_sprintrrf (CVE-2026-6238) 5/5: resolv: Add test case tst-ns_sprintrr (bug 34033, bug 34069)
For this backport:
- Patch 1/5 is skipped (documentation-only change to advisories, upstream glibc itself does not backport this to older releases)
- Patch 3/5 (CVE-2026-5435) is already patched in scarthgap sources
- Patches 2/5, 4/5, and 5/5 are backported as:
0028-CVE-2026-6238-0004.patch (inet_ntop failure check) 0029-CVE-2026-6238-0005.patch (buffer overread fix - CVE-2026-6238) 0030-CVE-2026-6238-0006.patch (test case for bug 34033, bug 34069)
However, the test case (tst-ns_sprintrr) from patch 5/5 failed on scarthgap's glibc 2.39 due to missing prerequisite commits. Three additional patches were backported to resolve the test failure:
0025-CVE-2026-6238-0001.patch (Declare __p_class_syms, __p_type_syms for internal) 0026-CVE-2026-6238-0002.patch (Fix ns_sprintrrf formatting of class, type values) 0027-CVE-2026-6238-0003.patch (Improve formatting of unknown records in ns_sprintrrf)
CVE-2026-6238 fixes buffer overreads in ns_sprintrrf affecting A6 and LOC record handling. The vulnerable LOC record handling was introduced before glibc 2.0, while A6 record handling was added in glibc 2.7.
Reference:
https://inbox.sourceware.org/libc-alpha/[email protected]/
https://nvd.nist.gov/vuln/detail/CVE-2026-6238
https://sourceware.org/bugzilla/show_bug.cgi?id=34069
Testing Results:
Before After Diff PASS 4896 4897 +1 XPASS 4 4 0 FAIL 372 372 0 XFAIL 16 16 0 UNSUPPORTED 224 224 0
Changes in testcases:
testcase-name before after
resolv/tst-ns_sprintrr(new) - PASS
commit - 4ba0b79b95 resolv: Add test case tst-ns_sprintrr (bug 34033, bug 34069) +PASS: resolv/tst-ns_sprintrr
--- .../glibc/glibc/0025-CVE-2026-6238-0001.patch | 56 +++ .../glibc/glibc/0026-CVE-2026-6238-0002.patch | 80 ++++ .../glibc/glibc/0027-CVE-2026-6238-0003.patch | 55 +++ .../glibc/glibc/0028-CVE-2026-6238-0004.patch | 70 ++++ .../glibc/glibc/0029-CVE-2026-6238-0005.patch | 66 +++ .../glibc/glibc/0030-CVE-2026-6238-0006.patch | 379 ++++++++++++++++++ meta/recipes-core/glibc/glibc_2.39.bb | 6 + 7 files changed, 712 insertions(+) create mode 100644 meta/recipes-core/glibc/glibc/0025-CVE-2026-6238-0001.patch create mode 100644 meta/recipes-core/glibc/glibc/0026-CVE-2026-6238-0002.patch create mode 100644 meta/recipes-core/glibc/glibc/0027-CVE-2026-6238-0003.patch create mode 100644 meta/recipes-core/glibc/glibc/0028-CVE-2026-6238-0004.patch create mode 100644 meta/recipes-core/glibc/glibc/0029-CVE-2026-6238-0005.patch create mode 100644 meta/recipes-core/glibc/glibc/0030-CVE-2026-6238-0006.patch
meta/recipes-core/glibc/glibc/0025-CVE-2026-6238-0001.patch new file +56 -0
@@ -0,0 +1,56 @@ +From 360f352c9a6da545d798ef3015e73ca114f0d230 Mon Sep 17 00:00:00 2001 +From: Florian Weimer <[email protected]> +Date: Fri, 19 Jun 2026 18:22:20 +0200 +Subject: [PATCH] resolv: Declare __p_class_syms, __p_type_syms for internal + use + +Reviewed-by: Carlos O'Donell <[email protected]> +Reviewed-by: Adhemerval Zanella <[email protected]> + +CVE: CVE-2026-6238 +Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=patch;h=360f352c9a6da545d798ef3015e73ca114f0d230] + +Signed-off-by: Deepesh Varatharajan <[email protected]> +--- + include/resolv.h | 5 +++++ + resolv/res_debug.c | 4 ---- + 2 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/include/resolv.h b/include/resolv.h +index 4dbbac38..d5ad9994 100644 +--- a/include/resolv.h ++++ b/include/resolv.h +@@ -70,6 +70,11 @@ libc_hidden_proto (__libc_res_nameinquery) + extern __typeof (__res_queriesmatch) __libc_res_queriesmatch; + libc_hidden_proto (__libc_res_queriesmatch) + ++extern const struct res_sym __p_class_syms[]; ++libresolv_hidden_proto (__p_class_syms) ++extern const struct res_sym __p_type_syms[]; ++libresolv_hidden_proto (__p_type_syms) ++ + /* Variant of res_hnok which operates on binary (but uncompressed) names. */ + bool __res_binary_hnok (const unsigned char *dn) attribute_hidden; + +diff --git a/resolv/res_debug.c b/resolv/res_debug.c +index dab5283b..6f03e414 100644 +--- a/resolv/res_debug.c ++++ b/resolv/res_debug.c +@@ -389,8 +389,6 @@ p_fqname(const u_char *cp, const u_char *msg, FILE *file) { + * that C_ANY is a qclass but not a class. (You can ask for records of class + * C_ANY, but you can't have any records of that class in the database.) + */ +-extern const struct res_sym __p_class_syms[]; +-libresolv_hidden_proto (__p_class_syms) + const struct res_sym __p_class_syms[] = { + {C_IN, (char *) "IN"}, + {C_CHAOS, (char *) "CHAOS"}, +@@ -425,8 +423,6 @@ const struct res_sym __p_update_section_syms[] attribute_hidden = { + * Names of RR types and qtypes. The list is incomplete because its + * size is part of the ABI. + */ +-extern const struct res_sym __p_type_syms[]; +-libresolv_hidden_proto (__p_type_syms) + const struct res_sym __p_type_syms[] = { + {ns_t_a, (char *) "A", (char *) "address"}, + {ns_t_ns, (char *) "NS", (char *) "name server"},
meta/recipes-core/glibc/glibc/0026-CVE-2026-6238-0002.patch new file +80 -0
80 lines not on this page · raw message
meta/recipes-core/glibc/glibc/0027-CVE-2026-6238-0003.patch new file +55 -0
55 lines not on this page · raw message
meta/recipes-core/glibc/glibc/0028-CVE-2026-6238-0004.patch new file +70 -0
70 lines not on this page · raw message
meta/recipes-core/glibc/glibc/0029-CVE-2026-6238-0005.patch new file +66 -0
66 lines not on this page · raw message
meta/recipes-core/glibc/glibc/0030-CVE-2026-6238-0006.patch new file +379 -0
379 lines not on this page · raw message
meta/recipes-core/glibc/glibc_2.39.bb +6 -0
@@ -57,6 +57,12 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ file://0023-qemu-stale-process.patch \ file://0001-stdlib-Add-single-threaded-fast-path-to-rand.patch \ file://0024-CVE-2026-5435.patch \ + file://0025-CVE-2026-6238-0001.patch \ + file://0026-CVE-2026-6238-0002.patch \ + file://0027-CVE-2026-6238-0003.patch \ + file://0028-CVE-2026-6238-0004.patch \ + file://0029-CVE-2026-6238-0005.patch \ + file://0030-CVE-2026-6238-0006.patch \ " S = "${WORKDIR}/git" B = "${WORKDIR}/build-${TARGET_SYS}"
Signature · 1 line
2.49.0
Quoted 60 lines · Deepesh via lists.openembedded.org Varatharajan
From: Deepesh Varatharajan <[email protected]>
Backport six commits from upstream glibc to fix CVE-2026-6238.
4ba0b79b95resolv: Add test case tst-ns_sprintrr (bug 34033, bug 34069)a7b60d23bbresolv: Fix buffer overreads inns_sprintrrf(CVE-2026-6238)cd0db208d5resolv: Check forinet_ntopfailure inns_sprintrrfd58415eb17resolv: Improve formatting of unknown records inns_sprintrrff69b7f95e3resolv: Fixns_sprintrrfformatting of class, type values (bug 34289)360f352c9aresolv: Declare__p_class_syms,__p_type_symsfor internal useThe upstream patch series [PATCH 0/5] contains five commits:
1/5: Update GLIBC-SA-2026-0012 to mention A6 records (doc only) 2/5: resolv: Check forinet_ntopfailure inns_sprintrrf3/5: resolv: Remove incorrect parts of TSIG handling fromns_sprintrrf(CVE-2026-5435)4/5: resolv: Fix buffer overreads in
ns_sprintrrf(CVE-2026-6238) 5/5: resolv: Add test case tst-ns_sprintrr (bug 34033, bug 34069)For this backport:
- Patch 1/5 is skipped (documentation-only change to advisories, upstream glibc itself does not backport this to older releases)
- Patch 3/5 (CVE-2026-5435) is already patched in scarthgap sources
- Patches 2/5, 4/5, and 5/5 are backported as:
0028-CVE-2026-6238-0004.patch (inet_ntopfailure check) 0029-CVE-2026-6238-0005.patch (buffer overread fix - CVE-2026-6238) 0030-CVE-2026-6238-0006.patch (test case for bug 34033, bug 34069)However, the test case (tst-ns_sprintrr) from patch 5/5 failed on scarthgap's glibc 2.39 due to missing prerequisite commits. Three additional patches were backported to resolve the test failure:
0025-CVE-2026-6238-0001.patch (Declare__p_class_syms,__p_type_symsfor internal) 0026-CVE-2026-6238-0002.patch (Fixns_sprintrrfformatting of class, type values) 0027-CVE-2026-6238-0003.patch (Improve formatting of unknown records inns_sprintrrf)CVE-2026-6238 fixes buffer overreads in
ns_sprintrrfaffecting A6 and LOC record handling. The vulnerable LOC record handling was introduced before glibc 2.0, while A6 record handling was added in glibc 2.7.Reference:
https://inbox.sourceware.org/libc-alpha/[email protected]/
https://nvd.nist.gov/vuln/detail/CVE-2026-6238
https://sourceware.org/bugzilla/show_bug.cgi?id=34069Testing Results:
Before After Diff PASS 4896 4897 +1 XPASS 4 4 0 FAIL 372 372 0 XFAIL 16 16 0 UNSUPPORTED 224 224 0Changes in testcases:
testcase-name before after
resolv/tst-ns_sprintrr(new) - PASScommit -
4ba0b79b95resolv: Add test case tst-ns_sprintrr (bug 34033, bug 34069) +PASS: resolv/tst-ns_sprintrrSigned-off-by Deepesh Varatharajan <[email protected]>
Quoted 15 lines
--- .../glibc/glibc/0025-CVE-2026-6238-0001.patch | 56 +++ .../glibc/glibc/0026-CVE-2026-6238-0002.patch | 80 ++++ .../glibc/glibc/0027-CVE-2026-6238-0003.patch | 55 +++ .../glibc/glibc/0028-CVE-2026-6238-0004.patch | 70 ++++ .../glibc/glibc/0029-CVE-2026-6238-0005.patch | 66 +++ .../glibc/glibc/0030-CVE-2026-6238-0006.patch | 379 ++++++++++++++++++ meta/recipes-core/glibc/glibc_2.39.bb | 6 + 7 files changed, 712 insertions(+) create mode 100644 meta/recipes-core/glibc/glibc/0025-CVE-2026-6238-0001.patch create mode 100644 meta/recipes-core/glibc/glibc/0026-CVE-2026-6238-0002.patch create mode 100644 meta/recipes-core/glibc/glibc/0027-CVE-2026-6238-0003.patch create mode 100644 meta/recipes-core/glibc/glibc/0028-CVE-2026-6238-0004.patch create mode 100644 meta/recipes-core/glibc/glibc/0029-CVE-2026-6238-0005.patch create mode 100644 meta/recipes-core/glibc/glibc/0030-CVE-2026-6238-0006.patch
Hello,
Out of curiosity, did we try to send these backports to upstream? I'd be more confortable keeping the "update along the upstream maintained branch" idea we had until now.
The 2.39 branch has not seen updates since 8 weeks so it looks like they finally stopped maintaining it, but I've not found an anounce, did you?
In the meantime, I'll keep reviewing those.
Thanks!
Signature · 2 lines
Yoann Congal Smile ECS
Quoted 60 lines · Deepesh via lists.openembedded.org Varatharajan
From: Deepesh Varatharajan <[email protected]>
Backport six commits from upstream glibc to fix CVE-2026-6238.
4ba0b79b95resolv: Add test case tst-ns_sprintrr (bug 34033, bug 34069)a7b60d23bbresolv: Fix buffer overreads inns_sprintrrf(CVE-2026-6238)cd0db208d5resolv: Check forinet_ntopfailure inns_sprintrrfd58415eb17resolv: Improve formatting of unknown records inns_sprintrrff69b7f95e3resolv: Fixns_sprintrrfformatting of class, type values (bug 34289)360f352c9aresolv: Declare__p_class_syms,__p_type_symsfor internal useThe upstream patch series [PATCH 0/5] contains five commits:
1/5: Update GLIBC-SA-2026-0012 to mention A6 records (doc only) 2/5: resolv: Check forinet_ntopfailure inns_sprintrrf3/5: resolv: Remove incorrect parts of TSIG handling fromns_sprintrrf(CVE-2026-5435)4/5: resolv: Fix buffer overreads in
ns_sprintrrf(CVE-2026-6238) 5/5: resolv: Add test case tst-ns_sprintrr (bug 34033, bug 34069)For this backport:
- Patch 1/5 is skipped (documentation-only change to advisories, upstream glibc itself does not backport this to older releases)
- Patch 3/5 (CVE-2026-5435) is already patched in scarthgap sources
- Patches 2/5, 4/5, and 5/5 are backported as:
0028-CVE-2026-6238-0004.patch (inet_ntopfailure check) 0029-CVE-2026-6238-0005.patch (buffer overread fix - CVE-2026-6238) 0030-CVE-2026-6238-0006.patch (test case for bug 34033, bug 34069)However, the test case (tst-ns_sprintrr) from patch 5/5 failed on scarthgap's glibc 2.39 due to missing prerequisite commits. Three additional patches were backported to resolve the test failure:
0025-CVE-2026-6238-0001.patch (Declare__p_class_syms,__p_type_symsfor internal) 0026-CVE-2026-6238-0002.patch (Fixns_sprintrrfformatting of class, type values) 0027-CVE-2026-6238-0003.patch (Improve formatting of unknown records inns_sprintrrf)CVE-2026-6238 fixes buffer overreads in
ns_sprintrrfaffecting A6 and LOC record handling. The vulnerable LOC record handling was introduced before glibc 2.0, while A6 record handling was added in glibc 2.7.Reference:
https://inbox.sourceware.org/libc-alpha/[email protected]/
https://nvd.nist.gov/vuln/detail/CVE-2026-6238
https://sourceware.org/bugzilla/show_bug.cgi?id=34069Testing Results:
Before After Diff PASS 4896 4897 +1 XPASS 4 4 0 FAIL 372 372 0 XFAIL 16 16 0 UNSUPPORTED 224 224 0Changes in testcases:
testcase-name before after
resolv/tst-ns_sprintrr(new) - PASScommit -
4ba0b79b95resolv: Add test case tst-ns_sprintrr (bug 34033, bug 34069) +PASS: resolv/tst-ns_sprintrrSigned-off-by Deepesh Varatharajan <[email protected]>
Quoted 15 lines
--- .../glibc/glibc/0025-CVE-2026-6238-0001.patch | 56 +++ .../glibc/glibc/0026-CVE-2026-6238-0002.patch | 80 ++++ .../glibc/glibc/0027-CVE-2026-6238-0003.patch | 55 +++ .../glibc/glibc/0028-CVE-2026-6238-0004.patch | 70 ++++ .../glibc/glibc/0029-CVE-2026-6238-0005.patch | 66 +++ .../glibc/glibc/0030-CVE-2026-6238-0006.patch | 379 ++++++++++++++++++ meta/recipes-core/glibc/glibc_2.39.bb | 6 + 7 files changed, 712 insertions(+) create mode 100644 meta/recipes-core/glibc/glibc/0025-CVE-2026-6238-0001.patch create mode 100644 meta/recipes-core/glibc/glibc/0026-CVE-2026-6238-0002.patch create mode 100644 meta/recipes-core/glibc/glibc/0027-CVE-2026-6238-0003.patch create mode 100644 meta/recipes-core/glibc/glibc/0028-CVE-2026-6238-0004.patch create mode 100644 meta/recipes-core/glibc/glibc/0029-CVE-2026-6238-0005.patch create mode 100644 meta/recipes-core/glibc/glibc/0030-CVE-2026-6238-0006.patch
Hello,
There are formating issues with this series. Some examples below, but I won't flag everything.
Quoted 23 lines
meta/recipes-core/glibc/glibc/0025-CVE-2026-6238-0001.patch new file +16
-0@@ -0,0 +1,56 @@ +From 360f352c9a6da545d798ef3015e73ca114f0d230 Mon Sep 17 00:00:00 2001 +From: Florian Weimer <[email protected]> +Date: Fri, 19 Jun 2026 18:22:20 +0200 +Subject: [PATCH] resolv: Declare __p_class_syms, __p_type_syms for internal + use + +Reviewed-by: Carlos O'Donell <[email protected]> +Reviewed-by: Adhemerval Zanella <[email protected]> + +CVE: CVE-2026-6238 +Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=patch;h=360f352c9a6da545d798ef3015e73ca114f0d230] + +Signed-off-by: Deepesh Varatharajan <[email protected]> +--- + include/resolv.h | 5 +++++ + resolv/res_debug.c | 4 ----
meta/recipes-core/glibc/glibc/0025-CVE-2026-6238-0001.patch line 26
Quoted 10 lines
meta/recipes-core/glibc/glibc/0025-CVE-2026-6238-0001.patch new file +10
-0+ 2 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/include/resolv.h b/include/resolv.h +index 4dbbac38..d5ad9994 100644 +--- a/include/resolv.h ++++ b/include/resolv.h +@@ -70,6 +70,11 @@ libc_hidden_proto (__libc_res_nameinquery) + extern __typeof (__res_queriesmatch) __libc_res_queriesmatch; + libc_hidden_proto (__libc_res_queriesmatch) +
^ patch formatting: it lacks a space here marking the context
Quoted 32 lines
meta/recipes-core/glibc/glibc/0026-CVE-2026-6238-0002.patch new file +26
-0@@ -0,0 +1,80 @@ +From f69b7f95e3694177546faec25d88bb266885c3b8 Mon Sep 17 00:00:00 2001 +From: Florian Weimer <[email protected]> +Date: Fri, 19 Jun 2026 18:22:20 +0200 +Subject: [PATCH] resolv: Fix ns_sprintrrf formatting of class, type values + (bug 34289) + +The p_class and p_type results could overwrite each other if both +were unknown. Format unknown values with CLASS and TYPE prefixes, +as in RFC 3597. Handle A6 separately because it cannot be added +to __p_type_syms for ABI reasons. + +Reviewed-by: Carlos O'Donell <[email protected]> +Reviewed-by: Adhemerval Zanella <[email protected]> + +CVE: CVE-2026-6238 +Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=patch;h=f69b7f95e3694177546faec25d88bb266885c3b8] + +Signed-off-by: Deepesh Varatharajan <[email protected]> +--- + resolv/ns_print.c | 38 +++++++++++++++++++++++++++++++++----- + 1 file changed, 33 insertions(+), 5 deletions(-) + +diff --git a/resolv/ns_print.c b/resolv/ns_print.c +index fffed4b3..59c34553 100644 +--- a/resolv/ns_print.c ++++ b/resolv/ns_print.c
meta/recipes-core/glibc/glibc/0026-CVE-2026-6238-0002.patch line 36
Quoted 10 lines
meta/recipes-core/glibc/glibc/0026-CVE-2026-6238-0002.patch new file +10
-0+@@ -78,6 +78,24 @@ ns_sprintrr(const ns_msg *handle, const ns_rr *rr, + } + libresolv_hidden_def (ns_sprintrr) + ++/* Writes the class/type symbol NUMBER to *BUF, using the name from ++ *SYMS if possible. If NUMBER is not found in *SYMS, print the ++ number with PREFIX. */ ++static int ++addsym (const struct res_sym *syms, int number, const char *prefix, ++ char **buf, size_t *buflen)
^ A space was added here from the upstream patch (there are
many instances of that below)
Can you please send a v2 where the diff between the upstream patch and your is minimal? (No formatting issues, no spurious reindentation)
You can use the interdiff tool to compare diffs (yours vs upstream's), it makes those issues visible.
BTW, I can't help but suspect that these changes are created by the use of a LLM. Please remember that you have to tag LLM generated patches.
Regards,
Signature · 2 lines
Yoann Congal Smile ECS