poky: subtree update:2834c2f853..17aabc0127

Adam Romanek (3):
      bitbake: fetch/git: run gc in foreground to avoid race with tar
      bitbake: fetch2/s3: allow to use credentials from environment variables
      own-mirrors: Add support for s3:// scheme in SOURCE_MIRROR_URL

Alexander Kanavin (44):
      devtool upgrade: rebase override-only patches as well
      cmake: update 3.20.3 -> 3.20.4
      gnu-config: update to latest revision
      bash: update 5.1 -> 5.1.8
      dnf: updatee 4.7.0 -> 4.8.0
      vulkan-samples: update to latest revision
      bind: upgrade 9.16.16 -> 9.16.18
      bluez5: upgrade 5.58 -> 5.59
      dejagnu: upgrade 1.6.2 -> 1.6.3
      libdnf: upgrade 0.63.0 -> 0.63.1
      libpcre: upgrade 8.44 -> 8.45
      libxi: upgrade 1.7.10 -> 1.7.99.2
      mtools: upgrade 4.0.29 -> 4.0.31
      python3-git: upgrade 3.1.17 -> 3.1.18
      sqlite3: upgrade 3.35.5 -> 3.36.0
      vte: upgrade 0.64.1 -> 0.64.2
      x264: upgrade to latest revision
      python3: apply test skipping patch unconditionally
      pypi: set SRC_URI with _prepend, not with +=
      man-pages: upgrade 5.11 -> 5.12
      rt-tests: update 1.10 -> 2.1
      python3-iniparse: update 0.4 -> 0.5
      iputils: correct upstream version check
      texinfo: update 6.7 -> 6.8
      xserver-xorg: exclude development snapshots from upstream version checks
      xwayland: exclude development snapshots from upstream version checks
      devtool: correctly handle non-standard source tree locations in upgrades
      llvm: make upgradable via devtool
      xserver-xorg: update 1.20.11 -> 1.20.12
      libmodulemd: update 2.12.1 -> 2.13.0
      bluez5: upgrade 5.59 -> 5.60
      createrepo-c: upgrade 0.17.3 -> 0.17.4
      ethtool: upgrade 5.12 -> 5.13
      gtk+3: upgrade 3.24.29 -> 3.24.30
      harfbuzz: upgrade 2.8.1 -> 2.8.2
      iproute2: upgrade 5.12.0 -> 5.13.0
      libgit2: upgrade 1.1.0 -> 1.1.1
      mpg123: upgrade 1.28.0 -> 1.28.2
      mtools: upgrade 4.0.31 -> 4.0.32
      ruby: upgrade 3.0.1 -> 3.0.2
      stress-ng: upgrade 0.12.11 -> 0.12.12
      webkitgtk: upgrade 2.32.1 -> 2.32.2
      xwayland: upgrade 21.1.1 -> 21.1.2
      tcl: fix upstream version check

Alexey Brodkin (3):
      dpkg: Add ARC support
      default-distrovars.inc: Remove seccomp for ARC
      dhcpcd: add ARC support

Andreas Müller (4):
      libdrm: upgrade 2.4.106 -> 2.4.107
      mesa: upgrade 21.1.3 -> 21.1.4
      pango: upgrade 1.48.5 -> 1.48.7
      mesa: upgrade 21.1.4 -> 21.1.5

Andrej Valek (1):
      busybox: add tmpdir option into mktemp applet

Armin Kuster (1):
      maintainers.inc: remove myself as a Maintainer

Asfak Rahman (1):
      openssh: Remove temporary keys before generating new ones

Bruce Ashfield (24):
      linux-yocto/5.10: update to v5.10.46
      linux-yocto/5.10: features/nft_tables: refresh config options
      linux-yocto/5.4: update to v5.4.128
      linux-yocto/5.10: rcu: Fix stall-warning deadlock due to non-release of rcu_node ->lock
      linux-yocto/5.10: update to v5.10.47
      linux-yocto/5.4: update to v5.4.129
      linux-yocto/5.10: scsi-debug needs scsi-disk
      linux-libc-headers: update to 5.13
      kernel-devsrc: fix scripts/prepare for ARM64
      kernel-devsrc: fix scripts prepare for powerpc
      kernel-devsrc: powerpc64 add scripts prepare support
      linux-yocto: introduce 5.13 recipes
      linux-yocto/5.13: add devupstream support
      linux-yocto-rt/5.13: integrate -rt1
      linux-yocto: add vfat KERNEL_FEATURE when MACHINE_FEATURES include vfat
      linux-yocto/5.10: update to v5.10.49
      linux-yocto/5.4: update to v5.4.131
      linux-yocto/5.13: update to v5.13.2
      linux-yocto/5.10: update to v5.10.50
      linux-yocto/5.4: update to v5.4.132
      linux-yocto/5.13: update to v5.13.3
      linux-yocto/5.13: update to v5.13.4
      linux-yocto/5.10: update to v5.10.52
      linux-yocto/5.4: update to v5.4.134

Changhyeok Bae (1):
      iputils: Update to 20210202

Changqing Li (1):
      boost-build-native: workaround one rarely hang problem on fedora34

Christoph Muellner (1):
      ldconfig-native: Add RISC-V support

Damian Wrobel (1):
      gobject-introspection: Fix the license (add MIT)

Denys Dmytriyenko (1):
      bitbake: providers: replace newly added logger.warn() with logger.warning()

Fabio Berton (1):
      lib/oe/package_manager: Don't ignore installation failures in install_complementary

Florian Amstutz (1):
      devtool: deploy-target: Fix preserving attributes when using --strip

Jose Quaresma (3):
      glslang: upgrade 11.4.0 -> 11.5.0
      shaderc: upgrade 2021.0 -> 2021.1
      spirv-tools: upgrade 2021.1 -> 2021.2

Joshua Watt (3):
      ref-manual: Document BUILDHISTORY_PATH_PREFIX_STRIP
      bitbake: bitbake: Add piping compression library
      bitbake: server: Fix early parsing errors preventing zombie bitbake

Khem Raj (7):
      glib-2.0: Fix signature of close_range
      gnome-desktop-testing: Fix non-literal format string warning
      util-linux: Disable chfn-chsh on non-target builds
      libseccomp: Update to main branch
      systemd: Fix libseccomp testcase involving __NR_ppoll
      util-linux: Fix signature of close_range()
      gpgme: Use glibc provided closefrom API when available

Lee Chee Yang (1):
      qemu: fix CVE-2021-3527

Marek Vasut (2):
      pulseaudio: Drop pulseaudio-conf
      update-rc.d: update SRCREV to pull in fix for non-bash shell support

Mark Hatle (1):
      populate_sdk_ext: Error if trying to generate an eSDK from a mulitconfig

Max Krummenacher (1):
      xwayland: port packageconfig from xserver-xorg recipe

Michael Halstead (1):
      releases: update to include 3.1.9

Michael Ho (1):
      sstate.bbclass: fix errors about read-only sstate mirrors

Mike Crowe (1):
      licence_image: Add lic-pkgs IMAGE_FEATURE

Mingli Yu (4):
      pulseaudio: check if NEON code can be compiled on arm
      perlcross: check the file if patched or not
      perl: correct libpth and glibpth
      parselogs.py: ignore rndr initialization failure

Patrick Williams (1):
      docs: remove image-mklibs references

Paul Barker (1):
      linux-yocto: Fix devupstream SRCREV assignment

Peter Bergin (1):
      Revert "libubootenv: inherit uboot-config"

Quentin Schulz (1):
      docs: replace remaining ``FOO`` by :term:`FOO`

Ralph Siemsen (1):
      oeqa/manual/toaster: fix small typo

Richard Purdie (26):
      package_pkgdata: Avoid task hash mismatches for generic task changes
      selftest/fetch: Avoid occasional selftest failure from poor temp file name choice
      kernel: Fix interaction when packaging disabled
      kernel-devicetree: Fix interaction when packaging disabled
      python3-pip/python3-pbr: Drop obsolete md5sum at upgrade
      oeqa/selftest/runcmd: Tweal test timeouts
      bash: Fix a rare make race build failure
      sstate/staging: Handle directory creation race issue
      oeqa/selftest/archiver: Allow tests to ignore empty directories
      dwarfsrcfiles: Avoid races over debug-link files
      oeqa/selftest/multiprocesslauch: Fix test race
      runqemu: Remove potential lock races around tap device handling
      glibc-testsuite: Fix build failures when directly running recipe
      license: Drop adding RRECOMMENDS for license packages
      report-error: Drop pointless inherit
      pseudo: Add uninative configuration sanity check
      pseudo: Update to latest version including statx fix
      sstate: Drop pseudo exclusion
      oeqa/qemurunner: Handle files no longer existing gracefully
      python3: Add a fix for a make install race
      Add README link to README.poky
      README.OE-Core/README.qemu: Move to markdown format
      bitbake: data_smart/parse: Allow ':' characters in variable/function names
      zstd: Include pzstd in the build
      buildtools-tarball: Add lz4 and ztsd (including pzstd)
      build-appliance-image: Update to master head revision

Ross Burton (29):
      glibc: backport MTE improvements from master
      glibc: re-enable memory tagging
      libgudev: fix SRC_URI
      cantarell-fonts: fix SRC_URI
      shadow: generate alternative links for chfn and chsh
      util-linux: build chfn and chsh
      util-linux: add missing ptest dependencies
      util-linux: backport test suite fixes
      util-linux: rewrite the ptest integration
      glib-2.0: fix g-file-into modification time test
      oeqa/selftest/recipetool: update socat version to fix failing download
      parted: improve ptest execution
      tcl: suffix all Tcl man pages instead of using alternatives
      tcl: EXTRA_OECONF already passes --libdir, don't do it again
      tcl: mark a patch as upstreamable
      tcl: use tcl-core instead of patching out packages
      tcl: use AUTOTOOLS_SCRIPT_PATH
      tcl: remove redundant file creation
      tcl: detect tests that error as well as fail
      tcl: clock.test needs a timezone to be set
      tcl: fix race in interp.test
      parted: remove obsolete patch
      parted: fix ptest RRECOMMENDS
      busybox: support mounting swap via labels
      meta: remove redundant ${libdir}/cmake from FILES_${PN}-dev
      cups: update to 2.3.3op2
      parted: skip tests that need vfat support
      avahi: fix CVE-2021-36217, crash on pinging '.local'
      parted: add device mappper PACKAGECONFIG

Sakib Sajal (3):
      buildstats.bbclass: log host data on failure to task specific file
      oe-time-dd-test.sh: add options and refactor
      scripts/oe-time-dd-test.sh: run "uptime" on each iteration

Saul Wold (4):
      qemurunner: Add info log for qemu startup
      oeqa/qemurunner: add support qmp cmd args
      oeqa/dump.py: Add support for QMP command arguments
      testimage.bbclass: Add dump-guest-memory cmd

Scott Weaver (1):
      meta-skeleton: update to satisfy yocto-check-layer tests

Tim Orling (6):
      python3-importlib-metadata: upgrade 4.5.0 -> 4.6.0
      python3-packaging: upgrade 20.9 -> 21.0
      python3-hypothesis: upgrade 6.14.0 -> 6.14.1
      python3-zipp: upgrade 3.4.1 -> 3.5.0
      at-spi2-core: upgrade 2.40.2 -> 2.40.3
      python3-hypothesis: upgrade 6.14.1 -> 6.14.3

Tony Tascioglu (1):
      valgrind: skip flaky ptest fb_test_amd64

Trevor Gamblin (2):
      python3-pip: upgrade 20.0.2 -> 21.1.2
      python3-pip: add multiprocessing to RDEPENDS

Yi Zhao (1):
      libffi: disable use of static exec trampolines

Zoltán Böszörményi (1):
      tzdata: Allow controlling zoneinfo binary format

Zqiang (1):
      ifupdown: Skip wrong test item

bkylerussell@gmail.com (1):
      gstreamer: add libgst packages to PACKAGES_DYNAMIC

jbouchard (1):
      Use the label provided when formating a dos partition

wangmy (19):
      libcap: upgrade 2.50 -> 2.51
      libhandy: upgrade 1.2.2 -> 1.2.3
      libva: upgrade 2.11.0 -> 2.12.0
      libxcrypt: upgrade 4.4.22 -> 4.4.23
      python3-numpy: upgrade 1.20.3 -> 1.21.0
      python3-pbr: upgrade 5.4.4 -> 5.6.0
      cmake: upgrade 3.20.4 -> 3.20.5
      gpgme: upgrade 1.15.1 -> 1.16.0
      libglu: upgrade 9.0.1 -> 9.0.2
      stress-ng: upgrade 0.12.10 -> 0.12.11
      xf86-input-libinput: upgrade 1.0.1 -> 1.1.0
      vulkan-headers: upgrade 1.2.176 -> 1.2.182
      vulkan-loader: upgrade 1.2.176 -> 1.2.182
      vulkan-tools: upgrade 1.2.176 -> 1.2.182
      gnome-desktop-testing: upgrade 2018.1 -> 2021.1
      python3-importlib-metadata: upgrade 4.6.0 -> 4.6.1
      u-boot: upgrade 2021.04 -> 2021.07
      python3-setuptools: upgrade 57.0.0 -> 57.1.0
      btrfs-tools: upgrade 5.12.1 -> 5.13

zangrc (1):
      python3-pip: upgrade 21.1.2 -> 21.1.3

