summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-05 17:50:25 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-10 10:32:07 +0000
commita8b7d51ccec6208ec91be7c7b207b110e3269e78 (patch)
tree6456b3fd1ba799c5afb87300f4c7907e4c9aa52e /meta
parent632565fb1c89f1c75223f1613d4ea648bbb88c44 (diff)
downloadpoky-a8b7d51ccec6208ec91be7c7b207b110e3269e78.tar.gz
glibc: Upgrade to 2.35
Package /usr/bin/ld.so in a separate package ld.so is a new tool which is added as a symlink to original dynamic linker so make it available with same name across architectures which is useful to leveral features like --preload, --audit, and --list-diagnostics more accessible to end users (From OE-Core rev: 2658dcbcfc3db814af1ee104303effc1b6cfa489) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/conf/distro/include/tcmode-default.inc2
-rw-r--r--meta/recipes-core/glibc/cross-localedef-native_2.35.bb (renamed from meta/recipes-core/glibc/cross-localedef-native_2.34.bb)16
-rw-r--r--meta/recipes-core/glibc/glibc-common.inc2
-rw-r--r--meta/recipes-core/glibc/glibc-locale_2.35.bb (renamed from meta/recipes-core/glibc/glibc-locale_2.34.bb)0
-rw-r--r--meta/recipes-core/glibc/glibc-mtrace_2.35.bb (renamed from meta/recipes-core/glibc/glibc-mtrace_2.34.bb)0
-rw-r--r--meta/recipes-core/glibc/glibc-package.inc7
-rw-r--r--meta/recipes-core/glibc/glibc-scripts_2.35.bb (renamed from meta/recipes-core/glibc/glibc-scripts_2.34.bb)0
-rw-r--r--meta/recipes-core/glibc/glibc-tests_2.35.bb (renamed from meta/recipes-core/glibc/glibc-tests_2.34.bb)0
-rw-r--r--meta/recipes-core/glibc/glibc-testsuite_2.35.bb (renamed from meta/recipes-core/glibc/glibc-testsuite_2.34.bb)0
-rw-r--r--meta/recipes-core/glibc/glibc-version.inc8
-rw-r--r--meta/recipes-core/glibc/glibc/0001-CVE-2021-38604.patch43
-rw-r--r--meta/recipes-core/glibc/glibc/0001-CVE-2021-3998.patch282
-rw-r--r--meta/recipes-core/glibc/glibc/0001-CVE-2021-3999.patch36
-rw-r--r--meta/recipes-core/glibc/glibc/0001-CVE-2022-23218.patch178
-rw-r--r--meta/recipes-core/glibc/glibc/0001-CVE-2022-23219.patch55
-rw-r--r--meta/recipes-core/glibc/glibc/0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch79
-rw-r--r--meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch2
-rw-r--r--meta/recipes-core/glibc/glibc/0002-CVE-2021-38604.patch150
-rw-r--r--meta/recipes-core/glibc/glibc/0002-CVE-2021-3998.patch138
-rw-r--r--meta/recipes-core/glibc/glibc/0002-CVE-2021-3999.patch357
-rw-r--r--meta/recipes-core/glibc/glibc/0002-CVE-2022-23218.patch126
-rw-r--r--meta/recipes-core/glibc/glibc/0002-CVE-2022-23219.patch89
-rw-r--r--meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch2
-rw-r--r--meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch8
-rw-r--r--meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch6
-rw-r--r--meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch18
-rw-r--r--meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch14
-rw-r--r--meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch16
-rw-r--r--meta/recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch2
-rw-r--r--meta/recipes-core/glibc/glibc/0009-yes-within-the-path-sets-wrong-config-variables.patch (renamed from meta/recipes-core/glibc/glibc/0016-yes-within-the-path-sets-wrong-config-variables.patch)2
-rw-r--r--meta/recipes-core/glibc/glibc/0010-eglibc-Cross-building-and-testing-instructions.patch (renamed from meta/recipes-core/glibc/glibc/0019-eglibc-Cross-building-and-testing-instructions.patch)2
-rw-r--r--meta/recipes-core/glibc/glibc/0011-eglibc-Help-bootstrap-cross-toolchain.patch (renamed from meta/recipes-core/glibc/glibc/0020-eglibc-Help-bootstrap-cross-toolchain.patch)8
-rw-r--r--meta/recipes-core/glibc/glibc/0012-eglibc-Resolve-__fpscr_values-on-SH4.patch (renamed from meta/recipes-core/glibc/glibc/0021-eglibc-Resolve-__fpscr_values-on-SH4.patch)2
-rw-r--r--meta/recipes-core/glibc/glibc/0013-eglibc-Forward-port-cross-locale-generation-support.patch (renamed from meta/recipes-core/glibc/glibc/0022-eglibc-Forward-port-cross-locale-generation-support.patch)66
-rw-r--r--meta/recipes-core/glibc/glibc/0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch (renamed from meta/recipes-core/glibc/glibc/0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch)10
-rw-r--r--meta/recipes-core/glibc/glibc/0016-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch (renamed from meta/recipes-core/glibc/glibc/0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch)6
-rw-r--r--meta/recipes-core/glibc/glibc/0017-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch (renamed from meta/recipes-core/glibc/glibc/0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch)6
-rw-r--r--meta/recipes-core/glibc/glibc/0018-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch (renamed from meta/recipes-core/glibc/glibc/0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch)19
-rw-r--r--meta/recipes-core/glibc/glibc/0019-powerpc-Do-not-ask-compiler-for-finding-arch.patch (renamed from meta/recipes-core/glibc/glibc/0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch)2
-rw-r--r--meta/recipes-core/glibc/glibc/0021-Replace-echo-with-printf-builtin-in-nscd-init-script.patch (renamed from meta/recipes-core/glibc/glibc/0018-Remove-bash-dependency-for-nscd-init-script.patch)47
-rw-r--r--meta/recipes-core/glibc/glibc/0022-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch (renamed from meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch)16
-rw-r--r--meta/recipes-core/glibc/glibc/0023-timezone-Make-shell-interpreter-overridable-in-tzsel.patch (renamed from meta/recipes-core/glibc/glibc/0001-Make-shell-interpreter-overridable-in-tzselect.ksh.patch)11
-rw-r--r--meta/recipes-core/glibc/glibc/0026-intl-Emit-no-lines-in-bison-generated-files.patch31
-rw-r--r--meta/recipes-core/glibc/glibc/CVE-2021-43396.patch184
-rw-r--r--meta/recipes-core/glibc/glibc_2.35.bb (renamed from meta/recipes-core/glibc/glibc_2.34.bb)39
45 files changed, 175 insertions, 1912 deletions
diff --git a/meta/conf/distro/include/tcmode-default.inc b/meta/conf/distro/include/tcmode-default.inc
index 372f8fe59a..adaa11e0f8 100644
--- a/meta/conf/distro/include/tcmode-default.inc
+++ b/meta/conf/distro/include/tcmode-default.inc
@@ -20,7 +20,7 @@ GCCVERSION ?= "11.%"
20SDKGCCVERSION ?= "${GCCVERSION}" 20SDKGCCVERSION ?= "${GCCVERSION}"
21BINUVERSION ?= "2.37%" 21BINUVERSION ?= "2.37%"
22GDBVERSION ?= "11.%" 22GDBVERSION ?= "11.%"
23GLIBCVERSION ?= "2.34" 23GLIBCVERSION ?= "2.35"
24LINUXLIBCVERSION ?= "5.16%" 24LINUXLIBCVERSION ?= "5.16%"
25QEMUVERSION ?= "6.2%" 25QEMUVERSION ?= "6.2%"
26GOVERSION ?= "1.17%" 26GOVERSION ?= "1.17%"
diff --git a/meta/recipes-core/glibc/cross-localedef-native_2.34.bb b/meta/recipes-core/glibc/cross-localedef-native_2.35.bb
index c37814ee24..893d376459 100644
--- a/meta/recipes-core/glibc/cross-localedef-native_2.34.bb
+++ b/meta/recipes-core/glibc/cross-localedef-native_2.35.bb
@@ -25,14 +25,14 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
25 file://0001-localedef-Add-hardlink-resolver-from-util-linux.patch \ 25 file://0001-localedef-Add-hardlink-resolver-from-util-linux.patch \
26 file://0002-localedef-fix-ups-hardlink-to-make-it-compile.patch \ 26 file://0002-localedef-fix-ups-hardlink-to-make-it-compile.patch \
27 \ 27 \
28 file://0018-Remove-bash-dependency-for-nscd-init-script.patch \ 28 file://0010-eglibc-Cross-building-and-testing-instructions.patch \
29 file://0019-eglibc-Cross-building-and-testing-instructions.patch \ 29 file://0011-eglibc-Help-bootstrap-cross-toolchain.patch \
30 file://0020-eglibc-Help-bootstrap-cross-toolchain.patch \ 30 file://0012-eglibc-Resolve-__fpscr_values-on-SH4.patch \
31 file://0021-eglibc-Resolve-__fpscr_values-on-SH4.patch \ 31 file://0013-eglibc-Forward-port-cross-locale-generation-support.patch \
32 file://0022-eglibc-Forward-port-cross-locale-generation-support.patch \ 32 file://0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
33 file://0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ 33 file://0021-Replace-echo-with-printf-builtin-in-nscd-init-script.patch \
34 file://0001-Make-shell-interpreter-overridable-in-tzselect.ksh.patch \ 34 file://0023-timezone-Make-shell-interpreter-overridable-in-tzsel.patch \
35" 35 "
36# Makes for a rather long rev (22 characters), but... 36# Makes for a rather long rev (22 characters), but...
37# 37#
38SRCREV_FORMAT = "glibc_localedef" 38SRCREV_FORMAT = "glibc_localedef"
diff --git a/meta/recipes-core/glibc/glibc-common.inc b/meta/recipes-core/glibc/glibc-common.inc
index f695cd6a4a..098ebbc932 100644
--- a/meta/recipes-core/glibc/glibc-common.inc
+++ b/meta/recipes-core/glibc/glibc-common.inc
@@ -22,4 +22,4 @@ ARM_INSTRUCTION_SET:armv6 = "arm"
22# 22#
23COMPATIBLE_HOST:libc-musl:class-target = "null" 23COMPATIBLE_HOST:libc-musl:class-target = "null"
24 24
25PV = "2.34" 25PV = "2.35"
diff --git a/meta/recipes-core/glibc/glibc-locale_2.34.bb b/meta/recipes-core/glibc/glibc-locale_2.35.bb
index f7702e0358..f7702e0358 100644
--- a/meta/recipes-core/glibc/glibc-locale_2.34.bb
+++ b/meta/recipes-core/glibc/glibc-locale_2.35.bb
diff --git a/meta/recipes-core/glibc/glibc-mtrace_2.34.bb b/meta/recipes-core/glibc/glibc-mtrace_2.35.bb
index 0b69bad46a..0b69bad46a 100644
--- a/meta/recipes-core/glibc/glibc-mtrace_2.34.bb
+++ b/meta/recipes-core/glibc/glibc-mtrace_2.35.bb
diff --git a/meta/recipes-core/glibc/glibc-package.inc b/meta/recipes-core/glibc/glibc-package.inc
index 54e2a08906..90437a1c6f 100644
--- a/meta/recipes-core/glibc/glibc-package.inc
+++ b/meta/recipes-core/glibc/glibc-package.inc
@@ -1,6 +1,6 @@
1INHIBIT_SYSROOT_STRIP = "1" 1INHIBIT_SYSROOT_STRIP = "1"
2 2
3PACKAGES = "${PN}-dbg catchsegv sln nscd ldconfig ldd tzcode glibc-thread-db ${PN}-pic libmemusage malloc-debug libnss-db libsegfault ${PN}-pcprofile libsotruss ${PN} ${PN}-utils glibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc ${PN}-src" 3PACKAGES = "${PN}-dbg catchsegv sln nscd ldconfig ldd ldso tzcode glibc-thread-db ${PN}-pic libmemusage malloc-debug libnss-db libsegfault ${PN}-pcprofile libsotruss ${PN} ${PN}-utils glibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc ${PN}-src"
4 4
5# The ld.so in this glibc supports the GNU_HASH 5# The ld.so in this glibc supports the GNU_HASH
6RPROVIDES:${PN} = "eglibc rtld(GNU_HASH)" 6RPROVIDES:${PN} = "eglibc rtld(GNU_HASH)"
@@ -23,12 +23,14 @@ ARCH_DYNAMIC_LOADER:aarch64 = "ld-linux-${TARGET_ARCH}.so.1"
23libc_baselibs:append = " ${@oe.utils.conditional('ARCH_DYNAMIC_LOADER', '', '', '${root_prefix}/lib/${ARCH_DYNAMIC_LOADER}', d)}" 23libc_baselibs:append = " ${@oe.utils.conditional('ARCH_DYNAMIC_LOADER', '', '', '${root_prefix}/lib/${ARCH_DYNAMIC_LOADER}', d)}"
24INSANE_SKIP:${PN}:append:aarch64 = " libdir" 24INSANE_SKIP:${PN}:append:aarch64 = " libdir"
25INSANE_SKIP:${PN}-dev += "staticdev" 25INSANE_SKIP:${PN}-dev += "staticdev"
26INSANE_SKIP:${MLPREFIX}ldso:append = " dev-so libdir"
26 27
27FILES:${PN} = "${libc_baselibs} ${libexecdir}/* ${sysconfdir}/ld.so.conf" 28FILES:${PN} = "${libc_baselibs} ${libexecdir}/* ${sysconfdir}/ld.so.conf"
28RRECOMMENDS:${PN} = "${@bb.utils.contains('DISTRO_FEATURES', 'ldconfig', '${MLPREFIX}ldconfig', '', d)}" 29RRECOMMENDS:${PN} = "${@bb.utils.contains('DISTRO_FEATURES', 'ldconfig', '${MLPREFIX}ldconfig', '', d)}"
29FILES:ldconfig = "${base_sbindir}/ldconfig" 30FILES:ldconfig = "${base_sbindir}/ldconfig"
30FILES:ldd = "${bindir}/ldd" 31FILES:ldd = "${bindir}/ldd"
31FILES:libsegfault = "${base_libdir}/libSegFault*" 32FILES:libsegfault = "${base_libdir}/libSegFault*"
33FILES:ldso = "${bindir}/${MLPREFIX}ld.so"
32FILES:libmemusage = "${base_libdir}/libmemusage.so" 34FILES:libmemusage = "${base_libdir}/libmemusage.so"
33FILES:malloc-debug = "${base_libdir}/libc_malloc_debug.so.0" 35FILES:malloc-debug = "${base_libdir}/libc_malloc_debug.so.0"
34FILES:libnss-db = "${base_libdir}/libnss_db.so.* ${base_libdir}/libnss_db-*.so ${localstatedir}/db/Makefile ${localstatedir}/db/makedbs.sh" 36FILES:libnss-db = "${base_libdir}/libnss_db.so.* ${base_libdir}/libnss_db-*.so ${localstatedir}/db/Makefile ${localstatedir}/db/makedbs.sh"
@@ -121,6 +123,9 @@ do_install() {
121 fi 123 fi
122 ln -rs ${D}${base_libdir}/libpthread.so.0 ${D}${libdir}/libpthread.so 124 ln -rs ${D}${base_libdir}/libpthread.so.0 ${D}${libdir}/libpthread.so
123 ln -rs ${D}${base_libdir}/librt.so.1 ${D}${libdir}/librt.so 125 ln -rs ${D}${base_libdir}/librt.so.1 ${D}${libdir}/librt.so
126 if [ -n "${MLPREFIX}" ]; then
127 mv ${D}${bindir}/ld.so ${D}${bindir}/${MLPREFIX}ld.so
128 fi
124} 129}
125 130
126def get_libc_fpu_setting(bb, d): 131def get_libc_fpu_setting(bb, d):
diff --git a/meta/recipes-core/glibc/glibc-scripts_2.34.bb b/meta/recipes-core/glibc/glibc-scripts_2.35.bb
index 5a89bd8022..5a89bd8022 100644
--- a/meta/recipes-core/glibc/glibc-scripts_2.34.bb
+++ b/meta/recipes-core/glibc/glibc-scripts_2.35.bb
diff --git a/meta/recipes-core/glibc/glibc-tests_2.34.bb b/meta/recipes-core/glibc/glibc-tests_2.35.bb
index 8c7ecf89ba..8c7ecf89ba 100644
--- a/meta/recipes-core/glibc/glibc-tests_2.34.bb
+++ b/meta/recipes-core/glibc/glibc-tests_2.35.bb
diff --git a/meta/recipes-core/glibc/glibc-testsuite_2.34.bb b/meta/recipes-core/glibc/glibc-testsuite_2.35.bb
index e8ad2a938b..e8ad2a938b 100644
--- a/meta/recipes-core/glibc/glibc-testsuite_2.34.bb
+++ b/meta/recipes-core/glibc/glibc-testsuite_2.35.bb
diff --git a/meta/recipes-core/glibc/glibc-version.inc b/meta/recipes-core/glibc/glibc-version.inc
index 281df7ecda..080e905b6e 100644
--- a/meta/recipes-core/glibc/glibc-version.inc
+++ b/meta/recipes-core/glibc/glibc-version.inc
@@ -1,7 +1,7 @@
1SRCBRANCH ?= "release/2.34/master" 1SRCBRANCH ?= "release/2.35/master"
2PV = "2.34" 2PV = "2.35"
3SRCREV_glibc ?= "ae37d06c7d127817ba43850f0f898b793d42aea7" 3SRCREV_glibc ?= "24962427071fa532c3c48c918e9d64d719cc8a6c"
4SRCREV_localedef ?= "95c0221703ad970a52445e9eaf91c4aff35eebef" 4SRCREV_localedef ?= "794da69788cbf9bf57b59a852f9f11307663fa87"
5 5
6GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git" 6GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
7 7
diff --git a/meta/recipes-core/glibc/glibc/0001-CVE-2021-38604.patch b/meta/recipes-core/glibc/glibc/0001-CVE-2021-38604.patch
deleted file mode 100644
index 1e94049004..0000000000
--- a/meta/recipes-core/glibc/glibc/0001-CVE-2021-38604.patch
+++ /dev/null
@@ -1,43 +0,0 @@
1From b805aebd42364fe696e417808a700fdb9800c9e8 Mon Sep 17 00:00:00 2001
2From: Nikita Popov <npv1310@gmail.com>
3Date: Mon, 9 Aug 2021 20:17:34 +0530
4Subject: [PATCH] librt: fix NULL pointer dereference (bug 28213)
5
6Helper thread frees copied attribute on NOTIFY_REMOVED message
7received from the OS kernel. Unfortunately, it fails to check whether
8copied attribute actually exists (data.attr != NULL). This worked
9earlier because free() checks passed pointer before actually
10attempting to release corresponding memory. But
11__pthread_attr_destroy assumes pointer is not NULL.
12
13So passing NULL pointer to __pthread_attr_destroy will result in
14segmentation fault. This scenario is possible if
15notification->sigev_notify_attributes == NULL (which means default
16thread attributes should be used).
17
18Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=b805aebd42364fe696e417808a700fdb9800c9e8]
19CVE: CVE-2021-38604
20
21Signed-off-by: Nikita Popov <npv1310@gmail.com>
22Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
23Signed-off-by: Vinay Kumar <vinay.m.engg@gmail.com>
24---
25 sysdeps/unix/sysv/linux/mq_notify.c | 2 +-
26 1 file changed, 1 insertion(+), 1 deletion(-)
27
28diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c
29index 9799dcdaa4..eccae2e4c6 100644
30--- a/sysdeps/unix/sysv/linux/mq_notify.c
31+++ b/sysdeps/unix/sysv/linux/mq_notify.c
32@@ -131,7 +131,7 @@ helper_thread (void *arg)
33 to wait until it is done with it. */
34 (void) __pthread_barrier_wait (&notify_barrier);
35 }
36- else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED)
37+ else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED && data.attr != NULL)
38 {
39 /* The only state we keep is the copy of the thread attributes. */
40 __pthread_attr_destroy (data.attr);
41--
422.31.1
43
diff --git a/meta/recipes-core/glibc/glibc/0001-CVE-2021-3998.patch b/meta/recipes-core/glibc/glibc/0001-CVE-2021-3998.patch
deleted file mode 100644
index c6bd5916e3..0000000000
--- a/meta/recipes-core/glibc/glibc/0001-CVE-2021-3998.patch
+++ /dev/null
@@ -1,282 +0,0 @@
1From fb7bff12e81c677a6622f724edd4d4987dd9d971 Mon Sep 17 00:00:00 2001
2From: Siddhesh Poyarekar <siddhesh@sourceware.org>
3Date: Tue, 18 Jan 2022 13:29:36 +0530
4Subject: [PATCH] support: Add helpers to create paths longer than PATH_MAX
5
6Add new helpers support_create_and_chdir_toolong_temp_directory and
7support_chdir_toolong_temp_directory to create and descend into
8directory trees longer than PATH_MAX.
9
10Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
11Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
12
13Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=062ff490c1467059f6cd64bb9c3d85f6cc6cf97a]
14CVE: CVE-2021-3998
15
16Signed-off-by: Pgowda <pgowda.cve@gmail.com>
17---
18 support/temp_file.c | 159 +++++++++++++++++++++++++++++++++++++++++---
19 support/temp_file.h | 9 +++
20 2 files changed, 159 insertions(+), 9 deletions(-)
21
22diff --git a/support/temp_file.c b/support/temp_file.c
23index e7bb8aadb9..e41128c2d4 100644
24--- a/support/temp_file.c
25+++ b/support/temp_file.c
26@@ -1,5 +1,6 @@
27 /* Temporary file handling for tests.
28 Copyright (C) 1998-2021 Free Software Foundation, Inc.
29+ Copyright The GNU Tools Authors.
30 This file is part of the GNU C Library.
31
32 The GNU C Library is free software; you can redistribute it and/or
33@@ -20,15 +21,17 @@
34 some 32-bit platforms. */
35 #define _FILE_OFFSET_BITS 64
36
37+#include <support/check.h>
38 #include <support/temp_file.h>
39 #include <support/temp_file-internal.h>
40 #include <support/support.h>
41
42+#include <errno.h>
43 #include <paths.h>
44 #include <stdio.h>
45 #include <stdlib.h>
46 #include <string.h>
47-#include <unistd.h>
48+#include <xunistd.h>
49
50 /* List of temporary files. */
51 static struct temp_name_list
52@@ -36,14 +39,20 @@ static struct temp_name_list
53 struct temp_name_list *next;
54 char *name;
55 pid_t owner;
56+ bool toolong;
57 } *temp_name_list;
58
59 /* Location of the temporary files. Set by the test skeleton via
60 support_set_test_dir. The string is not be freed. */
61 static const char *test_dir = _PATH_TMP;
62
63-void
64-add_temp_file (const char *name)
65+/* Name of subdirectories in a too long temporary directory tree. */
66+static char toolong_subdir[NAME_MAX + 1];
67+static bool toolong_initialized;
68+static size_t toolong_path_max;
69+
70+static void
71+add_temp_file_internal (const char *name, bool toolong)
72 {
73 struct temp_name_list *newp
74 = (struct temp_name_list *) xcalloc (sizeof (*newp), 1);
75@@ -53,12 +62,19 @@ add_temp_file (const char *name)
76 newp->name = newname;
77 newp->next = temp_name_list;
78 newp->owner = getpid ();
79+ newp->toolong = toolong;
80 temp_name_list = newp;
81 }
82 else
83 free (newp);
84 }
85
86+void
87+add_temp_file (const char *name)
88+{
89+ add_temp_file_internal (name, false);
90+}
91+
92 int
93 create_temp_file_in_dir (const char *base, const char *dir, char **filename)
94 {
95@@ -90,8 +106,8 @@ create_temp_file (const char *base, char
96 return create_temp_file_in_dir (base, test_dir, filename);
97 }
98
99-char *
100-support_create_temp_directory (const char *base)
101+static char *
102+create_temp_directory_internal (const char *base, bool toolong)
103 {
104 char *path = xasprintf ("%s/%sXXXXXX", test_dir, base);
105 if (mkdtemp (path) == NULL)
106@@ -99,16 +115,132 @@ support_create_temp_directory (const cha
107 printf ("error: mkdtemp (\"%s\"): %m", path);
108 exit (1);
109 }
110- add_temp_file (path);
111+ add_temp_file_internal (path, toolong);
112 return path;
113 }
114
115-/* Helper functions called by the test skeleton follow. */
116+char *
117+support_create_temp_directory (const char *base)
118+{
119+ return create_temp_directory_internal (base, false);
120+}
121+
122+static void
123+ensure_toolong_initialized (void)
124+{
125+ if (!toolong_initialized)
126+ FAIL_EXIT1 ("uninitialized toolong directory tree\n");
127+}
128+
129+static void
130+initialize_toolong (const char *base)
131+{
132+ long name_max = pathconf (base, _PC_NAME_MAX);
133+ name_max = (name_max < 0 ? 64
134+ : (name_max < sizeof (toolong_subdir) ? name_max
135+ : sizeof (toolong_subdir) - 1));
136+
137+ long path_max = pathconf (base, _PC_PATH_MAX);
138+ path_max = (path_max < 0 ? 1024
139+ : path_max <= PTRDIFF_MAX ? path_max : PTRDIFF_MAX);
140+
141+ /* Sanity check to ensure that the test does not create temporary directories
142+ in different filesystems because this API doesn't support it. */
143+ if (toolong_initialized)
144+ {
145+ if (name_max != strlen (toolong_subdir))
146+ FAIL_UNSUPPORTED ("name_max: Temporary directories in different"
147+ " filesystems not supported yet\n");
148+ if (path_max != toolong_path_max)
149+ FAIL_UNSUPPORTED ("path_max: Temporary directories in different"
150+ " filesystems not supported yet\n");
151+ return;
152+ }
153+
154+ toolong_path_max = path_max;
155+
156+ size_t len = name_max;
157+ memset (toolong_subdir, 'X', len);
158+ toolong_initialized = true;
159+}
160+
161+char *
162+support_create_and_chdir_toolong_temp_directory (const char *basename)
163+{
164+ char *base = create_temp_directory_internal (basename, true);
165+ xchdir (base);
166+
167+ initialize_toolong (base);
168+
169+ size_t sz = strlen (toolong_subdir);
170+
171+ /* Create directories and descend into them so that the final path is larger
172+ than PATH_MAX. */
173+ for (size_t i = 0; i <= toolong_path_max / sz; i++)
174+ {
175+ int ret = mkdir (toolong_subdir, S_IRWXU);
176+ if (ret != 0 && errno == ENAMETOOLONG)
177+ FAIL_UNSUPPORTED ("Filesystem does not support creating too long "
178+ "directory trees\n");
179+ else if (ret != 0)
180+ FAIL_EXIT1 ("Failed to create directory tree: %m\n");
181+ xchdir (toolong_subdir);
182+ }
183+ return base;
184+}
185
186 void
187-support_set_test_dir (const char *path)
188+support_chdir_toolong_temp_directory (const char *base)
189 {
190- test_dir = path;
191+ ensure_toolong_initialized ();
192+
193+ xchdir (base);
194+
195+ size_t sz = strlen (toolong_subdir);
196+ for (size_t i = 0; i <= toolong_path_max / sz; i++)
197+ xchdir (toolong_subdir);
198+}
199+
200+/* Helper functions called by the test skeleton follow. */
201+
202+static void
203+remove_toolong_subdirs (const char *base)
204+{
205+ ensure_toolong_initialized ();
206+
207+ if (chdir (base) != 0)
208+ {
209+ printf ("warning: toolong cleanup base failed: chdir (\"%s\"): %m\n",
210+ base);
211+ return;
212+ }
213+
214+ /* Descend. */
215+ int levels = 0;
216+ size_t sz = strlen (toolong_subdir);
217+ for (levels = 0; levels <= toolong_path_max / sz; levels++)
218+ if (chdir (toolong_subdir) != 0)
219+ {
220+ printf ("warning: toolong cleanup failed: chdir (\"%s\"): %m\n",
221+ toolong_subdir);
222+ break;
223+ }
224+
225+ /* Ascend and remove. */
226+ while (--levels >= 0)
227+ {
228+ if (chdir ("..") != 0)
229+ {
230+ printf ("warning: toolong cleanup failed: chdir (\"..\"): %m\n");
231+ return;
232+ }
233+ if (remove (toolong_subdir) != 0)
234+ {
235+ printf ("warning: could not remove subdirectory: %s: %m\n",
236+ toolong_subdir);
237+ return;
238+ }
239+ }
240 }
241
242 void
243@@ -123,6 +255,9 @@ support_delete_temp_files (void)
244 around, to prevent PID reuse.) */
245 if (temp_name_list->owner == pid)
246 {
247+ if (temp_name_list->toolong)
248+ remove_toolong_subdirs (temp_name_list->name);
249+
250 if (remove (temp_name_list->name) != 0)
251 printf ("warning: could not remove temporary file: %s: %m\n",
252 temp_name_list->name);
253@@ -147,3 +282,9 @@ support_print_temp_files (FILE *f)
254 fprintf (f, ")\n");
255 }
256 }
257+
258+void
259+support_set_test_dir (const char *path)
260+{
261+ test_dir = path;
262+}
263diff --git a/support/temp_file.h b/support/temp_file.h
264index 50a443abe4..8459ddda72 100644
265--- a/support/temp_file.h
266+++ b/support/temp_file.h
267@@ -44,6 +44,15 @@ int create_temp_file_in_dir (const char
268 returns. The caller should free this string. */
269 char *support_create_temp_directory (const char *base);
270
271+/* Create a temporary directory tree that is longer than PATH_MAX and schedule
272+ it for deletion. BASENAME is used as a prefix for the unique directory
273+ name, which the function returns. The caller should free this string. */
274+char *support_create_and_chdir_toolong_temp_directory (const char *basename);
275+
276+/* Change into the innermost directory of the directory tree BASE, which was
277+ created using support_create_and_chdir_toolong_temp_directory. */
278+void support_chdir_toolong_temp_directory (const char *base);
279+
280 __END_DECLS
281
282 #endif /* SUPPORT_TEMP_FILE_H */
diff --git a/meta/recipes-core/glibc/glibc/0001-CVE-2021-3999.patch b/meta/recipes-core/glibc/glibc/0001-CVE-2021-3999.patch
deleted file mode 100644
index 64749390b5..0000000000
--- a/meta/recipes-core/glibc/glibc/0001-CVE-2021-3999.patch
+++ /dev/null
@@ -1,36 +0,0 @@
1From 8c8a71c85f2ed5cc90d08d82ce645513fc907cb6 Mon Sep 17 00:00:00 2001
2From: Siddhesh Poyarekar <siddhesh@sourceware.org>
3Date: Mon, 24 Jan 2022 10:57:09 +0530
4Subject: [PATCH] tst-realpath-toolong: Fix hurd build
5
6Define PATH_MAX to a constant if it isn't already defined, like in hurd.
7
8Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
9(cherry picked from commit 976db046bc3a3738f69255ae00b0a09b8e77fd9c)
10
11Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=8c8a71c85f2ed5cc90d08d82ce645513fc907cb6]
12CVE: CVE-2021-3999
13
14Signed-off-by: Pgowda <pgowda.cve@gmail.com>
15---
16 stdlib/tst-realpath-toolong.c | 4 ++++
17 1 file changed, 4 insertions(+)
18
19diff --git a/stdlib/tst-realpath-toolong.c b/stdlib/tst-realpath-toolong.c
20index 8bed772460..4388890294 100644
21--- a/stdlib/tst-realpath-toolong.c
22+++ b/stdlib/tst-realpath-toolong.c
23@@ -29,6 +29,10 @@
24
25 #define BASENAME "tst-realpath-toolong."
26
27+#ifndef PATH_MAX
28+# define PATH_MAX 1024
29+#endif
30+
31 int
32 do_test (void)
33 {
34--
352.27.0
36
diff --git a/meta/recipes-core/glibc/glibc/0001-CVE-2022-23218.patch b/meta/recipes-core/glibc/glibc/0001-CVE-2022-23218.patch
deleted file mode 100644
index 4eb1fb7fbe..0000000000
--- a/meta/recipes-core/glibc/glibc/0001-CVE-2022-23218.patch
+++ /dev/null
@@ -1,178 +0,0 @@
1From e368b12f6c16b6888dda99ba641e999b9c9643c8 Mon Sep 17 00:00:00 2001
2From: Florian Weimer <fweimer@redhat.com>
3Date: Mon, 17 Jan 2022 10:21:34 +0100
4Subject: [PATCH] socket: Add the __sockaddr_un_set function
5
6Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=e368b12f6c16b6888dda99ba641e999b9c9643c8]
7CVE: CVE-2022-23219
8
9Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
10Signed-off-by: Pgowda <pgowda.cve@gmail.com>
11---
12 include/sys/un.h | 12 +++++++
13 socket/Makefile | 6 +++-
14 socket/sockaddr_un_set.c | 41 ++++++++++++++++++++++++
15 socket/tst-sockaddr_un_set.c | 62 ++++++++++++++++++++++++++++++++++++
16 4 files changed, 120 insertions(+), 1 deletion(-)
17 create mode 100644 socket/sockaddr_un_set.c
18 create mode 100644 socket/tst-sockaddr_un_set.c
19
20diff --git a/include/sys/un.h b/include/sys/un.h
21index bdbee99980..152afd9fc7 100644
22--- a/include/sys/un.h
23+++ b/include/sys/un.h
24@@ -1 +1,13 @@
25 #include <socket/sys/un.h>
26+
27+#ifndef _ISOMAC
28+
29+/* Set ADDR->sun_family to AF_UNIX and ADDR->sun_path to PATHNAME.
30+ Return 0 on success or -1 on failure (due to overlong PATHNAME).
31+ The caller should always use sizeof (struct sockaddr_un) as the
32+ socket address length, disregaring the length of PATHNAME.
33+ Only concrete (non-abstract) pathnames are supported. */
34+int __sockaddr_un_set (struct sockaddr_un *addr, const char *pathname)
35+ attribute_hidden;
36+
37+#endif /* _ISOMAC */
38diff --git a/socket/Makefile b/socket/Makefile
39index 39333e10ca..156eec6c85 100644
40--- a/socket/Makefile
41+++ b/socket/Makefile
42@@ -29,13 +29,17 @@ headers := sys/socket.h sys/un.h bits/sockaddr.h bits/socket.h \
43 routines := accept bind connect getpeername getsockname getsockopt \
44 listen recv recvfrom recvmsg send sendmsg sendto \
45 setsockopt shutdown socket socketpair isfdtype opensock \
46- sockatmark accept4 recvmmsg sendmmsg
47+ sockatmark accept4 recvmmsg sendmmsg sockaddr_un_set
48
49 tests := \
50 tst-accept4 \
51 tst-sockopt \
52 # tests
53
54+tests-internal := \
55+ tst-sockaddr_un_set \
56+ # tests-internal
57+
58 tests-time64 := \
59 tst-sockopt-time64 \
60 # tests
61diff --git a/socket/sockaddr_un_set.c b/socket/sockaddr_un_set.c
62new file mode 100644
63index 0000000000..0bd40dc34e
64--- /dev/null
65+++ b/socket/sockaddr_un_set.c
66@@ -0,0 +1,41 @@
67+/* Set the sun_path member of struct sockaddr_un.
68+ Copyright (C) 2022 Free Software Foundation, Inc.
69+ This file is part of the GNU C Library.
70+
71+ The GNU C Library is free software; you can redistribute it and/or
72+ modify it under the terms of the GNU Lesser General Public
73+ License as published by the Free Software Foundation; either
74+ version 2.1 of the License, or (at your option) any later version.
75+
76+ The GNU C Library is distributed in the hope that it will be useful,
77+ but WITHOUT ANY WARRANTY; without even the implied warranty of
78+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
79+ Lesser General Public License for more details.
80+
81+ You should have received a copy of the GNU Lesser General Public
82+ License along with the GNU C Library; if not, see
83+ <https://www.gnu.org/licenses/>. */
84+
85+#include <errno.h>
86+#include <string.h>
87+#include <sys/socket.h>
88+#include <sys/un.h>
89+
90+int
91+__sockaddr_un_set (struct sockaddr_un *addr, const char *pathname)
92+{
93+ size_t name_length = strlen (pathname);
94+
95+ /* The kernel supports names of exactly sizeof (addr->sun_path)
96+ bytes, without a null terminator, but userspace does not; see the
97+ SUN_LEN macro. */
98+ if (name_length >= sizeof (addr->sun_path))
99+ {
100+ __set_errno (EINVAL); /* Error code used by the kernel. */
101+ return -1;
102+ }
103+
104+ addr->sun_family = AF_UNIX;
105+ memcpy (addr->sun_path, pathname, name_length + 1);
106+ return 0;
107+}
108diff --git a/socket/tst-sockaddr_un_set.c b/socket/tst-sockaddr_un_set.c
109new file mode 100644
110index 0000000000..29c2a81afd
111--- /dev/null
112+++ b/socket/tst-sockaddr_un_set.c
113@@ -0,0 +1,62 @@
114+/* Test the __sockaddr_un_set function.
115+ Copyright (C) 2022 Free Software Foundation, Inc.
116+ This file is part of the GNU C Library.
117+
118+ The GNU C Library is free software; you can redistribute it and/or
119+ modify it under the terms of the GNU Lesser General Public
120+ License as published by the Free Software Foundation; either
121+ version 2.1 of the License, or (at your option) any later version.
122+
123+ The GNU C Library is distributed in the hope that it will be useful,
124+ but WITHOUT ANY WARRANTY; without even the implied warranty of
125+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
126+ Lesser General Public License for more details.
127+
128+ You should have received a copy of the GNU Lesser General Public
129+ License along with the GNU C Library; if not, see
130+ <https://www.gnu.org/licenses/>. */
131+
132+/* Re-compile the function because the version in libc is not
133+ exported. */
134+#include "sockaddr_un_set.c"
135+
136+#include <support/check.h>
137+
138+static int
139+do_test (void)
140+{
141+ struct sockaddr_un sun;
142+
143+ memset (&sun, 0xcc, sizeof (sun));
144+ __sockaddr_un_set (&sun, "");
145+ TEST_COMPARE (sun.sun_family, AF_UNIX);
146+ TEST_COMPARE (__sockaddr_un_set (&sun, ""), 0);
147+
148+ memset (&sun, 0xcc, sizeof (sun));
149+ TEST_COMPARE (__sockaddr_un_set (&sun, "/example"), 0);
150+ TEST_COMPARE_STRING (sun.sun_path, "/example");
151+
152+ {
153+ char pathname[108]; /* Length of sun_path (ABI constant). */
154+ memset (pathname, 'x', sizeof (pathname));
155+ pathname[sizeof (pathname) - 1] = '\0';
156+ memset (&sun, 0xcc, sizeof (sun));
157+ TEST_COMPARE (__sockaddr_un_set (&sun, pathname), 0);
158+ TEST_COMPARE (sun.sun_family, AF_UNIX);
159+ TEST_COMPARE_STRING (sun.sun_path, pathname);
160+ }
161+
162+ {
163+ char pathname[109];
164+ memset (pathname, 'x', sizeof (pathname));
165+ pathname[sizeof (pathname) - 1] = '\0';
166+ memset (&sun, 0xcc, sizeof (sun));
167+ errno = 0;
168+ TEST_COMPARE (__sockaddr_un_set (&sun, pathname), -1);
169+ TEST_COMPARE (errno, EINVAL);
170+ }
171+
172+ return 0;
173+}
174+
175+#include <support/test-driver.c>
176--
1772.27.0
178
diff --git a/meta/recipes-core/glibc/glibc/0001-CVE-2022-23219.patch b/meta/recipes-core/glibc/glibc/0001-CVE-2022-23219.patch
deleted file mode 100644
index 261c2909db..0000000000
--- a/meta/recipes-core/glibc/glibc/0001-CVE-2022-23219.patch
+++ /dev/null
@@ -1,55 +0,0 @@
1From 226b46770c82899b555986583294b049c6ec9b40 Mon Sep 17 00:00:00 2001
2From: Florian Weimer <fweimer@redhat.com>
3Date: Mon, 17 Jan 2022 10:21:34 +0100
4Subject: [PATCH] CVE-2022-23219: Buffer overflow in sunrpc clnt_create for
5 "unix" (bug 22542)
6
7Processing an overlong pathname in the sunrpc clnt_create function
8results in a stack-based buffer overflow.
9
10Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=226b46770c82899b555986583294b049c6ec9b40]
11CVE: CVE-2022-23219
12
13Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
14Signed-off-by: Pgowda <pgowda.cve@gmail.com>
15---
16 NEWS | 4 +++-
17 sunrpc/clnt_gen.c | 10 +++++++---
18 2 files changed, 10 insertions(+), 4 deletions(-)
19
20diff --git a/NEWS b/NEWS
21index ddd95a8329..38a9ddb2cf 100644
22--- a/NEWS
23+++ b/NEWS
24@@ -206,6 +206,10 @@ Security related changes:
25 CVE-2022-23218: Passing an overlong file name to the svcunix_create
26 legacy function could result in a stack-based buffer overflow.
27
28+ CVE-2022-23219: Passing an overlong file name to the clnt_create
29+ legacy function could result in a stack-based buffer overflow when
30+ using the "unix" protocol. Reported by Martin Sebor.
31+
32 The following bugs are resolved with this release:
33
34 [4737] libc: fork is not async-signal-safe
35diff --git a/sunrpc/clnt_gen.c b/sunrpc/clnt_gen.c
36index 13ced8994e..b44357cd88 100644
37--- a/sunrpc/clnt_gen.c
38+++ b/sunrpc/clnt_gen.c
39@@ -57,9 +57,13 @@ clnt_create (const char *hostname, u_lon
40
41 if (strcmp (proto, "unix") == 0)
42 {
43- memset ((char *)&sun, 0, sizeof (sun));
44- sun.sun_family = AF_UNIX;
45- strcpy (sun.sun_path, hostname);
46+ if (__sockaddr_un_set (&sun, hostname) < 0)
47+ {
48+ struct rpc_createerr *ce = &get_rpc_createerr ();
49+ ce->cf_stat = RPC_SYSTEMERROR;
50+ ce->cf_error.re_errno = errno;
51+ return NULL;
52+ }
53 sock = RPC_ANYSOCK;
54 client = clntunix_create (&sun, prog, vers, &sock, 0, 0);
55 if (client == NULL)
diff --git a/meta/recipes-core/glibc/glibc/0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch b/meta/recipes-core/glibc/glibc/0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch
deleted file mode 100644
index 3283dd7ad8..0000000000
--- a/meta/recipes-core/glibc/glibc/0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch
+++ /dev/null
@@ -1,79 +0,0 @@
1From a8bc44936202692edcd82a48c07d7cf27d6ed8ee Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Sun, 29 Aug 2021 20:49:16 +0800
4Subject: [PATCH] fix create thread failed in unprivileged process [BZ #28287]
5
6Since commit [d8ea0d0168 Add an internal wrapper for clone, clone2 and clone3]
7applied, start a unprivileged container (docker run without --privileged),
8it creates a thread failed in container.
9
10In commit d8ea0d0168, it calls __clone3 if HAVE_CLONE3_WAPPER is defined. If
11__clone3 returns -1 with ENOSYS, fall back to clone or clone2.
12
13As known from [1], cloneXXX fails with EPERM if CLONE_NEWCGROUP,
14CLONE_NEWIPC, CLONE_NEWNET, CLONE_NEWNS, CLONE_NEWPID, or CLONE_NEWUTS
15was specified by an unprivileged process (process without CAP_SYS_ADMIN)
16
17[1] https://man7.org/linux/man-pages/man2/clone3.2.html
18
19So if __clone3 returns -1 with EPERM, fall back to clone or clone2 could
20fix the issue. Here are the test steps:
21
221) Prepare test code
23cat > conftest.c <<ENDOF
24 #include <pthread.h>
25 #include <stdio.h>
26
27int check_me = 0;
28void* func(void* data) {check_me = 42; printf("start thread: check_me %d\n", check_me); return &check_me;}
29int main()
30{
31 pthread_t t;
32 void *ret;
33 pthread_create (&t, 0, func, 0);
34 pthread_join (t, &ret);
35 printf("check_me %d, p %p\n", check_me, &ret);
36 return (check_me != 42 || ret != &check_me);
37}
38
39ENDOF
40
412) Compile
42gcc -o conftest -pthread conftest.c
43
443) Start a container with glibc 2.34 installed
45[skip details]
46docker run -it <container-image-name> bash
47
484) Run conftest without this patch
49$ ./conftest
50check_me 0, p 0x7ffd91ccd400
51
525) Run conftest with this patch
53$ ./conftest
54start thread: check_me 42
55check_me 42, p 0x7ffe253c6f20
56
57Upstream-Status: Submitted [libc-alpha@sourceware.org]
58
59Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
60---
61 sysdeps/unix/sysv/linux/clone-internal.c | 2 +-
62 1 file changed, 1 insertion(+), 1 deletion(-)
63
64diff --git a/sysdeps/unix/sysv/linux/clone-internal.c b/sysdeps/unix/sysv/linux/clone-internal.c
65index 979f7880be..97101994e8 100644
66--- a/sysdeps/unix/sysv/linux/clone-internal.c
67+++ b/sysdeps/unix/sysv/linux/clone-internal.c
68@@ -52,7 +52,7 @@ __clone_internal (struct clone_args *cl_args,
69 /* Try clone3 first. */
70 int saved_errno = errno;
71 ret = __clone3 (cl_args, sizeof (*cl_args), func, arg);
72- if (ret != -1 || errno != ENOSYS)
73+ if (ret != -1 || (errno != ENOSYS && errno != EPERM))
74 return ret;
75
76 /* NB: Restore errno since errno may be checked against non-zero
77--
782.30.2
79
diff --git a/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch b/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch
index 3ff485b1e3..546fe58214 100644
--- a/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch
+++ b/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch
@@ -1,4 +1,4 @@
1From d34ba0833cd811f8869a6262044af55f9e7b59d8 Mon Sep 17 00:00:00 2001 1From 8778429a3345bb5c0361332cf5103f394717a396 Mon Sep 17 00:00:00 2001
2From: Jason Wessel <jason.wessel@windriver.com> 2From: Jason Wessel <jason.wessel@windriver.com>
3Date: Sat, 7 Dec 2019 09:59:22 -0800 3Date: Sat, 7 Dec 2019 09:59:22 -0800
4Subject: [PATCH] localedef: Add hardlink resolver from util-linux 4Subject: [PATCH] localedef: Add hardlink resolver from util-linux
diff --git a/meta/recipes-core/glibc/glibc/0002-CVE-2021-38604.patch b/meta/recipes-core/glibc/glibc/0002-CVE-2021-38604.patch
deleted file mode 100644
index 9f71fecddb..0000000000
--- a/meta/recipes-core/glibc/glibc/0002-CVE-2021-38604.patch
+++ /dev/null
@@ -1,150 +0,0 @@
1From 4cc79c217744743077bf7a0ec5e0a4318f1e6641 Mon Sep 17 00:00:00 2001
2From: Nikita Popov <npv1310@gmail.com>
3Date: Thu, 12 Aug 2021 16:09:50 +0530
4Subject: [PATCH] librt: add test (bug 28213)
5
6This test implements following logic:
71) Create POSIX message queue.
8 Register a notification with mq_notify (using NULL attributes).
9 Then immediately unregister the notification with mq_notify.
10 Helper thread in a vulnerable version of glibc
11 should cause NULL pointer dereference after these steps.
122) Once again, register the same notification.
13 Try to send a dummy message.
14 Test is considered successfulif the dummy message
15 is successfully received by the callback function.
16
17Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=4cc79c217744743077bf7a0ec5e0a4318f1e6641]
18CVE: CVE-2021-38604
19
20Signed-off-by: Nikita Popov <npv1310@gmail.com>
21Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
22Signed-off-by: Vinay Kumar <vinay.m.engg@gmail.com>
23---
24 rt/Makefile | 1 +
25 rt/tst-bz28213.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++
26 2 files changed, 102 insertions(+)
27 create mode 100644 rt/tst-bz28213.c
28
29diff --git a/rt/Makefile b/rt/Makefile
30index 113cea03a5..910e775995 100644
31--- a/rt/Makefile
32+++ b/rt/Makefile
33@@ -74,6 +74,7 @@ tests := tst-shm tst-timer tst-timer2 \
34 tst-aio7 tst-aio8 tst-aio9 tst-aio10 \
35 tst-mqueue1 tst-mqueue2 tst-mqueue3 tst-mqueue4 \
36 tst-mqueue5 tst-mqueue6 tst-mqueue7 tst-mqueue8 tst-mqueue9 \
37+ tst-bz28213 \
38 tst-timer3 tst-timer4 tst-timer5 \
39 tst-cpuclock2 tst-cputimer1 tst-cputimer2 tst-cputimer3 \
40 tst-shm-cancel \
41diff --git a/rt/tst-bz28213.c b/rt/tst-bz28213.c
42new file mode 100644
43index 0000000000..0c096b5a0a
44--- /dev/null
45+++ b/rt/tst-bz28213.c
46@@ -0,0 +1,101 @@
47+/* Bug 28213: test for NULL pointer dereference in mq_notify.
48+ Copyright (C) The GNU Toolchain Authors.
49+ This file is part of the GNU C Library.
50+
51+ The GNU C Library is free software; you can redistribute it and/or
52+ modify it under the terms of the GNU Lesser General Public
53+ License as published by the Free Software Foundation; either
54+ version 2.1 of the License, or (at your option) any later version.
55+
56+ The GNU C Library is distributed in the hope that it will be useful,
57+ but WITHOUT ANY WARRANTY; without even the implied warranty of
58+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
59+ Lesser General Public License for more details.
60+
61+ You should have received a copy of the GNU Lesser General Public
62+ License along with the GNU C Library; if not, see
63+ <https://www.gnu.org/licenses/>. */
64+
65+#include <errno.h>
66+#include <sys/types.h>
67+#include <sys/stat.h>
68+#include <fcntl.h>
69+#include <unistd.h>
70+#include <mqueue.h>
71+#include <signal.h>
72+#include <stdlib.h>
73+#include <string.h>
74+#include <support/check.h>
75+
76+static mqd_t m = -1;
77+static const char msg[] = "hello";
78+
79+static void
80+check_bz28213_cb (union sigval sv)
81+{
82+ char buf[sizeof (msg)];
83+
84+ (void) sv;
85+
86+ TEST_VERIFY_EXIT ((size_t) mq_receive (m, buf, sizeof (buf), NULL)
87+ == sizeof (buf));
88+ TEST_VERIFY_EXIT (memcmp (buf, msg, sizeof (buf)) == 0);
89+
90+ exit (0);
91+}
92+
93+static void
94+check_bz28213 (void)
95+{
96+ struct sigevent sev;
97+
98+ memset (&sev, '\0', sizeof (sev));
99+ sev.sigev_notify = SIGEV_THREAD;
100+ sev.sigev_notify_function = check_bz28213_cb;
101+
102+ /* Step 1: Register & unregister notifier.
103+ Helper thread should receive NOTIFY_REMOVED notification.
104+ In a vulnerable version of glibc, NULL pointer dereference follows. */
105+ TEST_VERIFY_EXIT (mq_notify (m, &sev) == 0);
106+ TEST_VERIFY_EXIT (mq_notify (m, NULL) == 0);
107+
108+ /* Step 2: Once again, register notification.
109+ Try to send one message.
110+ Test is considered successful, if the callback does exit (0). */
111+ TEST_VERIFY_EXIT (mq_notify (m, &sev) == 0);
112+ TEST_VERIFY_EXIT (mq_send (m, msg, sizeof (msg), 1) == 0);
113+
114+ /* Wait... */
115+ pause ();
116+}
117+
118+static int
119+do_test (void)
120+{
121+ static const char m_name[] = "/bz28213_queue";
122+ struct mq_attr m_attr;
123+
124+ memset (&m_attr, '\0', sizeof (m_attr));
125+ m_attr.mq_maxmsg = 1;
126+ m_attr.mq_msgsize = sizeof (msg);
127+
128+ m = mq_open (m_name,
129+ O_RDWR | O_CREAT | O_EXCL,
130+ 0600,
131+ &m_attr);
132+
133+ if (m < 0)
134+ {
135+ if (errno == ENOSYS)
136+ FAIL_UNSUPPORTED ("POSIX message queues are not implemented\n");
137+ FAIL_EXIT1 ("Failed to create POSIX message queue: %m\n");
138+ }
139+
140+ TEST_VERIFY_EXIT (mq_unlink (m_name) == 0);
141+
142+ check_bz28213 ();
143+
144+ return 0;
145+}
146+
147+#include <support/test-driver.c>
148--
1492.31.1
150
diff --git a/meta/recipes-core/glibc/glibc/0002-CVE-2021-3998.patch b/meta/recipes-core/glibc/glibc/0002-CVE-2021-3998.patch
deleted file mode 100644
index 0a4c34452d..0000000000
--- a/meta/recipes-core/glibc/glibc/0002-CVE-2021-3998.patch
+++ /dev/null
@@ -1,138 +0,0 @@
1From f7a79879c0b2bef0dadd6caaaeeb0d26423e04e5 Mon Sep 17 00:00:00 2001
2From: Siddhesh Poyarekar <siddhesh@sourceware.org>
3Date: Thu, 13 Jan 2022 11:28:36 +0530
4Subject: [PATCH] realpath: Set errno to ENAMETOOLONG for result larger than
5 PATH_MAX [BZ #28770]
6
7realpath returns an allocated string when the result exceeds PATH_MAX,
8which is unexpected when its second argument is not NULL. This results
9in the second argument (resolved) being uninitialized and also results
10in a memory leak since the caller expects resolved to be the same as the
11returned value.
12
13Return NULL and set errno to ENAMETOOLONG if the result exceeds
14PATH_MAX. This fixes [BZ #28770], which is CVE-2021-3998.
15
16Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
17Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
18(cherry picked from commit ee8d5e33adb284601c00c94687bc907e10aec9bb)
19
20Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=f7a79879c0b2bef0dadd6caaaeeb0d26423e04e5]
21CVE: CVE-2021-3998
22
23Signed-off-by: Pgowda <pgowda.cve@gmail.com>
24---
25 NEWS | 4 +++
26 stdlib/Makefile | 1 +
27 stdlib/canonicalize.c | 12 +++++++--
28 stdlib/tst-realpath-toolong.c | 49 +++++++++++++++++++++++++++++++++++
29 4 files changed, 64 insertions(+), 2 deletions(-)
30 create mode 100644 stdlib/tst-realpath-toolong.c
31
32diff --git a/NEWS b/NEWS
33index 7e773bd005..b4f81c2668 100644
34--- a/NEWS
35+++ b/NEWS
36@@ -210,6 +210,10 @@ Security related changes:
37 legacy function could result in a stack-based buffer overflow when
38 using the "unix" protocol. Reported by Martin Sebor.
39
40+ CVE-2021-3998: Passing a path longer than PATH_MAX to the realpath
41+ function could result in a memory leak and potential access of
42+ uninitialized memory. Reported by Qualys.
43+
44 The following bugs are resolved with this release:
45
46 [4737] libc: fork is not async-signal-safe
47diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c
48index 698f9ede25..7a23a51b3a 100644
49--- a/stdlib/canonicalize.c
50+++ b/stdlib/canonicalize.c
51@@ -400,8 +400,16 @@ realpath_stk (const char *name, char *re
52
53 error:
54 *dest++ = '\0';
55- if (resolved != NULL && dest - rname <= get_path_max ())
56- rname = strcpy (resolved, rname);
57+ if (resolved != NULL)
58+ {
59+ if (dest - rname <= get_path_max ())
60+ rname = strcpy (resolved, rname);
61+ else
62+ {
63+ failed = true;
64+ __set_errno (ENAMETOOLONG);
65+ }
66+ }
67
68 error_nomem:
69 scratch_buffer_free (&extra_buffer);
70diff --git a/stdlib/Makefile b/stdlib/Makefile
71index 9bb5c221e8..a4ac30d1f6 100644
72--- a/stdlib/Makefile
73+++ b/stdlib/Makefile
74@@ -88,7 +88,8 @@ tests := tst-strtol tst-strtod testmb t
75 tst-swapcontext1 tst-setcontext4 tst-setcontext5 \
76 tst-setcontext6 tst-setcontext7 tst-setcontext8 \
77 tst-setcontext9 tst-bz20544 tst-canon-bz26341 \
78- tst-realpath
79+ tst-realpath \
80+ tst-realpath-toolong
81
82 tests-internal := tst-strtod1i tst-strtod3 tst-strtod4 tst-strtod5i \
83 tst-tls-atexit tst-tls-atexit-nodelete
84diff --git a/stdlib/tst-realpath-toolong.c b/stdlib/tst-realpath-toolong.c
85new file mode 100644
86index 0000000000..8bed772460
87--- /dev/null
88+++ b/stdlib/tst-realpath-toolong.c
89@@ -0,0 +1,49 @@
90+/* Verify that realpath returns NULL with ENAMETOOLONG if the result exceeds
91+ NAME_MAX.
92+ Copyright The GNU Toolchain Authors.
93+ This file is part of the GNU C Library.
94+
95+ The GNU C Library is free software; you can redistribute it and/or
96+ modify it under the terms of the GNU Lesser General Public
97+ License as published by the Free Software Foundation; either
98+ version 2.1 of the License, or (at your option) any later version.
99+
100+ The GNU C Library is distributed in the hope that it will be useful,
101+ but WITHOUT ANY WARRANTY; without even the implied warranty of
102+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
103+ Lesser General Public License for more details.
104+
105+ You should have received a copy of the GNU Lesser General Public
106+ License along with the GNU C Library; if not, see
107+ <https://www.gnu.org/licenses/>. */
108+
109+#include <errno.h>
110+#include <limits.h>
111+#include <stdlib.h>
112+#include <string.h>
113+#include <unistd.h>
114+#include <support/check.h>
115+#include <support/temp_file.h>
116+#include <sys/types.h>
117+#include <sys/stat.h>
118+
119+#define BASENAME "tst-realpath-toolong."
120+
121+int
122+do_test (void)
123+{
124+ char *base = support_create_and_chdir_toolong_temp_directory (BASENAME);
125+
126+ char buf[PATH_MAX + 1];
127+ const char *res = realpath (".", buf);
128+
129+ /* canonicalize.c states that if the real path is >= PATH_MAX, then
130+ realpath returns NULL and sets ENAMETOOLONG. */
131+ TEST_VERIFY (res == NULL);
132+ TEST_VERIFY (errno == ENAMETOOLONG);
133+
134+ free (base);
135+ return 0;
136+}
137+
138+#include <support/test-driver.c>
diff --git a/meta/recipes-core/glibc/glibc/0002-CVE-2021-3999.patch b/meta/recipes-core/glibc/glibc/0002-CVE-2021-3999.patch
deleted file mode 100644
index ef3a504fdf..0000000000
--- a/meta/recipes-core/glibc/glibc/0002-CVE-2021-3999.patch
+++ /dev/null
@@ -1,357 +0,0 @@
1From 472e799a5f2102bc0c3206dbd5a801765fceb39c Mon Sep 17 00:00:00 2001
2From: Siddhesh Poyarekar <siddhesh@sourceware.org>
3Date: Fri, 21 Jan 2022 23:32:56 +0530
4Subject: [PATCH] getcwd: Set errno to ERANGE for size == 1 (CVE-2021-3999)
5
6No valid path returned by getcwd would fit into 1 byte, so reject the
7size early and return NULL with errno set to ERANGE. This change is
8prompted by CVE-2021-3999, which describes a single byte buffer
9underflow and overflow when all of the following conditions are met:
10
11- The buffer size (i.e. the second argument of getcwd) is 1 byte
12- The current working directory is too long
13- '/' is also mounted on the current working directory
14
15Sequence of events:
16
17- In sysdeps/unix/sysv/linux/getcwd.c, the syscall returns ENAMETOOLONG
18 because the linux kernel checks for name length before it checks
19 buffer size
20
21- The code falls back to the generic getcwd in sysdeps/posix
22
23- In the generic func, the buf[0] is set to '\0' on line 250
24
25- this while loop on line 262 is bypassed:
26
27 while (!(thisdev == rootdev && thisino == rootino))
28
29 since the rootfs (/) is bind mounted onto the directory and the flow
30 goes on to line 449, where it puts a '/' in the byte before the
31 buffer.
32
33- Finally on line 458, it moves 2 bytes (the underflowed byte and the
34 '\0') to the buf[0] and buf[1], resulting in a 1 byte buffer overflow.
35
36- buf is returned on line 469 and errno is not set.
37
38This resolves BZ #28769.
39
40Reviewed-by: Andreas Schwab <schwab@linux-m68k.org>
41Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
42Signed-off-by: Qualys Security Advisory <qsa@qualys.com>
43Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
44(cherry picked from commit 23e0e8f5f1fb5ed150253d986ecccdc90c2dcd5e)
45
46Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=472e799a5f2102bc0c3206dbd5a801765fceb39c]
47CVE: CVE-2021-3999
48
49Signed-off-by: Pgowda <pgowda.cve@gmail.com>
50---
51 NEWS | 6 +
52 sysdeps/posix/getcwd.c | 7 +
53 sysdeps/unix/sysv/linux/Makefile | 7 +-
54 .../unix/sysv/linux/tst-getcwd-smallbuff.c | 241 ++++++++++++++++++
55 4 files changed, 260 insertions(+), 1 deletion(-)
56 create mode 100644 sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c
57
58diff --git a/NEWS b/NEWS
59index b4f81c2668..8d7467d2c1 100644
60--- a/NEWS
61+++ b/NEWS
62@@ -214,6 +214,12 @@ Security related changes:
63 function could result in a memory leak and potential access of
64 uninitialized memory. Reported by Qualys.
65
66+ CVE-2021-3999: Passing a buffer of size exactly 1 byte to the getcwd
67+ function may result in an off-by-one buffer underflow and overflow
68+ when the current working directory is longer than PATH_MAX and also
69+ corresponds to the / directory through an unprivileged mount
70+ namespace. Reported by Qualys.
71+
72 The following bugs are resolved with this release:
73
74 [4737] libc: fork is not async-signal-safe
75diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c
76index 13680026ff..b6984a382c 100644
77--- a/sysdeps/posix/getcwd.c
78+++ b/sysdeps/posix/getcwd.c
79@@ -187,6 +187,13 @@ __getcwd_generic (char *buf, size_t size
80 size_t allocated = size;
81 size_t used;
82
83+ /* A size of 1 byte is never useful. */
84+ if (allocated == 1)
85+ {
86+ __set_errno (ERANGE);
87+ return NULL;
88+ }
89+
90 #if HAVE_MINIMALLY_WORKING_GETCWD
91 /* If AT_FDCWD is not defined, the algorithm below is O(N**2) and
92 this is much slower than the system getcwd (at least on
93diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
94index 76ad06361c..9380d3848d 100644
95--- a/sysdeps/unix/sysv/linux/Makefile
96+++ b/sysdeps/unix/sysv/linux/Makefile
97@@ -331,7 +331,12 @@ sysdep_routines += xstatconv internal_st
98
99 sysdep_headers += bits/fcntl-linux.h
100
101-tests += tst-fallocate tst-fallocate64 tst-o_path-locks
102+tests += \
103+ tst-fallocate \
104+ tst-fallocate64 \
105+ tst-getcwd-smallbuff \
106+ tst-o_path-locks \
107+# tests
108 endif
109
110 ifeq ($(subdir),elf)
111diff --git a/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c b/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c
112new file mode 100644
113index 0000000000..d460d6e766
114--- /dev/null
115+++ b/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c
116@@ -0,0 +1,241 @@
117+/* Verify that getcwd returns ERANGE for size 1 byte and does not underflow
118+ buffer when the CWD is too long and is also a mount target of /. See bug
119+ #28769 or CVE-2021-3999 for more context.
120+ Copyright The GNU Toolchain Authors.
121+ This file is part of the GNU C Library.
122+
123+ The GNU C Library is free software; you can redistribute it and/or
124+ modify it under the terms of the GNU Lesser General Public
125+ License as published by the Free Software Foundation; either
126+ version 2.1 of the License, or (at your option) any later version.
127+
128+ The GNU C Library is distributed in the hope that it will be useful,
129+ but WITHOUT ANY WARRANTY; without even the implied warranty of
130+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
131+ Lesser General Public License for more details.
132+
133+ You should have received a copy of the GNU Lesser General Public
134+ License along with the GNU C Library; if not, see
135+ <https://www.gnu.org/licenses/>. */
136+
137+#include <errno.h>
138+#include <fcntl.h>
139+#include <intprops.h>
140+#include <limits.h>
141+#include <stdio.h>
142+#include <stdlib.h>
143+#include <string.h>
144+#include <sys/mount.h>
145+#include <sys/stat.h>
146+#include <sys/types.h>
147+#include <sys/wait.h>
148+
149+#include <sys/socket.h>
150+#include <sys/un.h>
151+#include <support/check.h>
152+#include <support/temp_file.h>
153+#include <support/xsched.h>
154+#include <support/xunistd.h>
155+
156+static char *base;
157+#define BASENAME "tst-getcwd-smallbuff"
158+#define MOUNT_NAME "mpoint"
159+static int sockfd[2];
160+
161+static void
162+do_cleanup (void)
163+{
164+ support_chdir_toolong_temp_directory (base);
165+ TEST_VERIFY_EXIT (rmdir (MOUNT_NAME) == 0);
166+ free (base);
167+}
168+
169+static void
170+send_fd (const int sock, const int fd)
171+{
172+ struct msghdr msg = {0};
173+ union
174+ {
175+ struct cmsghdr hdr;
176+ char buf[CMSG_SPACE (sizeof (int))];
177+ } cmsgbuf = {0};
178+ struct cmsghdr *cmsg;
179+ struct iovec vec;
180+ char ch = 'A';
181+ ssize_t n;
182+
183+ msg.msg_control = &cmsgbuf.buf;
184+ msg.msg_controllen = sizeof (cmsgbuf.buf);
185+
186+ cmsg = CMSG_FIRSTHDR (&msg);
187+ cmsg->cmsg_len = CMSG_LEN (sizeof (int));
188+ cmsg->cmsg_level = SOL_SOCKET;
189+ cmsg->cmsg_type = SCM_RIGHTS;
190+ memcpy (CMSG_DATA (cmsg), &fd, sizeof (fd));
191+
192+ vec.iov_base = &ch;
193+ vec.iov_len = 1;
194+ msg.msg_iov = &vec;
195+ msg.msg_iovlen = 1;
196+
197+ while ((n = sendmsg (sock, &msg, 0)) == -1 && errno == EINTR);
198+
199+ TEST_VERIFY_EXIT (n == 1);
200+}
201+
202+static int
203+recv_fd (const int sock)
204+{
205+ struct msghdr msg = {0};
206+ union
207+ {
208+ struct cmsghdr hdr;
209+ char buf[CMSG_SPACE(sizeof(int))];
210+ } cmsgbuf = {0};
211+ struct cmsghdr *cmsg;
212+ struct iovec vec;
213+ ssize_t n;
214+ char ch = '\0';
215+ int fd = -1;
216+
217+ vec.iov_base = &ch;
218+ vec.iov_len = 1;
219+ msg.msg_iov = &vec;
220+ msg.msg_iovlen = 1;
221+
222+ msg.msg_control = &cmsgbuf.buf;
223+ msg.msg_controllen = sizeof (cmsgbuf.buf);
224+
225+ while ((n = recvmsg (sock, &msg, 0)) == -1 && errno == EINTR);
226+ if (n != 1 || ch != 'A')
227+ return -1;
228+
229+ cmsg = CMSG_FIRSTHDR (&msg);
230+ if (cmsg == NULL)
231+ return -1;
232+ if (cmsg->cmsg_type != SCM_RIGHTS)
233+ return -1;
234+ memcpy (&fd, CMSG_DATA (cmsg), sizeof (fd));
235+ if (fd < 0)
236+ return -1;
237+ return fd;
238+}
239+
240+static int
241+child_func (void * const arg)
242+{
243+ xclose (sockfd[0]);
244+ const int sock = sockfd[1];
245+ char ch;
246+
247+ TEST_VERIFY_EXIT (read (sock, &ch, 1) == 1);
248+ TEST_VERIFY_EXIT (ch == '1');
249+
250+ if (mount ("/", MOUNT_NAME, NULL, MS_BIND | MS_REC, NULL))
251+ FAIL_EXIT1 ("mount failed: %m\n");
252+ const int fd = xopen ("mpoint",
253+ O_RDONLY | O_PATH | O_DIRECTORY | O_NOFOLLOW, 0);
254+
255+ send_fd (sock, fd);
256+ xclose (fd);
257+
258+ TEST_VERIFY_EXIT (read (sock, &ch, 1) == 1);
259+ TEST_VERIFY_EXIT (ch == 'a');
260+
261+ xclose (sock);
262+ return 0;
263+}
264+
265+static void
266+update_map (char * const mapping, const char * const map_file)
267+{
268+ const size_t map_len = strlen (mapping);
269+
270+ const int fd = xopen (map_file, O_WRONLY, 0);
271+ xwrite (fd, mapping, map_len);
272+ xclose (fd);
273+}
274+
275+static void
276+proc_setgroups_write (const long child_pid, const char * const str)
277+{
278+ const size_t str_len = strlen(str);
279+
280+ char setgroups_path[sizeof ("/proc//setgroups") + INT_STRLEN_BOUND (long)];
281+
282+ snprintf (setgroups_path, sizeof (setgroups_path),
283+ "/proc/%ld/setgroups", child_pid);
284+
285+ const int fd = open (setgroups_path, O_WRONLY);
286+
287+ if (fd < 0)
288+ {
289+ TEST_VERIFY_EXIT (errno == ENOENT);
290+ FAIL_UNSUPPORTED ("/proc/%ld/setgroups not found\n", child_pid);
291+ }
292+
293+ xwrite (fd, str, str_len);
294+ xclose(fd);
295+}
296+
297+static char child_stack[1024 * 1024];
298+
299+int
300+do_test (void)
301+{
302+ base = support_create_and_chdir_toolong_temp_directory (BASENAME);
303+
304+ xmkdir (MOUNT_NAME, S_IRWXU);
305+ atexit (do_cleanup);
306+
307+ TEST_VERIFY_EXIT (socketpair (AF_UNIX, SOCK_STREAM, 0, sockfd) == 0);
308+ pid_t child_pid = xclone (child_func, NULL, child_stack,
309+ sizeof (child_stack),
310+ CLONE_NEWUSER | CLONE_NEWNS | SIGCHLD);
311+
312+ xclose (sockfd[1]);
313+ const int sock = sockfd[0];
314+
315+ char map_path[sizeof ("/proc//uid_map") + INT_STRLEN_BOUND (long)];
316+ char map_buf[sizeof ("0 1") + INT_STRLEN_BOUND (long)];
317+
318+ snprintf (map_path, sizeof (map_path), "/proc/%ld/uid_map",
319+ (long) child_pid);
320+ snprintf (map_buf, sizeof (map_buf), "0 %ld 1", (long) getuid());
321+ update_map (map_buf, map_path);
322+
323+ proc_setgroups_write ((long) child_pid, "deny");
324+ snprintf (map_path, sizeof (map_path), "/proc/%ld/gid_map",
325+ (long) child_pid);
326+ snprintf (map_buf, sizeof (map_buf), "0 %ld 1", (long) getgid());
327+ update_map (map_buf, map_path);
328+
329+ TEST_VERIFY_EXIT (send (sock, "1", 1, MSG_NOSIGNAL) == 1);
330+ const int fd = recv_fd (sock);
331+ TEST_VERIFY_EXIT (fd >= 0);
332+ TEST_VERIFY_EXIT (fchdir (fd) == 0);
333+
334+ static char buf[2 * 10 + 1];
335+ memset (buf, 'A', sizeof (buf));
336+
337+ /* Finally, call getcwd and check if it resulted in a buffer underflow. */
338+ char * cwd = getcwd (buf + sizeof (buf) / 2, 1);
339+ TEST_VERIFY (cwd == NULL);
340+ TEST_VERIFY (errno == ERANGE);
341+
342+ for (int i = 0; i < sizeof (buf); i++)
343+ if (buf[i] != 'A')
344+ {
345+ printf ("buf[%d] = %02x\n", i, (unsigned int) buf[i]);
346+ support_record_failure ();
347+ }
348+
349+ TEST_VERIFY_EXIT (send (sock, "a", 1, MSG_NOSIGNAL) == 1);
350+ xclose (sock);
351+ TEST_VERIFY_EXIT (xwaitpid (child_pid, NULL, 0) == child_pid);
352+
353+ return 0;
354+}
355+
356+#define CLEANUP_HANDLER do_cleanup
357+#include <support/test-driver.c>
diff --git a/meta/recipes-core/glibc/glibc/0002-CVE-2022-23218.patch b/meta/recipes-core/glibc/glibc/0002-CVE-2022-23218.patch
deleted file mode 100644
index 00fb3266c6..0000000000
--- a/meta/recipes-core/glibc/glibc/0002-CVE-2022-23218.patch
+++ /dev/null
@@ -1,126 +0,0 @@
1From f545ad4928fa1f27a3075265182b38a4f939a5f7 Mon Sep 17 00:00:00 2001
2From: Florian Weimer <fweimer@redhat.com>
3Date: Mon, 17 Jan 2022 10:21:34 +0100
4Subject: [PATCH] CVE-2022-23218: Buffer overflow in sunrpc svcunix_create (bug
5 28768)
6
7The sunrpc function svcunix_create suffers from a stack-based buffer
8overflow with overlong pathname arguments.
9
10Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=f545ad4928fa1f27a3075265182b38a4f939a5f7]
11CVE: CVE-2022-23218
12
13Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
14Signed-off-by: Pgowda <pgowda.cve@gmail.com>
15---
16 NEWS | 3 +++
17 sunrpc/Makefile | 2 +-
18 sunrpc/svc_unix.c | 11 ++++-------
19 sunrpc/tst-bug28768.c | 42 ++++++++++++++++++++++++++++++++++++++++++
20 4 files changed, 50 insertions(+), 8 deletions(-)
21 create mode 100644 sunrpc/tst-bug28768.c
22
23diff --git a/NEWS b/NEWS
24index 38a9ddb2cf..38802f0673 100644
25--- a/NEWS
26+++ b/NEWS
27@@ -203,6 +203,9 @@ Security related changes:
28 parameter number when processing the expansion resulting in a crash.
29 Reported by Philippe Antoine.
30
31+ CVE-2022-23218: Passing an overlong file name to the svcunix_create
32+ legacy function could result in a stack-based buffer overflow.
33+
34 The following bugs are resolved with this release:
35
36 [4737] libc: fork is not async-signal-safe
37diff --git a/sunrpc/Makefile b/sunrpc/Makefile
38index 183ef3dc55..a79a7195fc 100644
39--- a/sunrpc/Makefile
40+++ b/sunrpc/Makefile
41@@ -65,7 +65,7 @@ shared-only-routines = $(routines)
42 endif
43
44 tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error tst-udp-timeout \
45- tst-udp-nonblocking
46+ tst-udp-nonblocking tst-bug28768
47 xtests := tst-getmyaddr
48
49 ifeq ($(have-thread-library),yes)
50diff --git a/sunrpc/svc_unix.c b/sunrpc/svc_unix.c
51index f2280b4c49..67177a2e78 100644
52--- a/sunrpc/svc_unix.c
53+++ b/sunrpc/svc_unix.c
54@@ -154,7 +154,10 @@ svcunix_create (int sock, u_int sendsize
55 SVCXPRT *xprt;
56 struct unix_rendezvous *r;
57 struct sockaddr_un addr;
58- socklen_t len = sizeof (struct sockaddr_in);
59+ socklen_t len = sizeof (addr);
60+
61+ if (__sockaddr_un_set (&addr, path) < 0)
62+ return NULL;
63
64 if (sock == RPC_ANYSOCK)
65 {
66@@ -165,12 +168,6 @@ svcunix_create (int sock, u_int sendsize
67 }
68 madesock = TRUE;
69 }
70- memset (&addr, '\0', sizeof (addr));
71- addr.sun_family = AF_UNIX;
72- len = strlen (path) + 1;
73- memcpy (addr.sun_path, path, len);
74- len += sizeof (addr.sun_family);
75-
76 __bind (sock, (struct sockaddr *) &addr, len);
77
78 if (__getsockname (sock, (struct sockaddr *) &addr, &len) != 0
79diff --git a/sunrpc/tst-bug28768.c b/sunrpc/tst-bug28768.c
80new file mode 100644
81index 0000000000..35a4b7b0b3
82--- /dev/null
83+++ b/sunrpc/tst-bug28768.c
84@@ -0,0 +1,42 @@
85+/* Test to verify that long path is rejected by svcunix_create (bug 28768).
86+ Copyright (C) 2022 Free Software Foundation, Inc.
87+ This file is part of the GNU C Library.
88+
89+ The GNU C Library is free software; you can redistribute it and/or
90+ modify it under the terms of the GNU Lesser General Public
91+ License as published by the Free Software Foundation; either
92+ version 2.1 of the License, or (at your option) any later version.
93+
94+ The GNU C Library is distributed in the hope that it will be useful,
95+ but WITHOUT ANY WARRANTY; without even the implied warranty of
96+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
97+ Lesser General Public License for more details.
98+
99+ You should have received a copy of the GNU Lesser General Public
100+ License along with the GNU C Library; if not, see
101+ <http://www.gnu.org/licenses/>. */
102+
103+#include <errno.h>
104+#include <rpc/svc.h>
105+#include <shlib-compat.h>
106+#include <string.h>
107+#include <support/check.h>
108+
109+/* svcunix_create does not have a default version in linkobj/libc.so. */
110+compat_symbol_reference (libc, svcunix_create, svcunix_create, GLIBC_2_1);
111+
112+static int
113+do_test (void)
114+{
115+ char pathname[109];
116+ memset (pathname, 'x', sizeof (pathname));
117+ pathname[sizeof (pathname) - 1] = '\0';
118+
119+ errno = 0;
120+ TEST_VERIFY (svcunix_create (RPC_ANYSOCK, 4096, 4096, pathname) == NULL);
121+ TEST_COMPARE (errno, EINVAL);
122+
123+ return 0;
124+}
125+
126+#include <support/test-driver.c>
diff --git a/meta/recipes-core/glibc/glibc/0002-CVE-2022-23219.patch b/meta/recipes-core/glibc/glibc/0002-CVE-2022-23219.patch
deleted file mode 100644
index 6779e9afdf..0000000000
--- a/meta/recipes-core/glibc/glibc/0002-CVE-2022-23219.patch
+++ /dev/null
@@ -1,89 +0,0 @@
1From ef972a4c50014a16132b5c75571cfb6b30bef136 Mon Sep 17 00:00:00 2001
2From: Martin Sebor <msebor@redhat.com>
3Date: Mon, 17 Jan 2022 10:21:34 +0100
4Subject: [PATCH] sunrpc: Test case for clnt_create "unix" buffer overflow (bug
5 22542)
6
7Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=ef972a4c50014a16132b5c75571cfb6b30bef136]
8CVE: CVE-2022-23219
9
10Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
11Signed-off-by: Pgowda <pgowda.cve@gmail.com>
12---
13 sunrpc/Makefile | 5 ++++-
14 sunrpc/tst-bug22542.c | 44 +++++++++++++++++++++++++++++++++++++++++++
15 2 files changed, 48 insertions(+), 1 deletion(-)
16 create mode 100644 sunrpc/tst-bug22542.c
17
18diff --git a/sunrpc/Makefile b/sunrpc/Makefile
19index 9a31fe48b9..183ef3dc55 100644
20--- a/sunrpc/Makefile
21+++ b/sunrpc/Makefile
22@@ -65,7 +65,7 @@ shared-only-routines = $(routines)
23 endif
24
25 tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error tst-udp-timeout \
26- tst-udp-nonblocking tst-bug28768
27+ tst-udp-nonblocking tst-bug22542 tst-bug28768
28 xtests := tst-getmyaddr
29
30 ifeq ($(have-thread-library),yes)
31@@ -110,6 +110,8 @@ $(objpfx)tst-udp-nonblocking: $(common-o
32 $(objpfx)tst-udp-garbage: \
33 $(common-objpfx)linkobj/libc.so $(shared-thread-library)
34
35+$(objpfx)tst-bug22542: $(common-objpfx)linkobj/libc.so
36+
37 else # !have-GLIBC_2.31
38
39 routines = $(routines-for-nss)
40diff --git a/sunrpc/tst-bug22542.c b/sunrpc/tst-bug22542.c
41new file mode 100644
42index 0000000000..d6cd79787b
43--- /dev/null
44+++ b/sunrpc/tst-bug22542.c
45@@ -0,0 +1,44 @@
46+/* Test to verify that overlong hostname is rejected by clnt_create
47+ and doesn't cause a buffer overflow (bug 22542).
48+
49+ Copyright (C) 2022 Free Software Foundation, Inc.
50+ This file is part of the GNU C Library.
51+
52+ The GNU C Library is free software; you can redistribute it and/or
53+ modify it under the terms of the GNU Lesser General Public
54+ License as published by the Free Software Foundation; either
55+ version 2.1 of the License, or (at your option) any later version.
56+
57+ The GNU C Library is distributed in the hope that it will be useful,
58+ but WITHOUT ANY WARRANTY; without even the implied warranty of
59+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
60+ Lesser General Public License for more details.
61+
62+ You should have received a copy of the GNU Lesser General Public
63+ License along with the GNU C Library; if not, see
64+ <http://www.gnu.org/licenses/>. */
65+
66+#include <errno.h>
67+#include <rpc/clnt.h>
68+#include <string.h>
69+#include <support/check.h>
70+#include <sys/socket.h>
71+#include <sys/un.h>
72+
73+static int
74+do_test (void)
75+{
76+ /* Create an arbitrary hostname that's longer than fits in sun_path. */
77+ char name [sizeof ((struct sockaddr_un*)0)->sun_path * 2];
78+ memset (name, 'x', sizeof name - 1);
79+ name [sizeof name - 1] = '\0';
80+
81+ errno = 0;
82+ CLIENT *clnt = clnt_create (name, 0, 0, "unix");
83+
84+ TEST_VERIFY (clnt == NULL);
85+ TEST_COMPARE (errno, EINVAL);
86+ return 0;
87+}
88+
89+#include <support/test-driver.c>
diff --git a/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch b/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch
index 2445aa56b3..94a05cf954 100644
--- a/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch
+++ b/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch
@@ -1,4 +1,4 @@
1From d7bb36a9a27e5e4c3be6378493b41286513750e9 Mon Sep 17 00:00:00 2001 1From 87a69126d97bb8d5d52e34e451b4a7076efd6bed Mon Sep 17 00:00:00 2001
2From: Jason Wessel <jason.wessel@windriver.com> 2From: Jason Wessel <jason.wessel@windriver.com>
3Date: Sat, 7 Dec 2019 10:01:37 -0800 3Date: Sat, 7 Dec 2019 10:01:37 -0800
4Subject: [PATCH] localedef: fix-ups hardlink to make it compile 4Subject: [PATCH] localedef: fix-ups hardlink to make it compile
diff --git a/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch b/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch
index 210cc1076c..9a605078b9 100644
--- a/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch
+++ b/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch
@@ -1,4 +1,4 @@
1From 776a53db6afba8a7ff4412aba88b0679227877f9 Mon Sep 17 00:00:00 2001 1From 752b0d32fc96728ee624dbd62bf23e034d8d2aed Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 01:48:24 +0000 3Date: Wed, 18 Mar 2015 01:48:24 +0000
4Subject: [PATCH] nativesdk-glibc: Look for host system ld.so.cache as well 4Subject: [PATCH] nativesdk-glibc: Look for host system ld.so.cache as well
@@ -30,10 +30,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
30 1 file changed, 8 insertions(+), 8 deletions(-) 30 1 file changed, 8 insertions(+), 8 deletions(-)
31 31
32diff --git a/elf/dl-load.c b/elf/dl-load.c 32diff --git a/elf/dl-load.c b/elf/dl-load.c
33index a08df001af..d09daf9e41 100644 33index 721593135e..39c4657fa2 100644
34--- a/elf/dl-load.c 34--- a/elf/dl-load.c
35+++ b/elf/dl-load.c 35+++ b/elf/dl-load.c
36@@ -2196,6 +2196,14 @@ _dl_map_object (struct link_map *loader, const char *name, 36@@ -2208,6 +2208,14 @@ _dl_map_object (struct link_map *loader, const char *name,
37 } 37 }
38 } 38 }
39 39
@@ -48,7 +48,7 @@ index a08df001af..d09daf9e41 100644
48 #ifdef USE_LDCONFIG 48 #ifdef USE_LDCONFIG
49 if (fd == -1 49 if (fd == -1
50 && (__glibc_likely ((mode & __RTLD_SECURE) == 0) 50 && (__glibc_likely ((mode & __RTLD_SECURE) == 0)
51@@ -2254,14 +2262,6 @@ _dl_map_object (struct link_map *loader, const char *name, 51@@ -2266,14 +2274,6 @@ _dl_map_object (struct link_map *loader, const char *name,
52 } 52 }
53 #endif 53 #endif
54 54
diff --git a/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch b/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch
index 010b816e11..da288d6ccf 100644
--- a/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch
+++ b/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch
@@ -1,4 +1,4 @@
1From df18bae1eeee55ecb9db36d13fe67c58355682eb Mon Sep 17 00:00:00 2001 1From 2f7407697f2a905fedb98037152e7830f73bc6c6 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 01:50:00 +0000 3Date: Wed, 18 Mar 2015 01:50:00 +0000
4Subject: [PATCH] nativesdk-glibc: Fix buffer overrun with a relocated SDK 4Subject: [PATCH] nativesdk-glibc: Fix buffer overrun with a relocated SDK
@@ -21,10 +21,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
21 1 file changed, 12 insertions(+) 21 1 file changed, 12 insertions(+)
22 22
23diff --git a/elf/dl-load.c b/elf/dl-load.c 23diff --git a/elf/dl-load.c b/elf/dl-load.c
24index d09daf9e41..2c6270e2a7 100644 24index 39c4657fa2..daa3af6c51 100644
25--- a/elf/dl-load.c 25--- a/elf/dl-load.c
26+++ b/elf/dl-load.c 26+++ b/elf/dl-load.c
27@@ -1892,7 +1892,19 @@ open_path (const char *name, size_t namelen, int mode, 27@@ -1904,7 +1904,19 @@ open_path (const char *name, size_t namelen, int mode,
28 given on the command line when rtld is run directly. */ 28 given on the command line when rtld is run directly. */
29 return -1; 29 return -1;
30 30
diff --git a/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch b/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch
index bf9f3e36ca..14bcaf3ef9 100644
--- a/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch
+++ b/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch
@@ -1,4 +1,4 @@
1From 6af8ce8eceed86addbc188f773a2d36d83ee4042 Mon Sep 17 00:00:00 2001 1From 88a31cd08801df53249963f3b26c7dbcee6ae2f8 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 01:51:38 +0000 3Date: Wed, 18 Mar 2015 01:51:38 +0000
4Subject: [PATCH] nativesdk-glibc: Raise the size of arrays containing dl paths 4Subject: [PATCH] nativesdk-glibc: Raise the size of arrays containing dl paths
@@ -41,10 +41,10 @@ index 2b8da8650d..3d9787bda4 100644
41 _dl_cache_libcmp (const char *p1, const char *p2) 41 _dl_cache_libcmp (const char *p1, const char *p2)
42 { 42 {
43diff --git a/elf/dl-load.c b/elf/dl-load.c 43diff --git a/elf/dl-load.c b/elf/dl-load.c
44index 2c6270e2a7..23018d2f7e 100644 44index daa3af6c51..e323952993 100644
45--- a/elf/dl-load.c 45--- a/elf/dl-load.c
46+++ b/elf/dl-load.c 46+++ b/elf/dl-load.c
47@@ -115,8 +115,8 @@ enum { ncapstr = 1, max_capstrlen = 0 }; 47@@ -117,8 +117,8 @@ enum { ncapstr = 1, max_capstrlen = 0 };
48 gen-trusted-dirs.awk. */ 48 gen-trusted-dirs.awk. */
49 #include "trusted-dirs.h" 49 #include "trusted-dirs.h"
50 50
@@ -98,10 +98,10 @@ index 91966702ca..dc86c20e83 100644
98+const char __invoke_dynamic_linker__[4096] __attribute__ ((section (".interp"))) 98+const char __invoke_dynamic_linker__[4096] __attribute__ ((section (".interp")))
99 = RUNTIME_LINKER; 99 = RUNTIME_LINKER;
100diff --git a/elf/ldconfig.c b/elf/ldconfig.c 100diff --git a/elf/ldconfig.c b/elf/ldconfig.c
101index 1037e8d0cf..ffdac84952 100644 101index 101d56ac8e..33debef60a 100644
102--- a/elf/ldconfig.c 102--- a/elf/ldconfig.c
103+++ b/elf/ldconfig.c 103+++ b/elf/ldconfig.c
104@@ -177,6 +177,9 @@ static struct argp argp = 104@@ -176,6 +176,9 @@ static struct argp argp =
105 options, parse_opt, NULL, doc, NULL, more_help, NULL 105 options, parse_opt, NULL, doc, NULL, more_help, NULL
106 }; 106 };
107 107
@@ -112,10 +112,10 @@ index 1037e8d0cf..ffdac84952 100644
112 a platform. */ 112 a platform. */
113 static int 113 static int
114diff --git a/elf/rtld.c b/elf/rtld.c 114diff --git a/elf/rtld.c b/elf/rtld.c
115index fbbd60b446..fce9940f80 100644 115index 4b09e84b0d..56d93ff616 100644
116--- a/elf/rtld.c 116--- a/elf/rtld.c
117+++ b/elf/rtld.c 117+++ b/elf/rtld.c
118@@ -185,6 +185,7 @@ dso_name_valid_for_suid (const char *p) 118@@ -193,6 +193,7 @@ dso_name_valid_for_suid (const char *p)
119 } 119 }
120 return *p != '\0'; 120 return *p != '\0';
121 } 121 }
@@ -124,10 +124,10 @@ index fbbd60b446..fce9940f80 100644
124 static void 124 static void
125 audit_list_init (struct audit_list *list) 125 audit_list_init (struct audit_list *list)
126diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c 126diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c
127index 62bee28769..67b60dc88c 100644 127index 077082af66..46b6152455 100644
128--- a/iconv/gconv_conf.c 128--- a/iconv/gconv_conf.c
129+++ b/iconv/gconv_conf.c 129+++ b/iconv/gconv_conf.c
130@@ -36,7 +36,7 @@ 130@@ -35,7 +35,7 @@
131 #include <gconv_parseconfdir.h> 131 #include <gconv_parseconfdir.h>
132 132
133 /* This is the default path where we look for module lists. */ 133 /* This is the default path where we look for module lists. */
diff --git a/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch b/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch
index 3a37f7af72..493b2daad3 100644
--- a/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch
+++ b/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch
@@ -1,4 +1,4 @@
1From b30f380cd88ae181a4a6a3a4784206ffe3ccd19b Mon Sep 17 00:00:00 2001 1From a1fbd7ef1da02f334ff72c52cb11116164649067 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 31 Dec 2015 14:35:35 -0800 3Date: Thu, 31 Dec 2015 14:35:35 -0800
4Subject: [PATCH] nativesdk-glibc: Allow 64 bit atomics for x86 4Subject: [PATCH] nativesdk-glibc: Allow 64 bit atomics for x86
@@ -13,14 +13,14 @@ Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
13Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> 13Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
14Signed-off-by: Khem Raj <raj.khem@gmail.com> 14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15--- 15---
16 sysdeps/x86/atomic-machine.h | 3 +-- 16 sysdeps/x86/atomic-machine.h | 7 +------
17 1 file changed, 1 insertion(+), 2 deletions(-) 17 1 file changed, 1 insertion(+), 6 deletions(-)
18 18
19diff --git a/sysdeps/x86/atomic-machine.h b/sysdeps/x86/atomic-machine.h 19diff --git a/sysdeps/x86/atomic-machine.h b/sysdeps/x86/atomic-machine.h
20index 695222e4fa..9d39bfdbd5 100644 20index 2692d94a92..9d39bfdbd5 100644
21--- a/sysdeps/x86/atomic-machine.h 21--- a/sysdeps/x86/atomic-machine.h
22+++ b/sysdeps/x86/atomic-machine.h 22+++ b/sysdeps/x86/atomic-machine.h
23@@ -52,15 +52,14 @@ typedef uintmax_t uatomic_max_t; 23@@ -52,19 +52,14 @@ typedef uintmax_t uatomic_max_t;
24 #define LOCK_PREFIX "lock;" 24 #define LOCK_PREFIX "lock;"
25 25
26 #define USE_ATOMIC_COMPILER_BUILTINS 1 26 #define USE_ATOMIC_COMPILER_BUILTINS 1
@@ -33,6 +33,10 @@ index 695222e4fa..9d39bfdbd5 100644
33 # define BR_CONSTRAINT "q" 33 # define BR_CONSTRAINT "q"
34 # define IBR_CONSTRAINT "iq" 34 # define IBR_CONSTRAINT "iq"
35 #else 35 #else
36-/* Since the Pentium, i386 CPUs have supported 64-bit atomics, but the
37- i386 psABI supplement provides only 4-byte alignment for uint64_t
38- inside structs, so it is currently not possible to use 64-bit
39- atomics on this platform. */
36-# define __HAVE_64B_ATOMICS 0 40-# define __HAVE_64B_ATOMICS 0
37 # define SP_REG "esp" 41 # define SP_REG "esp"
38 # define SEG_REG "gs" 42 # define SEG_REG "gs"
diff --git a/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch b/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch
index d763178f21..b40d2bdef6 100644
--- a/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch
+++ b/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch
@@ -1,4 +1,4 @@
1From 24bffe9c2645cd6542e29cb57786dc703cced07b Mon Sep 17 00:00:00 2001 1From bf1603b3d73f64de777be00f7e55f2cfef596102 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 3 Aug 2018 09:55:12 -0700 3Date: Fri, 3 Aug 2018 09:55:12 -0700
4Subject: [PATCH] nativesdk-glibc: Make relocatable install for locales 4Subject: [PATCH] nativesdk-glibc: Make relocatable install for locales
@@ -19,10 +19,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
19 4 files changed, 8 insertions(+), 7 deletions(-) 19 4 files changed, 8 insertions(+), 7 deletions(-)
20 20
21diff --git a/locale/findlocale.c b/locale/findlocale.c 21diff --git a/locale/findlocale.c b/locale/findlocale.c
22index ab09122b0c..f42cc75780 100644 22index 5986373edd..856ba9afc0 100644
23--- a/locale/findlocale.c 23--- a/locale/findlocale.c
24+++ b/locale/findlocale.c 24+++ b/locale/findlocale.c
25@@ -56,7 +56,7 @@ struct __locale_data *const _nl_C[] attribute_hidden = 25@@ -55,7 +55,7 @@ struct __locale_data *const _nl_C[] attribute_hidden =
26 which are somehow addressed. */ 26 which are somehow addressed. */
27 struct loaded_l10nfile *_nl_locale_file_list[__LC_LAST]; 27 struct loaded_l10nfile *_nl_locale_file_list[__LC_LAST];
28 28
@@ -31,7 +31,7 @@ index ab09122b0c..f42cc75780 100644
31 31
32 /* Checks if the name is actually present, that is, not NULL and not 32 /* Checks if the name is actually present, that is, not NULL and not
33 empty. */ 33 empty. */
34@@ -166,7 +166,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len, 34@@ -165,7 +165,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
35 35
36 /* Nothing in the archive. Set the default path to search below. */ 36 /* Nothing in the archive. Set the default path to search below. */
37 locale_path = _nl_default_locale_path; 37 locale_path = _nl_default_locale_path;
@@ -67,10 +67,10 @@ index b3d4da0185..22f9dc1140 100644
67 /* Load the locale data for CATEGORY from the file specified by *NAME. 67 /* Load the locale data for CATEGORY from the file specified by *NAME.
68 If *NAME is "", use environment variables as specified by POSIX, and 68 If *NAME is "", use environment variables as specified by POSIX, and
69diff --git a/locale/programs/locale.c b/locale/programs/locale.c 69diff --git a/locale/programs/locale.c b/locale/programs/locale.c
70index ca0a95be99..6b98895203 100644 70index e9275d6b83..a9109155e5 100644
71--- a/locale/programs/locale.c 71--- a/locale/programs/locale.c
72+++ b/locale/programs/locale.c 72+++ b/locale/programs/locale.c
73@@ -632,6 +632,7 @@ nameentcmp (const void *a, const void *b) 73@@ -631,6 +631,7 @@ nameentcmp (const void *a, const void *b)
74 ((const struct nameent *) b)->name); 74 ((const struct nameent *) b)->name);
75 } 75 }
76 76
@@ -78,7 +78,7 @@ index ca0a95be99..6b98895203 100644
78 78
79 static int 79 static int
80 write_archive_locales (void **all_datap, char *linebuf) 80 write_archive_locales (void **all_datap, char *linebuf)
81@@ -645,7 +646,7 @@ write_archive_locales (void **all_datap, char *linebuf) 81@@ -644,7 +645,7 @@ write_archive_locales (void **all_datap, char *linebuf)
82 int fd, ret = 0; 82 int fd, ret = 0;
83 uint32_t cnt; 83 uint32_t cnt;
84 84
@@ -87,7 +87,7 @@ index ca0a95be99..6b98895203 100644
87 if (fd < 0) 87 if (fd < 0)
88 return 0; 88 return 0;
89 89
90@@ -700,8 +701,8 @@ write_archive_locales (void **all_datap, char *linebuf) 90@@ -699,8 +700,8 @@ write_archive_locales (void **all_datap, char *linebuf)
91 if (cnt) 91 if (cnt)
92 putchar_unlocked ('\n'); 92 putchar_unlocked ('\n');
93 93
diff --git a/meta/recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch b/meta/recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch
index f4fc1d68c4..a47dd5331a 100644
--- a/meta/recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch
+++ b/meta/recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch
@@ -1,4 +1,4 @@
1From 2761400989bcbf11e10bc85f90c3a2ba1305c4ae Mon Sep 17 00:00:00 2001 1From 78b2e81940561069faf7698931a033784f794e40 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 6 Mar 2021 14:48:56 -0800 3Date: Sat, 6 Mar 2021 14:48:56 -0800
4Subject: [PATCH] nativesdk-glibc: Fall back to faccessat on faccess2 returns 4Subject: [PATCH] nativesdk-glibc: Fall back to faccessat on faccess2 returns
diff --git a/meta/recipes-core/glibc/glibc/0016-yes-within-the-path-sets-wrong-config-variables.patch b/meta/recipes-core/glibc/glibc/0009-yes-within-the-path-sets-wrong-config-variables.patch
index f7e7f1cd10..77644a2ee3 100644
--- a/meta/recipes-core/glibc/glibc/0016-yes-within-the-path-sets-wrong-config-variables.patch
+++ b/meta/recipes-core/glibc/glibc/0009-yes-within-the-path-sets-wrong-config-variables.patch
@@ -1,4 +1,4 @@
1From 7be3e82b66394a7b242e56c6fc609e858b8e2436 Mon Sep 17 00:00:00 2001 1From f6e96a95212bc1fef57b9594a7dddc0c20639873 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 00:31:06 +0000 3Date: Wed, 18 Mar 2015 00:31:06 +0000
4Subject: [PATCH] 'yes' within the path sets wrong config variables 4Subject: [PATCH] 'yes' within the path sets wrong config variables
diff --git a/meta/recipes-core/glibc/glibc/0019-eglibc-Cross-building-and-testing-instructions.patch b/meta/recipes-core/glibc/glibc/0010-eglibc-Cross-building-and-testing-instructions.patch
index 8fb9182d98..295fa315d8 100644
--- a/meta/recipes-core/glibc/glibc/0019-eglibc-Cross-building-and-testing-instructions.patch
+++ b/meta/recipes-core/glibc/glibc/0010-eglibc-Cross-building-and-testing-instructions.patch
@@ -1,4 +1,4 @@
1From db9674ffc6583a508da1a3cb044c3ccf3febaea1 Mon Sep 17 00:00:00 2001 1From d6300e80c7c010fa7ca33e36e826151558cec498 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 00:42:58 +0000 3Date: Wed, 18 Mar 2015 00:42:58 +0000
4Subject: [PATCH] eglibc: Cross building and testing instructions 4Subject: [PATCH] eglibc: Cross building and testing instructions
diff --git a/meta/recipes-core/glibc/glibc/0020-eglibc-Help-bootstrap-cross-toolchain.patch b/meta/recipes-core/glibc/glibc/0011-eglibc-Help-bootstrap-cross-toolchain.patch
index 9b76cfd3b8..9e00da894d 100644
--- a/meta/recipes-core/glibc/glibc/0020-eglibc-Help-bootstrap-cross-toolchain.patch
+++ b/meta/recipes-core/glibc/glibc/0011-eglibc-Help-bootstrap-cross-toolchain.patch
@@ -1,4 +1,4 @@
1From 7856684f76c100155cad11b5b236fb31234b6e28 Mon Sep 17 00:00:00 2001 1From 1c8044544d2cbdc529910a3ed6eba4b0ce7ae549 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 00:49:28 +0000 3Date: Wed, 18 Mar 2015 00:49:28 +0000
4Subject: [PATCH] eglibc: Help bootstrap cross toolchain 4Subject: [PATCH] eglibc: Help bootstrap cross toolchain
@@ -29,7 +29,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
29 create mode 100644 include/stubs-bootstrap.h 29 create mode 100644 include/stubs-bootstrap.h
30 30
31diff --git a/Makefile b/Makefile 31diff --git a/Makefile b/Makefile
32index f98d5a9e67..c36d04da0f 100644 32index a49870d3d1..81673d7645 100644
33--- a/Makefile 33--- a/Makefile
34+++ b/Makefile 34+++ b/Makefile
35@@ -79,9 +79,18 @@ subdir-dirs = include 35@@ -79,9 +79,18 @@ subdir-dirs = include
@@ -52,7 +52,7 @@ index f98d5a9e67..c36d04da0f 100644
52 ifeq (yes,$(build-shared)) 52 ifeq (yes,$(build-shared))
53 headers += gnu/lib-names.h 53 headers += gnu/lib-names.h
54 endif 54 endif
55@@ -415,6 +424,16 @@ others: $(common-objpfx)testrun.sh $(common-objpfx)debugglibc.sh 55@@ -420,6 +429,16 @@ others: $(common-objpfx)testrun.sh $(common-objpfx)debugglibc.sh
56 56
57 subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs) 57 subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
58 58
@@ -69,7 +69,7 @@ index f98d5a9e67..c36d04da0f 100644
69 ifndef abi-variants 69 ifndef abi-variants
70 installed-stubs = $(inst_includedir)/gnu/stubs.h 70 installed-stubs = $(inst_includedir)/gnu/stubs.h
71 else 71 else
72@@ -441,6 +460,7 @@ $(inst_includedir)/gnu/stubs.h: $(+force) 72@@ -446,6 +465,7 @@ $(inst_includedir)/gnu/stubs.h: $(+force)
73 73
74 install-others-nosubdir: $(installed-stubs) 74 install-others-nosubdir: $(installed-stubs)
75 endif 75 endif
diff --git a/meta/recipes-core/glibc/glibc/0021-eglibc-Resolve-__fpscr_values-on-SH4.patch b/meta/recipes-core/glibc/glibc/0012-eglibc-Resolve-__fpscr_values-on-SH4.patch
index 74c8c10661..03c81bfbd7 100644
--- a/meta/recipes-core/glibc/glibc/0021-eglibc-Resolve-__fpscr_values-on-SH4.patch
+++ b/meta/recipes-core/glibc/glibc/0012-eglibc-Resolve-__fpscr_values-on-SH4.patch
@@ -1,4 +1,4 @@
1From 111ab95a85314d1e70fb159a14250354cc69d899 Mon Sep 17 00:00:00 2001 1From e5999ffd1b8690c2902a6406c07f51023a6bf7ec Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 00:55:53 +0000 3Date: Wed, 18 Mar 2015 00:55:53 +0000
4Subject: [PATCH] eglibc: Resolve __fpscr_values on SH4 4Subject: [PATCH] eglibc: Resolve __fpscr_values on SH4
diff --git a/meta/recipes-core/glibc/glibc/0022-eglibc-Forward-port-cross-locale-generation-support.patch b/meta/recipes-core/glibc/glibc/0013-eglibc-Forward-port-cross-locale-generation-support.patch
index a9ff8e92ea..48bb062e09 100644
--- a/meta/recipes-core/glibc/glibc/0022-eglibc-Forward-port-cross-locale-generation-support.patch
+++ b/meta/recipes-core/glibc/glibc/0013-eglibc-Forward-port-cross-locale-generation-support.patch
@@ -1,4 +1,4 @@
1From 4e5de801a39d66b8bd93d09f5912dcbe5db4ef04 Mon Sep 17 00:00:00 2001 1From 99ae3189430eaa5472b2117e5a999109a6ca9251 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 01:33:49 +0000 3Date: Wed, 18 Mar 2015 01:33:49 +0000
4Subject: [PATCH] eglibc: Forward port cross locale generation support 4Subject: [PATCH] eglibc: Forward port cross locale generation support
@@ -148,10 +148,10 @@ index 4841bfd05d..ffcba1fd79 100644
148 return NULL; 148 return NULL;
149 } 149 }
150diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c 150diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
151index b6406b775d..bfa4adba9c 100644 151index 06a5203334..84b3ff4166 100644
152--- a/locale/programs/ld-collate.c 152--- a/locale/programs/ld-collate.c
153+++ b/locale/programs/ld-collate.c 153+++ b/locale/programs/ld-collate.c
154@@ -349,7 +349,7 @@ new_element (struct locale_collate_t *collate, const char *mbs, size_t mbslen, 154@@ -352,7 +352,7 @@ new_element (struct locale_collate_t *collate, const char *mbs, size_t mbslen,
155 } 155 }
156 if (wcs != NULL) 156 if (wcs != NULL)
157 { 157 {
@@ -160,7 +160,7 @@ index b6406b775d..bfa4adba9c 100644
160 uint32_t zero = 0; 160 uint32_t zero = 0;
161 /* Handle <U0000> as a single character. */ 161 /* Handle <U0000> as a single character. */
162 if (nwcs == 0) 162 if (nwcs == 0)
163@@ -1775,8 +1775,7 @@ symbol `%s' has the same encoding as"), (*eptr)->name); 163@@ -1783,8 +1783,7 @@ symbol `%s' has the same encoding as"), (*eptr)->name);
164 164
165 if ((*eptr)->nwcs == runp->nwcs) 165 if ((*eptr)->nwcs == runp->nwcs)
166 { 166 {
@@ -170,7 +170,7 @@ index b6406b775d..bfa4adba9c 100644
170 170
171 if (c == 0) 171 if (c == 0)
172 { 172 {
173@@ -2003,9 +2002,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp) 173@@ -2011,9 +2010,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp)
174 one consecutive entry. */ 174 one consecutive entry. */
175 if (runp->wcnext != NULL 175 if (runp->wcnext != NULL
176 && runp->nwcs == runp->wcnext->nwcs 176 && runp->nwcs == runp->wcnext->nwcs
@@ -183,7 +183,7 @@ index b6406b775d..bfa4adba9c 100644
183 && (runp->wcs[runp->nwcs - 1] 183 && (runp->wcs[runp->nwcs - 1]
184 == runp->wcnext->wcs[runp->nwcs - 1] + 1)) 184 == runp->wcnext->wcs[runp->nwcs - 1] + 1))
185 { 185 {
186@@ -2029,9 +2028,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp) 186@@ -2037,9 +2036,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp)
187 runp = runp->wcnext; 187 runp = runp->wcnext;
188 while (runp->wcnext != NULL 188 while (runp->wcnext != NULL
189 && runp->nwcs == runp->wcnext->nwcs 189 && runp->nwcs == runp->wcnext->nwcs
@@ -197,10 +197,10 @@ index b6406b775d..bfa4adba9c 100644
197 == runp->wcnext->wcs[runp->nwcs - 1] + 1)); 197 == runp->wcnext->wcs[runp->nwcs - 1] + 1));
198 198
199diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c 199diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
200index 2fb579bbbf..d0be99581c 100644 200index 07b64ac5a1..70b49ab733 100644
201--- a/locale/programs/ld-ctype.c 201--- a/locale/programs/ld-ctype.c
202+++ b/locale/programs/ld-ctype.c 202+++ b/locale/programs/ld-ctype.c
203@@ -915,7 +915,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap, 203@@ -914,7 +914,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap,
204 allocate_arrays (ctype, charmap, ctype->repertoire); 204 allocate_arrays (ctype, charmap, ctype->repertoire);
205 205
206 default_missing_len = (ctype->default_missing 206 default_missing_len = (ctype->default_missing
@@ -209,7 +209,7 @@ index 2fb579bbbf..d0be99581c 100644
209 : 0); 209 : 0);
210 210
211 init_locale_data (&file, nelems); 211 init_locale_data (&file, nelems);
212@@ -1927,7 +1927,7 @@ read_translit_entry (struct linereader *ldfile, struct locale_ctype_t *ctype, 212@@ -1926,7 +1926,7 @@ read_translit_entry (struct linereader *ldfile, struct locale_ctype_t *ctype,
213 ignore = 1; 213 ignore = 1;
214 else 214 else
215 /* This value is usable. */ 215 /* This value is usable. */
@@ -218,7 +218,7 @@ index 2fb579bbbf..d0be99581c 100644
218 218
219 first = 0; 219 first = 0;
220 } 220 }
221@@ -2461,8 +2461,8 @@ with character code range values one must use the absolute ellipsis `...'")); 221@@ -2460,8 +2460,8 @@ with character code range values one must use the absolute ellipsis `...'"));
222 } 222 }
223 223
224 handle_tok_digit: 224 handle_tok_digit:
@@ -229,7 +229,7 @@ index 2fb579bbbf..d0be99581c 100644
229 handle_digits = 1; 229 handle_digits = 1;
230 goto read_charclass; 230 goto read_charclass;
231 231
232@@ -3904,8 +3904,7 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, 232@@ -3903,8 +3903,7 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
233 233
234 while (idx < number) 234 while (idx < number)
235 { 235 {
@@ -239,7 +239,7 @@ index 2fb579bbbf..d0be99581c 100644
239 if (res == 0) 239 if (res == 0)
240 { 240 {
241 replace = 1; 241 replace = 1;
242@@ -3942,11 +3941,11 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, 242@@ -3941,11 +3940,11 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
243 for (size_t cnt = 0; cnt < number; ++cnt) 243 for (size_t cnt = 0; cnt < number; ++cnt)
244 { 244 {
245 struct translit_to_t *srunp; 245 struct translit_to_t *srunp;
@@ -253,7 +253,7 @@ index 2fb579bbbf..d0be99581c 100644
253 srunp = srunp->next; 253 srunp = srunp->next;
254 } 254 }
255 /* Plus one for the extra NUL character marking the end of 255 /* Plus one for the extra NUL character marking the end of
256@@ -3970,18 +3969,18 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, 256@@ -3969,18 +3968,18 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
257 ctype->translit_from_idx[cnt] = from_len; 257 ctype->translit_from_idx[cnt] = from_len;
258 ctype->translit_to_idx[cnt] = to_len; 258 ctype->translit_to_idx[cnt] = to_len;
259 259
@@ -279,10 +279,10 @@ index 2fb579bbbf..d0be99581c 100644
279 srunp = srunp->next; 279 srunp = srunp->next;
280 } 280 }
281diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c 281diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
282index dcd2a2386d..6814740325 100644 282index e6f320d2b3..c6631ad101 100644
283--- a/locale/programs/ld-time.c 283--- a/locale/programs/ld-time.c
284+++ b/locale/programs/ld-time.c 284+++ b/locale/programs/ld-time.c
285@@ -220,8 +220,10 @@ No definition for %s category found"), "LC_TIME"); 285@@ -219,8 +219,10 @@ No definition for %s category found"), "LC_TIME");
286 } 286 }
287 else 287 else
288 { 288 {
@@ -294,7 +294,7 @@ index dcd2a2386d..6814740325 100644
294 } 294 }
295 } 295 }
296 296
297@@ -231,7 +233,7 @@ No definition for %s category found"), "LC_TIME"); 297@@ -230,7 +232,7 @@ No definition for %s category found"), "LC_TIME");
298 const int days_per_month[12] = { 31, 29, 31, 30, 31, 30, 298 const int days_per_month[12] = { 31, 29, 31, 30, 31, 30,
299 31, 31, 30, 31 ,30, 31 }; 299 31, 31, 30, 31 ,30, 31 };
300 size_t idx; 300 size_t idx;
@@ -303,7 +303,7 @@ index dcd2a2386d..6814740325 100644
303 303
304 time->era_entries = 304 time->era_entries =
305 (struct era_data *) xmalloc (time->num_era 305 (struct era_data *) xmalloc (time->num_era
306@@ -457,18 +459,18 @@ No definition for %s category found"), "LC_TIME"); 306@@ -456,18 +458,18 @@ No definition for %s category found"), "LC_TIME");
307 } 307 }
308 308
309 /* Now generate the wide character name and format. */ 309 /* Now generate the wide character name and format. */
@@ -329,7 +329,7 @@ index dcd2a2386d..6814740325 100644
329 } 329 }
330 else 330 else
331 time->era_entries[idx].wname = 331 time->era_entries[idx].wname =
332@@ -527,7 +529,16 @@ No definition for %s category found"), "LC_TIME"); 332@@ -526,7 +528,16 @@ No definition for %s category found"), "LC_TIME");
333 if (time->date_fmt == NULL) 333 if (time->date_fmt == NULL)
334 time->date_fmt = "%a %b %e %H:%M:%S %Z %Y"; 334 time->date_fmt = "%a %b %e %H:%M:%S %Z %Y";
335 if (time->wdate_fmt == NULL) 335 if (time->wdate_fmt == NULL)
@@ -348,10 +348,10 @@ index dcd2a2386d..6814740325 100644
348 348
349 349
350diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c 350diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c
351index 96d3ab66db..3af379d2c3 100644 351index a1f22b28ed..cbd3b40ceb 100644
352--- a/locale/programs/linereader.c 352--- a/locale/programs/linereader.c
353+++ b/locale/programs/linereader.c 353+++ b/locale/programs/linereader.c
354@@ -595,7 +595,7 @@ get_string (struct linereader *lr, const struct charmap_t *charmap, 354@@ -594,7 +594,7 @@ get_string (struct linereader *lr, const struct charmap_t *charmap,
355 { 355 {
356 int return_widestr = lr->return_widestr; 356 int return_widestr = lr->return_widestr;
357 char *buf; 357 char *buf;
@@ -361,10 +361,10 @@ index 96d3ab66db..3af379d2c3 100644
361 size_t bufmax = 56; 361 size_t bufmax = 56;
362 362
363diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c 363diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
364index 832c8fd1fc..fe689b3ae1 100644 364index f0da25e9e5..5d9e01cda2 100644
365--- a/locale/programs/localedef.c 365--- a/locale/programs/localedef.c
366+++ b/locale/programs/localedef.c 366+++ b/locale/programs/localedef.c
367@@ -109,6 +109,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; 367@@ -108,6 +108,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
368 #define OPT_NO_WARN 402 368 #define OPT_NO_WARN 402
369 #define OPT_WARN 403 369 #define OPT_WARN 403
370 #define OPT_NO_HARD_LINKS 404 370 #define OPT_NO_HARD_LINKS 404
@@ -372,7 +372,7 @@ index 832c8fd1fc..fe689b3ae1 100644
372 372
373 /* Definitions of arguments for argp functions. */ 373 /* Definitions of arguments for argp functions. */
374 static const struct argp_option options[] = 374 static const struct argp_option options[] =
375@@ -153,6 +154,8 @@ static const struct argp_option options[] = 375@@ -152,6 +153,8 @@ static const struct argp_option options[] =
376 N_("Generate little-endian output") }, 376 N_("Generate little-endian output") },
377 { "big-endian", OPT_BIG_ENDIAN, NULL, 0, 377 { "big-endian", OPT_BIG_ENDIAN, NULL, 0,
378 N_("Generate big-endian output") }, 378 N_("Generate big-endian output") },
@@ -381,7 +381,7 @@ index 832c8fd1fc..fe689b3ae1 100644
381 { NULL, 0, NULL, 0, NULL } 381 { NULL, 0, NULL, 0, NULL }
382 }; 382 };
383 383
384@@ -243,12 +246,14 @@ main (int argc, char *argv[]) 384@@ -242,12 +245,14 @@ main (int argc, char *argv[])
385 ctype locale. (P1003.2 4.35.5.2) */ 385 ctype locale. (P1003.2 4.35.5.2) */
386 setlocale (LC_CTYPE, "POSIX"); 386 setlocale (LC_CTYPE, "POSIX");
387 387
@@ -396,7 +396,7 @@ index 832c8fd1fc..fe689b3ae1 100644
396 396
397 /* Process charmap file. */ 397 /* Process charmap file. */
398 charmap = charmap_read (charmap_file, verbose, 1, be_quiet, 1); 398 charmap = charmap_read (charmap_file, verbose, 1, be_quiet, 1);
399@@ -400,6 +405,9 @@ parse_opt (int key, char *arg, struct argp_state *state) 399@@ -399,6 +404,9 @@ parse_opt (int key, char *arg, struct argp_state *state)
400 /* Do not hard link to other locales. */ 400 /* Do not hard link to other locales. */
401 hard_links = false; 401 hard_links = false;
402 break; 402 break;
@@ -407,10 +407,10 @@ index 832c8fd1fc..fe689b3ae1 100644
407 force_output = 1; 407 force_output = 1;
408 break; 408 break;
409diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c 409diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
410index 0f1affa1d4..7d86fae801 100644 410index 1427b518a9..dafa84a20b 100644
411--- a/locale/programs/locfile.c 411--- a/locale/programs/locfile.c
412+++ b/locale/programs/locfile.c 412+++ b/locale/programs/locfile.c
413@@ -544,6 +544,9 @@ compare_files (const char *filename1, const char *filename2, size_t size, 413@@ -543,6 +543,9 @@ compare_files (const char *filename1, const char *filename2, size_t size,
414 machine running localedef. */ 414 machine running localedef. */
415 bool swap_endianness_p; 415 bool swap_endianness_p;
416 416
@@ -420,7 +420,7 @@ index 0f1affa1d4..7d86fae801 100644
420 /* When called outside a start_locale_structure/end_locale_structure 420 /* When called outside a start_locale_structure/end_locale_structure
421 or start_locale_prelude/end_locale_prelude block, record that the 421 or start_locale_prelude/end_locale_prelude block, record that the
422 next byte in FILE's obstack will be the first byte of a new element. 422 next byte in FILE's obstack will be the first byte of a new element.
423@@ -621,7 +624,7 @@ add_locale_string (struct locale_file *file, const char *string) 423@@ -620,7 +623,7 @@ add_locale_string (struct locale_file *file, const char *string)
424 void 424 void
425 add_locale_wstring (struct locale_file *file, const uint32_t *string) 425 add_locale_wstring (struct locale_file *file, const uint32_t *string)
426 { 426 {
@@ -430,10 +430,10 @@ index 0f1affa1d4..7d86fae801 100644
430 430
431 /* Record that FILE's next element is the 32-bit integer VALUE. */ 431 /* Record that FILE's next element is the 32-bit integer VALUE. */
432diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h 432diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h
433index c986d599ec..222a779176 100644 433index cbc20fe88d..ae88e6d0af 100644
434--- a/locale/programs/locfile.h 434--- a/locale/programs/locfile.h
435+++ b/locale/programs/locfile.h 435+++ b/locale/programs/locfile.h
436@@ -71,6 +71,8 @@ extern void write_all_categories (struct localedef_t *definitions, 436@@ -70,6 +70,8 @@ extern void write_all_categories (struct localedef_t *definitions,
437 437
438 extern bool swap_endianness_p; 438 extern bool swap_endianness_p;
439 439
@@ -442,7 +442,7 @@ index c986d599ec..222a779176 100644
442 /* Change the output to be big-endian if BIG_ENDIAN is true and 442 /* Change the output to be big-endian if BIG_ENDIAN is true and
443 little-endian otherwise. */ 443 little-endian otherwise. */
444 static inline void 444 static inline void
445@@ -89,7 +91,8 @@ maybe_swap_uint32 (uint32_t value) 445@@ -88,7 +90,8 @@ maybe_swap_uint32 (uint32_t value)
446 } 446 }
447 447
448 /* Likewise, but munge an array of N uint32_ts starting at ARRAY. */ 448 /* Likewise, but munge an array of N uint32_ts starting at ARRAY. */
@@ -452,7 +452,7 @@ index c986d599ec..222a779176 100644
452 maybe_swap_uint32_array (uint32_t *array, size_t n) 452 maybe_swap_uint32_array (uint32_t *array, size_t n)
453 { 453 {
454 if (swap_endianness_p) 454 if (swap_endianness_p)
455@@ -99,7 +102,8 @@ maybe_swap_uint32_array (uint32_t *array, size_t n) 455@@ -98,7 +101,8 @@ maybe_swap_uint32_array (uint32_t *array, size_t n)
456 456
457 /* Like maybe_swap_uint32_array, but the array of N elements is at 457 /* Like maybe_swap_uint32_array, but the array of N elements is at
458 the end of OBSTACK's current object. */ 458 the end of OBSTACK's current object. */
@@ -462,7 +462,7 @@ index c986d599ec..222a779176 100644
462 maybe_swap_uint32_obstack (struct obstack *obstack, size_t n) 462 maybe_swap_uint32_obstack (struct obstack *obstack, size_t n)
463 { 463 {
464 maybe_swap_uint32_array ((uint32_t *) obstack_next_free (obstack) - n, n); 464 maybe_swap_uint32_array ((uint32_t *) obstack_next_free (obstack) - n, n);
465@@ -276,4 +280,55 @@ extern void identification_output (struct localedef_t *locale, 465@@ -275,4 +279,55 @@ extern void identification_output (struct localedef_t *locale,
466 const struct charmap_t *charmap, 466 const struct charmap_t *charmap,
467 const char *output_path); 467 const char *output_path);
468 468
diff --git a/meta/recipes-core/glibc/glibc/0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch b/meta/recipes-core/glibc/glibc/0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch
index 50c2e14735..eae1ee8907 100644
--- a/meta/recipes-core/glibc/glibc/0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch
+++ b/meta/recipes-core/glibc/glibc/0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch
@@ -1,4 +1,4 @@
1From 13bc0e53cc91e102472d532f28b3d44c30d291fc Mon Sep 17 00:00:00 2001 1From 32c2e23ad29f63f57f544daf1a59259147cd1008 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 3 Aug 2018 09:42:06 -0700 3Date: Fri, 3 Aug 2018 09:42:06 -0700
4Subject: [PATCH] localedef --add-to-archive uses a hard-coded locale path 4Subject: [PATCH] localedef --add-to-archive uses a hard-coded locale path
@@ -18,10 +18,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
18 1 file changed, 25 insertions(+), 10 deletions(-) 18 1 file changed, 25 insertions(+), 10 deletions(-)
19 19
20diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c 20diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
21index f38e835c52..8d8f8699b2 100644 21index 477499bd40..fe7b5ff60c 100644
22--- a/locale/programs/locarchive.c 22--- a/locale/programs/locarchive.c
23+++ b/locale/programs/locarchive.c 23+++ b/locale/programs/locarchive.c
24@@ -340,12 +340,24 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head) 24@@ -339,12 +339,24 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
25 struct namehashent *oldnamehashtab; 25 struct namehashent *oldnamehashtab;
26 struct locarhandle new_ah; 26 struct locarhandle new_ah;
27 size_t prefix_len = output_prefix ? strlen (output_prefix) : 0; 27 size_t prefix_len = output_prefix ? strlen (output_prefix) : 0;
@@ -51,7 +51,7 @@ index f38e835c52..8d8f8699b2 100644
51 strcpy (stpcpy (fname, archivefname), ".XXXXXX"); 51 strcpy (stpcpy (fname, archivefname), ".XXXXXX");
52 52
53 /* Not all of the old file has to be mapped. Change this now this 53 /* Not all of the old file has to be mapped. Change this now this
54@@ -569,10 +581,13 @@ open_archive (struct locarhandle *ah, bool readonly) 54@@ -568,10 +580,13 @@ open_archive (struct locarhandle *ah, bool readonly)
55 /* If ah has a non-NULL fname open that otherwise open the default. */ 55 /* If ah has a non-NULL fname open that otherwise open the default. */
56 if (archivefname == NULL) 56 if (archivefname == NULL)
57 { 57 {
@@ -69,7 +69,7 @@ index f38e835c52..8d8f8699b2 100644
69 } 69 }
70 70
71 while (1) 71 while (1)
72@@ -585,7 +600,7 @@ open_archive (struct locarhandle *ah, bool readonly) 72@@ -584,7 +599,7 @@ open_archive (struct locarhandle *ah, bool readonly)
73 the default locale archive we ignore the failure and 73 the default locale archive we ignore the failure and
74 list an empty archive, otherwise we print an error 74 list an empty archive, otherwise we print an error
75 and exit. */ 75 and exit. */
diff --git a/meta/recipes-core/glibc/glibc/0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch b/meta/recipes-core/glibc/glibc/0016-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch
index 2bfa2aaa06..4e51036ce5 100644
--- a/meta/recipes-core/glibc/glibc/0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch
+++ b/meta/recipes-core/glibc/glibc/0016-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch
@@ -1,4 +1,4 @@
1From 3190ada9ecaec915794886a608221655c120f90c Mon Sep 17 00:00:00 2001 1From c59bc6eb421ad3310c43951a11d2561bbf34e95e Mon Sep 17 00:00:00 2001
2From: Martin Jansa <martin.jansa@gmail.com> 2From: Martin Jansa <martin.jansa@gmail.com>
3Date: Mon, 17 Dec 2018 21:36:18 +0000 3Date: Mon, 17 Dec 2018 21:36:18 +0000
4Subject: [PATCH] locale: prevent maybe-uninitialized errors with -Os [BZ 4Subject: [PATCH] locale: prevent maybe-uninitialized errors with -Os [BZ
@@ -33,10 +33,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
33 1 file changed, 7 insertions(+) 33 1 file changed, 7 insertions(+)
34 34
35diff --git a/locale/weight.h b/locale/weight.h 35diff --git a/locale/weight.h b/locale/weight.h
36index 723e1fefda..f5798d379a 100644 36index 076529c0ba..2ac83657f7 100644
37--- a/locale/weight.h 37--- a/locale/weight.h
38+++ b/locale/weight.h 38+++ b/locale/weight.h
39@@ -28,7 +28,14 @@ findidx (const int32_t *table, 39@@ -27,7 +27,14 @@ findidx (const int32_t *table,
40 const unsigned char *extra, 40 const unsigned char *extra,
41 const unsigned char **cpp, size_t len) 41 const unsigned char **cpp, size_t len)
42 { 42 {
diff --git a/meta/recipes-core/glibc/glibc/0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch b/meta/recipes-core/glibc/glibc/0017-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch
index 8042caaeae..77a2bab87d 100644
--- a/meta/recipes-core/glibc/glibc/0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch
+++ b/meta/recipes-core/glibc/glibc/0017-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch
@@ -1,4 +1,4 @@
1From 5d201a75918a0e181ee6206f701901fdb91baf81 Mon Sep 17 00:00:00 2001 1From 9f4fcec5662bfa6f8aa6a36dda6f4c05f6e30e51 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 00:11:22 +0000 3Date: Wed, 18 Mar 2015 00:11:22 +0000
4Subject: [PATCH] readlib: Add OECORE_KNOWN_INTERPRETER_NAMES to known names 4Subject: [PATCH] readlib: Add OECORE_KNOWN_INTERPRETER_NAMES to known names
@@ -16,10 +16,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
16 1 file changed, 1 insertion(+) 16 1 file changed, 1 insertion(+)
17 17
18diff --git a/elf/readlib.c b/elf/readlib.c 18diff --git a/elf/readlib.c b/elf/readlib.c
19index 7383c23249..e97ea9449d 100644 19index 64b20d7804..50318158fb 100644
20--- a/elf/readlib.c 20--- a/elf/readlib.c
21+++ b/elf/readlib.c 21+++ b/elf/readlib.c
22@@ -51,6 +51,7 @@ static struct known_names interpreters[] = 22@@ -49,6 +49,7 @@ static struct known_names interpreters[] =
23 #ifdef SYSDEP_KNOWN_INTERPRETER_NAMES 23 #ifdef SYSDEP_KNOWN_INTERPRETER_NAMES
24 SYSDEP_KNOWN_INTERPRETER_NAMES 24 SYSDEP_KNOWN_INTERPRETER_NAMES
25 #endif 25 #endif
diff --git a/meta/recipes-core/glibc/glibc/0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch b/meta/recipes-core/glibc/glibc/0018-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch
index ece792509e..63f7749ecb 100644
--- a/meta/recipes-core/glibc/glibc/0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch
+++ b/meta/recipes-core/glibc/glibc/0018-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch
@@ -1,7 +1,7 @@
1From baba3c6021340a9070b734f931a15cea4cfe6c31 Mon Sep 17 00:00:00 2001 1From 4d6bce6b106d9d9a629aadba74d74cd8a500ccbf Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 15 May 2020 17:05:45 -0700 3Date: Fri, 15 May 2020 17:05:45 -0700
4Subject: [PATCH] wordsize.h: Unify the header between arm and aarch64 4Subject: [PATCH 18/24] wordsize.h: Unify the header between arm and aarch64
5 5
6This helps OE multilibs to not sythesize this header which causes all 6This helps OE multilibs to not sythesize this header which causes all
7kind of recursions and other issues since wordsize is fundamental header 7kind of recursions and other issues since wordsize is fundamental header
@@ -17,7 +17,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
17 copy sysdeps/{aarch64 => arm}/bits/wordsize.h (80%) 17 copy sysdeps/{aarch64 => arm}/bits/wordsize.h (80%)
18 18
19diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h 19diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h
20index 91da566b74..9a754514b3 100644 20index 4635431f0e..5ef0ed21f3 100644
21--- a/sysdeps/aarch64/bits/wordsize.h 21--- a/sysdeps/aarch64/bits/wordsize.h
22+++ b/sysdeps/aarch64/bits/wordsize.h 22+++ b/sysdeps/aarch64/bits/wordsize.h
23@@ -17,12 +17,16 @@ 23@@ -17,12 +17,16 @@
@@ -43,9 +43,17 @@ diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/arm/bits/wordsize.h
43similarity index 80% 43similarity index 80%
44copy from sysdeps/aarch64/bits/wordsize.h 44copy from sysdeps/aarch64/bits/wordsize.h
45copy to sysdeps/arm/bits/wordsize.h 45copy to sysdeps/arm/bits/wordsize.h
46index 91da566b74..34fcdef1f1 100644 46index 4635431f0e..34fcdef1f1 100644
47--- a/sysdeps/aarch64/bits/wordsize.h 47--- a/sysdeps/aarch64/bits/wordsize.h
48+++ b/sysdeps/arm/bits/wordsize.h 48+++ b/sysdeps/arm/bits/wordsize.h
49@@ -1,6 +1,6 @@
50 /* Determine the wordsize from the preprocessor defines.
51
52- Copyright (C) 2016-2022 Free Software Foundation, Inc.
53+ Copyright (C) 2016-2020 Free Software Foundation, Inc.
54 This file is part of the GNU C Library.
55
56 The GNU C Library is free software; you can redistribute it and/or
49@@ -17,12 +17,16 @@ 57@@ -17,12 +17,16 @@
50 License along with the GNU C Library; if not, see 58 License along with the GNU C Library; if not, see
51 <https://www.gnu.org/licenses/>. */ 59 <https://www.gnu.org/licenses/>. */
@@ -65,3 +73,6 @@ index 91da566b74..34fcdef1f1 100644
65 #endif 73 #endif
66 74
67 #define __WORDSIZE_TIME64_COMPAT32 0 75 #define __WORDSIZE_TIME64_COMPAT32 0
76--
772.34.1
78
diff --git a/meta/recipes-core/glibc/glibc/0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch b/meta/recipes-core/glibc/glibc/0019-powerpc-Do-not-ask-compiler-for-finding-arch.patch
index 22df820aed..4313c6860f 100644
--- a/meta/recipes-core/glibc/glibc/0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch
+++ b/meta/recipes-core/glibc/glibc/0019-powerpc-Do-not-ask-compiler-for-finding-arch.patch
@@ -1,4 +1,4 @@
1From 60aa53f547911163b42a1c436d695a15c87f34ee Mon Sep 17 00:00:00 2001 1From eb44466ec976d800bb697b10775efa28f22ec216 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 7 Aug 2020 14:31:16 -0700 3Date: Fri, 7 Aug 2020 14:31:16 -0700
4Subject: [PATCH] powerpc: Do not ask compiler for finding arch 4Subject: [PATCH] powerpc: Do not ask compiler for finding arch
diff --git a/meta/recipes-core/glibc/glibc/0018-Remove-bash-dependency-for-nscd-init-script.patch b/meta/recipes-core/glibc/glibc/0021-Replace-echo-with-printf-builtin-in-nscd-init-script.patch
index 23296da61d..42c498bbc8 100644
--- a/meta/recipes-core/glibc/glibc/0018-Remove-bash-dependency-for-nscd-init-script.patch
+++ b/meta/recipes-core/glibc/glibc/0021-Replace-echo-with-printf-builtin-in-nscd-init-script.patch
@@ -1,21 +1,22 @@
1From 412d33bbfe42a10a9b1f62afcc73fe121a0363b0 Mon Sep 17 00:00:00 2001 1From 77fbd98f551d5b2cd338aa7f524e5ed980edb65e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 31 Dec 2015 14:33:02 -0800 3Date: Thu, 31 Dec 2015 14:33:02 -0800
4Subject: [PATCH] Remove bash dependency for nscd init script 4Subject: [PATCH] Replace echo with printf builtin in nscd init script
5 5
6The nscd init script uses #! /bin/bash but only really uses one bashism 6The nscd init script calls for #! /bin/bash interpreter
7(translated strings), so remove them and switch the shell to #!/bin/sh. 7since it uses bash specific extentions namely (translated strings)
8and echo -n command, replace echo with printf and
9switch the shell interpreter to #!/bin/sh.
8 10
9Upstream-Status: Pending 11Upstream-Status: Submitted [https://patchwork.sourceware.org/project/glibc/patch/20211209203557.1318333-1-raj.khem@gmail.com/]
10 12Signed-off-by: Ross Burton <ross.burton@arm.com>
11Signed-off-by: Ross Burton <ross.burton@intel.com>
12Signed-off-by: Khem Raj <raj.khem@gmail.com> 13Signed-off-by: Khem Raj <raj.khem@gmail.com>
13--- 14---
14 nscd/nscd.init | 14 +++++++------- 15 nscd/nscd.init | 20 ++++++++++----------
15 1 file changed, 7 insertions(+), 7 deletions(-) 16 1 file changed, 10 insertions(+), 10 deletions(-)
16 17
17diff --git a/nscd/nscd.init b/nscd/nscd.init 18diff --git a/nscd/nscd.init b/nscd/nscd.init
18index a882da7d8b..b02986ec15 100644 19index a882da7d8b..857b541381 100644
19--- a/nscd/nscd.init 20--- a/nscd/nscd.init
20+++ b/nscd/nscd.init 21+++ b/nscd/nscd.init
21@@ -1,4 +1,4 @@ 22@@ -1,4 +1,4 @@
@@ -24,25 +25,27 @@ index a882da7d8b..b02986ec15 100644
24 # 25 #
25 # nscd: Starts the Name Switch Cache Daemon 26 # nscd: Starts the Name Switch Cache Daemon
26 # 27 #
27@@ -49,7 +49,7 @@ prog=nscd 28@@ -49,16 +49,16 @@ prog=nscd
28 start () { 29 start () {
29 [ -d /var/run/nscd ] || mkdir /var/run/nscd 30 [ -d /var/run/nscd ] || mkdir /var/run/nscd
30 [ -d /var/db/nscd ] || mkdir /var/db/nscd 31 [ -d /var/db/nscd ] || mkdir /var/db/nscd
31- echo -n $"Starting $prog: " 32- echo -n $"Starting $prog: "
32+ echo -n "Starting $prog: " 33+ printf "Starting $prog: "
33 daemon /usr/sbin/nscd 34 daemon /usr/sbin/nscd
34 RETVAL=$? 35 RETVAL=$?
35 echo 36- echo
36@@ -58,7 +58,7 @@ start () { 37+ printf "\n"
38 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscd
39 return $RETVAL
37 } 40 }
38 41
39 stop () { 42 stop () {
40- echo -n $"Stopping $prog: " 43- echo -n $"Stopping $prog: "
41+ echo -n "Stopping $prog: " 44+ printf "Stopping $prog: "
42 /usr/sbin/nscd -K 45 /usr/sbin/nscd -K
43 RETVAL=$? 46 RETVAL=$?
44 if [ $RETVAL -eq 0 ]; then 47 if [ $RETVAL -eq 0 ]; then
45@@ -67,9 +67,9 @@ stop () { 48@@ -67,11 +67,11 @@ stop () {
46 # a non-privileged user 49 # a non-privileged user
47 rm -f /var/run/nscd/nscd.pid 50 rm -f /var/run/nscd/nscd.pid
48 rm -f /var/run/nscd/socket 51 rm -f /var/run/nscd/socket
@@ -52,21 +55,25 @@ index a882da7d8b..b02986ec15 100644
52- failure $"$prog shutdown" 55- failure $"$prog shutdown"
53+ failure "$prog shutdown" 56+ failure "$prog shutdown"
54 fi 57 fi
55 echo 58- echo
59+ printf "\n"
56 return $RETVAL 60 return $RETVAL
61 }
62
57@@ -103,13 +103,13 @@ case "$1" in 63@@ -103,13 +103,13 @@ case "$1" in
58 RETVAL=$? 64 RETVAL=$?
59 ;; 65 ;;
60 force-reload | reload) 66 force-reload | reload)
61- echo -n $"Reloading $prog: " 67- echo -n $"Reloading $prog: "
62+ echo -n "Reloading $prog: " 68+ printf "Reloading $prog: "
63 killproc /usr/sbin/nscd -HUP 69 killproc /usr/sbin/nscd -HUP
64 RETVAL=$? 70 RETVAL=$?
65 echo 71- echo
72+ printf "\n"
66 ;; 73 ;;
67 *) 74 *)
68- echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}" 75- echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
69+ echo "Usage: $0 {start|stop|status|restart|reload|condrestart}" 76+ printf "Usage: $0 {start|stop|status|restart|reload|condrestart}\n"
70 RETVAL=1 77 RETVAL=1
71 ;; 78 ;;
72 esac 79 esac
diff --git a/meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch b/meta/recipes-core/glibc/glibc/0022-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch
index 1b99af7110..5ac9d6d3a1 100644
--- a/meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch
+++ b/meta/recipes-core/glibc/glibc/0022-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch
@@ -1,11 +1,11 @@
1From b4613f814ba7ba5db95d18116172f81a83ac8f5b Mon Sep 17 00:00:00 2001 1From 5d1384d86fc44404ca32c6fda2d46ec357337c91 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 00:27:10 +0000 3Date: Wed, 18 Mar 2015 00:27:10 +0000
4Subject: [PATCH] sysdeps/gnu/configure.ac: handle correctly 4Subject: [PATCH] sysdeps/gnu/configure.ac: Set libc_cv_rootsbindir only if its empty
5 $libc_cv_rootsbindir
6 5
7Upstream-Status: Pending 6This ensures that it can be set in build environment
8 7
8Upstream-Status: Submitted [https://patchwork.sourceware.org/project/glibc/patch/20211209203557.1318333-2-raj.khem@gmail.com/]
9Signed-off-by: Matthieu Crapet <Matthieu.Crapet@ingenico.com> 9Signed-off-by: Matthieu Crapet <Matthieu.Crapet@ingenico.com>
10Signed-off-by: Khem Raj <raj.khem@gmail.com> 10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11--- 11---
@@ -14,7 +14,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
14 2 files changed, 2 insertions(+), 2 deletions(-) 14 2 files changed, 2 insertions(+), 2 deletions(-)
15 15
16diff --git a/sysdeps/gnu/configure b/sysdeps/gnu/configure 16diff --git a/sysdeps/gnu/configure b/sysdeps/gnu/configure
17index c15d1087e8..37cc983f2a 100644 17index c15d1087e8..d30d6e37ae 100644
18--- a/sysdeps/gnu/configure 18--- a/sysdeps/gnu/configure
19+++ b/sysdeps/gnu/configure 19+++ b/sysdeps/gnu/configure
20@@ -32,6 +32,6 @@ case "$prefix" in 20@@ -32,6 +32,6 @@ case "$prefix" in
@@ -22,11 +22,11 @@ index c15d1087e8..37cc983f2a 100644
22 libc_cv_localstatedir=$localstatedir 22 libc_cv_localstatedir=$localstatedir
23 fi 23 fi
24- libc_cv_rootsbindir=/sbin 24- libc_cv_rootsbindir=/sbin
25+ test -n "$libc_cv_rootsbindir" || libc_cv_rootsbindir=/sbin 25+ libc_cv_rootsbindir=${libc_cv_rootsbindir:=/sbin}
26 ;; 26 ;;
27 esac 27 esac
28diff --git a/sysdeps/gnu/configure.ac b/sysdeps/gnu/configure.ac 28diff --git a/sysdeps/gnu/configure.ac b/sysdeps/gnu/configure.ac
29index 634fe4de2a..3db1697f4f 100644 29index 634fe4de2a..492112e0fd 100644
30--- a/sysdeps/gnu/configure.ac 30--- a/sysdeps/gnu/configure.ac
31+++ b/sysdeps/gnu/configure.ac 31+++ b/sysdeps/gnu/configure.ac
32@@ -21,6 +21,6 @@ case "$prefix" in 32@@ -21,6 +21,6 @@ case "$prefix" in
@@ -34,6 +34,6 @@ index 634fe4de2a..3db1697f4f 100644
34 libc_cv_localstatedir=$localstatedir 34 libc_cv_localstatedir=$localstatedir
35 fi 35 fi
36- libc_cv_rootsbindir=/sbin 36- libc_cv_rootsbindir=/sbin
37+ test -n "$libc_cv_rootsbindir" || libc_cv_rootsbindir=/sbin 37+ libc_cv_rootsbindir=${libc_cv_rootsbindir:=/sbin}
38 ;; 38 ;;
39 esac 39 esac
diff --git a/meta/recipes-core/glibc/glibc/0001-Make-shell-interpreter-overridable-in-tzselect.ksh.patch b/meta/recipes-core/glibc/glibc/0023-timezone-Make-shell-interpreter-overridable-in-tzsel.patch
index 0480c47b49..e5e6ceba60 100644
--- a/meta/recipes-core/glibc/glibc/0001-Make-shell-interpreter-overridable-in-tzselect.ksh.patch
+++ b/meta/recipes-core/glibc/glibc/0023-timezone-Make-shell-interpreter-overridable-in-tzsel.patch
@@ -1,7 +1,7 @@
1From 76d170fbbfd07b26a0288212201e5d15558db36f Mon Sep 17 00:00:00 2001 1From c0f251c58655e3377fe1c67a026c21ef68d2abcf Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 9 Dec 2021 15:14:42 -0800 3Date: Thu, 9 Dec 2021 15:14:42 -0800
4Subject: [PATCH] Make shell interpreter overridable in tzselect.ksh 4Subject: [PATCH] timezone: Make shell interpreter overridable in tzselect.ksh
5 5
6define new macro called KSHELL which can be used to define default shell 6define new macro called KSHELL which can be used to define default shell
7use Bash by default 7use Bash by default
@@ -14,10 +14,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
14 2 files changed, 10 insertions(+) 14 2 files changed, 10 insertions(+)
15 15
16diff --git a/Makeconfig b/Makeconfig 16diff --git a/Makeconfig b/Makeconfig
17index 3fa2f13003..a1ea5d5571 100644 17index 775bf12b65..7b9a8f0a94 100644
18--- a/Makeconfig 18--- a/Makeconfig
19+++ b/Makeconfig 19+++ b/Makeconfig
20@@ -292,6 +292,15 @@ ifndef sysincludedir 20@@ -293,6 +293,15 @@ ifndef sysincludedir
21 sysincludedir = /usr/include 21 sysincludedir = /usr/include
22 endif 22 endif
23 23
@@ -45,6 +45,3 @@ index c624a189b3..dc8f5277de 100644
45 < $< > $@.new 45 < $< > $@.new
46 chmod 555 $@.new 46 chmod 555 $@.new
47 mv -f $@.new $@ 47 mv -f $@.new $@
48--
492.34.1
50
diff --git a/meta/recipes-core/glibc/glibc/0026-intl-Emit-no-lines-in-bison-generated-files.patch b/meta/recipes-core/glibc/glibc/0026-intl-Emit-no-lines-in-bison-generated-files.patch
deleted file mode 100644
index 998db39b47..0000000000
--- a/meta/recipes-core/glibc/glibc/0026-intl-Emit-no-lines-in-bison-generated-files.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1From 99ab34278a6ebec134267412b4f619f43e278dea Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 3 Aug 2018 09:44:00 -0700
4Subject: [PATCH] intl: Emit no lines in bison generated files
5
6Improve reproducibility:
7Do not put any #line preprocessor commands in bison generated files.
8These lines contain absolute paths containing file locations on
9the host build machine.
10
11Upstream-Status: Pending
12
13Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15---
16 intl/Makefile | 2 +-
17 1 file changed, 1 insertion(+), 1 deletion(-)
18
19diff --git a/intl/Makefile b/intl/Makefile
20index 93478d87e8..b27a7935eb 100644
21--- a/intl/Makefile
22+++ b/intl/Makefile
23@@ -155,7 +155,7 @@ $(objpfx)tst-gettext6.out: $(objpfx)tst-gettext.out
24
25 CPPFLAGS += -D'LOCALEDIR="$(localedir)"' \
26 -D'LOCALE_ALIAS_PATH="$(localedir)"'
27-BISONFLAGS = --yacc --name-prefix=__gettext --output
28+BISONFLAGS = --yacc --no-lines --name-prefix=__gettext --output
29
30 $(inst_localedir)/locale.alias: locale.alias $(+force)
31 $(do-install)
diff --git a/meta/recipes-core/glibc/glibc/CVE-2021-43396.patch b/meta/recipes-core/glibc/glibc/CVE-2021-43396.patch
deleted file mode 100644
index ebea5efd34..0000000000
--- a/meta/recipes-core/glibc/glibc/CVE-2021-43396.patch
+++ /dev/null
@@ -1,184 +0,0 @@
1From ff012870b2c02a62598c04daa1e54632e020fd7d Mon Sep 17 00:00:00 2001
2From: Nikita Popov <npv1310@gmail.com>
3Date: Tue, 2 Nov 2021 13:21:42 +0500
4Subject: [PATCH] gconv: Do not emit spurious NUL character in ISO-2022-JP-3
5 (bug 28524)
6
7Bugfix 27256 has introduced another issue:
8In conversion from ISO-2022-JP-3 encoding, it is possible
9to force iconv to emit extra NUL character on internal state reset.
10To do this, it is sufficient to feed iconv with escape sequence
11which switches active character set.
12The simplified check 'data->__statep->__count != ASCII_set'
13introduced by the aforementioned bugfix picks that case and
14behaves as if '\0' character has been queued thus emitting it.
15
16To eliminate this issue, these steps are taken:
17* Restore original condition
18'(data->__statep->__count & ~7) != ASCII_set'.
19It is necessary since bits 0-2 may contain
20number of buffered input characters.
21* Check that queued character is not NUL.
22Similar step is taken for main conversion loop.
23
24Bundled test case follows following logic:
25* Try to convert ISO-2022-JP-3 escape sequence
26switching active character set
27* Reset internal state by providing NULL as input buffer
28* Ensure that nothing has been converted.
29
30Signed-off-by: Nikita Popov <npv1310@gmail.com>
31
32CVE: CVE-2021-43396
33Upstream-Status: Backport [ff012870b2c02a62598c04daa1e54632e020fd7d]
34---
35 iconvdata/Makefile | 5 +++-
36 iconvdata/bug-iconv15.c | 60 +++++++++++++++++++++++++++++++++++++++
37 iconvdata/iso-2022-jp-3.c | 28 ++++++++++++------
38 3 files changed, 84 insertions(+), 9 deletions(-)
39 create mode 100644 iconvdata/bug-iconv15.c
40
41Index: git/iconvdata/Makefile
42===================================================================
43--- git.orig/iconvdata/Makefile
44+++ git/iconvdata/Makefile
45@@ -1,4 +1,5 @@
46 # Copyright (C) 1997-2021 Free Software Foundation, Inc.
47+# Copyright (C) The GNU Toolchain Authors.
48 # This file is part of the GNU C Library.
49
50 # The GNU C Library is free software; you can redistribute it and/or
51@@ -74,7 +75,7 @@ ifeq (yes,$(build-shared))
52 tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
53 tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8 bug-iconv9 \
54 bug-iconv10 bug-iconv11 bug-iconv12 tst-iconv-big5-hkscs-to-2ucs4 \
55- bug-iconv13 bug-iconv14
56+ bug-iconv13 bug-iconv14 bug-iconv15
57 ifeq ($(have-thread-library),yes)
58 tests += bug-iconv3
59 endif
60@@ -327,6 +328,8 @@ $(objpfx)bug-iconv12.out: $(addprefix $(
61 $(addprefix $(objpfx),$(modules.so))
62 $(objpfx)bug-iconv14.out: $(addprefix $(objpfx), $(gconv-modules)) \
63 $(addprefix $(objpfx),$(modules.so))
64+$(objpfx)bug-iconv15.out: $(addprefix $(objpfx), $(gconv-modules)) \
65+ $(addprefix $(objpfx),$(modules.so))
66
67 $(objpfx)iconv-test.out: run-iconv-test.sh \
68 $(addprefix $(objpfx), $(gconv-modules)) \
69Index: git/iconvdata/bug-iconv15.c
70===================================================================
71--- /dev/null
72+++ git/iconvdata/bug-iconv15.c
73@@ -0,0 +1,60 @@
74+/* Bug 28524: Conversion from ISO-2022-JP-3 with iconv
75+ may emit spurious NUL character on state reset.
76+ Copyright (C) The GNU Toolchain Authors.
77+ This file is part of the GNU C Library.
78+
79+ The GNU C Library is free software; you can redistribute it and/or
80+ modify it under the terms of the GNU Lesser General Public
81+ License as published by the Free Software Foundation; either
82+ version 2.1 of the License, or (at your option) any later version.
83+
84+ The GNU C Library is distributed in the hope that it will be useful,
85+ but WITHOUT ANY WARRANTY; without even the implied warranty of
86+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
87+ Lesser General Public License for more details.
88+
89+ You should have received a copy of the GNU Lesser General Public
90+ License along with the GNU C Library; if not, see
91+ <https://www.gnu.org/licenses/>. */
92+
93+#include <stddef.h>
94+#include <iconv.h>
95+#include <support/check.h>
96+
97+static int
98+do_test (void)
99+{
100+ char in[] = "\x1b(I";
101+ char *inbuf = in;
102+ size_t inleft = sizeof (in) - 1;
103+ char out[1];
104+ char *outbuf = out;
105+ size_t outleft = sizeof (out);
106+ iconv_t cd;
107+
108+ cd = iconv_open ("UTF8", "ISO-2022-JP-3");
109+ TEST_VERIFY_EXIT (cd != (iconv_t) -1);
110+
111+ /* First call to iconv should alter internal state.
112+ Now, JISX0201_Kana_set is selected and
113+ state value != ASCII_set. */
114+ TEST_VERIFY (iconv (cd, &inbuf, &inleft, &outbuf, &outleft) != (size_t) -1);
115+
116+ /* No bytes should have been added to
117+ the output buffer at this point. */
118+ TEST_VERIFY (outbuf == out);
119+ TEST_VERIFY (outleft == sizeof (out));
120+
121+ /* Second call shall emit spurious NUL character in unpatched glibc. */
122+ TEST_VERIFY (iconv (cd, NULL, NULL, &outbuf, &outleft) != (size_t) -1);
123+
124+ /* No characters are expected to be produced. */
125+ TEST_VERIFY (outbuf == out);
126+ TEST_VERIFY (outleft == sizeof (out));
127+
128+ TEST_VERIFY_EXIT (iconv_close (cd) != -1);
129+
130+ return 0;
131+}
132+
133+#include <support/test-driver.c>
134Index: git/iconvdata/iso-2022-jp-3.c
135===================================================================
136--- git.orig/iconvdata/iso-2022-jp-3.c
137+++ git/iconvdata/iso-2022-jp-3.c
138@@ -1,5 +1,6 @@
139 /* Conversion module for ISO-2022-JP-3.
140 Copyright (C) 1998-2021 Free Software Foundation, Inc.
141+ Copyright (C) The GNU Toolchain Authors.
142 This file is part of the GNU C Library.
143 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998,
144 and Bruno Haible <bruno@clisp.org>, 2002.
145@@ -81,20 +82,31 @@ enum
146 the output state to the initial state. This has to be done during the
147 flushing. */
148 #define EMIT_SHIFT_TO_INIT \
149- if (data->__statep->__count != ASCII_set) \
150+ if ((data->__statep->__count & ~7) != ASCII_set) \
151 { \
152 if (FROM_DIRECTION) \
153 { \
154- if (__glibc_likely (outbuf + 4 <= outend)) \
155+ uint32_t ch = data->__statep->__count >> 6; \
156+ \
157+ if (__glibc_unlikely (ch != 0)) \
158 { \
159- /* Write out the last character. */ \
160- *((uint32_t *) outbuf) = data->__statep->__count >> 6; \
161- outbuf += sizeof (uint32_t); \
162- data->__statep->__count = ASCII_set; \
163+ if (__glibc_likely (outbuf + 4 <= outend)) \
164+ { \
165+ /* Write out the last character. */ \
166+ put32u (outbuf, ch); \
167+ outbuf += 4; \
168+ data->__statep->__count &= 7; \
169+ data->__statep->__count |= ASCII_set; \
170+ } \
171+ else \
172+ /* We don't have enough room in the output buffer. */ \
173+ status = __GCONV_FULL_OUTPUT; \
174 } \
175 else \
176- /* We don't have enough room in the output buffer. */ \
177- status = __GCONV_FULL_OUTPUT; \
178+ { \
179+ data->__statep->__count &= 7; \
180+ data->__statep->__count |= ASCII_set; \
181+ } \
182 } \
183 else \
184 { \
diff --git a/meta/recipes-core/glibc/glibc_2.34.bb b/meta/recipes-core/glibc/glibc_2.35.bb
index 67464d6ce0..2903a4001f 100644
--- a/meta/recipes-core/glibc/glibc_2.34.bb
+++ b/meta/recipes-core/glibc/glibc_2.35.bb
@@ -34,32 +34,19 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
34 file://makedbs.sh \ 34 file://makedbs.sh \
35 \ 35 \
36 ${NATIVESDKFIXES} \ 36 ${NATIVESDKFIXES} \
37 file://0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch \ 37 file://0009-yes-within-the-path-sets-wrong-config-variables.patch \
38 file://0016-yes-within-the-path-sets-wrong-config-variables.patch \ 38 file://0010-eglibc-Cross-building-and-testing-instructions.patch \
39 file://0018-Remove-bash-dependency-for-nscd-init-script.patch \ 39 file://0011-eglibc-Help-bootstrap-cross-toolchain.patch \
40 file://0019-eglibc-Cross-building-and-testing-instructions.patch \ 40 file://0012-eglibc-Resolve-__fpscr_values-on-SH4.patch \
41 file://0020-eglibc-Help-bootstrap-cross-toolchain.patch \ 41 file://0013-eglibc-Forward-port-cross-locale-generation-support.patch \
42 file://0021-eglibc-Resolve-__fpscr_values-on-SH4.patch \ 42 file://0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
43 file://0022-eglibc-Forward-port-cross-locale-generation-support.patch \ 43 file://0016-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch \
44 file://0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ 44 file://0017-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \
45 file://0026-intl-Emit-no-lines-in-bison-generated-files.patch \ 45 file://0018-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch \
46 file://0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch \ 46 file://0019-powerpc-Do-not-ask-compiler-for-finding-arch.patch \
47 file://0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \ 47 file://0021-Replace-echo-with-printf-builtin-in-nscd-init-script.patch \
48 file://0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch \ 48 file://0022-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch \
49 file://0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch \ 49 file://0023-timezone-Make-shell-interpreter-overridable-in-tzsel.patch \
50 file://0001-CVE-2021-38604.patch \
51 file://0002-CVE-2021-38604.patch \
52 file://0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \
53 file://CVE-2021-43396.patch \
54 file://0001-Make-shell-interpreter-overridable-in-tzselect.ksh.patch \
55 file://0001-CVE-2022-23218.patch \
56 file://0002-CVE-2022-23218.patch \
57 file://0001-CVE-2022-23219.patch \
58 file://0002-CVE-2022-23219.patch \
59 file://0001-CVE-2021-3998.patch \
60 file://0002-CVE-2021-3998.patch \
61 file://0001-CVE-2021-3999.patch \
62 file://0002-CVE-2021-3999.patch \
63 " 50 "
64S = "${WORKDIR}/git" 51S = "${WORKDIR}/git"
65B = "${WORKDIR}/build-${TARGET_SYS}" 52B = "${WORKDIR}/build-${TARGET_SYS}"