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-support/libseccomp/files/0001-arch-Add-riscv32-architecture-support.patch b/poky/meta/recipes-support/libseccomp/files/0001-arch-Add-riscv32-architecture-support.patch
new file mode 100644
index 0000000..62bd61f
--- /dev/null
+++ b/poky/meta/recipes-support/libseccomp/files/0001-arch-Add-riscv32-architecture-support.patch
@@ -0,0 +1,734 @@
+From 6d127a0463ea2d7bb5021562678324e28e0407e5 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 8 Jun 2021 19:45:34 -0700
+Subject: [PATCH 1/2] arch: Add riscv32 architecture support
+
+Support for rv32 was upstreamed into 5.4+ kernel
+
+Upstream-Status: Submitted [https://github.com/seccomp/libseccomp/pull/327]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ CREDITS                            |  1 +
+ README.md                          |  1 +
+ doc/man/man1/scmp_sys_resolver.1   |  2 +-
+ doc/man/man3/seccomp_arch_add.3    |  1 +
+ include/seccomp-syscalls.h         | 31 ++++++++++++++++++
+ include/seccomp.h.in               |  9 ++++++
+ src/Makefile.am                    |  1 +
+ src/arch-riscv32.c                 | 31 ++++++++++++++++++
+ src/arch-riscv32.h                 | 22 +++++++++++++
+ src/arch-syscall-dump.c            |  4 +++
+ src/arch-syscall-validate          | 51 +++++++++++++++++++++++++++++-
+ src/arch.c                         | 11 ++++++-
+ src/gen_pfc.c                      |  2 ++
+ src/python/libseccomp.pxd          |  1 +
+ src/python/seccomp.pyx             |  2 ++
+ src/syscalls.c                     |  1 +
+ src/syscalls.csv                   |  2 +-
+ src/syscalls.h                     |  2 ++
+ src/system.c                       |  1 +
+ tests/15-basic-resolver.c          |  1 +
+ tests/16-sim-arch_basic.c          |  6 ++++
+ tests/16-sim-arch_basic.py         |  1 +
+ tests/23-sim-arch_all_le_basic.c   |  3 ++
+ tests/23-sim-arch_all_le_basic.py  |  1 +
+ tests/56-basic-iterate_syscalls.c  |  1 +
+ tests/56-basic-iterate_syscalls.py |  1 +
+ tests/regression                   |  5 +--
+ tools/scmp_arch_detect.c           |  3 ++
+ tools/scmp_bpf_disasm.c            |  2 ++
+ tools/scmp_bpf_sim.c               |  2 ++
+ tools/util.c                       |  6 +++-
+ tools/util.h                       |  7 ++++
+ 32 files changed, 208 insertions(+), 7 deletions(-)
+ create mode 100644 src/arch-riscv32.c
+ create mode 100644 src/arch-riscv32.h
+
+diff --git a/CREDITS b/CREDITS
+index d6bbc2a..ad2f7e0 100644
+--- a/CREDITS
++++ b/CREDITS
+@@ -33,6 +33,7 @@ John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
+ Jonah Petri <jonah@petri.us>
+ Justin Cormack <justin.cormack@docker.com>
+ Kees Cook <keescook@chromium.org>
++Khem Raj <raj.khem@gmail.com>
+ Kyle R. Conway <kyle.r.conway@gmail.com>
+ Kenta Tada <Kenta.Tada@sony.com>
+ Luca Bruno <lucab@debian.org>
+diff --git a/README.md b/README.md
+index ba02186..2cd718f 100644
+--- a/README.md
++++ b/README.md
+@@ -54,6 +54,7 @@ The libseccomp library currently supports the architectures listed below:
+ * 32-bit s390 (s390)
+ * 64-bit s390x (s390x)
+ * 64-bit RISC-V (riscv64)
++* 32-bit RISC-V (riscv32)
+ * 32-bit SuperH big endian (sheb)
+ * 32-bit SuperH (sh)
+
+diff --git a/doc/man/man1/scmp_sys_resolver.1 b/doc/man/man1/scmp_sys_resolver.1
+index 267187b..fc68d18 100644
+--- a/doc/man/man1/scmp_sys_resolver.1
++++ b/doc/man/man1/scmp_sys_resolver.1
+@@ -36,7 +36,7 @@ The architecture to use for resolving the system call.  Valid
+ .I ARCH
+ values are "x86", "x86_64", "x32", "arm", "aarch64", "mips", "mipsel", "mips64",
+ "mipsel64", "mips64n32", "mipsel64n32", "parisc", "parisc64", "ppc", "ppc64",
+-"ppc64le", "s390", "s390x", "sheb" and "sh".
++"ppc64le", "riscv32", "s390", "s390x", "sheb" and "sh".
+ .TP
+ .B \-t
+ If necessary, translate the system call name to the proper system call number,
+diff --git a/doc/man/man3/seccomp_arch_add.3 b/doc/man/man3/seccomp_arch_add.3
+index 7baa21e..8966b3a 100644
+--- a/doc/man/man3/seccomp_arch_add.3
++++ b/doc/man/man3/seccomp_arch_add.3
+@@ -30,6 +30,7 @@ seccomp_arch_add, seccomp_arch_remove, seccomp_arch_exist, seccomp_arch_native \
+ .B #define SCMP_ARCH_S390X
+ .B #define SCMP_ARCH_PARISC
+ .B #define SCMP_ARCH_PARISC64
++.B #define SCMP_ARCH_RISCV32
+ .B #define SCMP_ARCH_RISCV64
+ .sp
+ .BI "uint32_t seccomp_arch_resolve_name(const char *" arch_name ");"
+diff --git a/include/seccomp-syscalls.h b/include/seccomp-syscalls.h
+index c694db1..c6ea5ca 100644
+--- a/include/seccomp-syscalls.h
++++ b/include/seccomp-syscalls.h
+@@ -275,6 +275,13 @@
+ #define __PNR_ppoll				-10241
+ #define __PNR_renameat				-10242
+ #define __PNR_riscv_flush_icache		-10243
++#define __PNR_fstat				-10244
++#define __PNR_futex				-10245
++#define __PNR_nanosleep				-10246
++#define __PNR_lseek				-10247
++#define __PNR_clock_gettime			-10248
++#define __PNR_clock_nanosleep			-10249
++#define __PNR_gettimeofday			-10250
+
+ /*
+  * libseccomp syscall definitions
+@@ -442,7 +449,11 @@
+ #define __SNR_clock_getres_time64	__PNR_clock_getres_time64
+ #endif
+
++#ifdef __NR_clock_gettime
+ #define __SNR_clock_gettime		__NR_clock_gettime
++#else
++#define __SNR_clock_gettime		__PNR_clock_gettime
++#endif
+
+ #ifdef __NR_clock_gettime64
+ #define __SNR_clock_gettime64		__NR_clock_gettime64
+@@ -450,7 +461,11 @@
+ #define __SNR_clock_gettime64		__PNR_clock_gettime64
+ #endif
+
++#ifdef __NR_clock_nanosleep
+ #define __SNR_clock_nanosleep		__NR_clock_nanosleep
++#else
++#define __SNR_clock_nanosleep		__PNR_clock_nanosleep
++#endif
+
+ #ifdef __NR_clock_nanosleep_time64
+ #define __SNR_clock_nanosleep_time64	__NR_clock_nanosleep_time64
+@@ -710,7 +725,11 @@
+ #define __SNR_ftruncate64		__PNR_ftruncate64
+ #endif
+
++#ifdef __NR_futex
+ #define __SNR_futex			__NR_futex
++#else
++#define __SNR_futex			__PNR_futex
++#endif
+
+ #ifdef __NR_futex_time64
+ #define __SNR_futex_time64		__NR_futex_time64
+@@ -896,7 +915,11 @@
+
+ #define __SNR_gettid			__NR_gettid
+
++#ifdef __NR_gettimeofday
+ #define __SNR_gettimeofday		__NR_gettimeofday
++#else
++#define __SNR_gettimeofday		__PNR_gettimeofday
++#endif
+
+ #ifdef __NR_getuid
+ #define __SNR_getuid			__NR_getuid
+@@ -1046,7 +1069,11 @@
+
+ #define __SNR_lremovexattr		__NR_lremovexattr
+
++#ifdef __NR_lseek
+ #define __SNR_lseek			__NR_lseek
++#else
++#define __SNR_lseek			__PNR_lseek
++#endif
+
+ #define __SNR_lsetxattr			__NR_lsetxattr
+
+@@ -1218,7 +1245,11 @@
+
+ #define __SNR_name_to_handle_at			__NR_name_to_handle_at
+
++#ifdef __NR_nanosleep
+ #define __SNR_nanosleep			__NR_nanosleep
++#else
++#define __SNR_nanosleep			__PNR_nanosleep
++#endif
+
+ #ifdef __NR_newfstatat
+ #define __SNR_newfstatat		__NR_newfstatat
+diff --git a/include/seccomp.h.in b/include/seccomp.h.in
+index 333a89c..2e911db 100644
+--- a/include/seccomp.h.in
++++ b/include/seccomp.h.in
+@@ -214,7 +214,16 @@ struct scmp_arg_cmp {
+ #endif /* EM_RISCV */
+ #define AUDIT_ARCH_RISCV64	(EM_RISCV|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
+ #endif /* AUDIT_ARCH_RISCV64 */
++
++#ifndef AUDIT_ARCH_RISCV32
++#ifndef EM_RISCV
++#define EM_RISCV		243
++#endif /* EM_RISCV */
++#define AUDIT_ARCH_RISCV32	(EM_RISCV|__AUDIT_ARCH_LE)
++#endif /* AUDIT_ARCH_RISCV32 */
++
+ #define SCMP_ARCH_RISCV64	AUDIT_ARCH_RISCV64
++#define SCMP_ARCH_RISCV32	AUDIT_ARCH_RISCV32
+
+ /**
+  * The SuperH architecture tokens
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 7b59810..7961925 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -44,6 +44,7 @@ SOURCES_ALL = \
+ 	arch-ppc.h arch-ppc.c \
+ 	arch-ppc64.h arch-ppc64.c \
+ 	arch-riscv64.h arch-riscv64.c \
++	arch-riscv32.h arch-riscv32.c \
+ 	arch-s390.h arch-s390.c \
+ 	arch-s390x.h arch-s390x.c \
+ 	arch-sh.h arch-sh.c \
+diff --git a/src/arch-riscv32.c b/src/arch-riscv32.c
+new file mode 100644
+index 0000000..53b3126
+--- /dev/null
++++ b/src/arch-riscv32.c
+@@ -0,0 +1,31 @@
++/*
++ * This library is free software; you can redistribute it and/or modify it
++ * under the terms of version 2.1 of the GNU Lesser General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This library is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
++ * for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * along with this library; if not, see <http://www.gnu.org/licenses>.
++ */
++
++#include <stdlib.h>
++#include <errno.h>
++#include <linux/audit.h>
++
++#include "arch.h"
++#include "arch-riscv32.h"
++
++const struct arch_def arch_def_riscv32 = {
++	.token = SCMP_ARCH_RISCV32,
++	.token_bpf = AUDIT_ARCH_RISCV32,
++	.size = ARCH_SIZE_32,
++	.endian = ARCH_ENDIAN_LITTLE,
++	.syscall_resolve_name = riscv32_syscall_resolve_name,
++	.syscall_resolve_num = riscv32_syscall_resolve_num,
++	.syscall_rewrite = NULL,
++	.rule_add = NULL,
++};
+diff --git a/src/arch-riscv32.h b/src/arch-riscv32.h
+new file mode 100644
+index 0000000..082a77d
+--- /dev/null
++++ b/src/arch-riscv32.h
+@@ -0,0 +1,22 @@
++/*
++ * This library is free software; you can redistribute it and/or modify it
++ * under the terms of version 2.1 of the GNU Lesser General Public License as
++ * published by the Free Software Foundation.
++ *
++ * This library is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
++ * for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * along with this library; if not, see <http://www.gnu.org/licenses>.
++ */
++
++#ifndef _ARCH_RISCV32_H
++#define _ARCH_RISCV32_H
++
++#include "arch.h"
++
++ARCH_DECL(riscv32)
++
++#endif
+diff --git a/src/arch-syscall-dump.c b/src/arch-syscall-dump.c
+index 843483b..c6ab57d 100644
+--- a/src/arch-syscall-dump.c
++++ b/src/arch-syscall-dump.c
+@@ -43,6 +43,7 @@
+ #include "arch-ppc.h"
+ #include "arch-ppc64.h"
+ #include "arch-riscv64.h"
++#include "arch-riscv32.h"
+ #include "arch-s390.h"
+ #include "arch-s390x.h"
+ #include "arch-sh.h"
+@@ -135,6 +136,9 @@ int main(int argc, char *argv[])
+ 		case SCMP_ARCH_RISCV64:
+ 			sys = riscv64_syscall_iterate(iter);
+ 			break;
++		case SCMP_ARCH_RISCV32:
++			sys = riscv32_syscall_iterate(iter);
++			break;
+ 		case SCMP_ARCH_S390:
+ 			sys = s390_syscall_iterate(iter);
+ 			break;
+diff --git a/src/arch-syscall-validate b/src/arch-syscall-validate
+index 68bebef..85c7f3d 100755
+--- a/src/arch-syscall-validate
++++ b/src/arch-syscall-validate
+@@ -519,6 +519,49 @@ function dump_lib_riscv64() {
+ 	dump_lib_arch riscv64 | mangle_lib_syscall riscv64
+ }
+
++#
++# Dump the riscv32 system syscall table
++#
++# Arguments:
++#     1    path to the kernel source
++#
++#  Dump the architecture's syscall table to stdout.
++#
++function dump_sys_riscv32() {
++	local sed_filter=""
++
++	sed_filter+='s/__NR3264_fadvise64/223/;'
++	sed_filter+='s/__NR3264_fcntl/25/;'
++	sed_filter+='s/__NR3264_fstatat/79/;'
++	sed_filter+='s/__NR3264_fstatfs/44/;'
++	sed_filter+='s/__NR3264_ftruncate/46/;'
++	sed_filter+='s/__NR3264_lseek/62/;'
++	sed_filter+='s/__NR3264_mmap/222/;'
++	sed_filter+='s/__NR3264_sendfile/71/;'
++	sed_filter+='s/__NR3264_statfs/43/;'
++	sed_filter+='s/__NR3264_truncate/45/;'
++	sed_filter+='s/__NR3264_fstat/80/;'
++
++	gcc -E -dM -I$1/include/uapi \
++		-D__BITS_PER_LONG=32 \
++		$1/arch/riscv/include/uapi/asm/unistd.h | \
++		grep "^#define __NR_" | \
++		sed '/__NR_syscalls/d' | \
++		sed 's/(__NR_arch_specific_syscall + 15)/259/' | \
++		sed '/__NR_arch_specific_syscall/d' | \
++		sed 's/#define[ \t]\+__NR_\([^ \t]\+\)[ \t]\+\(.*\)/\1,\2/' | \
++		sed $sed_filter | sort
++}
++
++#
++# Dump the riscv32 library syscall table
++#
++#  Dump the library's syscall table to stdout.
++#
++function dump_lib_riscv32() {
++	dump_lib_arch riscv32 | mangle_lib_syscall riscv32
++}
++
+ #
+ # Dump the s390 system syscall table
+ #
+@@ -639,6 +682,9 @@ function dump_sys() {
+ 	ppc64)
+ 		dump_sys_ppc64 "$2"
+ 		;;
++	riscv32)
++		dump_sys_riscv32 "$2"
++		;;
+ 	riscv64)
+ 		dump_sys_riscv64 "$2"
+ 		;;
+@@ -706,6 +752,9 @@ function dump_lib() {
+ 	ppc64)
+ 		dump_lib_ppc64
+ 		;;
++	riscv32)
++		dump_lib_riscv32
++		;;
+ 	riscv64)
+ 		dump_lib_riscv64
+ 		;;
+@@ -751,7 +800,7 @@ function gen_csv() {
+ 	abi_list+=" mips mips64 mips64n32"
+ 	abi_list+=" parisc parisc64"
+ 	abi_list+=" ppc ppc64"
+-	abi_list+=" riscv64"
++	abi_list+=" riscv32 riscv64"
+ 	abi_list+=" s390 s390x"
+ 	abi_list+=" sh"
+
+diff --git a/src/arch.c b/src/arch.c
+index 6ab922f..acf80af 100644
+--- a/src/arch.c
++++ b/src/arch.c
+@@ -43,6 +43,7 @@
+ #include "arch-ppc.h"
+ #include "arch-ppc64.h"
+ #include "arch-riscv64.h"
++#include "arch-riscv32.h"
+ #include "arch-s390.h"
+ #include "arch-s390x.h"
+ #include "arch-sh.h"
+@@ -97,8 +98,12 @@ const struct arch_def *arch_def_native = &arch_def_ppc;
+ const struct arch_def *arch_def_native = &arch_def_s390x;
+ #elif __s390__
+ const struct arch_def *arch_def_native = &arch_def_s390;
+-#elif __riscv && __riscv_xlen == 64
++#elif __riscv
++#if __riscv_xlen == 64
+ const struct arch_def *arch_def_native = &arch_def_riscv64;
++#elif __riscv_xlen == 32
++const struct arch_def *arch_def_native = &arch_def_riscv32;
++#endif
+ #elif __sh__
+ #ifdef __BIG_ENDIAN__
+ const struct arch_def *arch_def_native = &arch_def_sheb;
+@@ -167,6 +172,8 @@ const struct arch_def *arch_def_lookup(uint32_t token)
+ 		return &arch_def_s390;
+ 	case SCMP_ARCH_S390X:
+ 		return &arch_def_s390x;
++	case SCMP_ARCH_RISCV32:
++		return &arch_def_riscv32;
+ 	case SCMP_ARCH_RISCV64:
+ 		return &arch_def_riscv64;
+ 	case SCMP_ARCH_SHEB:
+@@ -223,6 +230,8 @@ const struct arch_def *arch_def_lookup_name(const char *arch_name)
+ 		return &arch_def_s390;
+ 	else if (strcmp(arch_name, "s390x") == 0)
+ 		return &arch_def_s390x;
++	else if (strcmp(arch_name, "riscv32") == 0)
++		return &arch_def_riscv32;
+ 	else if (strcmp(arch_name, "riscv64") == 0)
+ 		return &arch_def_riscv64;
+ 	else if (strcmp(arch_name, "sheb") == 0)
+diff --git a/src/gen_pfc.c b/src/gen_pfc.c
+index c7fb536..d45e181 100644
+--- a/src/gen_pfc.c
++++ b/src/gen_pfc.c
+@@ -87,6 +87,8 @@ static const char *_pfc_arch(const struct arch_def *arch)
+ 		return "s390x";
+ 	case SCMP_ARCH_S390:
+ 		return "s390";
++	case SCMP_ARCH_RISCV32:
++		return "riscv32";
+ 	case SCMP_ARCH_RISCV64:
+ 		return "riscv64";
+ 	case SCMP_ARCH_SHEB:
+diff --git a/src/python/libseccomp.pxd b/src/python/libseccomp.pxd
+index 0629bf1..000d503 100644
+--- a/src/python/libseccomp.pxd
++++ b/src/python/libseccomp.pxd
+@@ -51,6 +51,7 @@ cdef extern from "seccomp.h":
+         SCMP_ARCH_PPC64LE
+         SCMP_ARCH_S390
+         SCMP_ARCH_S390X
++        SCMP_ARCH_RISCV32
+         SCMP_ARCH_RISCV64
+
+     cdef enum scmp_filter_attr:
+diff --git a/src/python/seccomp.pyx b/src/python/seccomp.pyx
+index 1a9eb24..c94ad1d 100644
+--- a/src/python/seccomp.pyx
++++ b/src/python/seccomp.pyx
+@@ -214,6 +214,7 @@ cdef class Arch:
+     PARISC64 - 64-bit PA-RISC
+     PPC64 - 64-bit PowerPC
+     PPC - 32-bit PowerPC
++    RISCV32 - 32-bit RISC-V
+     RISCV64 - 64-bit RISC-V
+     """
+
+@@ -238,6 +239,7 @@ cdef class Arch:
+     PPC64LE = libseccomp.SCMP_ARCH_PPC64LE
+     S390 = libseccomp.SCMP_ARCH_S390
+     S390X = libseccomp.SCMP_ARCH_S390X
++    RISCV32 = libseccomp.SCMP_ARCH_RISCV32
+     RISCV64 = libseccomp.SCMP_ARCH_RISCV64
+
+     def __cinit__(self, arch=libseccomp.SCMP_ARCH_NATIVE):
+diff --git a/src/syscalls.c b/src/syscalls.c
+index ddb84fa..34e08d9 100644
+--- a/src/syscalls.c
++++ b/src/syscalls.c
+@@ -55,3 +55,4 @@ ARCH_DEF(sh)
+ ARCH_DEF(x32)
+ ARCH_DEF(x86)
+ ARCH_DEF(riscv64)
++ARCH_DEF(riscv32)
+diff --git a/src/syscalls.csv b/src/syscalls.csv
+index fbd1058..0ee6c15 100644
+--- a/src/syscalls.csv
++++ b/src/syscalls.csv
+@@ -1,4 +1,4 @@
+-#syscall (v5.12.0-rc7 2021-04-17),x86,x86_64,x32,arm,aarch64,mips,mips64,mips64n32,parisc,parisc64,ppc,ppc64,riscv64,s390,s390x,sh
++#syscall (v5.12.0-rc7 2021-04-17),x86,x86_64,x32,arm,aarch64,mips,mips64,mips64n32,parisc,parisc64,ppc,ppc64,riscv32,riscv64,s390,s390x,sh
+ accept,PNR,43,43,285,202,168,42,42,35,35,330,330,202,PNR,PNR,344
+ accept4,364,288,288,366,242,334,293,297,320,320,344,344,242,364,364,358
+ access,33,21,21,33,PNR,33,20,20,33,33,33,33,PNR,33,33,33
+diff --git a/src/syscalls.h b/src/syscalls.h
+index 4f959af..49887ba 100644
+--- a/src/syscalls.h
++++ b/src/syscalls.h
+@@ -28,6 +28,7 @@
+ #include "arch-x86.h"
+ #include "arch-x86.h"
+ #include "arch-riscv64.h"
++#include "arch-riscv32.h"
+
+ /* NOTE: changes to the arch_syscall_table layout may require changes to the
+  *       generate_syscalls_perf.sh and arch-syscall-validate scripts */
+@@ -49,6 +50,7 @@ struct arch_syscall_table {
+ 	int parisc64;
+ 	int ppc;
+ 	int ppc64;
++	int riscv32;
+ 	int riscv64;
+ 	int s390;
+ 	int s390x;
+diff --git a/src/system.c b/src/system.c
+index ae445bf..063e6be 100644
+--- a/src/system.c
++++ b/src/system.c
+@@ -130,6 +130,7 @@ int sys_chk_seccomp_syscall(void)
+ 	case SCMP_ARCH_PPC64LE:
+ 	case SCMP_ARCH_S390:
+ 	case SCMP_ARCH_S390X:
++	case SCMP_ARCH_RISCV32:
+ 	case SCMP_ARCH_RISCV64:
+ 		break;
+ 	default:
+diff --git a/tests/15-basic-resolver.c b/tests/15-basic-resolver.c
+index 2679270..57092f3 100644
+--- a/tests/15-basic-resolver.c
++++ b/tests/15-basic-resolver.c
+@@ -45,6 +45,7 @@ unsigned int arch_list[] = {
+ 	SCMP_ARCH_S390X,
+ 	SCMP_ARCH_PARISC,
+ 	SCMP_ARCH_PARISC64,
++	SCMP_ARCH_RISCV32,
+ 	SCMP_ARCH_RISCV64,
+ 	-1
+ };
+diff --git a/tests/16-sim-arch_basic.c b/tests/16-sim-arch_basic.c
+index 4fcbb5c..662e081 100644
+--- a/tests/16-sim-arch_basic.c
++++ b/tests/16-sim-arch_basic.c
+@@ -90,6 +90,9 @@ int main(int argc, char *argv[])
+ 	if (rc != 0)
+ 		goto out;
+ 	rc = seccomp_arch_add(ctx, SCMP_ARCH_PPC64LE);
++	if (rc != 0)
++		goto out;
++	rc = seccomp_arch_add(ctx, SCMP_ARCH_RISCV32);
+ 	if (rc != 0)
+ 		goto out;
+ 	rc = seccomp_arch_add(ctx, SCMP_ARCH_RISCV64);
+@@ -160,6 +163,9 @@ int main(int argc, char *argv[])
+ 	if (rc != 0)
+ 		goto out;
+ 	rc = seccomp_arch_remove(ctx, SCMP_ARCH_PPC64LE);
++	if (rc != 0)
++		goto out;
++	rc = seccomp_arch_remove(ctx, SCMP_ARCH_RISCV32);
+ 	if (rc != 0)
+ 		goto out;
+ 	rc = seccomp_arch_remove(ctx, SCMP_ARCH_RISCV64);
+diff --git a/tests/16-sim-arch_basic.py b/tests/16-sim-arch_basic.py
+index f22c985..d5e93a2 100755
+--- a/tests/16-sim-arch_basic.py
++++ b/tests/16-sim-arch_basic.py
+@@ -44,6 +44,7 @@ def test(args):
+     f.add_arch(Arch("mipsel64"))
+     f.add_arch(Arch("mipsel64n32"))
+     f.add_arch(Arch("ppc64le"))
++    f.add_arch(Arch("riscv32"))
+     f.add_arch(Arch("riscv64"))
+     f.add_arch(Arch("sh"))
+     f.add_rule(ALLOW, "read", Arg(0, EQ, sys.stdin.fileno()))
+diff --git a/tests/23-sim-arch_all_le_basic.c b/tests/23-sim-arch_all_le_basic.c
+index 08f030c..ec73224 100644
+--- a/tests/23-sim-arch_all_le_basic.c
++++ b/tests/23-sim-arch_all_le_basic.c
+@@ -75,6 +75,9 @@ int main(int argc, char *argv[])
+ 	if (rc != 0)
+ 		goto out;
+ 	rc = seccomp_arch_add(ctx, seccomp_arch_resolve_name("sh"));
++	if (rc != 0)
++		goto out;
++	rc = seccomp_arch_add(ctx, seccomp_arch_resolve_name("riscv32"));
+ 	if (rc != 0)
+ 		goto out;
+
+diff --git a/tests/23-sim-arch_all_le_basic.py b/tests/23-sim-arch_all_le_basic.py
+index 12bb243..1eebc20 100755
+--- a/tests/23-sim-arch_all_le_basic.py
++++ b/tests/23-sim-arch_all_le_basic.py
+@@ -40,6 +40,7 @@ def test(args):
+     f.add_arch(Arch("mipsel64"))
+     f.add_arch(Arch("mipsel64n32"))
+     f.add_arch(Arch("ppc64le"))
++    f.add_arch(Arch("riscv32"))
+     f.add_arch(Arch("riscv64"))
+     f.add_arch(Arch("sh"))
+     f.add_rule(ALLOW, "read", Arg(0, EQ, sys.stdin.fileno()))
+diff --git a/tests/56-basic-iterate_syscalls.c b/tests/56-basic-iterate_syscalls.c
+index 5e7ab67..c11ca8c 100644
+--- a/tests/56-basic-iterate_syscalls.c
++++ b/tests/56-basic-iterate_syscalls.c
+@@ -46,6 +46,7 @@ unsigned int arch_list[] = {
+ 	SCMP_ARCH_S390X,
+ 	SCMP_ARCH_PARISC,
+ 	SCMP_ARCH_PARISC64,
++	SCMP_ARCH_RISCV32,
+ 	SCMP_ARCH_RISCV64,
+ 	-1
+ };
+diff --git a/tests/56-basic-iterate_syscalls.py b/tests/56-basic-iterate_syscalls.py
+index 77a5b89..2e860bf 100755
+--- a/tests/56-basic-iterate_syscalls.py
++++ b/tests/56-basic-iterate_syscalls.py
+@@ -37,6 +37,7 @@ arch_list = ["x86",
+              "mipsel64",
+              "mipsel64n32",
+              "ppc64le",
++             "riscv32",
+              "riscv64"]
+
+ def test_arch(arch, init):
+diff --git a/tests/regression b/tests/regression
+index 53dab75..2869629 100755
+--- a/tests/regression
++++ b/tests/regression
+@@ -26,7 +26,7 @@ GLBL_ARCH_LE_SUPPORT=" \
+ 	arm aarch64 \
+ 	mipsel mipsel64 mipsel64n32 \
+ 	ppc64le \
+-	riscv64 \
++	riscv32 riscv64 \
+ 	sh"
+ GLBL_ARCH_BE_SUPPORT=" \
+ 	mips mips64 mips64n32 \
+@@ -41,6 +41,7 @@ GLBL_ARCH_32B_SUPPORT=" \
+ 	mips mipsel mips64n32 mipsel64n32 \
+ 	parisc \
+ 	ppc \
++	riscv32 \
+ 	s390 \
+ 	sheb sh"
+
+@@ -785,7 +786,7 @@ function run_test_live() {
+
+ 	# setup the arch specific return values
+ 	case "$arch" in
+-	x86|x86_64|x32|arm|aarch64|parisc|parisc64|ppc|ppc64|ppc64le|ppc|s390|s390x|riscv64|sh|sheb)
++	x86|x86_64|x32|arm|aarch64|parisc|parisc64|ppc|ppc64|ppc64le|ppc|s390|s390x|riscv32|riscv64|sh|sheb)
+ 		rc_kill_process=159
+ 		rc_kill=159
+ 		rc_allow=160
+diff --git a/tools/scmp_arch_detect.c b/tools/scmp_arch_detect.c
+index b6bd2bb..7789970 100644
+--- a/tools/scmp_arch_detect.c
++++ b/tools/scmp_arch_detect.c
+@@ -129,6 +129,9 @@ int main(int argc, char *argv[])
+ 		case SCMP_ARCH_SH:
+ 			printf("sh\n");
+ 			break;
++		case SCMP_ARCH_RISCV32:
++			printf("riscv32\n");
++			break;
+ 		default:
+ 			printf("unknown\n");
+ 		}
+diff --git a/tools/scmp_bpf_disasm.c b/tools/scmp_bpf_disasm.c
+index b95cdeb..49a89c7 100644
+--- a/tools/scmp_bpf_disasm.c
++++ b/tools/scmp_bpf_disasm.c
+@@ -510,6 +510,8 @@ int main(int argc, char *argv[])
+ 				arch = AUDIT_ARCH_S390X;
+ 			else if (strcmp(optarg, "riscv64") == 0)
+ 				arch = AUDIT_ARCH_RISCV64;
++			else if (strcmp(optarg, "riscv32") == 0)
++				arch = AUDIT_ARCH_RISCV32;
+ 			else
+ 				exit_usage(argv[0]);
+ 			break;
+diff --git a/tools/scmp_bpf_sim.c b/tools/scmp_bpf_sim.c
+index 04edfbc..53e6575 100644
+--- a/tools/scmp_bpf_sim.c
++++ b/tools/scmp_bpf_sim.c
+@@ -285,6 +285,8 @@ int main(int argc, char *argv[])
+ 				arch = AUDIT_ARCH_S390;
+ 			else if (strcmp(optarg, "s390x") == 0)
+ 				arch = AUDIT_ARCH_S390X;
++			else if (strcmp(optarg, "riscv32") == 0)
++				arch = AUDIT_ARCH_RISCV32;
+ 			else if (strcmp(optarg, "riscv64") == 0)
+ 				arch = AUDIT_ARCH_RISCV64;
+ 			else if (strcmp(optarg, "sheb") == 0)
+diff --git a/tools/util.c b/tools/util.c
+index afea6c9..1fc1f62 100644
+--- a/tools/util.c
++++ b/tools/util.c
+@@ -78,8 +78,12 @@
+ #define ARCH_NATIVE		AUDIT_ARCH_S390X
+ #elif __s390__
+ #define ARCH_NATIVE		AUDIT_ARCH_S390
+-#elif __riscv && __riscv_xlen == 64
++#elif __riscv
++#if __riscv_xlen == 64
+ #define ARCH_NATIVE		AUDIT_ARCH_RISCV64
++#elif __riscv_xlen == 32
++#define ARCH_NATIVE		AUDIT_ARCH_RISCV32
++#endif
+ #elif __sh__
+ #ifdef __BIG_ENDIAN__
+ #define ARCH_NATIVE		AUDIT_ARCH_SH
+diff --git a/tools/util.h b/tools/util.h
+index 6c2ca33..4d16e38 100644
+--- a/tools/util.h
++++ b/tools/util.h
+@@ -79,6 +79,13 @@
+ #define AUDIT_ARCH_RISCV64	(EM_RISCV|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
+ #endif /* AUDIT_ARCH_RISCV64 */
+
++#ifndef AUDIT_ARCH_RISCV32
++#ifndef EM_RISCV
++#define EM_RISCV		243
++#endif /* EM_RISCV */
++#define AUDIT_ARCH_RISCV32	(EM_RISCV|__AUDIT_ARCH_LE)
++#endif /* AUDIT_ARCH_RISCV32 */
++
+ extern uint32_t arch;
+
+ uint16_t ttoh16(uint32_t arch, uint16_t val);
+--
+2.32.0