zhengruoqin (3):
      libffi: upgrade 3.3 -> 3.4.2
      python3: upgrade 3.9.5 -> 3.9.6
      python3-pathlib2: upgrade 2.3.5 -> 2.3.6

Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: If493204235c3a1ce4e7fe65438168512d17a900e
diff --git a/poky/meta/recipes-core/busybox/busybox/0001-mktemp-add-tmpdir-option.patch b/poky/meta/recipes-core/busybox/busybox/0001-mktemp-add-tmpdir-option.patch
new file mode 100644
index 0000000..4a1960d
--- /dev/null
+++ b/poky/meta/recipes-core/busybox/busybox/0001-mktemp-add-tmpdir-option.patch
@@ -0,0 +1,81 @@
+From ceb378209f953ea745ed93a8645567196380ce3c Mon Sep 17 00:00:00 2001
+From: Andrej Valek <andrej.valek@siemens.com>
+Date: Thu, 24 Jun 2021 19:13:22 +0200
+Subject: [PATCH] mktemp: add tmpdir option
+
+Make mktemp more compatible with coreutils.
+- add "--tmpdir" option
+- add long variants for "d,q,u" options
+
+Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2021-June/088932.html]
+
+Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
+Signed-off-by: Peter Marko <peter.marko@siemens.com>
+---
+ coreutils/mktemp.c | 26 ++++++++++++++++++--------
+ 1 file changed, 18 insertions(+), 8 deletions(-)
+
+diff --git a/coreutils/mktemp.c b/coreutils/mktemp.c
+index 5393320a5..05c6d98c6 100644
+--- a/coreutils/mktemp.c
++++ b/coreutils/mktemp.c
+@@ -39,16 +39,17 @@
+ //kbuild:lib-$(CONFIG_MKTEMP) += mktemp.o
+ 
+ //usage:#define mktemp_trivial_usage
+-//usage:       "[-dt] [-p DIR] [TEMPLATE]"
++//usage:       "[-dt] [-p DIR, --tmpdir[=DIR]] [TEMPLATE]"
+ //usage:#define mktemp_full_usage "\n\n"
+ //usage:       "Create a temporary file with name based on TEMPLATE and print its name.\n"
+ //usage:       "TEMPLATE must end with XXXXXX (e.g. [/dir/]nameXXXXXX).\n"
+ //usage:       "Without TEMPLATE, -t tmp.XXXXXX is assumed.\n"
+-//usage:     "\n	-d	Make directory, not file"
+-//usage:     "\n	-q	Fail silently on errors"
+-//usage:     "\n	-t	Prepend base directory name to TEMPLATE"
+-//usage:     "\n	-p DIR	Use DIR as a base directory (implies -t)"
+-//usage:     "\n	-u	Do not create anything; print a name"
++//usage:     "\n	-d			Make directory, not file"
++//usage:     "\n	-q			Fail silently on errors"
++//usage:     "\n	-t			Prepend base directory name to TEMPLATE"
++//usage:     "\n	-p DIR, --tmpdir[=DIR]	Use DIR as a base directory (implies -t)"
++//usage:     "\n				For --tmpdir is a optional one."
++//usage:     "\n	-u			Do not create anything; print a name"
+ //usage:     "\n"
+ //usage:     "\nBase directory is: -p DIR, else $TMPDIR, else /tmp"
+ //usage:
+@@ -72,13 +73,22 @@ int mktemp_main(int argc UNUSED_PARAM, char **argv)
+ 		OPT_t = 1 << 2,
+ 		OPT_p = 1 << 3,
+ 		OPT_u = 1 << 4,
++		OPT_td = 1 << 5,
+ 	};
+ 
+ 	path = getenv("TMPDIR");
+ 	if (!path || path[0] == '\0')
+ 		path = "/tmp";
+ 
+-	opts = getopt32(argv, "^" "dqtp:u" "\0" "?1"/*1 arg max*/, &path);
++	opts = getopt32long(argv, "^"
++	       "dqtp:u\0"
++	       "?1" /* 1 arg max */,
++	       "directory\0" No_argument       "d"
++	       "quiet\0"     No_argument       "q"
++	       "dry-run\0"   No_argument       "u"
++	       "tmpdir\0"    Optional_argument "\xff"
++	       , &path, &path
++	);
+ 
+ 	chp = argv[optind];
+ 	if (!chp) {
+@@ -95,7 +105,7 @@ int mktemp_main(int argc UNUSED_PARAM, char **argv)
+ 		goto error;
+ 	}
+ #endif
+-	if (opts & (OPT_t|OPT_p))
++	if (opts & (OPT_t|OPT_p|OPT_td))
+ 		chp = concat_path_file(path, chp);
+ 
+ 	if (opts & OPT_u) {
+-- 
+2.11.0
+
diff --git a/poky/meta/recipes-core/busybox/busybox/mount-via-label.cfg b/poky/meta/recipes-core/busybox/busybox/mount-via-label.cfg
index 2fe7ab2..5a285de 100644
--- a/poky/meta/recipes-core/busybox/busybox/mount-via-label.cfg
+++ b/poky/meta/recipes-core/busybox/busybox/mount-via-label.cfg
@@ -1,9 +1,11 @@
 CONFIG_BLKID=y
 CONFIG_FEATURE_BLKID_TYPE=y
 CONFIG_FEATURE_MOUNT_LABEL=y
+CONFIG_FEATURE_SWAPONOFF_LABEL=y
 CONFIG_VOLUMEID=y
 CONFIG_FEATURE_VOLUMEID_BTRFS=y
 CONFIG_FEATURE_VOLUMEID_EXT=y
 CONFIG_FEATURE_VOLUMEID_F2FS=y
 CONFIG_FEATURE_VOLUMEID_FAT=y
 CONFIG_FEATURE_VOLUMEID_SQUASHFS=y
+CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y
diff --git a/poky/meta/recipes-core/busybox/busybox_1.33.1.bb b/poky/meta/recipes-core/busybox/busybox_1.33.1.bb
index a71ff53..4c2bc11 100644
--- a/poky/meta/recipes-core/busybox/busybox_1.33.1.bb
+++ b/poky/meta/recipes-core/busybox/busybox_1.33.1.bb
@@ -38,6 +38,8 @@
            ${@["", "file://mdev.cfg"][(d.getVar('VIRTUAL-RUNTIME_dev_manager') == 'busybox-mdev')]} \
            file://syslog.cfg \
            file://unicode.cfg \
+           file://rev.cfg \
+           file://pgrep.cfg \
            file://rcS \
            file://rcK \
            file://makefile-libbb-race.patch \
@@ -45,9 +47,8 @@
            file://0001-testsuite-use-www.example.org-for-wget-test-cases.patch \
            file://0001-du-l-works-fix-to-use-145-instead-of-144.patch \
            file://0001-sysctl-ignore-EIO-of-stable_secret-below-proc-sys-ne.patch \
-           file://rev.cfg \
-           file://pgrep.cfg \
            file://0001-gen_build_files-Use-C-locale-when-calling-sed-on-glo.patch \
+           file://0001-mktemp-add-tmpdir-option.patch \
            "
 SRC_URI_append_libc-musl = " file://musl.cfg "
 
diff --git a/poky/meta/recipes-core/dbus/dbus_1.12.20.bb b/poky/meta/recipes-core/dbus/dbus_1.12.20.bb
index 32e7d9c..2f6da67 100644
--- a/poky/meta/recipes-core/dbus/dbus_1.12.20.bb
+++ b/poky/meta/recipes-core/dbus/dbus_1.12.20.bb
@@ -71,7 +71,7 @@
 "
 FILES_${PN}-lib = "${libdir}/lib*.so.*"
 RRECOMMENDS_${PN}-lib = "${PN}"
-FILES_${PN}-dev += "${libdir}/dbus-1.0/include ${libdir}/cmake/DBus1 ${bindir}/dbus-test-tool ${datadir}/xml/dbus-1"
+FILES_${PN}-dev += "${libdir}/dbus-1.0/include ${bindir}/dbus-test-tool ${datadir}/xml/dbus-1"
 
 PACKAGE_WRITE_DEPS += "${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','systemd-systemctl-native','',d)}"
 pkg_postinst_dbus() {
diff --git a/poky/meta/recipes-core/glib-2.0/glib-2.0/0001-correctly-use-3-parameters-for-close_range.patch b/poky/meta/recipes-core/glib-2.0/glib-2.0/0001-correctly-use-3-parameters-for-close_range.patch
new file mode 100644
index 0000000..6ff25fc
--- /dev/null
+++ b/poky/meta/recipes-core/glib-2.0/glib-2.0/0001-correctly-use-3-parameters-for-close_range.patch
@@ -0,0 +1,29 @@
+From b71117d89434db83d34bc1b981ca03d4be299576 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 8 Jul 2021 17:26:43 -0700
+Subject: [PATCH] correctly use 3 parameters for close_range
+
+libc implementation has 3 parameter e.g.
+https://www.freebsd.org/cgi/man.cgi?query=close_range&sektion=2&format=html
+
+Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2180]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ glib/gspawn.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/glib/gspawn.c b/glib/gspawn.c
+index 899647c2f..3073a10a4 100644
+--- a/glib/gspawn.c
++++ b/glib/gspawn.c
+@@ -1520,7 +1520,7 @@ safe_closefrom (int lowfd)
+    *
+    * Handle ENOSYS in case it’s supported in libc but not the kernel; if so,
+    * fall back to safe_fdwalk(). */
+-  if (close_range (lowfd, G_MAXUINT) != 0 && errno == ENOSYS)
++  if (close_range (lowfd, G_MAXUINT, 0) != 0 && errno == ENOSYS)
+ #endif  /* HAVE_CLOSE_RANGE */
+   (void) safe_fdwalk (close_func, GINT_TO_POINTER (lowfd));
+ #endif
+--
+2.32.0
diff --git a/poky/meta/recipes-core/glib-2.0/glib-2.0/time-test.patch b/poky/meta/recipes-core/glib-2.0/glib-2.0/time-test.patch
new file mode 100644
index 0000000..4d7ef97
--- /dev/null
+++ b/poky/meta/recipes-core/glib-2.0/glib-2.0/time-test.patch
@@ -0,0 +1,40 @@
+Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2177]
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+
+From 289f8be1b397a453cfcf35641455f3ae5fb4faeb Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@arm.com>
+Date: Tue, 6 Jul 2021 19:26:03 +0100
+Subject: [PATCH] gio/tests/g-file-info: don't assume million-in-one events
+ don't happen
+
+The modification time test creates a file, gets the modification time in
+seconds, then gets the modification time in microseconds and assumes
+that the difference between the two has to be above 0.
+
+As rare as this may be, it can happen:
+
+$ stat g-file-info-test-50A450 -c %y
+2021-07-06 18:24:56.000000767 +0100
+
+Change the test to simply assert that the difference not negative to
+handle this case.
+---
+ gio/tests/g-file-info.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gio/tests/g-file-info.c b/gio/tests/g-file-info.c
+index c11c50462..fd0c64b55 100644
+--- a/gio/tests/g-file-info.c
++++ b/gio/tests/g-file-info.c
+@@ -178,7 +178,7 @@ test_g_file_info_modification_time (void)
+   g_assert_nonnull (dt_usecs);
+ 
+   ts = g_date_time_difference (dt_usecs, dt);
+-  g_assert_cmpint (ts, >, 0);
++  g_assert_cmpint (ts, >=, 0);
+   g_assert_cmpint (ts, <, G_USEC_PER_SEC);
+ 
+   /* Try round-tripping the modification time. */
+-- 
+2.25.1
+
diff --git a/poky/meta/recipes-core/glib-2.0/glib-2.0_2.68.3.bb b/poky/meta/recipes-core/glib-2.0/glib-2.0_2.68.3.bb
index 2a3a00f..cbce6ea 100644
--- a/poky/meta/recipes-core/glib-2.0/glib-2.0_2.68.3.bb
+++ b/poky/meta/recipes-core/glib-2.0/glib-2.0_2.68.3.bb
@@ -17,6 +17,8 @@
            file://0001-meson-Run-atomics-test-on-clang-as-well.patch \
            file://0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch \
            file://0001-gio-tests-codegen.py-bump-timeout-to-100-seconds.patch \
+           file://time-test.patch \
+           file://0001-correctly-use-3-parameters-for-close_range.patch \
            "
 SRC_URI_append_class-native = " file://relocate-modules.patch"
 
diff --git a/poky/meta/recipes-core/glibc/glibc-testsuite_2.33.bb b/poky/meta/recipes-core/glibc/glibc-testsuite_2.33.bb
index d887aef..659d313 100644
--- a/poky/meta/recipes-core/glibc/glibc-testsuite_2.33.bb
+++ b/poky/meta/recipes-core/glibc/glibc-testsuite_2.33.bb
@@ -61,3 +61,4 @@
 inherit nopackages
 deltask do_stash_locale
 deltask do_install
+deltask do_populate_sysroot
diff --git a/poky/meta/recipes-core/glibc/glibc/mte-backports.patch b/poky/meta/recipes-core/glibc/glibc/mte-backports.patch
new file mode 100644
index 0000000..d9604fd
--- /dev/null
+++ b/poky/meta/recipes-core/glibc/glibc/mte-backports.patch
@@ -0,0 +1,1238 @@
+Backport a number of patches from master to improve Arm MTE support.
+
+Upstream-Status: Backport [will be in 2.34]
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+
+From 2643466c2928a93de7b80a61f6a8f61a653862e1 Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <szabolcs.nagy@arm.com>
+Date: Thu, 11 Mar 2021 14:09:56 +0000
+Subject: [PATCH 01/11] malloc: Fix a potential realloc issue with memory
+ tagging
+
+At an _int_free call site in realloc the wrong size was used for tag
+clearing: the chunk header of the next chunk was also cleared which
+in practice may work, but logically wrong.
+
+The tag clearing is moved before the memcpy to save a tag computation,
+this avoids a chunk2mem.  Another chunk2mem is removed because newmem
+does not have to be recomputed. Whitespaces got fixed too.
+
+Reviewed-by: DJ Delorie <dj@redhat.com>
+---
+ malloc/malloc.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index 8f8f12c276..51cec67e55 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -4851,14 +4851,14 @@ _int_realloc(mstate av, mchunkptr oldp, INTERNAL_SIZE_T oldsize,
+             }
+           else
+             {
+-	      void *oldmem = chunk2mem (oldp);
++	      void *oldmem = chunk2rawmem (oldp);
++	      size_t sz = CHUNK_AVAILABLE_SIZE (oldp) - CHUNK_HDR_SZ;
++	      (void) TAG_REGION (oldmem, sz);
+ 	      newmem = TAG_NEW_USABLE (newmem);
+-	      memcpy (newmem, oldmem,
+-		      CHUNK_AVAILABLE_SIZE (oldp) - CHUNK_HDR_SZ);
+-	      (void) TAG_REGION (chunk2rawmem (oldp), oldsize);
+-              _int_free (av, oldp, 1);
+-              check_inuse_chunk (av, newp);
+-              return chunk2mem (newp);
++	      memcpy (newmem, oldmem, sz);
++	      _int_free (av, oldp, 1);
++	      check_inuse_chunk (av, newp);
++	      return newmem;
+             }
+         }
+     }
+-- 
+2.25.1
+
+
+From 32f3132be063e4b16a5cdb058980af354126e2f4 Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <szabolcs.nagy@arm.com>
+Date: Thu, 28 Jan 2021 17:34:36 +0000
+Subject: [PATCH 02/11] malloc: Move MTAG_MMAP_FLAGS definition
+
+This is only used internally in malloc.c, the extern declaration
+was wrong, __mtag_mmap_flags has internal linkage.
+
+Reviewed-by: DJ Delorie <dj@redhat.com>
+---
+ include/malloc.h | 7 -------
+ malloc/malloc.c  | 2 ++
+ 2 files changed, 2 insertions(+), 7 deletions(-)
+
+diff --git a/include/malloc.h b/include/malloc.h
+index 7ae08d53d3..b77761f74d 100644
+--- a/include/malloc.h
++++ b/include/malloc.h
+@@ -16,11 +16,4 @@ typedef struct malloc_state *mstate;
+ 
+ # endif /* !_ISOMAC */
+ 
+-#ifdef USE_MTAG
+-extern int __mtag_mmap_flags;
+-#define MTAG_MMAP_FLAGS __mtag_mmap_flags
+-#else
+-#define MTAG_MMAP_FLAGS 0
+-#endif
+-
+ #endif
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index 51cec67e55..61c25d0f93 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -463,11 +463,13 @@ static void *(*__tag_region)(void *, size_t) = __default_tag_region;
+ static void *(*__tag_new_usable)(void *) = __default_tag_nop;
+ static void *(*__tag_at)(void *) = __default_tag_nop;
+ 
++# define MTAG_MMAP_FLAGS __mtag_mmap_flags
+ # define TAG_NEW_MEMSET(ptr, val, size) __tag_new_memset (ptr, val, size)
+ # define TAG_REGION(ptr, size) __tag_region (ptr, size)
+ # define TAG_NEW_USABLE(ptr) __tag_new_usable (ptr)
+ # define TAG_AT(ptr) __tag_at (ptr)
+ #else
++# define MTAG_MMAP_FLAGS 0
+ # define TAG_NEW_MEMSET(ptr, val, size) memset (ptr, val, size)
+ # define TAG_REGION(ptr, size) (ptr)
+ # define TAG_NEW_USABLE(ptr) (ptr)
+-- 
+2.25.1
+
+
+From 4b13f77fb97f9618a7868ab767d05e0c2d7c6f6f Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <szabolcs.nagy@arm.com>
+Date: Thu, 4 Feb 2021 11:38:23 +0000
+Subject: [PATCH 03/11] malloc: Simplify __mtag_tag_new_usable
+
+The chunk cannot be a dumped one here.  The only non-obvious cases
+are free and realloc which may be called on a dumped area chunk,
+but in both cases it can be verified that tagging is already
+avoided for dumped area chunks.
+
+Reviewed-by: DJ Delorie <dj@redhat.com>
+---
+ malloc/arena.c | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/malloc/arena.c b/malloc/arena.c
+index bf17be27d4..0777dc70c6 100644
+--- a/malloc/arena.c
++++ b/malloc/arena.c
+@@ -298,11 +298,6 @@ __mtag_tag_new_usable (void *ptr)
+   if (ptr)
+     {
+       mchunkptr cp = mem2chunk(ptr);
+-      /* This likely will never happen, but we can't handle retagging
+-	 chunks from the dumped main arena.  So just return the
+-	 existing pointer.  */
+-      if (DUMPED_MAIN_ARENA_CHUNK (cp))
+-	return ptr;
+       ptr = __libc_mtag_tag_region (__libc_mtag_new_tag (ptr),
+ 				    CHUNK_AVAILABLE_SIZE (cp) - CHUNK_HDR_SZ);
+     }
+-- 
+2.25.1
+
+
+From 4f05837ba6934c5b8bbc6738f8883890493f50b6 Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <szabolcs.nagy@arm.com>
+Date: Thu, 4 Feb 2021 11:52:14 +0000
+Subject: [PATCH 04/11] malloc: Avoid taggig mmaped memory on free
+
+Either the memory belongs to the dumped area, in which case we don't
+want to tag (the dumped area has the same tag as malloc internal data
+so tagging is unnecessary, but chunks there may not have the right
+alignment for the tag granule), or the memory will be unmapped
+immediately (and thus tagging is not useful).
+
+Reviewed-by: DJ Delorie <dj@redhat.com>
+---
+ malloc/malloc.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index 61c25d0f93..ecb87350b0 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -3284,9 +3284,6 @@ __libc_free (void *mem)
+ 
+   p = mem2chunk (mem);
+ 
+-  /* Mark the chunk as belonging to the library again.  */
+-  (void)TAG_REGION (chunk2rawmem (p), CHUNK_AVAILABLE_SIZE (p) - CHUNK_HDR_SZ);
+-
+   if (chunk_is_mmapped (p))                       /* release mmapped memory. */
+     {
+       /* See if the dynamic brk/mmap threshold needs adjusting.
+@@ -3307,6 +3304,10 @@ __libc_free (void *mem)
+     {
+       MAYBE_INIT_TCACHE ();
+ 
++      /* Mark the chunk as belonging to the library again.  */
++      (void)TAG_REGION (chunk2rawmem (p),
++			CHUNK_AVAILABLE_SIZE (p) - CHUNK_HDR_SZ);
++
+       ar_ptr = arena_for_chunk (p);
+       _int_free (ar_ptr, p, 0);
+     }
+-- 
+2.25.1
+
+
+From 673fad3798846101b77a89595cfa17f334a1c898 Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <szabolcs.nagy@arm.com>
+Date: Tue, 16 Feb 2021 14:12:25 +0000
+Subject: [PATCH 05/11] malloc: Refactor TAG_ macros to avoid indirection
+
+This does not change behaviour, just removes one layer of indirection
+in the internal memory tagging logic.
+
+Use tag_ and mtag_ prefixes instead of __tag_ and __mtag_ since these
+are all symbols with internal linkage, private to malloc.c, so there
+is no user namespace pollution issue.
+
+Reviewed-by: DJ Delorie <dj@redhat.com>
+---
+ malloc/arena.c  | 16 +++++-----
+ malloc/hooks.c  | 10 +++---
+ malloc/malloc.c | 81 +++++++++++++++++++++++--------------------------
+ 3 files changed, 51 insertions(+), 56 deletions(-)
+
+diff --git a/malloc/arena.c b/malloc/arena.c
+index 0777dc70c6..d0778fea92 100644
+--- a/malloc/arena.c
++++ b/malloc/arena.c
+@@ -332,12 +332,12 @@ ptmalloc_init (void)
+       if (__MTAG_SBRK_UNTAGGED)
+ 	__morecore = __failing_morecore;
+ 
+-      __mtag_mmap_flags = __MTAG_MMAP_FLAGS;
+-      __tag_new_memset = __mtag_tag_new_memset;
+-      __tag_region = __libc_mtag_tag_region;
+-      __tag_new_usable = __mtag_tag_new_usable;
+-      __tag_at = __libc_mtag_address_get_tag;
+-      __mtag_granule_mask = ~(size_t)(__MTAG_GRANULE_SIZE - 1);
++      mtag_mmap_flags = __MTAG_MMAP_FLAGS;
++      tag_new_memset = __mtag_tag_new_memset;
++      tag_region = __libc_mtag_tag_region;
++      tag_new_usable = __mtag_tag_new_usable;
++      tag_at = __libc_mtag_address_get_tag;
++      mtag_granule_mask = ~(size_t)(__MTAG_GRANULE_SIZE - 1);
+     }
+ #endif
+ 
+@@ -557,7 +557,7 @@ new_heap (size_t size, size_t top_pad)
+             }
+         }
+     }
+-  if (__mprotect (p2, size, MTAG_MMAP_FLAGS | PROT_READ | PROT_WRITE) != 0)
++  if (__mprotect (p2, size, mtag_mmap_flags | PROT_READ | PROT_WRITE) != 0)
+     {
+       __munmap (p2, HEAP_MAX_SIZE);
+       return 0;
+@@ -587,7 +587,7 @@ grow_heap (heap_info *h, long diff)
+     {
+       if (__mprotect ((char *) h + h->mprotect_size,
+                       (unsigned long) new_size - h->mprotect_size,
+-                      MTAG_MMAP_FLAGS | PROT_READ | PROT_WRITE) != 0)
++                      mtag_mmap_flags | PROT_READ | PROT_WRITE) != 0)
+         return -2;
+ 
+       h->mprotect_size = new_size;
+diff --git a/malloc/hooks.c b/malloc/hooks.c
+index efec05f0a8..d8e304c31c 100644
+--- a/malloc/hooks.c
++++ b/malloc/hooks.c
+@@ -68,7 +68,7 @@ __malloc_check_init (void)
+    tags, so fetch the tag at each location before dereferencing
+    it.  */
+ #define SAFE_CHAR_OFFSET(p,offset) \
+-  ((unsigned char *) TAG_AT (((unsigned char *) p) + offset))
++  ((unsigned char *) tag_at (((unsigned char *) p) + offset))
+ 
+ /* A simple, standard set of debugging hooks.  Overhead is `only' one
+    byte per chunk; still this will catch most cases of double frees or
+@@ -249,7 +249,7 @@ malloc_check (size_t sz, const void *caller)
+   top_check ();
+   victim = _int_malloc (&main_arena, nb);
+   __libc_lock_unlock (main_arena.mutex);
+-  return mem2mem_check (TAG_NEW_USABLE (victim), sz);
++  return mem2mem_check (tag_new_usable (victim), sz);
+ }
+ 
+ static void
+@@ -280,7 +280,7 @@ free_check (void *mem, const void *caller)
+   else
+     {
+       /* Mark the chunk as belonging to the library again.  */
+-      (void)TAG_REGION (chunk2rawmem (p), CHUNK_AVAILABLE_SIZE (p)
++      (void)tag_region (chunk2rawmem (p), CHUNK_AVAILABLE_SIZE (p)
+                                          - CHUNK_HDR_SZ);
+       _int_free (&main_arena, p, 1);
+       __libc_lock_unlock (main_arena.mutex);
+@@ -375,7 +375,7 @@ invert:
+ 
+   __libc_lock_unlock (main_arena.mutex);
+ 
+-  return mem2mem_check (TAG_NEW_USABLE (newmem), bytes);
++  return mem2mem_check (tag_new_usable (newmem), bytes);
+ }
+ 
+ static void *
+@@ -417,7 +417,7 @@ memalign_check (size_t alignment, size_t bytes, const void *caller)
+   top_check ();
+   mem = _int_memalign (&main_arena, alignment, bytes + 1);
+   __libc_lock_unlock (main_arena.mutex);
+-  return mem2mem_check (TAG_NEW_USABLE (mem), bytes);
++  return mem2mem_check (tag_new_usable (mem), bytes);
+ }
+ 
+ #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_25)
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index ecb87350b0..62d00f54cc 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -413,26 +413,26 @@ void *(*__morecore)(ptrdiff_t) = __default_morecore;
+    operations can continue to be used.  Support macros are used to do
+    this:
+ 
+-   void *TAG_NEW_MEMSET (void *ptr, int, val, size_t size)
++   void *tag_new_memset (void *ptr, int, val, size_t size)
+ 
+    Has the same interface as memset(), but additionally allocates a
+    new tag, colors the memory with that tag and returns a pointer that
+    is correctly colored for that location.  The non-tagging version
+    will simply call memset.
+ 
+-   void *TAG_REGION (void *ptr, size_t size)
++   void *tag_region (void *ptr, size_t size)
+ 
+    Color the region of memory pointed to by PTR and size SIZE with
+    the color of PTR.  Returns the original pointer.
+ 
+-   void *TAG_NEW_USABLE (void *ptr)
++   void *tag_new_usable (void *ptr)
+ 
+    Allocate a new random color and use it to color the user region of
+    a chunk; this may include data from the subsequent chunk's header
+    if tagging is sufficiently fine grained.  Returns PTR suitably
+    recolored for accessing the memory there.
+ 
+-   void *TAG_AT (void *ptr)
++   void *tag_at (void *ptr)
+ 
+    Read the current color of the memory at the address pointed to by
+    PTR (ignoring it's current color) and return PTR recolored to that
+@@ -455,25 +455,20 @@ __default_tag_nop (void *ptr)
+   return ptr;
+ }
+ 
+-static int __mtag_mmap_flags = 0;
+-static size_t __mtag_granule_mask = ~(size_t)0;
++static int mtag_mmap_flags = 0;
++static size_t mtag_granule_mask = ~(size_t)0;
+ 
+-static void *(*__tag_new_memset)(void *, int, size_t) = memset;
+-static void *(*__tag_region)(void *, size_t) = __default_tag_region;
+-static void *(*__tag_new_usable)(void *) = __default_tag_nop;
+-static void *(*__tag_at)(void *) = __default_tag_nop;
++static void *(*tag_new_memset)(void *, int, size_t) = memset;
++static void *(*tag_region)(void *, size_t) = __default_tag_region;
++static void *(*tag_new_usable)(void *) = __default_tag_nop;
++static void *(*tag_at)(void *) = __default_tag_nop;
+ 
+-# define MTAG_MMAP_FLAGS __mtag_mmap_flags
+-# define TAG_NEW_MEMSET(ptr, val, size) __tag_new_memset (ptr, val, size)
+-# define TAG_REGION(ptr, size) __tag_region (ptr, size)
+-# define TAG_NEW_USABLE(ptr) __tag_new_usable (ptr)
+-# define TAG_AT(ptr) __tag_at (ptr)
+ #else
+-# define MTAG_MMAP_FLAGS 0
+-# define TAG_NEW_MEMSET(ptr, val, size) memset (ptr, val, size)
+-# define TAG_REGION(ptr, size) (ptr)
+-# define TAG_NEW_USABLE(ptr) (ptr)
+-# define TAG_AT(ptr) (ptr)
++# define mtag_mmap_flags 0
++# define tag_new_memset(ptr, val, size) memset (ptr, val, size)
++# define tag_region(ptr, size) (ptr)
++# define tag_new_usable(ptr) (ptr)
++# define tag_at(ptr) (ptr)
+ #endif
+ 
+ #include <string.h>
+@@ -1305,8 +1300,8 @@ nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ /* Convert between user mem pointers and chunk pointers, updating any
+    memory tags on the pointer to respect the tag value at that
+    location.  */
+-#define chunk2mem(p) ((void*)TAG_AT (((char*)(p) + CHUNK_HDR_SZ)))
+-#define mem2chunk(mem) ((mchunkptr)TAG_AT (((char*)(mem) - CHUNK_HDR_SZ)))
++#define chunk2mem(p) ((void *)tag_at (((char*)(p) + CHUNK_HDR_SZ)))
++#define mem2chunk(mem) ((mchunkptr)tag_at (((char*)(mem) - CHUNK_HDR_SZ)))
+ 
+ /* The smallest possible chunk */
+ #define MIN_CHUNK_SIZE        (offsetof(struct malloc_chunk, fd_nextsize))
+@@ -1337,7 +1332,7 @@ nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ #ifdef USE_MTAG
+ #define CHUNK_AVAILABLE_SIZE(p) \
+   ((chunksize (p) + (chunk_is_mmapped (p) ? 0 : SIZE_SZ))	\
+-   & __mtag_granule_mask)
++   & mtag_granule_mask)
+ #else
+ #define CHUNK_AVAILABLE_SIZE(p) \
+   (chunksize (p) + (chunk_is_mmapped (p) ? 0 : SIZE_SZ))
+@@ -1361,7 +1356,7 @@ checked_request2size (size_t req, size_t *sz) __nonnull (1)
+      number.  Ideally, this would be part of request2size(), but that
+      must be a macro that produces a compile time constant if passed
+      a constant literal.  */
+-  req = (req + ~__mtag_granule_mask) & __mtag_granule_mask;
++  req = (req + ~mtag_granule_mask) & mtag_granule_mask;
+ #endif
+ 
+   *sz = request2size (req);
+@@ -2467,7 +2462,7 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
+       if ((unsigned long) (size) > (unsigned long) (nb))
+         {
+           mm = (char *) (MMAP (0, size,
+-			       MTAG_MMAP_FLAGS | PROT_READ | PROT_WRITE, 0));
++			       mtag_mmap_flags | PROT_READ | PROT_WRITE, 0));
+ 
+           if (mm != MAP_FAILED)
+             {
+@@ -2665,7 +2660,7 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
+           if ((unsigned long) (size) > (unsigned long) (nb))
+             {
+               char *mbrk = (char *) (MMAP (0, size,
+-					   MTAG_MMAP_FLAGS | PROT_READ | PROT_WRITE,
++					   mtag_mmap_flags | PROT_READ | PROT_WRITE,
+ 					   0));
+ 
+               if (mbrk != MAP_FAILED)
+@@ -3221,14 +3216,14 @@ __libc_malloc (size_t bytes)
+       && tcache->counts[tc_idx] > 0)
+     {
+       victim = tcache_get (tc_idx);
+-      return TAG_NEW_USABLE (victim);
++      return tag_new_usable (victim);
+     }
+   DIAG_POP_NEEDS_COMMENT;
+ #endif
+ 
+   if (SINGLE_THREAD_P)
+     {
+-      victim = TAG_NEW_USABLE (_int_malloc (&main_arena, bytes));
++      victim = tag_new_usable (_int_malloc (&main_arena, bytes));
+       assert (!victim || chunk_is_mmapped (mem2chunk (victim)) ||
+ 	      &main_arena == arena_for_chunk (mem2chunk (victim)));
+       return victim;
+@@ -3249,7 +3244,7 @@ __libc_malloc (size_t bytes)
+   if (ar_ptr != NULL)
+     __libc_lock_unlock (ar_ptr->mutex);
+ 
+-  victim = TAG_NEW_USABLE (victim);
++  victim = tag_new_usable (victim);
+ 
+   assert (!victim || chunk_is_mmapped (mem2chunk (victim)) ||
+           ar_ptr == arena_for_chunk (mem2chunk (victim)));
+@@ -3305,7 +3300,7 @@ __libc_free (void *mem)
+       MAYBE_INIT_TCACHE ();
+ 
+       /* Mark the chunk as belonging to the library again.  */
+-      (void)TAG_REGION (chunk2rawmem (p),
++      (void)tag_region (chunk2rawmem (p),
+ 			CHUNK_AVAILABLE_SIZE (p) - CHUNK_HDR_SZ);
+ 
+       ar_ptr = arena_for_chunk (p);
+@@ -3408,7 +3403,7 @@ __libc_realloc (void *oldmem, size_t bytes)
+ 	     reused.  There's a performance hit for both us and the
+ 	     caller for doing this, so we might want to
+ 	     reconsider.  */
+-	  return TAG_NEW_USABLE (newmem);
++	  return tag_new_usable (newmem);
+ 	}
+ #endif
+       /* Note the extra SIZE_SZ overhead. */
+@@ -3451,7 +3446,7 @@ __libc_realloc (void *oldmem, size_t bytes)
+         {
+ 	  size_t sz = CHUNK_AVAILABLE_SIZE (oldp) - CHUNK_HDR_SZ;
+ 	  memcpy (newp, oldmem, sz);
+-	  (void) TAG_REGION (chunk2rawmem (oldp), sz);
++	  (void) tag_region (chunk2rawmem (oldp), sz);
+           _int_free (ar_ptr, oldp, 0);
+         }
+     }
+@@ -3509,7 +3504,7 @@ _mid_memalign (size_t alignment, size_t bytes, void *address)
+       p = _int_memalign (&main_arena, alignment, bytes);
+       assert (!p || chunk_is_mmapped (mem2chunk (p)) ||
+ 	      &main_arena == arena_for_chunk (mem2chunk (p)));
+-      return TAG_NEW_USABLE (p);
++      return tag_new_usable (p);
+     }
+ 
+   arena_get (ar_ptr, bytes + alignment + MINSIZE);
+@@ -3527,7 +3522,7 @@ _mid_memalign (size_t alignment, size_t bytes, void *address)
+ 
+   assert (!p || chunk_is_mmapped (mem2chunk (p)) ||
+           ar_ptr == arena_for_chunk (mem2chunk (p)));
+-  return TAG_NEW_USABLE (p);
++  return tag_new_usable (p);
+ }
+ /* For ISO C11.  */
+ weak_alias (__libc_memalign, aligned_alloc)
+@@ -3544,7 +3539,7 @@ __libc_valloc (size_t bytes)
+   void *address = RETURN_ADDRESS (0);
+   size_t pagesize = GLRO (dl_pagesize);
+   p = _mid_memalign (pagesize, bytes, address);
+-  return TAG_NEW_USABLE (p);
++  return tag_new_usable (p);
+ }
+ 
+ void *
+@@ -3569,7 +3564,7 @@ __libc_pvalloc (size_t bytes)
+   rounded_bytes = rounded_bytes & -(pagesize - 1);
+ 
+   p = _mid_memalign (pagesize, rounded_bytes, address);
+-  return TAG_NEW_USABLE (p);
++  return tag_new_usable (p);
+ }
+ 
+ void *
+@@ -3666,7 +3661,7 @@ __libc_calloc (size_t n, size_t elem_size)
+      regardless of MORECORE_CLEARS, so we zero the whole block while
+      doing so.  */
+ #ifdef USE_MTAG
+-  return TAG_NEW_MEMSET (mem, 0, CHUNK_AVAILABLE_SIZE (p) - CHUNK_HDR_SZ);
++  return tag_new_memset (mem, 0, CHUNK_AVAILABLE_SIZE (p) - CHUNK_HDR_SZ);
+ #else
+   INTERNAL_SIZE_T csz = chunksize (p);
+ 
+@@ -4821,7 +4816,7 @@ _int_realloc(mstate av, mchunkptr oldp, INTERNAL_SIZE_T oldsize,
+           av->top = chunk_at_offset (oldp, nb);
+           set_head (av->top, (newsize - nb) | PREV_INUSE);
+           check_inuse_chunk (av, oldp);
+-          return TAG_NEW_USABLE (chunk2rawmem (oldp));
++          return tag_new_usable (chunk2rawmem (oldp));
+         }
+ 
+       /* Try to expand forward into next chunk;  split off remainder below */
+@@ -4856,8 +4851,8 @@ _int_realloc(mstate av, mchunkptr oldp, INTERNAL_SIZE_T oldsize,
+             {
+ 	      void *oldmem = chunk2rawmem (oldp);
+ 	      size_t sz = CHUNK_AVAILABLE_SIZE (oldp) - CHUNK_HDR_SZ;
+-	      (void) TAG_REGION (oldmem, sz);
+-	      newmem = TAG_NEW_USABLE (newmem);
++	      (void) tag_region (oldmem, sz);
++	      newmem = tag_new_usable (newmem);
+ 	      memcpy (newmem, oldmem, sz);
+ 	      _int_free (av, oldp, 1);
+ 	      check_inuse_chunk (av, newp);
+@@ -4881,7 +4876,7 @@ _int_realloc(mstate av, mchunkptr oldp, INTERNAL_SIZE_T oldsize,
+     {
+       remainder = chunk_at_offset (newp, nb);
+       /* Clear any user-space tags before writing the header.  */
+-      remainder = TAG_REGION (remainder, remainder_size);
++      remainder = tag_region (remainder, remainder_size);
+       set_head_size (newp, nb | (av != &main_arena ? NON_MAIN_ARENA : 0));
+       set_head (remainder, remainder_size | PREV_INUSE |
+                 (av != &main_arena ? NON_MAIN_ARENA : 0));
+@@ -4891,7 +4886,7 @@ _int_realloc(mstate av, mchunkptr oldp, INTERNAL_SIZE_T oldsize,
+     }
+ 
+   check_inuse_chunk (av, newp);
+-  return TAG_NEW_USABLE (chunk2rawmem (newp));
++  return tag_new_usable (chunk2rawmem (newp));
+ }
+ 
+ /*
+@@ -5108,7 +5103,7 @@ musable (void *mem)
+       /* The usable space may be reduced if memory tagging is needed,
+ 	 since we cannot share the user-space data with malloc's internal
+ 	 data structure.  */
+-      result &= __mtag_granule_mask;
++      result &= mtag_granule_mask;
+ #endif
+       return result;
+     }
+-- 
+2.25.1
+
+
+From f0ea41e819f40aacedf25431bedd95da9c5db534 Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <szabolcs.nagy@arm.com>
+Date: Wed, 27 Jan 2021 15:45:43 +0000
+Subject: [PATCH 06/11] malloc: Use global flag instead of function pointer
+ dispatch for mtag
+
+A flag check can be faster than function pointers because of how
+branch prediction and speculation works and it can also remove a layer
+of indirection when there is a mismatch between the malloc internal
+tag_* api and __libc_mtag_* target hooks.
+
+Memory tagging wrapper functions are moved to malloc.c from arena.c and
+the logic now checks mmap_enabled.  The definition of tag_new_usable is
+moved after chunk related definitions.
+
+This refactoring also allows using mtag_enabled checks instead of
+USE_MTAG ifdefs when memory tagging support only changes code logic
+when memory tagging is enabled at runtime. Note: an "if (false)" code
+block is optimized away even at -O0 by gcc.
+
+Reviewed-by: DJ Delorie <dj@redhat.com>
+---
+ malloc/arena.c  | 33 +---------------------------
+ malloc/malloc.c | 58 ++++++++++++++++++++++++++++++++-----------------
+ 2 files changed, 39 insertions(+), 52 deletions(-)
+
+diff --git a/malloc/arena.c b/malloc/arena.c
+index d0778fea92..1e83bb66bd 100644
+--- a/malloc/arena.c
++++ b/malloc/arena.c
+@@ -287,34 +287,6 @@ extern struct dl_open_hook *_dl_open_hook;
+ libc_hidden_proto (_dl_open_hook);
+ #endif
+ 
+-#ifdef USE_MTAG
+-
+-/* Generate a new (random) tag value for PTR and tag the memory it
+-   points to upto the end of the usable size for the chunk containing
+-   it.  Return the newly tagged pointer.  */
+-static void *
+-__mtag_tag_new_usable (void *ptr)
+-{
+-  if (ptr)
+-    {
+-      mchunkptr cp = mem2chunk(ptr);
+-      ptr = __libc_mtag_tag_region (__libc_mtag_new_tag (ptr),
+-				    CHUNK_AVAILABLE_SIZE (cp) - CHUNK_HDR_SZ);
+-    }
+-  return ptr;
+-}
+-
+-/* Generate a new (random) tag value for PTR, set the tags for the
+-   memory to the new tag and initialize the memory contents to VAL.
+-   In practice this function will only be called with VAL=0, but we
+-   keep this parameter to maintain the same prototype as memset.  */
+-static void *
+-__mtag_tag_new_memset (void *ptr, int val, size_t size)
+-{
+-  return __libc_mtag_memset_with_tag (__libc_mtag_new_tag (ptr), val, size);
+-}
+-#endif
+-
+ static void
+ ptmalloc_init (void)
+ {
+@@ -332,11 +304,8 @@ ptmalloc_init (void)
+       if (__MTAG_SBRK_UNTAGGED)
+ 	__morecore = __failing_morecore;
+ 
++      mtag_enabled = true;
+       mtag_mmap_flags = __MTAG_MMAP_FLAGS;
+-      tag_new_memset = __mtag_tag_new_memset;
+-      tag_region = __libc_mtag_tag_region;
+-      tag_new_usable = __mtag_tag_new_usable;
+-      tag_at = __libc_mtag_address_get_tag;
+       mtag_granule_mask = ~(size_t)(__MTAG_GRANULE_SIZE - 1);
+     }
+ #endif
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index 62d00f54cc..253a919ec5 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -441,35 +441,41 @@ void *(*__morecore)(ptrdiff_t) = __default_morecore;
+ */
+ 
+ #ifdef USE_MTAG
++static bool mtag_enabled = false;
++static int mtag_mmap_flags = 0;
++static size_t mtag_granule_mask = ~(size_t)0;
++#else
++# define mtag_enabled false
++# define mtag_mmap_flags 0
++#endif
+ 
+-/* Default implementaions when memory tagging is supported, but disabled.  */
+-static void *
+-__default_tag_region (void *ptr, size_t size)
++static __always_inline void *
++tag_region (void *ptr, size_t size)
+ {
++  if (__glibc_unlikely (mtag_enabled))
++    return __libc_mtag_tag_region (ptr, size);
+   return ptr;
+ }
+ 
+-static void *
+-__default_tag_nop (void *ptr)
++static __always_inline void *
++tag_new_memset (void *ptr, int val, size_t size)
+ {
+-  return ptr;
++  if (__glibc_unlikely (mtag_enabled))
++    return __libc_mtag_memset_with_tag (__libc_mtag_new_tag (ptr), val, size);
++  return memset (ptr, val, size);
+ }
+ 
+-static int mtag_mmap_flags = 0;
+-static size_t mtag_granule_mask = ~(size_t)0;
+-
+-static void *(*tag_new_memset)(void *, int, size_t) = memset;
+-static void *(*tag_region)(void *, size_t) = __default_tag_region;
+-static void *(*tag_new_usable)(void *) = __default_tag_nop;
+-static void *(*tag_at)(void *) = __default_tag_nop;
++/* Defined later.  */
++static void *
++tag_new_usable (void *ptr);
+ 
+-#else
+-# define mtag_mmap_flags 0
+-# define tag_new_memset(ptr, val, size) memset (ptr, val, size)
+-# define tag_region(ptr, size) (ptr)
+-# define tag_new_usable(ptr) (ptr)
+-# define tag_at(ptr) (ptr)
+-#endif
++static __always_inline void *
++tag_at (void *ptr)
++{
++  if (__glibc_unlikely (mtag_enabled))
++    return __libc_mtag_address_get_tag (ptr);
++  return ptr;
++}
+ 
+ #include <string.h>
+ 
+@@ -1460,6 +1466,18 @@ checked_request2size (size_t req, size_t *sz) __nonnull (1)
+ #pragma GCC poison mchunk_size
+ #pragma GCC poison mchunk_prev_size
+ 
++static __always_inline void *
++tag_new_usable (void *ptr)
++{
++  if (__glibc_unlikely (mtag_enabled) && ptr)
++    {
++      mchunkptr cp = mem2chunk(ptr);
++      ptr = __libc_mtag_tag_region (__libc_mtag_new_tag (ptr),
++				    CHUNK_AVAILABLE_SIZE (cp) - CHUNK_HDR_SZ);
++    }
++  return ptr;
++}
++
+ /*
+    -------------------- Internal data structures --------------------
+ 
+-- 
+2.25.1
+
+
+From 8597244d5c3edbd672b285eea5f6dea833256f9d Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <szabolcs.nagy@arm.com>
+Date: Wed, 17 Feb 2021 10:39:37 +0000
+Subject: [PATCH 07/11] malloc: Ensure the generic mtag hooks are not used
+
+Use inline functions instead of macros, because macros can cause unused
+variable warnings and type conversion issues.  We assume these functions
+may appear in the code but only in dead code paths (hidden by a runtime
+check), so it's important that they can compile with correct types, but
+if they are actually used that should be an error.
+
+Currently the hooks are only used when USE_MTAG is true which only
+happens on aarch64 and then the aarch64 specific code is used not this
+generic header.  However followup refactoring will allow the hooks to
+be used with !USE_MTAG.
+
+Note: the const qualifier in the comment was wrong: changing tags is a
+write operation.
+
+Reviewed-by: DJ Delorie <dj@redhat.com>
+---
+ sysdeps/generic/libc-mtag.h | 41 ++++++++++++++++++++++++++++---------
+ 1 file changed, 31 insertions(+), 10 deletions(-)
+
+diff --git a/sysdeps/generic/libc-mtag.h b/sysdeps/generic/libc-mtag.h
+index 1a866cdc0c..e8fc236b6c 100644
+--- a/sysdeps/generic/libc-mtag.h
++++ b/sysdeps/generic/libc-mtag.h
+@@ -31,22 +31,43 @@
+ /* Extra flags to pass to mmap() to request a tagged region of memory.  */
+ #define __MTAG_MMAP_FLAGS 0
+ 
++/* Memory tagging target hooks are only called when memory tagging is
++   enabled at runtime.  The generic definitions here must not be used.  */
++void __libc_mtag_link_error (void);
++
+ /* Set the tags for a region of memory, which must have size and alignment
+-   that are multiples of __MTAG_GRANULE_SIZE.  Size cannot be zero.
+-   void *__libc_mtag_tag_region (const void *, size_t)  */
+-#define __libc_mtag_tag_region(p, s) (p)
++   that are multiples of __MTAG_GRANULE_SIZE.  Size cannot be zero.  */
++static inline void *
++__libc_mtag_tag_region (void *p, size_t n)
++{
++  __libc_mtag_link_error ();
++  return p;
++}
+ 
+ /* Optimized equivalent to __libc_mtag_tag_region followed by memset.  */
+-#define __libc_mtag_memset_with_tag memset
++static inline void *
++__libc_mtag_memset_with_tag (void *p, int c, size_t n)
++{
++  __libc_mtag_link_error ();
++  return memset (p, c, n);
++}
+ 
+ /* Convert address P to a pointer that is tagged correctly for that
+-   location.
+-   void *__libc_mtag_address_get_tag (void*)  */
+-#define __libc_mtag_address_get_tag(p) (p)
++   location.  */
++static inline void *
++__libc_mtag_address_get_tag (void *p)
++{
++  __libc_mtag_link_error ();
++  return p;
++}
+ 
+ /* Assign a new (random) tag to a pointer P (does not adjust the tag on
+-   the memory addressed).
+-   void *__libc_mtag_new_tag (void*)  */
+-#define __libc_mtag_new_tag(p) (p)
++   the memory addressed).  */
++static inline void *
++__libc_mtag_new_tag (void *p)
++{
++  __libc_mtag_link_error ();
++  return p;
++}
+ 
+ #endif /* _GENERIC_LIBC_MTAG_H */
+-- 
+2.25.1
+
+
+From 3d9e16280ad881d038aedba0b6fcbd9e78b29072 Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <szabolcs.nagy@arm.com>
+Date: Fri, 29 Jan 2021 17:07:28 +0000
+Subject: [PATCH 08/11] malloc: Only support zeroing and not arbitrary memset
+ with mtag
+
+The memset api is suboptimal and does not provide much benefit. Memory
+tagging only needs a zeroing memset (and only for memory that's sized
+and aligned to multiples of the tag granule), so change the internal
+api and the target hooks accordingly.  This is to simplify the
+implementation of the target hook.
+
+Reviewed-by: DJ Delorie <dj@redhat.com>
+---
+ malloc/malloc.c                                | 17 ++++++++---------
+ sysdeps/aarch64/Makefile                       |  2 +-
+ ...g_memset_tag.S => __mtag_tag_zero_region.S} | 18 +++++++-----------
+ sysdeps/aarch64/libc-mtag.h                    |  4 ++--
+ sysdeps/generic/libc-mtag.h                    |  6 +++---
+ 5 files changed, 21 insertions(+), 26 deletions(-)
+ rename sysdeps/aarch64/{__mtag_memset_tag.S => __mtag_tag_zero_region.S} (82%)
+
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index 253a919ec5..01cf6e9325 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -413,12 +413,11 @@ void *(*__morecore)(ptrdiff_t) = __default_morecore;
+    operations can continue to be used.  Support macros are used to do
+    this:
+ 
+-   void *tag_new_memset (void *ptr, int, val, size_t size)
++   void *tag_new_zero_region (void *ptr, size_t size)
+ 
+-   Has the same interface as memset(), but additionally allocates a
+-   new tag, colors the memory with that tag and returns a pointer that
+-   is correctly colored for that location.  The non-tagging version
+-   will simply call memset.
++   Allocates a new tag, colors the memory with that tag, zeros the
++   memory and returns a pointer that is correctly colored for that
++   location.  The non-tagging version will simply call memset with 0.
+ 
+    void *tag_region (void *ptr, size_t size)
+ 
+@@ -458,11 +457,11 @@ tag_region (void *ptr, size_t size)
+ }
+ 
+ static __always_inline void *
+-tag_new_memset (void *ptr, int val, size_t size)
++tag_new_zero_region (void *ptr, size_t size)
+ {
+   if (__glibc_unlikely (mtag_enabled))
+-    return __libc_mtag_memset_with_tag (__libc_mtag_new_tag (ptr), val, size);
+-  return memset (ptr, val, size);
++    return __libc_mtag_tag_zero_region (__libc_mtag_new_tag (ptr), size);
++  return memset (ptr, 0, size);
+ }
+ 
+ /* Defined later.  */
+@@ -3679,7 +3678,7 @@ __libc_calloc (size_t n, size_t elem_size)
+      regardless of MORECORE_CLEARS, so we zero the whole block while
+      doing so.  */
+ #ifdef USE_MTAG
+-  return tag_new_memset (mem, 0, CHUNK_AVAILABLE_SIZE (p) - CHUNK_HDR_SZ);
++  return tag_new_zero_region (mem, CHUNK_AVAILABLE_SIZE (p) - CHUNK_HDR_SZ);
+ #else
+   INTERNAL_SIZE_T csz = chunksize (p);
+ 
+diff --git a/sysdeps/aarch64/Makefile b/sysdeps/aarch64/Makefile
+index d3ab37a40a..259070cfad 100644
+--- a/sysdeps/aarch64/Makefile
++++ b/sysdeps/aarch64/Makefile
+@@ -41,7 +41,7 @@ endif
+ ifeq ($(subdir),misc)
+ sysdep_headers += sys/ifunc.h
+ sysdep_routines += __mtag_address_get_tag \
+-		   __mtag_memset_tag \
++		   __mtag_tag_zero_region \
+ 		   __mtag_new_tag \
+ 		   __mtag_tag_region
+ 
+diff --git a/sysdeps/aarch64/__mtag_memset_tag.S b/sysdeps/aarch64/__mtag_tag_zero_region.S
+similarity index 82%
+rename from sysdeps/aarch64/__mtag_memset_tag.S
+rename to sysdeps/aarch64/__mtag_tag_zero_region.S
+index 3c202888a4..74d398bba5 100644
+--- a/sysdeps/aarch64/__mtag_memset_tag.S
++++ b/sysdeps/aarch64/__mtag_tag_zero_region.S
+@@ -20,9 +20,6 @@
+ 
+ #ifdef USE_MTAG
+ 
+-/* Use the same register names and assignments as memset.  */
+-#include "memset-reg.h"
+-
+ 	.arch armv8.5-a
+ 	.arch_extension memtag
+ 
+@@ -31,16 +28,15 @@
+ /* FIXME: This is a minimal implementation.  We could do much better than
+    this for large values of COUNT.  */
+ 
+-ENTRY(__libc_mtag_memset_with_tag)
++#define dstin x0
++#define count x1
++#define dst   x2
+ 
+-	and	valw, valw, 255
+-	orr	valw, valw, valw, lsl 8
+-	orr	valw, valw, valw, lsl 16
+-	orr	val, val, val, lsl 32
+-	mov	dst, dstin
++ENTRY(__libc_mtag_tag_zero_region)
+ 
++	mov	dst, dstin
+ L(loop):
+-	stgp	val, val, [dst], #16
++	stzg	dst, [dst], #16
+ 	subs	count, count, 16
+ 	bne	L(loop)
+ #if 0
+@@ -49,5 +45,5 @@ L(loop):
+ 	ldg	dstin, [dstin] // Recover the tag created (might be untagged).
+ #endif
+ 	ret
+-END (__libc_mtag_memset_with_tag)
++END (__libc_mtag_tag_zero_region)
+ #endif /* USE_MTAG */
+diff --git a/sysdeps/aarch64/libc-mtag.h b/sysdeps/aarch64/libc-mtag.h
+index 979cbb743e..f58402ccf9 100644
+--- a/sysdeps/aarch64/libc-mtag.h
++++ b/sysdeps/aarch64/libc-mtag.h
+@@ -39,8 +39,8 @@
+    void *__libc_mtag_tag_region (const void *, size_t)  */
+ void *__libc_mtag_tag_region (void *, size_t);
+ 
+-/* Optimized equivalent to __libc_mtag_tag_region followed by memset.  */
+-void *__libc_mtag_memset_with_tag (void *, int, size_t);
++/* Optimized equivalent to __libc_mtag_tag_region followed by memset to 0.  */
++void *__libc_mtag_tag_zero_region (void *, size_t);
+ 
+ /* Convert address P to a pointer that is tagged correctly for that
+    location.
+diff --git a/sysdeps/generic/libc-mtag.h b/sysdeps/generic/libc-mtag.h
+index e8fc236b6c..4743e873f1 100644
+--- a/sysdeps/generic/libc-mtag.h
++++ b/sysdeps/generic/libc-mtag.h
+@@ -44,12 +44,12 @@ __libc_mtag_tag_region (void *p, size_t n)
+   return p;
+ }
+ 
+-/* Optimized equivalent to __libc_mtag_tag_region followed by memset.  */
++/* Optimized equivalent to __libc_mtag_tag_region followed by memset to 0.  */
+ static inline void *
+-__libc_mtag_memset_with_tag (void *p, int c, size_t n)
++__libc_mtag_tag_zero_region (void *p, size_t n)
+ {
+   __libc_mtag_link_error ();
+-  return memset (p, c, n);
++  return memset (p, 0, n);
+ }
+ 
+ /* Convert address P to a pointer that is tagged correctly for that
+-- 
+2.25.1
+
+
+From 4d596cb72342ba0734dc847653431e078a70edfc Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <szabolcs.nagy@arm.com>
+Date: Tue, 16 Feb 2021 17:02:44 +0000
+Subject: [PATCH 09/11] malloc: Change calloc when tagging is disabled
+
+When glibc is built with memory tagging support (USE_MTAG) but it is not
+enabled at runtime (mtag_enabled) then unconditional memset was used
+even though that can be often avoided.
+
+This is for performance when tagging is supported but not enabled.
+The extra check should have no overhead: tag_new_zero_region already
+had a runtime check which the compiler can now optimize away.
+
+Reviewed-by: DJ Delorie <dj@redhat.com>
+---
+ malloc/malloc.c | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index 01cf6e9325..0b2aff3768 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -3591,11 +3591,9 @@ __libc_calloc (size_t n, size_t elem_size)
+   mchunkptr oldtop;
+   INTERNAL_SIZE_T sz, oldtopsize;
+   void *mem;
+-#ifndef USE_MTAG
+   unsigned long clearsize;
+   unsigned long nclears;
+   INTERNAL_SIZE_T *d;
+-#endif
+   ptrdiff_t bytes;
+ 
+   if (__glibc_unlikely (__builtin_mul_overflow (n, elem_size, &bytes)))
+@@ -3674,12 +3672,13 @@ __libc_calloc (size_t n, size_t elem_size)
+     return 0;
+ 
+   mchunkptr p = mem2chunk (mem);
++
+   /* If we are using memory tagging, then we need to set the tags
+      regardless of MORECORE_CLEARS, so we zero the whole block while
+      doing so.  */
+-#ifdef USE_MTAG
+-  return tag_new_zero_region (mem, CHUNK_AVAILABLE_SIZE (p) - CHUNK_HDR_SZ);
+-#else
++  if (__glibc_unlikely (mtag_enabled))
++    return tag_new_zero_region (mem, CHUNK_AVAILABLE_SIZE (p) - CHUNK_HDR_SZ);
++
+   INTERNAL_SIZE_T csz = chunksize (p);
+ 
+   /* Two optional cases in which clearing not necessary */
+@@ -3733,7 +3732,6 @@ __libc_calloc (size_t n, size_t elem_size)
+     }
+ 
+   return mem;
+-#endif
+ }
+ 
+ /*
+-- 
+2.25.1
+
+
+From 287a35fba55a0a817db7af71ee966a37b7642bf0 Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <szabolcs.nagy@arm.com>
+Date: Mon, 8 Feb 2021 12:39:01 +0000
+Subject: [PATCH 10/11] malloc: Use branches instead of mtag_granule_mask
+
+The branches may be better optimized since mtag_enabled is widely used.
+
+Granule size larger than a chunk header is not supported since then we
+cannot have both the chunk header and user area granule aligned.  To
+fix that for targets with large granule, the chunk layout has to change.
+
+So code that attempted to handle the granule mask generally was changed.
+This simplified CHUNK_AVAILABLE_SIZE and the logic in malloc_usable_size.
+
+Reviewed-by: DJ Delorie <dj@redhat.com>
+---
+ malloc/arena.c  |  1 -
+ malloc/malloc.c | 34 ++++++++++++++--------------------
+ 2 files changed, 14 insertions(+), 21 deletions(-)
+
+diff --git a/malloc/arena.c b/malloc/arena.c
+index 1e83bb66bd..9fbbb38a15 100644
+--- a/malloc/arena.c
++++ b/malloc/arena.c
+@@ -306,7 +306,6 @@ ptmalloc_init (void)
+ 
+       mtag_enabled = true;
+       mtag_mmap_flags = __MTAG_MMAP_FLAGS;
+-      mtag_granule_mask = ~(size_t)(__MTAG_GRANULE_SIZE - 1);
+     }
+ #endif
+ 
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index 0b2aff3768..849bd8e2c9 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -442,7 +442,6 @@ void *(*__morecore)(ptrdiff_t) = __default_morecore;
+ #ifdef USE_MTAG
+ static bool mtag_enabled = false;
+ static int mtag_mmap_flags = 0;
+-static size_t mtag_granule_mask = ~(size_t)0;
+ #else
+ # define mtag_enabled false
+ # define mtag_mmap_flags 0
+@@ -1333,15 +1332,16 @@ nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+    ((req) + SIZE_SZ + MALLOC_ALIGN_MASK) & ~MALLOC_ALIGN_MASK)
+ 
+ /* Available size of chunk.  This is the size of the real usable data
+-   in the chunk, plus the chunk header.  */
+-#ifdef USE_MTAG
+-#define CHUNK_AVAILABLE_SIZE(p) \
+-  ((chunksize (p) + (chunk_is_mmapped (p) ? 0 : SIZE_SZ))	\
+-   & mtag_granule_mask)
+-#else
+-#define CHUNK_AVAILABLE_SIZE(p) \
+-  (chunksize (p) + (chunk_is_mmapped (p) ? 0 : SIZE_SZ))
+-#endif
++   in the chunk, plus the chunk header.  Note: If memory tagging is
++   enabled the layout changes to accomodate the granule size, this is
++   wasteful for small allocations so not done by default.  The logic
++   does not work if chunk headers are not granule aligned.  */
++_Static_assert (__MTAG_GRANULE_SIZE <= CHUNK_HDR_SZ,
++		"memory tagging is not supported with large granule.");
++#define CHUNK_AVAILABLE_SIZE(p)                                       \
++  (__MTAG_GRANULE_SIZE > SIZE_SZ && __glibc_unlikely (mtag_enabled) ? \
++    chunksize (p) :                                                   \
++    chunksize (p) + (chunk_is_mmapped (p) ? 0 : SIZE_SZ))
+ 
+ /* Check if REQ overflows when padded and aligned and if the resulting value
+    is less than PTRDIFF_T.  Returns TRUE and the requested size or MINSIZE in
+@@ -1353,7 +1353,6 @@ checked_request2size (size_t req, size_t *sz) __nonnull (1)
+   if (__glibc_unlikely (req > PTRDIFF_MAX))
+     return false;
+ 
+-#ifdef USE_MTAG
+   /* When using tagged memory, we cannot share the end of the user
+      block with the header for the next chunk, so ensure that we
+      allocate blocks that are rounded up to the granule size.  Take
+@@ -1361,8 +1360,9 @@ checked_request2size (size_t req, size_t *sz) __nonnull (1)
+      number.  Ideally, this would be part of request2size(), but that
+      must be a macro that produces a compile time constant if passed
+      a constant literal.  */
+-  req = (req + ~mtag_granule_mask) & mtag_granule_mask;
+-#endif
++  if (__glibc_unlikely (mtag_enabled))
++    req = (req + (__MTAG_GRANULE_SIZE - 1)) &
++	  ~(size_t)(__MTAG_GRANULE_SIZE - 1);
+ 
+   *sz = request2size (req);
+   return true;
+@@ -5112,14 +5112,8 @@ musable (void *mem)
+ 	    result = chunksize (p) - CHUNK_HDR_SZ;
+ 	}
+       else if (inuse (p))
+-	result = chunksize (p) - SIZE_SZ;
++	result = CHUNK_AVAILABLE_SIZE (p) - CHUNK_HDR_SZ;
+ 
+-#ifdef USE_MTAG
+-      /* The usable space may be reduced if memory tagging is needed,
+-	 since we cannot share the user-space data with malloc's internal
+-	 data structure.  */
+-      result &= mtag_granule_mask;
+-#endif
+       return result;
+     }
+   return 0;
+-- 
+2.25.1
+
+
+From 66de173bf919e601e408dc78772c6841ad6388ab Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <szabolcs.nagy@arm.com>
+Date: Wed, 17 Feb 2021 10:15:18 +0000
+Subject: [PATCH 11/11] malloc: Use mtag_enabled instead of USE_MTAG
+
+Use the runtime check where possible: it should not cause slow down in
+the !USE_MTAG case since then mtag_enabled is constant false, but it
+allows compiling the tagging logic so it's less likely to break or
+diverge when developers only test the !USE_MTAG case.
+
+Reviewed-by: DJ Delorie <dj@redhat.com>
+---
+ malloc/hooks.c  | 10 ++++------
+ malloc/malloc.c | 10 ++++------
+ 2 files changed, 8 insertions(+), 12 deletions(-)
+
+diff --git a/malloc/hooks.c b/malloc/hooks.c
+index d8e304c31c..9474e199c3 100644
+--- a/malloc/hooks.c
++++ b/malloc/hooks.c
+@@ -262,11 +262,10 @@ free_check (void *mem, const void *caller)
+ 
+   int err = errno;
+ 
+-#ifdef USE_MTAG
+   /* Quickly check that the freed pointer matches the tag for the memory.
+      This gives a useful double-free detection.  */
+-  *(volatile char *)mem;
+-#endif
++  if (__glibc_unlikely (mtag_enabled))
++    *(volatile char *)mem;
+ 
+   __libc_lock_lock (main_arena.mutex);
+   p = mem2chunk_check (mem, NULL);
+@@ -310,11 +309,10 @@ realloc_check (void *oldmem, size_t bytes, const void *caller)
+       return NULL;
+     }
+ 
+-#ifdef USE_MTAG
+   /* Quickly check that the freed pointer matches the tag for the memory.
+      This gives a useful double-free detection.  */
+-  *(volatile char *)oldmem;
+-#endif
++  if (__glibc_unlikely (mtag_enabled))
++    *(volatile char *)oldmem;
+ 
+   __libc_lock_lock (main_arena.mutex);
+   const mchunkptr oldp = mem2chunk_check (oldmem, &magic_p);
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index 849bd8e2c9..36583120ce 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -3286,11 +3286,10 @@ __libc_free (void *mem)
+   if (mem == 0)                              /* free(0) has no effect */
+     return;
+ 
+-#ifdef USE_MTAG
+   /* Quickly check that the freed pointer matches the tag for the memory.
+      This gives a useful double-free detection.  */
+-  *(volatile char *)mem;
+-#endif
++  if (__glibc_unlikely (mtag_enabled))
++    *(volatile char *)mem;
+ 
+   int err = errno;
+ 
+@@ -3352,11 +3351,10 @@ __libc_realloc (void *oldmem, size_t bytes)
+   if (oldmem == 0)
+     return __libc_malloc (bytes);
+ 
+-#ifdef USE_MTAG
+   /* Perform a quick check to ensure that the pointer's tag matches the
+      memory's tag.  */
+-  *(volatile char*) oldmem;
+-#endif
++  if (__glibc_unlikely (mtag_enabled))
++    *(volatile char*) oldmem;
+ 
+   /* chunk corresponding to oldmem */
+   const mchunkptr oldp = mem2chunk (oldmem);
+-- 
+2.25.1
+
diff --git a/poky/meta/recipes-core/glibc/glibc_2.33.bb b/poky/meta/recipes-core/glibc/glibc_2.33.bb
index caa2e2a..925efe8 100644
--- a/poky/meta/recipes-core/glibc/glibc_2.33.bb
+++ b/poky/meta/recipes-core/glibc/glibc_2.33.bb
@@ -56,6 +56,7 @@
            file://0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \
            file://0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch \
            file://0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch \
+           file://mte-backports.patch \
            "
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build-${TARGET_SYS}"
@@ -91,7 +92,7 @@
 EXTRA_OECONF_append_x86 = " --enable-cet"
 EXTRA_OECONF_append_x86-64 = " --enable-cet"
 
-PACKAGECONFIG ??= "nscd"
+PACKAGECONFIG ??= "nscd memory-tagging"
 PACKAGECONFIG[nscd] = "--enable-nscd,--disable-nscd"
 PACKAGECONFIG[memory-tagging] = "--enable-memory-tagging,--disable-memory-tagging"
 
diff --git a/poky/meta/recipes-core/glibc/ldconfig-native-2.12.1/add-riscv-support.patch b/poky/meta/recipes-core/glibc/ldconfig-native-2.12.1/add-riscv-support.patch
new file mode 100644
index 0000000..fc41aee
--- /dev/null
+++ b/poky/meta/recipes-core/glibc/ldconfig-native-2.12.1/add-riscv-support.patch
@@ -0,0 +1,79 @@
+From fd50228cc213d2d87f5e3cf1f123acb3fda9b04e Mon Sep 17 00:00:00 2001
+From: Christoph Muellner <cmuellner@linux.com>
+Date: Mon, 28 Jun 2021 00:34:12 +0200
+Subject: [PATCH] ldconfig: Add RISC-V support
+
+ldconfig-native does not support RISC-V at the moment.
+Let's pull the reqired constants from upstream and add
+the required parsing code.
+
+Upstream-Status: Backport
+
+Signed-off-by: Christoph Muellner <cmuellner@linux.com>
+---
+ cache.c      |  6 ++++++
+ ldconfig.h   |  2 ++
+ readelflib.c | 10 ++++++++++
+ 3 files changed, 18 insertions(+)
+
+diff --git a/cache.c b/cache.c
+index c4f5411..a3b9e70 100644
+--- a/cache.c
++++ b/cache.c
+@@ -125,6 +125,12 @@ print_entry (const char *lib, int flag, unsigned int osversion,
+     case FLAG_AARCH64_LIB64:
+       fputs (",AArch64", stdout);
+       break;
++    case FLAG_RISCV_FLOAT_ABI_SOFT:
++      fputs (",soft-float", stdout);
++      break;
++    case FLAG_RISCV_FLOAT_ABI_DOUBLE:
++      fputs (",double-float", stdout);
++      break;
+     case 0:
+       break;
+     default:
+diff --git a/ldconfig.h b/ldconfig.h
+index 6a8a750..2e5e379 100644
+--- a/ldconfig.h
++++ b/ldconfig.h
+@@ -38,6 +38,8 @@
+ #define FLAG_ARM_LIBHF			0x0900
+ #define FLAG_AARCH64_LIB64		0x0a00
+ #define FLAG_ARM_LIBSF			0x0b00
++#define FLAG_RISCV_FLOAT_ABI_SOFT	0x0f00
++#define FLAG_RISCV_FLOAT_ABI_DOUBLE	0x1000
+ 
+ /* Name of auxiliary cache.  */
+ #define _PATH_LDCONFIG_AUX_CACHE "/var/cache/ldconfig/aux-cache"
+diff --git a/readelflib.c b/readelflib.c
+index 9ec0a54..a01e1ce 100644
+--- a/readelflib.c
++++ b/readelflib.c
+@@ -33,6 +33,10 @@
+ #define EM_AARCH64	183		/* ARM AARCH64 */
+ #endif
+ 
++#ifndef EM_RISCV
++#define EM_RISCV	243		/* RISC-V */
++#endif
++
+ #undef check_ptr
+ #define check_ptr(ptr)						\
+ do								\
+@@ -331,6 +335,12 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag,
+       /* see sysdeps/unix/sysv/linux/arm/readelflib.c */
+       *flag |= FLAG_AARCH64_LIB64|FLAG_ELF_LIBC6;
+       break;
++    case EM_RISCV:
++      /* RISC-V libraries are always libc.so.6+. */
++      /* NOTE: This does not correctly handle soft-float binaries */
++      /* see sysdeps/unix/sysv/linux/riscv/readelflib.c */
++      *flag |= FLAG_RISCV_FLOAT_ABI_DOUBLE|FLAG_ELF_LIBC6;
++      break;
+     default:
+       error(0, 0, "%s is a 64-bit ELF for unknown machine %lx\n",
+             file_name, (long)elf_header->e_machine);
+-- 
+2.25.1
+
diff --git a/poky/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb b/poky/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
index 919d114..fd1630b 100644
--- a/poky/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
+++ b/poky/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
@@ -15,6 +15,7 @@
            file://endian-ness_handling_fix.patch \
            file://add-64-bit-flag-for-ELF64-entries.patch \
            file://no-aux-cache.patch \
+           file://add-riscv-support.patch \
 "
 
 PR = "r2"
diff --git a/poky/meta/recipes-core/ifupdown/files/0001-ifupdown-skip-wrong-test-case.patch b/poky/meta/recipes-core/ifupdown/files/0001-ifupdown-skip-wrong-test-case.patch
new file mode 100644
index 0000000..c751e4f
--- /dev/null
+++ b/poky/meta/recipes-core/ifupdown/files/0001-ifupdown-skip-wrong-test-case.patch
@@ -0,0 +1,32 @@
+From 98243deface88614e3f332c4a85d04a9abce55ff Mon Sep 17 00:00:00 2001
+From: Zqiang <qiang.zhang@windriver.com>
+Date: Mon, 19 Apr 2021 14:15:45 +0800
+Subject: [PATCH] ifupdown: skip wrong test case
+
+The test parameters of testcase(12-15) file is not right,
+it triggers a test failure, these test items are invalid
+and are skipped directly.
+
+Upstream-Status: Inappropriate [oe-core specific]
+
+Signed-off-by: Zqiang <qiang.zhang@windriver.com>
+---
+ tests/testbuild-linux | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/testbuild-linux b/tests/testbuild-linux
+index 1181ea0..5f148eb 100755
+--- a/tests/testbuild-linux
++++ b/tests/testbuild-linux
+@@ -3,7 +3,7 @@
+ dir=tests/linux
+ 
+ result=true
+-for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
++for test in 1 2 3 4 5 6 7 8 9 10 11 16 17 18; do
+ 	if [ -e $dir/testcase.$test ]; then
+ 		args="$(cat $dir/testcase.$test | sed -n 's/^# RUN: //p')"
+ 	else
+-- 
+2.17.1
+
diff --git a/poky/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch b/poky/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch
index d7600cf..ea88a90 100644
--- a/poky/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch
+++ b/poky/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch
@@ -3,9 +3,12 @@
 Upstream-Status: Inappropriate [oe-core specific]
 
 Signed-off-by: Kai Kang <kai.kang@windriver.com>
+---
+ tests/testbuild-linux | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
 
 diff --git a/tests/testbuild-linux b/tests/testbuild-linux
-index 1181ea0..d5c1814 100755
+index 5f148eb..d9b1698 100755
 --- a/tests/testbuild-linux
 +++ b/tests/testbuild-linux
 @@ -1,6 +1,7 @@
@@ -16,8 +19,8 @@
 +dir=$curdir/linux
  
  result=true
- for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
-@@ -12,7 +13,7 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
+ for test in 1 2 3 4 5 6 7 8 9 10 11 16 17 18; do
+@@ -12,7 +13,7 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 16 17 18; do
          echo "Testcase $test: $args"
  
  	exitcode=0
@@ -26,7 +29,7 @@
                  >$dir/up-res-out.$test 2>$dir/up-res-err.$test || exitcode=$?
  
          (echo "exit code: $exitcode";
-@@ -20,7 +21,7 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
+@@ -20,7 +21,7 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 16 17 18; do
           echo "====stderr===="; cat $dir/up-res-err.$test) > $dir/up-res.$test
  
  	exitcode=0
@@ -35,7 +38,7 @@
                 >$dir/down-res-out.$test 2>$dir/down-res-err.$test || exitcode=$?
  
          (echo "exit code: $exitcode";
-@@ -28,9 +29,9 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
+@@ -28,9 +29,9 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 16 17 18; do
           echo "====stderr===="; cat $dir/down-res-err.$test) > $dir/down-res.$test
  
          if diff -ub $dir/up.$test $dir/up-res.$test && diff -ub $dir/down.$test $dir/down-res.$test; then
@@ -47,3 +50,5 @@
                  result=false
          fi
          echo "=========="
+--
+2.17.1
diff --git a/poky/meta/recipes-core/ifupdown/ifupdown_0.8.36.bb b/poky/meta/recipes-core/ifupdown/ifupdown_0.8.36.bb
index c0a90a3..0daf50a 100644
--- a/poky/meta/recipes-core/ifupdown/ifupdown_0.8.36.bb
+++ b/poky/meta/recipes-core/ifupdown/ifupdown_0.8.36.bb
@@ -13,6 +13,7 @@
            file://0001-Define-FNM_EXTMATCH-for-musl.patch \
            file://0001-Makefile-do-not-use-dpkg-for-determining-OS-type.patch \
            file://run-ptest \
+           file://0001-ifupdown-skip-wrong-test-case.patch \
            ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'file://tweak-ptest-script.patch', '', d)} \
            "
 SRCREV = "c73226073e2b13970ca613b20a13b9c0253bf9da"
diff --git a/poky/meta/recipes-core/images/build-appliance-image_15.0.0.bb b/poky/meta/recipes-core/images/build-appliance-image_15.0.0.bb
index 32f8d16..1176311 100644
--- a/poky/meta/recipes-core/images/build-appliance-image_15.0.0.bb
+++ b/poky/meta/recipes-core/images/build-appliance-image_15.0.0.bb
@@ -24,7 +24,7 @@
 
 inherit core-image setuptools3
 
-SRCREV ?= "b44849c32c87fbb8c5a465ecc29a6182e6781d78"
+SRCREV ?= "75f491e5e20bd0aade764ea5bd15f547fafb7684"
 SRC_URI = "git://git.yoctoproject.org/poky \
            file://Yocto_Build_Appliance.vmx \
            file://Yocto_Build_Appliance.vmxf \
diff --git a/poky/meta/recipes-core/libxcrypt/libxcrypt-compat_4.4.22.bb b/poky/meta/recipes-core/libxcrypt/libxcrypt-compat_4.4.23.bb
similarity index 100%
rename from poky/meta/recipes-core/libxcrypt/libxcrypt-compat_4.4.22.bb
rename to poky/meta/recipes-core/libxcrypt/libxcrypt-compat_4.4.23.bb
diff --git a/poky/meta/recipes-core/libxcrypt/libxcrypt.inc b/poky/meta/recipes-core/libxcrypt/libxcrypt.inc
index e4505a6..79a2aa4 100644
--- a/poky/meta/recipes-core/libxcrypt/libxcrypt.inc
+++ b/poky/meta/recipes-core/libxcrypt/libxcrypt.inc
@@ -10,7 +10,7 @@
 inherit autotools pkgconfig
 
 SRC_URI = "git://github.com/besser82/libxcrypt.git;branch=${SRCBRANCH}"
-SRCREV = "3df9620d08db207367c0c5152148665b5ce422e1"
+SRCREV = "5dcc36aeeb053654659e898fd3de7f365c1c4df5"
 SRCBRANCH ?= "develop"
 
 SRC_URI += "file://fix_cflags_handling.patch"
diff --git a/poky/meta/recipes-core/libxcrypt/libxcrypt_4.4.22.bb b/poky/meta/recipes-core/libxcrypt/libxcrypt_4.4.23.bb
similarity index 100%
rename from poky/meta/recipes-core/libxcrypt/libxcrypt_4.4.22.bb
rename to poky/meta/recipes-core/libxcrypt/libxcrypt_4.4.23.bb
diff --git a/poky/meta/recipes-core/libxml/libxml2_2.9.12.bb b/poky/meta/recipes-core/libxml/libxml2_2.9.12.bb
index 955d934..2d1e929 100644
--- a/poky/meta/recipes-core/libxml/libxml2_2.9.12.bb
+++ b/poky/meta/recipes-core/libxml/libxml2_2.9.12.bb
@@ -67,7 +67,7 @@
 PACKAGES += "${PN}-python"
 
 FILES_${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"
-FILES_${PN}-dev += "${libdir}/xml2Conf.sh ${libdir}/cmake/*"
+FILES_${PN}-dev += "${libdir}/xml2Conf.sh"
 FILES_${PN}-utils = "${bindir}/*"
 FILES_${PN}-python = "${PYTHON_SITEPACKAGES_DIR}"
 
diff --git a/poky/meta/recipes-core/meta/buildtools-tarball.bb b/poky/meta/recipes-core/meta/buildtools-tarball.bb
index 9da81d5..b5dae17 100644
--- a/poky/meta/recipes-core/meta/buildtools-tarball.bb
+++ b/poky/meta/recipes-core/meta/buildtools-tarball.bb
@@ -29,6 +29,8 @@
     nativesdk-rpcsvc-proto \
     nativesdk-patch \
     nativesdk-mtools \
+    nativesdk-zstd \
+    nativesdk-lz4 \
     "
 
 MULTIMACH_TARGET_SYS = "${SDK_ARCH}-nativesdk${SDK_VENDOR}-${SDK_OS}"
diff --git a/poky/meta/recipes-core/systemd/systemd/0001-test-seccomp-Check-for-__NR_ppoll-before-use.patch b/poky/meta/recipes-core/systemd/systemd/0001-test-seccomp-Check-for-__NR_ppoll-before-use.patch
new file mode 100644
index 0000000..0ba5fa2
--- /dev/null
+++ b/poky/meta/recipes-core/systemd/systemd/0001-test-seccomp-Check-for-__NR_ppoll-before-use.patch
@@ -0,0 +1,39 @@
+From 027ac2ad0695bb506460f9dd7e57149b71055887 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 8 Jun 2021 23:21:01 -0700
+Subject: [PATCH] test-seccomp: Check for __NR_ppoll before use
+
+some newer architectures like riscv32 do not have __NR_ppoll from get go
+
+Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/19858]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/test/test-seccomp.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/test/test-seccomp.c b/src/test/test-seccomp.c
+index b1f917eb54..daac0fcea8 100644
+--- a/src/test/test-seccomp.c
++++ b/src/test/test-seccomp.c
+@@ -832,7 +832,7 @@ static void test_load_syscall_filter_set_raw(void) {
+                 assert_se(s = hashmap_new(NULL));
+ #if defined __NR_poll && __NR_poll >= 0
+                 assert_se(hashmap_put(s, UINT32_TO_PTR(__NR_poll + 1), INT_TO_PTR(-1)) >= 0);
+-#else
++#elif defined __NR_ppoll
+                 assert_se(hashmap_put(s, UINT32_TO_PTR(__NR_ppoll + 1), INT_TO_PTR(-1)) >= 0);
+ #endif
+ 
+@@ -849,7 +849,8 @@ static void test_load_syscall_filter_set_raw(void) {
+                 assert_se(s = hashmap_new(NULL));
+ #if defined __NR_poll && __NR_poll >= 0
+                 assert_se(hashmap_put(s, UINT32_TO_PTR(__NR_poll + 1), INT_TO_PTR(EILSEQ)) >= 0);
+-#else
++#elif defined __NR_ppoll
++                assert_se(hashmap_put(s, UINT32_TO_PTR(__NR_ppoll + 1), INT_TO_PTR(-1)) >= 0);
+                 assert_se(hashmap_put(s, UINT32_TO_PTR(__NR_ppoll + 1), INT_TO_PTR(EILSEQ)) >= 0);
+ #endif
+ 
+-- 
+2.32.0
+
diff --git a/poky/meta/recipes-core/systemd/systemd_248.3.bb b/poky/meta/recipes-core/systemd/systemd_248.3.bb
index 3760770..f5022a9 100644
--- a/poky/meta/recipes-core/systemd/systemd_248.3.bb
+++ b/poky/meta/recipes-core/systemd/systemd_248.3.bb
@@ -26,6 +26,7 @@
            file://0003-implment-systemd-sysv-install-for-OE.patch \
            file://0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch \
            file://0001-test-parse-argument-Include-signal.h.patch \
+           file://0001-test-seccomp-Check-for-__NR_ppoll-before-use.patch \
            "
 
 # patches needed by musl
diff --git a/poky/meta/recipes-core/update-rc.d/update-rc.d_0.8.bb b/poky/meta/recipes-core/update-rc.d/update-rc.d_0.8.bb
index 75632d9..da71667 100644
--- a/poky/meta/recipes-core/update-rc.d/update-rc.d_0.8.bb
+++ b/poky/meta/recipes-core/update-rc.d/update-rc.d_0.8.bb
@@ -7,7 +7,7 @@
 LIC_FILES_CHKSUM = "file://update-rc.d;beginline=5;endline=15;md5=d40a07c27f535425934bb5001f2037d9"
 
 SRC_URI = "git://git.yoctoproject.org/update-rc.d"
-SRCREV = "4b150b25b38de688d25cde2b2d22c268ed65a748"
+SRCREV = "8636cf478d426b568c1be11dbd9346f67e03adac"
 
 UPSTREAM_CHECK_COMMITS = "1"
 
diff --git a/poky/meta/recipes-core/util-linux/util-linux.inc b/poky/meta/recipes-core/util-linux/util-linux.inc
index 9d7d8a2..0648366 100644
--- a/poky/meta/recipes-core/util-linux/util-linux.inc
+++ b/poky/meta/recipes-core/util-linux/util-linux.inc
@@ -36,5 +36,12 @@
            file://display_testname_for_subtest.patch \
            file://avoid_parallel_tests.patch \
            file://8a3a74160b96498d672e3652827aa7e6d7f3a120.patch \
+           file://tests-kill.patch \
+           file://tests-blkdiscard.patch \
+           file://tests-ul.patch \
+           file://tests-eject.patch \
+           file://tests-lscpu.patch \
+           file://0001-login-fix-close_range-use.patch \
            "
+
 SRC_URI[sha256sum] = "bd07b7e98839e0359842110525a3032fdb8eaf3a90bedde3dd1652d32d15cce5"
diff --git a/poky/meta/recipes-core/util-linux/util-linux/0001-login-fix-close_range-use.patch b/poky/meta/recipes-core/util-linux/util-linux/0001-login-fix-close_range-use.patch
new file mode 100644
index 0000000..7a47597
--- /dev/null
+++ b/poky/meta/recipes-core/util-linux/util-linux/0001-login-fix-close_range-use.patch
@@ -0,0 +1,62 @@
+From 76ae0badd3fd7c8653fa4d3c78d2dcfcec51d23d Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak@redhat.com>
+Date: Wed, 14 Jul 2021 17:25:57 +0200
+Subject: [PATCH] login: fix close_range() use
+
+This new syscall comes with three arguments (see kernel commit
+278a5fbaed89dacd04e9d052f4594ffd0e0585de). Not sure why util-linux
+assume only two.
+
+Upstream-Status: Backport [https://github.com/karelzak/util-linux/commit/b8d99a618baffb4fc03cda4c40e29778b6d77ad4]
+Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1981729
+Signed-off-by: Karel Zak <kzak@redhat.com>
+---
+ include/fileutils.h | 4 ++--
+ lib/fileutils.c     | 2 +-
+ login-utils/login.c | 2 +-
+ 3 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/include/fileutils.h b/include/fileutils.h
+index ad54b95..f86426b 100644
+--- a/include/fileutils.h
++++ b/include/fileutils.h
+@@ -82,9 +82,9 @@ static inline struct dirent *xreaddir(DIR *dp)
+ # if defined(SYS_close_range)
+ #  include <sys/types.h>
+ #  ifndef HAVE_CLOSE_RANGE
+-static inline int close_range(unsigned int first, unsigned int last)
++static inline int close_range(unsigned int first, unsigned int last, int flags)
+ {
+-	return syscall(SYS_close_range, first, last);
++	return syscall(SYS_close_range, first, last, flags);
+ }
+ #  endif
+ #  define HAVE_CLOSE_RANGE 1
+diff --git a/lib/fileutils.c b/lib/fileutils.c
+index 846b718..a979b03 100644
+--- a/lib/fileutils.c
++++ b/lib/fileutils.c
+@@ -189,7 +189,7 @@ int main(int argc, char *argv[])
+ 		ignore_result( dup(STDIN_FILENO) );
+
+ # ifdef HAVE_CLOSE_RANGE
+-		close_range(STDERR_FILENO + 1, ~0U);
++		close_range(STDERR_FILENO + 1, ~0U, 0);
+ # else
+ 		ul_close_all_fds(STDERR_FILENO + 1, ~0U);
+ # endif
+diff --git a/login-utils/login.c b/login-utils/login.c
+index 7fefd05..94a042d 100644
+--- a/login-utils/login.c
++++ b/login-utils/login.c
+@@ -1358,7 +1358,7 @@ static void initialize(int argc, char **argv, struct login_context *cxt)
+ #endif
+ 	}
+ #ifdef HAVE_CLOSE_RANGE
+-	close_range(STDERR_FILENO + 1, ~0U);
++	close_range(STDERR_FILENO + 1, ~0U, 0);
+ #else
+ 	ul_close_all_fds(STDERR_FILENO + 1, ~0U);
+ #endif
+--
+2.32.0
diff --git a/poky/meta/recipes-core/util-linux/util-linux/run-ptest b/poky/meta/recipes-core/util-linux/util-linux/run-ptest
index e135ee5..3a910be 100644
--- a/poky/meta/recipes-core/util-linux/util-linux/run-ptest
+++ b/poky/meta/recipes-core/util-linux/util-linux/run-ptest
@@ -13,31 +13,12 @@
 export bindir=$(dirname $current_path)
 export PATH=$bindir/bin:$PATH
 
-cd tests || exit 1                                                          
-
-comps=$(find ts/ -type f -perm -111 -regex ".*/[^\.~]*" |  sort)
-
-
-echo
-echo "-------------------- util-linux regression tests --------------------"
-echo
-echo "                    For development purpose only.                    "
-echo "                 Don't execute on production system!                 "
-echo
-
-res=0
-count=0
-for ts in $comps; 
-do 
-   $ts | sed -u '{        
+./tests/run.sh --use-system-commands --parsable --show-diff | sed -u '{
       s/^\(.*\):\(.*\) \.\.\. OK$/PASS: \1:\2/                              
       s/^\(.*\):\(.*\) \.\.\. FAILED \(.*\)$/FAIL: \1:\2 \3/                
       s/^\(.*\):\(.*\) \.\.\. SKIPPED \(.*\)$/SKIP: \1:\2 \3/               
-   }' 
-done
-
+   }'
 
 if [ "x$UDEV_PID" != "x" ]; then
     /etc/init.d/udev start
 fi
-
diff --git a/poky/meta/recipes-core/util-linux/util-linux/tests-blkdiscard.patch b/poky/meta/recipes-core/util-linux/util-linux/tests-blkdiscard.patch
new file mode 100644
index 0000000..34b07a4
--- /dev/null
+++ b/poky/meta/recipes-core/util-linux/util-linux/tests-blkdiscard.patch
@@ -0,0 +1,31 @@
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+
+From 45fe65d934df2c938701f1c3cd3e0a6f3bdf25e6 Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@arm.com>
+Date: Tue, 29 Jun 2021 18:10:40 +0100
+Subject: [PATCH] tests/blkdiscard: check correct log file for errors
+
+When checking if the discard ioctl is supported, look in stderr not stdout.
+
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+---
+ tests/ts/blkdiscard/offsets | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/ts/blkdiscard/offsets b/tests/ts/blkdiscard/offsets
+index 9dddc35e2..5e724d51b 100755
+--- a/tests/ts/blkdiscard/offsets
++++ b/tests/ts/blkdiscard/offsets
+@@ -48,7 +48,7 @@ ts_log "testing offsets with full block size"
+ run_tscmd $TS_CMD_BLKDISCARD -v $DEVICE
+ if [ "$?" != "0" ]; then
+ 	# Skip the rest? For example loop backing files on NFS seem unsupported.
+-	grep -q "BLKDISCARD ioctl failed: Operation not supported" "$TS_OUTPUT" \
++	grep -q "BLKDISCARD ioctl failed: Operation not supported" "$TS_ERRLOG" \
+ 		&& ts_skip "BLKDISCARD not supported"
+ fi
+ run_tscmd $TS_CMD_BLKDISCARD -v -o 1 $DEVICE
+-- 
+2.25.1
+
diff --git a/poky/meta/recipes-core/util-linux/util-linux/tests-eject.patch b/poky/meta/recipes-core/util-linux/util-linux/tests-eject.patch
new file mode 100644
index 0000000..51e914d
--- /dev/null
+++ b/poky/meta/recipes-core/util-linux/util-linux/tests-eject.patch
@@ -0,0 +1,56 @@
+Upstream-Status: Submitted [https://github.com/karelzak/util-linux/pull/1375]
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+
+From dd956268ba89fc1caf83c45c3c495f34d261e0e2 Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@arm.com>
+Date: Thu, 1 Jul 2021 20:44:31 +0100
+Subject: [PATCH] test/eject: guard asan LD_PRELOAD with use-system-commands
+ check
+
+This test tries to add asan to LD_PRELOAD because the just-built eject
+will call the host /bin/umount, and apparently asan doesn't like this.
+
+However, if ldd isn't present, this fails as the path to asan is the
+error message saying that ldd isn't present.
+
+As the asan workaround is only needed when executing the binaries that
+have just been built and not the system binaries, only use it if the
+test is on the built binaries.
+
+Closes #1373.
+
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+---
+ tests/ts/eject/umount | 16 +++++++++-------
+ 1 file changed, 9 insertions(+), 7 deletions(-)
+
+diff --git a/tests/ts/eject/umount b/tests/ts/eject/umount
+index a829d46c0..2be281ee3 100755
+--- a/tests/ts/eject/umount
++++ b/tests/ts/eject/umount
+@@ -60,13 +60,15 @@ function deinit_device {
+ 	ts_scsi_debug_rmmod
+ }
+ 
+-# As the eject binary execl()s an uninstrumented /bin/umount binary, we need
+-# to explicitly $LD_PRELOAD the ASan's runtime DSO, otherwise ASan will complain.
+-# Since all three utilities used by this test (eject, fdisk, mount) are just
+-# libtool wrappers, let's check the kill binary instead, which should have
+-# the needed DSO information.
+-ASAN_RT_PATH="$(ts_get_asan_rt_path "$TS_CMD_KILL")"
+-[ -n "$ASAN_RT_PATH" ] && export LD_PRELOAD="$ASAN_RT_PATH:$LD_PRELOAD"
++if [ "$TS_USE_SYSTEM_COMMANDS" != "yes" ]; then
++	# As the eject binary execl()s an uninstrumented /bin/umount binary, we need
++	# to explicitly $LD_PRELOAD the ASan's runtime DSO, otherwise ASan will complain.
++	# Since all three utilities used by this test (eject, fdisk, mount) are just
++	# libtool wrappers, let's check the kill binary instead, which should have
++	# the needed DSO information.
++	ASAN_RT_PATH="$(ts_get_asan_rt_path "$TS_CMD_KILL")"
++	[ -n "$ASAN_RT_PATH" ] && export LD_PRELOAD="$ASAN_RT_PATH:$LD_PRELOAD"
++fi
+ 
+ ts_init_subtest "by-disk"
+ init_device
+-- 
+2.25.1
+
diff --git a/poky/meta/recipes-core/util-linux/util-linux/tests-kill.patch b/poky/meta/recipes-core/util-linux/util-linux/tests-kill.patch
new file mode 100644
index 0000000..fa49fd4
--- /dev/null
+++ b/poky/meta/recipes-core/util-linux/util-linux/tests-kill.patch
@@ -0,0 +1,88 @@
+Don't hardcode the use of /bin/kill, as this could be kill.procps.  Instead ask
+the shell what kill binary to use, which will be the symlink in
+/usr/lib/util-linux/ptest/bin/.
+
+Upstream-Status: Backport [https://github.com/karelzak/util-linux/pull/1367]
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+
+From e3f8a88cf688dffacb5f6033a8d24e2db40f75f6 Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@arm.com>
+Date: Tue, 29 Jun 2021 16:34:20 +0100
+Subject: [PATCH] Don't hardcode /bin
+
+---
+ tests/ts/kill/all_processes  | 2 +-
+ tests/ts/kill/name_to_number | 2 +-
+ tests/ts/kill/options        | 2 +-
+ tests/ts/kill/print_pid      | 2 +-
+ tests/ts/kill/queue          | 2 +-
+ 5 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/tests/ts/kill/all_processes b/tests/ts/kill/all_processes
+index 0b137574d..b2280777f 100755
+--- a/tests/ts/kill/all_processes
++++ b/tests/ts/kill/all_processes
+@@ -22,7 +22,7 @@ ts_skip_nonroot
+ 
+ # make sure we do not use shell built-in command
+ if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then
+-	TS_CMD_KILL="/bin/kill"
++	TS_CMD_KILL="$(which kill)"
+ fi
+ 
+ ts_check_test_command "$TS_CMD_KILL"
+diff --git a/tests/ts/kill/name_to_number b/tests/ts/kill/name_to_number
+index 9f4881cb7..8a7f4bef0 100755
+--- a/tests/ts/kill/name_to_number
++++ b/tests/ts/kill/name_to_number
+@@ -20,7 +20,7 @@ ts_init "$*"
+ 
+ # make sure we do not use shell built-in command
+ if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then
+-	TS_CMD_KILL="/bin/kill"
++	TS_CMD_KILL="$(which kill)"
+ fi
+ 
+ ts_check_test_command "$TS_CMD_KILL"
+diff --git a/tests/ts/kill/options b/tests/ts/kill/options
+index 2788c70a2..10653a543 100755
+--- a/tests/ts/kill/options
++++ b/tests/ts/kill/options
+@@ -20,7 +20,7 @@ ts_init "$*"
+ 
+ # make sure we do not use shell built-in command
+ if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then
+-	TS_CMD_KILL="/bin/kill"
++	TS_CMD_KILL="$(which kill)"
+ fi
+ 
+ ts_check_test_command "$TS_CMD_KILL"
+diff --git a/tests/ts/kill/print_pid b/tests/ts/kill/print_pid
+index 6926a3714..6e2db3711 100755
+--- a/tests/ts/kill/print_pid
++++ b/tests/ts/kill/print_pid
+@@ -20,7 +20,7 @@ ts_init "$*"
+ 
+ # make sure we do not use shell built-in command
+ if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then
+-	TS_CMD_KILL="/bin/kill"
++	TS_CMD_KILL="$(which kill)"
+ fi
+ 
+ ts_check_test_command "$TS_CMD_KILL"
+diff --git a/tests/ts/kill/queue b/tests/ts/kill/queue
+index 18f10e8c2..6c9e9efc9 100755
+--- a/tests/ts/kill/queue
++++ b/tests/ts/kill/queue
+@@ -20,7 +20,7 @@ ts_init "$*"
+ 
+ # make sure we do not use shell built-in command
+ if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then
+-	TS_CMD_KILL="/bin/kill"
++	TS_CMD_KILL="$(which kill)"
+ fi
+ 
+ ts_check_test_command "$TS_CMD_KILL"
+-- 
+2.25.1
+
diff --git a/poky/meta/recipes-core/util-linux/util-linux/tests-lscpu.patch b/poky/meta/recipes-core/util-linux/util-linux/tests-lscpu.patch
new file mode 100644
index 0000000..36a19bd
--- /dev/null
+++ b/poky/meta/recipes-core/util-linux/util-linux/tests-lscpu.patch
@@ -0,0 +1,42 @@
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+
+From c2ca2837a27a3f1344904037ea691bfdbb288f02 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak@redhat.com>
+Date: Fri, 2 Jul 2021 13:12:13 +0200
+Subject: [PATCH] lscpu: don't use DMI if executed with --sysroot
+
+Signed-off-by: Karel Zak <kzak@redhat.com>
+---
+ sys-utils/lscpu-arm.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/sys-utils/lscpu-arm.c b/sys-utils/lscpu-arm.c
+index d52765f9d..c7128094c 100644
+--- a/sys-utils/lscpu-arm.c
++++ b/sys-utils/lscpu-arm.c
+@@ -322,7 +322,8 @@ static void arm_decode(struct lscpu_cxt *cxt, struct lscpu_cputype *ct)
+ 
+ 	arm_ids_decode(ct);
+ 	arm_rXpY_decode(ct);
+-	if (cxt->is_cluster)
++
++	if (!cxt->noalive && cxt->is_cluster)
+ 		ct->nr_socket_on_cluster = get_number_of_physical_sockets_from_dmi();
+ }
+ 
+@@ -330,8 +331,9 @@ static int is_cluster_arm(struct lscpu_cxt *cxt)
+ {
+ 	struct stat st;
+ 
+-	if (!(strcmp(cxt->arch->name, "aarch64")) &&
+-	     (stat(_PATH_ACPI_PPTT, &st) < 0) && (cxt->ncputypes == 1))
++	if (!cxt->noalive
++	    && strcmp(cxt->arch->name, "aarch64") == 0
++	    && stat(_PATH_ACPI_PPTT, &st) < 0 && cxt->ncputypes == 1)
+ 		return 1;
+ 	else
+ 		return 0;
+-- 
+2.25.1
+
diff --git a/poky/meta/recipes-core/util-linux/util-linux/tests-ul.patch b/poky/meta/recipes-core/util-linux/util-linux/tests-ul.patch
new file mode 100644
index 0000000..6896393
--- /dev/null
+++ b/poky/meta/recipes-core/util-linux/util-linux/tests-ul.patch
@@ -0,0 +1,35 @@
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+
+From b1c71f19ea404e74d36ca5b8fbb0484043cdaef3 Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@arm.com>
+Date: Wed, 30 Jun 2021 11:25:01 +0100
+Subject: [PATCH] tests: mark ul/ul as a known failure
+
+As with ul/basic, this test produces different output when ran under
+different terminals, which isn't very useful.
+
+Set TS_KNOWN_FAIL so that these problems don't cause the test to fail.
+
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+---
+ tests/ts/ul/ul | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/tests/ts/ul/ul b/tests/ts/ul/ul
+index b856e33db..c707658ac 100755
+--- a/tests/ts/ul/ul
++++ b/tests/ts/ul/ul
+@@ -20,6 +20,9 @@ ts_init "$*"
+ 
+ ts_check_test_command "$TS_CMD_UL"
+ 
++# This test provides different result on some terminals and virtual machines
++TS_KNOWN_FAIL="yes"
++
+ printf "a\x08ab\x5F\x08c\\n\\ttab\\f\\b\\r" |
+ 	$TS_CMD_UL -t xterm >> $TS_OUTPUT 2>> $TS_ERRLOG
+ 
+-- 
+2.25.1
+
diff --git a/poky/meta/recipes-core/util-linux/util-linux_2.37.bb b/poky/meta/recipes-core/util-linux/util-linux_2.37.bb
index 9a50c75..2548b72 100644
--- a/poky/meta/recipes-core/util-linux/util-linux_2.37.bb
+++ b/poky/meta/recipes-core/util-linux/util-linux_2.37.bb
@@ -71,7 +71,7 @@
     --enable-mount --enable-partx --enable-raw --enable-rfkill \
     --enable-unshare --enable-write \
     \
-    --disable-bfs --disable-chfn-chsh --disable-login \
+    --disable-bfs --disable-login \
     --disable-makeinstall-chown --disable-minix --disable-newgrp \
     --disable-use-tty-group --disable-vipw \
     \
@@ -91,7 +91,7 @@
 # build host versions during development
 #
 PACKAGECONFIG ?= "pcre2"
-PACKAGECONFIG_class-target ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}"
+PACKAGECONFIG_class-target ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'chfn-chsh pam', '', d)}"
 PACKAGECONFIG[pam] = "--enable-su --enable-runuser,--disable-su --disable-runuser, libpam,"
 # Respect the systemd feature for uuidd
 PACKAGECONFIG[systemd] = "--with-systemd --with-systemdsystemunitdir=${systemd_system_unitdir}, --without-systemd --without-systemdsystemunitdir,systemd"
@@ -102,6 +102,7 @@
 # PCRE support in hardlink
 PACKAGECONFIG[pcre2] = ",,libpcre2"
 PACKAGECONFIG[cryptsetup] = "--with-cryptsetup,--without-cryptsetup,cryptsetup"
+PACKAGECONFIG[chfn-chsh] = "--enable-chfn-chsh,--disable-chfn-chsh,"
 
 EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'"
 
@@ -132,8 +133,8 @@
 RPROVIDES_${PN}-dev = "${PN}-libblkid-dev ${PN}-libmount-dev"
 
 RDEPENDS_${PN}-bash-completion += "${PN}-lsblk"
-RDEPENDS_${PN}-ptest += "bash bc btrfs-tools coreutils e2fsprogs grep iproute2 kmod mdadm procps sed socat which xz"
-RRECOMMENDS_${PN}-ptest += "kernel-module-scsi-debug"
+RDEPENDS_${PN}-ptest += "bash bc btrfs-tools coreutils e2fsprogs findutils grep iproute2 kmod mdadm procps sed socat which xz"
+RRECOMMENDS_${PN}-ptest += "kernel-module-scsi-debug kernel-module-sd-mod kernel-module-loop"
 RDEPENDS_${PN}-swaponoff = "${PN}-swapon ${PN}-swapoff"
 ALLOW_EMPTY_${PN}-swaponoff = "1"
 
@@ -209,6 +210,8 @@
 ALTERNATIVE_LINK_NAME[blkid] = "${base_sbindir}/blkid"
 ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev"
 ALTERNATIVE_LINK_NAME[cal] = "${bindir}/cal"
+ALTERNATIVE_LINK_NAME[chfn] = "${bindir}/chfn"
+ALTERNATIVE_LINK_NAME[chsh] = "${bindir}/chsh"
 ALTERNATIVE_LINK_NAME[chrt] = "${bindir}/chrt"
 ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg"
 ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject"
@@ -278,25 +281,10 @@
     cp -pR ${S}/tests/ts ${D}${PTEST_PATH}/tests/
     cp ${WORKDIR}/build/config.h ${D}${PTEST_PATH}
 
-    # The original paths of executables to be tested point to a local folder containing
-    # the executables. We want to test the installed executables, not the local copies.
-    # So strip the paths, the executables will be located via "which"
-    sed  -i \
-         -e '/^TS_CMD/ s|$top_builddir/||g' \
-         -e '/^TS_HELPER/ s|$top_builddir|${PTEST_PATH}|g' \
-         ${D}${PTEST_PATH}/tests/commands.sh
+    sed -i 's|@base_sbindir@|${base_sbindir}|g' ${D}${PTEST_PATH}/run-ptest
 
-    # Change 'if [ ! -x "$1" ]' to 'if [ ! -x "`which $1 2>/dev/null`"]'
-    sed -i -e \
-        '/^\tif[[:space:]]\[[[:space:]]![[:space:]]-x[[:space:]]"$1"/s|$1|`which $1 2>/dev/null`|g' \
-         ${D}${PTEST_PATH}/tests/functions.sh
-
-    # Running "kill" without the the complete path would use the shell's built-in kill
-    sed -i -e \
-         '/^TS_CMD_KILL/ s|kill|${PTEST_PATH}/bin/kill|g' \
-         ${D}${PTEST_PATH}/tests/commands.sh
-
-
-    sed -i 's|@base_sbindir@|${base_sbindir}|g'       ${D}${PTEST_PATH}/run-ptest
-
+    # chfn needs PAM
+    if ! ${@bb.utils.contains('PACKAGECONFIG', 'pam', 'true', 'false', d)}; then
+        rm -rf ${D}${PTEST_PATH}/tests/ts/chfn
+    fi
 }