summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.OE-Core.md10
-rw-r--r--bitbake/contrib/hashserv/Dockerfile6
-rw-r--r--bitbake/lib/bb/build.py14
-rw-r--r--bitbake/lib/bb/cooker.py4
-rw-r--r--bitbake/lib/bb/data_smart.py10
-rw-r--r--bitbake/lib/bb/fetch2/npm.py16
-rw-r--r--bitbake/lib/bb/fetch2/ssh.py2
-rw-r--r--bitbake/lib/bb/process.py2
-rw-r--r--bitbake/lib/bb/server/process.py3
-rw-r--r--bitbake/lib/bb/server/xmlrpcserver.py1
-rw-r--r--bitbake/lib/bb/tests/fetch.py5
-rw-r--r--bitbake/lib/bb/ui/knotty.py11
-rw-r--r--bitbake/lib/bb/utils.py9
-rw-r--r--bitbake/lib/pyinotify.py30
-rw-r--r--bitbake/lib/toaster/orm/fixtures/oe-core.xml28
-rw-r--r--bitbake/lib/toaster/orm/fixtures/poky.xml80
-rw-r--r--bitbake/lib/toaster/orm/fixtures/settings.xml2
-rw-r--r--bitbake/lib/toaster/orm/models.py2
-rw-r--r--bitbake/lib/toaster/toastergui/templates/projectconf.html16
-rw-r--r--documentation/bsp-guide/bsp.rst7
-rw-r--r--documentation/conf.py23
-rw-r--r--documentation/dev-manual/common-tasks.rst2
-rw-r--r--documentation/kernel-dev/common.rst2
-rw-r--r--documentation/migration-guides/migration-3.4.rst2
-rw-r--r--documentation/overview-manual/yp-intro.rst4
-rw-r--r--documentation/poky.yaml12
-rw-r--r--documentation/ref-manual/system-requirements.rst2
-rw-r--r--documentation/ref-manual/tasks.rst16
-rw-r--r--documentation/ref-manual/variables.rst8
-rw-r--r--documentation/releases.rst14
-rw-r--r--documentation/sphinx-static/switchers.js6
-rw-r--r--meta-poky/conf/distro/include/gcsections.inc2
-rw-r--r--meta-poky/conf/distro/poky.conf2
-rw-r--r--meta-selftest/recipes-test/git-submodule-test/git-submodule-test.bb15
-rw-r--r--meta-selftest/recipes-test/gitrepotest/gitrepotest.bb16
-rw-r--r--meta-selftest/recipes-test/gitrepotest/gitrepotest/0001-testpatch.patch9
-rw-r--r--meta-selftest/recipes-test/recipeutils/recipeutils-test_1.2.bb2
-rw-r--r--meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.10.bbappend16
-rw-r--r--meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.14.bbappend8
-rw-r--r--meta/classes/base.bbclass4
-rw-r--r--meta/classes/buildhistory.bbclass30
-rw-r--r--meta/classes/crate-fetch.bbclass24
-rw-r--r--meta/classes/cve-check.bbclass4
-rw-r--r--meta/classes/devshell.bbclass2
-rw-r--r--meta/classes/devupstream.bbclass5
-rw-r--r--meta/classes/externalsrc.bbclass19
-rw-r--r--meta/classes/insane.bbclass2
-rw-r--r--meta/classes/license.bbclass4
-rw-r--r--meta/classes/license_image.bbclass4
-rw-r--r--meta/classes/meson.bbclass11
-rw-r--r--meta/classes/qemuboot.bbclass4
-rw-r--r--meta/classes/rootfs-postcommands.bbclass28
-rw-r--r--meta/classes/sanity.bbclass7
-rw-r--r--meta/classes/sstate.bbclass20
-rw-r--r--meta/classes/toaster.bbclass6
-rw-r--r--meta/classes/uboot-sign.bbclass16
-rw-r--r--meta/conf/bitbake.conf8
-rw-r--r--meta/conf/distro/include/cve-extra-exclusions.inc9
-rw-r--r--meta/conf/distro/include/default-distrovars.inc2
-rw-r--r--meta/conf/distro/include/maintainers.inc3
-rw-r--r--meta/conf/distro/include/yocto-uninative.inc10
-rw-r--r--meta/conf/machine/include/x86/qemuboot-x86.inc2
-rw-r--r--meta/files/toolchain-shar-relocate.sh2
-rw-r--r--meta/lib/oe/license.py6
-rw-r--r--meta/lib/oe/packagedata.py2
-rw-r--r--meta/lib/oe/patch.py21
-rw-r--r--meta/lib/oe/reproducible.py2
-rw-r--r--meta/lib/oe/sdk.py4
-rw-r--r--meta/lib/oeqa/runtime/cases/parselogs.py14
-rw-r--r--meta/lib/oeqa/sdk/buildtools-cases/https.py4
-rw-r--r--meta/lib/oeqa/sdk/cases/buildepoxy.py2
-rw-r--r--meta/lib/oeqa/selftest/cases/bbtests.py31
-rw-r--r--meta/lib/oeqa/selftest/cases/devtool.py13
-rw-r--r--meta/lib/oeqa/selftest/cases/git.py15
-rw-r--r--meta/lib/oeqa/selftest/cases/recipetool.py2
-rw-r--r--meta/lib/oeqa/selftest/cases/sstatetests.py13
-rw-r--r--meta/lib/oeqa/utils/dump.py2
-rw-r--r--meta/recipes-bsp/grub/files/CVE-2021-3981-grub-mkconfig-Restore-umask-for-the-grub.cfg.patch49
-rw-r--r--meta/recipes-bsp/grub/grub2.inc3
-rw-r--r--meta/recipes-bsp/u-boot/u-boot-common.inc3
-rw-r--r--meta/recipes-connectivity/bind/bind-9.16.20/CVE-2021-25219-1.patch76
-rw-r--r--meta/recipes-connectivity/bind/bind-9.16.20/CVE-2021-25219-2.patch65
-rw-r--r--meta/recipes-connectivity/bind/bind_9.16.20.bb2
-rw-r--r--meta/recipes-connectivity/libpcap/libpcap_1.10.1.bb3
-rw-r--r--meta/recipes-connectivity/neard/neard_0.16.bb13
-rw-r--r--meta/recipes-connectivity/openssh/openssh/CVE-2021-41617.patch48
-rw-r--r--meta/recipes-connectivity/openssh/openssh_8.7p1.bb1
-rw-r--r--meta/recipes-connectivity/openssl/openssl/reproducibility.patch22
-rw-r--r--meta/recipes-connectivity/openssl/openssl_1.1.1o.bb (renamed from meta/recipes-connectivity/openssl/openssl_1.1.1l.bb)4
-rw-r--r--meta/recipes-connectivity/socat/socat_1.7.4.1.bb2
-rw-r--r--meta/recipes-core/busybox/busybox.inc2
-rw-r--r--meta/recipes-core/coreutils/coreutils_8.32.bb3
-rw-r--r--meta/recipes-core/expat/expat_2.4.7.bb (renamed from meta/recipes-core/expat/expat_2.4.1.bb)2
-rw-r--r--meta/recipes-core/glibc/glibc/0001-CVE-2021-3998.patch282
-rw-r--r--meta/recipes-core/glibc/glibc/0001-CVE-2021-3999.patch36
-rw-r--r--meta/recipes-core/glibc/glibc/0001-CVE-2022-23218.patch178
-rw-r--r--meta/recipes-core/glibc/glibc/0001-CVE-2022-23219.patch55
-rw-r--r--meta/recipes-core/glibc/glibc/0002-CVE-2021-3998.patch138
-rw-r--r--meta/recipes-core/glibc/glibc/0002-CVE-2021-3999.patch357
-rw-r--r--meta/recipes-core/glibc/glibc/0002-CVE-2022-23218.patch126
-rw-r--r--meta/recipes-core/glibc/glibc/0002-CVE-2022-23219.patch89
-rw-r--r--meta/recipes-core/glibc/glibc_2.34.bb10
-rw-r--r--meta/recipes-core/images/build-appliance-image_15.0.0.bb2
-rwxr-xr-xmeta/recipes-core/initrdscripts/initramfs-framework/finish12
-rw-r--r--meta/recipes-core/libxml/libxml2/CVE-2022-23308-fix-regression.patch99
-rw-r--r--meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch16
-rw-r--r--meta/recipes-core/libxml/libxml2_2.9.13.bb (renamed from meta/recipes-core/libxml/libxml2_2.9.12.bb)14
-rw-r--r--meta/recipes-core/ncurses/files/CVE-2021-39537.patch65
-rw-r--r--meta/recipes-core/ncurses/ncurses_6.2.bb1
-rw-r--r--meta/recipes-core/systemd/systemd-boot_249.7.bb (renamed from meta/recipes-core/systemd/systemd-boot_249.3.bb)0
-rw-r--r--meta/recipes-core/systemd/systemd.inc2
-rw-r--r--meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch2
-rw-r--r--meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch2
-rw-r--r--meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch8
-rw-r--r--meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch24
-rw-r--r--meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch15
-rw-r--r--meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch2
-rw-r--r--meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch3
-rw-r--r--meta/recipes-core/systemd/systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch4
-rw-r--r--meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch6
-rw-r--r--meta/recipes-core/systemd/systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch4
-rw-r--r--meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch2
-rw-r--r--meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch2
-rw-r--r--meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch4
-rw-r--r--meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch2
-rw-r--r--meta/recipes-core/systemd/systemd/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch2
-rw-r--r--meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch2
-rw-r--r--meta/recipes-core/systemd/systemd/0018-avoid-redefinition-of-prctl_mm_map-structure.patch2
-rw-r--r--meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch2
-rw-r--r--meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch8
-rw-r--r--meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch2
-rw-r--r--meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch8
-rw-r--r--meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch4
-rw-r--r--meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch2
-rw-r--r--meta/recipes-core/systemd/systemd/0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch2
-rw-r--r--meta/recipes-core/systemd/systemd_249.7.bb (renamed from meta/recipes-core/systemd/systemd_249.3.bb)4
-rw-r--r--meta/recipes-core/util-linux/util-linux-libuuid_2.37.4.bb (renamed from meta/recipes-core/util-linux/util-linux-libuuid_2.37.2.bb)0
-rw-r--r--meta/recipes-core/util-linux/util-linux.inc2
-rw-r--r--meta/recipes-core/util-linux/util-linux_2.37.4.bb (renamed from meta/recipes-core/util-linux/util-linux_2.37.2.bb)0
-rw-r--r--meta/recipes-core/volatile-binds/files/volatile-binds.service.in2
-rw-r--r--meta/recipes-core/zlib/zlib/CVE-2018-25032.patch347
-rw-r--r--meta/recipes-core/zlib/zlib_1.2.11.bb1
-rw-r--r--meta/recipes-devtools/binutils/binutils-2.37.inc2
-rw-r--r--meta/recipes-devtools/binutils/binutils/0001-CVE-2021-42574.patch2001
-rw-r--r--meta/recipes-devtools/binutils/binutils/161e87d12167b1e36193385485c1f6ce92f74f02.patch247
-rw-r--r--meta/recipes-devtools/bootchart2/bootchart2_0.14.9.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-11.2.inc12
-rw-r--r--meta/recipes-devtools/gcc/gcc-target.inc2
-rw-r--r--meta/recipes-devtools/gcc/gcc/0001-CVE-2021-35465.patch138
-rw-r--r--meta/recipes-devtools/gcc/gcc/0001-CVE-2021-42574.patch2282
-rw-r--r--meta/recipes-devtools/gcc/gcc/0001-CVE-2021-46195.patch128
-rw-r--r--meta/recipes-devtools/gcc/gcc/0002-CVE-2021-35465.patch39
-rw-r--r--meta/recipes-devtools/gcc/gcc/0002-CVE-2021-42574.patch1765
-rw-r--r--meta/recipes-devtools/gcc/gcc/0003-CVE-2021-35465.patch103
-rw-r--r--meta/recipes-devtools/gcc/gcc/0003-CVE-2021-42574.patch142
-rw-r--r--meta/recipes-devtools/gcc/gcc/0004-CVE-2021-35465.patch304
-rw-r--r--meta/recipes-devtools/gcc/gcc/0004-CVE-2021-42574.patch573
-rw-r--r--meta/recipes-devtools/gnu-config/gnu-config_git.bb2
-rw-r--r--meta/recipes-devtools/go/go-1.16.15.inc (renamed from meta/recipes-devtools/go/go-1.16.8.inc)4
-rw-r--r--meta/recipes-devtools/go/go-binary-native_1.16.15.bb (renamed from meta/recipes-devtools/go/go-binary-native_1.16.8.bb)4
-rw-r--r--meta/recipes-devtools/go/go-cross-canadian_1.16.15.bb (renamed from meta/recipes-devtools/go/go-cross-canadian_1.16.8.bb)0
-rw-r--r--meta/recipes-devtools/go/go-cross_1.16.15.bb (renamed from meta/recipes-devtools/go/go-cross_1.16.8.bb)0
-rw-r--r--meta/recipes-devtools/go/go-crosssdk_1.16.15.bb (renamed from meta/recipes-devtools/go/go-crosssdk_1.16.8.bb)0
-rw-r--r--meta/recipes-devtools/go/go-native_1.16.15.bb (renamed from meta/recipes-devtools/go/go-native_1.16.8.bb)0
-rw-r--r--meta/recipes-devtools/go/go-runtime_1.16.15.bb (renamed from meta/recipes-devtools/go/go-runtime_1.16.8.bb)0
-rw-r--r--meta/recipes-devtools/go/go_1.16.15.bb (renamed from meta/recipes-devtools/go/go_1.16.8.bb)0
-rw-r--r--meta/recipes-devtools/libtool/libtool-2.4.6.inc27
-rw-r--r--meta/recipes-devtools/libtool/libtool/0001-ltmain.in-Handle-trailing-slashes-on-install-command.patch35
-rw-r--r--meta/recipes-devtools/libtool/libtool/0002-libtool.m4-Rename-the-with-sysroot-option-to-avoid-c.patch (renamed from meta/recipes-devtools/libtool/libtool/rename-with-sysroot.patch)13
-rw-r--r--meta/recipes-devtools/libtool/libtool/0003-ltmain.in-Add-missing-sysroot-to-library-path.patch (renamed from meta/recipes-devtools/libtool/libtool/use-sysroot-in-libpath.patch)10
-rw-r--r--meta/recipes-devtools/libtool/libtool/0004-ltmain.sh-Fix-sysroot-paths-being-encoded-into-RPATH.patch (renamed from meta/recipes-devtools/libtool/libtool/fix-final-rpath.patch)16
-rw-r--r--meta/recipes-devtools/libtool/libtool/0005-ltmain.in-Don-t-encode-RATHS-which-match-default-lin.patch (renamed from meta/recipes-devtools/libtool/libtool/fix-rpath.patch)37
-rw-r--r--meta/recipes-devtools/libtool/libtool/0006-libtool.m4-Handle-as-a-sysroot-correctly.patch (renamed from meta/recipes-devtools/libtool/libtool/fix-resolve-lt-sysroot.patch)18
-rw-r--r--meta/recipes-devtools/libtool/libtool/0007-libtool-Fix-support-for-NIOS2-processor.patch (renamed from meta/recipes-devtools/libtool/libtool/0001-libtool-Fix-support-for-NIOS2-processor.patch)9
-rw-r--r--meta/recipes-devtools/libtool/libtool/0008-libtool-Check-for-static-libs-for-internal-compiler-.patch (renamed from meta/recipes-devtools/libtool/libtool/0001-libtool-Check-for-static-libs-for-internal-compiler-.patch)13
-rw-r--r--meta/recipes-devtools/libtool/libtool/0009-Makefile.am-make-sure-autoheader-run-before-autoconf.patch (renamed from meta/recipes-devtools/libtool/libtool/0001-Makefile.am-make-sure-autoheader-run-before-autoconf.patch)10
-rw-r--r--meta/recipes-devtools/libtool/libtool/0010-Makefile.am-make-sure-autoheader-run-before-automake.patch (renamed from meta/recipes-devtools/libtool/libtool/0001-Makefile.am-make-sure-autoheader-run-before-automake.patch)9
-rw-r--r--meta/recipes-devtools/libtool/libtool/0011-ltmain.in-Handle-prefix-map-compiler-options-correct.patch (renamed from meta/recipes-devtools/libtool/libtool/lto-prefix.patch)6
-rw-r--r--[-rwxr-xr-x]meta/recipes-devtools/libtool/libtool/0012-libtool.m4-For-reproducibility-stop-encoding-hostnam.patch (renamed from meta/recipes-devtools/libtool/libtool/debian-no_hostname.patch)12
-rw-r--r--meta/recipes-devtools/libtool/libtool/ARFLAGS-use-cr-instead-of-cru-by-default.patch133
-rw-r--r--meta/recipes-devtools/libtool/libtool/fixinstall.patch6
-rw-r--r--meta/recipes-devtools/libtool/libtool/libool.m4-add-ARFLAGS-variable.patch77
-rw-r--r--meta/recipes-devtools/libtool/libtool/norm-rpath.patch38
-rw-r--r--meta/recipes-devtools/libtool/libtool/trailingslash.patch35
-rw-r--r--meta/recipes-devtools/perl/files/perl-rdepends.txt338
-rw-r--r--meta/recipes-devtools/perl/libxml-parser-perl_2.46.bb1
-rw-r--r--meta/recipes-devtools/perl/perl_5.34.0.bb12
-rw-r--r--meta/recipes-devtools/pseudo/pseudo_git.bb2
-rw-r--r--meta/recipes-devtools/python/python3-pyelftools_0.27.bb2
-rw-r--r--meta/recipes-devtools/python/python3/0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch20
-rw-r--r--meta/recipes-devtools/python/python3_3.9.9.bb (renamed from meta/recipes-devtools/python/python3_3.9.7.bb)2
-rw-r--r--meta/recipes-devtools/quilt/quilt.inc3
-rw-r--r--meta/recipes-devtools/rpm/rpm_4.16.1.3.bb3
-rw-r--r--meta/recipes-devtools/ruby/ruby_3.0.3.bb (renamed from meta/recipes-devtools/ruby/ruby_3.0.2.bb)4
-rw-r--r--meta/recipes-devtools/rust/rust-cross.inc2
-rw-r--r--meta/recipes-extended/asciidoc/asciidoc_9.1.0.bb2
-rw-r--r--meta/recipes-extended/cups/cups.inc1
-rw-r--r--meta/recipes-extended/ghostscript/ghostscript/CVE-2021-3781.patch236
-rw-r--r--meta/recipes-extended/ghostscript/ghostscript/CVE-2021-45949.patch68
-rw-r--r--meta/recipes-extended/ghostscript/ghostscript_9.54.0.bb2
-rw-r--r--meta/recipes-extended/libarchive/libarchive_3.5.3.bb (renamed from meta/recipes-extended/libarchive/libarchive_3.5.1.bb)2
-rw-r--r--meta/recipes-extended/lighttpd/lighttpd/0001-mod_extforward-fix-out-of-bounds-OOB-write-fixes-313.patch97
-rw-r--r--meta/recipes-extended/lighttpd/lighttpd_1.4.59.bb1
-rw-r--r--meta/recipes-extended/mc/files/0001-Ticket-4200-fix-FTBFS-with-ncurses-build-with-disabl.patch87
-rw-r--r--meta/recipes-extended/mc/mc_4.8.27.bb5
-rw-r--r--meta/recipes-extended/pigz/files/0001-Fix-bug-when-combining-l-with-d.patch50
-rw-r--r--meta/recipes-extended/pigz/pigz_2.6.bb3
-rw-r--r--meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch150
-rw-r--r--meta/recipes-extended/unzip/unzip/CVE-2021-4217.patch67
-rw-r--r--meta/recipes-extended/unzip/unzip_6.0.bb1
-rw-r--r--meta/recipes-extended/xz/xz/CVE-2022-1271.patch96
-rw-r--r--meta/recipes-extended/xz/xz_5.2.5.bb4
-rw-r--r--meta/recipes-extended/zip/zip-3.0/0001-configure-use-correct-CPP.patch47
-rw-r--r--meta/recipes-extended/zip/zip-3.0/0002-configure-support-PIC-code-build.patch34
-rw-r--r--meta/recipes-extended/zip/zip_3.0.bb2
-rw-r--r--meta/recipes-gnome/epiphany/epiphany_40.6.bb (renamed from meta/recipes-gnome/epiphany/epiphany_40.3.bb)2
-rw-r--r--meta/recipes-graphics/drm/libdrm_2.4.109.bb (renamed from meta/recipes-graphics/drm/libdrm_2.4.107.bb)2
-rw-r--r--meta/recipes-graphics/harfbuzz/harfbuzz_2.9.1.bb (renamed from meta/recipes-graphics/harfbuzz/harfbuzz_2.9.0.bb)2
-rw-r--r--meta/recipes-graphics/virglrenderer/virglrenderer/cve-2022-0135.patch117
-rw-r--r--meta/recipes-graphics/virglrenderer/virglrenderer/cve-2022-0175.patch107
-rw-r--r--meta/recipes-graphics/virglrenderer/virglrenderer_0.9.1.bb4
-rw-r--r--meta/recipes-graphics/vulkan/vulkan-loader_1.2.182.0.bb2
-rw-r--r--meta/recipes-graphics/xorg-lib/libxshmfence_1.3.bb2
-rw-r--r--meta/recipes-graphics/xorg-xserver/xserver-xorg.inc10
-rw-r--r--meta/recipes-graphics/xorg-xserver/xserver-xorg_1.20.14.bb (renamed from meta/recipes-graphics/xorg-xserver/xserver-xorg_1.20.13.bb)2
-rw-r--r--meta/recipes-kernel/dtc/python3-dtschema-wrapper/dt-doc-validate20
-rw-r--r--meta/recipes-kernel/dtc/python3-dtschema-wrapper/dt-mk-schema20
-rw-r--r--meta/recipes-kernel/dtc/python3-dtschema-wrapper/dt-validate20
-rw-r--r--meta/recipes-kernel/dtc/python3-dtschema-wrapper_2021.10.bb17
-rw-r--r--meta/recipes-kernel/kern-tools/kern-tools-native_git.bb5
-rw-r--r--meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb4
-rw-r--r--meta/recipes-kernel/linux-firmware/linux-firmware_20220509.bb (renamed from meta/recipes-kernel/linux-firmware/linux-firmware_20211027.bb)11
-rw-r--r--meta/recipes-kernel/linux/kernel-devsrc.bb4
-rw-r--r--meta/recipes-kernel/linux/linux-yocto-rt_5.10.bb6
-rw-r--r--meta/recipes-kernel/linux/linux-yocto-rt_5.14.bb6
-rw-r--r--meta/recipes-kernel/linux/linux-yocto-tiny_5.10.bb8
-rw-r--r--meta/recipes-kernel/linux/linux-yocto-tiny_5.14.bb8
-rw-r--r--meta/recipes-kernel/linux/linux-yocto_5.10.bb29
-rw-r--r--meta/recipes-kernel/linux/linux-yocto_5.14.bb26
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0001-Fix-compaction-migratepages-event-name.patch37
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0001-fix-cpu-hotplug-Remove-deprecated-CPU-hotplug-functi.patch394
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0002-Fix-tracepoint-event-allow-same-provider-and-event-n.patch48
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0002-fix-Revert-Makefile-Enable-Wimplicit-fallthrough-for.patch829
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0003-fix-sched-tracing-Don-t-re-read-p-state-when-emittin.patch183
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0004-fix-block-remove-genhd.h-v5.18.patch45
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0005-fix-scsi-block-Remove-REQ_OP_WRITE_SAME-support-v5.1.patch79
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0006-fix-random-remove-unused-tracepoints-v5.18.patch47
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0007-fix-kprobes-Use-rethook-for-kretprobe-if-possible-v5.patch72
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0008-fix-scsi-core-Remove-scsi-scsi_request.h-v5.18.patch44
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0009-Rename-genhd-wrapper-to-blkdev.patch76
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0010-fix-mm-compaction-cleanup-the-compaction-trace-event.patch106
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules_2.13.3.bb (renamed from meta/recipes-kernel/lttng/lttng-modules_2.13.0.bb)15
-rwxr-xr-xmeta/recipes-kernel/perf/perf/sort-pmuevents.py28
-rw-r--r--meta/recipes-kernel/wireless-regdb/wireless-regdb_2022.04.08.bb (renamed from meta/recipes-kernel/wireless-regdb/wireless-regdb_2021.08.28.bb)2
-rw-r--r--meta/recipes-multimedia/alsa/alsa-tools_1.2.5.bb1
-rw-r--r--meta/recipes-multimedia/gstreamer/gst-devtools_1.18.6.bb (renamed from meta/recipes-multimedia/gstreamer/gst-devtools_1.18.5.bb)2
-rw-r--r--meta/recipes-multimedia/gstreamer/gst-examples_1.18.6.bb (renamed from meta/recipes-multimedia/gstreamer/gst-examples_1.18.5.bb)2
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.18.6.bb (renamed from meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.18.5.bb)2
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.18.6.bb (renamed from meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.18.5.bb)2
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.18.6.bb (renamed from meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.18.5.bb)2
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.18.6.bb (renamed from meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.18.5.bb)2
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.18.6.bb (renamed from meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.18.5.bb)2
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.18.6.bb (renamed from meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.18.5.bb)2
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.18.6.bb (renamed from meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.18.5.bb)2
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.18.6.bb (renamed from meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.18.5.bb)2
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi_1.18.6.bb (renamed from meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi_1.18.5.bb)2
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0_1.18.6.bb (renamed from meta/recipes-multimedia/gstreamer/gstreamer1.0_1.18.5.bb)2
-rw-r--r--meta/recipes-multimedia/libsndfile/libsndfile1/CVE-2021-4156.patch32
-rw-r--r--meta/recipes-multimedia/libsndfile/libsndfile1_1.0.28.bb1
-rw-r--r--meta/recipes-multimedia/libtiff/tiff/0001-tif_jbig.c-fix-crash-when-reading-a-file-with-multip.patch38
-rw-r--r--meta/recipes-multimedia/libtiff/tiff/0001-tiffset-fix-global-buffer-overflow-for-ASCII-tags-wh.patch43
-rw-r--r--meta/recipes-multimedia/libtiff/tiff/0002-tiffcrop-fix-issue-380-and-382-heap-buffer-overflow-.patch219
-rw-r--r--meta/recipes-multimedia/libtiff/tiff/0003-add-checks-for-return-value-of-limitMalloc-392.patch93
-rw-r--r--meta/recipes-multimedia/libtiff/tiff/0004-TIFFFetchNormalTag-avoid-calling-memcpy-with-a-null-.patch33
-rw-r--r--meta/recipes-multimedia/libtiff/tiff/0005-fix-the-FPE-in-tiffcrop-393.patch36
-rw-r--r--meta/recipes-multimedia/libtiff/tiff/0006-fix-heap-buffer-overflow-in-tiffcp-278.patch57
-rw-r--r--meta/recipes-multimedia/libtiff/tiff/561599c99f987dc32ae110370cfdd7df7975586b.patch30
-rw-r--r--meta/recipes-multimedia/libtiff/tiff/eecb0712f4c3a5b449f70c57988260a667ddbdef.patch32
-rw-r--r--meta/recipes-multimedia/libtiff/tiff_4.3.0.bb12
-rw-r--r--meta/recipes-multimedia/speex/speex/CVE-2020-23903.patch30
-rw-r--r--meta/recipes-multimedia/speex/speex_1.2.0.bb4
-rw-r--r--meta/recipes-sato/images/core-image-sato-sdk.bb3
-rw-r--r--meta/recipes-sato/webkit/webkitgtk/0001-Enable-THREADS_PREFER_PTHREAD_FLAG.patch2
-rw-r--r--meta/recipes-sato/webkit/webkitgtk/reproducibility.patch22
-rw-r--r--meta/recipes-sato/webkit/webkitgtk_2.32.4.bb (renamed from meta/recipes-sato/webkit/webkitgtk_2.32.3.bb)3
-rw-r--r--meta/recipes-support/boost/boost/0001-BoostConfig.cmake-allow-searching-for-python310.patch50
-rw-r--r--meta/recipes-support/boost/boost/0002-math-allow-definition-of-boost_math_no_atomic_int-on-the-command-line.patch53
-rw-r--r--meta/recipes-support/boost/boost/0003-math-make-no-atomics-a-soft-failure-in-bernoulli_details_hpp.patch151
-rw-r--r--meta/recipes-support/boost/boost_1.77.0.bb3
-rw-r--r--meta/recipes-support/gmp/gmp/cve-2021-43618.patch27
-rw-r--r--meta/recipes-support/gmp/gmp_6.2.1.bb9
-rw-r--r--meta/recipes-support/icu/icu_69.1.bb2
-rw-r--r--meta/recipes-support/libusb/libusb1_1.0.24.bb6
-rw-r--r--meta/recipes-support/vim/files/0001-src-Makefile-improve-reproducibility.patch13
-rw-r--r--meta/recipes-support/vim/files/0002-patch-8.2.3428-using-freed-memory-when-replacing.patch83
-rw-r--r--meta/recipes-support/vim/files/0003-patch-8.2.3487-illegal-memory-access-if-buffer-name-.patch86
-rw-r--r--meta/recipes-support/vim/files/0004-patch-8.2.3489-ml_get-error-after-search-with-range.patch72
-rw-r--r--meta/recipes-support/vim/files/0005-patch-8.2.3564-invalid-memory-access-when-scrolling-.patch97
-rw-r--r--meta/recipes-support/vim/files/CVE-2021-3778.patch61
-rw-r--r--meta/recipes-support/vim/files/b7081e135a16091c93f6f5f7525a5c58fb7ca9f9.patch207
-rw-r--r--meta/recipes-support/vim/files/disable_acl_header_check.patch15
-rw-r--r--meta/recipes-support/vim/files/no-path-adjust.patch8
-rw-r--r--meta/recipes-support/vim/files/racefix.patch6
-rw-r--r--meta/recipes-support/vim/files/vim-add-knob-whether-elf.h-are-checked.patch13
-rw-r--r--meta/recipes-support/vim/vim.inc13
-rwxr-xr-xscripts/buildhistory-diff5
-rwxr-xr-xscripts/git26
-rw-r--r--scripts/lib/checklayer/cases/common.py2
-rw-r--r--scripts/lib/devtool/deploy.py2
-rw-r--r--scripts/lib/devtool/upgrade.py15
-rw-r--r--scripts/lib/recipetool/create.py19
-rw-r--r--scripts/lib/recipetool/create_buildsys.py3
-rw-r--r--scripts/lib/scriptutils.py7
-rw-r--r--scripts/lib/wic/engine.py6
-rw-r--r--scripts/lib/wic/misc.py4
-rw-r--r--scripts/lib/wic/pluginbase.py8
-rw-r--r--scripts/lib/wic/plugins/imager/direct.py2
-rw-r--r--scripts/lib/wic/plugins/source/rootfs.py5
-rwxr-xr-xscripts/oe-pkgdata-util2
-rwxr-xr-xscripts/runqemu5
-rwxr-xr-xscripts/runqemu-ifdown1
-rwxr-xr-xscripts/wic7
-rwxr-xr-xscripts/yocto-check-layer13
323 files changed, 14227 insertions, 2658 deletions
diff --git a/README.OE-Core.md b/README.OE-Core.md
index 521916cd4f..2f2127fb03 100644
--- a/README.OE-Core.md
+++ b/README.OE-Core.md
@@ -6,24 +6,24 @@ of OpenEmbedded. It is distro-less (can build a functional image with
6DISTRO = "nodistro") and contains only emulated machine support. 6DISTRO = "nodistro") and contains only emulated machine support.
7 7
8For information about OpenEmbedded, see the OpenEmbedded website: 8For information about OpenEmbedded, see the OpenEmbedded website:
9 http://www.openembedded.org/ 9 https://www.openembedded.org/
10 10
11The Yocto Project has extensive documentation about OE including a reference manual 11The Yocto Project has extensive documentation about OE including a reference manual
12which can be found at: 12which can be found at:
13 http://yoctoproject.org/documentation 13 https://docs.yoctoproject.org/
14 14
15 15
16Contributing 16Contributing
17------------ 17------------
18 18
19Please refer to 19Please refer to
20http://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded 20https://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded
21for guidelines on how to submit patches. 21for guidelines on how to submit patches.
22 22
23Mailing list: 23Mailing list:
24 24
25 http://lists.openembedded.org/mailman/listinfo/openembedded-core 25 https://lists.openembedded.org/g/openembedded-core
26 26
27Source code: 27Source code:
28 28
29 http://git.openembedded.org/openembedded-core/ 29 https://git.openembedded.org/openembedded-core/
diff --git a/bitbake/contrib/hashserv/Dockerfile b/bitbake/contrib/hashserv/Dockerfile
index d6fc728f37..74b4a3be1d 100644
--- a/bitbake/contrib/hashserv/Dockerfile
+++ b/bitbake/contrib/hashserv/Dockerfile
@@ -1,7 +1,7 @@
1# SPDX-License-Identifier: MIT 1# SPDX-License-Identifier: MIT
2# 2#
3# Copyright (c) 2021 Joshua Watt <JPEWhacker@gmail.com> 3# Copyright (c) 2021 Joshua Watt <JPEWhacker@gmail.com>
4# 4#
5# Dockerfile to build a bitbake hash equivalence server container 5# Dockerfile to build a bitbake hash equivalence server container
6# 6#
7# From the root of the bitbake repository, run: 7# From the root of the bitbake repository, run:
@@ -15,5 +15,9 @@ RUN apk add --no-cache python3
15 15
16COPY bin/bitbake-hashserv /opt/bbhashserv/bin/ 16COPY bin/bitbake-hashserv /opt/bbhashserv/bin/
17COPY lib/hashserv /opt/bbhashserv/lib/hashserv/ 17COPY lib/hashserv /opt/bbhashserv/lib/hashserv/
18COPY lib/bb /opt/bbhashserv/lib/bb/
19COPY lib/codegen.py /opt/bbhashserv/lib/codegen.py
20COPY lib/ply /opt/bbhashserv/lib/ply/
21COPY lib/bs4 /opt/bbhashserv/lib/bs4/
18 22
19ENTRYPOINT ["/opt/bbhashserv/bin/bitbake-hashserv"] 23ENTRYPOINT ["/opt/bbhashserv/bin/bitbake-hashserv"]
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 7e4ab9f64c..44d1d9d981 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -715,19 +715,23 @@ def _exec_task(fn, task, d, quieterr):
715 logger.debug2("Zero size logfn %s, removing", logfn) 715 logger.debug2("Zero size logfn %s, removing", logfn)
716 bb.utils.remove(logfn) 716 bb.utils.remove(logfn)
717 bb.utils.remove(loglink) 717 bb.utils.remove(loglink)
718 except bb.BBHandledException:
719 event.fire(TaskFailed(task, fn, logfn, localdata, True), localdata)
720 return 1
721 except (Exception, SystemExit) as exc: 718 except (Exception, SystemExit) as exc:
719 handled = False
720 if isinstance(exc, bb.BBHandledException):
721 handled = True
722
722 if quieterr: 723 if quieterr:
724 if not handled:
725 logger.warning(repr(exc))
723 event.fire(TaskFailedSilent(task, fn, logfn, localdata), localdata) 726 event.fire(TaskFailedSilent(task, fn, logfn, localdata), localdata)
724 else: 727 else:
725 errprinted = errchk.triggered 728 errprinted = errchk.triggered
726 # If the output is already on stdout, we've printed the information in the 729 # If the output is already on stdout, we've printed the information in the
727 # logs once already so don't duplicate 730 # logs once already so don't duplicate
728 if verboseStdoutLogging: 731 if verboseStdoutLogging or handled:
729 errprinted = True 732 errprinted = True
730 logger.error(repr(exc)) 733 if not handled:
734 logger.error(repr(exc))
731 event.fire(TaskFailed(task, fn, logfn, localdata, errprinted), localdata) 735 event.fire(TaskFailed(task, fn, logfn, localdata, errprinted), localdata)
732 return 1 736 return 1
733 737
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 3688aa0886..288d73fd92 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -2167,6 +2167,8 @@ class CookerParser(object):
2167 self.total) 2167 self.total)
2168 2168
2169 bb.event.fire(event, self.cfgdata) 2169 bb.event.fire(event, self.cfgdata)
2170 else:
2171 bb.error("Parsing halted due to errors")
2170 2172
2171 for process in self.processes: 2173 for process in self.processes:
2172 self.parser_quit.put(None) 2174 self.parser_quit.put(None)
@@ -2257,7 +2259,7 @@ class CookerParser(object):
2257 return False 2259 return False
2258 except bb.BBHandledException as exc: 2260 except bb.BBHandledException as exc:
2259 self.error += 1 2261 self.error += 1
2260 logger.error('Failed to parse recipe: %s' % exc.recipe) 2262 logger.debug('Failed to parse recipe: %s' % exc.recipe)
2261 self.shutdown(clean=False, force=True) 2263 self.shutdown(clean=False, force=True)
2262 return False 2264 return False
2263 except ParsingFailure as exc: 2265 except ParsingFailure as exc:
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index 8d235da121..e960327871 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -492,12 +492,12 @@ class DataSmart(MutableMapping):
492 def setVar(self, var, value, **loginfo): 492 def setVar(self, var, value, **loginfo):
493 #print("var=" + str(var) + " val=" + str(value)) 493 #print("var=" + str(var) + " val=" + str(value))
494 494
495 if "_append" in var or "_prepend" in var or "_remove" in var: 495 if not var.startswith("__anon_") and ("_append" in var or "_prepend" in var or "_remove" in var):
496 info = "%s" % var 496 info = "%s" % var
497 if "filename" in loginfo: 497 if "file" in loginfo:
498 info += " file: %s" % loginfo[filename] 498 info += " file: %s" % loginfo["file"]
499 if "lineno" in loginfo: 499 if "line" in loginfo:
500 info += " line: %s" % loginfo[lineno] 500 info += " line: %s" % loginfo["line"]
501 bb.fatal("Variable %s contains an operation using the old override syntax. Please convert this layer/metadata before attempting to use with a newer bitbake." % info) 501 bb.fatal("Variable %s contains an operation using the old override syntax. Please convert this layer/metadata before attempting to use with a newer bitbake." % info)
502 502
503 self.expand_cache = {} 503 self.expand_cache = {}
diff --git a/bitbake/lib/bb/fetch2/npm.py b/bitbake/lib/bb/fetch2/npm.py
index e497c38dc7..b3a3a444ee 100644
--- a/bitbake/lib/bb/fetch2/npm.py
+++ b/bitbake/lib/bb/fetch2/npm.py
@@ -72,23 +72,19 @@ def npm_unpack(tarball, destdir, d):
72 cmd += " --delay-directory-restore" 72 cmd += " --delay-directory-restore"
73 cmd += " --strip-components=1" 73 cmd += " --strip-components=1"
74 runfetchcmd(cmd, d, workdir=destdir) 74 runfetchcmd(cmd, d, workdir=destdir)
75 runfetchcmd("chmod -R +X %s" % (destdir), d, quiet=True, workdir=destdir) 75 runfetchcmd("chmod -R +X '%s'" % (destdir), d, quiet=True, workdir=destdir)
76 76
77class NpmEnvironment(object): 77class NpmEnvironment(object):
78 """ 78 """
79 Using a npm config file seems more reliable than using cli arguments. 79 Using a npm config file seems more reliable than using cli arguments.
80 This class allows to create a controlled environment for npm commands. 80 This class allows to create a controlled environment for npm commands.
81 """ 81 """
82 def __init__(self, d, configs=None, npmrc=None): 82 def __init__(self, d, configs=[], npmrc=None):
83 self.d = d 83 self.d = d
84 84
85 if configs: 85 self.user_config = tempfile.NamedTemporaryFile(mode="w", buffering=1)
86 self.user_config = tempfile.NamedTemporaryFile(mode="w", buffering=1) 86 for key, value in configs:
87 self.user_config_name = self.user_config.name 87 self.user_config.write("%s=%s\n" % (key, value))
88 for key, value in configs:
89 self.user_config.write("%s=%s\n" % (key, value))
90 else:
91 self.user_config_name = "/dev/null"
92 88
93 if npmrc: 89 if npmrc:
94 self.global_config_name = npmrc 90 self.global_config_name = npmrc
@@ -109,7 +105,7 @@ class NpmEnvironment(object):
109 workdir = tmpdir 105 workdir = tmpdir
110 106
111 def _run(cmd): 107 def _run(cmd):
112 cmd = "NPM_CONFIG_USERCONFIG=%s " % (self.user_config_name) + cmd 108 cmd = "NPM_CONFIG_USERCONFIG=%s " % (self.user_config.name) + cmd
113 cmd = "NPM_CONFIG_GLOBALCONFIG=%s " % (self.global_config_name) + cmd 109 cmd = "NPM_CONFIG_GLOBALCONFIG=%s " % (self.global_config_name) + cmd
114 return runfetchcmd(cmd, d, workdir=workdir) 110 return runfetchcmd(cmd, d, workdir=workdir)
115 111
diff --git a/bitbake/lib/bb/fetch2/ssh.py b/bitbake/lib/bb/fetch2/ssh.py
index 2c8557e1f8..a104c9eb19 100644
--- a/bitbake/lib/bb/fetch2/ssh.py
+++ b/bitbake/lib/bb/fetch2/ssh.py
@@ -40,9 +40,9 @@ __pattern__ = re.compile(r'''
40 ( # Optional username/password block 40 ( # Optional username/password block
41 (?P<user>\S+) # username 41 (?P<user>\S+) # username
42 (:(?P<pass>\S+))? # colon followed by the password (optional) 42 (:(?P<pass>\S+))? # colon followed by the password (optional)
43 )?
44 (?P<cparam>(;[^;]+)*)? # connection parameters block (optional) 43 (?P<cparam>(;[^;]+)*)? # connection parameters block (optional)
45 @ 44 @
45 )?
46 (?P<host>\S+?) # non-greedy match of the host 46 (?P<host>\S+?) # non-greedy match of the host
47 (:(?P<port>[0-9]+))? # colon followed by the port (optional) 47 (:(?P<port>[0-9]+))? # colon followed by the port (optional)
48 / 48 /
diff --git a/bitbake/lib/bb/process.py b/bitbake/lib/bb/process.py
index d5a1775fce..af5d804a1d 100644
--- a/bitbake/lib/bb/process.py
+++ b/bitbake/lib/bb/process.py
@@ -60,7 +60,7 @@ class Popen(subprocess.Popen):
60 "close_fds": True, 60 "close_fds": True,
61 "preexec_fn": subprocess_setup, 61 "preexec_fn": subprocess_setup,
62 "stdout": subprocess.PIPE, 62 "stdout": subprocess.PIPE,
63 "stderr": subprocess.STDOUT, 63 "stderr": subprocess.PIPE,
64 "stdin": subprocess.PIPE, 64 "stdin": subprocess.PIPE,
65 "shell": False, 65 "shell": False,
66 } 66 }
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index 8fdcc66dc7..91c4637522 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -27,6 +27,7 @@ import re
27import datetime 27import datetime
28import pickle 28import pickle
29import traceback 29import traceback
30import gc
30import bb.server.xmlrpcserver 31import bb.server.xmlrpcserver
31from bb import daemonize 32from bb import daemonize
32from multiprocessing import queues 33from multiprocessing import queues
@@ -739,8 +740,10 @@ class ConnectionWriter(object):
739 740
740 def send(self, obj): 741 def send(self, obj):
741 obj = multiprocessing.reduction.ForkingPickler.dumps(obj) 742 obj = multiprocessing.reduction.ForkingPickler.dumps(obj)
743 gc.disable()
742 with self.wlock: 744 with self.wlock:
743 self.writer.send_bytes(obj) 745 self.writer.send_bytes(obj)
746 gc.enable()
744 747
745 def fileno(self): 748 def fileno(self):
746 return self.writer.fileno() 749 return self.writer.fileno()
diff --git a/bitbake/lib/bb/server/xmlrpcserver.py b/bitbake/lib/bb/server/xmlrpcserver.py
index 2fa71be667..01f55538ae 100644
--- a/bitbake/lib/bb/server/xmlrpcserver.py
+++ b/bitbake/lib/bb/server/xmlrpcserver.py
@@ -11,6 +11,7 @@ import hashlib
11import time 11import time
12import inspect 12import inspect
13from xmlrpc.server import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler 13from xmlrpc.server import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
14import bb.server.xmlrpcclient
14 15
15import bb 16import bb
16 17
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index a85ebdf425..b597438729 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -1079,7 +1079,7 @@ class FetcherNetworkTest(FetcherTest):
1079 """ Prevent regression on deeply nested submodules not being checked out properly, even though they were fetched. """ 1079 """ Prevent regression on deeply nested submodules not being checked out properly, even though they were fetched. """
1080 1080
1081 # This repository also has submodules where the module (name), path and url do not align 1081 # This repository also has submodules where the module (name), path and url do not align
1082 url = "gitsm://github.com/azure/iotedge.git;protocol=https;rev=d76e0316c6f324345d77c48a83ce836d09392699" 1082 url = "gitsm://github.com/azure/iotedge.git;protocol=https;rev=d76e0316c6f324345d77c48a83ce836d09392699;branch=main"
1083 fetcher = bb.fetch.Fetch([url], self.d) 1083 fetcher = bb.fetch.Fetch([url], self.d)
1084 fetcher.download() 1084 fetcher.download()
1085 # Previous cwd has been deleted 1085 # Previous cwd has been deleted
@@ -1378,9 +1378,6 @@ class FetchCheckStatusTest(FetcherTest):
1378 "https://downloads.yoctoproject.org/releases/opkg/opkg-0.1.7.tar.gz", 1378 "https://downloads.yoctoproject.org/releases/opkg/opkg-0.1.7.tar.gz",
1379 "https://downloads.yoctoproject.org/releases/opkg/opkg-0.3.0.tar.gz", 1379 "https://downloads.yoctoproject.org/releases/opkg/opkg-0.3.0.tar.gz",
1380 "ftp://sourceware.org/pub/libffi/libffi-1.20.tar.gz", 1380 "ftp://sourceware.org/pub/libffi/libffi-1.20.tar.gz",
1381 "http://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz",
1382 "https://ftp.gnu.org/gnu/chess/gnuchess-5.08.tar.gz",
1383 "https://ftp.gnu.org/gnu/gmp/gmp-4.0.tar.gz",
1384 # GitHub releases are hosted on Amazon S3, which doesn't support HEAD 1381 # GitHub releases are hosted on Amazon S3, which doesn't support HEAD
1385 "https://github.com/kergoth/tslib/releases/download/1.1/tslib-1.1.tar.xz" 1382 "https://github.com/kergoth/tslib/releases/download/1.1/tslib-1.1.tar.xz"
1386 ] 1383 ]
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 484545a684..3ba5579ca4 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -228,7 +228,9 @@ class TerminalFilter(object):
228 228
229 def keepAlive(self, t): 229 def keepAlive(self, t):
230 if not self.cuu: 230 if not self.cuu:
231 print("Bitbake still alive (%ds)" % t) 231 print("Bitbake still alive (no events for %ds). Active tasks:" % t)
232 for t in self.helper.running_tasks:
233 print(t)
232 sys.stdout.flush() 234 sys.stdout.flush()
233 235
234 def updateFooter(self): 236 def updateFooter(self):
@@ -605,7 +607,8 @@ def main(server, eventHandler, params, tf = TerminalFilter):
605 warnings = 0 607 warnings = 0
606 taskfailures = [] 608 taskfailures = []
607 609
608 printinterval = 5000 610 printintervaldelta = 10 * 60 # 10 minutes
611 printinterval = printintervaldelta
609 lastprint = time.time() 612 lastprint = time.time()
610 613
611 termfilter = tf(main, helper, console_handlers, params.options.quiet) 614 termfilter = tf(main, helper, console_handlers, params.options.quiet)
@@ -615,7 +618,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
615 try: 618 try:
616 if (lastprint + printinterval) <= time.time(): 619 if (lastprint + printinterval) <= time.time():
617 termfilter.keepAlive(printinterval) 620 termfilter.keepAlive(printinterval)
618 printinterval += 5000 621 printinterval += printintervaldelta
619 event = eventHandler.waitEvent(0) 622 event = eventHandler.waitEvent(0)
620 if event is None: 623 if event is None:
621 if main.shutdown > 1: 624 if main.shutdown > 1:
@@ -646,7 +649,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
646 649
647 if isinstance(event, logging.LogRecord): 650 if isinstance(event, logging.LogRecord):
648 lastprint = time.time() 651 lastprint = time.time()
649 printinterval = 5000 652 printinterval = printintervaldelta
650 if event.levelno >= bb.msg.BBLogFormatter.ERROR: 653 if event.levelno >= bb.msg.BBLogFormatter.ERROR:
651 errors = errors + 1 654 errors = errors + 1
652 return_value = 1 655 return_value = 1
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index d890ea832e..cd442dcd0d 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -16,7 +16,8 @@ import bb.msg
16import multiprocessing 16import multiprocessing
17import fcntl 17import fcntl
18import importlib 18import importlib
19from importlib import machinery 19import importlib.machinery
20import importlib.util
20import itertools 21import itertools
21import subprocess 22import subprocess
22import glob 23import glob
@@ -400,7 +401,7 @@ def better_exec(code, context, text = None, realfile = "<code>", pythonexception
400 code = better_compile(code, realfile, realfile) 401 code = better_compile(code, realfile, realfile)
401 try: 402 try:
402 exec(code, get_context(), context) 403 exec(code, get_context(), context)
403 except (bb.BBHandledException, bb.parse.SkipRecipe, bb.data_smart.ExpansionError): 404 except (bb.BBHandledException, bb.parse.SkipRecipe, bb.data_smart.ExpansionError, bb.process.ExecutionError):
404 # Error already shown so passthrough, no need for traceback 405 # Error already shown so passthrough, no need for traceback
405 raise 406 raise
406 except Exception as e: 407 except Exception as e:
@@ -1620,7 +1621,9 @@ def load_plugins(logger, plugins, pluginpath):
1620 logger.debug('Loading plugin %s' % name) 1621 logger.debug('Loading plugin %s' % name)
1621 spec = importlib.machinery.PathFinder.find_spec(name, path=[pluginpath] ) 1622 spec = importlib.machinery.PathFinder.find_spec(name, path=[pluginpath] )
1622 if spec: 1623 if spec:
1623 return spec.loader.load_module() 1624 mod = importlib.util.module_from_spec(spec)
1625 spec.loader.exec_module(mod)
1626 return mod
1624 1627
1625 logger.debug('Loading plugins from %s...' % pluginpath) 1628 logger.debug('Loading plugins from %s...' % pluginpath)
1626 1629
diff --git a/bitbake/lib/pyinotify.py b/bitbake/lib/pyinotify.py
index 6ae40a2d76..8c94b3e334 100644
--- a/bitbake/lib/pyinotify.py
+++ b/bitbake/lib/pyinotify.py
@@ -52,7 +52,6 @@ from collections import deque
52from datetime import datetime, timedelta 52from datetime import datetime, timedelta
53import time 53import time
54import re 54import re
55import asyncore
56import glob 55import glob
57import locale 56import locale
58import subprocess 57import subprocess
@@ -1475,35 +1474,6 @@ class ThreadedNotifier(threading.Thread, Notifier):
1475 self.loop() 1474 self.loop()
1476 1475
1477 1476
1478class AsyncNotifier(asyncore.file_dispatcher, Notifier):
1479 """
1480 This notifier inherits from asyncore.file_dispatcher in order to be able to
1481 use pyinotify along with the asyncore framework.
1482
1483 """
1484 def __init__(self, watch_manager, default_proc_fun=None, read_freq=0,
1485 threshold=0, timeout=None, channel_map=None):
1486 """
1487 Initializes the async notifier. The only additional parameter is
1488 'channel_map' which is the optional asyncore private map. See
1489 Notifier class for the meaning of the others parameters.
1490
1491 """
1492 Notifier.__init__(self, watch_manager, default_proc_fun, read_freq,
1493 threshold, timeout)
1494 asyncore.file_dispatcher.__init__(self, self._fd, channel_map)
1495
1496 def handle_read(self):
1497 """
1498 When asyncore tells us we can read from the fd, we proceed processing
1499 events. This method can be overridden for handling a notification
1500 differently.
1501
1502 """
1503 self.read_events()
1504 self.process_events()
1505
1506
1507class TornadoAsyncNotifier(Notifier): 1477class TornadoAsyncNotifier(Notifier):
1508 """ 1478 """
1509 Tornado ioloop adapter. 1479 Tornado ioloop adapter.
diff --git a/bitbake/lib/toaster/orm/fixtures/oe-core.xml b/bitbake/lib/toaster/orm/fixtures/oe-core.xml
index b01a337012..25543f6ec4 100644
--- a/bitbake/lib/toaster/orm/fixtures/oe-core.xml
+++ b/bitbake/lib/toaster/orm/fixtures/oe-core.xml
@@ -23,9 +23,14 @@
23 <field type="CharField" name="branch">master</field> 23 <field type="CharField" name="branch">master</field>
24 </object> 24 </object>
25 <object model="orm.bitbakeversion" pk="4"> 25 <object model="orm.bitbakeversion" pk="4">
26 <field type="CharField" name="name">gatesgarth</field> 26 <field type="CharField" name="name">hardknott</field>
27 <field type="CharField" name="giturl">git://git.openembedded.org/bitbake</field> 27 <field type="CharField" name="giturl">git://git.openembedded.org/bitbake</field>
28 <field type="CharField" name="branch">1.48</field> 28 <field type="CharField" name="branch">1.50</field>
29 </object>
30 <object model="orm.bitbakeversion" pk="5">
31 <field type="CharField" name="name">honister</field>
32 <field type="CharField" name="giturl">git://git.openembedded.org/bitbake</field>
33 <field type="CharField" name="branch">1.52</field>
29 </object> 34 </object>
30 35
31 <!-- Releases available --> 36 <!-- Releases available -->
@@ -51,11 +56,18 @@
51 <field type="TextField" name="helptext">Toaster will run your builds using the tip of the &lt;a href=\"https://cgit.openembedded.org/openembedded-core/log/\"&gt;OpenEmbedded master&lt;/a&gt; branch.</field> 56 <field type="TextField" name="helptext">Toaster will run your builds using the tip of the &lt;a href=\"https://cgit.openembedded.org/openembedded-core/log/\"&gt;OpenEmbedded master&lt;/a&gt; branch.</field>
52 </object> 57 </object>
53 <object model="orm.release" pk="4"> 58 <object model="orm.release" pk="4">
54 <field type="CharField" name="name">gatesgarth</field> 59 <field type="CharField" name="name">hardknott</field>
55 <field type="CharField" name="description">Openembedded Gatesgarth</field> 60 <field type="CharField" name="description">Openembedded Hardknott</field>
56 <field rel="ManyToOneRel" to="orm.bitbakeversion" name="bitbake_version">4</field> 61 <field rel="ManyToOneRel" to="orm.bitbakeversion" name="bitbake_version">4</field>
57 <field type="CharField" name="branch_name">gatesgarth</field> 62 <field type="CharField" name="branch_name">hardknott</field>
58 <field type="TextField" name="helptext">Toaster will run your builds using the tip of the &lt;a href=\"https://cgit.openembedded.org/openembedded-core/log/?h=gatesgarth\"&gt;OpenEmbedded Gatesgarth&lt;/a&gt; branch.</field> 63 <field type="TextField" name="helptext">Toaster will run your builds using the tip of the &lt;a href=\"https://cgit.openembedded.org/openembedded-core/log/?h=hardknott\"&gt;OpenEmbedded Hardknott&lt;/a&gt; branch.</field>
64 </object>
65 <object model="orm.release" pk="5">
66 <field type="CharField" name="name">honister</field>
67 <field type="CharField" name="description">Openembedded Honister</field>
68 <field rel="ManyToOneRel" to="orm.bitbakeversion" name="bitbake_version">5</field>
69 <field type="CharField" name="branch_name">honister</field>
70 <field type="TextField" name="helptext">Toaster will run your builds using the tip of the &lt;a href=\"https://cgit.openembedded.org/openembedded-core/log/?h=honister\"&gt;OpenEmbedded Honister&lt;/a&gt; branch.</field>
59 </object> 71 </object>
60 72
61 <!-- Default layers for each release --> 73 <!-- Default layers for each release -->
@@ -75,6 +87,10 @@
75 <field rel="ManyToOneRel" to="orm.release" name="release">4</field> 87 <field rel="ManyToOneRel" to="orm.release" name="release">4</field>
76 <field type="CharField" name="layer_name">openembedded-core</field> 88 <field type="CharField" name="layer_name">openembedded-core</field>
77 </object> 89 </object>
90 <object model="orm.releasedefaultlayer" pk="5">
91 <field rel="ManyToOneRel" to="orm.release" name="release">5</field>
92 <field type="CharField" name="layer_name">openembedded-core</field>
93 </object>
78 94
79 95
80 <!-- Layer for the Local release --> 96 <!-- Layer for the Local release -->
diff --git a/bitbake/lib/toaster/orm/fixtures/poky.xml b/bitbake/lib/toaster/orm/fixtures/poky.xml
index 363789d624..5811cfae0f 100644
--- a/bitbake/lib/toaster/orm/fixtures/poky.xml
+++ b/bitbake/lib/toaster/orm/fixtures/poky.xml
@@ -26,9 +26,15 @@
26 <field type="CharField" name="dirpath">bitbake</field> 26 <field type="CharField" name="dirpath">bitbake</field>
27 </object> 27 </object>
28 <object model="orm.bitbakeversion" pk="4"> 28 <object model="orm.bitbakeversion" pk="4">
29 <field type="CharField" name="name">gatesgarth</field> 29 <field type="CharField" name="name">hardknott</field>
30 <field type="CharField" name="giturl">git://git.yoctoproject.org/poky</field> 30 <field type="CharField" name="giturl">git://git.yoctoproject.org/poky</field>
31 <field type="CharField" name="branch">gatesgarth</field> 31 <field type="CharField" name="branch">hardknott</field>
32 <field type="CharField" name="dirpath">bitbake</field>
33 </object>
34 <object model="orm.bitbakeversion" pk="5">
35 <field type="CharField" name="name">honister</field>
36 <field type="CharField" name="giturl">git://git.yoctoproject.org/poky</field>
37 <field type="CharField" name="branch">honister</field>
32 <field type="CharField" name="dirpath">bitbake</field> 38 <field type="CharField" name="dirpath">bitbake</field>
33 </object> 39 </object>
34 40
@@ -56,11 +62,18 @@
56 <field type="TextField" name="helptext">Toaster will run your builds using the tip of the &lt;a href="https://git.yoctoproject.org/cgit/cgit.cgi/poky/log/"&gt;Yocto Project Master branch&lt;/a&gt;.</field> 62 <field type="TextField" name="helptext">Toaster will run your builds using the tip of the &lt;a href="https://git.yoctoproject.org/cgit/cgit.cgi/poky/log/"&gt;Yocto Project Master branch&lt;/a&gt;.</field>
57 </object> 63 </object>
58 <object model="orm.release" pk="4"> 64 <object model="orm.release" pk="4">
59 <field type="CharField" name="name">gatesgarth</field> 65 <field type="CharField" name="name">hardknott</field>
60 <field type="CharField" name="description">Yocto Project 3.2 "Gatesgarth"</field> 66 <field type="CharField" name="description">Yocto Project 3.3 "Hardknott"</field>
61 <field rel="ManyToOneRel" to="orm.bitbakeversion" name="bitbake_version">4</field> 67 <field rel="ManyToOneRel" to="orm.bitbakeversion" name="bitbake_version">4</field>
62 <field type="CharField" name="branch_name">gatesgarth</field> 68 <field type="CharField" name="branch_name">hardknott</field>
63 <field type="TextField" name="helptext">Toaster will run your builds using the tip of the &lt;a href="https://git.yoctoproject.org/cgit/cgit.cgi/poky/log/?h=gatesgarth"&gt;Yocto Project Gatesgarth branch&lt;/a&gt;.</field> 69 <field type="TextField" name="helptext">Toaster will run your builds using the tip of the &lt;a href="https://git.yoctoproject.org/cgit/cgit.cgi/poky/log/?h=hardknott"&gt;Yocto Project Hardknott branch&lt;/a&gt;.</field>
70 </object>
71 <object model="orm.release" pk="5">
72 <field type="CharField" name="name">honister</field>
73 <field type="CharField" name="description">Yocto Project 3.4 "Honister"</field>
74 <field rel="ManyToOneRel" to="orm.bitbakeversion" name="bitbake_version">5</field>
75 <field type="CharField" name="branch_name">honister</field>
76 <field type="TextField" name="helptext">Toaster will run your builds using the tip of the &lt;a href="https://git.yoctoproject.org/cgit/cgit.cgi/poky/log/?h=honister"&gt;Yocto Project Honister branch&lt;/a&gt;.</field>
64 </object> 77 </object>
65 78
66 <!-- Default project layers for each release --> 79 <!-- Default project layers for each release -->
@@ -112,6 +125,18 @@
112 <field rel="ManyToOneRel" to="orm.release" name="release">4</field> 125 <field rel="ManyToOneRel" to="orm.release" name="release">4</field>
113 <field type="CharField" name="layer_name">meta-yocto-bsp</field> 126 <field type="CharField" name="layer_name">meta-yocto-bsp</field>
114 </object> 127 </object>
128 <object model="orm.releasedefaultlayer" pk="13">
129 <field rel="ManyToOneRel" to="orm.release" name="release">5</field>
130 <field type="CharField" name="layer_name">openembedded-core</field>
131 </object>
132 <object model="orm.releasedefaultlayer" pk="14">
133 <field rel="ManyToOneRel" to="orm.release" name="release">5</field>
134 <field type="CharField" name="layer_name">meta-poky</field>
135 </object>
136 <object model="orm.releasedefaultlayer" pk="15">
137 <field rel="ManyToOneRel" to="orm.release" name="release">5</field>
138 <field type="CharField" name="layer_name">meta-yocto-bsp</field>
139 </object>
115 140
116 <!-- Default layers provided by poky 141 <!-- Default layers provided by poky
117 openembedded-core 142 openembedded-core
@@ -152,7 +177,14 @@
152 <field rel="ManyToOneRel" to="orm.layer" name="layer">1</field> 177 <field rel="ManyToOneRel" to="orm.layer" name="layer">1</field>
153 <field type="IntegerField" name="layer_source">0</field> 178 <field type="IntegerField" name="layer_source">0</field>
154 <field rel="ManyToOneRel" to="orm.release" name="release">4</field> 179 <field rel="ManyToOneRel" to="orm.release" name="release">4</field>
155 <field type="CharField" name="branch">gatesgarth</field> 180 <field type="CharField" name="branch">hardknott</field>
181 <field type="CharField" name="dirpath">meta</field>
182 </object>
183 <object model="orm.layer_version" pk="5">
184 <field rel="ManyToOneRel" to="orm.layer" name="layer">1</field>
185 <field type="IntegerField" name="layer_source">0</field>
186 <field rel="ManyToOneRel" to="orm.release" name="release">5</field>
187 <field type="CharField" name="branch">honister</field>
156 <field type="CharField" name="dirpath">meta</field> 188 <field type="CharField" name="dirpath">meta</field>
157 </object> 189 </object>
158 190
@@ -164,14 +196,14 @@
164 <field type="CharField" name="vcs_web_tree_base_url">https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/%path%?h=%branch%</field> 196 <field type="CharField" name="vcs_web_tree_base_url">https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/%path%?h=%branch%</field>
165 <field type="CharField" name="vcs_web_file_base_url">https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/%path%?h=%branch%</field> 197 <field type="CharField" name="vcs_web_file_base_url">https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/%path%?h=%branch%</field>
166 </object> 198 </object>
167 <object model="orm.layer_version" pk="5"> 199 <object model="orm.layer_version" pk="6">
168 <field rel="ManyToOneRel" to="orm.layer" name="layer">2</field> 200 <field rel="ManyToOneRel" to="orm.layer" name="layer">2</field>
169 <field type="IntegerField" name="layer_source">0</field> 201 <field type="IntegerField" name="layer_source">0</field>
170 <field rel="ManyToOneRel" to="orm.release" name="release">1</field> 202 <field rel="ManyToOneRel" to="orm.release" name="release">1</field>
171 <field type="CharField" name="branch">dunfell</field> 203 <field type="CharField" name="branch">dunfell</field>
172 <field type="CharField" name="dirpath">meta-poky</field> 204 <field type="CharField" name="dirpath">meta-poky</field>
173 </object> 205 </object>
174 <object model="orm.layer_version" pk="6"> 206 <object model="orm.layer_version" pk="7">
175 <field rel="ManyToOneRel" to="orm.layer" name="layer">2</field> 207 <field rel="ManyToOneRel" to="orm.layer" name="layer">2</field>
176 <field type="IntegerField" name="layer_source">0</field> 208 <field type="IntegerField" name="layer_source">0</field>
177 <field rel="ManyToOneRel" to="orm.release" name="release">2</field> 209 <field rel="ManyToOneRel" to="orm.release" name="release">2</field>
@@ -179,18 +211,25 @@
179 <field type="CharField" name="commit">HEAD</field> 211 <field type="CharField" name="commit">HEAD</field>
180 <field type="CharField" name="dirpath">meta-poky</field> 212 <field type="CharField" name="dirpath">meta-poky</field>
181 </object> 213 </object>
182 <object model="orm.layer_version" pk="7"> 214 <object model="orm.layer_version" pk="8">
183 <field rel="ManyToOneRel" to="orm.layer" name="layer">2</field> 215 <field rel="ManyToOneRel" to="orm.layer" name="layer">2</field>
184 <field type="IntegerField" name="layer_source">0</field> 216 <field type="IntegerField" name="layer_source">0</field>
185 <field rel="ManyToOneRel" to="orm.release" name="release">3</field> 217 <field rel="ManyToOneRel" to="orm.release" name="release">3</field>
186 <field type="CharField" name="branch">master</field> 218 <field type="CharField" name="branch">master</field>
187 <field type="CharField" name="dirpath">meta-poky</field> 219 <field type="CharField" name="dirpath">meta-poky</field>
188 </object> 220 </object>
189 <object model="orm.layer_version" pk="8"> 221 <object model="orm.layer_version" pk="9">
190 <field rel="ManyToOneRel" to="orm.layer" name="layer">2</field> 222 <field rel="ManyToOneRel" to="orm.layer" name="layer">2</field>
191 <field type="IntegerField" name="layer_source">0</field> 223 <field type="IntegerField" name="layer_source">0</field>
192 <field rel="ManyToOneRel" to="orm.release" name="release">4</field> 224 <field rel="ManyToOneRel" to="orm.release" name="release">4</field>
193 <field type="CharField" name="branch">gatesgarth</field> 225 <field type="CharField" name="branch">hardknott</field>
226 <field type="CharField" name="dirpath">meta-poky</field>
227 </object>
228 <object model="orm.layer_version" pk="10">
229 <field rel="ManyToOneRel" to="orm.layer" name="layer">2</field>
230 <field type="IntegerField" name="layer_source">0</field>
231 <field rel="ManyToOneRel" to="orm.release" name="release">5</field>
232 <field type="CharField" name="branch">honister</field>
194 <field type="CharField" name="dirpath">meta-poky</field> 233 <field type="CharField" name="dirpath">meta-poky</field>
195 </object> 234 </object>
196 235
@@ -202,14 +241,14 @@
202 <field type="CharField" name="vcs_web_tree_base_url">https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/%path%?h=%branch%</field> 241 <field type="CharField" name="vcs_web_tree_base_url">https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/%path%?h=%branch%</field>
203 <field type="CharField" name="vcs_web_file_base_url">https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/%path%?h=%branch%</field> 242 <field type="CharField" name="vcs_web_file_base_url">https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/%path%?h=%branch%</field>
204 </object> 243 </object>
205 <object model="orm.layer_version" pk="9"> 244 <object model="orm.layer_version" pk="11">
206 <field rel="ManyToOneRel" to="orm.layer" name="layer">3</field> 245 <field rel="ManyToOneRel" to="orm.layer" name="layer">3</field>
207 <field type="IntegerField" name="layer_source">0</field> 246 <field type="IntegerField" name="layer_source">0</field>
208 <field rel="ManyToOneRel" to="orm.release" name="release">1</field> 247 <field rel="ManyToOneRel" to="orm.release" name="release">1</field>
209 <field type="CharField" name="branch">dunfell</field> 248 <field type="CharField" name="branch">dunfell</field>
210 <field type="CharField" name="dirpath">meta-yocto-bsp</field> 249 <field type="CharField" name="dirpath">meta-yocto-bsp</field>
211 </object> 250 </object>
212 <object model="orm.layer_version" pk="10"> 251 <object model="orm.layer_version" pk="12">
213 <field rel="ManyToOneRel" to="orm.layer" name="layer">3</field> 252 <field rel="ManyToOneRel" to="orm.layer" name="layer">3</field>
214 <field type="IntegerField" name="layer_source">0</field> 253 <field type="IntegerField" name="layer_source">0</field>
215 <field rel="ManyToOneRel" to="orm.release" name="release">2</field> 254 <field rel="ManyToOneRel" to="orm.release" name="release">2</field>
@@ -217,18 +256,25 @@
217 <field type="CharField" name="commit">HEAD</field> 256 <field type="CharField" name="commit">HEAD</field>
218 <field type="CharField" name="dirpath">meta-yocto-bsp</field> 257 <field type="CharField" name="dirpath">meta-yocto-bsp</field>
219 </object> 258 </object>
220 <object model="orm.layer_version" pk="11"> 259 <object model="orm.layer_version" pk="13">
221 <field rel="ManyToOneRel" to="orm.layer" name="layer">3</field> 260 <field rel="ManyToOneRel" to="orm.layer" name="layer">3</field>
222 <field type="IntegerField" name="layer_source">0</field> 261 <field type="IntegerField" name="layer_source">0</field>
223 <field rel="ManyToOneRel" to="orm.release" name="release">3</field> 262 <field rel="ManyToOneRel" to="orm.release" name="release">3</field>
224 <field type="CharField" name="branch">master</field> 263 <field type="CharField" name="branch">master</field>
225 <field type="CharField" name="dirpath">meta-yocto-bsp</field> 264 <field type="CharField" name="dirpath">meta-yocto-bsp</field>
226 </object> 265 </object>
227 <object model="orm.layer_version" pk="12"> 266 <object model="orm.layer_version" pk="14">
228 <field rel="ManyToOneRel" to="orm.layer" name="layer">3</field> 267 <field rel="ManyToOneRel" to="orm.layer" name="layer">3</field>
229 <field type="IntegerField" name="layer_source">0</field> 268 <field type="IntegerField" name="layer_source">0</field>
230 <field rel="ManyToOneRel" to="orm.release" name="release">4</field> 269 <field rel="ManyToOneRel" to="orm.release" name="release">4</field>
231 <field type="CharField" name="branch">gatesgarth</field> 270 <field type="CharField" name="branch">hardknott</field>
271 <field type="CharField" name="dirpath">meta-yocto-bsp</field>
272 </object>
273 <object model="orm.layer_version" pk="15">
274 <field rel="ManyToOneRel" to="orm.layer" name="layer">3</field>
275 <field type="IntegerField" name="layer_source">0</field>
276 <field rel="ManyToOneRel" to="orm.release" name="release">5</field>
277 <field type="CharField" name="branch">honister</field>
232 <field type="CharField" name="dirpath">meta-yocto-bsp</field> 278 <field type="CharField" name="dirpath">meta-yocto-bsp</field>
233 </object> 279 </object>
234</django-objects> 280</django-objects>
diff --git a/bitbake/lib/toaster/orm/fixtures/settings.xml b/bitbake/lib/toaster/orm/fixtures/settings.xml
index 78c0fdca7f..ab3ea021f5 100644
--- a/bitbake/lib/toaster/orm/fixtures/settings.xml
+++ b/bitbake/lib/toaster/orm/fixtures/settings.xml
@@ -19,7 +19,7 @@
19 <field type="CharField" name="value">${TOPDIR}/../sstate-cache</field> 19 <field type="CharField" name="value">${TOPDIR}/../sstate-cache</field>
20 </object> 20 </object>
21 <object model="orm.toastersetting" pk="6"> 21 <object model="orm.toastersetting" pk="6">
22 <field type="CharField" name="name">DEFCONF_IMAGE_INSTALL_append</field> 22 <field type="CharField" name="name">DEFCONF_IMAGE_INSTALL:append</field>
23 <field type="CharField" name="value"></field> 23 <field type="CharField" name="value"></field>
24 </object> 24 </object>
25 <object model="orm.toastersetting" pk="7"> 25 <object model="orm.toastersetting" pk="7">
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 4c94b407d7..6d772367d8 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -1717,7 +1717,7 @@ class CustomImageRecipe(Recipe):
1717 1717
1718 def generate_recipe_file_contents(self): 1718 def generate_recipe_file_contents(self):
1719 """Generate the contents for the recipe file.""" 1719 """Generate the contents for the recipe file."""
1720 # If we have no excluded packages we only need to _append 1720 # If we have no excluded packages we only need to :append
1721 if self.excludes_set.count() == 0: 1721 if self.excludes_set.count() == 0:
1722 packages_conf = "IMAGE_INSTALL:append = \" " 1722 packages_conf = "IMAGE_INSTALL:append = \" "
1723 1723
diff --git a/bitbake/lib/toaster/toastergui/templates/projectconf.html b/bitbake/lib/toaster/toastergui/templates/projectconf.html
index bd49f1f585..c74adf0a7e 100644
--- a/bitbake/lib/toaster/toastergui/templates/projectconf.html
+++ b/bitbake/lib/toaster/toastergui/templates/projectconf.html
@@ -73,7 +73,7 @@
73 73
74 {% if image_install_append_defined %} 74 {% if image_install_append_defined %}
75 <dt> 75 <dt>
76 <span class="js-config-var-name js-config-var-managed-name">IMAGE_INSTALL_append</span> 76 <span class="js-config-var-name js-config-var-managed-name">IMAGE_INSTALL:append</span>
77 <span class="glyphicon glyphicon-question-sign get-help" title="Specifies additional packages to install into an image. If your build creates more than one image, the packages will be installed in all of them"></span> 77 <span class="glyphicon glyphicon-question-sign get-help" title="Specifies additional packages to install into an image. If your build creates more than one image, the packages will be installed in all of them"></span>
78 </dt> 78 </dt>
79 <dd class="variable-list"> 79 <dd class="variable-list">
@@ -83,7 +83,7 @@
83 <form id="change-image_install-form" class="form-inline" style="display:none;"> 83 <form id="change-image_install-form" class="form-inline" style="display:none;">
84 <div class="row"> 84 <div class="row">
85 <div class="col-md-4"> 85 <div class="col-md-4">
86 <span class="help-block">To set IMAGE_INSTALL_append to more than one package, type the package names separated by a space.</span> 86 <span class="help-block">To set IMAGE_INSTALL:append to more than one package, type the package names separated by a space.</span>
87 </div> 87 </div>
88 </div> 88 </div>
89 <div class="form-group"> 89 <div class="form-group">
@@ -771,10 +771,10 @@ $(document).ready(function() {
771 771
772 {% if image_install_append_defined %} 772 {% if image_install_append_defined %}
773 773
774 // init IMAGE_INSTALL_append trash icon 774 // init IMAGE_INSTALL:append trash icon
775 setDeleteTooltip($('#delete-image_install-icon')); 775 setDeleteTooltip($('#delete-image_install-icon'));
776 776
777 // change IMAGE_INSTALL_append variable 777 // change IMAGE_INSTALL:append variable
778 $('#change-image_install-icon').click(function() { 778 $('#change-image_install-icon').click(function() {
779 // preset the edit value 779 // preset the edit value
780 var current_val = $("span#image_install").text().trim(); 780 var current_val = $("span#image_install").text().trim();
@@ -814,7 +814,7 @@ $(document).ready(function() {
814 $('#apply-change-image_install').click(function(){ 814 $('#apply-change-image_install').click(function(){
815 // insure these non-empty values have single space prefix 815 // insure these non-empty values have single space prefix
816 var value = " " + $('#new-image_install').val().trim(); 816 var value = " " + $('#new-image_install').val().trim();
817 postEditAjaxRequest({"configvarChange" : 'IMAGE_INSTALL_append:'+value}); 817 postEditAjaxRequest({"configvarChange" : 'IMAGE_INSTALL:append:'+value});
818 $('#image_install').text(value); 818 $('#image_install').text(value);
819 $('#image_install').removeClass('text-muted'); 819 $('#image_install').removeClass('text-muted');
820 $("#change-image_install-form").slideUp(function () { 820 $("#change-image_install-form").slideUp(function () {
@@ -826,10 +826,10 @@ $(document).ready(function() {
826 }); 826 });
827 }); 827 });
828 828
829 // delete IMAGE_INSTALL_append variable value 829 // delete IMAGE_INSTALL:append variable value
830 $('#delete-image_install-icon').click(function(){ 830 $('#delete-image_install-icon').click(function(){
831 $(this).tooltip('hide'); 831 $(this).tooltip('hide');
832 postEditAjaxRequest({"configvarChange" : 'IMAGE_INSTALL_append:'+''}); 832 postEditAjaxRequest({"configvarChange" : 'IMAGE_INSTALL:append:'+''});
833 $('#image_install').parent().fadeOut(1000, function(){ 833 $('#image_install').parent().fadeOut(1000, function(){
834 $('#image_install').addClass('text-muted'); 834 $('#image_install').addClass('text-muted');
835 $('#image_install').text('Not set'); 835 $('#image_install').text('Not set');
@@ -1011,7 +1011,7 @@ $(document).ready(function() {
1011 $(".save").attr("disabled","disabled"); 1011 $(".save").attr("disabled","disabled");
1012 1012
1013 // Reload page if admin-removed core managed value is manually added back in 1013 // Reload page if admin-removed core managed value is manually added back in
1014 if (0 <= " DISTRO DL_DIR IMAGE_FSTYPES IMAGE_INSTALL_append PACKAGE_CLASSES SSTATE_DIR ".indexOf( " "+variable+" " )) { 1014 if (0 <= " DISTRO DL_DIR IMAGE_FSTYPES IMAGE_INSTALL:append PACKAGE_CLASSES SSTATE_DIR ".indexOf( " "+variable+" " )) {
1015 // delayed reload to avoid race condition with postEditAjaxRequest 1015 // delayed reload to avoid race condition with postEditAjaxRequest
1016 do_reload=true; 1016 do_reload=true;
1017 } 1017 }
diff --git a/documentation/bsp-guide/bsp.rst b/documentation/bsp-guide/bsp.rst
index 65652ff898..1cc92d721d 100644
--- a/documentation/bsp-guide/bsp.rst
+++ b/documentation/bsp-guide/bsp.rst
@@ -166,8 +166,9 @@ section.
166#. *Determine the BSP Layer You Want:* The Yocto Project supports many 166#. *Determine the BSP Layer You Want:* The Yocto Project supports many
167 BSPs, which are maintained in their own layers or in layers designed 167 BSPs, which are maintained in their own layers or in layers designed
168 to contain several BSPs. To get an idea of machine support through 168 to contain several BSPs. To get an idea of machine support through
169 BSP layers, you can look at the `index of 169 BSP layers, you can look at the
170 machines <&YOCTO_RELEASE_DL_URL;/machines>`__ for the release. 170 :yocto_dl:`index of machines </releases/yocto/yocto-&DISTRO;/machines>`
171 for the release.
171 172
172#. *Optionally Clone the meta-intel BSP Layer:* If your hardware is 173#. *Optionally Clone the meta-intel BSP Layer:* If your hardware is
173 based on current Intel CPUs and devices, you can leverage this BSP 174 based on current Intel CPUs and devices, you can leverage this BSP
@@ -877,7 +878,7 @@ Yocto Project:
877 your BSP layer as listed in the ``recipes.txt`` file, which is found 878 your BSP layer as listed in the ``recipes.txt`` file, which is found
878 in ``poky/meta`` directory of the :term:`Source Directory` 879 in ``poky/meta`` directory of the :term:`Source Directory`
879 or in the OpenEmbedded-Core Layer (``openembedded-core``) at 880 or in the OpenEmbedded-Core Layer (``openembedded-core``) at
880 https://git.openembedded.org/openembedded-core/tree/meta. 881 :oe_git:`/openembedded-core/tree/meta`.
881 882
882 You should place recipes (``*.bb`` files) and recipe modifications 883 You should place recipes (``*.bb`` files) and recipe modifications
883 (``*.bbappend`` files) into ``recipes-*`` subdirectories by 884 (``*.bbappend`` files) into ``recipes-*`` subdirectories by
diff --git a/documentation/conf.py b/documentation/conf.py
index 104b49ea02..22d0dd604a 100644
--- a/documentation/conf.py
+++ b/documentation/conf.py
@@ -15,8 +15,27 @@
15import os 15import os
16import sys 16import sys
17import datetime 17import datetime
18try:
19 import yaml
20except ImportError:
21 sys.stderr.write("The Yocto Project Sphinx documentation requires PyYAML.\
22 \nPlease make sure to install pyyaml python package.\n")
23 sys.exit(1)
18 24
19current_version = "3.4" 25# current_version = "dev"
26# bitbake_version = "" # Leave empty for development branch
27# Obtain versions from poky.yaml instead
28with open("poky.yaml") as data:
29 buff = data.read()
30 subst_vars = yaml.safe_load(buff)
31 if "DOCCONF_VERSION" not in subst_vars:
32 sys.stderr.write("Please set DOCCONF_VERSION in poky.yaml")
33 sys.exit(1)
34 current_version = subst_vars["DOCCONF_VERSION"]
35 if "BITBAKE_SERIES" not in subst_vars:
36 sys.stderr.write("Please set BITBAKE_SERIES in poky.yaml")
37 sys.exit(1)
38 bitbake_version = subst_vars["BITBAKE_SERIES"]
20 39
21# String used in sidebar 40# String used in sidebar
22version = 'Version: ' + current_version 41version = 'Version: ' + current_version
@@ -90,7 +109,7 @@ extlinks = {
90 109
91# Intersphinx config to use cross reference with Bitbake user manual 110# Intersphinx config to use cross reference with Bitbake user manual
92intersphinx_mapping = { 111intersphinx_mapping = {
93 'bitbake': ('https://docs.yoctoproject.org/bitbake/', None) 112 'bitbake': ('https://docs.yoctoproject.org/bitbake/' + bitbake_version, None)
94} 113}
95 114
96# Suppress "WARNING: unknown mimetype for ..." 115# Suppress "WARNING: unknown mimetype for ..."
diff --git a/documentation/dev-manual/common-tasks.rst b/documentation/dev-manual/common-tasks.rst
index 4683b1c045..fa9cd58b37 100644
--- a/documentation/dev-manual/common-tasks.rst
+++ b/documentation/dev-manual/common-tasks.rst
@@ -4781,7 +4781,7 @@ configuration would be as follows::
4781 require conf/multilib.conf 4781 require conf/multilib.conf
4782 MULTILIBS = "multilib:lib32" 4782 MULTILIBS = "multilib:lib32"
4783 DEFAULTTUNE:virtclass-multilib-lib32 = "x86" 4783 DEFAULTTUNE:virtclass-multilib-lib32 = "x86"
4784 IMAGE_INSTALL:append = "lib32-glib-2.0" 4784 IMAGE_INSTALL:append = " lib32-glib-2.0"
4785 4785
4786This example enables an additional library named 4786This example enables an additional library named
4787``lib32`` alongside the normal target packages. When combining these 4787``lib32`` alongside the normal target packages. When combining these
diff --git a/documentation/kernel-dev/common.rst b/documentation/kernel-dev/common.rst
index d42ca5f99a..631c46631e 100644
--- a/documentation/kernel-dev/common.rst
+++ b/documentation/kernel-dev/common.rst
@@ -1062,7 +1062,7 @@ Section.
1062 contents:: 1062 contents::
1063 1063
1064 FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" 1064 FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
1065 SRC_URI:append = "file://0001-calibrate.c-Added-some-printk-statements.patch" 1065 SRC_URI:append = " file://0001-calibrate.c-Added-some-printk-statements.patch"
1066 1066
1067 The :term:`FILESEXTRAPATHS` and :term:`SRC_URI` statements 1067 The :term:`FILESEXTRAPATHS` and :term:`SRC_URI` statements
1068 enable the OpenEmbedded build system to find the patch file. 1068 enable the OpenEmbedded build system to find the patch file.
diff --git a/documentation/migration-guides/migration-3.4.rst b/documentation/migration-guides/migration-3.4.rst
index 6105015a24..8143cd4813 100644
--- a/documentation/migration-guides/migration-3.4.rst
+++ b/documentation/migration-guides/migration-3.4.rst
@@ -140,7 +140,7 @@ configuration provided and tested by the Yocto Project, there is
140simply no sense in continuing to enable prelink. 140simply no sense in continuing to enable prelink.
141 141
142There's also a concern that no one is maintaining the code, and there 142There's also a concern that no one is maintaining the code, and there
143are open bugs (including `this serious one <https://bugzilla.yoctoproject.org/show_bug.cgi?id=14429>`__). 143are open bugs (including :yocto_bugs:`this serious one </show_bug.cgi?id=14429>`).
144Given that prelink does intricate address arithmetic and rewriting 144Given that prelink does intricate address arithmetic and rewriting
145of binaries the best option is to disable the feature. It is recommended 145of binaries the best option is to disable the feature. It is recommended
146that you consider disabling this feature in your own configuration if 146that you consider disabling this feature in your own configuration if
diff --git a/documentation/overview-manual/yp-intro.rst b/documentation/overview-manual/yp-intro.rst
index 7aee9db04f..3ca81428cf 100644
--- a/documentation/overview-manual/yp-intro.rst
+++ b/documentation/overview-manual/yp-intro.rst
@@ -217,8 +217,8 @@ your Metadata, the easier it is to cope with future changes.
217 - Use Board Support Package (BSP) layers from silicon vendors when 217 - Use Board Support Package (BSP) layers from silicon vendors when
218 possible. 218 possible.
219 219
220 - Familiarize yourself with the `Yocto Project curated layer 220 - Familiarize yourself with the
221 index <https://www.yoctoproject.org/software-overview/layers/>`__ 221 :yocto_home:`Yocto Project curated layer index</software-overview/layers/>`
222 or the :oe_layerindex:`OpenEmbedded layer index <>`. 222 or the :oe_layerindex:`OpenEmbedded layer index <>`.
223 The latter contains more layers but they are less universally 223 The latter contains more layers but they are less universally
224 validated. 224 validated.
diff --git a/documentation/poky.yaml b/documentation/poky.yaml
index f2d1e8b97f..fc7ec9ec3c 100644
--- a/documentation/poky.yaml
+++ b/documentation/poky.yaml
@@ -1,12 +1,14 @@
1DISTRO : "3.4" 1DISTRO : "3.4.4"
2DISTRO_NAME_NO_CAP : "honister" 2DISTRO_NAME_NO_CAP : "honister"
3DISTRO_NAME : "Honister" 3DISTRO_NAME : "Honister"
4DISTRO_NAME_NO_CAP_MINUS_ONE : "hardknott" 4DISTRO_NAME_NO_CAP_MINUS_ONE : "hardknott"
5DISTRO_NAME_NO_CAP_LTS : "dunfell" 5DISTRO_NAME_NO_CAP_LTS : "dunfell"
6YOCTO_DOC_VERSION : "3.4" 6YOCTO_DOC_VERSION : "3.4.4"
7YOCTO_DOC_VERSION_MINUS_ONE : "3.3.3" 7YOCTO_DOC_VERSION_MINUS_ONE : "3.3.6"
8DISTRO_REL_TAG : "yocto-3.4" 8DISTRO_REL_TAG : "yocto-3.4.4"
9POKYVERSION : "26.0.0" 9DOCCONF_VERSION : "3.4.4"
10BITBAKE_SERIES : "1.52"
11POKYVERSION : "26.0.4"
10YOCTO_POKY : "poky-&DISTRO_NAME_NO_CAP;-&POKYVERSION;" 12YOCTO_POKY : "poky-&DISTRO_NAME_NO_CAP;-&POKYVERSION;"
11YOCTO_DL_URL : "https://downloads.yoctoproject.org" 13YOCTO_DL_URL : "https://downloads.yoctoproject.org"
12YOCTO_AB_URL : "https://autobuilder.yoctoproject.org" 14YOCTO_AB_URL : "https://autobuilder.yoctoproject.org"
diff --git a/documentation/ref-manual/system-requirements.rst b/documentation/ref-manual/system-requirements.rst
index 5c15b6de56..6df59a1745 100644
--- a/documentation/ref-manual/system-requirements.rst
+++ b/documentation/ref-manual/system-requirements.rst
@@ -320,7 +320,7 @@ If you would prefer not to use the ``install-buildtools`` script, you can instea
320download and run a pre-built buildtools installer yourself with the following 320download and run a pre-built buildtools installer yourself with the following
321steps: 321steps:
322 322
3231. Locate and download the ``*.sh`` at &YOCTO_RELEASE_DL_URL;/buildtools/ 3231. Locate and download the ``*.sh`` at :yocto_dl:`/releases/yocto/yocto-&DISTRO;/buildtools/`
324 324
3252. Execute the installation script. Here is an example for the 3252. Execute the installation script. Here is an example for the
326 traditional installer:: 326 traditional installer::
diff --git a/documentation/ref-manual/tasks.rst b/documentation/ref-manual/tasks.rst
index 4edae33392..2438c023b4 100644
--- a/documentation/ref-manual/tasks.rst
+++ b/documentation/ref-manual/tasks.rst
@@ -326,21 +326,19 @@ file as a patch file::
326 file://file;apply=yes \ 326 file://file;apply=yes \
327 " 327 "
328 328
329Conversely, if you have a directory full of patch files and you want to 329Conversely, if you have a file whose file type is ``.patch`` or ``.diff``
330exclude some so that the ``do_patch`` task does not apply them during 330and you want to exclude it so that the ``do_patch`` task does not apply
331the patch phase, you can use the "apply=no" parameter with the 331it during the patch phase, you can use the "apply=no" parameter with the
332:term:`SRC_URI` statement:: 332:term:`SRC_URI` statement::
333 333
334 SRC_URI = " \ 334 SRC_URI = " \
335 git://path_to_repo/some_package \ 335 git://path_to_repo/some_package \
336 file://path_to_lots_of_patch_files \ 336 file://file1.patch \
337 file://path_to_lots_of_patch_files/patch_file5;apply=no \ 337 file://file2.patch;apply=no \
338 " 338 "
339 339
340In the 340In the previous example ``file1.patch`` would be applied as a patch by default
341previous example, assuming all the files in the directory holding the 341while ``file2.patch`` would not be applied.
342patch files end with either ``.patch`` or ``.diff``, every file would be
343applied as a patch by default except for the ``patch_file5`` patch.
344 342
345You can find out more about the patching process in the 343You can find out more about the patching process in the
346":ref:`overview-manual/concepts:patching`" section in 344":ref:`overview-manual/concepts:patching`" section in
diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
index fd796fddf7..7aef27337e 100644
--- a/documentation/ref-manual/variables.rst
+++ b/documentation/ref-manual/variables.rst
@@ -3979,10 +3979,10 @@ system and gives an overview of their function and contents.
3979 statements add specific configurations to targeted machine types:: 3979 statements add specific configurations to targeted machine types::
3980 3980
3981 KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc features/taskstats/taskstats.scc" 3981 KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc features/taskstats/taskstats.scc"
3982 KERNEL_FEATURES:append = "${KERNEL_EXTRA_FEATURES}" 3982 KERNEL_FEATURES:append = " ${KERNEL_EXTRA_FEATURES}"
3983 KERNEL_FEATURES:append:qemuall = "cfg/virtio.scc" 3983 KERNEL_FEATURES:append:qemuall = " cfg/virtio.scc"
3984 KERNEL_FEATURES:append:qemux86 = " cfg/sound.scc cfg/paravirt_kvm.scc" 3984 KERNEL_FEATURES:append:qemux86 = " cfg/sound.scc cfg/paravirt_kvm.scc"
3985 KERNEL_FEATURES:append:qemux86-64 = "cfg/sound.scc" 3985 KERNEL_FEATURES:append:qemux86-64 = " cfg/sound.scc"
3986 3986
3987 :term:`KERNEL_FIT_LINK_NAME` 3987 :term:`KERNEL_FIT_LINK_NAME`
3988 The link name of the kernel flattened image tree (FIT) image. This 3988 The link name of the kernel flattened image tree (FIT) image. This
@@ -4170,7 +4170,7 @@ system and gives an overview of their function and contents.
4170 SRCREV_machine:core2-32-intel-common = "43b9eced9ba8a57add36af07736344dcc383f711" 4170 SRCREV_machine:core2-32-intel-common = "43b9eced9ba8a57add36af07736344dcc383f711"
4171 KMACHINE:core2-32-intel-common = "intel-core2-32" 4171 KMACHINE:core2-32-intel-common = "intel-core2-32"
4172 KBRANCH:core2-32-intel-common = "standard/base" 4172 KBRANCH:core2-32-intel-common = "standard/base"
4173 KERNEL_FEATURES:append:core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" 4173 KERNEL_FEATURES:append:core2-32-intel-common = " ${KERNEL_FEATURES_INTEL_COMMON}"
4174 4174
4175 The :term:`KMACHINE` statement says 4175 The :term:`KMACHINE` statement says
4176 that the kernel understands the machine name as "intel-core2-32". 4176 that the kernel understands the machine name as "intel-core2-32".
diff --git a/documentation/releases.rst b/documentation/releases.rst
index d5a2d2aa80..7a71ac4087 100644
--- a/documentation/releases.rst
+++ b/documentation/releases.rst
@@ -4,6 +4,15 @@
4 Supported Release Manuals 4 Supported Release Manuals
5=========================== 5===========================
6 6
7*****************************
8Release Series 3.4 (honister)
9*****************************
10
11- :yocto_docs:`3.4 Documentation </3.4>`
12- :yocto_docs:`3.4.1 Documentation </3.4.1>`
13- :yocto_docs:`3.4.2 Documentation </3.4.2>`
14- :yocto_docs:`3.4.3 Documentation </3.4.3>`
15
7****************************** 16******************************
8Release Series 3.3 (hardknott) 17Release Series 3.3 (hardknott)
9****************************** 18******************************
@@ -12,6 +21,8 @@ Release Series 3.3 (hardknott)
12- :yocto_docs:`3.3.1 Documentation </3.3.1>` 21- :yocto_docs:`3.3.1 Documentation </3.3.1>`
13- :yocto_docs:`3.3.2 Documentation </3.3.2>` 22- :yocto_docs:`3.3.2 Documentation </3.3.2>`
14- :yocto_docs:`3.3.3 Documentation </3.3.3>` 23- :yocto_docs:`3.3.3 Documentation </3.3.3>`
24- :yocto_docs:`3.3.4 Documentation </3.3.4>`
25- :yocto_docs:`3.3.5 Documentation </3.3.5>`
15 26
16**************************** 27****************************
17Release Series 3.1 (dunfell) 28Release Series 3.1 (dunfell)
@@ -29,6 +40,9 @@ Release Series 3.1 (dunfell)
29- :yocto_docs:`3.1.9 Documentation </3.1.9>` 40- :yocto_docs:`3.1.9 Documentation </3.1.9>`
30- :yocto_docs:`3.1.10 Documentation </3.1.10>` 41- :yocto_docs:`3.1.10 Documentation </3.1.10>`
31- :yocto_docs:`3.1.11 Documentation </3.1.11>` 42- :yocto_docs:`3.1.11 Documentation </3.1.11>`
43- :yocto_docs:`3.1.12 Documentation </3.1.12>`
44- :yocto_docs:`3.1.13 Documentation </3.1.13>`
45- :yocto_docs:`3.1.14 Documentation </3.1.14>`
32 46
33========================== 47==========================
34 Outdated Release Manuals 48 Outdated Release Manuals
diff --git a/documentation/sphinx-static/switchers.js b/documentation/sphinx-static/switchers.js
index 6038dbb5a7..feea5f2abf 100644
--- a/documentation/sphinx-static/switchers.js
+++ b/documentation/sphinx-static/switchers.js
@@ -3,10 +3,10 @@
3 3
4 var all_versions = { 4 var all_versions = {
5 'dev': 'dev (3.5)', 5 'dev': 'dev (3.5)',
6 '3.4': '3.4', 6 '3.4.2': '3.4.2',
7 '3.3.3': '3.3.3', 7 '3.3.5': '3.3.5',
8 '3.2.4': '3.2.4', 8 '3.2.4': '3.2.4',
9 '3.1.11': '3.1.11', 9 '3.1.14': '3.1.14',
10 '3.0.4': '3.0.4', 10 '3.0.4': '3.0.4',
11 '2.7.4': '2.7.4', 11 '2.7.4': '2.7.4',
12 }; 12 };
diff --git a/meta-poky/conf/distro/include/gcsections.inc b/meta-poky/conf/distro/include/gcsections.inc
index 886a005b34..a1f8651ae9 100644
--- a/meta-poky/conf/distro/include/gcsections.inc
+++ b/meta-poky/conf/distro/include/gcsections.inc
@@ -16,6 +16,8 @@ LDFLAGS_SECTION_REMOVAL:pn-grub = ""
16# SDK packages with build problems using sections 16# SDK packages with build problems using sections
17CFLAGS_SECTION_REMOVAL:pn-nativesdk-glibc = "" 17CFLAGS_SECTION_REMOVAL:pn-nativesdk-glibc = ""
18LDFLAGS_SECTION_REMOVAL:pn-nativesdk-glibc = "" 18LDFLAGS_SECTION_REMOVAL:pn-nativesdk-glibc = ""
19CFLAGS_SECTION_REMOVAL:pn-nativesdk-cairo = ""
20LDFLAGS_SECTION_REMOVAL:pn-nativesdk-cairo = ""
19CFLAGS_SECTION_REMOVAL:pn-nativesdk-mingw-w64-runtime = "" 21CFLAGS_SECTION_REMOVAL:pn-nativesdk-mingw-w64-runtime = ""
20LDFLAGS_SECTION_REMOVAL:pn-nativesdk-mingw-w64-runtime = "" 22LDFLAGS_SECTION_REMOVAL:pn-nativesdk-mingw-w64-runtime = ""
21CFLAGS_SECTION_REMOVAL:pn-nativesdk-perl = "" 23CFLAGS_SECTION_REMOVAL:pn-nativesdk-perl = ""
diff --git a/meta-poky/conf/distro/poky.conf b/meta-poky/conf/distro/poky.conf
index 1884fd1783..6a21404a87 100644
--- a/meta-poky/conf/distro/poky.conf
+++ b/meta-poky/conf/distro/poky.conf
@@ -1,6 +1,6 @@
1DISTRO = "poky" 1DISTRO = "poky"
2DISTRO_NAME = "Poky (Yocto Project Reference Distro)" 2DISTRO_NAME = "Poky (Yocto Project Reference Distro)"
3DISTRO_VERSION = "3.4.1" 3DISTRO_VERSION = "3.4.4"
4DISTRO_CODENAME = "honister" 4DISTRO_CODENAME = "honister"
5SDK_VENDOR = "-pokysdk" 5SDK_VENDOR = "-pokysdk"
6SDK_VERSION = "${@d.getVar('DISTRO_VERSION').replace('snapshot-${METADATA_REVISION}', 'snapshot')}" 6SDK_VERSION = "${@d.getVar('DISTRO_VERSION').replace('snapshot-${METADATA_REVISION}', 'snapshot')}"
diff --git a/meta-selftest/recipes-test/git-submodule-test/git-submodule-test.bb b/meta-selftest/recipes-test/git-submodule-test/git-submodule-test.bb
index cc5d7eae5a..fa3041b7d8 100644
--- a/meta-selftest/recipes-test/git-submodule-test/git-submodule-test.bb
+++ b/meta-selftest/recipes-test/git-submodule-test/git-submodule-test.bb
@@ -7,3 +7,18 @@ INHIBIT_DEFAULT_DEPS = "1"
7 7
8SRC_URI = "gitsm://git.yoctoproject.org/git-submodule-test;branch=master" 8SRC_URI = "gitsm://git.yoctoproject.org/git-submodule-test;branch=master"
9SRCREV = "a2885dd7d25380d23627e7544b7bbb55014b16ee" 9SRCREV = "a2885dd7d25380d23627e7544b7bbb55014b16ee"
10
11S = "${WORKDIR}/git"
12
13do_test_git_as_user() {
14 cd ${S}
15 git status
16}
17addtask test_git_as_user after do_unpack
18
19fakeroot do_test_git_as_root() {
20 cd ${S}
21 git status
22}
23do_test_git_as_root[depends] += "virtual/fakeroot-native:do_populate_sysroot"
24addtask test_git_as_root after do_unpack
diff --git a/meta-selftest/recipes-test/gitrepotest/gitrepotest.bb b/meta-selftest/recipes-test/gitrepotest/gitrepotest.bb
new file mode 100644
index 0000000000..f1b6c55833
--- /dev/null
+++ b/meta-selftest/recipes-test/gitrepotest/gitrepotest.bb
@@ -0,0 +1,16 @@
1SUMMARY = "Test recipe for git repo initialization"
2HOMEPAGE = "https://git.yoctoproject.org/git/matchbox-panel-2"
3LICENSE = "GPL-2.0-or-later"
4LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
5
6INHIBIT_DEFAULT_DEPS = "1"
7
8PATCHTOOL="git"
9
10SRC_URI = "git://git.yoctoproject.org/git/matchbox-panel-2;branch=master;protocol=https \
11 file://0001-testpatch.patch \
12 "
13
14SRCREV = "f82ca3f42510fb3ef10f598b393eb373a2c34ca7"
15
16S = "${WORKDIR}/git"
diff --git a/meta-selftest/recipes-test/gitrepotest/gitrepotest/0001-testpatch.patch b/meta-selftest/recipes-test/gitrepotest/gitrepotest/0001-testpatch.patch
new file mode 100644
index 0000000000..bccda17ee9
--- /dev/null
+++ b/meta-selftest/recipes-test/gitrepotest/gitrepotest/0001-testpatch.patch
@@ -0,0 +1,9 @@
1diff --git a/Makefile.am b/Makefile.am
2index 432a9b4..bbf7c74 100644
3--- a/Makefile.am
4+++ b/Makefile.am
5@@ -1,3 +1,4 @@
6+## This is useless comment to test if patch works
7 ACLOCAL_AMFLAGS = -I m4
8
9 SUBDIRS = matchbox-panel applets data po
diff --git a/meta-selftest/recipes-test/recipeutils/recipeutils-test_1.2.bb b/meta-selftest/recipes-test/recipeutils/recipeutils-test_1.2.bb
index 062d6a7a05..ad9f475d15 100644
--- a/meta-selftest/recipes-test/recipeutils/recipeutils-test_1.2.bb
+++ b/meta-selftest/recipes-test/recipeutils/recipeutils-test_1.2.bb
@@ -2,7 +2,7 @@ SUMMARY = "Test recipe for recipeutils.patch_recipe()"
2 2
3require recipeutils-test.inc 3require recipeutils-test.inc
4 4
5LICENSE = "Proprietary" 5LICENSE = "HPND"
6LIC_FILES_CHKSUM = "file://${WORKDIR}/somefile;md5=d41d8cd98f00b204e9800998ecf8427e" 6LIC_FILES_CHKSUM = "file://${WORKDIR}/somefile;md5=d41d8cd98f00b204e9800998ecf8427e"
7DEPENDS += "zlib" 7DEPENDS += "zlib"
8 8
diff --git a/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.10.bbappend b/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.10.bbappend
index a7ef143dc9..94192afffe 100644
--- a/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.10.bbappend
+++ b/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.10.bbappend
@@ -7,17 +7,17 @@ KMACHINE:genericx86 ?= "common-pc"
7KMACHINE:genericx86-64 ?= "common-pc-64" 7KMACHINE:genericx86-64 ?= "common-pc-64"
8KMACHINE:beaglebone-yocto ?= "beaglebone" 8KMACHINE:beaglebone-yocto ?= "beaglebone"
9 9
10SRCREV_machine:genericx86 ?= "164ed895bc1e94722e80fe6496b176f6bb815cd4" 10SRCREV_machine:genericx86 ?= "a8b4c628f382412e5e7df5750f2be711df95fa06"
11SRCREV_machine:genericx86-64 ?= "164ed895bc1e94722e80fe6496b176f6bb815cd4" 11SRCREV_machine:genericx86-64 ?= "a8b4c628f382412e5e7df5750f2be711df95fa06"
12SRCREV_machine:edgerouter ?= "4ab94e777d8b41ee1ee4c279259e9733bc8049b1" 12SRCREV_machine:edgerouter ?= "43577894d2295a92fce760dc403b97527fb55835"
13SRCREV_machine:beaglebone-yocto ?= "941cc9c3849f96f7eaf109b1e35e05ba366aca56" 13SRCREV_machine:beaglebone-yocto ?= "8038166b729c192d06f1eb37ab6868a5769f8bc5"
14 14
15COMPATIBLE_MACHINE:genericx86 = "genericx86" 15COMPATIBLE_MACHINE:genericx86 = "genericx86"
16COMPATIBLE_MACHINE:genericx86-64 = "genericx86-64" 16COMPATIBLE_MACHINE:genericx86-64 = "genericx86-64"
17COMPATIBLE_MACHINE:edgerouter = "edgerouter" 17COMPATIBLE_MACHINE:edgerouter = "edgerouter"
18COMPATIBLE_MACHINE:beaglebone-yocto = "beaglebone-yocto" 18COMPATIBLE_MACHINE:beaglebone-yocto = "beaglebone-yocto"
19 19
20LINUX_VERSION:genericx86 = "5.10.63" 20LINUX_VERSION:genericx86 = "5.10.113"
21LINUX_VERSION:genericx86-64 = "5.10.63" 21LINUX_VERSION:genericx86-64 = "5.10.113"
22LINUX_VERSION:edgerouter = "5.10.63" 22LINUX_VERSION:edgerouter = "5.10.113"
23LINUX_VERSION:beaglebone-yocto = "5.10.63" 23LINUX_VERSION:beaglebone-yocto = "5.10.113"
diff --git a/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.14.bbappend b/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.14.bbappend
index 52371ff66a..af4a7392f0 100644
--- a/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.14.bbappend
+++ b/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.14.bbappend
@@ -7,8 +7,8 @@ KMACHINE:genericx86 ?= "common-pc"
7KMACHINE:genericx86-64 ?= "common-pc-64" 7KMACHINE:genericx86-64 ?= "common-pc-64"
8KMACHINE:beaglebone-yocto ?= "beaglebone" 8KMACHINE:beaglebone-yocto ?= "beaglebone"
9 9
10SRCREV_machine:genericx86 ?= "7ae156be3bdbf033839f7f3ec2e9a0ffffb18818" 10SRCREV_machine:genericx86 ?= "9d5572038eacda2e2a86e3f743f35ec415319fb4"
11SRCREV_machine:genericx86-64 ?= "7ae156be3bdbf033839f7f3ec2e9a0ffffb18818" 11SRCREV_machine:genericx86-64 ?= "9d5572038eacda2e2a86e3f743f35ec415319fb4"
12SRCREV_machine:edgerouter ?= "7ae156be3bdbf033839f7f3ec2e9a0ffffb18818" 12SRCREV_machine:edgerouter ?= "7ae156be3bdbf033839f7f3ec2e9a0ffffb18818"
13SRCREV_machine:beaglebone-yocto ?= "7ae156be3bdbf033839f7f3ec2e9a0ffffb18818" 13SRCREV_machine:beaglebone-yocto ?= "7ae156be3bdbf033839f7f3ec2e9a0ffffb18818"
14 14
@@ -17,7 +17,7 @@ COMPATIBLE_MACHINE:genericx86-64 = "genericx86-64"
17COMPATIBLE_MACHINE:edgerouter = "edgerouter" 17COMPATIBLE_MACHINE:edgerouter = "edgerouter"
18COMPATIBLE_MACHINE:beaglebone-yocto = "beaglebone-yocto" 18COMPATIBLE_MACHINE:beaglebone-yocto = "beaglebone-yocto"
19 19
20LINUX_VERSION:genericx86 = "5.14.6" 20LINUX_VERSION:genericx86 = "5.14.21"
21LINUX_VERSION:genericx86-64 = "5.14.6" 21LINUX_VERSION:genericx86-64 = "5.14.21"
22LINUX_VERSION:edgerouter = "5.14.6" 22LINUX_VERSION:edgerouter = "5.14.6"
23LINUX_VERSION:beaglebone-yocto = "5.14.6" 23LINUX_VERSION:beaglebone-yocto = "5.14.6"
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 340ebe7d78..070341d1aa 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -122,6 +122,10 @@ def setup_hosttools_dir(dest, toolsvar, d, fatal=True):
122 tools = d.getVar(toolsvar).split() 122 tools = d.getVar(toolsvar).split()
123 origbbenv = d.getVar("BB_ORIGENV", False) 123 origbbenv = d.getVar("BB_ORIGENV", False)
124 path = origbbenv.getVar("PATH") 124 path = origbbenv.getVar("PATH")
125 # Need to ignore our own scripts directories to avoid circular links
126 for p in path.split(":"):
127 if p.endswith("/scripts"):
128 path = path.replace(p, "/ignoreme")
125 bb.utils.mkdirhier(dest) 129 bb.utils.mkdirhier(dest)
126 notfound = [] 130 notfound = []
127 for tool in tools: 131 for tool in tools:
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 7c44fec2d1..810c4fae73 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -979,23 +979,19 @@ def write_latest_srcrev(d, pkghistdir):
979 value = value.replace('"', '').strip() 979 value = value.replace('"', '').strip()
980 old_tag_srcrevs[key] = value 980 old_tag_srcrevs[key] = value
981 with open(srcrevfile, 'w') as f: 981 with open(srcrevfile, 'w') as f:
982 orig_srcrev = d.getVar('SRCREV', False) or 'INVALID' 982 for name, srcrev in sorted(srcrevs.items()):
983 if orig_srcrev != 'INVALID': 983 suffix = "_" + name
984 f.write('# SRCREV = "%s"\n' % orig_srcrev) 984 if name == "default":
985 if len(srcrevs) > 1: 985 suffix = ""
986 for name, srcrev in sorted(srcrevs.items()): 986 orig_srcrev = d.getVar('SRCREV%s' % suffix, False)
987 orig_srcrev = d.getVar('SRCREV_%s' % name, False) 987 if orig_srcrev:
988 if orig_srcrev: 988 f.write('# SRCREV%s = "%s"\n' % (suffix, orig_srcrev))
989 f.write('# SRCREV_%s = "%s"\n' % (name, orig_srcrev)) 989 f.write('SRCREV%s = "%s"\n' % (suffix, srcrev))
990 f.write('SRCREV_%s = "%s"\n' % (name, srcrev)) 990 for name, srcrev in sorted(tag_srcrevs.items()):
991 else: 991 f.write('# tag_%s = "%s"\n' % (name, srcrev))
992 f.write('SRCREV = "%s"\n' % next(iter(srcrevs.values()))) 992 if name in old_tag_srcrevs and old_tag_srcrevs[name] != srcrev:
993 if len(tag_srcrevs) > 0: 993 pkg = d.getVar('PN')
994 for name, srcrev in sorted(tag_srcrevs.items()): 994 bb.warn("Revision for tag %s in package %s was changed since last build (from %s to %s)" % (name, pkg, old_tag_srcrevs[name], srcrev))
995 f.write('# tag_%s = "%s"\n' % (name, srcrev))
996 if name in old_tag_srcrevs and old_tag_srcrevs[name] != srcrev:
997 pkg = d.getVar('PN')
998 bb.warn("Revision for tag %s in package %s was changed since last build (from %s to %s)" % (name, pkg, old_tag_srcrevs[name], srcrev))
999 995
1000 else: 996 else:
1001 if os.path.exists(srcrevfile): 997 if os.path.exists(srcrevfile):
diff --git a/meta/classes/crate-fetch.bbclass b/meta/classes/crate-fetch.bbclass
index c0ed434a96..04d76c0de8 100644
--- a/meta/classes/crate-fetch.bbclass
+++ b/meta/classes/crate-fetch.bbclass
@@ -7,7 +7,25 @@
7# crate://<packagename>/<version> 7# crate://<packagename>/<version>
8# 8#
9 9
10python () { 10def import_crate(d):
11 import crate 11 import crate
12 bb.fetch2.methods.append( crate.Crate() ) 12 if not getattr(crate, 'imported', False):
13 bb.fetch2.methods.append(crate.Crate())
14 crate.imported = True
15
16python crate_import_handler() {
17 import_crate(d)
13} 18}
19
20addhandler crate_import_handler
21crate_import_handler[eventmask] = "bb.event.RecipePreFinalise"
22
23def crate_get_srcrev(d):
24 import_crate(d)
25 srcuri = d.getVar("SRC_URI")
26 if "crate://" not in srcuri and "git://" not in srcuri:
27 return "Invalid"
28 return bb.fetch2.get_srcrev(d)
29
30# Override SRCPV to make sure it imports the fetcher first
31SRCPV = "${@crate_get_srcrev(d)}"
diff --git a/meta/classes/cve-check.bbclass b/meta/classes/cve-check.bbclass
index 70d1988a70..60e2618bb7 100644
--- a/meta/classes/cve-check.bbclass
+++ b/meta/classes/cve-check.bbclass
@@ -143,6 +143,7 @@ python cve_check_write_rootfs_manifest () {
143 manifest_name = d.getVar("CVE_CHECK_MANIFEST") 143 manifest_name = d.getVar("CVE_CHECK_MANIFEST")
144 cve_tmp_file = d.getVar("CVE_CHECK_TMP_FILE") 144 cve_tmp_file = d.getVar("CVE_CHECK_TMP_FILE")
145 145
146 bb.utils.mkdirhier(os.path.dirname(manifest_name))
146 shutil.copyfile(cve_tmp_file, manifest_name) 147 shutil.copyfile(cve_tmp_file, manifest_name)
147 148
148 if manifest_name and os.path.exists(manifest_name): 149 if manifest_name and os.path.exists(manifest_name):
@@ -263,7 +264,8 @@ def get_cve_info(d, cves):
263 import sqlite3 264 import sqlite3
264 265
265 cve_data = {} 266 cve_data = {}
266 conn = sqlite3.connect(d.getVar("CVE_CHECK_DB_FILE")) 267 db_file = d.expand("file:${CVE_CHECK_DB_FILE}?mode=ro")
268 conn = sqlite3.connect(db_file, uri=True)
267 269
268 for cve in cves: 270 for cve in cves:
269 for row in conn.execute("SELECT * FROM NVD WHERE ID IS ?", (cve,)): 271 for row in conn.execute("SELECT * FROM NVD WHERE ID IS ?", (cve,)):
diff --git a/meta/classes/devshell.bbclass b/meta/classes/devshell.bbclass
index 76dd0b42ee..b6212ebd89 100644
--- a/meta/classes/devshell.bbclass
+++ b/meta/classes/devshell.bbclass
@@ -2,6 +2,8 @@ inherit terminal
2 2
3DEVSHELL = "${SHELL}" 3DEVSHELL = "${SHELL}"
4 4
5PATH:prepend:task-devshell = "${COREBASE}/scripts/git-intercept:"
6
5python do_devshell () { 7python do_devshell () {
6 if d.getVarFlag("do_devshell", "manualfakeroot"): 8 if d.getVarFlag("do_devshell", "manualfakeroot"):
7 d.prependVar("DEVSHELL", "pseudo ") 9 d.prependVar("DEVSHELL", "pseudo ")
diff --git a/meta/classes/devupstream.bbclass b/meta/classes/devupstream.bbclass
index facc46f3af..ba6dc4136c 100644
--- a/meta/classes/devupstream.bbclass
+++ b/meta/classes/devupstream.bbclass
@@ -30,10 +30,11 @@ python devupstream_virtclass_handler () {
30 # Develpment releases are never preferred by default 30 # Develpment releases are never preferred by default
31 d.setVar("DEFAULT_PREFERENCE", "-1") 31 d.setVar("DEFAULT_PREFERENCE", "-1")
32 32
33 uri = bb.fetch2.URI(d.getVar("SRC_URI").split()[0]) 33 src_uri = d.getVar("SRC_URI:class-devupstream") or d.getVar("SRC_URI")
34 uri = bb.fetch2.URI(src_uri.split()[0])
34 35
35 if uri.scheme == "git" and not d.getVar("S:class-devupstream"): 36 if uri.scheme == "git" and not d.getVar("S:class-devupstream"):
36 d.setVar("S:class-devupstream", "${WORKDIR}/git") 37 d.setVar("S", "${WORKDIR}/git")
37 38
38 # Modify the PV if the recipe hasn't already overridden it 39 # Modify the PV if the recipe hasn't already overridden it
39 pv = d.getVar("PV") 40 pv = d.getVar("PV")
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index ad93b2d2ab..435635f42b 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -90,15 +90,16 @@ python () {
90 # Since configure will likely touch ${S}, ensure only we lock so one task has access at a time 90 # Since configure will likely touch ${S}, ensure only we lock so one task has access at a time
91 d.appendVarFlag(task, "lockfiles", " ${S}/singletask.lock") 91 d.appendVarFlag(task, "lockfiles", " ${S}/singletask.lock")
92 92
93 # We do not want our source to be wiped out, ever (kernel.bbclass does this for do_clean) 93 for funcname in [task, "base_" + task, "kernel_" + task]:
94 cleandirs = oe.recipeutils.split_var_value(d.getVarFlag(task, 'cleandirs', False) or '') 94 # We do not want our source to be wiped out, ever (kernel.bbclass does this for do_clean)
95 setvalue = False 95 cleandirs = oe.recipeutils.split_var_value(d.getVarFlag(funcname, 'cleandirs', False) or '')
96 for cleandir in cleandirs[:]: 96 setvalue = False
97 if oe.path.is_path_parent(externalsrc, d.expand(cleandir)): 97 for cleandir in cleandirs[:]:
98 cleandirs.remove(cleandir) 98 if oe.path.is_path_parent(externalsrc, d.expand(cleandir)):
99 setvalue = True 99 cleandirs.remove(cleandir)
100 if setvalue: 100 setvalue = True
101 d.setVarFlag(task, 'cleandirs', ' '.join(cleandirs)) 101 if setvalue:
102 d.setVarFlag(funcname, 'cleandirs', ' '.join(cleandirs))
102 103
103 fetch_tasks = ['do_fetch', 'do_unpack'] 104 fetch_tasks = ['do_fetch', 'do_unpack']
104 # If we deltask do_patch, there's no dependency to ensure do_unpack gets run, so add one 105 # If we deltask do_patch, there's no dependency to ensure do_unpack gets run, so add one
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index bfaf2577d0..2c8f5338e5 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -945,7 +945,7 @@ def package_qa_check_empty_dirs(pkg, d, messages):
945 recommendation = (d.getVar('QA_EMPTY_DIRS_RECOMMENDATION:' + dir) or 945 recommendation = (d.getVar('QA_EMPTY_DIRS_RECOMMENDATION:' + dir) or
946 "but it is expected to be empty") 946 "but it is expected to be empty")
947 msg = "%s installs files in %s, %s" % (pkg, dir, recommendation) 947 msg = "%s installs files in %s, %s" % (pkg, dir, recommendation)
948 oe.qa.add_message(messages, "empty-dirs", msg) 948 package_qa_add_message(messages, "empty-dirs", msg)
949 949
950def package_qa_check_encoding(keys, encode, d): 950def package_qa_check_encoding(keys, encode, d):
951 def check_encoding(key, enc): 951 def check_encoding(key, enc):
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 45d912741d..7a34e185c7 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -145,6 +145,10 @@ def find_license_files(d):
145 find_license(node.s.replace("+", "").replace("*", "")) 145 find_license(node.s.replace("+", "").replace("*", ""))
146 self.generic_visit(node) 146 self.generic_visit(node)
147 147
148 def visit_Constant(self, node):
149 find_license(node.value.replace("+", "").replace("*", ""))
150 self.generic_visit(node)
151
148 def find_license(license_type): 152 def find_license(license_type):
149 try: 153 try:
150 bb.utils.mkdirhier(gen_lic_dest) 154 bb.utils.mkdirhier(gen_lic_dest)
diff --git a/meta/classes/license_image.bbclass b/meta/classes/license_image.bbclass
index 5490d121f1..150e8174f1 100644
--- a/meta/classes/license_image.bbclass
+++ b/meta/classes/license_image.bbclass
@@ -19,8 +19,8 @@ python write_package_manifest() {
19 19
20 pkgs = image_list_installed_packages(d) 20 pkgs = image_list_installed_packages(d)
21 output = format_pkg_list(pkgs) 21 output = format_pkg_list(pkgs)
22 open(os.path.join(license_image_dir, 'package.manifest'), 22 with open(os.path.join(license_image_dir, 'package.manifest'), "w+") as package_manifest:
23 'w+').write(output) 23 package_manifest.write(output)
24} 24}
25 25
26python license_create_manifest() { 26python license_create_manifest() {
diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
index 4ba70de3dc..a7981e481f 100644
--- a/meta/classes/meson.bbclass
+++ b/meta/classes/meson.bbclass
@@ -36,8 +36,15 @@ MESON_CROSS_FILE = ""
36MESON_CROSS_FILE:class-target = "--cross-file ${WORKDIR}/meson.cross" 36MESON_CROSS_FILE:class-target = "--cross-file ${WORKDIR}/meson.cross"
37MESON_CROSS_FILE:class-nativesdk = "--cross-file ${WORKDIR}/meson.cross" 37MESON_CROSS_FILE:class-nativesdk = "--cross-file ${WORKDIR}/meson.cross"
38 38
39def rust_tool(d, target_var):
40 rustc = d.getVar('RUSTC')
41 if not rustc:
42 return ""
43 cmd = [rustc, "--target", d.getVar(target_var)] + d.getVar("RUSTFLAGS").split()
44 return "rust = %s" % repr(cmd)
45
39addtask write_config before do_configure 46addtask write_config before do_configure
40do_write_config[vardeps] += "CC CXX LD AR NM STRIP READELF CFLAGS CXXFLAGS LDFLAGS" 47do_write_config[vardeps] += "CC CXX LD AR NM STRIP READELF CFLAGS CXXFLAGS LDFLAGS RUSTC RUSTFLAGS"
41do_write_config() { 48do_write_config() {
42 # This needs to be Py to split the args into single-element lists 49 # This needs to be Py to split the args into single-element lists
43 cat >${WORKDIR}/meson.cross <<EOF 50 cat >${WORKDIR}/meson.cross <<EOF
@@ -54,6 +61,7 @@ llvm-config = 'llvm-config${LLVMVERSION}'
54cups-config = 'cups-config' 61cups-config = 'cups-config'
55g-ir-scanner = '${STAGING_BINDIR}/g-ir-scanner-wrapper' 62g-ir-scanner = '${STAGING_BINDIR}/g-ir-scanner-wrapper'
56g-ir-compiler = '${STAGING_BINDIR}/g-ir-compiler-wrapper' 63g-ir-compiler = '${STAGING_BINDIR}/g-ir-compiler-wrapper'
64${@rust_tool(d, "HOST_SYS")}
57 65
58[built-in options] 66[built-in options]
59c_args = ${@meson_array('CFLAGS', d)} 67c_args = ${@meson_array('CFLAGS', d)}
@@ -88,6 +96,7 @@ strip = ${@meson_array('BUILD_STRIP', d)}
88readelf = ${@meson_array('BUILD_READELF', d)} 96readelf = ${@meson_array('BUILD_READELF', d)}
89objcopy = ${@meson_array('BUILD_OBJCOPY', d)} 97objcopy = ${@meson_array('BUILD_OBJCOPY', d)}
90pkgconfig = 'pkg-config-native' 98pkgconfig = 'pkg-config-native'
99${@rust_tool(d, "BUILD_SYS")}
91 100
92[built-in options] 101[built-in options]
93c_args = ${@meson_array('BUILD_CFLAGS', d)} 102c_args = ${@meson_array('BUILD_CFLAGS', d)}
diff --git a/meta/classes/qemuboot.bbclass b/meta/classes/qemuboot.bbclass
index bf529e9aa4..2bde12748d 100644
--- a/meta/classes/qemuboot.bbclass
+++ b/meta/classes/qemuboot.bbclass
@@ -29,7 +29,7 @@
29# 29#
30# QB_AUDIO_DRV: qemu audio driver, e.g., "alsa", set it when support audio 30# QB_AUDIO_DRV: qemu audio driver, e.g., "alsa", set it when support audio
31# 31#
32# QB_AUDIO_OPT: qemu audio option, e.g., "-soundhw ac97,es1370", used 32# QB_AUDIO_OPT: qemu audio option, e.g., "-device AC97", used
33# when QB_AUDIO_DRV is set. 33# when QB_AUDIO_DRV is set.
34# 34#
35# QB_RNG: Pass-through for host random number generator, it can speedup boot 35# QB_RNG: Pass-through for host random number generator, it can speedup boot
@@ -131,6 +131,8 @@ python do_write_qemuboot_conf() {
131 'qemu-helper-native/1.0-r1/recipe-sysroot-native/usr/bin/') 131 'qemu-helper-native/1.0-r1/recipe-sysroot-native/usr/bin/')
132 else: 132 else:
133 val = d.getVar(k) 133 val = d.getVar(k)
134 if val is None:
135 continue
134 # we only want to write out relative paths so that we can relocate images 136 # we only want to write out relative paths so that we can relocate images
135 # and still run them 137 # and still run them
136 if val.startswith(topdir): 138 if val.startswith(topdir):
diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass
index 7fe9e3d8c8..2310e86cdf 100644
--- a/meta/classes/rootfs-postcommands.bbclass
+++ b/meta/classes/rootfs-postcommands.bbclass
@@ -21,7 +21,7 @@ ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("IMAGE_FEATURES", "read-only
21# otherwise kernel or initramfs end up mounting the rootfs read/write 21# otherwise kernel or initramfs end up mounting the rootfs read/write
22# (the default) if supported by the underlying storage. 22# (the default) if supported by the underlying storage.
23# 23#
24# We do this with _append because the default value might get set later with ?= 24# We do this with :append because the default value might get set later with ?=
25# and we don't want to disable such a default that by setting a value here. 25# and we don't want to disable such a default that by setting a value here.
26APPEND:append = '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", " ro", "", d)}' 26APPEND:append = '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", " ro", "", d)}'
27 27
@@ -52,7 +52,7 @@ inherit image-artifact-names
52# the numeric IDs of dynamically created entries remain stable. 52# the numeric IDs of dynamically created entries remain stable.
53# 53#
54# We want this to run as late as possible, in particular after 54# We want this to run as late as possible, in particular after
55# systemd_sysusers_create and set_user_group. Using _append is not 55# systemd_sysusers_create and set_user_group. Using :append is not
56# enough for that, set_user_group is added that way and would end 56# enough for that, set_user_group is added that way and would end
57# up running after us. 57# up running after us.
58SORT_PASSWD_POSTPROCESS_COMMAND ??= " sort_passwd; " 58SORT_PASSWD_POSTPROCESS_COMMAND ??= " sort_passwd; "
@@ -62,7 +62,7 @@ python () {
62} 62}
63 63
64systemd_create_users () { 64systemd_create_users () {
65 for conffile in ${IMAGE_ROOTFS}/usr/lib/sysusers.d/systemd.conf ${IMAGE_ROOTFS}/usr/lib/sysusers.d/systemd-remote.conf; do 65 for conffile in ${IMAGE_ROOTFS}/usr/lib/sysusers.d/*.conf; do
66 [ -e $conffile ] || continue 66 [ -e $conffile ] || continue
67 grep -v "^#" $conffile | sed -e '/^$/d' | while read type name id comment; do 67 grep -v "^#" $conffile | sed -e '/^$/d' | while read type name id comment; do
68 if [ "$type" = "u" ]; then 68 if [ "$type" = "u" ]; then
@@ -78,12 +78,8 @@ systemd_create_users () {
78 eval groupadd --root ${IMAGE_ROOTFS} $groupadd_params || true 78 eval groupadd --root ${IMAGE_ROOTFS} $groupadd_params || true
79 elif [ "$type" = "m" ]; then 79 elif [ "$type" = "m" ]; then
80 group=$id 80 group=$id
81 if [ ! `grep -q "^${group}:" ${IMAGE_ROOTFS}${sysconfdir}/group` ]; then 81 eval groupadd --root ${IMAGE_ROOTFS} --system $group || true
82 eval groupadd --root ${IMAGE_ROOTFS} --system $group 82 eval useradd --root ${IMAGE_ROOTFS} --shell /sbin/nologin --system $name --no-user-group || true
83 fi
84 if [ ! `grep -q "^${name}:" ${IMAGE_ROOTFS}${sysconfdir}/passwd` ]; then
85 eval useradd --root ${IMAGE_ROOTFS} --shell /sbin/nologin --system $name
86 fi
87 eval usermod --root ${IMAGE_ROOTFS} -a -G $group $name 83 eval usermod --root ${IMAGE_ROOTFS} -a -G $group $name
88 fi 84 fi
89 done 85 done
@@ -271,9 +267,10 @@ python write_image_manifest () {
271 267
272 if os.path.exists(manifest_name) and link_name: 268 if os.path.exists(manifest_name) and link_name:
273 manifest_link = deploy_dir + "/" + link_name + ".manifest" 269 manifest_link = deploy_dir + "/" + link_name + ".manifest"
274 if os.path.lexists(manifest_link): 270 if manifest_link != manifest_name:
275 os.remove(manifest_link) 271 if os.path.lexists(manifest_link):
276 os.symlink(os.path.basename(manifest_name), manifest_link) 272 os.remove(manifest_link)
273 os.symlink(os.path.basename(manifest_name), manifest_link)
277} 274}
278 275
279# Can be used to create /etc/timestamp during image construction to give a reasonably 276# Can be used to create /etc/timestamp during image construction to give a reasonably
@@ -343,9 +340,10 @@ python write_image_test_data() {
343 340
344 if os.path.exists(testdata_name) and link_name: 341 if os.path.exists(testdata_name) and link_name:
345 testdata_link = os.path.join(deploy_dir, "%s.testdata.json" % link_name) 342 testdata_link = os.path.join(deploy_dir, "%s.testdata.json" % link_name)
346 if os.path.lexists(testdata_link): 343 if testdata_link != testdata_name:
347 os.remove(testdata_link) 344 if os.path.lexists(testdata_link):
348 os.symlink(os.path.basename(testdata_name), testdata_link) 345 os.remove(testdata_link)
346 os.symlink(os.path.basename(testdata_name), testdata_link)
349} 347}
350write_image_test_data[vardepsexclude] += "TOPDIR" 348write_image_test_data[vardepsexclude] += "TOPDIR"
351 349
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index ddba1e6e1e..a175a1104f 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -395,7 +395,7 @@ def check_connectivity(d):
395 msg += " Please ensure your host's network is configured correctly.\n" 395 msg += " Please ensure your host's network is configured correctly.\n"
396 msg += " If your ISP or network is blocking the above URL,\n" 396 msg += " If your ISP or network is blocking the above URL,\n"
397 msg += " try with another domain name, for example by setting:\n" 397 msg += " try with another domain name, for example by setting:\n"
398 msg += " CONNECTIVITY_CHECK_URIS = \"https://www.yoctoproject.org/\"" 398 msg += " CONNECTIVITY_CHECK_URIS = \"https://www.example.com/\""
399 msg += " You could also set BB_NO_NETWORK = \"1\" to disable network\n" 399 msg += " You could also set BB_NO_NETWORK = \"1\" to disable network\n"
400 msg += " access if all required sources are on local disk.\n" 400 msg += " access if all required sources are on local disk.\n"
401 retval = msg 401 retval = msg
@@ -941,6 +941,11 @@ def check_sanity_everybuild(status, d):
941 mirror_base = urllib.parse.urlparse(mirror[:-1*len('/PATH')]).path 941 mirror_base = urllib.parse.urlparse(mirror[:-1*len('/PATH')]).path
942 check_symlink(mirror_base, d) 942 check_symlink(mirror_base, d)
943 943
944 # Check sstate mirrors aren't being used with a local hash server and no remote
945 hashserv = d.getVar("BB_HASHSERVE")
946 if d.getVar("SSTATE_MIRRORS") and hashserv and hashserv.startswith("unix://") and not d.getVar("BB_HASHSERVE_UPSTREAM"):
947 bb.warn("You are using a local hash equivalence server but have configured an sstate mirror. This will likely mean no sstate will match from the mirror. You may wish to disable the hash equivalence use (BB_HASHSERVE), or use a hash equivalence server alongside the sstate mirror.")
948
944 # Check that TMPDIR hasn't changed location since the last time we were run 949 # Check that TMPDIR hasn't changed location since the last time we were run
945 tmpdir = d.getVar('TMPDIR') 950 tmpdir = d.getVar('TMPDIR')
946 checkfile = os.path.join(tmpdir, "saved_tmpdir") 951 checkfile = os.path.join(tmpdir, "saved_tmpdir")
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index ba2c9fee35..d3816ec7b0 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -788,7 +788,9 @@ def sstate_setscene(d):
788 shared_state = sstate_state_fromvars(d) 788 shared_state = sstate_state_fromvars(d)
789 accelerate = sstate_installpkg(shared_state, d) 789 accelerate = sstate_installpkg(shared_state, d)
790 if not accelerate: 790 if not accelerate:
791 bb.fatal("No suitable staging package found") 791 msg = "No sstate archive obtainable, will run full task instead."
792 bb.warn(msg)
793 raise bb.BBHandledException(msg)
792 794
793python sstate_task_prefunc () { 795python sstate_task_prefunc () {
794 shared_state = sstate_state_fromvars(d) 796 shared_state = sstate_state_fromvars(d)
@@ -852,14 +854,18 @@ sstate_create_package () {
852 fi 854 fi
853 chmod 0664 $TFILE 855 chmod 0664 $TFILE
854 # Skip if it was already created by some other process 856 # Skip if it was already created by some other process
855 if [ ! -e ${SSTATE_PKG} ]; then 857 if [ -h ${SSTATE_PKG} ] && [ ! -e ${SSTATE_PKG} ]; then
858 # There is a symbolic link, but it links to nothing.
859 # Forcefully replace it with the new file.
860 ln -f $TFILE ${SSTATE_PKG} || true
861 elif [ ! -e ${SSTATE_PKG} ]; then
856 # Move into place using ln to attempt an atomic op. 862 # Move into place using ln to attempt an atomic op.
857 # Abort if it already exists 863 # Abort if it already exists
858 ln $TFILE ${SSTATE_PKG} && rm $TFILE 864 ln $TFILE ${SSTATE_PKG} || true
859 else 865 else
860 rm $TFILE 866 touch ${SSTATE_PKG} 2>/dev/null || true
861 fi 867 fi
862 touch ${SSTATE_PKG} 2>/dev/null || true 868 rm $TFILE
863} 869}
864 870
865python sstate_sign_package () { 871python sstate_sign_package () {
@@ -889,7 +895,7 @@ python sstate_report_unihash() {
889sstate_unpack_package () { 895sstate_unpack_package () {
890 tar -xvzf ${SSTATE_PKG} 896 tar -xvzf ${SSTATE_PKG}
891 # update .siginfo atime on local/NFS mirror if it is a symbolic link 897 # update .siginfo atime on local/NFS mirror if it is a symbolic link
892 [ ! -h ${SSTATE_PKG}.siginfo ] || touch -a ${SSTATE_PKG}.siginfo 2>/dev/null || true 898 [ ! -h ${SSTATE_PKG}.siginfo ] || [ ! -e ${SSTATE_PKG}.siginfo ] || touch -a ${SSTATE_PKG}.siginfo 2>/dev/null || true
893 # update each symbolic link instead of any referenced file 899 # update each symbolic link instead of any referenced file
894 touch --no-dereference ${SSTATE_PKG} 2>/dev/null || true 900 touch --no-dereference ${SSTATE_PKG} 2>/dev/null || true
895 [ ! -e ${SSTATE_PKG}.sig ] || touch --no-dereference ${SSTATE_PKG}.sig 2>/dev/null || true 901 [ ! -e ${SSTATE_PKG}.sig ] || touch --no-dereference ${SSTATE_PKG}.sig 2>/dev/null || true
@@ -971,7 +977,7 @@ def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True,
971 977
972 localdata2 = bb.data.createCopy(localdata) 978 localdata2 = bb.data.createCopy(localdata)
973 srcuri = "file://" + sstatefile 979 srcuri = "file://" + sstatefile
974 localdata.setVar('SRC_URI', srcuri) 980 localdata2.setVar('SRC_URI', srcuri)
975 bb.debug(2, "SState: Attempting to fetch %s" % srcuri) 981 bb.debug(2, "SState: Attempting to fetch %s" % srcuri)
976 982
977 try: 983 try:
diff --git a/meta/classes/toaster.bbclass b/meta/classes/toaster.bbclass
index dd5c7f224b..f365c09142 100644
--- a/meta/classes/toaster.bbclass
+++ b/meta/classes/toaster.bbclass
@@ -101,11 +101,11 @@ def _toaster_load_pkgdatafile(dirpath, filepath):
101 for line in fin: 101 for line in fin:
102 try: 102 try:
103 kn, kv = line.strip().split(": ", 1) 103 kn, kv = line.strip().split(": ", 1)
104 m = re.match(r"^PKG_([^A-Z:]*)", kn) 104 m = re.match(r"^PKG:([^A-Z:]*)", kn)
105 if m: 105 if m:
106 pkgdata['OPKGN'] = m.group(1) 106 pkgdata['OPKGN'] = m.group(1)
107 kn = "_".join([x for x in kn.split("_") if x.isupper()]) 107 kn = kn.split(":")[0]
108 pkgdata[kn] = kv.strip() 108 pkgdata[kn] = kv
109 if kn.startswith('FILES_INFO'): 109 if kn.startswith('FILES_INFO'):
110 pkgdata[kn] = json.loads(kv) 110 pkgdata[kn] = json.loads(kv)
111 111
diff --git a/meta/classes/uboot-sign.bbclass b/meta/classes/uboot-sign.bbclass
index fdf153248c..c39b30f43b 100644
--- a/meta/classes/uboot-sign.bbclass
+++ b/meta/classes/uboot-sign.bbclass
@@ -131,6 +131,20 @@ concat_dtb_helper() {
131 elif [ -e "${DEPLOYDIR}/${UBOOT_NODTB_IMAGE}" -a -e "$deployed_uboot_dtb_binary" ]; then 131 elif [ -e "${DEPLOYDIR}/${UBOOT_NODTB_IMAGE}" -a -e "$deployed_uboot_dtb_binary" ]; then
132 cd ${DEPLOYDIR} 132 cd ${DEPLOYDIR}
133 cat ${UBOOT_NODTB_IMAGE} $deployed_uboot_dtb_binary | tee ${B}/${CONFIG_B_PATH}/${UBOOT_BINARY} > ${UBOOT_IMAGE} 133 cat ${UBOOT_NODTB_IMAGE} $deployed_uboot_dtb_binary | tee ${B}/${CONFIG_B_PATH}/${UBOOT_BINARY} > ${UBOOT_IMAGE}
134
135 if [ -n "${UBOOT_CONFIG}" ]
136 then
137 for config in ${UBOOT_MACHINE}; do
138 i=$(expr $i + 1);
139 for type in ${UBOOT_CONFIG}; do
140 j=$(expr $j + 1);
141 if [ $j -eq $i ]
142 then
143 cp ${UBOOT_IMAGE} ${B}/${CONFIG_B_PATH}/u-boot-$type.${UBOOT_SUFFIX}
144 fi
145 done
146 done
147 fi
134 else 148 else
135 bbwarn "Failure while adding public key to u-boot binary. Verified boot won't be available." 149 bbwarn "Failure while adding public key to u-boot binary. Verified boot won't be available."
136 fi 150 fi
@@ -205,7 +219,7 @@ install_helper() {
205 fi 219 fi
206} 220}
207 221
208# Install SPL dtb and u-boot nodtb to datadir, 222# Install SPL dtb and u-boot nodtb to datadir,
209install_spl_helper() { 223install_spl_helper() {
210 if [ -f "${SPL_DIR}/${SPL_DTB_BINARY}" ]; then 224 if [ -f "${SPL_DIR}/${SPL_DTB_BINARY}" ]; then
211 install -Dm 0644 ${SPL_DIR}/${SPL_DTB_BINARY} ${D}${datadir}/${SPL_DTB_IMAGE} 225 install -Dm 0644 ${SPL_DIR}/${SPL_DTB_BINARY} ${D}${datadir}/${SPL_DTB_IMAGE}
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index c2cb2f0d9d..51253003fd 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -730,10 +730,18 @@ export PKG_CONFIG_DISABLE_UNINSTALLED = "yes"
730export PKG_CONFIG_SYSTEM_LIBRARY_PATH = "${base_libdir}:${libdir}" 730export PKG_CONFIG_SYSTEM_LIBRARY_PATH = "${base_libdir}:${libdir}"
731export PKG_CONFIG_SYSTEM_INCLUDE_PATH = "${includedir}" 731export PKG_CONFIG_SYSTEM_INCLUDE_PATH = "${includedir}"
732 732
733# Git configuration
734
733# Don't allow git to chdir up past WORKDIR so that it doesn't detect the OE 735# Don't allow git to chdir up past WORKDIR so that it doesn't detect the OE
734# repository when building a recipe 736# repository when building a recipe
735export GIT_CEILING_DIRECTORIES = "${WORKDIR}" 737export GIT_CEILING_DIRECTORIES = "${WORKDIR}"
736 738
739# Treat all directories are safe, as during fakeroot tasks git will run as
740# root so recent git releases (eg 2.30.3) will refuse to work on repositories. See
741# https://github.com/git/git/commit/8959555cee7ec045958f9b6dd62e541affb7e7d9 for
742# further details.
743export GIT_CONFIG_PARAMETERS="'safe.directory=*'"
744
737### 745###
738### Config file processing 746### Config file processing
739### 747###
diff --git a/meta/conf/distro/include/cve-extra-exclusions.inc b/meta/conf/distro/include/cve-extra-exclusions.inc
index a6f52b5de7..e02a4d1fde 100644
--- a/meta/conf/distro/include/cve-extra-exclusions.inc
+++ b/meta/conf/distro/include/cve-extra-exclusions.inc
@@ -44,7 +44,14 @@ CVE_CHECK_WHITELIST += "CVE-2010-4756"
44# exposing this interface in an exploitable way 44# exposing this interface in an exploitable way
45CVE_CHECK_WHITELIST += "CVE-2020-29509 CVE-2020-29511" 45CVE_CHECK_WHITELIST += "CVE-2020-29509 CVE-2020-29511"
46 46
47 47# db
48# Since Oracle relicensed bdb, the open source community is slowly but surely replacing bdb with
49# supported and open source friendly alternatives. As a result these CVEs are unlikely to ever be fixed.
50CVE_CHECK_WHITELIST += "CVE-2015-2583 CVE-2015-2624 CVE-2015-2626 CVE-2015-2640 CVE-2015-2654 \
51CVE-2015-2656 CVE-2015-4754 CVE-2015-4764 CVE-2015-4774 CVE-2015-4775 CVE-2015-4776 CVE-2015-4777 \
52CVE-2015-4778 CVE-2015-4779 CVE-2015-4780 CVE-2015-4781 CVE-2015-4782 CVE-2015-4783 CVE-2015-4784 \
53CVE-2015-4785 CVE-2015-4786 CVE-2015-4787 CVE-2015-4788 CVE-2015-4789 CVE-2015-4790 CVE-2016-0682 \
54CVE-2016-0689 CVE-2016-0692 CVE-2016-0694 CVE-2016-3418 CVE-2020-2981"
48 55
49#### CPE update pending #### 56#### CPE update pending ####
50 57
diff --git a/meta/conf/distro/include/default-distrovars.inc b/meta/conf/distro/include/default-distrovars.inc
index fb0f1097da..3bba651a77 100644
--- a/meta/conf/distro/include/default-distrovars.inc
+++ b/meta/conf/distro/include/default-distrovars.inc
@@ -54,4 +54,4 @@ KERNEL_IMAGETYPES ??= "${KERNEL_IMAGETYPE}"
54# fetch from the network (and warn you if not). To disable the test set 54# fetch from the network (and warn you if not). To disable the test set
55# the variable to be empty. 55# the variable to be empty.
56# Git example url: git://git.yoctoproject.org/yocto-firewall-test;protocol=git;rev=master;branch=master 56# Git example url: git://git.yoctoproject.org/yocto-firewall-test;protocol=git;rev=master;branch=master
57CONNECTIVITY_CHECK_URIS ?= "https://www.example.com/" 57CONNECTIVITY_CHECK_URIS ?= "https://yoctoproject.org/connectivity.html"
diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
index 8592de5a66..2b54d2d12f 100644
--- a/meta/conf/distro/include/maintainers.inc
+++ b/meta/conf/distro/include/maintainers.inc
@@ -592,6 +592,7 @@ RECIPE_MAINTAINER:pn-python3-cython = "Oleksandr Kravchuk <open.source@oleksandr
592RECIPE_MAINTAINER:pn-python3-dbus = "Zang Ruochen <zangrc.fnst@fujitsu.com>" 592RECIPE_MAINTAINER:pn-python3-dbus = "Zang Ruochen <zangrc.fnst@fujitsu.com>"
593RECIPE_MAINTAINER:pn-python3-dbusmock = "Oleksandr Kravchuk <open.source@oleksandr-kravchuk.com>" 593RECIPE_MAINTAINER:pn-python3-dbusmock = "Oleksandr Kravchuk <open.source@oleksandr-kravchuk.com>"
594RECIPE_MAINTAINER:pn-python3-docutils = "Oleksandr Kravchuk <open.source@oleksandr-kravchuk.com>" 594RECIPE_MAINTAINER:pn-python3-docutils = "Oleksandr Kravchuk <open.source@oleksandr-kravchuk.com>"
595RECIPE_MAINTAINER:pn-python3-dtschema-wrapper = "Bruce Ashfield <bruce.ashfield@gmail.com>"
595RECIPE_MAINTAINER:pn-python3-pycryptodome = "Joshua Watt <JPEWhacker@gmail.com>" 596RECIPE_MAINTAINER:pn-python3-pycryptodome = "Joshua Watt <JPEWhacker@gmail.com>"
596RECIPE_MAINTAINER:pn-python3-pycryptodomex = "Joshua Watt <JPEWhacker@gmail.com>" 597RECIPE_MAINTAINER:pn-python3-pycryptodomex = "Joshua Watt <JPEWhacker@gmail.com>"
597RECIPE_MAINTAINER:pn-python3-extras = "Oleksandr Kravchuk <open.source@oleksandr-kravchuk.com>" 598RECIPE_MAINTAINER:pn-python3-extras = "Oleksandr Kravchuk <open.source@oleksandr-kravchuk.com>"
@@ -659,7 +660,7 @@ RECIPE_MAINTAINER:pn-ruby = "Ross Burton <ross.burton@arm.com>"
659RECIPE_MAINTAINER:pn-run-postinsts = "Ross Burton <ross.burton@arm.com>" 660RECIPE_MAINTAINER:pn-run-postinsts = "Ross Burton <ross.burton@arm.com>"
660RECIPE_MAINTAINER:pn-rust = "Randy MacLeod <Randy.MacLeod@windriver.com>" 661RECIPE_MAINTAINER:pn-rust = "Randy MacLeod <Randy.MacLeod@windriver.com>"
661RECIPE_MAINTAINER:pn-rustfmt = "Randy MacLeod <Randy.MacLeod@windriver.com>" 662RECIPE_MAINTAINER:pn-rustfmt = "Randy MacLeod <Randy.MacLeod@windriver.com>"
662RECIPE_MAINTAINER:pn-rust-cross-${TARGET_ARCH} = "Randy MacLeod <Randy.MacLeod@windriver.com>" 663RECIPE_MAINTAINER:pn-rust-cross-${TUNE_PKGARCH}-${TCLIBC} = "Randy MacLeod <Randy.MacLeod@windriver.com>"
663RECIPE_MAINTAINER:pn-rust-cross-canadian-${TRANSLATED_TARGET_ARCH} = "Randy MacLeod <Randy.MacLeod@windriver.com>" 664RECIPE_MAINTAINER:pn-rust-cross-canadian-${TRANSLATED_TARGET_ARCH} = "Randy MacLeod <Randy.MacLeod@windriver.com>"
664RECIPE_MAINTAINER:pn-rust-hello-world = "Randy MacLeod <Randy.MacLeod@windriver.com>" 665RECIPE_MAINTAINER:pn-rust-hello-world = "Randy MacLeod <Randy.MacLeod@windriver.com>"
665RECIPE_MAINTAINER:pn-rust-llvm = "Randy MacLeod <Randy.MacLeod@windriver.com>" 666RECIPE_MAINTAINER:pn-rust-llvm = "Randy MacLeod <Randy.MacLeod@windriver.com>"
diff --git a/meta/conf/distro/include/yocto-uninative.inc b/meta/conf/distro/include/yocto-uninative.inc
index 6833072cd3..411fe45a24 100644
--- a/meta/conf/distro/include/yocto-uninative.inc
+++ b/meta/conf/distro/include/yocto-uninative.inc
@@ -6,10 +6,10 @@
6# to the distro running on the build machine. 6# to the distro running on the build machine.
7# 7#
8 8
9UNINATIVE_MAXGLIBCVERSION = "2.34" 9UNINATIVE_MAXGLIBCVERSION = "2.35"
10UNINATIVE_VERSION = "3.4" 10UNINATIVE_VERSION = "3.6"
11 11
12UNINATIVE_URL ?= "http://downloads.yoctoproject.org/releases/uninative/${UNINATIVE_VERSION}/" 12UNINATIVE_URL ?= "http://downloads.yoctoproject.org/releases/uninative/${UNINATIVE_VERSION}/"
13UNINATIVE_CHECKSUM[aarch64] ?= "3013cdda8f0dc6639ce1c80f33eabce66f06b890bd5b58739a6d7a92a0bb7100" 13UNINATIVE_CHECKSUM[aarch64] ?= "d64831cf2792c8e470c2e42230660e1a8e5de56a579cdd59978791f663c2f3ed"
14UNINATIVE_CHECKSUM[i686] ?= "abed500de584aad63ec237546db20cdd0c69d8870a6f8e94ac31721ace64b376" 14UNINATIVE_CHECKSUM[i686] ?= "2f0ee9b66b1bb2c85e2b592fb3c9c7f5d77399fa638d74961330cdb8de34ca3b"
15UNINATIVE_CHECKSUM[x86_64] ?= "126f4f7f6f21084ee140dac3eb4c536b963837826b7c38599db0b512c3377ba2" 15UNINATIVE_CHECKSUM[x86_64] ?= "9bfc4c970495b3716b2f9e52c4df9f968c02463a9a95000f6657fbc3fde1f098"
diff --git a/meta/conf/machine/include/x86/qemuboot-x86.inc b/meta/conf/machine/include/x86/qemuboot-x86.inc
index d3b91070a8..b7b6428e44 100644
--- a/meta/conf/machine/include/x86/qemuboot-x86.inc
+++ b/meta/conf/machine/include/x86/qemuboot-x86.inc
@@ -8,7 +8,7 @@ QB_CPU:x86-64 = "-cpu IvyBridge -machine q35"
8QB_CPU_KVM:x86-64 = "-cpu IvyBridge -machine q35" 8QB_CPU_KVM:x86-64 = "-cpu IvyBridge -machine q35"
9 9
10QB_AUDIO_DRV = "alsa" 10QB_AUDIO_DRV = "alsa"
11QB_AUDIO_OPT = "-soundhw ac97,es1370" 11QB_AUDIO_OPT = "-device AC97"
12QB_KERNEL_CMDLINE_APPEND = "oprofile.timer=1 tsc=reliable no_timer_check rcupdate.rcu_expedited=1" 12QB_KERNEL_CMDLINE_APPEND = "oprofile.timer=1 tsc=reliable no_timer_check rcupdate.rcu_expedited=1"
13QB_OPT_APPEND = "-usb -device usb-tablet" 13QB_OPT_APPEND = "-usb -device usb-tablet"
14 14
diff --git a/meta/files/toolchain-shar-relocate.sh b/meta/files/toolchain-shar-relocate.sh
index 3ece04db0a..cee9adbf39 100644
--- a/meta/files/toolchain-shar-relocate.sh
+++ b/meta/files/toolchain-shar-relocate.sh
@@ -5,7 +5,7 @@ fi
5 5
6# fix dynamic loader paths in all ELF SDK binaries 6# fix dynamic loader paths in all ELF SDK binaries
7native_sysroot=$($SUDO_EXEC cat $env_setup_script |grep 'OECORE_NATIVE_SYSROOT='|cut -d'=' -f2|tr -d '"') 7native_sysroot=$($SUDO_EXEC cat $env_setup_script |grep 'OECORE_NATIVE_SYSROOT='|cut -d'=' -f2|tr -d '"')
8dl_path=$($SUDO_EXEC find $native_sysroot/lib -name "ld-linux*") 8dl_path=$($SUDO_EXEC find $native_sysroot/lib -maxdepth 1 -name "ld-linux*")
9if [ "$dl_path" = "" ] ; then 9if [ "$dl_path" = "" ] ; then
10 echo "SDK could not be set up. Relocate script unable to find ld-linux.so. Abort!" 10 echo "SDK could not be set up. Relocate script unable to find ld-linux.so. Abort!"
11 exit 1 11 exit 1
diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py
index 665d32ecbb..b5d378a549 100644
--- a/meta/lib/oe/license.py
+++ b/meta/lib/oe/license.py
@@ -74,6 +74,9 @@ class FlattenVisitor(LicenseVisitor):
74 def visit_Str(self, node): 74 def visit_Str(self, node):
75 self.licenses.append(node.s) 75 self.licenses.append(node.s)
76 76
77 def visit_Constant(self, node):
78 self.licenses.append(node.value)
79
77 def visit_BinOp(self, node): 80 def visit_BinOp(self, node):
78 if isinstance(node.op, ast.BitOr): 81 if isinstance(node.op, ast.BitOr):
79 left = FlattenVisitor(self.choose_licenses) 82 left = FlattenVisitor(self.choose_licenses)
@@ -227,6 +230,9 @@ class ListVisitor(LicenseVisitor):
227 def visit_Str(self, node): 230 def visit_Str(self, node):
228 self.licenses.add(node.s) 231 self.licenses.add(node.s)
229 232
233 def visit_Constant(self, node):
234 self.licenses.add(node.value)
235
230def list_licenses(licensestr): 236def list_licenses(licensestr):
231 """Simply get a list of all licenses mentioned in a license string. 237 """Simply get a list of all licenses mentioned in a license string.
232 Binary operators are not applied or taken into account in any way""" 238 Binary operators are not applied or taken into account in any way"""
diff --git a/meta/lib/oe/packagedata.py b/meta/lib/oe/packagedata.py
index 02c81e5a52..212f048bc6 100644
--- a/meta/lib/oe/packagedata.py
+++ b/meta/lib/oe/packagedata.py
@@ -19,7 +19,7 @@ def read_pkgdatafile(fn):
19 import re 19 import re
20 with open(fn, 'r') as f: 20 with open(fn, 'r') as f:
21 lines = f.readlines() 21 lines = f.readlines()
22 r = re.compile("(^.+?):\s+(.*)") 22 r = re.compile(r"(^.+?):\s+(.*)")
23 for l in lines: 23 for l in lines:
24 m = r.match(l) 24 m = r.match(l)
25 if m: 25 if m:
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
index fccbedb519..9034fcae03 100644
--- a/meta/lib/oe/patch.py
+++ b/meta/lib/oe/patch.py
@@ -4,6 +4,7 @@
4 4
5import oe.path 5import oe.path
6import oe.types 6import oe.types
7import subprocess
7 8
8class NotFoundError(bb.BBHandledException): 9class NotFoundError(bb.BBHandledException):
9 def __init__(self, path): 10 def __init__(self, path):
@@ -25,7 +26,6 @@ class CmdError(bb.BBHandledException):
25 26
26def runcmd(args, dir = None): 27def runcmd(args, dir = None):
27 import pipes 28 import pipes
28 import subprocess
29 29
30 if dir: 30 if dir:
31 olddir = os.path.abspath(os.curdir) 31 olddir = os.path.abspath(os.curdir)
@@ -56,6 +56,7 @@ def runcmd(args, dir = None):
56 if dir: 56 if dir:
57 os.chdir(olddir) 57 os.chdir(olddir)
58 58
59
59class PatchError(Exception): 60class PatchError(Exception):
60 def __init__(self, msg): 61 def __init__(self, msg):
61 self.msg = msg 62 self.msg = msg
@@ -298,6 +299,24 @@ class GitApplyTree(PatchTree):
298 PatchTree.__init__(self, dir, d) 299 PatchTree.__init__(self, dir, d)
299 self.commituser = d.getVar('PATCH_GIT_USER_NAME') 300 self.commituser = d.getVar('PATCH_GIT_USER_NAME')
300 self.commitemail = d.getVar('PATCH_GIT_USER_EMAIL') 301 self.commitemail = d.getVar('PATCH_GIT_USER_EMAIL')
302 if not self._isInitialized():
303 self._initRepo()
304
305 def _isInitialized(self):
306 cmd = "git rev-parse --show-toplevel"
307 try:
308 output = runcmd(cmd.split(), self.dir).strip()
309 except CmdError as err:
310 ## runcmd returned non-zero which most likely means 128
311 ## Not a git directory
312 return False
313 ## Make sure repo is in builddir to not break top-level git repos
314 return os.path.samefile(output, self.dir)
315
316 def _initRepo(self):
317 runcmd("git init".split(), self.dir)
318 runcmd("git add .".split(), self.dir)
319 runcmd("git commit -a --allow-empty -m bitbake_patching_started".split(), self.dir)
301 320
302 @staticmethod 321 @staticmethod
303 def extractPatchHeader(patchfile): 322 def extractPatchHeader(patchfile):
diff --git a/meta/lib/oe/reproducible.py b/meta/lib/oe/reproducible.py
index 204b9bd734..0938e4cb39 100644
--- a/meta/lib/oe/reproducible.py
+++ b/meta/lib/oe/reproducible.py
@@ -41,7 +41,7 @@ def find_git_folder(d, sourcedir):
41 for root, dirs, files in os.walk(workdir, topdown=True): 41 for root, dirs, files in os.walk(workdir, topdown=True):
42 dirs[:] = [d for d in dirs if d not in exclude] 42 dirs[:] = [d for d in dirs if d not in exclude]
43 if '.git' in dirs: 43 if '.git' in dirs:
44 return root 44 return os.path.join(root, ".git")
45 45
46 bb.warn("Failed to find a git repository in WORKDIR: %s" % workdir) 46 bb.warn("Failed to find a git repository in WORKDIR: %s" % workdir)
47 return None 47 return None
diff --git a/meta/lib/oe/sdk.py b/meta/lib/oe/sdk.py
index 37b59afd1a..27347667e8 100644
--- a/meta/lib/oe/sdk.py
+++ b/meta/lib/oe/sdk.py
@@ -115,6 +115,10 @@ def sdk_list_installed_packages(d, target, rootfs_dir=None):
115 115
116 rootfs_dir = [sdk_output, os.path.join(sdk_output, target_path)][target is True] 116 rootfs_dir = [sdk_output, os.path.join(sdk_output, target_path)][target is True]
117 117
118 if target is False:
119 ipkgconf_sdk_target = d.getVar("IPKGCONF_SDK")
120 d.setVar("IPKGCONF_TARGET", ipkgconf_sdk_target)
121
118 img_type = d.getVar('IMAGE_PKGTYPE') 122 img_type = d.getVar('IMAGE_PKGTYPE')
119 import importlib 123 import importlib
120 cls = importlib.import_module('oe.package_manager.' + img_type) 124 cls = importlib.import_module('oe.package_manager.' + img_type)
diff --git a/meta/lib/oeqa/runtime/cases/parselogs.py b/meta/lib/oeqa/runtime/cases/parselogs.py
index 50101b7851..b81acdd18a 100644
--- a/meta/lib/oeqa/runtime/cases/parselogs.py
+++ b/meta/lib/oeqa/runtime/cases/parselogs.py
@@ -303,7 +303,7 @@ class ParseLogsTest(OERuntimeTestCase):
303 grepcmd = 'grep ' 303 grepcmd = 'grep '
304 grepcmd += '-Ei "' 304 grepcmd += '-Ei "'
305 for error in errors: 305 for error in errors:
306 grepcmd += '\<' + error + '\>' + '|' 306 grepcmd += r'\<' + error + r'\>' + '|'
307 grepcmd = grepcmd[:-1] 307 grepcmd = grepcmd[:-1]
308 grepcmd += '" ' + str(log) + " | grep -Eiv \'" 308 grepcmd += '" ' + str(log) + " | grep -Eiv \'"
309 309
@@ -314,13 +314,13 @@ class ParseLogsTest(OERuntimeTestCase):
314 errorlist = ignore_errors['default'] 314 errorlist = ignore_errors['default']
315 315
316 for ignore_error in errorlist: 316 for ignore_error in errorlist:
317 ignore_error = ignore_error.replace('(', '\(') 317 ignore_error = ignore_error.replace('(', r'\(')
318 ignore_error = ignore_error.replace(')', '\)') 318 ignore_error = ignore_error.replace(')', r'\)')
319 ignore_error = ignore_error.replace("'", '.') 319 ignore_error = ignore_error.replace("'", '.')
320 ignore_error = ignore_error.replace('?', '\?') 320 ignore_error = ignore_error.replace('?', r'\?')
321 ignore_error = ignore_error.replace('[', '\[') 321 ignore_error = ignore_error.replace('[', r'\[')
322 ignore_error = ignore_error.replace(']', '\]') 322 ignore_error = ignore_error.replace(']', r'\]')
323 ignore_error = ignore_error.replace('*', '\*') 323 ignore_error = ignore_error.replace('*', r'\*')
324 ignore_error = ignore_error.replace('0-9', '[0-9]') 324 ignore_error = ignore_error.replace('0-9', '[0-9]')
325 grepcmd += ignore_error + '|' 325 grepcmd += ignore_error + '|'
326 grepcmd = grepcmd[:-1] 326 grepcmd = grepcmd[:-1]
diff --git a/meta/lib/oeqa/sdk/buildtools-cases/https.py b/meta/lib/oeqa/sdk/buildtools-cases/https.py
index 134879aab3..35e549eb40 100644
--- a/meta/lib/oeqa/sdk/buildtools-cases/https.py
+++ b/meta/lib/oeqa/sdk/buildtools-cases/https.py
@@ -13,8 +13,8 @@ class HTTPTests(OESDKTestCase):
13 """ 13 """
14 14
15 def test_wget(self): 15 def test_wget(self):
16 self._run('env -i wget --debug --output-document /dev/null https://www.example.com') 16 self._run('env -i wget --debug --output-document /dev/null https://yoctoproject.org/connectivity.html')
17 17
18 def test_python(self): 18 def test_python(self):
19 # urlopen() returns a file-like object on success and throws an exception otherwise 19 # urlopen() returns a file-like object on success and throws an exception otherwise
20 self._run('python3 -c \'import urllib.request; urllib.request.urlopen("https://www.example.com/")\'') 20 self._run('python3 -c \'import urllib.request; urllib.request.urlopen("https://yoctoproject.org/connectivity.html")\'')
diff --git a/meta/lib/oeqa/sdk/cases/buildepoxy.py b/meta/lib/oeqa/sdk/cases/buildepoxy.py
index 385f8ccca8..f69f720cd6 100644
--- a/meta/lib/oeqa/sdk/cases/buildepoxy.py
+++ b/meta/lib/oeqa/sdk/cases/buildepoxy.py
@@ -17,7 +17,7 @@ class EpoxyTest(OESDKTestCase):
17 """ 17 """
18 def setUp(self): 18 def setUp(self):
19 if not (self.tc.hasHostPackage("nativesdk-meson")): 19 if not (self.tc.hasHostPackage("nativesdk-meson")):
20 raise unittest.SkipTest("GalculatorTest class: SDK doesn't contain Meson") 20 raise unittest.SkipTest("EpoxyTest class: SDK doesn't contain Meson")
21 21
22 def test_epoxy(self): 22 def test_epoxy(self):
23 with tempfile.TemporaryDirectory(prefix="epoxy", dir=self.tc.sdk_dir) as testdir: 23 with tempfile.TemporaryDirectory(prefix="epoxy", dir=self.tc.sdk_dir) as testdir:
diff --git a/meta/lib/oeqa/selftest/cases/bbtests.py b/meta/lib/oeqa/selftest/cases/bbtests.py
index 6562364074..a08001a173 100644
--- a/meta/lib/oeqa/selftest/cases/bbtests.py
+++ b/meta/lib/oeqa/selftest/cases/bbtests.py
@@ -163,7 +163,7 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\"
163""") 163""")
164 self.track_for_cleanup(os.path.join(self.builddir, "download-selftest")) 164 self.track_for_cleanup(os.path.join(self.builddir, "download-selftest"))
165 165
166 data = 'SRC_URI = "${GNU_MIRROR}/aspell/aspell-${PV}.tar.gz;downloadfilename=test-aspell.tar.gz"' 166 data = 'SRC_URI = "https://downloads.yoctoproject.org/mirror/sources/aspell-${PV}.tar.gz;downloadfilename=test-aspell.tar.gz"'
167 self.write_recipeinc('aspell', data) 167 self.write_recipeinc('aspell', data)
168 result = bitbake('-f -c fetch aspell', ignore_status=True) 168 result = bitbake('-f -c fetch aspell', ignore_status=True)
169 self.delete_recipeinc('aspell') 169 self.delete_recipeinc('aspell')
@@ -300,3 +300,32 @@ INHERIT:remove = \"report-error\"
300 300
301 test_recipe_summary_after = get_bb_var('SUMMARY', test_recipe) 301 test_recipe_summary_after = get_bb_var('SUMMARY', test_recipe)
302 self.assertEqual(expected_recipe_summary, test_recipe_summary_after) 302 self.assertEqual(expected_recipe_summary, test_recipe_summary_after)
303
304 def test_git_patchtool(self):
305 """ PATCHTOOL=git should work with non-git sources like tarballs
306 test recipe for the test must NOT containt git:// repository in SRC_URI
307 """
308 test_recipe = "man-db"
309 self.write_recipeinc(test_recipe, 'PATCHTOOL=\"git\"')
310 src = get_bb_var("SRC_URI",test_recipe)
311 gitscm = re.search("git://", src)
312 self.assertFalse(gitscm, "test_git_patchtool pre-condition failed: {} test recipe contains git repo!".format(test_recipe))
313 result = bitbake('{} -c patch'.format(test_recipe), ignore_status=False)
314 fatal = re.search("fatal: not a git repository (or any of the parent directories)", result.output)
315 self.assertFalse(fatal, "Failed to patch using PATCHTOOL=\"git\"")
316 self.delete_recipeinc(test_recipe)
317 bitbake('-cclean {}'.format(test_recipe))
318
319 def test_git_patchtool2(self):
320 """ Test if PATCHTOOL=git works with git repo and doesn't reinitialize it
321 """
322 test_recipe = "gitrepotest"
323 src = get_bb_var("SRC_URI",test_recipe)
324 gitscm = re.search("git://", src)
325 self.assertTrue(gitscm, "test_git_patchtool pre-condition failed: {} test recipe doesn't contains git repo!".format(test_recipe))
326 result = bitbake('{} -c patch'.format(test_recipe), ignore_status=False)
327 srcdir = get_bb_var('S', test_recipe)
328 result = runCmd("git log", cwd = srcdir)
329 self.assertFalse("bitbake_patching_started" in result.output, msg = "Repository has been reinitialized. {}".format(srcdir))
330 self.delete_recipeinc(test_recipe)
331 bitbake('-cclean {}'.format(test_recipe))
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index d2b31af80e..1fe0628a44 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -442,6 +442,7 @@ class DevtoolAddTests(DevtoolBase):
442 tempdir = tempfile.mkdtemp(prefix='devtoolqa') 442 tempdir = tempfile.mkdtemp(prefix='devtoolqa')
443 self.track_for_cleanup(tempdir) 443 self.track_for_cleanup(tempdir)
444 url = 'gitsm://git.yoctoproject.org/mraa' 444 url = 'gitsm://git.yoctoproject.org/mraa'
445 url_branch = '%s;branch=master' % url
445 checkrev = 'ae127b19a50aa54255e4330ccfdd9a5d058e581d' 446 checkrev = 'ae127b19a50aa54255e4330ccfdd9a5d058e581d'
446 testrecipe = 'mraa' 447 testrecipe = 'mraa'
447 srcdir = os.path.join(tempdir, testrecipe) 448 srcdir = os.path.join(tempdir, testrecipe)
@@ -462,7 +463,7 @@ class DevtoolAddTests(DevtoolBase):
462 checkvars = {} 463 checkvars = {}
463 checkvars['S'] = '${WORKDIR}/git' 464 checkvars['S'] = '${WORKDIR}/git'
464 checkvars['PV'] = '1.0+git${SRCPV}' 465 checkvars['PV'] = '1.0+git${SRCPV}'
465 checkvars['SRC_URI'] = url 466 checkvars['SRC_URI'] = url_branch
466 checkvars['SRCREV'] = '${AUTOREV}' 467 checkvars['SRCREV'] = '${AUTOREV}'
467 self._test_recipe_contents(recipefile, checkvars, []) 468 self._test_recipe_contents(recipefile, checkvars, [])
468 # Try with revision and version specified 469 # Try with revision and version specified
@@ -481,7 +482,7 @@ class DevtoolAddTests(DevtoolBase):
481 checkvars = {} 482 checkvars = {}
482 checkvars['S'] = '${WORKDIR}/git' 483 checkvars['S'] = '${WORKDIR}/git'
483 checkvars['PV'] = '1.5+git${SRCPV}' 484 checkvars['PV'] = '1.5+git${SRCPV}'
484 checkvars['SRC_URI'] = url 485 checkvars['SRC_URI'] = url_branch
485 checkvars['SRCREV'] = checkrev 486 checkvars['SRCREV'] = checkrev
486 self._test_recipe_contents(recipefile, checkvars, []) 487 self._test_recipe_contents(recipefile, checkvars, [])
487 488
@@ -1463,6 +1464,14 @@ class DevtoolExtractTests(DevtoolBase):
1463 1464
1464class DevtoolUpgradeTests(DevtoolBase): 1465class DevtoolUpgradeTests(DevtoolBase):
1465 1466
1467 def setUp(self):
1468 super().setUp()
1469 try:
1470 runCmd("git config --global user.name")
1471 runCmd("git config --global user.email")
1472 except:
1473 self.skip("Git user.name and user.email must be set")
1474
1466 def test_devtool_upgrade(self): 1475 def test_devtool_upgrade(self):
1467 # Check preconditions 1476 # Check preconditions
1468 self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory') 1477 self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory')
diff --git a/meta/lib/oeqa/selftest/cases/git.py b/meta/lib/oeqa/selftest/cases/git.py
new file mode 100644
index 0000000000..f12874dc7d
--- /dev/null
+++ b/meta/lib/oeqa/selftest/cases/git.py
@@ -0,0 +1,15 @@
1from oeqa.selftest.case import OESelftestTestCase
2from oeqa.utils.commands import bitbake
3
4class GitCheck(OESelftestTestCase):
5 def test_git_intercept(self):
6 """
7 Git binaries with CVE-2022-24765 fixed will refuse to operate on a
8 repository which is owned by a different user. This breaks our
9 do_install task as that runs inside pseudo, so the git repository is
10 owned by the build user but git is running as (fake)root.
11
12 We have an intercept which disables pseudo, so verify that it works.
13 """
14 bitbake("git-submodule-test -c test_git_as_user")
15 bitbake("git-submodule-test -c test_git_as_root")
diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py
index 8dc00ac10e..814a03191b 100644
--- a/meta/lib/oeqa/selftest/cases/recipetool.py
+++ b/meta/lib/oeqa/selftest/cases/recipetool.py
@@ -375,7 +375,7 @@ class RecipetoolTests(RecipetoolBase):
375 temprecipe = os.path.join(self.tempdir, 'recipe') 375 temprecipe = os.path.join(self.tempdir, 'recipe')
376 os.makedirs(temprecipe) 376 os.makedirs(temprecipe)
377 pv = '1.7.4.1' 377 pv = '1.7.4.1'
378 srcuri = 'http://www.dest-unreach.org/socat/download/socat-%s.tar.bz2' % pv 378 srcuri = 'http://www.dest-unreach.org/socat/download/Archive/socat-%s.tar.bz2' % pv
379 result = runCmd('recipetool create %s -o %s' % (srcuri, temprecipe)) 379 result = runCmd('recipetool create %s -o %s' % (srcuri, temprecipe))
380 dirlist = os.listdir(temprecipe) 380 dirlist = os.listdir(temprecipe)
381 if len(dirlist) > 1: 381 if len(dirlist) > 1:
diff --git a/meta/lib/oeqa/selftest/cases/sstatetests.py b/meta/lib/oeqa/selftest/cases/sstatetests.py
index 7e0ed0dac1..4b8669e9d3 100644
--- a/meta/lib/oeqa/selftest/cases/sstatetests.py
+++ b/meta/lib/oeqa/selftest/cases/sstatetests.py
@@ -347,7 +347,7 @@ TCLIBCAPPEND = \"\"
347MACHINE = \"qemuarm\" 347MACHINE = \"qemuarm\"
348BB_SIGNATURE_HANDLER = "OEBasicHash" 348BB_SIGNATURE_HANDLER = "OEBasicHash"
349""" 349"""
350 self.sstate_allarch_samesigs(configA, configB) 350 self.sstate_common_samesigs(configA, configB, allarch=True)
351 351
352 def test_sstate_nativesdk_samesigs_multilib(self): 352 def test_sstate_nativesdk_samesigs_multilib(self):
353 """ 353 """
@@ -371,9 +371,9 @@ require conf/multilib.conf
371MULTILIBS = \"\" 371MULTILIBS = \"\"
372BB_SIGNATURE_HANDLER = "OEBasicHash" 372BB_SIGNATURE_HANDLER = "OEBasicHash"
373""" 373"""
374 self.sstate_allarch_samesigs(configA, configB) 374 self.sstate_common_samesigs(configA, configB)
375 375
376 def sstate_allarch_samesigs(self, configA, configB): 376 def sstate_common_samesigs(self, configA, configB, allarch=False):
377 377
378 self.write_config(configA) 378 self.write_config(configA)
379 self.track_for_cleanup(self.topdir + "/tmp-sstatesamehash") 379 self.track_for_cleanup(self.topdir + "/tmp-sstatesamehash")
@@ -401,6 +401,13 @@ BB_SIGNATURE_HANDLER = "OEBasicHash"
401 self.maxDiff = None 401 self.maxDiff = None
402 self.assertEqual(files1, files2) 402 self.assertEqual(files1, files2)
403 403
404 if allarch:
405 allarchdir = os.path.basename(glob.glob(self.topdir + "/tmp-sstatesamehash/stamps/all-*-linux")[0])
406
407 files1 = get_files(self.topdir + "/tmp-sstatesamehash/stamps/" + allarchdir)
408 files2 = get_files(self.topdir + "/tmp-sstatesamehash2/stamps/" + allarchdir)
409 self.assertEqual(files1, files2)
410
404 def test_sstate_sametune_samesigs(self): 411 def test_sstate_sametune_samesigs(self):
405 """ 412 """
406 The sstate checksums of two identical machines (using the same tune) should be the 413 The sstate checksums of two identical machines (using the same tune) should be the
diff --git a/meta/lib/oeqa/utils/dump.py b/meta/lib/oeqa/utils/dump.py
index bb067f4846..dc8757807e 100644
--- a/meta/lib/oeqa/utils/dump.py
+++ b/meta/lib/oeqa/utils/dump.py
@@ -134,4 +134,4 @@ class MonitorDumper(BaseDumper):
134 output = self.runner.run_monitor(cmd_name) 134 output = self.runner.run_monitor(cmd_name)
135 self._write_dump(cmd_name, output) 135 self._write_dump(cmd_name, output)
136 except Exception as e: 136 except Exception as e:
137 print("Failed to dump QMP CMD: %s with\nExecption: %s" % (cmd_name, e)) 137 print("Failed to dump QMP CMD: %s with\nException: %s" % (cmd_name, e))
diff --git a/meta/recipes-bsp/grub/files/CVE-2021-3981-grub-mkconfig-Restore-umask-for-the-grub.cfg.patch b/meta/recipes-bsp/grub/files/CVE-2021-3981-grub-mkconfig-Restore-umask-for-the-grub.cfg.patch
new file mode 100644
index 0000000000..dae26fd8bb
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/CVE-2021-3981-grub-mkconfig-Restore-umask-for-the-grub.cfg.patch
@@ -0,0 +1,49 @@
1From 0adec29674561034771c13e446069b41ef41e4d4 Mon Sep 17 00:00:00 2001
2From: Michael Chang <mchang@suse.com>
3Date: Fri, 3 Dec 2021 16:13:28 +0800
4Subject: [PATCH] grub-mkconfig: Restore umask for the grub.cfg
5
6The commit ab2e53c8a (grub-mkconfig: Honor a symlink when generating
7configuration by grub-mkconfig) has inadvertently discarded umask for
8creating grub.cfg in the process of running grub-mkconfig. The resulting
9wrong permission (0644) would allow unprivileged users to read GRUB
10configuration file content. This presents a low confidentiality risk
11as grub.cfg may contain non-secured plain-text passwords.
12
13This patch restores the missing umask and sets the creation file mode
14to 0600 preventing unprivileged access.
15
16Fixes: CVE-2021-3981
17
18Signed-off-by: Michael Chang <mchang@suse.com>
19Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
20
21Upstream-Status: Backport
22CVE: CVE-2021-3981
23
24Reference to upstream patch:
25https://git.savannah.gnu.org/cgit/grub.git/commit/?id=0adec29674561034771c13e446069b41ef41e4d4
26
27Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com>
28---
29 util/grub-mkconfig.in | 3 +++
30 1 file changed, 3 insertions(+)
31
32diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
33index c3ea7612e..62335d027 100644
34--- a/util/grub-mkconfig.in
35+++ b/util/grub-mkconfig.in
36@@ -301,7 +301,10 @@ and /etc/grub.d/* files or please file a bug report with
37 exit 1
38 else
39 # none of the children aborted with error, install the new grub.cfg
40+ oldumask=$(umask)
41+ umask 077
42 cat ${grub_cfg}.new > ${grub_cfg}
43+ umask $oldumask
44 rm -f ${grub_cfg}.new
45 fi
46 fi
47--
482.31.1
49
diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc
index bb791347dc..bdb3e2d999 100644
--- a/meta/recipes-bsp/grub/grub2.inc
+++ b/meta/recipes-bsp/grub/grub2.inc
@@ -20,12 +20,15 @@ SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \
20 file://0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch \ 20 file://0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch \
21 file://determinism.patch \ 21 file://determinism.patch \
22 file://0001-RISC-V-Restore-the-typcast-to-long.patch \ 22 file://0001-RISC-V-Restore-the-typcast-to-long.patch \
23 file://CVE-2021-3981-grub-mkconfig-Restore-umask-for-the-grub.cfg.patch \
23" 24"
24 25
25SRC_URI[sha256sum] = "23b64b4c741569f9426ed2e3d0e6780796fca081bee4c99f62aa3f53ae803f5f" 26SRC_URI[sha256sum] = "23b64b4c741569f9426ed2e3d0e6780796fca081bee4c99f62aa3f53ae803f5f"
26 27
27# Applies only to RHEL 28# Applies only to RHEL
28CVE_CHECK_WHITELIST += "CVE-2019-14865" 29CVE_CHECK_WHITELIST += "CVE-2019-14865"
30# Applies only to SUSE
31CVE_CHECK_WHITELIST += "CVE-2021-46705"
29 32
30DEPENDS = "flex-native bison-native gettext-native" 33DEPENDS = "flex-native bison-native gettext-native"
31 34
diff --git a/meta/recipes-bsp/u-boot/u-boot-common.inc b/meta/recipes-bsp/u-boot/u-boot-common.inc
index 2423e9ca14..9af65e6b27 100644
--- a/meta/recipes-bsp/u-boot/u-boot-common.inc
+++ b/meta/recipes-bsp/u-boot/u-boot-common.inc
@@ -19,4 +19,7 @@ SRC_URI = "git://git.denx.de/u-boot.git;branch=master \
19 19
20S = "${WORKDIR}/git" 20S = "${WORKDIR}/git"
21B = "${WORKDIR}/build" 21B = "${WORKDIR}/build"
22
23inherit pkgconfig
24
22do_configure[cleandirs] = "${B}" 25do_configure[cleandirs] = "${B}"
diff --git a/meta/recipes-connectivity/bind/bind-9.16.20/CVE-2021-25219-1.patch b/meta/recipes-connectivity/bind/bind-9.16.20/CVE-2021-25219-1.patch
new file mode 100644
index 0000000000..f63c333264
--- /dev/null
+++ b/meta/recipes-connectivity/bind/bind-9.16.20/CVE-2021-25219-1.patch
@@ -0,0 +1,76 @@
1From 011e9418ce9bb25675de6ac8d47536efedeeb312 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= <ondrej@sury.org>
3Date: Fri, 24 Sep 2021 09:35:11 +0200
4Subject: [PATCH] Disable lame-ttl cache
5
6The lame-ttl cache is implemented in ADB as per-server locked
7linked-list "indexed" with <qname,qtype>. This list has to be walked
8every time there's a new query or new record added into the lame cache.
9Determined attacker can use this to degrade performance of the resolver.
10
11Resolver testing has shown that disabling the lame cache has little
12impact on the resolver performance and it's a minimal viable defense
13against this kind of attack.
14
15CVE: CVE-2021-25219
16
17Upstream-Status: Backport [https://gitlab.isc.org/isc-projects/bind9/-/commit/8fe18c0566c41228a568157287f5a44f96d37662]
18
19Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
20---
21 bin/named/config.c | 2 +-
22 bin/named/server.c | 7 +++++--
23 doc/arm/reference.rst | 6 +++---
24 3 files changed, 9 insertions(+), 6 deletions(-)
25
26diff --git a/bin/named/config.c b/bin/named/config.c
27index fa8473db7c..b6453b814e 100644
28--- a/bin/named/config.c
29+++ b/bin/named/config.c
30@@ -151,7 +151,7 @@ options {\n\
31 fetches-per-server 0;\n\
32 fetches-per-zone 0;\n\
33 glue-cache yes;\n\
34- lame-ttl 600;\n"
35+ lame-ttl 0;\n"
36 #ifdef HAVE_LMDB
37 " lmdb-mapsize 32M;\n"
38 #endif /* ifdef HAVE_LMDB */
39diff --git a/bin/named/server.c b/bin/named/server.c
40index 638703e8c2..35ad6a0b7f 100644
41--- a/bin/named/server.c
42+++ b/bin/named/server.c
43@@ -4806,8 +4806,11 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
44 result = named_config_get(maps, "lame-ttl", &obj);
45 INSIST(result == ISC_R_SUCCESS);
46 lame_ttl = cfg_obj_asduration(obj);
47- if (lame_ttl > 1800) {
48- lame_ttl = 1800;
49+ if (lame_ttl > 0) {
50+ cfg_obj_log(obj, named_g_lctx, ISC_LOG_WARNING,
51+ "disabling lame cache despite lame-ttl > 0 as it "
52+ "may cause performance issues");
53+ lame_ttl = 0;
54 }
55 dns_resolver_setlamettl(view->resolver, lame_ttl);
56
57diff --git a/doc/arm/reference.rst b/doc/arm/reference.rst
58index 3bc4439745..fea854f3d1 100644
59--- a/doc/arm/reference.rst
60+++ b/doc/arm/reference.rst
61@@ -3358,9 +3358,9 @@ Tuning
62 ^^^^^^
63
64 ``lame-ttl``
65- This sets the number of seconds to cache a lame server indication. 0
66- disables caching. (This is **NOT** recommended.) The default is
67- ``600`` (10 minutes) and the maximum value is ``1800`` (30 minutes).
68+ This is always set to 0. More information is available in the
69+ `security advisory for CVE-2021-25219
70+ <https://kb.isc.org/docs/cve-2021-25219>`_.
71
72 ``servfail-ttl``
73 This sets the number of seconds to cache a SERVFAIL response due to DNSSEC
74--
752.17.1
76
diff --git a/meta/recipes-connectivity/bind/bind-9.16.20/CVE-2021-25219-2.patch b/meta/recipes-connectivity/bind/bind-9.16.20/CVE-2021-25219-2.patch
new file mode 100644
index 0000000000..1217f7f186
--- /dev/null
+++ b/meta/recipes-connectivity/bind/bind-9.16.20/CVE-2021-25219-2.patch
@@ -0,0 +1,65 @@
1From 117cf776a7add27ac6d236b4062258da0d068486 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= <ondrej@sury.org>
3Date: Mon, 15 Nov 2021 16:26:52 +0800
4Subject: [PATCH] Enable lame response detection even with disabled lame cache
5
6Previously, when lame cache would be disabled by setting lame-ttl to 0,
7it would also disable lame answer detection. In this commit, we enable
8the lame response detection even when the lame cache is disabled. This
9enables stopping answer processing early rather than going through the
10whole answer processing flow.
11
12CVE: CVE-2021-25219
13
14Upstream-Status: Backport [https://gitlab.isc.org/isc-projects/bind9/-/commit/e4931584a34bdd0a0d18e4d918fb853bf5296787]
15
16Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
17---
18 lib/dns/resolver.c | 23 ++++++++++++-----------
19 1 file changed, 12 insertions(+), 11 deletions(-)
20
21diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c
22index 50fadc0..9291bd4 100644
23--- a/lib/dns/resolver.c
24+++ b/lib/dns/resolver.c
25@@ -10217,25 +10217,26 @@ rctx_badserver(respctx_t *rctx, isc_result_t result) {
26 */
27 static isc_result_t
28 rctx_lameserver(respctx_t *rctx) {
29- isc_result_t result;
30+ isc_result_t result = ISC_R_SUCCESS;
31 fetchctx_t *fctx = rctx->fctx;
32 resquery_t *query = rctx->query;
33
34- if (fctx->res->lame_ttl == 0 || ISFORWARDER(query->addrinfo) ||
35- !is_lame(fctx, query->rmessage))
36- {
37+ if (ISFORWARDER(query->addrinfo) || !is_lame(fctx, query->rmessage)) {
38 return (ISC_R_SUCCESS);
39 }
40
41 inc_stats(fctx->res, dns_resstatscounter_lame);
42 log_lame(fctx, query->addrinfo);
43- result = dns_adb_marklame(fctx->adb, query->addrinfo, &fctx->name,
44- fctx->type, rctx->now + fctx->res->lame_ttl);
45- if (result != ISC_R_SUCCESS) {
46- isc_log_write(dns_lctx, DNS_LOGCATEGORY_RESOLVER,
47- DNS_LOGMODULE_RESOLVER, ISC_LOG_ERROR,
48- "could not mark server as lame: %s",
49- isc_result_totext(result));
50+ if (fctx->res->lame_ttl != 0) {
51+ result = dns_adb_marklame(fctx->adb, query->addrinfo,
52+ &fctx->name, fctx->type,
53+ rctx->now + fctx->res->lame_ttl);
54+ if (result != ISC_R_SUCCESS) {
55+ isc_log_write(dns_lctx, DNS_LOGCATEGORY_RESOLVER,
56+ DNS_LOGMODULE_RESOLVER, ISC_LOG_ERROR,
57+ "could not mark server as lame: %s",
58+ isc_result_totext(result));
59+ }
60 }
61 rctx->broken_server = DNS_R_LAME;
62 rctx->next_server = true;
63--
642.17.1
65
diff --git a/meta/recipes-connectivity/bind/bind_9.16.20.bb b/meta/recipes-connectivity/bind/bind_9.16.20.bb
index ddf323fb9c..0ba0a46b15 100644
--- a/meta/recipes-connectivity/bind/bind_9.16.20.bb
+++ b/meta/recipes-connectivity/bind/bind_9.16.20.bb
@@ -18,6 +18,8 @@ SRC_URI = "https://ftp.isc.org/isc/bind9/${PV}/${BPN}-${PV}.tar.xz \
18 file://bind-ensure-searching-for-json-headers-searches-sysr.patch \ 18 file://bind-ensure-searching-for-json-headers-searches-sysr.patch \
19 file://0001-named-lwresd-V-and-start-log-hide-build-options.patch \ 19 file://0001-named-lwresd-V-and-start-log-hide-build-options.patch \
20 file://0001-avoid-start-failure-with-bind-user.patch \ 20 file://0001-avoid-start-failure-with-bind-user.patch \
21 file://CVE-2021-25219-1.patch \
22 file://CVE-2021-25219-2.patch \
21 " 23 "
22 24
23SRC_URI[sha256sum] = "4d0d93c0d0b63080609e84625f24ff8777f8d164e78a75b1c19c334ce42d5b58" 25SRC_URI[sha256sum] = "4d0d93c0d0b63080609e84625f24ff8777f8d164e78a75b1c19c334ce42d5b58"
diff --git a/meta/recipes-connectivity/libpcap/libpcap_1.10.1.bb b/meta/recipes-connectivity/libpcap/libpcap_1.10.1.bb
index 9a8c46e0ef..dbe2fd8157 100644
--- a/meta/recipes-connectivity/libpcap/libpcap_1.10.1.bb
+++ b/meta/recipes-connectivity/libpcap/libpcap_1.10.1.bb
@@ -19,10 +19,11 @@ BINCONFIG = "${bindir}/pcap-config"
19 19
20# Explicitly disable dag support. We don't have recipe for it and if enabled here, 20# Explicitly disable dag support. We don't have recipe for it and if enabled here,
21# configure script poisons the include dirs with /usr/local/include even when the 21# configure script poisons the include dirs with /usr/local/include even when the
22# support hasn't been detected. 22# support hasn't been detected. Do the same thing for DPDK.
23EXTRA_OECONF = " \ 23EXTRA_OECONF = " \
24 --with-pcap=linux \ 24 --with-pcap=linux \
25 --without-dag \ 25 --without-dag \
26 --without-dpdk \
26 " 27 "
27EXTRA_AUTORECONF += "--exclude=aclocal" 28EXTRA_AUTORECONF += "--exclude=aclocal"
28 29
diff --git a/meta/recipes-connectivity/neard/neard_0.16.bb b/meta/recipes-connectivity/neard/neard_0.16.bb
index b6cc1d6ced..936b3c5754 100644
--- a/meta/recipes-connectivity/neard/neard_0.16.bb
+++ b/meta/recipes-connectivity/neard/neard_0.16.bb
@@ -2,21 +2,22 @@ SUMMARY = "Linux NFC daemon"
2DESCRIPTION = "A daemon for the Linux Near Field Communication stack" 2DESCRIPTION = "A daemon for the Linux Near Field Communication stack"
3HOMEPAGE = "http://01.org/linux-nfc" 3HOMEPAGE = "http://01.org/linux-nfc"
4LICENSE = "GPLv2" 4LICENSE = "GPLv2"
5LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \
6 file://src/near.h;beginline=1;endline=20;md5=358e4deefef251a4761e1ffacc965d13 \
7 "
5 8
6DEPENDS = "dbus glib-2.0 libnl" 9DEPENDS = "dbus glib-2.0 libnl"
7 10
8SRC_URI = "${KERNELORG_MIRROR}/linux/network/nfc/${BP}.tar.xz \ 11SRC_URI = "git://git.kernel.org/pub/scm/network/nfc/neard.git;protocol=git;branch=master \
9 file://neard.in \ 12 file://neard.in \
10 file://Makefile.am-fix-parallel-issue.patch \ 13 file://Makefile.am-fix-parallel-issue.patch \
11 file://Makefile.am-do-not-ship-version.h.patch \ 14 file://Makefile.am-do-not-ship-version.h.patch \
12 file://0001-Add-header-dependency-to-nciattach.o.patch \ 15 file://0001-Add-header-dependency-to-nciattach.o.patch \
13 " 16 "
14SRC_URI[md5sum] = "5c691fb7872856dc0d909c298bc8cb41"
15SRC_URI[sha256sum] = "eae3b11c541a988ec11ca94b7deab01080cd5b58cfef3ced6ceac9b6e6e65b36"
16 17
17LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \ 18SRCREV = "949795024f7625420e93e288c56e194cb9a3e74a"
18 file://src/near.h;beginline=1;endline=20;md5=358e4deefef251a4761e1ffacc965d13 \ 19
19 " 20S = "${WORKDIR}/git"
20 21
21inherit autotools pkgconfig systemd update-rc.d 22inherit autotools pkgconfig systemd update-rc.d
22 23
diff --git a/meta/recipes-connectivity/openssh/openssh/CVE-2021-41617.patch b/meta/recipes-connectivity/openssh/openssh/CVE-2021-41617.patch
new file mode 100644
index 0000000000..bebde7f26d
--- /dev/null
+++ b/meta/recipes-connectivity/openssh/openssh/CVE-2021-41617.patch
@@ -0,0 +1,48 @@
1From 1f0707e8e78ef290fd0f229df3fcd2236f29db89 Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Thu, 28 Oct 2021 11:11:05 +0800
4Subject: [PATCH] upstream: need initgroups() before setresgid(); reported by
5 anton@,
6
7ok deraadt@
8
9OpenBSD-Commit-ID: 6aa003ee658b316960d94078f2a16edbc25087ce
10
11CVE: CVE-2021-41617
12Upstream-Status: Backport [https://github.com/openssh/openssh-portable/commit/f3cbe43e28fe71427d41cfe3a17125b972710455
13https://github.com/openssh/openssh-portable/commit/bf944e3794eff5413f2df1ef37cddf96918c6bde]
14
15Signed-off-by: Changqing Li <changqing.li@windriver.com>
16---
17 misc.c | 8 ++++++++
18 1 file changed, 8 insertions(+)
19
20diff --git a/misc.c b/misc.c
21index d988ce3..33eca1c 100644
22--- a/misc.c
23+++ b/misc.c
24@@ -56,6 +56,7 @@
25 #ifdef HAVE_PATHS_H
26 # include <paths.h>
27 #include <pwd.h>
28+#include <grp.h>
29 #endif
30 #ifdef SSH_TUN_OPENBSD
31 #include <net/if.h>
32@@ -2629,6 +2630,13 @@ subprocess(const char *tag, const char *command,
33 }
34 closefrom(STDERR_FILENO + 1);
35
36+ if (geteuid() == 0 &&
37+ initgroups(pw->pw_name, pw->pw_gid) == -1) {
38+ error("%s: initgroups(%s, %u): %s", tag,
39+ pw->pw_name, (u_int)pw->pw_gid, strerror(errno));
40+ _exit(1);
41+ }
42+
43 if (setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) == -1) {
44 error("%s: setresgid %u: %s", tag, (u_int)pw->pw_gid,
45 strerror(errno));
46--
472.17.1
48
diff --git a/meta/recipes-connectivity/openssh/openssh_8.7p1.bb b/meta/recipes-connectivity/openssh/openssh_8.7p1.bb
index 07cd6b74cd..d19833e56f 100644
--- a/meta/recipes-connectivity/openssh/openssh_8.7p1.bb
+++ b/meta/recipes-connectivity/openssh/openssh_8.7p1.bb
@@ -24,6 +24,7 @@ SRC_URI = "http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.tar
24 file://fix-potential-signed-overflow-in-pointer-arithmatic.patch \ 24 file://fix-potential-signed-overflow-in-pointer-arithmatic.patch \
25 file://sshd_check_keys \ 25 file://sshd_check_keys \
26 file://add-test-support-for-busybox.patch \ 26 file://add-test-support-for-busybox.patch \
27 file://CVE-2021-41617.patch \
27 " 28 "
28SRC_URI[sha256sum] = "7ca34b8bb24ae9e50f33792b7091b3841d7e1b440ff57bc9fabddf01e2ed1e24" 29SRC_URI[sha256sum] = "7ca34b8bb24ae9e50f33792b7091b3841d7e1b440ff57bc9fabddf01e2ed1e24"
29 30
diff --git a/meta/recipes-connectivity/openssl/openssl/reproducibility.patch b/meta/recipes-connectivity/openssl/openssl/reproducibility.patch
new file mode 100644
index 0000000000..8accbc9df2
--- /dev/null
+++ b/meta/recipes-connectivity/openssl/openssl/reproducibility.patch
@@ -0,0 +1,22 @@
1Using localtime() means the output can depend on the timezone of the build machine.
2Using gmtime() is safer. For complete reproducibility use SOURCE_DATE_EPOCH if set.
3
4Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
5Upstream-Status: Pending [should be suitable]
6
7Index: openssl-3.0.1/apps/progs.pl
8===================================================================
9--- openssl-3.0.1.orig/apps/progs.pl
10+++ openssl-3.0.1/apps/progs.pl
11@@ -21,7 +21,10 @@ die "Unrecognised option, must be -C or
12 my %commands = ();
13 my $cmdre = qr/^\s*int\s+([a-z_][a-z0-9_]*)_main\(\s*int\s+argc\s*,/;
14 my $apps_openssl = shift @ARGV;
15-my $YEAR = [localtime()]->[5] + 1900;
16+my $YEAR = [gmtime()]->[5] + 1900;
17+if (defined($ENV{SOURCE_DATE_EPOCH}) && $ENV{SOURCE_DATE_EPOCH} !~ /\D/) {
18+ $YEAR = [gmtime($ENV{SOURCE_DATE_EPOCH})]->[5] + 1900;
19+}
20
21 # because the program apps/openssl has object files as sources, and
22 # they then have the corresponding C files as source, we need to chain
diff --git a/meta/recipes-connectivity/openssl/openssl_1.1.1l.bb b/meta/recipes-connectivity/openssl/openssl_1.1.1o.bb
index b241ba78bc..d6386c33a9 100644
--- a/meta/recipes-connectivity/openssl/openssl_1.1.1l.bb
+++ b/meta/recipes-connectivity/openssl/openssl_1.1.1o.bb
@@ -17,6 +17,7 @@ SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
17 file://0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch \ 17 file://0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch \
18 file://afalg.patch \ 18 file://afalg.patch \
19 file://reproducible.patch \ 19 file://reproducible.patch \
20 file://reproducibility.patch \
20 " 21 "
21 22
22SRC_URI:append:class-nativesdk = " \ 23SRC_URI:append:class-nativesdk = " \
@@ -28,7 +29,7 @@ SRC_URI:append:riscv32 = " \
28 file://0004-Fixup-support-for-io_pgetevents_time64-syscall.patch \ 29 file://0004-Fixup-support-for-io_pgetevents_time64-syscall.patch \
29 " 30 "
30 31
31SRC_URI[sha256sum] = "0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1" 32SRC_URI[sha256sum] = "9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f"
32 33
33inherit lib_package multilib_header multilib_script ptest 34inherit lib_package multilib_header multilib_script ptest
34MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash" 35MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash"
@@ -203,6 +204,7 @@ do_install_ptest () {
203 install -m755 ${B}/apps/CA.pl ${D}${PTEST_PATH}/apps 204 install -m755 ${B}/apps/CA.pl ${D}${PTEST_PATH}/apps
204 205
205 install -d ${D}${PTEST_PATH}/engines 206 install -d ${D}${PTEST_PATH}/engines
207 install -m755 ${B}/engines/dasync.so ${D}${PTEST_PATH}/engines
206 install -m755 ${B}/engines/ossltest.so ${D}${PTEST_PATH}/engines 208 install -m755 ${B}/engines/ossltest.so ${D}${PTEST_PATH}/engines
207 209
208 # seems to be needed with perl 5.32.1 210 # seems to be needed with perl 5.32.1
diff --git a/meta/recipes-connectivity/socat/socat_1.7.4.1.bb b/meta/recipes-connectivity/socat/socat_1.7.4.1.bb
index 1ad5f15b93..41c8552f25 100644
--- a/meta/recipes-connectivity/socat/socat_1.7.4.1.bb
+++ b/meta/recipes-connectivity/socat/socat_1.7.4.1.bb
@@ -9,7 +9,7 @@ LICENSE = "GPL-2.0-with-OpenSSL-exception"
9LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ 9LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
10 file://README;beginline=257;endline=287;md5=82520b052f322ac2b5b3dfdc7c7eea86" 10 file://README;beginline=257;endline=287;md5=82520b052f322ac2b5b3dfdc7c7eea86"
11 11
12SRC_URI = "http://www.dest-unreach.org/socat/download/socat-${PV}.tar.bz2 \ 12SRC_URI = "http://www.dest-unreach.org/socat/download/Archive/socat-${PV}.tar.bz2 \
13" 13"
14 14
15SRC_URI[md5sum] = "36cad050ecf4981ab044c3fbd75c643f" 15SRC_URI[md5sum] = "36cad050ecf4981ab044c3fbd75c643f"
diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index 808c3dc700..187ca15957 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -349,7 +349,7 @@ do_install_ptest () {
349 # These access the internet which is not guaranteed to work on machines running the tests 349 # These access the internet which is not guaranteed to work on machines running the tests
350 rm -rf ${D}${PTEST_PATH}/testsuite/wget 350 rm -rf ${D}${PTEST_PATH}/testsuite/wget
351 sort ${B}/.config > ${D}${PTEST_PATH}/.config 351 sort ${B}/.config > ${D}${PTEST_PATH}/.config
352 ln -s /bin/busybox ${D}${PTEST_PATH}/busybox 352 ln -s ${base_bindir}/busybox ${D}${PTEST_PATH}/busybox
353} 353}
354 354
355inherit update-alternatives 355inherit update-alternatives
diff --git a/meta/recipes-core/coreutils/coreutils_8.32.bb b/meta/recipes-core/coreutils/coreutils_8.32.bb
index 01acf9a874..d819bbaae6 100644
--- a/meta/recipes-core/coreutils/coreutils_8.32.bb
+++ b/meta/recipes-core/coreutils/coreutils_8.32.bb
@@ -208,6 +208,3 @@ do_install_ptest () {
208} 208}
209 209
210FILES:${PN}-ptest += "${bindir}/getlimits" 210FILES:${PN}-ptest += "${bindir}/getlimits"
211
212# These are specific to Opensuse
213CVE_WHITELIST += "CVE-2013-0221 CVE-2013-0222 CVE-2013-0223"
diff --git a/meta/recipes-core/expat/expat_2.4.1.bb b/meta/recipes-core/expat/expat_2.4.7.bb
index 14e5aca9e6..0530ece64d 100644
--- a/meta/recipes-core/expat/expat_2.4.1.bb
+++ b/meta/recipes-core/expat/expat_2.4.7.bb
@@ -15,7 +15,7 @@ SRC_URI = "https://github.com/libexpat/libexpat/releases/download/R_${VERSION_TA
15 15
16UPSTREAM_CHECK_URI = "https://github.com/libexpat/libexpat/releases/" 16UPSTREAM_CHECK_URI = "https://github.com/libexpat/libexpat/releases/"
17 17
18SRC_URI[sha256sum] = "2f9b6a580b94577b150a7d5617ad4643a4301a6616ff459307df3e225bcfbf40" 18SRC_URI[sha256sum] = "e149bdd8b90254c62b3d195da53a09bd531a4d63a963b0d8a5268d48dd2f6a65"
19 19
20EXTRA_OECMAKE:class-native += "-DEXPAT_BUILD_DOCS=OFF" 20EXTRA_OECMAKE:class-native += "-DEXPAT_BUILD_DOCS=OFF"
21 21
diff --git a/meta/recipes-core/glibc/glibc/0001-CVE-2021-3998.patch b/meta/recipes-core/glibc/glibc/0001-CVE-2021-3998.patch
new file mode 100644
index 0000000000..c6bd5916e3
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0001-CVE-2021-3998.patch
@@ -0,0 +1,282 @@
1From fb7bff12e81c677a6622f724edd4d4987dd9d971 Mon Sep 17 00:00:00 2001
2From: Siddhesh Poyarekar <siddhesh@sourceware.org>
3Date: Tue, 18 Jan 2022 13:29:36 +0530
4Subject: [PATCH] support: Add helpers to create paths longer than PATH_MAX
5
6Add new helpers support_create_and_chdir_toolong_temp_directory and
7support_chdir_toolong_temp_directory to create and descend into
8directory trees longer than PATH_MAX.
9
10Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
11Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
12
13Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=062ff490c1467059f6cd64bb9c3d85f6cc6cf97a]
14CVE: CVE-2021-3998
15
16Signed-off-by: Pgowda <pgowda.cve@gmail.com>
17---
18 support/temp_file.c | 159 +++++++++++++++++++++++++++++++++++++++++---
19 support/temp_file.h | 9 +++
20 2 files changed, 159 insertions(+), 9 deletions(-)
21
22diff --git a/support/temp_file.c b/support/temp_file.c
23index e7bb8aadb9..e41128c2d4 100644
24--- a/support/temp_file.c
25+++ b/support/temp_file.c
26@@ -1,5 +1,6 @@
27 /* Temporary file handling for tests.
28 Copyright (C) 1998-2021 Free Software Foundation, Inc.
29+ Copyright The GNU Tools Authors.
30 This file is part of the GNU C Library.
31
32 The GNU C Library is free software; you can redistribute it and/or
33@@ -20,15 +21,17 @@
34 some 32-bit platforms. */
35 #define _FILE_OFFSET_BITS 64
36
37+#include <support/check.h>
38 #include <support/temp_file.h>
39 #include <support/temp_file-internal.h>
40 #include <support/support.h>
41
42+#include <errno.h>
43 #include <paths.h>
44 #include <stdio.h>
45 #include <stdlib.h>
46 #include <string.h>
47-#include <unistd.h>
48+#include <xunistd.h>
49
50 /* List of temporary files. */
51 static struct temp_name_list
52@@ -36,14 +39,20 @@ static struct temp_name_list
53 struct temp_name_list *next;
54 char *name;
55 pid_t owner;
56+ bool toolong;
57 } *temp_name_list;
58
59 /* Location of the temporary files. Set by the test skeleton via
60 support_set_test_dir. The string is not be freed. */
61 static const char *test_dir = _PATH_TMP;
62
63-void
64-add_temp_file (const char *name)
65+/* Name of subdirectories in a too long temporary directory tree. */
66+static char toolong_subdir[NAME_MAX + 1];
67+static bool toolong_initialized;
68+static size_t toolong_path_max;
69+
70+static void
71+add_temp_file_internal (const char *name, bool toolong)
72 {
73 struct temp_name_list *newp
74 = (struct temp_name_list *) xcalloc (sizeof (*newp), 1);
75@@ -53,12 +62,19 @@ add_temp_file (const char *name)
76 newp->name = newname;
77 newp->next = temp_name_list;
78 newp->owner = getpid ();
79+ newp->toolong = toolong;
80 temp_name_list = newp;
81 }
82 else
83 free (newp);
84 }
85
86+void
87+add_temp_file (const char *name)
88+{
89+ add_temp_file_internal (name, false);
90+}
91+
92 int
93 create_temp_file_in_dir (const char *base, const char *dir, char **filename)
94 {
95@@ -90,8 +106,8 @@ create_temp_file (const char *base, char
96 return create_temp_file_in_dir (base, test_dir, filename);
97 }
98
99-char *
100-support_create_temp_directory (const char *base)
101+static char *
102+create_temp_directory_internal (const char *base, bool toolong)
103 {
104 char *path = xasprintf ("%s/%sXXXXXX", test_dir, base);
105 if (mkdtemp (path) == NULL)
106@@ -99,16 +115,132 @@ support_create_temp_directory (const cha
107 printf ("error: mkdtemp (\"%s\"): %m", path);
108 exit (1);
109 }
110- add_temp_file (path);
111+ add_temp_file_internal (path, toolong);
112 return path;
113 }
114
115-/* Helper functions called by the test skeleton follow. */
116+char *
117+support_create_temp_directory (const char *base)
118+{
119+ return create_temp_directory_internal (base, false);
120+}
121+
122+static void
123+ensure_toolong_initialized (void)
124+{
125+ if (!toolong_initialized)
126+ FAIL_EXIT1 ("uninitialized toolong directory tree\n");
127+}
128+
129+static void
130+initialize_toolong (const char *base)
131+{
132+ long name_max = pathconf (base, _PC_NAME_MAX);
133+ name_max = (name_max < 0 ? 64
134+ : (name_max < sizeof (toolong_subdir) ? name_max
135+ : sizeof (toolong_subdir) - 1));
136+
137+ long path_max = pathconf (base, _PC_PATH_MAX);
138+ path_max = (path_max < 0 ? 1024
139+ : path_max <= PTRDIFF_MAX ? path_max : PTRDIFF_MAX);
140+
141+ /* Sanity check to ensure that the test does not create temporary directories
142+ in different filesystems because this API doesn't support it. */
143+ if (toolong_initialized)
144+ {
145+ if (name_max != strlen (toolong_subdir))
146+ FAIL_UNSUPPORTED ("name_max: Temporary directories in different"
147+ " filesystems not supported yet\n");
148+ if (path_max != toolong_path_max)
149+ FAIL_UNSUPPORTED ("path_max: Temporary directories in different"
150+ " filesystems not supported yet\n");
151+ return;
152+ }
153+
154+ toolong_path_max = path_max;
155+
156+ size_t len = name_max;
157+ memset (toolong_subdir, 'X', len);
158+ toolong_initialized = true;
159+}
160+
161+char *
162+support_create_and_chdir_toolong_temp_directory (const char *basename)
163+{
164+ char *base = create_temp_directory_internal (basename, true);
165+ xchdir (base);
166+
167+ initialize_toolong (base);
168+
169+ size_t sz = strlen (toolong_subdir);
170+
171+ /* Create directories and descend into them so that the final path is larger
172+ than PATH_MAX. */
173+ for (size_t i = 0; i <= toolong_path_max / sz; i++)
174+ {
175+ int ret = mkdir (toolong_subdir, S_IRWXU);
176+ if (ret != 0 && errno == ENAMETOOLONG)
177+ FAIL_UNSUPPORTED ("Filesystem does not support creating too long "
178+ "directory trees\n");
179+ else if (ret != 0)
180+ FAIL_EXIT1 ("Failed to create directory tree: %m\n");
181+ xchdir (toolong_subdir);
182+ }
183+ return base;
184+}
185
186 void
187-support_set_test_dir (const char *path)
188+support_chdir_toolong_temp_directory (const char *base)
189 {
190- test_dir = path;
191+ ensure_toolong_initialized ();
192+
193+ xchdir (base);
194+
195+ size_t sz = strlen (toolong_subdir);
196+ for (size_t i = 0; i <= toolong_path_max / sz; i++)
197+ xchdir (toolong_subdir);
198+}
199+
200+/* Helper functions called by the test skeleton follow. */
201+
202+static void
203+remove_toolong_subdirs (const char *base)
204+{
205+ ensure_toolong_initialized ();
206+
207+ if (chdir (base) != 0)
208+ {
209+ printf ("warning: toolong cleanup base failed: chdir (\"%s\"): %m\n",
210+ base);
211+ return;
212+ }
213+
214+ /* Descend. */
215+ int levels = 0;
216+ size_t sz = strlen (toolong_subdir);
217+ for (levels = 0; levels <= toolong_path_max / sz; levels++)
218+ if (chdir (toolong_subdir) != 0)
219+ {
220+ printf ("warning: toolong cleanup failed: chdir (\"%s\"): %m\n",
221+ toolong_subdir);
222+ break;
223+ }
224+
225+ /* Ascend and remove. */
226+ while (--levels >= 0)
227+ {
228+ if (chdir ("..") != 0)
229+ {
230+ printf ("warning: toolong cleanup failed: chdir (\"..\"): %m\n");
231+ return;
232+ }
233+ if (remove (toolong_subdir) != 0)
234+ {
235+ printf ("warning: could not remove subdirectory: %s: %m\n",
236+ toolong_subdir);
237+ return;
238+ }
239+ }
240 }
241
242 void
243@@ -123,6 +255,9 @@ support_delete_temp_files (void)
244 around, to prevent PID reuse.) */
245 if (temp_name_list->owner == pid)
246 {
247+ if (temp_name_list->toolong)
248+ remove_toolong_subdirs (temp_name_list->name);
249+
250 if (remove (temp_name_list->name) != 0)
251 printf ("warning: could not remove temporary file: %s: %m\n",
252 temp_name_list->name);
253@@ -147,3 +282,9 @@ support_print_temp_files (FILE *f)
254 fprintf (f, ")\n");
255 }
256 }
257+
258+void
259+support_set_test_dir (const char *path)
260+{
261+ test_dir = path;
262+}
263diff --git a/support/temp_file.h b/support/temp_file.h
264index 50a443abe4..8459ddda72 100644
265--- a/support/temp_file.h
266+++ b/support/temp_file.h
267@@ -44,6 +44,15 @@ int create_temp_file_in_dir (const char
268 returns. The caller should free this string. */
269 char *support_create_temp_directory (const char *base);
270
271+/* Create a temporary directory tree that is longer than PATH_MAX and schedule
272+ it for deletion. BASENAME is used as a prefix for the unique directory
273+ name, which the function returns. The caller should free this string. */
274+char *support_create_and_chdir_toolong_temp_directory (const char *basename);
275+
276+/* Change into the innermost directory of the directory tree BASE, which was
277+ created using support_create_and_chdir_toolong_temp_directory. */
278+void support_chdir_toolong_temp_directory (const char *base);
279+
280 __END_DECLS
281
282 #endif /* SUPPORT_TEMP_FILE_H */
diff --git a/meta/recipes-core/glibc/glibc/0001-CVE-2021-3999.patch b/meta/recipes-core/glibc/glibc/0001-CVE-2021-3999.patch
new file mode 100644
index 0000000000..64749390b5
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0001-CVE-2021-3999.patch
@@ -0,0 +1,36 @@
1From 8c8a71c85f2ed5cc90d08d82ce645513fc907cb6 Mon Sep 17 00:00:00 2001
2From: Siddhesh Poyarekar <siddhesh@sourceware.org>
3Date: Mon, 24 Jan 2022 10:57:09 +0530
4Subject: [PATCH] tst-realpath-toolong: Fix hurd build
5
6Define PATH_MAX to a constant if it isn't already defined, like in hurd.
7
8Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
9(cherry picked from commit 976db046bc3a3738f69255ae00b0a09b8e77fd9c)
10
11Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=8c8a71c85f2ed5cc90d08d82ce645513fc907cb6]
12CVE: CVE-2021-3999
13
14Signed-off-by: Pgowda <pgowda.cve@gmail.com>
15---
16 stdlib/tst-realpath-toolong.c | 4 ++++
17 1 file changed, 4 insertions(+)
18
19diff --git a/stdlib/tst-realpath-toolong.c b/stdlib/tst-realpath-toolong.c
20index 8bed772460..4388890294 100644
21--- a/stdlib/tst-realpath-toolong.c
22+++ b/stdlib/tst-realpath-toolong.c
23@@ -29,6 +29,10 @@
24
25 #define BASENAME "tst-realpath-toolong."
26
27+#ifndef PATH_MAX
28+# define PATH_MAX 1024
29+#endif
30+
31 int
32 do_test (void)
33 {
34--
352.27.0
36
diff --git a/meta/recipes-core/glibc/glibc/0001-CVE-2022-23218.patch b/meta/recipes-core/glibc/glibc/0001-CVE-2022-23218.patch
new file mode 100644
index 0000000000..4eb1fb7fbe
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0001-CVE-2022-23218.patch
@@ -0,0 +1,178 @@
1From e368b12f6c16b6888dda99ba641e999b9c9643c8 Mon Sep 17 00:00:00 2001
2From: Florian Weimer <fweimer@redhat.com>
3Date: Mon, 17 Jan 2022 10:21:34 +0100
4Subject: [PATCH] socket: Add the __sockaddr_un_set function
5
6Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=e368b12f6c16b6888dda99ba641e999b9c9643c8]
7CVE: CVE-2022-23219
8
9Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
10Signed-off-by: Pgowda <pgowda.cve@gmail.com>
11---
12 include/sys/un.h | 12 +++++++
13 socket/Makefile | 6 +++-
14 socket/sockaddr_un_set.c | 41 ++++++++++++++++++++++++
15 socket/tst-sockaddr_un_set.c | 62 ++++++++++++++++++++++++++++++++++++
16 4 files changed, 120 insertions(+), 1 deletion(-)
17 create mode 100644 socket/sockaddr_un_set.c
18 create mode 100644 socket/tst-sockaddr_un_set.c
19
20diff --git a/include/sys/un.h b/include/sys/un.h
21index bdbee99980..152afd9fc7 100644
22--- a/include/sys/un.h
23+++ b/include/sys/un.h
24@@ -1 +1,13 @@
25 #include <socket/sys/un.h>
26+
27+#ifndef _ISOMAC
28+
29+/* Set ADDR->sun_family to AF_UNIX and ADDR->sun_path to PATHNAME.
30+ Return 0 on success or -1 on failure (due to overlong PATHNAME).
31+ The caller should always use sizeof (struct sockaddr_un) as the
32+ socket address length, disregaring the length of PATHNAME.
33+ Only concrete (non-abstract) pathnames are supported. */
34+int __sockaddr_un_set (struct sockaddr_un *addr, const char *pathname)
35+ attribute_hidden;
36+
37+#endif /* _ISOMAC */
38diff --git a/socket/Makefile b/socket/Makefile
39index 39333e10ca..156eec6c85 100644
40--- a/socket/Makefile
41+++ b/socket/Makefile
42@@ -29,13 +29,17 @@ headers := sys/socket.h sys/un.h bits/sockaddr.h bits/socket.h \
43 routines := accept bind connect getpeername getsockname getsockopt \
44 listen recv recvfrom recvmsg send sendmsg sendto \
45 setsockopt shutdown socket socketpair isfdtype opensock \
46- sockatmark accept4 recvmmsg sendmmsg
47+ sockatmark accept4 recvmmsg sendmmsg sockaddr_un_set
48
49 tests := \
50 tst-accept4 \
51 tst-sockopt \
52 # tests
53
54+tests-internal := \
55+ tst-sockaddr_un_set \
56+ # tests-internal
57+
58 tests-time64 := \
59 tst-sockopt-time64 \
60 # tests
61diff --git a/socket/sockaddr_un_set.c b/socket/sockaddr_un_set.c
62new file mode 100644
63index 0000000000..0bd40dc34e
64--- /dev/null
65+++ b/socket/sockaddr_un_set.c
66@@ -0,0 +1,41 @@
67+/* Set the sun_path member of struct sockaddr_un.
68+ Copyright (C) 2022 Free Software Foundation, Inc.
69+ This file is part of the GNU C Library.
70+
71+ The GNU C Library is free software; you can redistribute it and/or
72+ modify it under the terms of the GNU Lesser General Public
73+ License as published by the Free Software Foundation; either
74+ version 2.1 of the License, or (at your option) any later version.
75+
76+ The GNU C Library is distributed in the hope that it will be useful,
77+ but WITHOUT ANY WARRANTY; without even the implied warranty of
78+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
79+ Lesser General Public License for more details.
80+
81+ You should have received a copy of the GNU Lesser General Public
82+ License along with the GNU C Library; if not, see
83+ <https://www.gnu.org/licenses/>. */
84+
85+#include <errno.h>
86+#include <string.h>
87+#include <sys/socket.h>
88+#include <sys/un.h>
89+
90+int
91+__sockaddr_un_set (struct sockaddr_un *addr, const char *pathname)
92+{
93+ size_t name_length = strlen (pathname);
94+
95+ /* The kernel supports names of exactly sizeof (addr->sun_path)
96+ bytes, without a null terminator, but userspace does not; see the
97+ SUN_LEN macro. */
98+ if (name_length >= sizeof (addr->sun_path))
99+ {
100+ __set_errno (EINVAL); /* Error code used by the kernel. */
101+ return -1;
102+ }
103+
104+ addr->sun_family = AF_UNIX;
105+ memcpy (addr->sun_path, pathname, name_length + 1);
106+ return 0;
107+}
108diff --git a/socket/tst-sockaddr_un_set.c b/socket/tst-sockaddr_un_set.c
109new file mode 100644
110index 0000000000..29c2a81afd
111--- /dev/null
112+++ b/socket/tst-sockaddr_un_set.c
113@@ -0,0 +1,62 @@
114+/* Test the __sockaddr_un_set function.
115+ Copyright (C) 2022 Free Software Foundation, Inc.
116+ This file is part of the GNU C Library.
117+
118+ The GNU C Library is free software; you can redistribute it and/or
119+ modify it under the terms of the GNU Lesser General Public
120+ License as published by the Free Software Foundation; either
121+ version 2.1 of the License, or (at your option) any later version.
122+
123+ The GNU C Library is distributed in the hope that it will be useful,
124+ but WITHOUT ANY WARRANTY; without even the implied warranty of
125+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
126+ Lesser General Public License for more details.
127+
128+ You should have received a copy of the GNU Lesser General Public
129+ License along with the GNU C Library; if not, see
130+ <https://www.gnu.org/licenses/>. */
131+
132+/* Re-compile the function because the version in libc is not
133+ exported. */
134+#include "sockaddr_un_set.c"
135+
136+#include <support/check.h>
137+
138+static int
139+do_test (void)
140+{
141+ struct sockaddr_un sun;
142+
143+ memset (&sun, 0xcc, sizeof (sun));
144+ __sockaddr_un_set (&sun, "");
145+ TEST_COMPARE (sun.sun_family, AF_UNIX);
146+ TEST_COMPARE (__sockaddr_un_set (&sun, ""), 0);
147+
148+ memset (&sun, 0xcc, sizeof (sun));
149+ TEST_COMPARE (__sockaddr_un_set (&sun, "/example"), 0);
150+ TEST_COMPARE_STRING (sun.sun_path, "/example");
151+
152+ {
153+ char pathname[108]; /* Length of sun_path (ABI constant). */
154+ memset (pathname, 'x', sizeof (pathname));
155+ pathname[sizeof (pathname) - 1] = '\0';
156+ memset (&sun, 0xcc, sizeof (sun));
157+ TEST_COMPARE (__sockaddr_un_set (&sun, pathname), 0);
158+ TEST_COMPARE (sun.sun_family, AF_UNIX);
159+ TEST_COMPARE_STRING (sun.sun_path, pathname);
160+ }
161+
162+ {
163+ char pathname[109];
164+ memset (pathname, 'x', sizeof (pathname));
165+ pathname[sizeof (pathname) - 1] = '\0';
166+ memset (&sun, 0xcc, sizeof (sun));
167+ errno = 0;
168+ TEST_COMPARE (__sockaddr_un_set (&sun, pathname), -1);
169+ TEST_COMPARE (errno, EINVAL);
170+ }
171+
172+ return 0;
173+}
174+
175+#include <support/test-driver.c>
176--
1772.27.0
178
diff --git a/meta/recipes-core/glibc/glibc/0001-CVE-2022-23219.patch b/meta/recipes-core/glibc/glibc/0001-CVE-2022-23219.patch
new file mode 100644
index 0000000000..261c2909db
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0001-CVE-2022-23219.patch
@@ -0,0 +1,55 @@
1From 226b46770c82899b555986583294b049c6ec9b40 Mon Sep 17 00:00:00 2001
2From: Florian Weimer <fweimer@redhat.com>
3Date: Mon, 17 Jan 2022 10:21:34 +0100
4Subject: [PATCH] CVE-2022-23219: Buffer overflow in sunrpc clnt_create for
5 "unix" (bug 22542)
6
7Processing an overlong pathname in the sunrpc clnt_create function
8results in a stack-based buffer overflow.
9
10Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=226b46770c82899b555986583294b049c6ec9b40]
11CVE: CVE-2022-23219
12
13Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
14Signed-off-by: Pgowda <pgowda.cve@gmail.com>
15---
16 NEWS | 4 +++-
17 sunrpc/clnt_gen.c | 10 +++++++---
18 2 files changed, 10 insertions(+), 4 deletions(-)
19
20diff --git a/NEWS b/NEWS
21index ddd95a8329..38a9ddb2cf 100644
22--- a/NEWS
23+++ b/NEWS
24@@ -206,6 +206,10 @@ Security related changes:
25 CVE-2022-23218: Passing an overlong file name to the svcunix_create
26 legacy function could result in a stack-based buffer overflow.
27
28+ CVE-2022-23219: Passing an overlong file name to the clnt_create
29+ legacy function could result in a stack-based buffer overflow when
30+ using the "unix" protocol. Reported by Martin Sebor.
31+
32 The following bugs are resolved with this release:
33
34 [4737] libc: fork is not async-signal-safe
35diff --git a/sunrpc/clnt_gen.c b/sunrpc/clnt_gen.c
36index 13ced8994e..b44357cd88 100644
37--- a/sunrpc/clnt_gen.c
38+++ b/sunrpc/clnt_gen.c
39@@ -57,9 +57,13 @@ clnt_create (const char *hostname, u_lon
40
41 if (strcmp (proto, "unix") == 0)
42 {
43- memset ((char *)&sun, 0, sizeof (sun));
44- sun.sun_family = AF_UNIX;
45- strcpy (sun.sun_path, hostname);
46+ if (__sockaddr_un_set (&sun, hostname) < 0)
47+ {
48+ struct rpc_createerr *ce = &get_rpc_createerr ();
49+ ce->cf_stat = RPC_SYSTEMERROR;
50+ ce->cf_error.re_errno = errno;
51+ return NULL;
52+ }
53 sock = RPC_ANYSOCK;
54 client = clntunix_create (&sun, prog, vers, &sock, 0, 0);
55 if (client == NULL)
diff --git a/meta/recipes-core/glibc/glibc/0002-CVE-2021-3998.patch b/meta/recipes-core/glibc/glibc/0002-CVE-2021-3998.patch
new file mode 100644
index 0000000000..0a4c34452d
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0002-CVE-2021-3998.patch
@@ -0,0 +1,138 @@
1From f7a79879c0b2bef0dadd6caaaeeb0d26423e04e5 Mon Sep 17 00:00:00 2001
2From: Siddhesh Poyarekar <siddhesh@sourceware.org>
3Date: Thu, 13 Jan 2022 11:28:36 +0530
4Subject: [PATCH] realpath: Set errno to ENAMETOOLONG for result larger than
5 PATH_MAX [BZ #28770]
6
7realpath returns an allocated string when the result exceeds PATH_MAX,
8which is unexpected when its second argument is not NULL. This results
9in the second argument (resolved) being uninitialized and also results
10in a memory leak since the caller expects resolved to be the same as the
11returned value.
12
13Return NULL and set errno to ENAMETOOLONG if the result exceeds
14PATH_MAX. This fixes [BZ #28770], which is CVE-2021-3998.
15
16Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
17Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
18(cherry picked from commit ee8d5e33adb284601c00c94687bc907e10aec9bb)
19
20Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=f7a79879c0b2bef0dadd6caaaeeb0d26423e04e5]
21CVE: CVE-2021-3998
22
23Signed-off-by: Pgowda <pgowda.cve@gmail.com>
24---
25 NEWS | 4 +++
26 stdlib/Makefile | 1 +
27 stdlib/canonicalize.c | 12 +++++++--
28 stdlib/tst-realpath-toolong.c | 49 +++++++++++++++++++++++++++++++++++
29 4 files changed, 64 insertions(+), 2 deletions(-)
30 create mode 100644 stdlib/tst-realpath-toolong.c
31
32diff --git a/NEWS b/NEWS
33index 7e773bd005..b4f81c2668 100644
34--- a/NEWS
35+++ b/NEWS
36@@ -210,6 +210,10 @@ Security related changes:
37 legacy function could result in a stack-based buffer overflow when
38 using the "unix" protocol. Reported by Martin Sebor.
39
40+ CVE-2021-3998: Passing a path longer than PATH_MAX to the realpath
41+ function could result in a memory leak and potential access of
42+ uninitialized memory. Reported by Qualys.
43+
44 The following bugs are resolved with this release:
45
46 [4737] libc: fork is not async-signal-safe
47diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c
48index 698f9ede25..7a23a51b3a 100644
49--- a/stdlib/canonicalize.c
50+++ b/stdlib/canonicalize.c
51@@ -400,8 +400,16 @@ realpath_stk (const char *name, char *re
52
53 error:
54 *dest++ = '\0';
55- if (resolved != NULL && dest - rname <= get_path_max ())
56- rname = strcpy (resolved, rname);
57+ if (resolved != NULL)
58+ {
59+ if (dest - rname <= get_path_max ())
60+ rname = strcpy (resolved, rname);
61+ else
62+ {
63+ failed = true;
64+ __set_errno (ENAMETOOLONG);
65+ }
66+ }
67
68 error_nomem:
69 scratch_buffer_free (&extra_buffer);
70diff --git a/stdlib/Makefile b/stdlib/Makefile
71index 9bb5c221e8..a4ac30d1f6 100644
72--- a/stdlib/Makefile
73+++ b/stdlib/Makefile
74@@ -88,7 +88,8 @@ tests := tst-strtol tst-strtod testmb t
75 tst-swapcontext1 tst-setcontext4 tst-setcontext5 \
76 tst-setcontext6 tst-setcontext7 tst-setcontext8 \
77 tst-setcontext9 tst-bz20544 tst-canon-bz26341 \
78- tst-realpath
79+ tst-realpath \
80+ tst-realpath-toolong
81
82 tests-internal := tst-strtod1i tst-strtod3 tst-strtod4 tst-strtod5i \
83 tst-tls-atexit tst-tls-atexit-nodelete
84diff --git a/stdlib/tst-realpath-toolong.c b/stdlib/tst-realpath-toolong.c
85new file mode 100644
86index 0000000000..8bed772460
87--- /dev/null
88+++ b/stdlib/tst-realpath-toolong.c
89@@ -0,0 +1,49 @@
90+/* Verify that realpath returns NULL with ENAMETOOLONG if the result exceeds
91+ NAME_MAX.
92+ Copyright The GNU Toolchain Authors.
93+ This file is part of the GNU C Library.
94+
95+ The GNU C Library is free software; you can redistribute it and/or
96+ modify it under the terms of the GNU Lesser General Public
97+ License as published by the Free Software Foundation; either
98+ version 2.1 of the License, or (at your option) any later version.
99+
100+ The GNU C Library is distributed in the hope that it will be useful,
101+ but WITHOUT ANY WARRANTY; without even the implied warranty of
102+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
103+ Lesser General Public License for more details.
104+
105+ You should have received a copy of the GNU Lesser General Public
106+ License along with the GNU C Library; if not, see
107+ <https://www.gnu.org/licenses/>. */
108+
109+#include <errno.h>
110+#include <limits.h>
111+#include <stdlib.h>
112+#include <string.h>
113+#include <unistd.h>
114+#include <support/check.h>
115+#include <support/temp_file.h>
116+#include <sys/types.h>
117+#include <sys/stat.h>
118+
119+#define BASENAME "tst-realpath-toolong."
120+
121+int
122+do_test (void)
123+{
124+ char *base = support_create_and_chdir_toolong_temp_directory (BASENAME);
125+
126+ char buf[PATH_MAX + 1];
127+ const char *res = realpath (".", buf);
128+
129+ /* canonicalize.c states that if the real path is >= PATH_MAX, then
130+ realpath returns NULL and sets ENAMETOOLONG. */
131+ TEST_VERIFY (res == NULL);
132+ TEST_VERIFY (errno == ENAMETOOLONG);
133+
134+ free (base);
135+ return 0;
136+}
137+
138+#include <support/test-driver.c>
diff --git a/meta/recipes-core/glibc/glibc/0002-CVE-2021-3999.patch b/meta/recipes-core/glibc/glibc/0002-CVE-2021-3999.patch
new file mode 100644
index 0000000000..ef3a504fdf
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0002-CVE-2021-3999.patch
@@ -0,0 +1,357 @@
1From 472e799a5f2102bc0c3206dbd5a801765fceb39c Mon Sep 17 00:00:00 2001
2From: Siddhesh Poyarekar <siddhesh@sourceware.org>
3Date: Fri, 21 Jan 2022 23:32:56 +0530
4Subject: [PATCH] getcwd: Set errno to ERANGE for size == 1 (CVE-2021-3999)
5
6No valid path returned by getcwd would fit into 1 byte, so reject the
7size early and return NULL with errno set to ERANGE. This change is
8prompted by CVE-2021-3999, which describes a single byte buffer
9underflow and overflow when all of the following conditions are met:
10
11- The buffer size (i.e. the second argument of getcwd) is 1 byte
12- The current working directory is too long
13- '/' is also mounted on the current working directory
14
15Sequence of events:
16
17- In sysdeps/unix/sysv/linux/getcwd.c, the syscall returns ENAMETOOLONG
18 because the linux kernel checks for name length before it checks
19 buffer size
20
21- The code falls back to the generic getcwd in sysdeps/posix
22
23- In the generic func, the buf[0] is set to '\0' on line 250
24
25- this while loop on line 262 is bypassed:
26
27 while (!(thisdev == rootdev && thisino == rootino))
28
29 since the rootfs (/) is bind mounted onto the directory and the flow
30 goes on to line 449, where it puts a '/' in the byte before the
31 buffer.
32
33- Finally on line 458, it moves 2 bytes (the underflowed byte and the
34 '\0') to the buf[0] and buf[1], resulting in a 1 byte buffer overflow.
35
36- buf is returned on line 469 and errno is not set.
37
38This resolves BZ #28769.
39
40Reviewed-by: Andreas Schwab <schwab@linux-m68k.org>
41Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
42Signed-off-by: Qualys Security Advisory <qsa@qualys.com>
43Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
44(cherry picked from commit 23e0e8f5f1fb5ed150253d986ecccdc90c2dcd5e)
45
46Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=472e799a5f2102bc0c3206dbd5a801765fceb39c]
47CVE: CVE-2021-3999
48
49Signed-off-by: Pgowda <pgowda.cve@gmail.com>
50---
51 NEWS | 6 +
52 sysdeps/posix/getcwd.c | 7 +
53 sysdeps/unix/sysv/linux/Makefile | 7 +-
54 .../unix/sysv/linux/tst-getcwd-smallbuff.c | 241 ++++++++++++++++++
55 4 files changed, 260 insertions(+), 1 deletion(-)
56 create mode 100644 sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c
57
58diff --git a/NEWS b/NEWS
59index b4f81c2668..8d7467d2c1 100644
60--- a/NEWS
61+++ b/NEWS
62@@ -214,6 +214,12 @@ Security related changes:
63 function could result in a memory leak and potential access of
64 uninitialized memory. Reported by Qualys.
65
66+ CVE-2021-3999: Passing a buffer of size exactly 1 byte to the getcwd
67+ function may result in an off-by-one buffer underflow and overflow
68+ when the current working directory is longer than PATH_MAX and also
69+ corresponds to the / directory through an unprivileged mount
70+ namespace. Reported by Qualys.
71+
72 The following bugs are resolved with this release:
73
74 [4737] libc: fork is not async-signal-safe
75diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c
76index 13680026ff..b6984a382c 100644
77--- a/sysdeps/posix/getcwd.c
78+++ b/sysdeps/posix/getcwd.c
79@@ -187,6 +187,13 @@ __getcwd_generic (char *buf, size_t size
80 size_t allocated = size;
81 size_t used;
82
83+ /* A size of 1 byte is never useful. */
84+ if (allocated == 1)
85+ {
86+ __set_errno (ERANGE);
87+ return NULL;
88+ }
89+
90 #if HAVE_MINIMALLY_WORKING_GETCWD
91 /* If AT_FDCWD is not defined, the algorithm below is O(N**2) and
92 this is much slower than the system getcwd (at least on
93diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
94index 76ad06361c..9380d3848d 100644
95--- a/sysdeps/unix/sysv/linux/Makefile
96+++ b/sysdeps/unix/sysv/linux/Makefile
97@@ -331,7 +331,12 @@ sysdep_routines += xstatconv internal_st
98
99 sysdep_headers += bits/fcntl-linux.h
100
101-tests += tst-fallocate tst-fallocate64 tst-o_path-locks
102+tests += \
103+ tst-fallocate \
104+ tst-fallocate64 \
105+ tst-getcwd-smallbuff \
106+ tst-o_path-locks \
107+# tests
108 endif
109
110 ifeq ($(subdir),elf)
111diff --git a/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c b/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c
112new file mode 100644
113index 0000000000..d460d6e766
114--- /dev/null
115+++ b/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c
116@@ -0,0 +1,241 @@
117+/* Verify that getcwd returns ERANGE for size 1 byte and does not underflow
118+ buffer when the CWD is too long and is also a mount target of /. See bug
119+ #28769 or CVE-2021-3999 for more context.
120+ Copyright The GNU Toolchain Authors.
121+ This file is part of the GNU C Library.
122+
123+ The GNU C Library is free software; you can redistribute it and/or
124+ modify it under the terms of the GNU Lesser General Public
125+ License as published by the Free Software Foundation; either
126+ version 2.1 of the License, or (at your option) any later version.
127+
128+ The GNU C Library is distributed in the hope that it will be useful,
129+ but WITHOUT ANY WARRANTY; without even the implied warranty of
130+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
131+ Lesser General Public License for more details.
132+
133+ You should have received a copy of the GNU Lesser General Public
134+ License along with the GNU C Library; if not, see
135+ <https://www.gnu.org/licenses/>. */
136+
137+#include <errno.h>
138+#include <fcntl.h>
139+#include <intprops.h>
140+#include <limits.h>
141+#include <stdio.h>
142+#include <stdlib.h>
143+#include <string.h>
144+#include <sys/mount.h>
145+#include <sys/stat.h>
146+#include <sys/types.h>
147+#include <sys/wait.h>
148+
149+#include <sys/socket.h>
150+#include <sys/un.h>
151+#include <support/check.h>
152+#include <support/temp_file.h>
153+#include <support/xsched.h>
154+#include <support/xunistd.h>
155+
156+static char *base;
157+#define BASENAME "tst-getcwd-smallbuff"
158+#define MOUNT_NAME "mpoint"
159+static int sockfd[2];
160+
161+static void
162+do_cleanup (void)
163+{
164+ support_chdir_toolong_temp_directory (base);
165+ TEST_VERIFY_EXIT (rmdir (MOUNT_NAME) == 0);
166+ free (base);
167+}
168+
169+static void
170+send_fd (const int sock, const int fd)
171+{
172+ struct msghdr msg = {0};
173+ union
174+ {
175+ struct cmsghdr hdr;
176+ char buf[CMSG_SPACE (sizeof (int))];
177+ } cmsgbuf = {0};
178+ struct cmsghdr *cmsg;
179+ struct iovec vec;
180+ char ch = 'A';
181+ ssize_t n;
182+
183+ msg.msg_control = &cmsgbuf.buf;
184+ msg.msg_controllen = sizeof (cmsgbuf.buf);
185+
186+ cmsg = CMSG_FIRSTHDR (&msg);
187+ cmsg->cmsg_len = CMSG_LEN (sizeof (int));
188+ cmsg->cmsg_level = SOL_SOCKET;
189+ cmsg->cmsg_type = SCM_RIGHTS;
190+ memcpy (CMSG_DATA (cmsg), &fd, sizeof (fd));
191+
192+ vec.iov_base = &ch;
193+ vec.iov_len = 1;
194+ msg.msg_iov = &vec;
195+ msg.msg_iovlen = 1;
196+
197+ while ((n = sendmsg (sock, &msg, 0)) == -1 && errno == EINTR);
198+
199+ TEST_VERIFY_EXIT (n == 1);
200+}
201+
202+static int
203+recv_fd (const int sock)
204+{
205+ struct msghdr msg = {0};
206+ union
207+ {
208+ struct cmsghdr hdr;
209+ char buf[CMSG_SPACE(sizeof(int))];
210+ } cmsgbuf = {0};
211+ struct cmsghdr *cmsg;
212+ struct iovec vec;
213+ ssize_t n;
214+ char ch = '\0';
215+ int fd = -1;
216+
217+ vec.iov_base = &ch;
218+ vec.iov_len = 1;
219+ msg.msg_iov = &vec;
220+ msg.msg_iovlen = 1;
221+
222+ msg.msg_control = &cmsgbuf.buf;
223+ msg.msg_controllen = sizeof (cmsgbuf.buf);
224+
225+ while ((n = recvmsg (sock, &msg, 0)) == -1 && errno == EINTR);
226+ if (n != 1 || ch != 'A')
227+ return -1;
228+
229+ cmsg = CMSG_FIRSTHDR (&msg);
230+ if (cmsg == NULL)
231+ return -1;
232+ if (cmsg->cmsg_type != SCM_RIGHTS)
233+ return -1;
234+ memcpy (&fd, CMSG_DATA (cmsg), sizeof (fd));
235+ if (fd < 0)
236+ return -1;
237+ return fd;
238+}
239+
240+static int
241+child_func (void * const arg)
242+{
243+ xclose (sockfd[0]);
244+ const int sock = sockfd[1];
245+ char ch;
246+
247+ TEST_VERIFY_EXIT (read (sock, &ch, 1) == 1);
248+ TEST_VERIFY_EXIT (ch == '1');
249+
250+ if (mount ("/", MOUNT_NAME, NULL, MS_BIND | MS_REC, NULL))
251+ FAIL_EXIT1 ("mount failed: %m\n");
252+ const int fd = xopen ("mpoint",
253+ O_RDONLY | O_PATH | O_DIRECTORY | O_NOFOLLOW, 0);
254+
255+ send_fd (sock, fd);
256+ xclose (fd);
257+
258+ TEST_VERIFY_EXIT (read (sock, &ch, 1) == 1);
259+ TEST_VERIFY_EXIT (ch == 'a');
260+
261+ xclose (sock);
262+ return 0;
263+}
264+
265+static void
266+update_map (char * const mapping, const char * const map_file)
267+{
268+ const size_t map_len = strlen (mapping);
269+
270+ const int fd = xopen (map_file, O_WRONLY, 0);
271+ xwrite (fd, mapping, map_len);
272+ xclose (fd);
273+}
274+
275+static void
276+proc_setgroups_write (const long child_pid, const char * const str)
277+{
278+ const size_t str_len = strlen(str);
279+
280+ char setgroups_path[sizeof ("/proc//setgroups") + INT_STRLEN_BOUND (long)];
281+
282+ snprintf (setgroups_path, sizeof (setgroups_path),
283+ "/proc/%ld/setgroups", child_pid);
284+
285+ const int fd = open (setgroups_path, O_WRONLY);
286+
287+ if (fd < 0)
288+ {
289+ TEST_VERIFY_EXIT (errno == ENOENT);
290+ FAIL_UNSUPPORTED ("/proc/%ld/setgroups not found\n", child_pid);
291+ }
292+
293+ xwrite (fd, str, str_len);
294+ xclose(fd);
295+}
296+
297+static char child_stack[1024 * 1024];
298+
299+int
300+do_test (void)
301+{
302+ base = support_create_and_chdir_toolong_temp_directory (BASENAME);
303+
304+ xmkdir (MOUNT_NAME, S_IRWXU);
305+ atexit (do_cleanup);
306+
307+ TEST_VERIFY_EXIT (socketpair (AF_UNIX, SOCK_STREAM, 0, sockfd) == 0);
308+ pid_t child_pid = xclone (child_func, NULL, child_stack,
309+ sizeof (child_stack),
310+ CLONE_NEWUSER | CLONE_NEWNS | SIGCHLD);
311+
312+ xclose (sockfd[1]);
313+ const int sock = sockfd[0];
314+
315+ char map_path[sizeof ("/proc//uid_map") + INT_STRLEN_BOUND (long)];
316+ char map_buf[sizeof ("0 1") + INT_STRLEN_BOUND (long)];
317+
318+ snprintf (map_path, sizeof (map_path), "/proc/%ld/uid_map",
319+ (long) child_pid);
320+ snprintf (map_buf, sizeof (map_buf), "0 %ld 1", (long) getuid());
321+ update_map (map_buf, map_path);
322+
323+ proc_setgroups_write ((long) child_pid, "deny");
324+ snprintf (map_path, sizeof (map_path), "/proc/%ld/gid_map",
325+ (long) child_pid);
326+ snprintf (map_buf, sizeof (map_buf), "0 %ld 1", (long) getgid());
327+ update_map (map_buf, map_path);
328+
329+ TEST_VERIFY_EXIT (send (sock, "1", 1, MSG_NOSIGNAL) == 1);
330+ const int fd = recv_fd (sock);
331+ TEST_VERIFY_EXIT (fd >= 0);
332+ TEST_VERIFY_EXIT (fchdir (fd) == 0);
333+
334+ static char buf[2 * 10 + 1];
335+ memset (buf, 'A', sizeof (buf));
336+
337+ /* Finally, call getcwd and check if it resulted in a buffer underflow. */
338+ char * cwd = getcwd (buf + sizeof (buf) / 2, 1);
339+ TEST_VERIFY (cwd == NULL);
340+ TEST_VERIFY (errno == ERANGE);
341+
342+ for (int i = 0; i < sizeof (buf); i++)
343+ if (buf[i] != 'A')
344+ {
345+ printf ("buf[%d] = %02x\n", i, (unsigned int) buf[i]);
346+ support_record_failure ();
347+ }
348+
349+ TEST_VERIFY_EXIT (send (sock, "a", 1, MSG_NOSIGNAL) == 1);
350+ xclose (sock);
351+ TEST_VERIFY_EXIT (xwaitpid (child_pid, NULL, 0) == child_pid);
352+
353+ return 0;
354+}
355+
356+#define CLEANUP_HANDLER do_cleanup
357+#include <support/test-driver.c>
diff --git a/meta/recipes-core/glibc/glibc/0002-CVE-2022-23218.patch b/meta/recipes-core/glibc/glibc/0002-CVE-2022-23218.patch
new file mode 100644
index 0000000000..00fb3266c6
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0002-CVE-2022-23218.patch
@@ -0,0 +1,126 @@
1From f545ad4928fa1f27a3075265182b38a4f939a5f7 Mon Sep 17 00:00:00 2001
2From: Florian Weimer <fweimer@redhat.com>
3Date: Mon, 17 Jan 2022 10:21:34 +0100
4Subject: [PATCH] CVE-2022-23218: Buffer overflow in sunrpc svcunix_create (bug
5 28768)
6
7The sunrpc function svcunix_create suffers from a stack-based buffer
8overflow with overlong pathname arguments.
9
10Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=f545ad4928fa1f27a3075265182b38a4f939a5f7]
11CVE: CVE-2022-23218
12
13Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
14Signed-off-by: Pgowda <pgowda.cve@gmail.com>
15---
16 NEWS | 3 +++
17 sunrpc/Makefile | 2 +-
18 sunrpc/svc_unix.c | 11 ++++-------
19 sunrpc/tst-bug28768.c | 42 ++++++++++++++++++++++++++++++++++++++++++
20 4 files changed, 50 insertions(+), 8 deletions(-)
21 create mode 100644 sunrpc/tst-bug28768.c
22
23diff --git a/NEWS b/NEWS
24index 38a9ddb2cf..38802f0673 100644
25--- a/NEWS
26+++ b/NEWS
27@@ -203,6 +203,9 @@ Security related changes:
28 parameter number when processing the expansion resulting in a crash.
29 Reported by Philippe Antoine.
30
31+ CVE-2022-23218: Passing an overlong file name to the svcunix_create
32+ legacy function could result in a stack-based buffer overflow.
33+
34 The following bugs are resolved with this release:
35
36 [4737] libc: fork is not async-signal-safe
37diff --git a/sunrpc/Makefile b/sunrpc/Makefile
38index 183ef3dc55..a79a7195fc 100644
39--- a/sunrpc/Makefile
40+++ b/sunrpc/Makefile
41@@ -65,7 +65,7 @@ shared-only-routines = $(routines)
42 endif
43
44 tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error tst-udp-timeout \
45- tst-udp-nonblocking
46+ tst-udp-nonblocking tst-bug28768
47 xtests := tst-getmyaddr
48
49 ifeq ($(have-thread-library),yes)
50diff --git a/sunrpc/svc_unix.c b/sunrpc/svc_unix.c
51index f2280b4c49..67177a2e78 100644
52--- a/sunrpc/svc_unix.c
53+++ b/sunrpc/svc_unix.c
54@@ -154,7 +154,10 @@ svcunix_create (int sock, u_int sendsize
55 SVCXPRT *xprt;
56 struct unix_rendezvous *r;
57 struct sockaddr_un addr;
58- socklen_t len = sizeof (struct sockaddr_in);
59+ socklen_t len = sizeof (addr);
60+
61+ if (__sockaddr_un_set (&addr, path) < 0)
62+ return NULL;
63
64 if (sock == RPC_ANYSOCK)
65 {
66@@ -165,12 +168,6 @@ svcunix_create (int sock, u_int sendsize
67 }
68 madesock = TRUE;
69 }
70- memset (&addr, '\0', sizeof (addr));
71- addr.sun_family = AF_UNIX;
72- len = strlen (path) + 1;
73- memcpy (addr.sun_path, path, len);
74- len += sizeof (addr.sun_family);
75-
76 __bind (sock, (struct sockaddr *) &addr, len);
77
78 if (__getsockname (sock, (struct sockaddr *) &addr, &len) != 0
79diff --git a/sunrpc/tst-bug28768.c b/sunrpc/tst-bug28768.c
80new file mode 100644
81index 0000000000..35a4b7b0b3
82--- /dev/null
83+++ b/sunrpc/tst-bug28768.c
84@@ -0,0 +1,42 @@
85+/* Test to verify that long path is rejected by svcunix_create (bug 28768).
86+ Copyright (C) 2022 Free Software Foundation, Inc.
87+ This file is part of the GNU C Library.
88+
89+ The GNU C Library is free software; you can redistribute it and/or
90+ modify it under the terms of the GNU Lesser General Public
91+ License as published by the Free Software Foundation; either
92+ version 2.1 of the License, or (at your option) any later version.
93+
94+ The GNU C Library is distributed in the hope that it will be useful,
95+ but WITHOUT ANY WARRANTY; without even the implied warranty of
96+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
97+ Lesser General Public License for more details.
98+
99+ You should have received a copy of the GNU Lesser General Public
100+ License along with the GNU C Library; if not, see
101+ <http://www.gnu.org/licenses/>. */
102+
103+#include <errno.h>
104+#include <rpc/svc.h>
105+#include <shlib-compat.h>
106+#include <string.h>
107+#include <support/check.h>
108+
109+/* svcunix_create does not have a default version in linkobj/libc.so. */
110+compat_symbol_reference (libc, svcunix_create, svcunix_create, GLIBC_2_1);
111+
112+static int
113+do_test (void)
114+{
115+ char pathname[109];
116+ memset (pathname, 'x', sizeof (pathname));
117+ pathname[sizeof (pathname) - 1] = '\0';
118+
119+ errno = 0;
120+ TEST_VERIFY (svcunix_create (RPC_ANYSOCK, 4096, 4096, pathname) == NULL);
121+ TEST_COMPARE (errno, EINVAL);
122+
123+ return 0;
124+}
125+
126+#include <support/test-driver.c>
diff --git a/meta/recipes-core/glibc/glibc/0002-CVE-2022-23219.patch b/meta/recipes-core/glibc/glibc/0002-CVE-2022-23219.patch
new file mode 100644
index 0000000000..6779e9afdf
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0002-CVE-2022-23219.patch
@@ -0,0 +1,89 @@
1From ef972a4c50014a16132b5c75571cfb6b30bef136 Mon Sep 17 00:00:00 2001
2From: Martin Sebor <msebor@redhat.com>
3Date: Mon, 17 Jan 2022 10:21:34 +0100
4Subject: [PATCH] sunrpc: Test case for clnt_create "unix" buffer overflow (bug
5 22542)
6
7Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=ef972a4c50014a16132b5c75571cfb6b30bef136]
8CVE: CVE-2022-23219
9
10Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
11Signed-off-by: Pgowda <pgowda.cve@gmail.com>
12---
13 sunrpc/Makefile | 5 ++++-
14 sunrpc/tst-bug22542.c | 44 +++++++++++++++++++++++++++++++++++++++++++
15 2 files changed, 48 insertions(+), 1 deletion(-)
16 create mode 100644 sunrpc/tst-bug22542.c
17
18diff --git a/sunrpc/Makefile b/sunrpc/Makefile
19index 9a31fe48b9..183ef3dc55 100644
20--- a/sunrpc/Makefile
21+++ b/sunrpc/Makefile
22@@ -65,7 +65,7 @@ shared-only-routines = $(routines)
23 endif
24
25 tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error tst-udp-timeout \
26- tst-udp-nonblocking tst-bug28768
27+ tst-udp-nonblocking tst-bug22542 tst-bug28768
28 xtests := tst-getmyaddr
29
30 ifeq ($(have-thread-library),yes)
31@@ -110,6 +110,8 @@ $(objpfx)tst-udp-nonblocking: $(common-o
32 $(objpfx)tst-udp-garbage: \
33 $(common-objpfx)linkobj/libc.so $(shared-thread-library)
34
35+$(objpfx)tst-bug22542: $(common-objpfx)linkobj/libc.so
36+
37 else # !have-GLIBC_2.31
38
39 routines = $(routines-for-nss)
40diff --git a/sunrpc/tst-bug22542.c b/sunrpc/tst-bug22542.c
41new file mode 100644
42index 0000000000..d6cd79787b
43--- /dev/null
44+++ b/sunrpc/tst-bug22542.c
45@@ -0,0 +1,44 @@
46+/* Test to verify that overlong hostname is rejected by clnt_create
47+ and doesn't cause a buffer overflow (bug 22542).
48+
49+ Copyright (C) 2022 Free Software Foundation, Inc.
50+ This file is part of the GNU C Library.
51+
52+ The GNU C Library is free software; you can redistribute it and/or
53+ modify it under the terms of the GNU Lesser General Public
54+ License as published by the Free Software Foundation; either
55+ version 2.1 of the License, or (at your option) any later version.
56+
57+ The GNU C Library is distributed in the hope that it will be useful,
58+ but WITHOUT ANY WARRANTY; without even the implied warranty of
59+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
60+ Lesser General Public License for more details.
61+
62+ You should have received a copy of the GNU Lesser General Public
63+ License along with the GNU C Library; if not, see
64+ <http://www.gnu.org/licenses/>. */
65+
66+#include <errno.h>
67+#include <rpc/clnt.h>
68+#include <string.h>
69+#include <support/check.h>
70+#include <sys/socket.h>
71+#include <sys/un.h>
72+
73+static int
74+do_test (void)
75+{
76+ /* Create an arbitrary hostname that's longer than fits in sun_path. */
77+ char name [sizeof ((struct sockaddr_un*)0)->sun_path * 2];
78+ memset (name, 'x', sizeof name - 1);
79+ name [sizeof name - 1] = '\0';
80+
81+ errno = 0;
82+ CLIENT *clnt = clnt_create (name, 0, 0, "unix");
83+
84+ TEST_VERIFY (clnt == NULL);
85+ TEST_COMPARE (errno, EINVAL);
86+ return 0;
87+}
88+
89+#include <support/test-driver.c>
diff --git a/meta/recipes-core/glibc/glibc_2.34.bb b/meta/recipes-core/glibc/glibc_2.34.bb
index 7206477278..6ceb677731 100644
--- a/meta/recipes-core/glibc/glibc_2.34.bb
+++ b/meta/recipes-core/glibc/glibc_2.34.bb
@@ -59,6 +59,14 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
59 file://0002-CVE-2021-38604.patch \ 59 file://0002-CVE-2021-38604.patch \
60 file://0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \ 60 file://0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \
61 file://CVE-2021-43396.patch \ 61 file://CVE-2021-43396.patch \
62 file://0001-CVE-2022-23218.patch \
63 file://0002-CVE-2022-23218.patch \
64 file://0001-CVE-2022-23219.patch \
65 file://0002-CVE-2022-23219.patch \
66 file://0001-CVE-2021-3998.patch \
67 file://0002-CVE-2021-3998.patch \
68 file://0001-CVE-2021-3999.patch \
69 file://0002-CVE-2021-3999.patch \
62 " 70 "
63S = "${WORKDIR}/git" 71S = "${WORKDIR}/git"
64B = "${WORKDIR}/build-${TARGET_SYS}" 72B = "${WORKDIR}/build-${TARGET_SYS}"
@@ -90,7 +98,7 @@ EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \
90 98
91EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}" 99EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}"
92 100
93EXTRA_OECONF:append:x86 = " --enable-cet" 101EXTRA_OECONF:append:x86 = " ${@bb.utils.contains_any('TUNE_FEATURES', 'i586 c3', '--disable-cet', '--enable-cet', d)}"
94EXTRA_OECONF:append:x86-64 = " --enable-cet" 102EXTRA_OECONF:append:x86-64 = " --enable-cet"
95 103
96PACKAGECONFIG ??= "nscd memory-tagging" 104PACKAGECONFIG ??= "nscd memory-tagging"
diff --git a/meta/recipes-core/images/build-appliance-image_15.0.0.bb b/meta/recipes-core/images/build-appliance-image_15.0.0.bb
index 94cafdbbe4..e8151ac982 100644
--- a/meta/recipes-core/images/build-appliance-image_15.0.0.bb
+++ b/meta/recipes-core/images/build-appliance-image_15.0.0.bb
@@ -24,7 +24,7 @@ IMAGE_FSTYPES = "wic.vmdk wic.vhd wic.vhdx"
24 24
25inherit core-image setuptools3 25inherit core-image setuptools3
26 26
27SRCREV ?= "156767d3ed6f044a6b2dd43fc1fea13852e761a2" 27SRCREV ?= "3f17ee4ebef3103e290750d8cdd7d001fc306673"
28SRC_URI = "git://git.yoctoproject.org/poky;branch=honister \ 28SRC_URI = "git://git.yoctoproject.org/poky;branch=honister \
29 file://Yocto_Build_Appliance.vmx \ 29 file://Yocto_Build_Appliance.vmx \
30 file://Yocto_Build_Appliance.vmxf \ 30 file://Yocto_Build_Appliance.vmxf \
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/finish b/meta/recipes-core/initrdscripts/initramfs-framework/finish
index 717383ebac..f08a920867 100755
--- a/meta/recipes-core/initrdscripts/initramfs-framework/finish
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/finish
@@ -12,6 +12,18 @@ finish_run() {
12 fatal "ERROR: There's no '/dev' on rootfs." 12 fatal "ERROR: There's no '/dev' on rootfs."
13 fi 13 fi
14 14
15 # Unmount anything that was automounted by busybox via mdev-mount.sh.
16 # We're about to switch_root, and leaving anything mounted will prevent
17 # the next rootfs from modifying the block device. Ignore ROOT_DISK,
18 # if it was set by setup-live, because it'll be mounted over loopback
19 # to ROOTFS_DIR.
20 local dev
21 for dev in /run/media/*; do
22 if mountpoint -q "${dev}" && [ "${dev##*/}" != "${ROOT_DISK}" ]; then
23 umount -f "${dev}" || debug "Failed to unmount ${dev}"
24 fi
25 done
26
15 info "Switching root to '$ROOTFS_DIR'..." 27 info "Switching root to '$ROOTFS_DIR'..."
16 28
17 debug "Moving /dev, /proc and /sys onto rootfs..." 29 debug "Moving /dev, /proc and /sys onto rootfs..."
diff --git a/meta/recipes-core/libxml/libxml2/CVE-2022-23308-fix-regression.patch b/meta/recipes-core/libxml/libxml2/CVE-2022-23308-fix-regression.patch
new file mode 100644
index 0000000000..e188914613
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/CVE-2022-23308-fix-regression.patch
@@ -0,0 +1,99 @@
1From 646fe48d1c8a74310c409ddf81fe7df6700052af Mon Sep 17 00:00:00 2001
2From: Nick Wellnhofer <wellnhofer@aevum.de>
3Date: Tue, 22 Feb 2022 11:51:08 +0100
4Subject: [PATCH] Fix --without-valid build
5
6Regressed in commit 652dd12a.
7---
8 valid.c | 58 ++++++++++++++++++++++++++++-----------------------------
9 1 file changed, 29 insertions(+), 29 deletions(-)
10---
11
12From https://github.com/GNOME/libxml2.git
13 commit 646fe48d1c8a74310c409ddf81fe7df6700052af
14
15CVE: CVE-2022-23308
16Upstream-Status: Backport
17
18Signed-off-by: Joe Slater <joe.slater@windriver.com>
19
20
21diff --git a/valid.c b/valid.c
22index 8e596f1d..9684683a 100644
23--- a/valid.c
24+++ b/valid.c
25@@ -479,35 +479,6 @@ nodeVPop(xmlValidCtxtPtr ctxt)
26 return (ret);
27 }
28
29-/**
30- * xmlValidNormalizeString:
31- * @str: a string
32- *
33- * Normalize a string in-place.
34- */
35-static void
36-xmlValidNormalizeString(xmlChar *str) {
37- xmlChar *dst;
38- const xmlChar *src;
39-
40- if (str == NULL)
41- return;
42- src = str;
43- dst = str;
44-
45- while (*src == 0x20) src++;
46- while (*src != 0) {
47- if (*src == 0x20) {
48- while (*src == 0x20) src++;
49- if (*src != 0)
50- *dst++ = 0x20;
51- } else {
52- *dst++ = *src++;
53- }
54- }
55- *dst = 0;
56-}
57-
58 #ifdef DEBUG_VALID_ALGO
59 static void
60 xmlValidPrintNode(xmlNodePtr cur) {
61@@ -2636,6 +2607,35 @@ xmlDumpNotationTable(xmlBufferPtr buf, xmlNotationTablePtr table) {
62 (xmlDictOwns(dict, (const xmlChar *)(str)) == 0))) \
63 xmlFree((char *)(str));
64
65+/**
66+ * xmlValidNormalizeString:
67+ * @str: a string
68+ *
69+ * Normalize a string in-place.
70+ */
71+static void
72+xmlValidNormalizeString(xmlChar *str) {
73+ xmlChar *dst;
74+ const xmlChar *src;
75+
76+ if (str == NULL)
77+ return;
78+ src = str;
79+ dst = str;
80+
81+ while (*src == 0x20) src++;
82+ while (*src != 0) {
83+ if (*src == 0x20) {
84+ while (*src == 0x20) src++;
85+ if (*src != 0)
86+ *dst++ = 0x20;
87+ } else {
88+ *dst++ = *src++;
89+ }
90+ }
91+ *dst = 0;
92+}
93+
94 static int
95 xmlIsStreaming(xmlValidCtxtPtr ctxt) {
96 xmlParserCtxtPtr pctxt;
97--
982.35.1
99
diff --git a/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch b/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch
index 90fa193775..6f44275299 100644
--- a/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch
+++ b/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch
@@ -18,11 +18,11 @@ Signed-off-by: Tony Tascioglu <tony.tascioglu@windriver.com>
18 libxml.m4 | 190 ++---------------------------------------------------- 18 libxml.m4 | 190 ++----------------------------------------------------
19 1 file changed, 5 insertions(+), 185 deletions(-) 19 1 file changed, 5 insertions(+), 185 deletions(-)
20 20
21diff --git a/libxml.m4 b/libxml.m4 21Index: libxml2-2.9.13/libxml.m4
22index 09de9fe2..1c535853 100644 22===================================================================
23--- a/libxml.m4 23--- libxml2-2.9.13.orig/libxml.m4
24+++ b/libxml.m4 24+++ libxml2-2.9.13/libxml.m4
25@@ -1,192 +1,12 @@ 25@@ -1,191 +1,12 @@
26-# Configure paths for LIBXML2 26-# Configure paths for LIBXML2
27-# Simon Josefsson 2020-02-12 27-# Simon Josefsson 2020-02-12
28-# Fix autoconf 2.70+ warnings 28-# Fix autoconf 2.70+ warnings
@@ -147,9 +147,8 @@ index 09de9fe2..1c535853 100644
147- { 147- {
148- printf("\n*** An old version of libxml (%d.%d.%d) was found.\n", 148- printf("\n*** An old version of libxml (%d.%d.%d) was found.\n",
149- xml_major_version, xml_minor_version, xml_micro_version); 149- xml_major_version, xml_minor_version, xml_micro_version);
150- printf("*** You need a version of libxml newer than %d.%d.%d. The latest version of\n", 150- printf("*** You need a version of libxml newer than %d.%d.%d.\n",
151- major, minor, micro); 151- major, minor, micro);
152- printf("*** libxml is always available from ftp://ftp.xmlsoft.org.\n");
153- printf("***\n"); 152- printf("***\n");
154- printf("*** If you have already installed a sufficiently new version, this error\n"); 153- printf("*** If you have already installed a sufficiently new version, this error\n");
155- printf("*** probably means that the wrong copy of the xml2-config shell script is\n"); 154- printf("*** probably means that the wrong copy of the xml2-config shell script is\n");
@@ -220,6 +219,3 @@ index 09de9fe2..1c535853 100644
220- AC_SUBST(XML_LIBS) 219- AC_SUBST(XML_LIBS)
221- rm -f conf.xmltest 220- rm -f conf.xmltest
222 ]) 221 ])
223--
2242.7.4
225
diff --git a/meta/recipes-core/libxml/libxml2_2.9.12.bb b/meta/recipes-core/libxml/libxml2_2.9.13.bb
index c387587dfd..e361b53bfd 100644
--- a/meta/recipes-core/libxml/libxml2_2.9.12.bb
+++ b/meta/recipes-core/libxml/libxml2_2.9.13.bb
@@ -1,6 +1,6 @@
1SUMMARY = "XML C Parser Library and Toolkit" 1SUMMARY = "XML C Parser Library and Toolkit"
2DESCRIPTION = "The XML Parser Library allows for manipulation of XML files. Libxml2 exports Push and Pull type parser interfaces for both XML and HTML. It can do DTD validation at parse time, on a parsed document instance or with an arbitrary DTD. Libxml2 includes complete XPath, XPointer and Xinclude implementations. It also has a SAX like interface, which is designed to be compatible with Expat." 2DESCRIPTION = "The XML Parser Library allows for manipulation of XML files. Libxml2 exports Push and Pull type parser interfaces for both XML and HTML. It can do DTD validation at parse time, on a parsed document instance or with an arbitrary DTD. Libxml2 includes complete XPath, XPointer and Xinclude implementations. It also has a SAX like interface, which is designed to be compatible with Expat."
3HOMEPAGE = "http://www.xmlsoft.org/" 3HOMEPAGE = "https://gitlab.gnome.org/GNOME/libxml2"
4BUGTRACKER = "http://bugzilla.gnome.org/buglist.cgi?product=libxml2" 4BUGTRACKER = "http://bugzilla.gnome.org/buglist.cgi?product=libxml2"
5SECTION = "libs" 5SECTION = "libs"
6LICENSE = "MIT" 6LICENSE = "MIT"
@@ -11,19 +11,23 @@ LIC_FILES_CHKSUM = "file://Copyright;md5=2044417e2e5006b65a8b9067b683fcf1 \
11 11
12DEPENDS = "zlib virtual/libiconv" 12DEPENDS = "zlib virtual/libiconv"
13 13
14SRC_URI = "http://www.xmlsoft.org/sources/libxml2-${PV}.tar.gz;name=libtar \ 14inherit gnomebase
15 http://www.w3.org/XML/Test/xmlts20080827.tar.gz;subdir=${BP};name=testtar \ 15
16SRC_URI += "http://www.w3.org/XML/Test/xmlts20080827.tar.gz;subdir=${BP};name=testtar \
16 file://libxml-64bit.patch \ 17 file://libxml-64bit.patch \
17 file://runtest.patch \ 18 file://runtest.patch \
18 file://run-ptest \ 19 file://run-ptest \
19 file://python-sitepackages-dir.patch \ 20 file://python-sitepackages-dir.patch \
20 file://libxml-m4-use-pkgconfig.patch \
21 file://0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch \ 21 file://0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch \
22 file://fix-execution-of-ptests.patch \ 22 file://fix-execution-of-ptests.patch \
23 file://remove-fuzz-from-ptests.patch \ 23 file://remove-fuzz-from-ptests.patch \
24 file://libxml-m4-use-pkgconfig.patch \
24 " 25 "
26# will be in v2.9.14
27#
28SRC_URI += "file://CVE-2022-23308-fix-regression.patch"
25 29
26SRC_URI[libtar.sha256sum] = "c8d6681e38c56f172892c85ddc0852e1fd4b53b4209e7f4ebf17f7e2eae71d92" 30SRC_URI[archive.sha256sum] = "276130602d12fe484ecc03447ee5e759d0465558fbc9d6bd144e3745306ebf0e"
27SRC_URI[testtar.sha256sum] = "96151685cec997e1f9f3387e3626d61e6284d4d6e66e0e440c209286c03e9cc7" 31SRC_URI[testtar.sha256sum] = "96151685cec997e1f9f3387e3626d61e6284d4d6e66e0e440c209286c03e9cc7"
28 32
29BINCONFIG = "${bindir}/xml2-config" 33BINCONFIG = "${bindir}/xml2-config"
diff --git a/meta/recipes-core/ncurses/files/CVE-2021-39537.patch b/meta/recipes-core/ncurses/files/CVE-2021-39537.patch
new file mode 100644
index 0000000000..d63bf57e8d
--- /dev/null
+++ b/meta/recipes-core/ncurses/files/CVE-2021-39537.patch
@@ -0,0 +1,65 @@
1From e83ecbd26252bac163fc4377ef30edbd4acb0bad Mon Sep 17 00:00:00 2001
2From: Sven Joachim <svenjoac@gmx.de>
3Date: Mon, 1 Jun 2020 08:03:52 +0200
4Subject: [PATCH] Import upstream patch 20200531
5
620200531
7 + correct configure version-check/warnng for g++ to allow for 10.x
8 + re-enable "bel" in konsole-base (report by Nia Huang)
9 + add linux-s entry (patch by Alexandre Montaron).
10 + drop long-obsolete convert_configure.pl
11 + add test/test_parm.c, for checking tparm changes.
12 + improve parameter-checking for tparm, adding function _nc_tiparm() to
13 handle the most-used case, which accepts only numeric parameters
14 (report/testcase by "puppet-meteor").
15 + use a more conservative estimate of the buffer-size in lib_tparm.c's
16 save_text() and save_number(), in case the sprintf() function
17 passes-through unexpected characters from a format specifier
18 (report/testcase by "puppet-meteor").
19 + add a check for end-of-string in cvtchar to handle a malformed
20 string in infotocap (report/testcase by "puppet-meteor").
21
22CVE: CVE-2021-39537
23
24Upstream-Status: Backport [https://github.com/mirror/ncurses/commit/790a85dbd4a81d5f5d8dd02a44d84f01512ef443]
25
26Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
27---
28 ncurses/tinfo/captoinfo.c | 11 +-
29 1 file changed, 6 insertions(+), 2 deletions(-)
30
31diff --git a/ncurses/tinfo/captoinfo.c b/ncurses/tinfo/captoinfo.c
32index 8b3b83d1..9362105a 100644
33--- a/ncurses/tinfo/captoinfo.c
34+++ b/ncurses/tinfo/captoinfo.c
35@@ -98,7 +98,7 @@
36 #include <ctype.h>
37 #include <tic.h>
38
39-MODULE_ID("$Id: captoinfo.c,v 1.98 2020/02/02 23:34:34 tom Exp $")
40+MODULE_ID("$Id: captoinfo.c,v 1.99 2020/05/25 21:28:29 tom Exp $")
41
42 #if 0
43 #define DEBUG_THIS(p) DEBUG(9, p)
44@@ -216,12 +216,15 @@ cvtchar(register const char *sp)
45 }
46 break;
47 case '^':
48+ len = 2;
49 c = UChar(*++sp);
50- if (c == '?')
51+ if (c == '?') {
52 c = 127;
53- else
54+ } else if (c == '\0') {
55+ len = 1;
56+ } else {
57 c &= 0x1f;
58- len = 2;
59+ }
60 break;
61 default:
62 c = UChar(*sp);
63--
642.17.1
65
diff --git a/meta/recipes-core/ncurses/ncurses_6.2.bb b/meta/recipes-core/ncurses/ncurses_6.2.bb
index e7d7396a20..598c51b00b 100644
--- a/meta/recipes-core/ncurses/ncurses_6.2.bb
+++ b/meta/recipes-core/ncurses/ncurses_6.2.bb
@@ -3,6 +3,7 @@ require ncurses.inc
3SRC_URI += "file://0001-tic-hang.patch \ 3SRC_URI += "file://0001-tic-hang.patch \
4 file://0002-configure-reproducible.patch \ 4 file://0002-configure-reproducible.patch \
5 file://0003-gen-pkgconfig.in-Do-not-include-LDFLAGS-in-generated.patch \ 5 file://0003-gen-pkgconfig.in-Do-not-include-LDFLAGS-in-generated.patch \
6 file://CVE-2021-39537.patch \
6 " 7 "
7# commit id corresponds to the revision in package version 8# commit id corresponds to the revision in package version
8SRCREV = "a669013cd5e9d6434e5301348ea51baf306c93c4" 9SRCREV = "a669013cd5e9d6434e5301348ea51baf306c93c4"
diff --git a/meta/recipes-core/systemd/systemd-boot_249.3.bb b/meta/recipes-core/systemd/systemd-boot_249.7.bb
index b3d4e31e08..b3d4e31e08 100644
--- a/meta/recipes-core/systemd/systemd-boot_249.3.bb
+++ b/meta/recipes-core/systemd/systemd-boot_249.7.bb
diff --git a/meta/recipes-core/systemd/systemd.inc b/meta/recipes-core/systemd/systemd.inc
index 13b8b61af6..b77f847abd 100644
--- a/meta/recipes-core/systemd/systemd.inc
+++ b/meta/recipes-core/systemd/systemd.inc
@@ -14,7 +14,7 @@ LICENSE = "GPLv2 & LGPLv2.1"
14LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \ 14LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
15 file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c" 15 file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
16 16
17SRCREV = "090378dcb1de5ca66900503210e85d63075fa70a" 17SRCREV = "d4406e94a32d423d8a73deb7757fb09890afe2c4"
18SRCBRANCH = "v249-stable" 18SRCBRANCH = "v249-stable"
19SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH} \ 19SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH} \
20" 20"
diff --git a/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch b/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch
index 15fa0c4546..d03a1d9e76 100644
--- a/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch
+++ b/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch
@@ -1,4 +1,4 @@
1From 40acdb90031cfeb7140cee5205bce24f8c91d857 Mon Sep 17 00:00:00 2001 1From 5d730902f47498a2866b46875352f6810a01d67c Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 13:41:41 +0800 3Date: Mon, 25 Feb 2019 13:41:41 +0800
4Subject: [PATCH] don't use glibc-specific qsort_r 4Subject: [PATCH] don't use glibc-specific qsort_r
diff --git a/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch b/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch
index d0110a2388..eca52d0bda 100644
--- a/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch
+++ b/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch
@@ -1,4 +1,4 @@
1From 2a2f95b6dc16d2ea7a8e9349c6b19cc50c34777b Mon Sep 17 00:00:00 2001 1From 3b42a888685aee1776a12cff84a5fe0063378483 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 13:55:12 +0800 3Date: Mon, 25 Feb 2019 13:55:12 +0800
4Subject: [PATCH] missing_type.h: add __compare_fn_t and comparison_fn_t 4Subject: [PATCH] missing_type.h: add __compare_fn_t and comparison_fn_t
diff --git a/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch b/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch
index 1d61367da4..40ee43b155 100644
--- a/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch
+++ b/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch
@@ -1,4 +1,4 @@
1From b19f800e178516d4f4d344457647e4a018bd6855 Mon Sep 17 00:00:00 2001 1From 3e0df2c22bfd37bc62bf09a01ec498e40d3599de Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com> 2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Sat, 22 May 2021 20:26:24 +0200 3Date: Sat, 22 May 2021 20:26:24 +0200
4Subject: [PATCH] add fallback parse_printf_format implementation 4Subject: [PATCH] add fallback parse_printf_format implementation
@@ -23,7 +23,7 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com>
23 create mode 100644 src/basic/parse-printf-format.h 23 create mode 100644 src/basic/parse-printf-format.h
24 24
25diff --git a/meson.build b/meson.build 25diff --git a/meson.build b/meson.build
26index 738879eb21..1aa20b8246 100644 26index 5bdfd9753d..3421da3a4d 100644
27--- a/meson.build 27--- a/meson.build
28+++ b/meson.build 28+++ b/meson.build
29@@ -656,6 +656,7 @@ endif 29@@ -656,6 +656,7 @@ endif
@@ -35,10 +35,10 @@ index 738879eb21..1aa20b8246 100644
35 'valgrind/memcheck.h', 35 'valgrind/memcheck.h',
36 'valgrind/valgrind.h', 36 'valgrind/valgrind.h',
37diff --git a/src/basic/meson.build b/src/basic/meson.build 37diff --git a/src/basic/meson.build b/src/basic/meson.build
38index 9b016ce5e8..a9ce21b02e 100644 38index 452b965db3..4e64d883dc 100644
39--- a/src/basic/meson.build 39--- a/src/basic/meson.build
40+++ b/src/basic/meson.build 40+++ b/src/basic/meson.build
41@@ -322,6 +322,11 @@ endforeach 41@@ -321,6 +321,11 @@ endforeach
42 42
43 basic_sources += generated_gperf_headers 43 basic_sources += generated_gperf_headers
44 44
diff --git a/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch b/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch
index 0462d52d5e..efdd43708b 100644
--- a/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch
+++ b/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch
@@ -1,4 +1,4 @@
1From db6551741a3654d8e75aff93ea00fbff579f7b02 Mon Sep 17 00:00:00 2001 1From cef23a651ea200e30e1e6ed2a2564505e3a42d46 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 14:18:21 +0800 3Date: Mon, 25 Feb 2019 14:18:21 +0800
4Subject: [PATCH] src/basic/missing.h: check for missing strndupa 4Subject: [PATCH] src/basic/missing.h: check for missing strndupa
@@ -73,7 +73,7 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
73 51 files changed, 62 insertions(+) 73 51 files changed, 62 insertions(+)
74 74
75diff --git a/meson.build b/meson.build 75diff --git a/meson.build b/meson.build
76index 1aa20b8246..aafee71eb4 100644 76index 3421da3a4d..ddef6fba91 100644
77--- a/meson.build 77--- a/meson.build
78+++ b/meson.build 78+++ b/meson.build
79@@ -480,6 +480,7 @@ foreach ident : ['secure_getenv', '__secure_getenv'] 79@@ -480,6 +480,7 @@ foreach ident : ['secure_getenv', '__secure_getenv']
@@ -109,7 +109,7 @@ index 1ff6160dc8..c9efd862a2 100644
109 static int cg_enumerate_items(const char *controller, const char *path, FILE **_f, const char *item) { 109 static int cg_enumerate_items(const char *controller, const char *path, FILE **_f, const char *item) {
110 _cleanup_free_ char *fs = NULL; 110 _cleanup_free_ char *fs = NULL;
111diff --git a/src/basic/env-util.c b/src/basic/env-util.c 111diff --git a/src/basic/env-util.c b/src/basic/env-util.c
112index 81b1e3f10e..8fedcfd1cd 100644 112index 1ca445dab4..1f5a212d4e 100644
113--- a/src/basic/env-util.c 113--- a/src/basic/env-util.c
114+++ b/src/basic/env-util.c 114+++ b/src/basic/env-util.c
115@@ -18,6 +18,7 @@ 115@@ -18,6 +18,7 @@
@@ -165,7 +165,7 @@ index f91f8f7a08..fb31596216 100644
165 int mkdir_safe_internal( 165 int mkdir_safe_internal(
166 const char *path, 166 const char *path,
167diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c 167diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c
168index 8c836a1b74..2eb7e5a634 100644 168index 7e57d9a226..c0e64f2aca 100644
169--- a/src/basic/mountpoint-util.c 169--- a/src/basic/mountpoint-util.c
170+++ b/src/basic/mountpoint-util.c 170+++ b/src/basic/mountpoint-util.c
171@@ -11,6 +11,7 @@ 171@@ -11,6 +11,7 @@
@@ -273,7 +273,7 @@ index 84c3caf3a5..0fa84eaa38 100644
273 BUS_DEFINE_PROPERTY_GET(bus_property_get_tasks_max, "t", TasksMax, tasks_max_resolve); 273 BUS_DEFINE_PROPERTY_GET(bus_property_get_tasks_max, "t", TasksMax, tasks_max_resolve);
274 274
275diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c 275diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
276index 50daef6702..1cc6d91e64 100644 276index 902e074bd2..ac15b944e6 100644
277--- a/src/core/dbus-execute.c 277--- a/src/core/dbus-execute.c
278+++ b/src/core/dbus-execute.c 278+++ b/src/core/dbus-execute.c
279@@ -42,6 +42,7 @@ 279@@ -42,6 +42,7 @@
@@ -297,7 +297,7 @@ index ca9b399d8c..b864480a8c 100644
297 int bus_property_get_triggered_unit( 297 int bus_property_get_triggered_unit(
298 sd_bus *bus, 298 sd_bus *bus,
299diff --git a/src/core/execute.c b/src/core/execute.c 299diff --git a/src/core/execute.c b/src/core/execute.c
300index 2a337b55a2..2a64675c5f 100644 300index 2f2de4d9cf..515b2fe748 100644
301--- a/src/core/execute.c 301--- a/src/core/execute.c
302+++ b/src/core/execute.c 302+++ b/src/core/execute.c
303@@ -98,6 +98,7 @@ 303@@ -98,6 +98,7 @@
@@ -321,7 +321,7 @@ index a56f12f47f..6b8729ef67 100644
321 #if HAVE_KMOD 321 #if HAVE_KMOD
322 #include "module-util.h" 322 #include "module-util.h"
323diff --git a/src/core/service.c b/src/core/service.c 323diff --git a/src/core/service.c b/src/core/service.c
324index cb0a528f0d..740d305710 100644 324index 7b90822f68..4af076eeba 100644
325--- a/src/core/service.c 325--- a/src/core/service.c
326+++ b/src/core/service.c 326+++ b/src/core/service.c
327@@ -41,6 +41,7 @@ 327@@ -41,6 +41,7 @@
@@ -357,7 +357,7 @@ index ae1d43756a..24de98c9f3 100644
357 #define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-remote.pem" 357 #define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-remote.pem"
358 #define CERT_FILE CERTIFICATE_ROOT "/certs/journal-remote.pem" 358 #define CERT_FILE CERTIFICATE_ROOT "/certs/journal-remote.pem"
359diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c 359diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
360index c8fb726d42..858a425d12 100644 360index 3eac97510d..db6913bc7a 100644
361--- a/src/journal/journalctl.c 361--- a/src/journal/journalctl.c
362+++ b/src/journal/journalctl.c 362+++ b/src/journal/journalctl.c
363@@ -72,6 +72,7 @@ 363@@ -72,6 +72,7 @@
@@ -393,7 +393,7 @@ index bfd42aea7d..daefc56e3e 100644
393 static int node_vtable_get_userdata( 393 static int node_vtable_get_userdata(
394 sd_bus *bus, 394 sd_bus *bus,
395diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c 395diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c
396index 378774fe8b..2694c177d5 100644 396index 09eb49c37f..82f1b3d1be 100644
397--- a/src/libsystemd/sd-bus/bus-socket.c 397--- a/src/libsystemd/sd-bus/bus-socket.c
398+++ b/src/libsystemd/sd-bus/bus-socket.c 398+++ b/src/libsystemd/sd-bus/bus-socket.c
399@@ -27,6 +27,7 @@ 399@@ -27,6 +27,7 @@
@@ -405,7 +405,7 @@ index 378774fe8b..2694c177d5 100644
405 #define SNDBUF_SIZE (8*1024*1024) 405 #define SNDBUF_SIZE (8*1024*1024)
406 406
407diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c 407diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
408index a32e2f5e20..97fd3aec82 100644 408index ab8d4e4a60..7e35fbe9e6 100644
409--- a/src/libsystemd/sd-bus/sd-bus.c 409--- a/src/libsystemd/sd-bus/sd-bus.c
410+++ b/src/libsystemd/sd-bus/sd-bus.c 410+++ b/src/libsystemd/sd-bus/sd-bus.c
411@@ -42,6 +42,7 @@ 411@@ -42,6 +42,7 @@
@@ -429,7 +429,7 @@ index 13c08fe295..9aae83486e 100644
429 #define MAX_SIZE (2*1024*1024) 429 #define MAX_SIZE (2*1024*1024)
430 430
431diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c 431diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c
432index 5728c537bc..94885b0bf6 100644 432index b3240177cb..7e3ae2d24f 100644
433--- a/src/libsystemd/sd-journal/sd-journal.c 433--- a/src/libsystemd/sd-journal/sd-journal.c
434+++ b/src/libsystemd/sd-journal/sd-journal.c 434+++ b/src/libsystemd/sd-journal/sd-journal.c
435@@ -40,6 +40,7 @@ 435@@ -40,6 +40,7 @@
@@ -669,7 +669,7 @@ index 65c40de4c8..4ef9a0c6c8 100644
669 _printf_(2,3) 669 _printf_(2,3)
670 static void path_prepend(char **path, const char *fmt, ...) { 670 static void path_prepend(char **path, const char *fmt, ...) {
671diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c 671diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
672index b28089be71..a7e2232299 100644 672index 9854270b27..71b5fab1e7 100644
673--- a/src/udev/udev-event.c 673--- a/src/udev/udev-event.c
674+++ b/src/udev/udev-event.c 674+++ b/src/udev/udev-event.c
675@@ -34,6 +34,7 @@ 675@@ -34,6 +34,7 @@
diff --git a/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch b/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch
index 855607e6a8..3875753ff4 100644
--- a/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch
+++ b/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch
@@ -1,4 +1,4 @@
1From d7ae3aadc70555932e03349907f8be04d03a50ee Mon Sep 17 00:00:00 2001 1From a3be3b7160856ffb8259ede9e2e0168d74bf126e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 26 Oct 2017 22:10:42 -0700 3Date: Thu, 26 Oct 2017 22:10:42 -0700
4Subject: [PATCH] Include netinet/if_ether.h 4Subject: [PATCH] Include netinet/if_ether.h
@@ -103,7 +103,7 @@ index 5ad396a57e..1dc007fe13 100644
103-#endif /* _UAPI_LINUX_IN6_H */ 103-#endif /* _UAPI_LINUX_IN6_H */
104+#endif /* _LINUX_IN6_H */ 104+#endif /* _LINUX_IN6_H */
105diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c 105diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
106index e8c47f429a..359922c1b3 100644 106index efbf7d7df3..86906332b6 100644
107--- a/src/libsystemd-network/sd-dhcp6-client.c 107--- a/src/libsystemd-network/sd-dhcp6-client.c
108+++ b/src/libsystemd-network/sd-dhcp6-client.c 108+++ b/src/libsystemd-network/sd-dhcp6-client.c
109@@ -5,7 +5,6 @@ 109@@ -5,7 +5,6 @@
@@ -274,12 +274,13 @@ index 2b72b618fc..d0d4cfb384 100644
274 #include "sd-dhcp6-client.h" 274 #include "sd-dhcp6-client.h"
275 275
276diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c 276diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
277index 9421ce1aa6..3e37cbcc39 100644 277index 20675f2306..2884511ff3 100644
278--- a/src/network/networkd-link.c 278--- a/src/network/networkd-link.c
279+++ b/src/network/networkd-link.c 279+++ b/src/network/networkd-link.c
280@@ -1,8 +1,8 @@ 280@@ -1,9 +1,9 @@
281 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 281 /* SPDX-License-Identifier: LGPL-2.1-or-later */
282 282
283 #include <net/if.h>
283+#include <netinet/if_ether.h> 284+#include <netinet/if_ether.h>
284 #include <netinet/in.h> 285 #include <netinet/in.h>
285 #include <linux/if.h> 286 #include <linux/if.h>
@@ -299,7 +300,7 @@ index 850b4f449e..6f85d41328 100644
299 #include <netinet/in.h> 300 #include <netinet/in.h>
300 #include <linux/netdevice.h> 301 #include <linux/netdevice.h>
301diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c 302diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
302index 77a93beca9..3bf9ae8837 100644 303index eeba31c45d..0a2b0ed42b 100644
303--- a/src/network/networkd-route.c 304--- a/src/network/networkd-route.c
304+++ b/src/network/networkd-route.c 305+++ b/src/network/networkd-route.c
305@@ -1,5 +1,6 @@ 306@@ -1,5 +1,6 @@
@@ -310,7 +311,7 @@ index 77a93beca9..3bf9ae8837 100644
310 #include <linux/ipv6_route.h> 311 #include <linux/ipv6_route.h>
311 #include <linux/nexthop.h> 312 #include <linux/nexthop.h>
312diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c 313diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
313index 10c312c480..e44fbb5c35 100644 314index 13c4cedd10..6558d551ab 100644
314--- a/src/network/networkd-setlink.c 315--- a/src/network/networkd-setlink.c
315+++ b/src/network/networkd-setlink.c 316+++ b/src/network/networkd-setlink.c
316@@ -1,8 +1,8 @@ 317@@ -1,8 +1,8 @@
@@ -369,7 +370,7 @@ index 8dfe23691b..e269856337 100644
369 #include <netinet/ether.h> 370 #include <netinet/ether.h>
370 #include <unistd.h> 371 #include <unistd.h>
371diff --git a/src/udev/udev-builtin-net_setup_link.c b/src/udev/udev-builtin-net_setup_link.c 372diff --git a/src/udev/udev-builtin-net_setup_link.c b/src/udev/udev-builtin-net_setup_link.c
372index d40251331c..89566c05f5 100644 373index 5964e30bf1..52a18d7a7f 100644
373--- a/src/udev/udev-builtin-net_setup_link.c 374--- a/src/udev/udev-builtin-net_setup_link.c
374+++ b/src/udev/udev-builtin-net_setup_link.c 375+++ b/src/udev/udev-builtin-net_setup_link.c
375@@ -1,5 +1,6 @@ 376@@ -1,5 +1,6 @@
diff --git a/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch b/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
index 28846935e0..1d8c481467 100644
--- a/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
+++ b/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
@@ -1,4 +1,4 @@
1From e2d70a1735fc6b9d3c079814831ab0b1b2a9d1e0 Mon Sep 17 00:00:00 2001 1From fb068403b25002156435350165ea418a6338a313 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 14:56:21 +0800 3Date: Mon, 25 Feb 2019 14:56:21 +0800
4Subject: [PATCH] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not defined 4Subject: [PATCH] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not defined
diff --git a/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch b/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch
index 444e123854..c613581ef9 100644
--- a/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch
+++ b/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch
@@ -1,4 +1,4 @@
1From 3410d82c9d07aee3e951fc6ae0b41fc1a594e00d Mon Sep 17 00:00:00 2001 1From 7ca9887f84adba065dc2e59b3de55ace2fc72ec0 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 15:00:06 +0800 3Date: Mon, 25 Feb 2019 15:00:06 +0800
4Subject: [PATCH] add missing FTW_ macros for musl 4Subject: [PATCH] add missing FTW_ macros for musl
@@ -10,6 +10,7 @@ This is to avoid build failures like below for musl.
10Upstream-Status: Inappropriate [musl specific] 10Upstream-Status: Inappropriate [musl specific]
11 11
12Signed-off-by: Chen Qi <Qi.Chen@windriver.com> 12Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
13
13--- 14---
14 src/basic/missing_type.h | 20 ++++++++++++++++++++ 15 src/basic/missing_type.h | 20 ++++++++++++++++++++
15 src/shared/mount-setup.c | 1 + 16 src/shared/mount-setup.c | 1 +
diff --git a/meta/recipes-core/systemd/systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch b/meta/recipes-core/systemd/systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch
index 4670c232a5..0fc320420e 100644
--- a/meta/recipes-core/systemd/systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch
+++ b/meta/recipes-core/systemd/systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch
@@ -1,4 +1,4 @@
1From 1e3bc870ded807cff0d3771dd89a850d020df032 Mon Sep 17 00:00:00 2001 1From c7453b716ae308b89cf4b2b231a36ddd38a49752 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 15:03:47 +0800 3Date: Mon, 25 Feb 2019 15:03:47 +0800
4Subject: [PATCH] fix missing of __register_atfork for non-glibc builds 4Subject: [PATCH] fix missing of __register_atfork for non-glibc builds
@@ -12,7 +12,7 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
12 1 file changed, 7 insertions(+) 12 1 file changed, 7 insertions(+)
13 13
14diff --git a/src/basic/process-util.c b/src/basic/process-util.c 14diff --git a/src/basic/process-util.c b/src/basic/process-util.c
15index 14259ea8df..18681838ef 100644 15index 461bbfe9a5..2d06f9f60a 100644
16--- a/src/basic/process-util.c 16--- a/src/basic/process-util.c
17+++ b/src/basic/process-util.c 17+++ b/src/basic/process-util.c
18@@ -18,6 +18,9 @@ 18@@ -18,6 +18,9 @@
diff --git a/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch b/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch
index e6bb37a65e..ff981b8c74 100644
--- a/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch
+++ b/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch
@@ -1,4 +1,4 @@
1From eeacb75025d8f537d54c35256c5730c9aab15cde Mon Sep 17 00:00:00 2001 1From 856010e268a6aca8e5f02502457afe289bd877f1 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 15:12:41 +0800 3Date: Mon, 25 Feb 2019 15:12:41 +0800
4Subject: [PATCH] Use uintmax_t for handling rlim_t 4Subject: [PATCH] Use uintmax_t for handling rlim_t
@@ -87,10 +87,10 @@ index 23d108d5df..3e6fb438d7 100644
87 return 1; 87 return 1;
88 } 88 }
89diff --git a/src/core/execute.c b/src/core/execute.c 89diff --git a/src/core/execute.c b/src/core/execute.c
90index 2a64675c5f..dca1e0e3b6 100644 90index 515b2fe748..7693f2d9a0 100644
91--- a/src/core/execute.c 91--- a/src/core/execute.c
92+++ b/src/core/execute.c 92+++ b/src/core/execute.c
93@@ -5391,9 +5391,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) { 93@@ -5395,9 +5395,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
94 for (unsigned i = 0; i < RLIM_NLIMITS; i++) 94 for (unsigned i = 0; i < RLIM_NLIMITS; i++)
95 if (c->rlimit[i]) { 95 if (c->rlimit[i]) {
96 fprintf(f, "%sLimit%s: " RLIM_FMT "\n", 96 fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
diff --git a/meta/recipes-core/systemd/systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch b/meta/recipes-core/systemd/systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch
index 897e332f33..0ee871c92d 100644
--- a/meta/recipes-core/systemd/systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch
+++ b/meta/recipes-core/systemd/systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch
@@ -1,4 +1,4 @@
1From fa29a572faaeb6fb9ed0bc6802d17139773e1908 Mon Sep 17 00:00:00 2001 1From ad395dda5db9b1ae156be121cfc8a38960de6c55 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Wed, 28 Feb 2018 21:25:22 -0800 3Date: Wed, 28 Feb 2018 21:25:22 -0800
4Subject: [PATCH] test-sizeof.c: Disable tests for missing typedefs in musl 4Subject: [PATCH] test-sizeof.c: Disable tests for missing typedefs in musl
@@ -13,7 +13,7 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
13 1 file changed, 4 insertions(+) 13 1 file changed, 4 insertions(+)
14 14
15diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c 15diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c
16index 3c9dc180fa..e1a59d408c 100644 16index e36bee4e8f..4403c0aa52 100644
17--- a/src/test/test-sizeof.c 17--- a/src/test/test-sizeof.c
18+++ b/src/test/test-sizeof.c 18+++ b/src/test/test-sizeof.c
19@@ -55,8 +55,10 @@ int main(void) { 19@@ -55,8 +55,10 @@ int main(void) {
diff --git a/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch b/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
index 3bf706fc55..12a92b8739 100644
--- a/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
+++ b/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
@@ -1,4 +1,4 @@
1From 88c8922f9e4d221402d9cb2e04b9c82e89125827 Mon Sep 17 00:00:00 2001 1From 5d4c6b2f4b88b69b31f967371d2a6136c65dc3fd Mon Sep 17 00:00:00 2001
2From: Andre McCurdy <armccurdy@gmail.com> 2From: Andre McCurdy <armccurdy@gmail.com>
3Date: Tue, 10 Oct 2017 14:33:30 -0700 3Date: Tue, 10 Oct 2017 14:33:30 -0700
4Subject: [PATCH] don't pass AT_SYMLINK_NOFOLLOW flag to faccessat() 4Subject: [PATCH] don't pass AT_SYMLINK_NOFOLLOW flag to faccessat()
diff --git a/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch b/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch
index 74008714c1..bd7a0c4e8e 100644
--- a/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch
+++ b/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch
@@ -1,4 +1,4 @@
1From e07e9b998ad61b09555bc809aa15de9d2516787a Mon Sep 17 00:00:00 2001 1From 1803ea271b93370fdcf7ec497277344f1e775429 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 27 May 2018 08:36:44 -0700 3Date: Sun, 27 May 2018 08:36:44 -0700
4Subject: [PATCH] Define glibc compatible basename() for non-glibc systems 4Subject: [PATCH] Define glibc compatible basename() for non-glibc systems
diff --git a/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch b/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
index c5e20cbb80..7933b9e76e 100644
--- a/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
+++ b/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
@@ -1,4 +1,4 @@
1From 2f048d13e100158320bda248635b3c533ac9717b Mon Sep 17 00:00:00 2001 1From 30b08f76ea7f5c324afedf97f0867b76dac9f128 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Wed, 4 Jul 2018 15:00:44 +0800 3Date: Wed, 4 Jul 2018 15:00:44 +0800
4Subject: [PATCH] Do not disable buffering when writing to oom_score_adj 4Subject: [PATCH] Do not disable buffering when writing to oom_score_adj
@@ -25,7 +25,7 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com>
25 1 file changed, 1 insertion(+), 1 deletion(-) 25 1 file changed, 1 insertion(+), 1 deletion(-)
26 26
27diff --git a/src/basic/process-util.c b/src/basic/process-util.c 27diff --git a/src/basic/process-util.c b/src/basic/process-util.c
28index 18681838ef..0fa71ccce0 100644 28index 2d06f9f60a..f86bd0b7dc 100644
29--- a/src/basic/process-util.c 29--- a/src/basic/process-util.c
30+++ b/src/basic/process-util.c 30+++ b/src/basic/process-util.c
31@@ -1606,7 +1606,7 @@ int set_oom_score_adjust(int value) { 31@@ -1606,7 +1606,7 @@ int set_oom_score_adjust(int value) {
diff --git a/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch b/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
index 39804bd364..0b0d2a6431 100644
--- a/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
+++ b/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
@@ -1,4 +1,4 @@
1From 45148529792c0cda32fdd61610c8d5a700d541fa Mon Sep 17 00:00:00 2001 1From 873202f63f9f117c6e5a98e444cc709057042979 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Tue, 10 Jul 2018 15:40:17 +0800 3Date: Tue, 10 Jul 2018 15:40:17 +0800
4Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi 4Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
diff --git a/meta/recipes-core/systemd/systemd/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch b/meta/recipes-core/systemd/systemd/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch
index 365e2a36f1..e6507c5f89 100644
--- a/meta/recipes-core/systemd/systemd/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch
+++ b/meta/recipes-core/systemd/systemd/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch
@@ -1,4 +1,4 @@
1From 02a2772889d6cb08c9ca0561b52e7a9a80e50497 Mon Sep 17 00:00:00 2001 1From e7441559266074e7a33e3c11ff5cdaf5ba9c0e24 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 15:18:00 +0800 3Date: Mon, 25 Feb 2019 15:18:00 +0800
4Subject: [PATCH] Hide __start_BUS_ERROR_MAP and __stop_BUS_ERROR_MAP 4Subject: [PATCH] Hide __start_BUS_ERROR_MAP and __stop_BUS_ERROR_MAP
diff --git a/meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch b/meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch
index 8a6c03f312..eeff693bc4 100644
--- a/meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch
+++ b/meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch
@@ -1,4 +1,4 @@
1From 47c4ac80689077b1eb86cf05b4326b1ac345aedf Mon Sep 17 00:00:00 2001 1From 64f4d2eb976b9f23ce85b3655a876f7299eafd58 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 15:27:54 +0800 3Date: Mon, 25 Feb 2019 15:27:54 +0800
4Subject: [PATCH] missing_type.h: add __compar_d_fn_t definition 4Subject: [PATCH] missing_type.h: add __compar_d_fn_t definition
diff --git a/meta/recipes-core/systemd/systemd/0018-avoid-redefinition-of-prctl_mm_map-structure.patch b/meta/recipes-core/systemd/systemd/0018-avoid-redefinition-of-prctl_mm_map-structure.patch
index e75935a280..5ca5386289 100644
--- a/meta/recipes-core/systemd/systemd/0018-avoid-redefinition-of-prctl_mm_map-structure.patch
+++ b/meta/recipes-core/systemd/systemd/0018-avoid-redefinition-of-prctl_mm_map-structure.patch
@@ -1,4 +1,4 @@
1From 2cb33d8896a4ad2d3b489fed51f17d5e45dfb4fc Mon Sep 17 00:00:00 2001 1From d95330f328c23c1cd6c51aeca43f081746cf2899 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 15:44:54 +0800 3Date: Mon, 25 Feb 2019 15:44:54 +0800
4Subject: [PATCH] avoid redefinition of prctl_mm_map structure 4Subject: [PATCH] avoid redefinition of prctl_mm_map structure
diff --git a/meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch b/meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch
index 629c103627..d51ac4265a 100644
--- a/meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch
+++ b/meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch
@@ -1,4 +1,4 @@
1From 200a2a2e4f04a7b7078dd455fafbd6774240e30b Mon Sep 17 00:00:00 2001 1From 2284f2f44b1b30f10b9196e0f5c6d0a2e0c1871f Mon Sep 17 00:00:00 2001
2From: Alex Kiernan <alex.kiernan@gmail.com> 2From: Alex Kiernan <alex.kiernan@gmail.com>
3Date: Fri, 7 Aug 2020 15:19:27 +0000 3Date: Fri, 7 Aug 2020 15:19:27 +0000
4Subject: [PATCH] Handle missing LOCK_EX 4Subject: [PATCH] Handle missing LOCK_EX
diff --git a/meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch b/meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch
index ea6e82f466..2d272ed3e8 100644
--- a/meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch
+++ b/meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch
@@ -1,4 +1,4 @@
1From 6445b7737a89256f35adc56701a5c47b48618ced Mon Sep 17 00:00:00 2001 1From a6a25e1ecae91f48a4f87bf0cc17eaaf0a919ffe Mon Sep 17 00:00:00 2001
2From: Alex Kiernan <alex.kiernan@gmail.com> 2From: Alex Kiernan <alex.kiernan@gmail.com>
3Date: Fri, 7 Aug 2020 15:20:17 +0000 3Date: Fri, 7 Aug 2020 15:20:17 +0000
4Subject: [PATCH] Fix incompatible pointer type struct sockaddr_un * 4Subject: [PATCH] Fix incompatible pointer type struct sockaddr_un *
@@ -24,15 +24,15 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
24 1 file changed, 1 insertion(+), 1 deletion(-) 24 1 file changed, 1 insertion(+), 1 deletion(-)
25 25
26diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c 26diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
27index 04685fecba..90b12bb5bd 100644 27index 575b9da447..ff08ed23cc 100644
28--- a/src/nspawn/nspawn.c 28--- a/src/nspawn/nspawn.c
29+++ b/src/nspawn/nspawn.c 29+++ b/src/nspawn/nspawn.c
30@@ -5354,7 +5354,7 @@ static int cant_be_in_netns(void) { 30@@ -5354,7 +5354,7 @@ static int cant_be_in_netns(void) {
31 if (fd < 0) 31 if (fd < 0)
32 return log_error_errno(errno, "Failed to allocate udev control socket: %m"); 32 return log_error_errno(errno, "Failed to allocate udev control socket: %m");
33 33
34- if (connect(fd, &sa.un, SOCKADDR_UN_LEN(sa.un)) < 0) { 34- if (connect(fd, &sa.sa, SOCKADDR_UN_LEN(sa.un)) < 0) {
35+ if (connect(fd, (struct sockaddr *)&sa.un, SOCKADDR_UN_LEN(sa.un)) < 0) { 35+ if (connect(fd, (struct sockaddr *)&sa.sa, SOCKADDR_UN_LEN(sa.un)) < 0) {
36 36
37 if (errno == ENOENT || ERRNO_IS_DISCONNECT(errno)) 37 if (errno == ENOENT || ERRNO_IS_DISCONNECT(errno))
38 return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), 38 return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
diff --git a/meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch b/meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch
index 60c12b0740..3fe5aeab13 100644
--- a/meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch
+++ b/meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch
@@ -1,4 +1,4 @@
1From ae71bf2b97dc9d4760defd83463c1d305f332f22 Mon Sep 17 00:00:00 2001 1From 47472da6e8900773c26da8fd26699367447d97a6 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 16:53:06 +0800 3Date: Mon, 25 Feb 2019 16:53:06 +0800
4Subject: [PATCH] test-json.c: define M_PIl 4Subject: [PATCH] test-json.c: define M_PIl
diff --git a/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch b/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
index 6998bf0dd0..4df35d81d1 100644
--- a/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
+++ b/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
@@ -1,4 +1,4 @@
1From 3198690c2dbb4b457a04ef21914dc4d531540273 Mon Sep 17 00:00:00 2001 1From 0f9422780a569c79a4b28e44c79c70b4a354bd92 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Fri, 1 Mar 2019 15:22:15 +0800 3Date: Fri, 1 Mar 2019 15:22:15 +0800
4Subject: [PATCH] do not disable buffer in writing files 4Subject: [PATCH] do not disable buffer in writing files
@@ -134,7 +134,7 @@ index 955b18bd2a..6d89c90176 100644
134 log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m"); 134 log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
135 } 135 }
136diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c 136diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
137index 29530bb691..3ecf6a45a2 100644 137index 981218f52f..436aaaddb4 100644
138--- a/src/binfmt/binfmt.c 138--- a/src/binfmt/binfmt.c
139+++ b/src/binfmt/binfmt.c 139+++ b/src/binfmt/binfmt.c
140@@ -48,7 +48,7 @@ static int delete_rule(const char *rule) { 140@@ -48,7 +48,7 @@ static int delete_rule(const char *rule) {
@@ -165,7 +165,7 @@ index 29530bb691..3ecf6a45a2 100644
165 STRV_FOREACH(f, files) { 165 STRV_FOREACH(f, files) {
166 k = apply_file(*f, true); 166 k = apply_file(*f, true);
167diff --git a/src/core/main.c b/src/core/main.c 167diff --git a/src/core/main.c b/src/core/main.c
168index b32a19a1d8..4e1238853e 100644 168index c64c73883e..1ac185e946 100644
169--- a/src/core/main.c 169--- a/src/core/main.c
170+++ b/src/core/main.c 170+++ b/src/core/main.c
171@@ -1402,7 +1402,7 @@ static int bump_unix_max_dgram_qlen(void) { 171@@ -1402,7 +1402,7 @@ static int bump_unix_max_dgram_qlen(void) {
@@ -252,7 +252,7 @@ index cb01b25bc6..e92051268b 100644
252 log_error_errno(r, "Failed to move process: %m"); 252 log_error_errno(r, "Failed to move process: %m");
253 goto finish; 253 goto finish;
254diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c 254diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
255index 90b12bb5bd..6a1dafa094 100644 255index ff08ed23cc..e7c4a874a9 100644
256--- a/src/nspawn/nspawn.c 256--- a/src/nspawn/nspawn.c
257+++ b/src/nspawn/nspawn.c 257+++ b/src/nspawn/nspawn.c
258@@ -2751,7 +2751,7 @@ static int reset_audit_loginuid(void) { 258@@ -2751,7 +2751,7 @@ static int reset_audit_loginuid(void) {
diff --git a/meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch b/meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch
index 06702765ee..e001ed59e8 100644
--- a/meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch
+++ b/meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch
@@ -1,4 +1,4 @@
1From b04518c464b526f8b9adc9ce3c08b1881db47989 Mon Sep 17 00:00:00 2001 1From e4f9ef547fa342102db15188544daa18e71e9c66 Mon Sep 17 00:00:00 2001
2From: Scott Murray <scott.murray@konsulko.com> 2From: Scott Murray <scott.murray@konsulko.com>
3Date: Fri, 13 Sep 2019 19:26:27 -0400 3Date: Fri, 13 Sep 2019 19:26:27 -0400
4Subject: [PATCH] Handle __cpu_mask usage 4Subject: [PATCH] Handle __cpu_mask usage
@@ -38,7 +38,7 @@ index 3c63a58826..4c2d4347fc 100644
38 typedef struct CPUSet { 38 typedef struct CPUSet {
39 cpu_set_t *set; 39 cpu_set_t *set;
40diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c 40diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c
41index e1a59d408c..c269ea6e8c 100644 41index 4403c0aa52..e7e4ae112d 100644
42--- a/src/test/test-sizeof.c 42--- a/src/test/test-sizeof.c
43+++ b/src/test/test-sizeof.c 43+++ b/src/test/test-sizeof.c
44@@ -1,6 +1,5 @@ 44@@ -1,6 +1,5 @@
diff --git a/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch b/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch
index dc63305825..e9b7c1c078 100644
--- a/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch
+++ b/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch
@@ -1,4 +1,4 @@
1From 0c8935128b39864b07dfee39cfa9d35d48f056aa Mon Sep 17 00:00:00 2001 1From 66a926cf906260c2fb5ea851e55efe03edd444dc Mon Sep 17 00:00:00 2001
2From: Alex Kiernan <alex.kiernan@gmail.com> 2From: Alex Kiernan <alex.kiernan@gmail.com>
3Date: Tue, 10 Mar 2020 11:05:20 +0000 3Date: Tue, 10 Mar 2020 11:05:20 +0000
4Subject: [PATCH] Handle missing gshadow 4Subject: [PATCH] Handle missing gshadow
diff --git a/meta/recipes-core/systemd/systemd/0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch b/meta/recipes-core/systemd/systemd/0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch
index ff96a720c5..b7fd3cddbb 100644
--- a/meta/recipes-core/systemd/systemd/0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch
+++ b/meta/recipes-core/systemd/systemd/0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch
@@ -1,4 +1,4 @@
1From f5d7fee9620cbcf52be8f8ba477890d28cadfbc8 Mon Sep 17 00:00:00 2001 1From 6f0dd2ba75b68036d7b4ebfe47ac5eaf44d26f06 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 12 Apr 2021 23:44:53 -0700 3Date: Mon, 12 Apr 2021 23:44:53 -0700
4Subject: [PATCH] missing_syscall.h: Define MIPS ABI defines for musl 4Subject: [PATCH] missing_syscall.h: Define MIPS ABI defines for musl
diff --git a/meta/recipes-core/systemd/systemd_249.3.bb b/meta/recipes-core/systemd/systemd_249.7.bb
index f8c85dabf0..c94a18140e 100644
--- a/meta/recipes-core/systemd/systemd_249.3.bb
+++ b/meta/recipes-core/systemd/systemd_249.7.bb
@@ -385,7 +385,7 @@ SYSTEMD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', '${PN}-binfm
385SYSTEMD_SERVICE:${PN}-binfmt = "systemd-binfmt.service" 385SYSTEMD_SERVICE:${PN}-binfmt = "systemd-binfmt.service"
386 386
387USERADD_PACKAGES = "${PN} ${PN}-extra-utils \ 387USERADD_PACKAGES = "${PN} ${PN}-extra-utils \
388 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gateway', '', d)} \ 388 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \
389 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \ 389 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \
390 ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \ 390 ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
391" 391"
@@ -397,7 +397,7 @@ USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit', '--syste
397USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /sbin/nologin systemd-resolve;', '', d)}" 397USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /sbin/nologin systemd-resolve;', '', d)}"
398USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /sbin/nologin systemd-timesync;', '', d)}" 398USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /sbin/nologin systemd-timesync;', '', d)}"
399USERADD_PARAM:${PN}-extra-utils = "--system -d / -M --shell /sbin/nologin systemd-bus-proxy" 399USERADD_PARAM:${PN}-extra-utils = "--system -d / -M --shell /sbin/nologin systemd-bus-proxy"
400USERADD_PARAM:${PN}-journal-gateway = "--system -d / -M --shell /sbin/nologin systemd-journal-gateway" 400USERADD_PARAM:${PN}-journal-gatewayd = "--system -d / -M --shell /sbin/nologin systemd-journal-gateway"
401USERADD_PARAM:${PN}-journal-remote = "--system -d / -M --shell /sbin/nologin systemd-journal-remote" 401USERADD_PARAM:${PN}-journal-remote = "--system -d / -M --shell /sbin/nologin systemd-journal-remote"
402USERADD_PARAM:${PN}-journal-upload = "--system -d / -M --shell /sbin/nologin systemd-journal-upload" 402USERADD_PARAM:${PN}-journal-upload = "--system -d / -M --shell /sbin/nologin systemd-journal-upload"
403 403
diff --git a/meta/recipes-core/util-linux/util-linux-libuuid_2.37.2.bb b/meta/recipes-core/util-linux/util-linux-libuuid_2.37.4.bb
index 5d759aed94..5d759aed94 100644
--- a/meta/recipes-core/util-linux/util-linux-libuuid_2.37.2.bb
+++ b/meta/recipes-core/util-linux/util-linux-libuuid_2.37.4.bb
diff --git a/meta/recipes-core/util-linux/util-linux.inc b/meta/recipes-core/util-linux/util-linux.inc
index 1e3cd28801..c48f9572f5 100644
--- a/meta/recipes-core/util-linux/util-linux.inc
+++ b/meta/recipes-core/util-linux/util-linux.inc
@@ -37,4 +37,4 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-lin
37 file://avoid_parallel_tests.patch \ 37 file://avoid_parallel_tests.patch \
38 " 38 "
39 39
40SRC_URI[sha256sum] = "6a0764c1aae7fb607ef8a6dd2c0f6c47d5e5fd27aa08820abaad9ec14e28e9d9" 40SRC_URI[sha256sum] = "634e6916ad913366c3536b6468e7844769549b99a7b2bf80314de78ab5655b83"
diff --git a/meta/recipes-core/util-linux/util-linux_2.37.2.bb b/meta/recipes-core/util-linux/util-linux_2.37.4.bb
index d609c30067..d609c30067 100644
--- a/meta/recipes-core/util-linux/util-linux_2.37.2.bb
+++ b/meta/recipes-core/util-linux/util-linux_2.37.4.bb
diff --git a/meta/recipes-core/volatile-binds/files/volatile-binds.service.in b/meta/recipes-core/volatile-binds/files/volatile-binds.service.in
index e2ad39f258..0c1c79d0c4 100644
--- a/meta/recipes-core/volatile-binds/files/volatile-binds.service.in
+++ b/meta/recipes-core/volatile-binds/files/volatile-binds.service.in
@@ -1,6 +1,6 @@
1[Unit] 1[Unit]
2Description=Bind mount volatile @where@ 2Description=Bind mount volatile @where@
3DefaultDependencies=false 3DefaultDependencies=no
4Before=local-fs.target 4Before=local-fs.target
5RequiresMountsFor=@whatparent@ @whereparent@ 5RequiresMountsFor=@whatparent@ @whereparent@
6ConditionPathIsReadWrite=@whatparent@ 6ConditionPathIsReadWrite=@whatparent@
diff --git a/meta/recipes-core/zlib/zlib/CVE-2018-25032.patch b/meta/recipes-core/zlib/zlib/CVE-2018-25032.patch
new file mode 100644
index 0000000000..5cb6183641
--- /dev/null
+++ b/meta/recipes-core/zlib/zlib/CVE-2018-25032.patch
@@ -0,0 +1,347 @@
1CVE: CVE-2018-25032
2Upstream-Status: Backport
3Signed-off-by: Ross Burton <ross.burton@arm.com>
4
5From 5c44459c3b28a9bd3283aaceab7c615f8020c531 Mon Sep 17 00:00:00 2001
6From: Mark Adler <madler@alumni.caltech.edu>
7Date: Tue, 17 Apr 2018 22:09:22 -0700
8Subject: [PATCH] Fix a bug that can crash deflate on some input when using
9 Z_FIXED.
10
11This bug was reported by Danilo Ramos of Eideticom, Inc. It has
12lain in wait 13 years before being found! The bug was introduced
13in zlib 1.2.2.2, with the addition of the Z_FIXED option. That
14option forces the use of fixed Huffman codes. For rare inputs with
15a large number of distant matches, the pending buffer into which
16the compressed data is written can overwrite the distance symbol
17table which it overlays. That results in corrupted output due to
18invalid distances, and can result in out-of-bound accesses,
19crashing the application.
20
21The fix here combines the distance buffer and literal/length
22buffers into a single symbol buffer. Now three bytes of pending
23buffer space are opened up for each literal or length/distance
24pair consumed, instead of the previous two bytes. This assures
25that the pending buffer cannot overwrite the symbol table, since
26the maximum fixed code compressed length/distance is 31 bits, and
27since there are four bytes of pending space for every three bytes
28of symbol space.
29---
30 deflate.c | 74 ++++++++++++++++++++++++++++++++++++++++---------------
31 deflate.h | 25 +++++++++----------
32 trees.c | 50 +++++++++++--------------------------
33 3 files changed, 79 insertions(+), 70 deletions(-)
34
35diff --git a/deflate.c b/deflate.c
36index 425babc00..19cba873a 100644
37--- a/deflate.c
38+++ b/deflate.c
39@@ -255,11 +255,6 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
40 int wrap = 1;
41 static const char my_version[] = ZLIB_VERSION;
42
43- ushf *overlay;
44- /* We overlay pending_buf and d_buf+l_buf. This works since the average
45- * output size for (length,distance) codes is <= 24 bits.
46- */
47-
48 if (version == Z_NULL || version[0] != my_version[0] ||
49 stream_size != sizeof(z_stream)) {
50 return Z_VERSION_ERROR;
51@@ -329,9 +324,47 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
52
53 s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
54
55- overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
56- s->pending_buf = (uchf *) overlay;
57- s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
58+ /* We overlay pending_buf and sym_buf. This works since the average size
59+ * for length/distance pairs over any compressed block is assured to be 31
60+ * bits or less.
61+ *
62+ * Analysis: The longest fixed codes are a length code of 8 bits plus 5
63+ * extra bits, for lengths 131 to 257. The longest fixed distance codes are
64+ * 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest
65+ * possible fixed-codes length/distance pair is then 31 bits total.
66+ *
67+ * sym_buf starts one-fourth of the way into pending_buf. So there are
68+ * three bytes in sym_buf for every four bytes in pending_buf. Each symbol
69+ * in sym_buf is three bytes -- two for the distance and one for the
70+ * literal/length. As each symbol is consumed, the pointer to the next
71+ * sym_buf value to read moves forward three bytes. From that symbol, up to
72+ * 31 bits are written to pending_buf. The closest the written pending_buf
73+ * bits gets to the next sym_buf symbol to read is just before the last
74+ * code is written. At that time, 31*(n-2) bits have been written, just
75+ * after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at
76+ * 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1
77+ * symbols are written.) The closest the writing gets to what is unread is
78+ * then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and
79+ * can range from 128 to 32768.
80+ *
81+ * Therefore, at a minimum, there are 142 bits of space between what is
82+ * written and what is read in the overlain buffers, so the symbols cannot
83+ * be overwritten by the compressed data. That space is actually 139 bits,
84+ * due to the three-bit fixed-code block header.
85+ *
86+ * That covers the case where either Z_FIXED is specified, forcing fixed
87+ * codes, or when the use of fixed codes is chosen, because that choice
88+ * results in a smaller compressed block than dynamic codes. That latter
89+ * condition then assures that the above analysis also covers all dynamic
90+ * blocks. A dynamic-code block will only be chosen to be emitted if it has
91+ * fewer bits than a fixed-code block would for the same set of symbols.
92+ * Therefore its average symbol length is assured to be less than 31. So
93+ * the compressed data for a dynamic block also cannot overwrite the
94+ * symbols from which it is being constructed.
95+ */
96+
97+ s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4);
98+ s->pending_buf_size = (ulg)s->lit_bufsize * 4;
99
100 if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
101 s->pending_buf == Z_NULL) {
102@@ -340,8 +373,12 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
103 deflateEnd (strm);
104 return Z_MEM_ERROR;
105 }
106- s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
107- s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
108+ s->sym_buf = s->pending_buf + s->lit_bufsize;
109+ s->sym_end = (s->lit_bufsize - 1) * 3;
110+ /* We avoid equality with lit_bufsize*3 because of wraparound at 64K
111+ * on 16 bit machines and because stored blocks are restricted to
112+ * 64K-1 bytes.
113+ */
114
115 s->level = level;
116 s->strategy = strategy;
117@@ -552,7 +589,7 @@ int ZEXPORT deflatePrime (strm, bits, value)
118
119 if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
120 s = strm->state;
121- if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3))
122+ if (s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3))
123 return Z_BUF_ERROR;
124 do {
125 put = Buf_size - s->bi_valid;
126@@ -1113,7 +1150,6 @@ int ZEXPORT deflateCopy (dest, source)
127 #else
128 deflate_state *ds;
129 deflate_state *ss;
130- ushf *overlay;
131
132
133 if (deflateStateCheck(source) || dest == Z_NULL) {
134@@ -1133,8 +1169,7 @@ int ZEXPORT deflateCopy (dest, source)
135 ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
136 ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
137 ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
138- overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
139- ds->pending_buf = (uchf *) overlay;
140+ ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4);
141
142 if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
143 ds->pending_buf == Z_NULL) {
144@@ -1148,8 +1183,7 @@ int ZEXPORT deflateCopy (dest, source)
145 zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
146
147 ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
148- ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
149- ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
150+ ds->sym_buf = ds->pending_buf + ds->lit_bufsize;
151
152 ds->l_desc.dyn_tree = ds->dyn_ltree;
153 ds->d_desc.dyn_tree = ds->dyn_dtree;
154@@ -1925,7 +1959,7 @@ local block_state deflate_fast(s, flush)
155 FLUSH_BLOCK(s, 1);
156 return finish_done;
157 }
158- if (s->last_lit)
159+ if (s->sym_next)
160 FLUSH_BLOCK(s, 0);
161 return block_done;
162 }
163@@ -2056,7 +2090,7 @@ local block_state deflate_slow(s, flush)
164 FLUSH_BLOCK(s, 1);
165 return finish_done;
166 }
167- if (s->last_lit)
168+ if (s->sym_next)
169 FLUSH_BLOCK(s, 0);
170 return block_done;
171 }
172@@ -2131,7 +2165,7 @@ local block_state deflate_rle(s, flush)
173 FLUSH_BLOCK(s, 1);
174 return finish_done;
175 }
176- if (s->last_lit)
177+ if (s->sym_next)
178 FLUSH_BLOCK(s, 0);
179 return block_done;
180 }
181@@ -2170,7 +2204,7 @@ local block_state deflate_huff(s, flush)
182 FLUSH_BLOCK(s, 1);
183 return finish_done;
184 }
185- if (s->last_lit)
186+ if (s->sym_next)
187 FLUSH_BLOCK(s, 0);
188 return block_done;
189 }
190diff --git a/deflate.h b/deflate.h
191index 23ecdd312..d4cf1a98b 100644
192--- a/deflate.h
193+++ b/deflate.h
194@@ -217,7 +217,7 @@ typedef struct internal_state {
195 /* Depth of each subtree used as tie breaker for trees of equal frequency
196 */
197
198- uchf *l_buf; /* buffer for literals or lengths */
199+ uchf *sym_buf; /* buffer for distances and literals/lengths */
200
201 uInt lit_bufsize;
202 /* Size of match buffer for literals/lengths. There are 4 reasons for
203@@ -239,13 +239,8 @@ typedef struct internal_state {
204 * - I can't count above 4
205 */
206
207- uInt last_lit; /* running index in l_buf */
208-
209- ushf *d_buf;
210- /* Buffer for distances. To simplify the code, d_buf and l_buf have
211- * the same number of elements. To use different lengths, an extra flag
212- * array would be necessary.
213- */
214+ uInt sym_next; /* running index in sym_buf */
215+ uInt sym_end; /* symbol table full when sym_next reaches this */
216
217 ulg opt_len; /* bit length of current block with optimal trees */
218 ulg static_len; /* bit length of current block with static trees */
219@@ -325,20 +320,22 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
220
221 # define _tr_tally_lit(s, c, flush) \
222 { uch cc = (c); \
223- s->d_buf[s->last_lit] = 0; \
224- s->l_buf[s->last_lit++] = cc; \
225+ s->sym_buf[s->sym_next++] = 0; \
226+ s->sym_buf[s->sym_next++] = 0; \
227+ s->sym_buf[s->sym_next++] = cc; \
228 s->dyn_ltree[cc].Freq++; \
229- flush = (s->last_lit == s->lit_bufsize-1); \
230+ flush = (s->sym_next == s->sym_end); \
231 }
232 # define _tr_tally_dist(s, distance, length, flush) \
233 { uch len = (uch)(length); \
234 ush dist = (ush)(distance); \
235- s->d_buf[s->last_lit] = dist; \
236- s->l_buf[s->last_lit++] = len; \
237+ s->sym_buf[s->sym_next++] = dist; \
238+ s->sym_buf[s->sym_next++] = dist >> 8; \
239+ s->sym_buf[s->sym_next++] = len; \
240 dist--; \
241 s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
242 s->dyn_dtree[d_code(dist)].Freq++; \
243- flush = (s->last_lit == s->lit_bufsize-1); \
244+ flush = (s->sym_next == s->sym_end); \
245 }
246 #else
247 # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
248diff --git a/trees.c b/trees.c
249index 4f4a65011..decaeb7c3 100644
250--- a/trees.c
251+++ b/trees.c
252@@ -416,7 +416,7 @@ local void init_block(s)
253
254 s->dyn_ltree[END_BLOCK].Freq = 1;
255 s->opt_len = s->static_len = 0L;
256- s->last_lit = s->matches = 0;
257+ s->sym_next = s->matches = 0;
258 }
259
260 #define SMALLEST 1
261@@ -948,7 +948,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
262
263 Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
264 opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
265- s->last_lit));
266+ s->sym_next / 3));
267
268 if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
269
270@@ -1017,8 +1017,9 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
271 unsigned dist; /* distance of matched string */
272 unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
273 {
274- s->d_buf[s->last_lit] = (ush)dist;
275- s->l_buf[s->last_lit++] = (uch)lc;
276+ s->sym_buf[s->sym_next++] = dist;
277+ s->sym_buf[s->sym_next++] = dist >> 8;
278+ s->sym_buf[s->sym_next++] = lc;
279 if (dist == 0) {
280 /* lc is the unmatched char */
281 s->dyn_ltree[lc].Freq++;
282@@ -1033,30 +1034,7 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
283 s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
284 s->dyn_dtree[d_code(dist)].Freq++;
285 }
286-
287-#ifdef TRUNCATE_BLOCK
288- /* Try to guess if it is profitable to stop the current block here */
289- if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
290- /* Compute an upper bound for the compressed length */
291- ulg out_length = (ulg)s->last_lit*8L;
292- ulg in_length = (ulg)((long)s->strstart - s->block_start);
293- int dcode;
294- for (dcode = 0; dcode < D_CODES; dcode++) {
295- out_length += (ulg)s->dyn_dtree[dcode].Freq *
296- (5L+extra_dbits[dcode]);
297- }
298- out_length >>= 3;
299- Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
300- s->last_lit, in_length, out_length,
301- 100L - out_length*100L/in_length));
302- if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
303- }
304-#endif
305- return (s->last_lit == s->lit_bufsize-1);
306- /* We avoid equality with lit_bufsize because of wraparound at 64K
307- * on 16 bit machines and because stored blocks are restricted to
308- * 64K-1 bytes.
309- */
310+ return (s->sym_next == s->sym_end);
311 }
312
313 /* ===========================================================================
314@@ -1069,13 +1047,14 @@ local void compress_block(s, ltree, dtree)
315 {
316 unsigned dist; /* distance of matched string */
317 int lc; /* match length or unmatched char (if dist == 0) */
318- unsigned lx = 0; /* running index in l_buf */
319+ unsigned sx = 0; /* running index in sym_buf */
320 unsigned code; /* the code to send */
321 int extra; /* number of extra bits to send */
322
323- if (s->last_lit != 0) do {
324- dist = s->d_buf[lx];
325- lc = s->l_buf[lx++];
326+ if (s->sym_next != 0) do {
327+ dist = s->sym_buf[sx++] & 0xff;
328+ dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8;
329+ lc = s->sym_buf[sx++];
330 if (dist == 0) {
331 send_code(s, lc, ltree); /* send a literal byte */
332 Tracecv(isgraph(lc), (stderr," '%c' ", lc));
333@@ -1100,11 +1079,10 @@ local void compress_block(s, ltree, dtree)
334 }
335 } /* literal or match pair ? */
336
337- /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
338- Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
339- "pendingBuf overflow");
340+ /* Check that the overlay between pending_buf and sym_buf is ok: */
341+ Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
342
343- } while (lx < s->last_lit);
344+ } while (sx < s->sym_next);
345
346 send_code(s, END_BLOCK, ltree);
347 }
diff --git a/meta/recipes-core/zlib/zlib_1.2.11.bb b/meta/recipes-core/zlib/zlib_1.2.11.bb
index 1c06aa0ab5..11a076e496 100644
--- a/meta/recipes-core/zlib/zlib_1.2.11.bb
+++ b/meta/recipes-core/zlib/zlib_1.2.11.bb
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://zlib.h;beginline=6;endline=23;md5=5377232268e952e9ef6
8 8
9SRC_URI = "${SOURCEFORGE_MIRROR}/libpng/${BPN}/${PV}/${BPN}-${PV}.tar.xz \ 9SRC_URI = "${SOURCEFORGE_MIRROR}/libpng/${BPN}/${PV}/${BPN}-${PV}.tar.xz \
10 file://ldflags-tests.patch \ 10 file://ldflags-tests.patch \
11 file://CVE-2018-25032.patch \
11 file://run-ptest \ 12 file://run-ptest \
12 " 13 "
13UPSTREAM_CHECK_URI = "http://zlib.net/" 14UPSTREAM_CHECK_URI = "http://zlib.net/"
diff --git a/meta/recipes-devtools/binutils/binutils-2.37.inc b/meta/recipes-devtools/binutils/binutils-2.37.inc
index 6093558e4b..f4427aef45 100644
--- a/meta/recipes-devtools/binutils/binutils-2.37.inc
+++ b/meta/recipes-devtools/binutils/binutils-2.37.inc
@@ -36,5 +36,7 @@ SRC_URI = "\
36 file://0015-sync-with-OE-libtool-changes.patch \ 36 file://0015-sync-with-OE-libtool-changes.patch \
37 file://0016-Check-for-clang-before-checking-gcc-version.patch \ 37 file://0016-Check-for-clang-before-checking-gcc-version.patch \
38 file://0017-bfd-Close-the-file-descriptor-if-there-is-no-archive.patch \ 38 file://0017-bfd-Close-the-file-descriptor-if-there-is-no-archive.patch \
39 file://0001-CVE-2021-42574.patch \
40 file://161e87d12167b1e36193385485c1f6ce92f74f02.patch \
39" 41"
40S = "${WORKDIR}/git" 42S = "${WORKDIR}/git"
diff --git a/meta/recipes-devtools/binutils/binutils/0001-CVE-2021-42574.patch b/meta/recipes-devtools/binutils/binutils/0001-CVE-2021-42574.patch
new file mode 100644
index 0000000000..0622ae389e
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/0001-CVE-2021-42574.patch
@@ -0,0 +1,2001 @@
1From b3aa80b45c4f46029efeb204bb9f2d2c4278a0e5 Mon Sep 17 00:00:00 2001
2From: Nick Clifton <nickc@redhat.com>
3Date: Tue, 9 Nov 2021 13:25:42 +0000
4Subject: [PATCH] Add --unicode option to control how unicode characters are
5 handled by display tools.
6
7 * nm.c: Add --unicode option to control how unicode characters are
8 handled.
9 * objdump.c: Likewise.
10 * readelf.c: Likewise.
11 * strings.c: Likewise.
12 * binutils.texi: Document the new feature.
13 * NEWS: Document the new feature.
14 * testsuite/binutils-all/unicode.exp: New file.
15 * testsuite/binutils-all/nm.hex.unicode
16 * testsuite/binutils-all/strings.escape.unicode
17 * testsuite/binutils-all/objdump.highlight.unicode
18 * testsuite/binutils-all/readelf.invalid.unicode
19
20CVE: CVE-2021-42574
21Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=b3aa80b45c4f46029efeb204bb9f2d2c4278a0e5]
22
23RP: Added tweak uint -> unsigned int partial backport of
24https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=795588aec4f894206863c938bd6d716895886009
25
26Signed-off-by: pgowda <pgowda.cve@gmail.com>
27---
28 binutils/ChangeLog | 15 +
29 binutils/NEWS | 9 +
30 binutils/doc/binutils.texi | 78 ++++
31 binutils/nm.c | 228 ++++++++++-
32 binutils/objdump.c | 235 ++++++++++--
33 binutils/readelf.c | 190 +++++++++-
34 binutils/strings.c | 757 ++++++++++++++++++++++++++++++++++---
35 7 files changed, 1409 insertions(+), 103 deletions(-)
36
37diff --git a/binutils/ChangeLog b/binutils/ChangeLog
38--- a/binutils/ChangeLog 2021-12-19 19:00:27.038540406 -0800
39+++ b/binutils/ChangeLog 2021-12-19 19:28:42.733565078 -0800
40@@ -1,3 +1,18 @@
41+2021-11-09 Nick Clifton <nickc@redhat.com>
42+
43+ * nm.c: Add --unicode option to control how unicode characters are
44+ handled.
45+ * objdump.c: Likewise.
46+ * readelf.c: Likewise.
47+ * strings.c: Likewise.
48+ * binutils.texi: Document the new feature.
49+ * NEWS: Document the new feature.
50+ * testsuite/binutils-all/unicode.exp: New file.
51+ * testsuite/binutils-all/nm.hex.unicode
52+ * testsuite/binutils-all/strings.escape.unicode
53+ * testsuite/binutils-all/objdump.highlight.unicode
54+ * testsuite/binutils-all/readelf.invalid.unicode
55+
56 2021-07-16 Nick Clifton <nickc@redhat.com>
57
58 * po/sv.po: Updated Swedish translation.
59diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi
60--- a/binutils/doc/binutils.texi 2021-12-19 19:00:27.042540338 -0800
61+++ b/binutils/doc/binutils.texi 2021-12-19 19:27:56.526354667 -0800
62@@ -812,6 +812,7 @@ nm [@option{-A}|@option{-o}|@option{--pr
63 [@option{-s}|@option{--print-armap}]
64 [@option{-t} @var{radix}|@option{--radix=}@var{radix}]
65 [@option{-u}|@option{--undefined-only}]
66+ [@option{-U} @var{method}] [@option{--unicode=}@var{method}]
67 [@option{-V}|@option{--version}]
68 [@option{-X 32_64}]
69 [@option{--defined-only}]
70@@ -1132,6 +1133,21 @@ Use @var{radix} as the radix for printin
71 @cindex undefined symbols
72 Display only undefined symbols (those external to each object file).
73
74+@item -U @var{[d|i|l|e|x|h]}
75+@itemx --unicode=@var{[default|invalid|locale|escape|hex|highlight]}
76+Controls the display of UTF-8 encoded mulibyte characters in strings.
77+The default (@option{--unicode=default}) is to give them no special
78+treatment. The @option{--unicode=locale} option displays the sequence
79+in the current locale, which may or may not support them. The options
80+@option{--unicode=hex} and @option{--unicode=invalid} display them as
81+hex byte sequences enclosed by either angle brackets or curly braces.
82+
83+The @option{--unicode=escape} option displays them as escape sequences
84+(@var{\uxxxx}) and the @option{--unicode=highlight} option displays
85+them as escape sequences highlighted in red (if supported by the
86+output device). The colouring is intended to draw attention to the
87+presence of unicode sequences where they might not be expected.
88+
89 @item -V
90 @itemx --version
91 Show the version number of @command{nm} and exit.
92@@ -2247,6 +2263,7 @@ objdump [@option{-a}|@option{--archive-h
93 [@option{--prefix-strip=}@var{level}]
94 [@option{--insn-width=}@var{width}]
95 [@option{--visualize-jumps[=color|=extended-color|=off]}
96+ [@option{-U} @var{method}] [@option{--unicode=}@var{method}]
97 [@option{-V}|@option{--version}]
98 [@option{-H}|@option{--help}]
99 @var{objfile}@dots{}
100@@ -2921,6 +2938,21 @@ When displaying symbols include those wh
101 special in some way and which would not normally be of interest to the
102 user.
103
104+@item -U @var{[d|i|l|e|x|h]}
105+@itemx --unicode=@var{[default|invalid|locale|escape|hex|highlight]}
106+Controls the display of UTF-8 encoded mulibyte characters in strings.
107+The default (@option{--unicode=default}) is to give them no special
108+treatment. The @option{--unicode=locale} option displays the sequence
109+in the current locale, which may or may not support them. The options
110+@option{--unicode=hex} and @option{--unicode=invalid} display them as
111+hex byte sequences enclosed by either angle brackets or curly braces.
112+
113+The @option{--unicode=escape} option displays them as escape sequences
114+(@var{\uxxxx}) and the @option{--unicode=highlight} option displays
115+them as escape sequences highlighted in red (if supported by the
116+output device). The colouring is intended to draw attention to the
117+presence of unicode sequences where they might not be expected.
118+
119 @item -V
120 @itemx --version
121 Print the version number of @command{objdump} and exit.
122@@ -3197,6 +3229,7 @@ strings [@option{-afovV}] [@option{-}@va
123 [@option{-n} @var{min-len}] [@option{--bytes=}@var{min-len}]
124 [@option{-t} @var{radix}] [@option{--radix=}@var{radix}]
125 [@option{-e} @var{encoding}] [@option{--encoding=}@var{encoding}]
126+ [@option{-U} @var{method}] [@option{--unicode=}@var{method}]
127 [@option{-}] [@option{--all}] [@option{--print-file-name}]
128 [@option{-T} @var{bfdname}] [@option{--target=}@var{bfdname}]
129 [@option{-w}] [@option{--include-all-whitespace}]
130@@ -3288,6 +3321,28 @@ single-8-bit-byte characters, @samp{b} =
131 littleendian. Useful for finding wide character strings. (@samp{l}
132 and @samp{b} apply to, for example, Unicode UTF-16/UCS-2 encodings).
133
134+@item -U @var{[d|i|l|e|x|h]}
135+@itemx --unicode=@var{[default|invalid|locale|escape|hex|highlight]}
136+Controls the display of UTF-8 encoded mulibyte characters in strings.
137+The default (@option{--unicode=default}) is to give them no special
138+treatment, and instead rely upon the setting of the
139+@option{--encoding} option. The other values for this option
140+automatically enable @option{--encoding=S}.
141+
142+The @option{--unicode=invalid} option treats them as non-graphic
143+characters and hence not part of a valid string. All the remaining
144+options treat them as valid string characters.
145+
146+The @option{--unicode=locale} option displays them in the current
147+locale, which may or may not support UTF-8 encoding. The
148+@option{--unicode=hex} option displays them as hex byte sequences
149+enclosed between @var{<>} characters. The @option{--unicode=escape}
150+option displays them as escape sequences (@var{\uxxxx}) and the
151+@option{--unicode=highlight} option displays them as escape sequences
152+highlighted in red (if supported by the output device). The colouring
153+is intended to draw attention to the presence of unicode sequences
154+where they might not be expected.
155+
156 @item -T @var{bfdname}
157 @itemx --target=@var{bfdname}
158 @cindex object code format
159@@ -4796,6 +4851,7 @@ readelf [@option{-a}|@option{--all}]
160 [@option{--demangle@var{=style}}|@option{--no-demangle}]
161 [@option{--quiet}]
162 [@option{--recurse-limit}|@option{--no-recurse-limit}]
163+ [@option{-U} @var{method}|@option{--unicode=}@var{method}]
164 [@option{-n}|@option{--notes}]
165 [@option{-r}|@option{--relocs}]
166 [@option{-u}|@option{--unwind}]
167@@ -4962,6 +5018,28 @@ necessary in order to demangle truly com
168 that if the recursion limit is disabled then stack exhaustion is
169 possible and any bug reports about such an event will be rejected.
170
171+@item -U @var{[d|i|l|e|x|h]}
172+@itemx --unicode=[default|invalid|locale|escape|hex|highlight]
173+Controls the display of non-ASCII characters in identifier names.
174+The default (@option{--unicode=locale} or @option{--unicode=default}) is
175+to treat them as multibyte characters and display them in the current
176+locale. All other versions of this option treat the bytes as UTF-8
177+encoded values and attempt to interpret them. If they cannot be
178+interpreted or if the @option{--unicode=invalid} option is used then
179+they are displayed as a sequence of hex bytes, encloses in curly
180+parethesis characters.
181+
182+Using the @option{--unicode=escape} option will display the characters
183+as as unicode escape sequences (@var{\uxxxx}). Using the
184+@option{--unicode=hex} will display the characters as hex byte
185+sequences enclosed between angle brackets.
186+
187+Using the @option{--unicode=highlight} will display the characters as
188+unicode escape sequences but it will also highlighted them in red,
189+assuming that colouring is supported by the output device. The
190+colouring is intended to draw attention to the presence of unicode
191+sequences when they might not be expected.
192+
193 @item -e
194 @itemx --headers
195 Display all the headers in the file. Equivalent to @option{-h -l -S}.
196diff --git a/binutils/NEWS b/binutils/NEWS
197--- a/binutils/NEWS 2021-12-19 19:00:27.038540406 -0800
198+++ b/binutils/NEWS 2021-12-19 19:30:04.764162972 -0800
199@@ -1,5 +1,14 @@
200 -*- text -*-
201
202+* Tools which display symbols or strings (readelf, strings, nm, objdump)
203+ have a new command line option which controls how unicode characters are
204+ handled. By default they are treated as normal for the tool. Using
205+ --unicode=locale will display them according to the current locale.
206+ Using --unicode=hex will display them as hex byte values, whilst
207+ --unicode=escape will display them as escape sequences. In addition
208+ using --unicode=highlight will display them as unicode escape sequences
209+ highlighted in red (if supported by the output device).
210+
211 Changes in 2.37:
212
213 * The readelf tool has a new command line option which can be used to specify
214diff --git a/binutils/nm.c b/binutils/nm.c
215--- a/binutils/nm.c 2021-12-19 19:00:27.046540270 -0800
216+++ b/binutils/nm.c 2021-12-19 19:36:34.797491555 -0800
217@@ -38,6 +38,11 @@
218 #include "bucomm.h"
219 #include "plugin-api.h"
220 #include "plugin.h"
221+#include "safe-ctype.h"
222+
223+#ifndef streq
224+#define streq(a,b) (strcmp ((a),(b)) == 0)
225+#endif
226
227 /* When sorting by size, we use this structure to hold the size and a
228 pointer to the minisymbol. */
229@@ -216,6 +221,18 @@ static const char *plugin_target = NULL;
230 static bfd *lineno_cache_bfd;
231 static bfd *lineno_cache_rel_bfd;
232
233+typedef enum unicode_display_type
234+{
235+ unicode_default = 0,
236+ unicode_locale,
237+ unicode_escape,
238+ unicode_hex,
239+ unicode_highlight,
240+ unicode_invalid
241+} unicode_display_type;
242+
243+static unicode_display_type unicode_display = unicode_default;
244+
245 enum long_option_values
246 {
247 OPTION_TARGET = 200,
248@@ -260,6 +277,7 @@ static struct option long_options[] =
249 {"target", required_argument, 0, OPTION_TARGET},
250 {"defined-only", no_argument, &defined_only, 1},
251 {"undefined-only", no_argument, &undefined_only, 1},
252+ {"unicode", required_argument, NULL, 'U'},
253 {"version", no_argument, &show_version, 1},
254 {"with-symbol-versions", no_argument, &with_symbol_versions, 1},
255 {"without-symbol-versions", no_argument, &with_symbol_versions, 0},
256@@ -313,6 +331,8 @@ usage (FILE *stream, int status)
257 -t, --radix=RADIX Use RADIX for printing symbol values\n\
258 --target=BFDNAME Specify the target object format as BFDNAME\n\
259 -u, --undefined-only Display only undefined symbols\n\
260+ -U {d|s|i|x|e|h} Specify how to treat UTF-8 encoded unicode characters\n\
261+ --unicode={default|show|invalid|hex|escape|highlight}\n\
262 --with-symbol-versions Display version strings after symbol names\n\
263 -X 32_64 (ignored)\n\
264 @FILE Read options from FILE\n\
265@@ -432,6 +452,187 @@ get_coff_symbol_type (const struct inter
266 return bufp;
267 }
268
269+/* Convert a potential UTF-8 encoded sequence in IN into characters in OUT.
270+ The conversion format is controlled by the unicode_display variable.
271+ Returns the number of characters added to OUT.
272+ Returns the number of bytes consumed from IN in CONSUMED.
273+ Always consumes at least one byte and displays at least one character. */
274+
275+static unsigned int
276+display_utf8 (const unsigned char * in, char * out, unsigned int * consumed)
277+{
278+ char * orig_out = out;
279+ unsigned int nchars = 0;
280+ unsigned int j;
281+
282+ if (unicode_display == unicode_default)
283+ goto invalid;
284+
285+ if (in[0] < 0xc0)
286+ goto invalid;
287+
288+ if ((in[1] & 0xc0) != 0x80)
289+ goto invalid;
290+
291+ if ((in[0] & 0x20) == 0)
292+ {
293+ nchars = 2;
294+ goto valid;
295+ }
296+
297+ if ((in[2] & 0xc0) != 0x80)
298+ goto invalid;
299+
300+ if ((in[0] & 0x10) == 0)
301+ {
302+ nchars = 3;
303+ goto valid;
304+ }
305+
306+ if ((in[3] & 0xc0) != 0x80)
307+ goto invalid;
308+
309+ nchars = 4;
310+
311+ valid:
312+ switch (unicode_display)
313+ {
314+ case unicode_locale:
315+ /* Copy the bytes into the output buffer as is. */
316+ memcpy (out, in, nchars);
317+ out += nchars;
318+ break;
319+
320+ case unicode_invalid:
321+ case unicode_hex:
322+ out += sprintf (out, "%c", unicode_display == unicode_hex ? '<' : '{');
323+ out += sprintf (out, "0x");
324+ for (j = 0; j < nchars; j++)
325+ out += sprintf (out, "%02x", in [j]);
326+ out += sprintf (out, "%c", unicode_display == unicode_hex ? '>' : '}');
327+ break;
328+
329+ case unicode_highlight:
330+ if (isatty (1))
331+ out += sprintf (out, "\x1B[31;47m"); /* Red. */
332+ /* Fall through. */
333+ case unicode_escape:
334+ switch (nchars)
335+ {
336+ case 2:
337+ out += sprintf (out, "\\u%02x%02x",
338+ ((in[0] & 0x1c) >> 2),
339+ ((in[0] & 0x03) << 6) | (in[1] & 0x3f));
340+ break;
341+
342+ case 3:
343+ out += sprintf (out, "\\u%02x%02x",
344+ ((in[0] & 0x0f) << 4) | ((in[1] & 0x3c) >> 2),
345+ ((in[1] & 0x03) << 6) | ((in[2] & 0x3f)));
346+ break;
347+
348+ case 4:
349+ out += sprintf (out, "\\u%02x%02x%02x",
350+ ((in[0] & 0x07) << 6) | ((in[1] & 0x3c) >> 2),
351+ ((in[1] & 0x03) << 6) | ((in[2] & 0x3c) >> 2),
352+ ((in[2] & 0x03) << 6) | ((in[3] & 0x3f)));
353+ break;
354+ default:
355+ /* URG. */
356+ break;
357+ }
358+
359+ if (unicode_display == unicode_highlight && isatty (1))
360+ out += sprintf (out, "\033[0m"); /* Default colour. */
361+ break;
362+
363+ default:
364+ /* URG */
365+ break;
366+ }
367+
368+ * consumed = nchars;
369+ return out - orig_out;
370+
371+ invalid:
372+ /* Not a valid UTF-8 sequence. */
373+ *out = *in;
374+ * consumed = 1;
375+ return 1;
376+}
377+
378+/* Convert any UTF-8 encoded characters in NAME into the form specified by
379+ unicode_display. Also converts control characters. Returns a static
380+ buffer if conversion was necessary.
381+ Code stolen from objdump.c:sanitize_string(). */
382+
383+static const char *
384+convert_utf8 (const char * in)
385+{
386+ static char * buffer = NULL;
387+ static size_t buffer_len = 0;
388+ const char * original = in;
389+ char * out;
390+
391+ /* Paranoia. */
392+ if (in == NULL)
393+ return "";
394+
395+ /* See if any conversion is necessary.
396+ In the majority of cases it will not be needed. */
397+ do
398+ {
399+ unsigned char c = *in++;
400+
401+ if (c == 0)
402+ return original;
403+
404+ if (ISCNTRL (c))
405+ break;
406+
407+ if (unicode_display != unicode_default && c >= 0xc0)
408+ break;
409+ }
410+ while (1);
411+
412+ /* Copy the input, translating as needed. */
413+ in = original;
414+ if (buffer_len < (strlen (in) * 9))
415+ {
416+ free ((void *) buffer);
417+ buffer_len = strlen (in) * 9;
418+ buffer = xmalloc (buffer_len + 1);
419+ }
420+
421+ out = buffer;
422+ do
423+ {
424+ unsigned char c = *in++;
425+
426+ if (c == 0)
427+ break;
428+
429+ if (ISCNTRL (c))
430+ {
431+ *out++ = '^';
432+ *out++ = c + 0x40;
433+ }
434+ else if (unicode_display != unicode_default && c >= 0xc0)
435+ {
436+ unsigned int num_consumed;
437+
438+ out += display_utf8 ((const unsigned char *)(in - 1), out, & num_consumed);
439+ in += num_consumed - 1;
440+ }
441+ else
442+ *out++ = c;
443+ }
444+ while (1);
445+
446+ *out = 0;
447+ return buffer;
448+}
449+
450 /* Print symbol name NAME, read from ABFD, with printf format FORM,
451 demangling it if requested. */
452
453@@ -444,6 +645,7 @@ print_symname (const char *form, struct
454
455 if (name == NULL)
456 name = info->sinfo->name;
457+
458 if (!with_symbol_versions
459 && bfd_get_flavour (abfd) == bfd_target_elf_flavour)
460 {
461@@ -451,6 +653,7 @@ print_symname (const char *form, struct
462 if (atver)
463 *atver = 0;
464 }
465+
466 if (do_demangle && *name)
467 {
468 alloc = bfd_demangle (abfd, name, demangle_flags);
469@@ -458,6 +661,11 @@ print_symname (const char *form, struct
470 name = alloc;
471 }
472
473+ if (unicode_display != unicode_default)
474+ {
475+ name = convert_utf8 (name);
476+ }
477+
478 if (info != NULL && info->elfinfo && with_symbol_versions)
479 {
480 const char *version_string;
481@@ -1807,7 +2015,7 @@ main (int argc, char **argv)
482 fatal (_("fatal error: libbfd ABI mismatch"));
483 set_default_bfd_target ();
484
485- while ((c = getopt_long (argc, argv, "aABCDef:gHhjJlnopPrSst:uvVvX:",
486+ while ((c = getopt_long (argc, argv, "aABCDef:gHhjJlnopPrSst:uU:vVvX:",
487 long_options, (int *) 0)) != EOF)
488 {
489 switch (c)
490@@ -1900,6 +2108,24 @@ main (int argc, char **argv)
491 case 'u':
492 undefined_only = 1;
493 break;
494+
495+ case 'U':
496+ if (streq (optarg, "default") || streq (optarg, "d"))
497+ unicode_display = unicode_default;
498+ else if (streq (optarg, "locale") || streq (optarg, "l"))
499+ unicode_display = unicode_locale;
500+ else if (streq (optarg, "escape") || streq (optarg, "e"))
501+ unicode_display = unicode_escape;
502+ else if (streq (optarg, "invalid") || streq (optarg, "i"))
503+ unicode_display = unicode_invalid;
504+ else if (streq (optarg, "hex") || streq (optarg, "x"))
505+ unicode_display = unicode_hex;
506+ else if (streq (optarg, "highlight") || streq (optarg, "h"))
507+ unicode_display = unicode_highlight;
508+ else
509+ fatal (_("invalid argument to -U/--unicode: %s"), optarg);
510+ break;
511+
512 case 'V':
513 show_version = 1;
514 break;
515diff --git a/binutils/objdump.c b/binutils/objdump.c
516--- a/binutils/objdump.c 2021-12-19 19:00:27.046540270 -0800
517+++ b/binutils/objdump.c 2021-12-19 19:43:09.438736729 -0800
518@@ -204,6 +204,18 @@ static const struct objdump_private_desc
519
520 /* The list of detected jumps inside a function. */
521 static struct jump_info *detected_jumps = NULL;
522+
523+typedef enum unicode_display_type
524+{
525+ unicode_default = 0,
526+ unicode_locale,
527+ unicode_escape,
528+ unicode_hex,
529+ unicode_highlight,
530+ unicode_invalid
531+} unicode_display_type;
532+
533+static unicode_display_type unicode_display = unicode_default;
534
535 static void usage (FILE *, int) ATTRIBUTE_NORETURN;
536 static void
537@@ -330,6 +342,9 @@ usage (FILE *stream, int status)
538 fprintf (stream, _("\
539 -w, --wide Format output for more than 80 columns\n"));
540 fprintf (stream, _("\
541+ -U[d|l|i|x|e|h] Controls the display of UTF-8 unicode characters\n\
542+ --unicode=[default|locale|invalid|hex|escape|highlight]\n"));
543+ fprintf (stream, _("\
544 -z, --disassemble-zeroes Do not skip blocks of zeroes when disassembling\n"));
545 fprintf (stream, _("\
546 --start-address=ADDR Only process data whose address is >= ADDR\n"));
547@@ -420,17 +435,23 @@ static struct option long_options[]=
548 {
549 {"adjust-vma", required_argument, NULL, OPTION_ADJUST_VMA},
550 {"all-headers", no_argument, NULL, 'x'},
551- {"private-headers", no_argument, NULL, 'p'},
552- {"private", required_argument, NULL, 'P'},
553 {"architecture", required_argument, NULL, 'm'},
554 {"archive-headers", no_argument, NULL, 'a'},
555+#ifdef ENABLE_LIBCTF
556+ {"ctf", required_argument, NULL, OPTION_CTF},
557+ {"ctf-parent", required_argument, NULL, OPTION_CTF_PARENT},
558+#endif
559 {"debugging", no_argument, NULL, 'g'},
560 {"debugging-tags", no_argument, NULL, 'e'},
561 {"demangle", optional_argument, NULL, 'C'},
562 {"disassemble", optional_argument, NULL, 'd'},
563 {"disassemble-all", no_argument, NULL, 'D'},
564- {"disassembler-options", required_argument, NULL, 'M'},
565 {"disassemble-zeroes", no_argument, NULL, 'z'},
566+ {"disassembler-options", required_argument, NULL, 'M'},
567+ {"dwarf", optional_argument, NULL, OPTION_DWARF},
568+ {"dwarf-check", no_argument, 0, OPTION_DWARF_CHECK},
569+ {"dwarf-depth", required_argument, 0, OPTION_DWARF_DEPTH},
570+ {"dwarf-start", required_argument, 0, OPTION_DWARF_START},
571 {"dynamic-reloc", no_argument, NULL, 'R'},
572 {"dynamic-syms", no_argument, NULL, 'T'},
573 {"endian", required_argument, NULL, OPTION_ENDIAN},
574@@ -440,16 +461,23 @@ static struct option long_options[]=
575 {"full-contents", no_argument, NULL, 's'},
576 {"headers", no_argument, NULL, 'h'},
577 {"help", no_argument, NULL, 'H'},
578+ {"include", required_argument, NULL, 'I'},
579 {"info", no_argument, NULL, 'i'},
580+ {"inlines", no_argument, 0, OPTION_INLINES},
581+ {"insn-width", required_argument, NULL, OPTION_INSN_WIDTH},
582 {"line-numbers", no_argument, NULL, 'l'},
583- {"no-show-raw-insn", no_argument, &show_raw_insn, -1},
584 {"no-addresses", no_argument, &no_addresses, 1},
585- {"process-links", no_argument, &process_links, true},
586+ {"no-recurse-limit", no_argument, NULL, OPTION_NO_RECURSE_LIMIT},
587+ {"no-recursion-limit", no_argument, NULL, OPTION_NO_RECURSE_LIMIT},
588+ {"no-show-raw-insn", no_argument, &show_raw_insn, -1},
589+ {"prefix", required_argument, NULL, OPTION_PREFIX},
590 {"prefix-addresses", no_argument, &prefix_addresses, 1},
591+ {"prefix-strip", required_argument, NULL, OPTION_PREFIX_STRIP},
592+ {"private", required_argument, NULL, 'P'},
593+ {"private-headers", no_argument, NULL, 'p'},
594+ {"process-links", no_argument, &process_links, true},
595 {"recurse-limit", no_argument, NULL, OPTION_RECURSE_LIMIT},
596 {"recursion-limit", no_argument, NULL, OPTION_RECURSE_LIMIT},
597- {"no-recurse-limit", no_argument, NULL, OPTION_NO_RECURSE_LIMIT},
598- {"no-recursion-limit", no_argument, NULL, OPTION_NO_RECURSE_LIMIT},
599 {"reloc", no_argument, NULL, 'r'},
600 {"section", required_argument, NULL, 'j'},
601 {"section-headers", no_argument, NULL, 'h'},
602@@ -457,28 +485,16 @@ static struct option long_options[]=
603 {"source", no_argument, NULL, 'S'},
604 {"source-comment", optional_argument, NULL, OPTION_SOURCE_COMMENT},
605 {"special-syms", no_argument, &dump_special_syms, 1},
606- {"include", required_argument, NULL, 'I'},
607- {"dwarf", optional_argument, NULL, OPTION_DWARF},
608-#ifdef ENABLE_LIBCTF
609- {"ctf", required_argument, NULL, OPTION_CTF},
610- {"ctf-parent", required_argument, NULL, OPTION_CTF_PARENT},
611-#endif
612 {"stabs", no_argument, NULL, 'G'},
613 {"start-address", required_argument, NULL, OPTION_START_ADDRESS},
614 {"stop-address", required_argument, NULL, OPTION_STOP_ADDRESS},
615 {"syms", no_argument, NULL, 't'},
616 {"target", required_argument, NULL, 'b'},
617+ {"unicode", required_argument, NULL, 'U'},
618 {"version", no_argument, NULL, 'V'},
619- {"wide", no_argument, NULL, 'w'},
620- {"prefix", required_argument, NULL, OPTION_PREFIX},
621- {"prefix-strip", required_argument, NULL, OPTION_PREFIX_STRIP},
622- {"insn-width", required_argument, NULL, OPTION_INSN_WIDTH},
623- {"dwarf-depth", required_argument, 0, OPTION_DWARF_DEPTH},
624- {"dwarf-start", required_argument, 0, OPTION_DWARF_START},
625- {"dwarf-check", no_argument, 0, OPTION_DWARF_CHECK},
626- {"inlines", no_argument, 0, OPTION_INLINES},
627 {"visualize-jumps", optional_argument, 0, OPTION_VISUALIZE_JUMPS},
628- {0, no_argument, 0, 0}
629+ {"wide", no_argument, NULL, 'w'},
630+ {NULL, no_argument, NULL, 0}
631 };
632
633 static void
634@@ -488,9 +504,121 @@ nonfatal (const char *msg)
635 exit_status = 1;
636 }
637
638+/* Convert a potential UTF-8 encoded sequence in IN into characters in OUT.
639+ The conversion format is controlled by the unicode_display variable.
640+ Returns the number of characters added to OUT.
641+ Returns the number of bytes consumed from IN in CONSUMED.
642+ Always consumes at least one byte and displays at least one character. */
643+
644+static unsigned int
645+display_utf8 (const unsigned char * in, char * out, unsigned int * consumed)
646+{
647+ char * orig_out = out;
648+ unsigned int nchars = 0;
649+ unsigned int j;
650+
651+ if (unicode_display == unicode_default)
652+ goto invalid;
653+
654+ if (in[0] < 0xc0)
655+ goto invalid;
656+
657+ if ((in[1] & 0xc0) != 0x80)
658+ goto invalid;
659+
660+ if ((in[0] & 0x20) == 0)
661+ {
662+ nchars = 2;
663+ goto valid;
664+ }
665+
666+ if ((in[2] & 0xc0) != 0x80)
667+ goto invalid;
668+
669+ if ((in[0] & 0x10) == 0)
670+ {
671+ nchars = 3;
672+ goto valid;
673+ }
674+
675+ if ((in[3] & 0xc0) != 0x80)
676+ goto invalid;
677+
678+ nchars = 4;
679+
680+ valid:
681+ switch (unicode_display)
682+ {
683+ case unicode_locale:
684+ /* Copy the bytes into the output buffer as is. */
685+ memcpy (out, in, nchars);
686+ out += nchars;
687+ break;
688+
689+ case unicode_invalid:
690+ case unicode_hex:
691+ out += sprintf (out, "%c", unicode_display == unicode_hex ? '<' : '{');
692+ out += sprintf (out, "0x");
693+ for (j = 0; j < nchars; j++)
694+ out += sprintf (out, "%02x", in [j]);
695+ out += sprintf (out, "%c", unicode_display == unicode_hex ? '>' : '}');
696+ break;
697+
698+ case unicode_highlight:
699+ if (isatty (1))
700+ out += sprintf (out, "\x1B[31;47m"); /* Red. */
701+ /* Fall through. */
702+ case unicode_escape:
703+ switch (nchars)
704+ {
705+ case 2:
706+ out += sprintf (out, "\\u%02x%02x",
707+ ((in[0] & 0x1c) >> 2),
708+ ((in[0] & 0x03) << 6) | (in[1] & 0x3f));
709+ break;
710+
711+ case 3:
712+ out += sprintf (out, "\\u%02x%02x",
713+ ((in[0] & 0x0f) << 4) | ((in[1] & 0x3c) >> 2),
714+ ((in[1] & 0x03) << 6) | ((in[2] & 0x3f)));
715+ break;
716+
717+ case 4:
718+ out += sprintf (out, "\\u%02x%02x%02x",
719+ ((in[0] & 0x07) << 6) | ((in[1] & 0x3c) >> 2),
720+ ((in[1] & 0x03) << 6) | ((in[2] & 0x3c) >> 2),
721+ ((in[2] & 0x03) << 6) | ((in[3] & 0x3f)));
722+ break;
723+ default:
724+ /* URG. */
725+ break;
726+ }
727+
728+ if (unicode_display == unicode_highlight && isatty (1))
729+ out += sprintf (out, "\033[0m"); /* Default colour. */
730+ break;
731+
732+ default:
733+ /* URG */
734+ break;
735+ }
736+
737+ * consumed = nchars;
738+ return out - orig_out;
739+
740+ invalid:
741+ /* Not a valid UTF-8 sequence. */
742+ *out = *in;
743+ * consumed = 1;
744+ return 1;
745+}
746+
747 /* Returns a version of IN with any control characters
748 replaced by escape sequences. Uses a static buffer
749- if necessary. */
750+ if necessary.
751+
752+ If unicode display is enabled, then also handles the
753+ conversion of unicode characters. */
754
755 static const char *
756 sanitize_string (const char * in)
757@@ -508,40 +636,50 @@ sanitize_string (const char * in)
758 of cases it will not be needed. */
759 do
760 {
761- char c = *in++;
762+ unsigned char c = *in++;
763
764 if (c == 0)
765 return original;
766
767 if (ISCNTRL (c))
768 break;
769+
770+ if (unicode_display != unicode_default && c >= 0xc0)
771+ break;
772 }
773 while (1);
774
775 /* Copy the input, translating as needed. */
776 in = original;
777- if (buffer_len < (strlen (in) * 2))
778+ if (buffer_len < (strlen (in) * 9))
779 {
780 free ((void *) buffer);
781- buffer_len = strlen (in) * 2;
782+ buffer_len = strlen (in) * 9;
783 buffer = xmalloc (buffer_len + 1);
784 }
785
786 out = buffer;
787 do
788 {
789- char c = *in++;
790+ unsigned char c = *in++;
791
792 if (c == 0)
793 break;
794
795- if (!ISCNTRL (c))
796- *out++ = c;
797- else
798+ if (ISCNTRL (c))
799 {
800 *out++ = '^';
801 *out++ = c + 0x40;
802 }
803+ else if (unicode_display != unicode_default && c >= 0xc0)
804+ {
805+ unsigned int num_consumed;
806+
807+ out += display_utf8 ((const unsigned char *)(in - 1), out, & num_consumed);
808+ in += num_consumed - 1;
809+ }
810+ else
811+ *out++ = c;
812 }
813 while (1);
814
815@@ -4529,6 +4667,24 @@ dump_symbols (bfd *abfd ATTRIBUTE_UNUSED
816 free (alloc);
817 }
818 }
819+ else if (unicode_display != unicode_default
820+ && name != NULL && *name != '\0')
821+ {
822+ const char * sanitized_name;
823+
824+ /* If we want to sanitize the name, we do it here, and
825+ temporarily clobber it while calling bfd_print_symbol.
826+ FIXME: This is a gross hack. */
827+ sanitized_name = sanitize_string (name);
828+ if (sanitized_name != name)
829+ (*current)->name = sanitized_name;
830+ else
831+ sanitized_name = NULL;
832+ bfd_print_symbol (cur_bfd, stdout, *current,
833+ bfd_print_symbol_all);
834+ if (sanitized_name != NULL)
835+ (*current)->name = name;
836+ }
837 else
838 bfd_print_symbol (cur_bfd, stdout, *current,
839 bfd_print_symbol_all);
840@@ -5212,7 +5368,7 @@ main (int argc, char **argv)
841 set_default_bfd_target ();
842
843 while ((c = getopt_long (argc, argv,
844- "pP:ib:m:M:VvCdDlfFaHhrRtTxsSI:j:wE:zgeGW::",
845+ "CDE:FGHI:LM:P:RSTU:VW::ab:defghij:lm:prstvwxz",
846 long_options, (int *) 0))
847 != EOF)
848 {
849@@ -5495,6 +5651,23 @@ main (int argc, char **argv)
850 seenflag = true;
851 break;
852
853+ case 'U':
854+ if (streq (optarg, "default") || streq (optarg, "d"))
855+ unicode_display = unicode_default;
856+ else if (streq (optarg, "locale") || streq (optarg, "l"))
857+ unicode_display = unicode_locale;
858+ else if (streq (optarg, "escape") || streq (optarg, "e"))
859+ unicode_display = unicode_escape;
860+ else if (streq (optarg, "invalid") || streq (optarg, "i"))
861+ unicode_display = unicode_invalid;
862+ else if (streq (optarg, "hex") || streq (optarg, "x"))
863+ unicode_display = unicode_hex;
864+ else if (streq (optarg, "highlight") || streq (optarg, "h"))
865+ unicode_display = unicode_highlight;
866+ else
867+ fatal (_("invalid argument to -U/--unicode: %s"), optarg);
868+ break;
869+
870 case 'H':
871 usage (stdout, 0);
872 /* No need to set seenflag or to break - usage() does not return. */
873diff --git a/binutils/readelf.c b/binutils/readelf.c
874--- a/binutils/readelf.c 2021-12-19 19:00:27.058540065 -0800
875+++ b/binutils/readelf.c 2021-12-19 19:27:56.538354462 -0800
876@@ -328,6 +328,19 @@ typedef enum print_mode
877 }
878 print_mode;
879
880+typedef enum unicode_display_type
881+{
882+ unicode_default = 0,
883+ unicode_locale,
884+ unicode_escape,
885+ unicode_hex,
886+ unicode_highlight,
887+ unicode_invalid
888+} unicode_display_type;
889+
890+static unicode_display_type unicode_display = unicode_default;
891+
892+
893 /* Versioned symbol info. */
894 enum versioned_symbol_info
895 {
896@@ -632,11 +645,18 @@ print_symbol (signed int width, const ch
897 if (c == 0)
898 break;
899
900- /* Do not print control characters directly as they can affect terminal
901- settings. Such characters usually appear in the names generated
902- by the assembler for local labels. */
903- if (ISCNTRL (c))
904+ if (ISPRINT (c))
905+ {
906+ putchar (c);
907+ width_remaining --;
908+ num_printed ++;
909+ }
910+ else if (ISCNTRL (c))
911 {
912+ /* Do not print control characters directly as they can affect terminal
913+ settings. Such characters usually appear in the names generated
914+ by the assembler for local labels. */
915+
916 if (width_remaining < 2)
917 break;
918
919@@ -644,11 +664,137 @@ print_symbol (signed int width, const ch
920 width_remaining -= 2;
921 num_printed += 2;
922 }
923- else if (ISPRINT (c))
924+ else if (c == 0x7f)
925 {
926- putchar (c);
927- width_remaining --;
928- num_printed ++;
929+ if (width_remaining < 5)
930+ break;
931+ printf ("<DEL>");
932+ width_remaining -= 5;
933+ num_printed += 5;
934+ }
935+ else if (unicode_display != unicode_locale
936+ && unicode_display != unicode_default)
937+ {
938+ /* Display unicode characters as something else. */
939+ unsigned char bytes[4];
940+ bool is_utf8;
941+ unsigned int nbytes;
942+
943+ bytes[0] = c;
944+
945+ if (bytes[0] < 0xc0)
946+ {
947+ nbytes = 1;
948+ is_utf8 = false;
949+ }
950+ else
951+ {
952+ bytes[1] = *symbol++;
953+
954+ if ((bytes[1] & 0xc0) != 0x80)
955+ {
956+ is_utf8 = false;
957+ /* Do not consume this character. It may only
958+ be the first byte in the sequence that was
959+ corrupt. */
960+ --symbol;
961+ nbytes = 1;
962+ }
963+ else if ((bytes[0] & 0x20) == 0)
964+ {
965+ is_utf8 = true;
966+ nbytes = 2;
967+ }
968+ else
969+ {
970+ bytes[2] = *symbol++;
971+
972+ if ((bytes[2] & 0xc0) != 0x80)
973+ {
974+ is_utf8 = false;
975+ symbol -= 2;
976+ nbytes = 1;
977+ }
978+ else if ((bytes[0] & 0x10) == 0)
979+ {
980+ is_utf8 = true;
981+ nbytes = 3;
982+ }
983+ else
984+ {
985+ bytes[3] = *symbol++;
986+
987+ nbytes = 4;
988+
989+ if ((bytes[3] & 0xc0) != 0x80)
990+ {
991+ is_utf8 = false;
992+ symbol -= 3;
993+ nbytes = 1;
994+ }
995+ else
996+ is_utf8 = true;
997+ }
998+ }
999+ }
1000+
1001+ if (unicode_display == unicode_invalid)
1002+ is_utf8 = false;
1003+
1004+ if (unicode_display == unicode_hex || ! is_utf8)
1005+ {
1006+ unsigned int i;
1007+
1008+ if (width_remaining < (nbytes * 2) + 2)
1009+ break;
1010+
1011+ putchar (is_utf8 ? '<' : '{');
1012+ printf ("0x");
1013+ for (i = 0; i < nbytes; i++)
1014+ printf ("%02x", bytes[i]);
1015+ putchar (is_utf8 ? '>' : '}');
1016+ }
1017+ else
1018+ {
1019+ if (unicode_display == unicode_highlight && isatty (1))
1020+ printf ("\x1B[31;47m"); /* Red. */
1021+
1022+ switch (nbytes)
1023+ {
1024+ case 2:
1025+ if (width_remaining < 6)
1026+ break;
1027+ printf ("\\u%02x%02x",
1028+ (bytes[0] & 0x1c) >> 2,
1029+ ((bytes[0] & 0x03) << 6) | (bytes[1] & 0x3f));
1030+ break;
1031+ case 3:
1032+ if (width_remaining < 6)
1033+ break;
1034+ printf ("\\u%02x%02x",
1035+ ((bytes[0] & 0x0f) << 4) | ((bytes[1] & 0x3c) >> 2),
1036+ ((bytes[1] & 0x03) << 6) | (bytes[2] & 0x3f));
1037+ break;
1038+ case 4:
1039+ if (width_remaining < 8)
1040+ break;
1041+ printf ("\\u%02x%02x%02x",
1042+ ((bytes[0] & 0x07) << 6) | ((bytes[1] & 0x3c) >> 2),
1043+ ((bytes[1] & 0x03) << 6) | ((bytes[2] & 0x3c) >> 2),
1044+ ((bytes[2] & 0x03) << 6) | (bytes[3] & 0x3f));
1045+
1046+ break;
1047+ default:
1048+ /* URG. */
1049+ break;
1050+ }
1051+
1052+ if (unicode_display == unicode_highlight && isatty (1))
1053+ printf ("\033[0m"); /* Default colour. */
1054+ }
1055+
1056+ if (bytes[nbytes - 1] == 0)
1057+ break;
1058 }
1059 else
1060 {
1061@@ -4668,6 +4814,7 @@ static struct option options[] =
1062 {"syms", no_argument, 0, 's'},
1063 {"silent-truncation",no_argument, 0, 'T'},
1064 {"section-details", no_argument, 0, 't'},
1065+ {"unicode", required_argument, NULL, 'U'},
1066 {"unwind", no_argument, 0, 'u'},
1067 {"version-info", no_argument, 0, 'V'},
1068 {"version", no_argument, 0, 'v'},
1069@@ -4744,6 +4891,12 @@ usage (FILE * stream)
1070 fprintf (stream, _("\
1071 --no-recurse-limit Disable a demangling recursion limit\n"));
1072 fprintf (stream, _("\
1073+ -U[dlexhi] --unicode=[default|locale|escape|hex|highlight|invalid]\n\
1074+ Display unicode characters as determined by the current locale\n\
1075+ (default), escape sequences, \"<hex sequences>\", highlighted\n\
1076+ escape sequences, or treat them as invalid and display as\n\
1077+ \"{hex sequences}\"\n"));
1078+ fprintf (stream, _("\
1079 -n --notes Display the core notes (if present)\n"));
1080 fprintf (stream, _("\
1081 -r --relocs Display the relocations (if present)\n"));
1082@@ -4928,7 +5081,7 @@ parse_args (struct dump_data *dumpdata,
1083 usage (stderr);
1084
1085 while ((c = getopt_long
1086- (argc, argv, "ACDHILNPR:STVWacdeghi:lnp:rstuvw::x:z", options, NULL)) != EOF)
1087+ (argc, argv, "ACDHILNPR:STU:VWacdeghi:lnp:rstuvw::x:z", options, NULL)) != EOF)
1088 {
1089 switch (c)
1090 {
1091@@ -5130,6 +5283,25 @@ parse_args (struct dump_data *dumpdata,
1092 /* Ignored for backward compatibility. */
1093 break;
1094
1095+ case 'U':
1096+ if (optarg == NULL)
1097+ error (_("Missing arg to -U/--unicode")); /* Can this happen ? */
1098+ else if (streq (optarg, "default") || streq (optarg, "d"))
1099+ unicode_display = unicode_default;
1100+ else if (streq (optarg, "locale") || streq (optarg, "l"))
1101+ unicode_display = unicode_locale;
1102+ else if (streq (optarg, "escape") || streq (optarg, "e"))
1103+ unicode_display = unicode_escape;
1104+ else if (streq (optarg, "invalid") || streq (optarg, "i"))
1105+ unicode_display = unicode_invalid;
1106+ else if (streq (optarg, "hex") || streq (optarg, "x"))
1107+ unicode_display = unicode_hex;
1108+ else if (streq (optarg, "highlight") || streq (optarg, "h"))
1109+ unicode_display = unicode_highlight;
1110+ else
1111+ error (_("invalid argument to -U/--unicode: %s"), optarg);
1112+ break;
1113+
1114 case OPTION_SYM_BASE:
1115 sym_base = 0;
1116 if (optarg != NULL)
1117diff --git a/binutils/strings.c b/binutils/strings.c
1118--- a/binutils/strings.c 2021-12-19 19:00:27.058540065 -0800
1119+++ b/binutils/strings.c 2021-12-19 19:48:26.205313218 -0800
1120@@ -55,6 +55,19 @@
1121 -T {bfdname}
1122 Specify a non-default object file format.
1123
1124+ --unicode={default|locale|invalid|hex|escape|highlight}
1125+ -u {d|l|i|x|e|h}
1126+ Determine how to handle UTF-8 unicode characters. The default
1127+ is no special treatment. All other versions of this option
1128+ only apply if the encoding is valid and enabling the option
1129+ implies --encoding=S.
1130+ The 'locale' option displays the characters according to the
1131+ current locale. The 'invalid' option treats them as
1132+ non-string characters. The 'hex' option displays them as hex
1133+ byte sequences. The 'escape' option displays them as escape
1134+ sequences and the 'highlight' option displays them as
1135+ coloured escape sequences.
1136+
1137 --output-separator=sep_string
1138 -s sep_string String used to separate parsed strings in output.
1139 Default is newline.
1140@@ -76,6 +89,22 @@
1141 #include "safe-ctype.h"
1142 #include "bucomm.h"
1143
1144+#ifndef streq
1145+#define streq(a,b) (strcmp ((a),(b)) == 0)
1146+#endif
1147+
1148+typedef enum unicode_display_type
1149+{
1150+ unicode_default = 0,
1151+ unicode_locale,
1152+ unicode_escape,
1153+ unicode_hex,
1154+ unicode_highlight,
1155+ unicode_invalid
1156+} unicode_display_type;
1157+
1158+static unicode_display_type unicode_display = unicode_default;
1159+
1160 #define STRING_ISGRAPHIC(c) \
1161 ( (c) >= 0 \
1162 && (c) <= 255 \
1163@@ -94,7 +123,7 @@ extern int errno;
1164 static int address_radix;
1165
1166 /* Minimum length of sequence of graphic chars to trigger output. */
1167-static int string_min;
1168+static unsigned int string_min;
1169
1170 /* Whether or not we include all whitespace as a graphic char. */
1171 static bool include_all_whitespace;
1172@@ -121,21 +150,22 @@ static char *output_separator;
1173 static struct option long_options[] =
1174 {
1175 {"all", no_argument, NULL, 'a'},
1176+ {"bytes", required_argument, NULL, 'n'},
1177 {"data", no_argument, NULL, 'd'},
1178+ {"encoding", required_argument, NULL, 'e'},
1179+ {"help", no_argument, NULL, 'h'},
1180+ {"include-all-whitespace", no_argument, NULL, 'w'},
1181+ {"output-separator", required_argument, NULL, 's'},
1182 {"print-file-name", no_argument, NULL, 'f'},
1183- {"bytes", required_argument, NULL, 'n'},
1184 {"radix", required_argument, NULL, 't'},
1185- {"include-all-whitespace", no_argument, NULL, 'w'},
1186- {"encoding", required_argument, NULL, 'e'},
1187 {"target", required_argument, NULL, 'T'},
1188- {"output-separator", required_argument, NULL, 's'},
1189- {"help", no_argument, NULL, 'h'},
1190+ {"unicode", required_argument, NULL, 'U'},
1191 {"version", no_argument, NULL, 'v'},
1192 {NULL, 0, NULL, 0}
1193 };
1194
1195 static bool strings_file (char *);
1196-static void print_strings (const char *, FILE *, file_ptr, int, int, char *);
1197+static void print_strings (const char *, FILE *, file_ptr, int, char *);
1198 static void usage (FILE *, int) ATTRIBUTE_NORETURN;
1199
1200 int main (int, char **);
1201@@ -171,7 +201,7 @@ main (int argc, char **argv)
1202 encoding = 's';
1203 output_separator = NULL;
1204
1205- while ((optc = getopt_long (argc, argv, "adfhHn:wot:e:T:s:Vv0123456789",
1206+ while ((optc = getopt_long (argc, argv, "adfhHn:wot:e:T:s:U:Vv0123456789",
1207 long_options, (int *) 0)) != EOF)
1208 {
1209 switch (optc)
1210@@ -244,6 +274,23 @@ main (int argc, char **argv)
1211 output_separator = optarg;
1212 break;
1213
1214+ case 'U':
1215+ if (streq (optarg, "default") || streq (optarg, "d"))
1216+ unicode_display = unicode_default;
1217+ else if (streq (optarg, "locale") || streq (optarg, "l"))
1218+ unicode_display = unicode_locale;
1219+ else if (streq (optarg, "escape") || streq (optarg, "e"))
1220+ unicode_display = unicode_escape;
1221+ else if (streq (optarg, "invalid") || streq (optarg, "i"))
1222+ unicode_display = unicode_invalid;
1223+ else if (streq (optarg, "hex") || streq (optarg, "x"))
1224+ unicode_display = unicode_hex;
1225+ else if (streq (optarg, "highlight") || streq (optarg, "h"))
1226+ unicode_display = unicode_highlight;
1227+ else
1228+ fatal (_("invalid argument to -U/--unicode: %s"), optarg);
1229+ break;
1230+
1231 case 'V':
1232 case 'v':
1233 print_version ("strings");
1234@@ -258,6 +305,9 @@ main (int argc, char **argv)
1235 }
1236 }
1237
1238+ if (unicode_display != unicode_default)
1239+ encoding = 'S';
1240+
1241 if (numeric_opt != 0)
1242 {
1243 string_min = (int) strtoul (argv[numeric_opt - 1] + 1, &s, 0);
1244@@ -293,14 +343,14 @@ main (int argc, char **argv)
1245 {
1246 datasection_only = false;
1247 SET_BINARY (fileno (stdin));
1248- print_strings ("{standard input}", stdin, 0, 0, 0, (char *) NULL);
1249+ print_strings ("{standard input}", stdin, 0, 0, (char *) NULL);
1250 files_given = true;
1251 }
1252 else
1253 {
1254 for (; optind < argc; ++optind)
1255 {
1256- if (strcmp (argv[optind], "-") == 0)
1257+ if (streq (argv[optind], "-"))
1258 datasection_only = false;
1259 else
1260 {
1261@@ -342,7 +392,7 @@ strings_a_section (bfd *abfd, asection *
1262 }
1263
1264 *got_a_section = true;
1265- print_strings (filename, NULL, sect->filepos, 0, sectsize, (char *) mem);
1266+ print_strings (filename, NULL, sect->filepos, sectsize, (char *) mem);
1267 free (mem);
1268 }
1269
1270@@ -427,7 +477,7 @@ strings_file (char *file)
1271 return false;
1272 }
1273
1274- print_strings (file, stream, (file_ptr) 0, 0, 0, (char *) 0);
1275+ print_strings (file, stream, (file_ptr) 0, 0, (char *) NULL);
1276
1277 if (fclose (stream) == EOF)
1278 {
1279@@ -551,6 +601,626 @@ unget_part_char (long c, file_ptr *addre
1280 }
1281 }
1282 }
1283+
1284+static void
1285+print_filename_and_address (const char * filename, file_ptr address)
1286+{
1287+ if (print_filenames)
1288+ printf ("%s: ", filename);
1289+
1290+ if (! print_addresses)
1291+ return;
1292+
1293+ switch (address_radix)
1294+ {
1295+ case 8:
1296+ if (sizeof (address) > sizeof (long))
1297+ {
1298+#ifndef __MSVCRT__
1299+ printf ("%7llo ", (unsigned long long) address);
1300+#else
1301+ printf ("%7I64o ", (unsigned long long) address);
1302+#endif
1303+ }
1304+ else
1305+ printf ("%7lo ", (unsigned long) address);
1306+ break;
1307+
1308+ case 10:
1309+ if (sizeof (address) > sizeof (long))
1310+ {
1311+#ifndef __MSVCRT__
1312+ printf ("%7llu ", (unsigned long long) address);
1313+#else
1314+ printf ("%7I64d ", (unsigned long long) address);
1315+#endif
1316+ }
1317+ else
1318+ printf ("%7ld ", (long) address);
1319+ break;
1320+
1321+ case 16:
1322+ if (sizeof (address) > sizeof (long))
1323+ {
1324+#ifndef __MSVCRT__
1325+ printf ("%7llx ", (unsigned long long) address);
1326+#else
1327+ printf ("%7I64x ", (unsigned long long) address);
1328+#endif
1329+ }
1330+ else
1331+ printf ("%7lx ", (unsigned long) address);
1332+ break;
1333+ }
1334+}
1335+
1336+/* Return non-zero if the bytes starting at BUFFER form a valid UTF-8 encoding.
1337+ If the encoding is valid then returns the number of bytes it uses. */
1338+
1339+static unsigned int
1340+is_valid_utf8 (const unsigned char * buffer, unsigned long buflen)
1341+{
1342+ if (buffer[0] < 0xc0)
1343+ return 0;
1344+
1345+ if (buflen < 2)
1346+ return 0;
1347+
1348+ if ((buffer[1] & 0xc0) != 0x80)
1349+ return 0;
1350+
1351+ if ((buffer[0] & 0x20) == 0)
1352+ return 2;
1353+
1354+ if (buflen < 3)
1355+ return 0;
1356+
1357+ if ((buffer[2] & 0xc0) != 0x80)
1358+ return 0;
1359+
1360+ if ((buffer[0] & 0x10) == 0)
1361+ return 3;
1362+
1363+ if (buflen < 4)
1364+ return 0;
1365+
1366+ if ((buffer[3] & 0xc0) != 0x80)
1367+ return 0;
1368+
1369+ return 4;
1370+}
1371+
1372+/* Display a UTF-8 encoded character in BUFFER according to the setting
1373+ of unicode_display. The character is known to be valid.
1374+ Returns the number of bytes consumed. */
1375+
1376+static unsigned int
1377+display_utf8_char (const unsigned char * buffer)
1378+{
1379+ unsigned int j;
1380+ unsigned int utf8_len;
1381+
1382+ switch (buffer[0] & 0x30)
1383+ {
1384+ case 0x00:
1385+ case 0x10:
1386+ utf8_len = 2;
1387+ break;
1388+ case 0x20:
1389+ utf8_len = 3;
1390+ break;
1391+ default:
1392+ utf8_len = 4;
1393+ }
1394+
1395+ switch (unicode_display)
1396+ {
1397+ default:
1398+ fprintf (stderr, "ICE: unexpected unicode display type\n");
1399+ break;
1400+
1401+ case unicode_escape:
1402+ case unicode_highlight:
1403+ if (unicode_display == unicode_highlight && isatty (1))
1404+ printf ("\x1B[31;47m"); /* Red. */
1405+
1406+ switch (utf8_len)
1407+ {
1408+ case 2:
1409+ printf ("\\u%02x%02x",
1410+ ((buffer[0] & 0x1c) >> 2),
1411+ ((buffer[0] & 0x03) << 6) | (buffer[1] & 0x3f));
1412+ break;
1413+
1414+ case 3:
1415+ printf ("\\u%02x%02x",
1416+ ((buffer[0] & 0x0f) << 4) | ((buffer[1] & 0x3c) >> 2),
1417+ ((buffer[1] & 0x03) << 6) | ((buffer[2] & 0x3f)));
1418+ break;
1419+
1420+ case 4:
1421+ printf ("\\u%02x%02x%02x",
1422+ ((buffer[0] & 0x07) << 6) | ((buffer[1] & 0x3c) >> 2),
1423+ ((buffer[1] & 0x03) << 6) | ((buffer[2] & 0x3c) >> 2),
1424+ ((buffer[2] & 0x03) << 6) | ((buffer[3] & 0x3f)));
1425+ break;
1426+ default:
1427+ /* URG. */
1428+ break;
1429+ }
1430+
1431+ if (unicode_display == unicode_highlight && isatty (1))
1432+ printf ("\033[0m"); /* Default colour. */
1433+ break;
1434+
1435+ case unicode_hex:
1436+ putchar ('<');
1437+ printf ("0x");
1438+ for (j = 0; j < utf8_len; j++)
1439+ printf ("%02x", buffer [j]);
1440+ putchar ('>');
1441+ break;
1442+
1443+ case unicode_locale:
1444+ printf ("%.1s", buffer);
1445+ break;
1446+ }
1447+
1448+ return utf8_len;
1449+}
1450+
1451+/* Display strings in BUFFER. Treat any UTF-8 encoded characters encountered
1452+ according to the setting of the unicode_display variable. The buffer
1453+ contains BUFLEN bytes.
1454+
1455+ Display the characters as if they started at ADDRESS and are contained in
1456+ FILENAME. */
1457+
1458+static void
1459+print_unicode_buffer (const char * filename,
1460+ file_ptr address,
1461+ const unsigned char * buffer,
1462+ unsigned long buflen)
1463+{
1464+ /* Paranoia checks... */
1465+ if (filename == NULL
1466+ || buffer == NULL
1467+ || unicode_display == unicode_default
1468+ || encoding != 'S'
1469+ || encoding_bytes != 1)
1470+ {
1471+ fprintf (stderr, "ICE: bad arguments to print_unicode_buffer\n");
1472+ return;
1473+ }
1474+
1475+ if (buflen == 0)
1476+ return;
1477+
1478+ /* We must only display strings that are at least string_min *characters*
1479+ long. So we scan the buffer in two stages. First we locate the start
1480+ of a potential string. Then we walk along it until we have found
1481+ string_min characters. Then we go back to the start point and start
1482+ displaying characters according to the unicode_display setting. */
1483+
1484+ unsigned long start_point = 0;
1485+ unsigned long i = 0;
1486+ unsigned int char_len = 1;
1487+ unsigned int num_found = 0;
1488+
1489+ for (i = 0; i < buflen; i += char_len)
1490+ {
1491+ int c = buffer[i];
1492+
1493+ char_len = 1;
1494+
1495+ /* Find the first potential character of a string. */
1496+ if (! STRING_ISGRAPHIC (c))
1497+ {
1498+ num_found = 0;
1499+ continue;
1500+ }
1501+
1502+ if (c > 126)
1503+ {
1504+ if (c < 0xc0)
1505+ {
1506+ num_found = 0;
1507+ continue;
1508+ }
1509+
1510+ if ((char_len = is_valid_utf8 (buffer + i, buflen - i)) == 0)
1511+ {
1512+ char_len = 1;
1513+ num_found = 0;
1514+ continue;
1515+ }
1516+
1517+ if (unicode_display == unicode_invalid)
1518+ {
1519+ /* We have found a valid UTF-8 character, but we treat it as non-graphic. */
1520+ num_found = 0;
1521+ continue;
1522+ }
1523+ }
1524+
1525+ if (num_found == 0)
1526+ /* We have found a potential starting point for a string. */
1527+ start_point = i;
1528+
1529+ ++ num_found;
1530+
1531+ if (num_found >= string_min)
1532+ break;
1533+ }
1534+
1535+ if (num_found < string_min)
1536+ return;
1537+
1538+ print_filename_and_address (filename, address + start_point);
1539+
1540+ /* We have found string_min characters. Display them and any
1541+ more that follow. */
1542+ for (i = start_point; i < buflen; i += char_len)
1543+ {
1544+ int c = buffer[i];
1545+
1546+ char_len = 1;
1547+
1548+ if (! STRING_ISGRAPHIC (c))
1549+ break;
1550+ else if (c < 127)
1551+ putchar (c);
1552+ else if (! is_valid_utf8 (buffer + i, buflen - i))
1553+ break;
1554+ else if (unicode_display == unicode_invalid)
1555+ break;
1556+ else
1557+ char_len = display_utf8_char (buffer + i);
1558+ }
1559+
1560+ if (output_separator)
1561+ fputs (output_separator, stdout);
1562+ else
1563+ putchar ('\n');
1564+
1565+ /* FIXME: Using tail recursion here is lazy programming... */
1566+ print_unicode_buffer (filename, address + i, buffer + i, buflen - i);
1567+}
1568+
1569+static int
1570+get_unicode_byte (FILE * stream,
1571+ unsigned char * putback,
1572+ unsigned int * num_putback,
1573+ unsigned int * num_read)
1574+{
1575+ if (* num_putback > 0)
1576+ {
1577+ * num_putback = * num_putback - 1;
1578+ return putback [* num_putback];
1579+ }
1580+
1581+ * num_read = * num_read + 1;
1582+
1583+#if defined(HAVE_GETC_UNLOCKED) && HAVE_DECL_GETC_UNLOCKED
1584+ return getc_unlocked (stream);
1585+#else
1586+ return getc (stream);
1587+#endif
1588+}
1589+
1590+/* Helper function for print_unicode_stream. */
1591+
1592+static void
1593+print_unicode_stream_body (const char * filename,
1594+ file_ptr address,
1595+ FILE * stream,
1596+ unsigned char * putback_buf,
1597+ unsigned int num_putback,
1598+ unsigned char * print_buf)
1599+{
1600+ /* It would be nice if we could just read the stream into a buffer
1601+ and then process if with print_unicode_buffer. But the input
1602+ might be huge or it might time-locked (eg stdin). So instead
1603+ we go one byte at a time... */
1604+
1605+ file_ptr start_point = 0;
1606+ unsigned int num_read = 0;
1607+ unsigned int num_chars = 0;
1608+ unsigned int num_print = 0;
1609+ int c = 0;
1610+
1611+ /* Find a series of string_min characters. Put them into print_buf. */
1612+ do
1613+ {
1614+ if (num_chars >= string_min)
1615+ break;
1616+
1617+ c = get_unicode_byte (stream, putback_buf, & num_putback, & num_read);
1618+ if (c == EOF)
1619+ break;
1620+
1621+ if (! STRING_ISGRAPHIC (c))
1622+ {
1623+ num_chars = num_print = 0;
1624+ continue;
1625+ }
1626+
1627+ if (num_chars == 0)
1628+ start_point = num_read - 1;
1629+
1630+ if (c < 127)
1631+ {
1632+ print_buf[num_print] = c;
1633+ num_chars ++;
1634+ num_print ++;
1635+ continue;
1636+ }
1637+
1638+ if (c < 0xc0)
1639+ {
1640+ num_chars = num_print = 0;
1641+ continue;
1642+ }
1643+
1644+ /* We *might* have a UTF-8 sequence. Time to start peeking. */
1645+ char utf8[4];
1646+
1647+ utf8[0] = c;
1648+ c = get_unicode_byte (stream, putback_buf, & num_putback, & num_read);
1649+ if (c == EOF)
1650+ break;
1651+ utf8[1] = c;
1652+
1653+ if ((utf8[1] & 0xc0) != 0x80)
1654+ {
1655+ /* Invalid UTF-8. */
1656+ putback_buf[num_putback++] = utf8[1];
1657+ num_chars = num_print = 0;
1658+ continue;
1659+ }
1660+ else if ((utf8[0] & 0x20) == 0)
1661+ {
1662+ /* A valid 2-byte UTF-8 encoding. */
1663+ if (unicode_display == unicode_invalid)
1664+ {
1665+ putback_buf[num_putback++] = utf8[1];
1666+ num_chars = num_print = 0;
1667+ }
1668+ else
1669+ {
1670+ print_buf[num_print ++] = utf8[0];
1671+ print_buf[num_print ++] = utf8[1];
1672+ num_chars ++;
1673+ }
1674+ continue;
1675+ }
1676+
1677+ c = get_unicode_byte (stream, putback_buf, & num_putback, & num_read);
1678+ if (c == EOF)
1679+ break;
1680+ utf8[2] = c;
1681+
1682+ if ((utf8[2] & 0xc0) != 0x80)
1683+ {
1684+ /* Invalid UTF-8. */
1685+ putback_buf[num_putback++] = utf8[2];
1686+ putback_buf[num_putback++] = utf8[1];
1687+ num_chars = num_print = 0;
1688+ continue;
1689+ }
1690+ else if ((utf8[0] & 0x10) == 0)
1691+ {
1692+ /* A valid 3-byte UTF-8 encoding. */
1693+ if (unicode_display == unicode_invalid)
1694+ {
1695+ putback_buf[num_putback++] = utf8[2];
1696+ putback_buf[num_putback++] = utf8[1];
1697+ num_chars = num_print = 0;
1698+ }
1699+ else
1700+ {
1701+ print_buf[num_print ++] = utf8[0];
1702+ print_buf[num_print ++] = utf8[1];
1703+ print_buf[num_print ++] = utf8[2];
1704+ num_chars ++;
1705+ }
1706+ continue;
1707+ }
1708+
1709+ c = get_unicode_byte (stream, putback_buf, & num_putback, & num_read);
1710+ if (c == EOF)
1711+ break;
1712+ utf8[3] = c;
1713+
1714+ if ((utf8[3] & 0xc0) != 0x80)
1715+ {
1716+ /* Invalid UTF-8. */
1717+ putback_buf[num_putback++] = utf8[3];
1718+ putback_buf[num_putback++] = utf8[2];
1719+ putback_buf[num_putback++] = utf8[1];
1720+ num_chars = num_print = 0;
1721+ }
1722+ /* We have a valid 4-byte UTF-8 encoding. */
1723+ else if (unicode_display == unicode_invalid)
1724+ {
1725+ putback_buf[num_putback++] = utf8[3];
1726+ putback_buf[num_putback++] = utf8[1];
1727+ putback_buf[num_putback++] = utf8[2];
1728+ num_chars = num_print = 0;
1729+ }
1730+ else
1731+ {
1732+ print_buf[num_print ++] = utf8[0];
1733+ print_buf[num_print ++] = utf8[1];
1734+ print_buf[num_print ++] = utf8[2];
1735+ print_buf[num_print ++] = utf8[3];
1736+ num_chars ++;
1737+ }
1738+ }
1739+ while (1);
1740+
1741+ if (num_chars >= string_min)
1742+ {
1743+ /* We know that we have string_min valid characters in print_buf,
1744+ and there may be more to come in the stream. Start displaying
1745+ them. */
1746+
1747+ print_filename_and_address (filename, address + start_point);
1748+
1749+ unsigned int i;
1750+ for (i = 0; i < num_print;)
1751+ {
1752+ if (print_buf[i] < 127)
1753+ putchar (print_buf[i++]);
1754+ else
1755+ i += display_utf8_char (print_buf + i);
1756+ }
1757+
1758+ /* OK so now we have to start read unchecked bytes. */
1759+
1760+ /* Find a series of string_min characters. Put them into print_buf. */
1761+ do
1762+ {
1763+ c = get_unicode_byte (stream, putback_buf, & num_putback, & num_read);
1764+ if (c == EOF)
1765+ break;
1766+
1767+ if (! STRING_ISGRAPHIC (c))
1768+ break;
1769+
1770+ if (c < 127)
1771+ {
1772+ putchar (c);
1773+ continue;
1774+ }
1775+
1776+ if (c < 0xc0)
1777+ break;
1778+
1779+ /* We *might* have a UTF-8 sequence. Time to start peeking. */
1780+ unsigned char utf8[4];
1781+
1782+ utf8[0] = c;
1783+ c = get_unicode_byte (stream, putback_buf, & num_putback, & num_read);
1784+ if (c == EOF)
1785+ break;
1786+ utf8[1] = c;
1787+
1788+ if ((utf8[1] & 0xc0) != 0x80)
1789+ {
1790+ /* Invalid UTF-8. */
1791+ putback_buf[num_putback++] = utf8[1];
1792+ break;
1793+ }
1794+ else if ((utf8[0] & 0x20) == 0)
1795+ {
1796+ /* Valid 2-byte UTF-8. */
1797+ if (unicode_display == unicode_invalid)
1798+ {
1799+ putback_buf[num_putback++] = utf8[1];
1800+ break;
1801+ }
1802+ else
1803+ {
1804+ (void) display_utf8_char (utf8);
1805+ continue;
1806+ }
1807+ }
1808+
1809+ c = get_unicode_byte (stream, putback_buf, & num_putback, & num_read);
1810+ if (c == EOF)
1811+ break;
1812+ utf8[2] = c;
1813+
1814+ if ((utf8[2] & 0xc0) != 0x80)
1815+ {
1816+ /* Invalid UTF-8. */
1817+ putback_buf[num_putback++] = utf8[2];
1818+ putback_buf[num_putback++] = utf8[1];
1819+ break;
1820+ }
1821+ else if ((utf8[0] & 0x10) == 0)
1822+ {
1823+ /* Valid 3-byte UTF-8. */
1824+ if (unicode_display == unicode_invalid)
1825+ {
1826+ putback_buf[num_putback++] = utf8[2];
1827+ putback_buf[num_putback++] = utf8[1];
1828+ break;
1829+ }
1830+ else
1831+ {
1832+ (void) display_utf8_char (utf8);
1833+ continue;
1834+ }
1835+ }
1836+
1837+ c = get_unicode_byte (stream, putback_buf, & num_putback, & num_read);
1838+ if (c == EOF)
1839+ break;
1840+ utf8[3] = c;
1841+
1842+ if ((utf8[3] & 0xc0) != 0x80)
1843+ {
1844+ /* Invalid UTF-8. */
1845+ putback_buf[num_putback++] = utf8[3];
1846+ putback_buf[num_putback++] = utf8[2];
1847+ putback_buf[num_putback++] = utf8[1];
1848+ break;
1849+ }
1850+ else if (unicode_display == unicode_invalid)
1851+ {
1852+ putback_buf[num_putback++] = utf8[3];
1853+ putback_buf[num_putback++] = utf8[2];
1854+ putback_buf[num_putback++] = utf8[1];
1855+ break;
1856+ }
1857+ else
1858+ /* A valid 4-byte UTF-8 encoding. */
1859+ (void) display_utf8_char (utf8);
1860+ }
1861+ while (1);
1862+
1863+ if (output_separator)
1864+ fputs (output_separator, stdout);
1865+ else
1866+ putchar ('\n');
1867+ }
1868+
1869+ if (c != EOF)
1870+ /* FIXME: Using tail recursion here is lazy, but it works. */
1871+ print_unicode_stream_body (filename, address + num_read, stream, putback_buf, num_putback, print_buf);
1872+}
1873+
1874+/* Display strings read in from STREAM. Treat any UTF-8 encoded characters
1875+ encountered according to the setting of the unicode_display variable.
1876+ The stream is positioned at ADDRESS and is attached to FILENAME. */
1877+
1878+static void
1879+print_unicode_stream (const char * filename,
1880+ file_ptr address,
1881+ FILE * stream)
1882+{
1883+ /* Paranoia checks... */
1884+ if (filename == NULL
1885+ || stream == NULL
1886+ || unicode_display == unicode_default
1887+ || encoding != 'S'
1888+ || encoding_bytes != 1)
1889+ {
1890+ fprintf (stderr, "ICE: bad arguments to print_unicode_stream\n");
1891+ return;
1892+ }
1893+
1894+ /* Allocate space for string_min 4-byte utf-8 characters. */
1895+ unsigned char * print_buf = xmalloc ((4 * string_min) + 1);
1896+ /* We should never have to put back more than 4 bytes. */
1897+ unsigned char putback_buf[5];
1898+ unsigned int num_putback = 0;
1899+
1900+ print_unicode_stream_body (filename, address, stream, putback_buf, num_putback, print_buf);
1901+ free (print_buf);
1902+}
1903
1904 /* Find the strings in file FILENAME, read from STREAM.
1905 Assume that STREAM is positioned so that the next byte read
1906@@ -566,20 +1236,29 @@ unget_part_char (long c, file_ptr *addre
1907
1908 static void
1909 print_strings (const char *filename, FILE *stream, file_ptr address,
1910- int stop_point, int magiccount, char *magic)
1911+ int magiccount, char *magic)
1912 {
1913+ if (unicode_display != unicode_default)
1914+ {
1915+ if (magic != NULL)
1916+ print_unicode_buffer (filename, address,
1917+ (const unsigned char *) magic, magiccount);
1918+
1919+ if (stream != NULL)
1920+ print_unicode_stream (filename, address, stream);
1921+ return;
1922+ }
1923+
1924 char *buf = (char *) xmalloc (sizeof (char) * (string_min + 1));
1925
1926 while (1)
1927 {
1928 file_ptr start;
1929- int i;
1930+ unsigned int i;
1931 long c;
1932
1933 /* See if the next `string_min' chars are all graphic chars. */
1934 tryline:
1935- if (stop_point && address >= stop_point)
1936- break;
1937 start = address;
1938 for (i = 0; i < string_min; i++)
1939 {
1940@@ -601,51 +1280,7 @@ print_strings (const char *filename, FIL
1941
1942 /* We found a run of `string_min' graphic characters. Print up
1943 to the next non-graphic character. */
1944-
1945- if (print_filenames)
1946- printf ("%s: ", filename);
1947- if (print_addresses)
1948- switch (address_radix)
1949- {
1950- case 8:
1951- if (sizeof (start) > sizeof (long))
1952- {
1953-#ifndef __MSVCRT__
1954- printf ("%7llo ", (unsigned long long) start);
1955-#else
1956- printf ("%7I64o ", (unsigned long long) start);
1957-#endif
1958- }
1959- else
1960- printf ("%7lo ", (unsigned long) start);
1961- break;
1962-
1963- case 10:
1964- if (sizeof (start) > sizeof (long))
1965- {
1966-#ifndef __MSVCRT__
1967- printf ("%7llu ", (unsigned long long) start);
1968-#else
1969- printf ("%7I64d ", (unsigned long long) start);
1970-#endif
1971- }
1972- else
1973- printf ("%7ld ", (long) start);
1974- break;
1975-
1976- case 16:
1977- if (sizeof (start) > sizeof (long))
1978- {
1979-#ifndef __MSVCRT__
1980- printf ("%7llx ", (unsigned long long) start);
1981-#else
1982- printf ("%7I64x ", (unsigned long long) start);
1983-#endif
1984- }
1985- else
1986- printf ("%7lx ", (unsigned long) start);
1987- break;
1988- }
1989+ print_filename_and_address (filename, start);
1990
1991 buf[i] = '\0';
1992 fputs (buf, stdout);
1993@@ -697,6 +1332,8 @@ usage (FILE *stream, int status)
1994 -T --target=<BFDNAME> Specify the binary file format\n\
1995 -e --encoding={s,S,b,l,B,L} Select character size and endianness:\n\
1996 s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit\n\
1997+ --unicode={default|show|invalid|hex|escape|highlight}\n\
1998+ -u {d|s|i|x|e|h} Specify how to treat UTF-8 encoded unicode characters\n\
1999 -s --output-separator=<string> String used to separate strings in output.\n\
2000 @<file> Read options from <file>\n\
2001 -h --help Display this information\n\
diff --git a/meta/recipes-devtools/binutils/binutils/161e87d12167b1e36193385485c1f6ce92f74f02.patch b/meta/recipes-devtools/binutils/binutils/161e87d12167b1e36193385485c1f6ce92f74f02.patch
new file mode 100644
index 0000000000..8a655af06c
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/161e87d12167b1e36193385485c1f6ce92f74f02.patch
@@ -0,0 +1,247 @@
1From: Alan Modra <amodra@gmail.com>
2Date: Wed, 15 Dec 2021 01:18:42 +0000 (+1030)
3Subject: PR28694, Out-of-bounds write in stab_xcoff_builtin_type
4CVE: CVE-2021-45078
5
6Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=161e87d12167b1e36193385485c1f6ce92f74f02]
7
8PR28694, Out-of-bounds write in stab_xcoff_builtin_type
9
10 PR 28694
11 * stabs.c (stab_xcoff_builtin_type): Make typenum unsigned.
12 Negate typenum earlier, simplifying bounds checking. Correct
13 off-by-one indexing. Adjust switch cases.
14---
15
16diff --git a/binutils/stabs.c b/binutils/stabs.c
17index 274bfb0e7fa..83ee3ea5fa4 100644
18--- a/binutils/stabs.c
19+++ b/binutils/stabs.c
20@@ -202,7 +202,7 @@ static debug_type stab_find_type (void *, struct stab_handle *, const int *);
21 static bool stab_record_type
22 (void *, struct stab_handle *, const int *, debug_type);
23 static debug_type stab_xcoff_builtin_type
24- (void *, struct stab_handle *, int);
25+ (void *, struct stab_handle *, unsigned int);
26 static debug_type stab_find_tagged_type
27 (void *, struct stab_handle *, const char *, int, enum debug_type_kind);
28 static debug_type *stab_demangle_argtypes
29@@ -3496,166 +3496,167 @@ stab_record_type (void *dhandle ATTRIBUTE_UNUSED, struct stab_handle *info,
30
31 static debug_type
32 stab_xcoff_builtin_type (void *dhandle, struct stab_handle *info,
33- int typenum)
34+ unsigned int typenum)
35 {
36 debug_type rettype;
37 const char *name;
38
39- if (typenum >= 0 || typenum < -XCOFF_TYPE_COUNT)
40+ typenum = -typenum - 1;
41+ if (typenum >= XCOFF_TYPE_COUNT)
42 {
43- fprintf (stderr, _("Unrecognized XCOFF type %d\n"), typenum);
44+ fprintf (stderr, _("Unrecognized XCOFF type %d\n"), -typenum - 1);
45 return DEBUG_TYPE_NULL;
46 }
47- if (info->xcoff_types[-typenum] != NULL)
48- return info->xcoff_types[-typenum];
49+ if (info->xcoff_types[typenum] != NULL)
50+ return info->xcoff_types[typenum];
51
52- switch (-typenum)
53+ switch (typenum)
54 {
55- case 1:
56+ case 0:
57 /* The size of this and all the other types are fixed, defined
58 by the debugging format. */
59 name = "int";
60 rettype = debug_make_int_type (dhandle, 4, false);
61 break;
62- case 2:
63+ case 1:
64 name = "char";
65 rettype = debug_make_int_type (dhandle, 1, false);
66 break;
67- case 3:
68+ case 2:
69 name = "short";
70 rettype = debug_make_int_type (dhandle, 2, false);
71 break;
72- case 4:
73+ case 3:
74 name = "long";
75 rettype = debug_make_int_type (dhandle, 4, false);
76 break;
77- case 5:
78+ case 4:
79 name = "unsigned char";
80 rettype = debug_make_int_type (dhandle, 1, true);
81 break;
82- case 6:
83+ case 5:
84 name = "signed char";
85 rettype = debug_make_int_type (dhandle, 1, false);
86 break;
87- case 7:
88+ case 6:
89 name = "unsigned short";
90 rettype = debug_make_int_type (dhandle, 2, true);
91 break;
92- case 8:
93+ case 7:
94 name = "unsigned int";
95 rettype = debug_make_int_type (dhandle, 4, true);
96 break;
97- case 9:
98+ case 8:
99 name = "unsigned";
100 rettype = debug_make_int_type (dhandle, 4, true);
101 break;
102- case 10:
103+ case 9:
104 name = "unsigned long";
105 rettype = debug_make_int_type (dhandle, 4, true);
106 break;
107- case 11:
108+ case 10:
109 name = "void";
110 rettype = debug_make_void_type (dhandle);
111 break;
112- case 12:
113+ case 11:
114 /* IEEE single precision (32 bit). */
115 name = "float";
116 rettype = debug_make_float_type (dhandle, 4);
117 break;
118- case 13:
119+ case 12:
120 /* IEEE double precision (64 bit). */
121 name = "double";
122 rettype = debug_make_float_type (dhandle, 8);
123 break;
124- case 14:
125+ case 13:
126 /* This is an IEEE double on the RS/6000, and different machines
127 with different sizes for "long double" should use different
128 negative type numbers. See stabs.texinfo. */
129 name = "long double";
130 rettype = debug_make_float_type (dhandle, 8);
131 break;
132- case 15:
133+ case 14:
134 name = "integer";
135 rettype = debug_make_int_type (dhandle, 4, false);
136 break;
137- case 16:
138+ case 15:
139 name = "boolean";
140 rettype = debug_make_bool_type (dhandle, 4);
141 break;
142- case 17:
143+ case 16:
144 name = "short real";
145 rettype = debug_make_float_type (dhandle, 4);
146 break;
147- case 18:
148+ case 17:
149 name = "real";
150 rettype = debug_make_float_type (dhandle, 8);
151 break;
152- case 19:
153+ case 18:
154 /* FIXME */
155 name = "stringptr";
156 rettype = NULL;
157 break;
158- case 20:
159+ case 19:
160 /* FIXME */
161 name = "character";
162 rettype = debug_make_int_type (dhandle, 1, true);
163 break;
164- case 21:
165+ case 20:
166 name = "logical*1";
167 rettype = debug_make_bool_type (dhandle, 1);
168 break;
169- case 22:
170+ case 21:
171 name = "logical*2";
172 rettype = debug_make_bool_type (dhandle, 2);
173 break;
174- case 23:
175+ case 22:
176 name = "logical*4";
177 rettype = debug_make_bool_type (dhandle, 4);
178 break;
179- case 24:
180+ case 23:
181 name = "logical";
182 rettype = debug_make_bool_type (dhandle, 4);
183 break;
184- case 25:
185+ case 24:
186 /* Complex type consisting of two IEEE single precision values. */
187 name = "complex";
188 rettype = debug_make_complex_type (dhandle, 8);
189 break;
190- case 26:
191+ case 25:
192 /* Complex type consisting of two IEEE double precision values. */
193 name = "double complex";
194 rettype = debug_make_complex_type (dhandle, 16);
195 break;
196- case 27:
197+ case 26:
198 name = "integer*1";
199 rettype = debug_make_int_type (dhandle, 1, false);
200 break;
201- case 28:
202+ case 27:
203 name = "integer*2";
204 rettype = debug_make_int_type (dhandle, 2, false);
205 break;
206- case 29:
207+ case 28:
208 name = "integer*4";
209 rettype = debug_make_int_type (dhandle, 4, false);
210 break;
211- case 30:
212+ case 29:
213 /* FIXME */
214 name = "wchar";
215 rettype = debug_make_int_type (dhandle, 2, false);
216 break;
217- case 31:
218+ case 30:
219 name = "long long";
220 rettype = debug_make_int_type (dhandle, 8, false);
221 break;
222- case 32:
223+ case 31:
224 name = "unsigned long long";
225 rettype = debug_make_int_type (dhandle, 8, true);
226 break;
227- case 33:
228+ case 32:
229 name = "logical*8";
230 rettype = debug_make_bool_type (dhandle, 8);
231 break;
232- case 34:
233+ case 33:
234 name = "integer*8";
235 rettype = debug_make_int_type (dhandle, 8, false);
236 break;
237@@ -3664,9 +3665,7 @@ stab_xcoff_builtin_type (void *dhandle, struct stab_handle *info,
238 }
239
240 rettype = debug_name_type (dhandle, name, rettype);
241-
242- info->xcoff_types[-typenum] = rettype;
243-
244+ info->xcoff_types[typenum] = rettype;
245 return rettype;
246 }
247
diff --git a/meta/recipes-devtools/bootchart2/bootchart2_0.14.9.bb b/meta/recipes-devtools/bootchart2/bootchart2_0.14.9.bb
index 59fcd8c78a..413c9b9499 100644
--- a/meta/recipes-devtools/bootchart2/bootchart2_0.14.9.bb
+++ b/meta/recipes-devtools/bootchart2/bootchart2_0.14.9.bb
@@ -150,7 +150,7 @@ do_install () {
150 150
151PACKAGES =+ "pybootchartgui" 151PACKAGES =+ "pybootchartgui"
152FILES:pybootchartgui += "${PYTHON_SITEPACKAGES_DIR}/pybootchartgui ${bindir}/pybootchartgui" 152FILES:pybootchartgui += "${PYTHON_SITEPACKAGES_DIR}/pybootchartgui ${bindir}/pybootchartgui"
153RDEPENDS:pybootchartgui = "python3-pycairo python3-compression python3-image python3-shell python3-compression python3-codecs" 153RDEPENDS:pybootchartgui = "python3-pycairo python3-compression python3-image python3-math python3-shell python3-compression python3-codecs"
154RDEPENDS:${PN}:class-target += "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'sysvinit-pidof', 'procps', d)}" 154RDEPENDS:${PN}:class-target += "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'sysvinit-pidof', 'procps', d)}"
155RDEPENDS:${PN}:class-target += "lsb-release" 155RDEPENDS:${PN}:class-target += "lsb-release"
156DEPENDS:append:class-native = " python3-pycairo-native" 156DEPENDS:append:class-native = " python3-pycairo-native"
diff --git a/meta/recipes-devtools/gcc/gcc-11.2.inc b/meta/recipes-devtools/gcc/gcc-11.2.inc
index 9fd30f52a8..40d2b59354 100644
--- a/meta/recipes-devtools/gcc/gcc-11.2.inc
+++ b/meta/recipes-devtools/gcc/gcc-11.2.inc
@@ -68,6 +68,15 @@ SRC_URI = "\
68 file://0036-mingw32-Enable-operation_not_supported.patch \ 68 file://0036-mingw32-Enable-operation_not_supported.patch \
69 file://0037-libatomic-Do-not-enforce-march-on-aarch64.patch \ 69 file://0037-libatomic-Do-not-enforce-march-on-aarch64.patch \
70 file://0041-apply-debug-prefix-maps-before-checksumming-DIEs.patch \ 70 file://0041-apply-debug-prefix-maps-before-checksumming-DIEs.patch \
71 file://0001-CVE-2021-35465.patch \
72 file://0002-CVE-2021-35465.patch \
73 file://0003-CVE-2021-35465.patch \
74 file://0004-CVE-2021-35465.patch \
75 file://0001-CVE-2021-42574.patch \
76 file://0002-CVE-2021-42574.patch \
77 file://0003-CVE-2021-42574.patch \
78 file://0004-CVE-2021-42574.patch \
79 file://0001-CVE-2021-46195.patch \
71" 80"
72SRC_URI[sha256sum] = "d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b" 81SRC_URI[sha256sum] = "d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b"
73 82
@@ -117,3 +126,6 @@ EXTRA_OECONF_PATHS = "\
117 --with-sysroot=/not/exist \ 126 --with-sysroot=/not/exist \
118 --with-build-sysroot=${STAGING_DIR_TARGET} \ 127 --with-build-sysroot=${STAGING_DIR_TARGET} \
119" 128"
129
130# Is a binutils 2.26 issue, not gcc
131CVE_CHECK_WHITELIST += "CVE-2021-37322"
diff --git a/meta/recipes-devtools/gcc/gcc-target.inc b/meta/recipes-devtools/gcc/gcc-target.inc
index bf55e692e6..bcea75b2fa 100644
--- a/meta/recipes-devtools/gcc/gcc-target.inc
+++ b/meta/recipes-devtools/gcc/gcc-target.inc
@@ -193,7 +193,7 @@ do_install () {
193 rm -f *c++* 193 rm -f *c++*
194 194
195 # We don't care about the gcc-<version> ones for this 195 # We don't care about the gcc-<version> ones for this
196 rm -f *gcc-?.?* 196 rm -f *gcc-?*.?*
197 197
198 # Not sure why we end up with these but we don't want them... 198 # Not sure why we end up with these but we don't want them...
199 rm -f ${TARGET_PREFIX}${TARGET_PREFIX}* 199 rm -f ${TARGET_PREFIX}${TARGET_PREFIX}*
diff --git a/meta/recipes-devtools/gcc/gcc/0001-CVE-2021-35465.patch b/meta/recipes-devtools/gcc/gcc/0001-CVE-2021-35465.patch
new file mode 100644
index 0000000000..6b1d4e3fce
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc/0001-CVE-2021-35465.patch
@@ -0,0 +1,138 @@
1From 3929bca9ca95de9d35e82ae8828b188029e3eb70 Mon Sep 17 00:00:00 2001
2From: Richard Earnshaw <rearnsha@arm.com>
3Date: Fri, 11 Jun 2021 16:02:05 +0100
4Subject: [PATCH] arm: Add command-line option for enabling CVE-2021-35465
5 mitigation [PR102035]
6
7Add a new option, -mfix-cmse-cve-2021-35465 and document it. Enable it
8automatically for cortex-m33, cortex-m35p and cortex-m55.
9
10gcc:
11 PR target/102035
12 * config/arm/arm.opt (mfix-cmse-cve-2021-35465): New option.
13 * doc/invoke.texi (Arm Options): Document it.
14 * config/arm/arm-cpus.in (quirk_vlldm): New feature bit.
15 (ALL_QUIRKS): Add quirk_vlldm.
16 (cortex-m33): Add quirk_vlldm.
17 (cortex-m35p, cortex-m55): Likewise.
18 * config/arm/arm.c (arm_option_override): Enable fix_vlldm if
19 targetting an affected CPU and not explicitly controlled on
20 the command line.
21
22CVE: CVE-2021-35465
23Upstream-Status: Backport[https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=3929bca9ca95de9d35e82ae8828b188029e3eb70]
24Signed-off-by: Pgowda <pgowda.cve@gmail.com>
25
26---
27 gcc/config/arm/arm-cpus.in | 9 +++++++--
28 gcc/config/arm/arm.c | 9 +++++++++
29 gcc/config/arm/arm.opt | 4 ++++
30 gcc/doc/invoke.texi | 9 +++++++++
31 4 files changed, 29 insertions(+), 2 deletions(-)
32
33diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
34--- a/gcc/config/arm/arm.c 2021-11-15 02:13:11.100579812 -0800
35+++ b/gcc/config/arm/arm.c 2021-11-15 02:17:36.988237692 -0800
36@@ -3610,6 +3610,15 @@ arm_option_override (void)
37 fix_cm3_ldrd = 0;
38 }
39
40+ /* Enable fix_vlldm by default if required. */
41+ if (fix_vlldm == 2)
42+ {
43+ if (bitmap_bit_p (arm_active_target.isa, isa_bit_quirk_vlldm))
44+ fix_vlldm = 1;
45+ else
46+ fix_vlldm = 0;
47+ }
48+
49 /* Hot/Cold partitioning is not currently supported, since we can't
50 handle literal pool placement in that case. */
51 if (flag_reorder_blocks_and_partition)
52diff --git a/gcc/config/arm/arm-cpus.in b/gcc/config/arm/arm-cpus.in
53--- a/gcc/config/arm/arm-cpus.in 2021-11-15 02:13:11.104579747 -0800
54+++ b/gcc/config/arm/arm-cpus.in 2021-11-15 02:17:36.984237757 -0800
55@@ -186,6 +186,9 @@ define feature quirk_armv6kz
56 # Cortex-M3 LDRD quirk.
57 define feature quirk_cm3_ldrd
58
59+# v8-m/v8.1-m VLLDM errata.
60+define feature quirk_vlldm
61+
62 # Don't use .cpu assembly directive
63 define feature quirk_no_asmcpu
64
65@@ -322,7 +325,7 @@ define implied vfp_base MVE MVE_FP ALL_F
66 # architectures.
67 # xscale isn't really a 'quirk', but it isn't an architecture either and we
68 # need to ignore it for matching purposes.
69-define fgroup ALL_QUIRKS quirk_no_volatile_ce quirk_armv6kz quirk_cm3_ldrd xscale quirk_no_asmcpu
70+define fgroup ALL_QUIRKS quirk_no_volatile_ce quirk_armv6kz quirk_cm3_ldrd quirk_vlldm xscale quirk_no_asmcpu
71
72 define fgroup IGNORE_FOR_MULTILIB cdecp0 cdecp1 cdecp2 cdecp3 cdecp4 cdecp5 cdecp6 cdecp7
73
74@@ -1570,6 +1573,7 @@ begin cpu cortex-m33
75 architecture armv8-m.main+dsp+fp
76 option nofp remove ALL_FP
77 option nodsp remove armv7em
78+ isa quirk_vlldm
79 costs v7m
80 end cpu cortex-m33
81
82@@ -1579,6 +1583,7 @@ begin cpu cortex-m35p
83 architecture armv8-m.main+dsp+fp
84 option nofp remove ALL_FP
85 option nodsp remove armv7em
86+ isa quirk_vlldm
87 costs v7m
88 end cpu cortex-m35p
89
90@@ -1590,7 +1595,7 @@ begin cpu cortex-m55
91 option nomve remove mve mve_float
92 option nofp remove ALL_FP mve_float
93 option nodsp remove MVE mve_float
94- isa quirk_no_asmcpu
95+ isa quirk_no_asmcpu quirk_vlldm
96 costs v7m
97 vendor 41
98 end cpu cortex-m55
99diff --git a/gcc/config/arm/arm.opt b/gcc/config/arm/arm.opt
100--- a/gcc/config/arm/arm.opt 2021-11-15 02:13:11.104579747 -0800
101+++ b/gcc/config/arm/arm.opt 2021-11-15 02:17:36.988237692 -0800
102@@ -268,6 +268,10 @@ Target Var(fix_cm3_ldrd) Init(2)
103 Avoid overlapping destination and address registers on LDRD instructions
104 that may trigger Cortex-M3 errata.
105
106+mfix-cmse-cve-2021-35465
107+Target Var(fix_vlldm) Init(2)
108+Mitigate issues with VLLDM on some M-profile devices (CVE-2021-35465).
109+
110 munaligned-access
111 Target Var(unaligned_access) Init(2) Save
112 Enable unaligned word and halfword accesses to packed data.
113diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
114--- a/gcc/doc/invoke.texi 2021-11-15 02:13:11.112579616 -0800
115+++ b/gcc/doc/invoke.texi 2021-11-15 02:17:36.996237562 -0800
116@@ -804,6 +804,7 @@ Objective-C and Objective-C++ Dialects}.
117 -mverbose-cost-dump @gol
118 -mpure-code @gol
119 -mcmse @gol
120+-mfix-cmse-cve-2021-35465 @gol
121 -mfdpic}
122
123 @emph{AVR Options}
124@@ -20487,6 +20488,14 @@ Generate secure code as per the "ARMv8-M
125 Development Tools Engineering Specification", which can be found on
126 @url{https://developer.arm.com/documentation/ecm0359818/latest/}.
127
128+@item -mfix-cmse-cve-2021-35465
129+@opindex mfix-cmse-cve-2021-35465
130+Mitigate against a potential security issue with the @code{VLLDM} instruction
131+in some M-profile devices when using CMSE (CVE-2021-365465). This option is
132+enabled by default when the option @option{-mcpu=} is used with
133+@code{cortex-m33}, @code{cortex-m35p} or @code{cortex-m55}. The option
134+@option{-mno-fix-cmse-cve-2021-35465} can be used to disable the mitigation.
135+
136 @item -mfdpic
137 @itemx -mno-fdpic
138 @opindex mfdpic
diff --git a/meta/recipes-devtools/gcc/gcc/0001-CVE-2021-42574.patch b/meta/recipes-devtools/gcc/gcc/0001-CVE-2021-42574.patch
new file mode 100644
index 0000000000..4d680ccc8f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc/0001-CVE-2021-42574.patch
@@ -0,0 +1,2282 @@
1From bd5e882cf6e0def3dd1bc106075d59a303fe0d1e Mon Sep 17 00:00:00 2001
2From: David Malcolm <dmalcolm@redhat.com>
3Date: Mon, 18 Oct 2021 18:55:31 -0400
4Subject: [PATCH] diagnostics: escape non-ASCII source bytes for certain
5 diagnostics
6MIME-Version: 1.0
7Content-Type: text/plain; charset=utf8
8Content-Transfer-Encoding: 8bit
9
10This patch adds support to GCC's diagnostic subsystem for escaping certain
11bytes and Unicode characters when quoting source code.
12
13Specifically, this patch adds a new flag rich_location::m_escape_on_output
14which is a hint from a diagnostic that non-ASCII bytes in the pertinent
15lines of the user's source code should be escaped when printed.
16
17The patch sets this for the following diagnostics:
18- when complaining about stray bytes in the program (when these
19are non-printable)
20- when complaining about "null character(s) ignored");
21- for -Wnormalized= (and generate source ranges for such warnings)
22
23The escaping is controlled by a new option:
24 -fdiagnostics-escape-format=[unicode|bytes]
25
26For example, consider a diagnostic involing a source line containing the
27string "before" followed by the Unicode character U+03C0 ("GREEK SMALL
28LETTER PI", with UTF-8 encoding 0xCF 0x80) followed by the byte 0xBF
29(a stray UTF-8 trailing byte), followed by the string "after", where the
30diagnostic highlights the U+03C0 character.
31
32By default, this line will be printed verbatim to the user when
33reporting a diagnostic at it, as:
34
35 beforeÏXafter
36 ^
37
38(using X for the stray byte to avoid putting invalid UTF-8 in this
39commit message)
40
41If the diagnostic sets the "escape" flag, it will be printed as:
42
43 before<U+03C0><BF>after
44 ^~~~~~~~
45
46with -fdiagnostics-escape-format=unicode (the default), or as:
47
48 before<CF><80><BF>after
49 ^~~~~~~~
50
51if the user supplies -fdiagnostics-escape-format=bytes.
52
53This only affects how the source is printed; it does not affect
54how column numbers that are printed (as per -fdiagnostics-column-unit=
55and -fdiagnostics-column-origin=).
56
57gcc/c-family/ChangeLog:
58 * c-lex.c (c_lex_with_flags): When complaining about non-printable
59 CPP_OTHER tokens, set the "escape on output" flag.
60
61gcc/ChangeLog:
62 * common.opt (fdiagnostics-escape-format=): New.
63 (diagnostics_escape_format): New enum.
64 (DIAGNOSTICS_ESCAPE_FORMAT_UNICODE): New enum value.
65 (DIAGNOSTICS_ESCAPE_FORMAT_BYTES): Likewise.
66 * diagnostic-format-json.cc (json_end_diagnostic): Add
67 "escape-source" attribute.
68 * diagnostic-show-locus.c
69 (exploc_with_display_col::exploc_with_display_col): Replace
70 "tabstop" param with a cpp_char_column_policy and add an "aspect"
71 param. Use these to compute m_display_col accordingly.
72 (struct char_display_policy): New struct.
73 (layout::m_policy): New field.
74 (layout::m_escape_on_output): New field.
75 (def_policy): New function.
76 (make_range): Update for changes to exploc_with_display_col ctor.
77 (default_print_decoded_ch): New.
78 (width_per_escaped_byte): New.
79 (escape_as_bytes_width): New.
80 (escape_as_bytes_print): New.
81 (escape_as_unicode_width): New.
82 (escape_as_unicode_print): New.
83 (make_policy): New.
84 (layout::layout): Initialize new fields. Update m_exploc ctor
85 call for above change to ctor.
86 (layout::maybe_add_location_range): Update for changes to
87 exploc_with_display_col ctor.
88 (layout::calculate_x_offset_display): Update for change to
89 cpp_display_width.
90 (layout::print_source_line): Pass policy
91 to cpp_display_width_computation. Capture cpp_decoded_char when
92 calling process_next_codepoint. Move printing of source code to
93 m_policy.m_print_cb.
94 (line_label::line_label): Pass in policy rather than context.
95 (layout::print_any_labels): Update for change to line_label ctor.
96 (get_affected_range): Pass in policy rather than context, updating
97 calls to location_compute_display_column accordingly.
98 (get_printed_columns): Likewise, also for cpp_display_width.
99 (correction::correction): Pass in policy rather than tabstop.
100 (correction::compute_display_cols): Pass m_policy rather than
101 m_tabstop to cpp_display_width.
102 (correction::m_tabstop): Replace with...
103 (correction::m_policy): ...this.
104 (line_corrections::line_corrections): Pass in policy rather than
105 context.
106 (line_corrections::m_context): Replace with...
107 (line_corrections::m_policy): ...this.
108 (line_corrections::add_hint): Update to use m_policy rather than
109 m_context.
110 (line_corrections::add_hint): Likewise.
111 (layout::print_trailing_fixits): Likewise.
112 (selftest::test_display_widths): New.
113 (selftest::test_layout_x_offset_display_utf8): Update to use
114 policy rather than tabstop.
115 (selftest::test_one_liner_labels_utf8): Add test of escaping
116 source lines.
117 (selftest::test_diagnostic_show_locus_one_liner_utf8): Update to
118 use policy rather than tabstop.
119 (selftest::test_overlapped_fixit_printing): Likewise.
120 (selftest::test_overlapped_fixit_printing_utf8): Likewise.
121 (selftest::test_overlapped_fixit_printing_2): Likewise.
122 (selftest::test_tab_expansion): Likewise.
123 (selftest::test_escaping_bytes_1): New.
124 (selftest::test_escaping_bytes_2): New.
125 (selftest::diagnostic_show_locus_c_tests): Call the new tests.
126 * diagnostic.c (diagnostic_initialize): Initialize
127 context->escape_format.
128 (convert_column_unit): Update to use default character width policy.
129 (selftest::test_diagnostic_get_location_text): Likewise.
130 * diagnostic.h (enum diagnostics_escape_format): New enum.
131 (diagnostic_context::escape_format): New field.
132 * doc/invoke.texi (-fdiagnostics-escape-format=): New option.
133 (-fdiagnostics-format=): Add "escape-source" attribute to examples
134 of JSON output, and document it.
135 * input.c (location_compute_display_column): Pass in "policy"
136 rather than "tabstop", passing to
137 cpp_byte_column_to_display_column.
138 (selftest::test_cpp_utf8): Update to use cpp_char_column_policy.
139 * input.h (class cpp_char_column_policy): New forward decl.
140 (location_compute_display_column): Pass in "policy" rather than
141 "tabstop".
142 * opts.c (common_handle_option): Handle
143 OPT_fdiagnostics_escape_format_.
144 * selftest.c (temp_source_file::temp_source_file): New ctor
145 overload taking a size_t.
146 * selftest.h (temp_source_file::temp_source_file): Likewise.
147
148gcc/testsuite/ChangeLog:
149 * c-c++-common/diagnostic-format-json-1.c: Add regexp to consume
150 "escape-source" attribute.
151 * c-c++-common/diagnostic-format-json-2.c: Likewise.
152 * c-c++-common/diagnostic-format-json-3.c: Likewise.
153 * c-c++-common/diagnostic-format-json-4.c: Likewise, twice.
154 * c-c++-common/diagnostic-format-json-5.c: Likewise.
155 * gcc.dg/cpp/warn-normalized-4-bytes.c: New test.
156 * gcc.dg/cpp/warn-normalized-4-unicode.c: New test.
157 * gcc.dg/encoding-issues-bytes.c: New test.
158 * gcc.dg/encoding-issues-unicode.c: New test.
159 * gfortran.dg/diagnostic-format-json-1.F90: Add regexp to consume
160 "escape-source" attribute.
161 * gfortran.dg/diagnostic-format-json-2.F90: Likewise.
162 * gfortran.dg/diagnostic-format-json-3.F90: Likewise.
163
164libcpp/ChangeLog:
165 * charset.c (convert_escape): Use encoding_rich_location when
166 complaining about nonprintable unknown escape sequences.
167 (cpp_display_width_computation::::cpp_display_width_computation):
168 Pass in policy rather than tabstop.
169 (cpp_display_width_computation::process_next_codepoint): Add "out"
170 param and populate *out if non-NULL.
171 (cpp_display_width_computation::advance_display_cols): Pass NULL
172 to process_next_codepoint.
173 (cpp_byte_column_to_display_column): Pass in policy rather than
174 tabstop. Pass NULL to process_next_codepoint.
175 (cpp_display_column_to_byte_column): Pass in policy rather than
176 tabstop.
177 * errors.c (cpp_diagnostic_get_current_location): New function,
178 splitting out the logic from...
179 (cpp_diagnostic): ...here.
180 (cpp_warning_at): New function.
181 (cpp_pedwarning_at): New function.
182 * include/cpplib.h (cpp_warning_at): New decl for rich_location.
183 (cpp_pedwarning_at): Likewise.
184 (struct cpp_decoded_char): New.
185 (struct cpp_char_column_policy): New.
186 (cpp_display_width_computation::cpp_display_width_computation):
187 Replace "tabstop" param with "policy".
188 (cpp_display_width_computation::process_next_codepoint): Add "out"
189 param.
190 (cpp_display_width_computation::m_tabstop): Replace with...
191 (cpp_display_width_computation::m_policy): ...this.
192 (cpp_byte_column_to_display_column): Replace "tabstop" param with
193 "policy".
194 (cpp_display_width): Likewise.
195 (cpp_display_column_to_byte_column): Likewise.
196 * include/line-map.h (rich_location::escape_on_output_p): New.
197 (rich_location::set_escape_on_output): New.
198 (rich_location::m_escape_on_output): New.
199 * internal.h (cpp_diagnostic_get_current_location): New decl.
200 (class encoding_rich_location): New.
201 * lex.c (skip_whitespace): Use encoding_rich_location when
202 complaining about null characters.
203 (warn_about_normalization): Generate a source range when
204 complaining about improperly normalized tokens, rather than just a
205 point, and use encoding_rich_location so that the source code
206 is escaped on printing.
207 * line-map.c (rich_location::rich_location): Initialize
208 m_escape_on_output.
209
210Signed-off-by: David Malcolm <dmalcolm@redhat.com>
211
212CVE: CVE-2021-42574
213Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=bd5e882cf6e0def3dd1bc106075d59a303fe0d1e]
214Signed-off-by: Pgowda <pgowda.cve@gmail.com>
215
216---
217 gcc/c-family/c-lex.c | 6 +-
218 gcc/common.opt | 13 +
219 gcc/diagnostic-format-json.cc | 3 +
220 gcc/diagnostic-show-locus.c | 580 +++++++++++++++---
221 gcc/diagnostic.c | 10 +-
222 gcc/diagnostic.h | 18 +
223 gcc/doc/invoke.texi | 43 +-
224 gcc/input.c | 62 +-
225 gcc/input.h | 7 +-
226 gcc/opts.c | 4 +
227 gcc/selftest.c | 15 +
228 gcc/selftest.h | 2 +
229 .../c-c++-common/diagnostic-format-json-1.c | 1 +
230 .../c-c++-common/diagnostic-format-json-2.c | 1 +
231 .../c-c++-common/diagnostic-format-json-3.c | 1 +
232 .../c-c++-common/diagnostic-format-json-4.c | 2 +
233 .../c-c++-common/diagnostic-format-json-5.c | 1 +
234 .../gcc.dg/cpp/warn-normalized-4-bytes.c | 21 +
235 .../gcc.dg/cpp/warn-normalized-4-unicode.c | 19 +
236 gcc/testsuite/gcc.dg/encoding-issues-bytes.c | Bin 0 -> 595 bytes
237 .../gcc.dg/encoding-issues-unicode.c | Bin 0 -> 613 bytes
238 .../gfortran.dg/diagnostic-format-json-1.F90 | 1 +
239 .../gfortran.dg/diagnostic-format-json-2.F90 | 1 +
240 .../gfortran.dg/diagnostic-format-json-3.F90 | 1 +
241 libcpp/charset.c | 63 +-
242 libcpp/errors.c | 82 ++-
243 libcpp/include/cpplib.h | 76 ++-
244 libcpp/include/line-map.h | 13 +
245 libcpp/internal.h | 23 +
246 libcpp/lex.c | 38 +-
247 libcpp/line-map.c | 3 +-
248 31 files changed, 942 insertions(+), 168 deletions(-)
249 create mode 100644 gcc/testsuite/gcc.dg/cpp/warn-normalized-4-bytes.c
250 create mode 100644 gcc/testsuite/gcc.dg/cpp/warn-normalized-4-unicode.c
251 create mode 100644 gcc/testsuite/gcc.dg/encoding-issues-bytes.c
252 create mode 100644 gcc/testsuite/gcc.dg/encoding-issues-unicode.c
253
254diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c
255--- a/gcc/c-family/c-lex.c 2021-07-27 23:55:06.980283060 -0700
256+++ b/gcc/c-family/c-lex.c 2021-12-14 01:16:01.541943272 -0800
257@@ -603,7 +603,11 @@ c_lex_with_flags (tree *value, location_
258 else if (ISGRAPH (c))
259 error_at (*loc, "stray %qc in program", (int) c);
260 else
261- error_at (*loc, "stray %<\\%o%> in program", (int) c);
262+ {
263+ rich_location rich_loc (line_table, *loc);
264+ rich_loc.set_escape_on_output (true);
265+ error_at (&rich_loc, "stray %<\\%o%> in program", (int) c);
266+ }
267 }
268 goto retry;
269
270diff --git a/gcc/common.opt b/gcc/common.opt
271--- a/gcc/common.opt 2021-12-13 22:08:44.939137107 -0800
272+++ b/gcc/common.opt 2021-12-14 01:16:01.541943272 -0800
273@@ -1348,6 +1348,10 @@ fdiagnostics-format=
274 Common Joined RejectNegative Enum(diagnostics_output_format)
275 -fdiagnostics-format=[text|json] Select output format.
276
277+fdiagnostics-escape-format=
278+Common Joined RejectNegative Enum(diagnostics_escape_format)
279+-fdiagnostics-escape-format=[unicode|bytes] Select how to escape non-printable-ASCII bytes in the source for diagnostics that suggest it.
280+
281 ; Required for these enum values.
282 SourceInclude
283 diagnostic.h
284@@ -1362,6 +1366,15 @@ EnumValue
285 Enum(diagnostics_column_unit) String(byte) Value(DIAGNOSTICS_COLUMN_UNIT_BYTE)
286
287 Enum
288+Name(diagnostics_escape_format) Type(int)
289+
290+EnumValue
291+Enum(diagnostics_escape_format) String(unicode) Value(DIAGNOSTICS_ESCAPE_FORMAT_UNICODE)
292+
293+EnumValue
294+Enum(diagnostics_escape_format) String(bytes) Value(DIAGNOSTICS_ESCAPE_FORMAT_BYTES)
295+
296+Enum
297 Name(diagnostics_output_format) Type(int)
298
299 EnumValue
300diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
301--- a/gcc/diagnostic.c 2021-07-27 23:55:07.232286576 -0700
302+++ b/gcc/diagnostic.c 2021-12-14 01:16:01.545943202 -0800
303@@ -230,6 +230,7 @@ diagnostic_initialize (diagnostic_contex
304 context->column_unit = DIAGNOSTICS_COLUMN_UNIT_DISPLAY;
305 context->column_origin = 1;
306 context->tabstop = 8;
307+ context->escape_format = DIAGNOSTICS_ESCAPE_FORMAT_UNICODE;
308 context->edit_context_ptr = NULL;
309 context->diagnostic_group_nesting_depth = 0;
310 context->diagnostic_group_emission_count = 0;
311@@ -382,7 +383,10 @@ convert_column_unit (enum diagnostics_co
312 gcc_unreachable ();
313
314 case DIAGNOSTICS_COLUMN_UNIT_DISPLAY:
315- return location_compute_display_column (s, tabstop);
316+ {
317+ cpp_char_column_policy policy (tabstop, cpp_wcwidth);
318+ return location_compute_display_column (s, policy);
319+ }
320
321 case DIAGNOSTICS_COLUMN_UNIT_BYTE:
322 return s.column;
323@@ -2275,8 +2279,8 @@ test_diagnostic_get_location_text ()
324 const char *const content = "smile \xf0\x9f\x98\x82\n";
325 const int line_bytes = strlen (content) - 1;
326 const int def_tabstop = 8;
327- const int display_width = cpp_display_width (content, line_bytes,
328- def_tabstop);
329+ const cpp_char_column_policy policy (def_tabstop, cpp_wcwidth);
330+ const int display_width = cpp_display_width (content, line_bytes, policy);
331 ASSERT_EQ (line_bytes - 2, display_width);
332 temp_source_file tmp (SELFTEST_LOCATION, ".c", content);
333 const char *const fname = tmp.get_filename ();
334diff --git a/gcc/diagnostic-format-json.cc b/gcc/diagnostic-format-json.cc
335--- a/gcc/diagnostic-format-json.cc 2021-07-27 23:55:07.232286576 -0700
336+++ b/gcc/diagnostic-format-json.cc 2021-12-14 01:16:01.541943272 -0800
337@@ -264,6 +264,9 @@ json_end_diagnostic (diagnostic_context
338 json::value *path_value = context->make_json_for_path (context, path);
339 diag_obj->set ("path", path_value);
340 }
341+
342+ diag_obj->set ("escape-source",
343+ new json::literal (richloc->escape_on_output_p ()));
344 }
345
346 /* No-op implementation of "begin_group_cb" for JSON output. */
347diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
348--- a/gcc/diagnostic.h 2021-07-27 23:55:07.236286632 -0700
349+++ b/gcc/diagnostic.h 2021-12-14 01:16:01.545943202 -0800
350@@ -38,6 +38,20 @@ enum diagnostics_column_unit
351 DIAGNOSTICS_COLUMN_UNIT_BYTE
352 };
353
354+/* An enum for controlling how to print non-ASCII characters/bytes when
355+ a diagnostic suggests escaping the source code on output. */
356+
357+enum diagnostics_escape_format
358+{
359+ /* Escape non-ASCII Unicode characters in the form <U+XXXX> and
360+ non-UTF-8 bytes in the form <XX>. */
361+ DIAGNOSTICS_ESCAPE_FORMAT_UNICODE,
362+
363+ /* Escape non-ASCII bytes in the form <XX> (thus showing the underlying
364+ encoding of non-ASCII Unicode characters). */
365+ DIAGNOSTICS_ESCAPE_FORMAT_BYTES
366+};
367+
368 /* Enum for overriding the standard output format. */
369
370 enum diagnostics_output_format
371@@ -320,6 +334,10 @@ struct diagnostic_context
372 /* The size of the tabstop for tab expansion. */
373 int tabstop;
374
375+ /* How should non-ASCII/non-printable bytes be escaped when
376+ a diagnostic suggests escaping the source code on output. */
377+ enum diagnostics_escape_format escape_format;
378+
379 /* If non-NULL, an edit_context to which fix-it hints should be
380 applied, for generating patches. */
381 edit_context *edit_context_ptr;
382diff --git a/gcc/diagnostic-show-locus.c b/gcc/diagnostic-show-locus.c
383--- a/gcc/diagnostic-show-locus.c 2021-07-27 23:55:07.232286576 -0700
384+++ b/gcc/diagnostic-show-locus.c 2021-12-14 01:16:01.545943202 -0800
385@@ -175,10 +175,26 @@ enum column_unit {
386 class exploc_with_display_col : public expanded_location
387 {
388 public:
389- exploc_with_display_col (const expanded_location &exploc, int tabstop)
390- : expanded_location (exploc),
391- m_display_col (location_compute_display_column (exploc, tabstop))
392- {}
393+ exploc_with_display_col (const expanded_location &exploc,
394+ const cpp_char_column_policy &policy,
395+ enum location_aspect aspect)
396+ : expanded_location (exploc),
397+ m_display_col (location_compute_display_column (exploc, policy))
398+ {
399+ if (exploc.column > 0)
400+ {
401+ /* m_display_col is now the final column of the byte.
402+ If escaping has happened, we may want the first column instead. */
403+ if (aspect != LOCATION_ASPECT_FINISH)
404+ {
405+ expanded_location prev_exploc (exploc);
406+ prev_exploc.column--;
407+ int prev_display_col
408+ = (location_compute_display_column (prev_exploc, policy));
409+ m_display_col = prev_display_col + 1;
410+ }
411+ }
412+ }
413
414 int m_display_col;
415 };
416@@ -313,6 +329,31 @@ test_line_span ()
417
418 #endif /* #if CHECKING_P */
419
420+/* A bundle of information containing how to print unicode
421+ characters and bytes when quoting source code.
422+
423+ Provides a unified place to support escaping some subset
424+ of characters to some format.
425+
426+ Extends char_column_policy; printing is split out to avoid
427+ libcpp having to know about pretty_printer. */
428+
429+struct char_display_policy : public cpp_char_column_policy
430+{
431+ public:
432+ char_display_policy (int tabstop,
433+ int (*width_cb) (cppchar_t c),
434+ void (*print_cb) (pretty_printer *pp,
435+ const cpp_decoded_char &cp))
436+ : cpp_char_column_policy (tabstop, width_cb),
437+ m_print_cb (print_cb)
438+ {
439+ }
440+
441+ void (*m_print_cb) (pretty_printer *pp,
442+ const cpp_decoded_char &cp);
443+};
444+
445 /* A class to control the overall layout when printing a diagnostic.
446
447 The layout is determined within the constructor.
448@@ -345,6 +386,8 @@ class layout
449
450 void print_line (linenum_type row);
451
452+ void on_bad_codepoint (const char *ptr, cppchar_t ch, size_t ch_sz);
453+
454 private:
455 bool will_show_line_p (linenum_type row) const;
456 void print_leading_fixits (linenum_type row);
457@@ -386,6 +429,7 @@ class layout
458 private:
459 diagnostic_context *m_context;
460 pretty_printer *m_pp;
461+ char_display_policy m_policy;
462 location_t m_primary_loc;
463 exploc_with_display_col m_exploc;
464 colorizer m_colorizer;
465@@ -398,6 +442,7 @@ class layout
466 auto_vec <line_span> m_line_spans;
467 int m_linenum_width;
468 int m_x_offset_display;
469+ bool m_escape_on_output;
470 };
471
472 /* Implementation of "class colorizer". */
473@@ -646,6 +691,11 @@ layout_range::intersects_line_p (linenum
474 /* Default for when we don't care what the tab expansion is set to. */
475 static const int def_tabstop = 8;
476
477+static cpp_char_column_policy def_policy ()
478+{
479+ return cpp_char_column_policy (8, cpp_wcwidth);
480+}
481+
482 /* Create some expanded locations for testing layout_range. The filename
483 member of the explocs is set to the empty string. This member will only be
484 inspected by the calls to location_compute_display_column() made from the
485@@ -662,10 +712,13 @@ make_range (int start_line, int start_co
486 = {"", start_line, start_col, NULL, false};
487 const expanded_location finish_exploc
488 = {"", end_line, end_col, NULL, false};
489- return layout_range (exploc_with_display_col (start_exploc, def_tabstop),
490- exploc_with_display_col (finish_exploc, def_tabstop),
491+ return layout_range (exploc_with_display_col (start_exploc, def_policy (),
492+ LOCATION_ASPECT_START),
493+ exploc_with_display_col (finish_exploc, def_policy (),
494+ LOCATION_ASPECT_FINISH),
495 SHOW_RANGE_WITHOUT_CARET,
496- exploc_with_display_col (start_exploc, def_tabstop),
497+ exploc_with_display_col (start_exploc, def_policy (),
498+ LOCATION_ASPECT_CARET),
499 0, NULL);
500 }
501
502@@ -959,6 +1012,164 @@ fixit_cmp (const void *p_a, const void *
503 return hint_a->get_start_loc () - hint_b->get_start_loc ();
504 }
505
506+/* Callbacks for use when not escaping the source. */
507+
508+/* The default callback for char_column_policy::m_width_cb is cpp_wcwidth. */
509+
510+/* Callback for char_display_policy::m_print_cb for printing source chars
511+ when not escaping the source. */
512+
513+static void
514+default_print_decoded_ch (pretty_printer *pp,
515+ const cpp_decoded_char &decoded_ch)
516+{
517+ for (const char *ptr = decoded_ch.m_start_byte;
518+ ptr != decoded_ch.m_next_byte; ptr++)
519+ {
520+ if (*ptr == '\0' || *ptr == '\r')
521+ {
522+ pp_space (pp);
523+ continue;
524+ }
525+
526+ pp_character (pp, *ptr);
527+ }
528+}
529+
530+/* Callbacks for use with DIAGNOSTICS_ESCAPE_FORMAT_BYTES. */
531+
532+static const int width_per_escaped_byte = 4;
533+
534+/* Callback for char_column_policy::m_width_cb for determining the
535+ display width when escaping with DIAGNOSTICS_ESCAPE_FORMAT_BYTES. */
536+
537+static int
538+escape_as_bytes_width (cppchar_t ch)
539+{
540+ if (ch < 0x80 && ISPRINT (ch))
541+ return cpp_wcwidth (ch);
542+ else
543+ {
544+ if (ch <= 0x7F) return 1 * width_per_escaped_byte;
545+ if (ch <= 0x7FF) return 2 * width_per_escaped_byte;
546+ if (ch <= 0xFFFF) return 3 * width_per_escaped_byte;
547+ return 4 * width_per_escaped_byte;
548+ }
549+}
550+
551+/* Callback for char_display_policy::m_print_cb for printing source chars
552+ when escaping with DIAGNOSTICS_ESCAPE_FORMAT_BYTES. */
553+
554+static void
555+escape_as_bytes_print (pretty_printer *pp,
556+ const cpp_decoded_char &decoded_ch)
557+{
558+ if (!decoded_ch.m_valid_ch)
559+ {
560+ for (const char *iter = decoded_ch.m_start_byte;
561+ iter != decoded_ch.m_next_byte; ++iter)
562+ {
563+ char buf[16];
564+ sprintf (buf, "<%02x>", (unsigned char)*iter);
565+ pp_string (pp, buf);
566+ }
567+ return;
568+ }
569+
570+ cppchar_t ch = decoded_ch.m_ch;
571+ if (ch < 0x80 && ISPRINT (ch))
572+ pp_character (pp, ch);
573+ else
574+ {
575+ for (const char *iter = decoded_ch.m_start_byte;
576+ iter < decoded_ch.m_next_byte; ++iter)
577+ {
578+ char buf[16];
579+ sprintf (buf, "<%02x>", (unsigned char)*iter);
580+ pp_string (pp, buf);
581+ }
582+ }
583+}
584+
585+/* Callbacks for use with DIAGNOSTICS_ESCAPE_FORMAT_UNICODE. */
586+
587+/* Callback for char_column_policy::m_width_cb for determining the
588+ display width when escaping with DIAGNOSTICS_ESCAPE_FORMAT_UNICODE. */
589+
590+static int
591+escape_as_unicode_width (cppchar_t ch)
592+{
593+ if (ch < 0x80 && ISPRINT (ch))
594+ return cpp_wcwidth (ch);
595+ else
596+ {
597+ // Width of "<U+%04x>"
598+ if (ch > 0xfffff)
599+ return 10;
600+ else if (ch > 0xffff)
601+ return 9;
602+ else
603+ return 8;
604+ }
605+}
606+
607+/* Callback for char_display_policy::m_print_cb for printing source chars
608+ when escaping with DIAGNOSTICS_ESCAPE_FORMAT_UNICODE. */
609+
610+static void
611+escape_as_unicode_print (pretty_printer *pp,
612+ const cpp_decoded_char &decoded_ch)
613+{
614+ if (!decoded_ch.m_valid_ch)
615+ {
616+ escape_as_bytes_print (pp, decoded_ch);
617+ return;
618+ }
619+
620+ cppchar_t ch = decoded_ch.m_ch;
621+ if (ch < 0x80 && ISPRINT (ch))
622+ pp_character (pp, ch);
623+ else
624+ {
625+ char buf[16];
626+ sprintf (buf, "<U+%04X>", ch);
627+ pp_string (pp, buf);
628+ }
629+}
630+
631+/* Populate a char_display_policy based on DC and RICHLOC. */
632+
633+static char_display_policy
634+make_policy (const diagnostic_context &dc,
635+ const rich_location &richloc)
636+{
637+ /* The default is to not escape non-ASCII bytes. */
638+ char_display_policy result
639+ (dc.tabstop, cpp_wcwidth, default_print_decoded_ch);
640+
641+ /* If the diagnostic suggests escaping non-ASCII bytes, then
642+ use policy from user-supplied options. */
643+ if (richloc.escape_on_output_p ())
644+ {
645+ result.m_undecoded_byte_width = width_per_escaped_byte;
646+ switch (dc.escape_format)
647+ {
648+ default:
649+ gcc_unreachable ();
650+ case DIAGNOSTICS_ESCAPE_FORMAT_UNICODE:
651+ result.m_width_cb = escape_as_unicode_width;
652+ result.m_print_cb = escape_as_unicode_print;
653+ break;
654+ case DIAGNOSTICS_ESCAPE_FORMAT_BYTES:
655+ result.m_width_cb = escape_as_bytes_width;
656+ result.m_print_cb = escape_as_bytes_print;
657+ break;
658+ }
659+ }
660+
661+ return result;
662+}
663+
664 /* Implementation of class layout. */
665
666 /* Constructor for class layout.
667@@ -975,8 +1186,10 @@ layout::layout (diagnostic_context * con
668 diagnostic_t diagnostic_kind)
669 : m_context (context),
670 m_pp (context->printer),
671+ m_policy (make_policy (*context, *richloc)),
672 m_primary_loc (richloc->get_range (0)->m_loc),
673- m_exploc (richloc->get_expanded_location (0), context->tabstop),
674+ m_exploc (richloc->get_expanded_location (0), m_policy,
675+ LOCATION_ASPECT_CARET),
676 m_colorizer (context, diagnostic_kind),
677 m_colorize_source_p (context->colorize_source_p),
678 m_show_labels_p (context->show_labels_p),
679@@ -986,7 +1199,8 @@ layout::layout (diagnostic_context * con
680 m_fixit_hints (richloc->get_num_fixit_hints ()),
681 m_line_spans (1 + richloc->get_num_locations ()),
682 m_linenum_width (0),
683- m_x_offset_display (0)
684+ m_x_offset_display (0),
685+ m_escape_on_output (richloc->escape_on_output_p ())
686 {
687 for (unsigned int idx = 0; idx < richloc->get_num_locations (); idx++)
688 {
689@@ -1072,10 +1286,13 @@ layout::maybe_add_location_range (const
690
691 /* Everything is now known to be in the correct source file,
692 but it may require further sanitization. */
693- layout_range ri (exploc_with_display_col (start, m_context->tabstop),
694- exploc_with_display_col (finish, m_context->tabstop),
695+ layout_range ri (exploc_with_display_col (start, m_policy,
696+ LOCATION_ASPECT_START),
697+ exploc_with_display_col (finish, m_policy,
698+ LOCATION_ASPECT_FINISH),
699 loc_range->m_range_display_kind,
700- exploc_with_display_col (caret, m_context->tabstop),
701+ exploc_with_display_col (caret, m_policy,
702+ LOCATION_ASPECT_CARET),
703 original_idx, loc_range->m_label);
704
705 /* If we have a range that finishes before it starts (perhaps
706@@ -1409,7 +1626,7 @@ layout::calculate_x_offset_display ()
707 = get_line_bytes_without_trailing_whitespace (line.get_buffer (),
708 line.length ());
709 int eol_display_column
710- = cpp_display_width (line.get_buffer (), line_bytes, m_context->tabstop);
711+ = cpp_display_width (line.get_buffer (), line_bytes, m_policy);
712 if (caret_display_column > eol_display_column
713 || !caret_display_column)
714 {
715@@ -1488,7 +1705,7 @@ layout::print_source_line (linenum_type
716 /* This object helps to keep track of which display column we are at, which is
717 necessary for computing the line bounds in display units, for doing
718 tab expansion, and for implementing m_x_offset_display. */
719- cpp_display_width_computation dw (line, line_bytes, m_context->tabstop);
720+ cpp_display_width_computation dw (line, line_bytes, m_policy);
721
722 /* Skip the first m_x_offset_display display columns. In case the leading
723 portion that will be skipped ends with a character with wcwidth > 1, then
724@@ -1536,7 +1753,8 @@ layout::print_source_line (linenum_type
725 tabs and replacing some control bytes with spaces as necessary. */
726 const char *c = dw.next_byte ();
727 const int start_disp_col = dw.display_cols_processed () + 1;
728- const int this_display_width = dw.process_next_codepoint ();
729+ cpp_decoded_char cp;
730+ const int this_display_width = dw.process_next_codepoint (&cp);
731 if (*c == '\t')
732 {
733 /* The returned display width is the number of spaces into which the
734@@ -1545,15 +1763,6 @@ layout::print_source_line (linenum_type
735 pp_space (m_pp);
736 continue;
737 }
738- if (*c == '\0' || *c == '\r')
739- {
740- /* cpp_wcwidth() promises to return 1 for all control bytes, and we
741- want to output these as a single space too, so this case is
742- actually the same as the '\t' case. */
743- gcc_assert (this_display_width == 1);
744- pp_space (m_pp);
745- continue;
746- }
747
748 /* We have a (possibly multibyte) character to output; update the line
749 bounds if it is not whitespace. */
750@@ -1565,7 +1774,8 @@ layout::print_source_line (linenum_type
751 }
752
753 /* Output the character. */
754- while (c != dw.next_byte ()) pp_character (m_pp, *c++);
755+ m_policy.m_print_cb (m_pp, cp);
756+ c = dw.next_byte ();
757 }
758 print_newline ();
759 return lbounds;
760@@ -1664,14 +1874,14 @@ layout::print_annotation_line (linenum_t
761 class line_label
762 {
763 public:
764- line_label (diagnostic_context *context, int state_idx, int column,
765+ line_label (const cpp_char_column_policy &policy,
766+ int state_idx, int column,
767 label_text text)
768 : m_state_idx (state_idx), m_column (column),
769 m_text (text), m_label_line (0), m_has_vbar (true)
770 {
771 const int bytes = strlen (text.m_buffer);
772- m_display_width
773- = cpp_display_width (text.m_buffer, bytes, context->tabstop);
774+ m_display_width = cpp_display_width (text.m_buffer, bytes, policy);
775 }
776
777 /* Sorting is primarily by column, then by state index. */
778@@ -1731,7 +1941,7 @@ layout::print_any_labels (linenum_type r
779 if (text.m_buffer == NULL)
780 continue;
781
782- labels.safe_push (line_label (m_context, i, disp_col, text));
783+ labels.safe_push (line_label (m_policy, i, disp_col, text));
784 }
785 }
786
787@@ -2011,7 +2221,7 @@ public:
788
789 /* Get the range of bytes or display columns that HINT would affect. */
790 static column_range
791-get_affected_range (diagnostic_context *context,
792+get_affected_range (const cpp_char_column_policy &policy,
793 const fixit_hint *hint, enum column_unit col_unit)
794 {
795 expanded_location exploc_start = expand_location (hint->get_start_loc ());
796@@ -2022,13 +2232,11 @@ get_affected_range (diagnostic_context *
797 int finish_column;
798 if (col_unit == CU_DISPLAY_COLS)
799 {
800- start_column
801- = location_compute_display_column (exploc_start, context->tabstop);
802+ start_column = location_compute_display_column (exploc_start, policy);
803 if (hint->insertion_p ())
804 finish_column = start_column - 1;
805 else
806- finish_column
807- = location_compute_display_column (exploc_finish, context->tabstop);
808+ finish_column = location_compute_display_column (exploc_finish, policy);
809 }
810 else
811 {
812@@ -2041,12 +2249,13 @@ get_affected_range (diagnostic_context *
813 /* Get the range of display columns that would be printed for HINT. */
814
815 static column_range
816-get_printed_columns (diagnostic_context *context, const fixit_hint *hint)
817+get_printed_columns (const cpp_char_column_policy &policy,
818+ const fixit_hint *hint)
819 {
820 expanded_location exploc = expand_location (hint->get_start_loc ());
821- int start_column = location_compute_display_column (exploc, context->tabstop);
822+ int start_column = location_compute_display_column (exploc, policy);
823 int hint_width = cpp_display_width (hint->get_string (), hint->get_length (),
824- context->tabstop);
825+ policy);
826 int final_hint_column = start_column + hint_width - 1;
827 if (hint->insertion_p ())
828 {
829@@ -2056,8 +2265,7 @@ get_printed_columns (diagnostic_context
830 {
831 exploc = expand_location (hint->get_next_loc ());
832 --exploc.column;
833- int finish_column
834- = location_compute_display_column (exploc, context->tabstop);
835+ int finish_column = location_compute_display_column (exploc, policy);
836 return column_range (start_column,
837 MAX (finish_column, final_hint_column));
838 }
839@@ -2075,13 +2283,13 @@ public:
840 column_range affected_columns,
841 column_range printed_columns,
842 const char *new_text, size_t new_text_len,
843- int tabstop)
844+ const cpp_char_column_policy &policy)
845 : m_affected_bytes (affected_bytes),
846 m_affected_columns (affected_columns),
847 m_printed_columns (printed_columns),
848 m_text (xstrdup (new_text)),
849 m_byte_length (new_text_len),
850- m_tabstop (tabstop),
851+ m_policy (policy),
852 m_alloc_sz (new_text_len + 1)
853 {
854 compute_display_cols ();
855@@ -2099,7 +2307,7 @@ public:
856
857 void compute_display_cols ()
858 {
859- m_display_cols = cpp_display_width (m_text, m_byte_length, m_tabstop);
860+ m_display_cols = cpp_display_width (m_text, m_byte_length, m_policy);
861 }
862
863 void overwrite (int dst_offset, const char_span &src_span)
864@@ -2127,7 +2335,7 @@ public:
865 char *m_text;
866 size_t m_byte_length; /* Not including null-terminator. */
867 int m_display_cols;
868- int m_tabstop;
869+ const cpp_char_column_policy &m_policy;
870 size_t m_alloc_sz;
871 };
872
873@@ -2163,15 +2371,16 @@ correction::ensure_terminated ()
874 class line_corrections
875 {
876 public:
877- line_corrections (diagnostic_context *context, const char *filename,
878+ line_corrections (const char_display_policy &policy,
879+ const char *filename,
880 linenum_type row)
881- : m_context (context), m_filename (filename), m_row (row)
882+ : m_policy (policy), m_filename (filename), m_row (row)
883 {}
884 ~line_corrections ();
885
886 void add_hint (const fixit_hint *hint);
887
888- diagnostic_context *m_context;
889+ const char_display_policy &m_policy;
890 const char *m_filename;
891 linenum_type m_row;
892 auto_vec <correction *> m_corrections;
893@@ -2217,10 +2426,10 @@ source_line::source_line (const char *fi
894 void
895 line_corrections::add_hint (const fixit_hint *hint)
896 {
897- column_range affected_bytes = get_affected_range (m_context, hint, CU_BYTES);
898- column_range affected_columns = get_affected_range (m_context, hint,
899+ column_range affected_bytes = get_affected_range (m_policy, hint, CU_BYTES);
900+ column_range affected_columns = get_affected_range (m_policy, hint,
901 CU_DISPLAY_COLS);
902- column_range printed_columns = get_printed_columns (m_context, hint);
903+ column_range printed_columns = get_printed_columns (m_policy, hint);
904
905 /* Potentially consolidate. */
906 if (!m_corrections.is_empty ())
907@@ -2289,7 +2498,7 @@ line_corrections::add_hint (const fixit_
908 printed_columns,
909 hint->get_string (),
910 hint->get_length (),
911- m_context->tabstop));
912+ m_policy));
913 }
914
915 /* If there are any fixit hints on source line ROW, print them.
916@@ -2303,7 +2512,7 @@ layout::print_trailing_fixits (linenum_t
917 {
918 /* Build a list of correction instances for the line,
919 potentially consolidating hints (for the sake of readability). */
920- line_corrections corrections (m_context, m_exploc.file, row);
921+ line_corrections corrections (m_policy, m_exploc.file, row);
922 for (unsigned int i = 0; i < m_fixit_hints.length (); i++)
923 {
924 const fixit_hint *hint = m_fixit_hints[i];
925@@ -2646,6 +2855,59 @@ namespace selftest {
926
927 /* Selftests for diagnostic_show_locus. */
928
929+/* Verify that cpp_display_width correctly handles escaping. */
930+
931+static void
932+test_display_widths ()
933+{
934+ gcc_rich_location richloc (UNKNOWN_LOCATION);
935+
936+ /* U+03C0 "GREEK SMALL LETTER PI". */
937+ const char *pi = "\xCF\x80";
938+ /* U+1F642 "SLIGHTLY SMILING FACE". */
939+ const char *emoji = "\xF0\x9F\x99\x82";
940+ /* Stray trailing byte of a UTF-8 character. */
941+ const char *stray = "\xBF";
942+ /* U+10FFFF. */
943+ const char *max_codepoint = "\xF4\x8F\xBF\xBF";
944+
945+ /* No escaping. */
946+ {
947+ test_diagnostic_context dc;
948+ char_display_policy policy (make_policy (dc, richloc));
949+ ASSERT_EQ (cpp_display_width (pi, strlen (pi), policy), 1);
950+ ASSERT_EQ (cpp_display_width (emoji, strlen (emoji), policy), 2);
951+ ASSERT_EQ (cpp_display_width (stray, strlen (stray), policy), 1);
952+ /* Don't check width of U+10FFFF; it's in a private use plane. */
953+ }
954+
955+ richloc.set_escape_on_output (true);
956+
957+ {
958+ test_diagnostic_context dc;
959+ dc.escape_format = DIAGNOSTICS_ESCAPE_FORMAT_UNICODE;
960+ char_display_policy policy (make_policy (dc, richloc));
961+ ASSERT_EQ (cpp_display_width (pi, strlen (pi), policy), 8);
962+ ASSERT_EQ (cpp_display_width (emoji, strlen (emoji), policy), 9);
963+ ASSERT_EQ (cpp_display_width (stray, strlen (stray), policy), 4);
964+ ASSERT_EQ (cpp_display_width (max_codepoint, strlen (max_codepoint),
965+ policy),
966+ strlen ("<U+10FFFF>"));
967+ }
968+
969+ {
970+ test_diagnostic_context dc;
971+ dc.escape_format = DIAGNOSTICS_ESCAPE_FORMAT_BYTES;
972+ char_display_policy policy (make_policy (dc, richloc));
973+ ASSERT_EQ (cpp_display_width (pi, strlen (pi), policy), 8);
974+ ASSERT_EQ (cpp_display_width (emoji, strlen (emoji), policy), 16);
975+ ASSERT_EQ (cpp_display_width (stray, strlen (stray), policy), 4);
976+ ASSERT_EQ (cpp_display_width (max_codepoint, strlen (max_codepoint),
977+ policy),
978+ 16);
979+ }
980+}
981+
982 /* For precise tests of the layout, make clear where the source line will
983 start. test_left_margin sets the total byte count from the left side of the
984 screen to the start of source lines, after the line number and the separator,
985@@ -2715,10 +2977,10 @@ test_layout_x_offset_display_utf8 (const
986 char_span lspan = location_get_source_line (tmp.get_filename (), 1);
987 ASSERT_EQ (line_display_cols,
988 cpp_display_width (lspan.get_buffer (), lspan.length (),
989- def_tabstop));
990+ def_policy ()));
991 ASSERT_EQ (line_display_cols,
992 location_compute_display_column (expand_location (line_end),
993- def_tabstop));
994+ def_policy ()));
995 ASSERT_EQ (0, memcmp (lspan.get_buffer () + (emoji_col - 1),
996 "\xf0\x9f\x98\x82\xf0\x9f\x98\x82", 8));
997
998@@ -2866,12 +3128,13 @@ test_layout_x_offset_display_tab (const
999 ASSERT_EQ ('\t', *(lspan.get_buffer () + (tab_col - 1)));
1000 for (int tabstop = 1; tabstop != num_tabstops; ++tabstop)
1001 {
1002+ cpp_char_column_policy policy (tabstop, cpp_wcwidth);
1003 ASSERT_EQ (line_bytes + extra_width[tabstop],
1004 cpp_display_width (lspan.get_buffer (), lspan.length (),
1005- tabstop));
1006+ policy));
1007 ASSERT_EQ (line_bytes + extra_width[tabstop],
1008 location_compute_display_column (expand_location (line_end),
1009- tabstop));
1010+ policy));
1011 }
1012
1013 /* Check that the tab is expanded to the expected number of spaces. */
1014@@ -4003,6 +4266,43 @@ test_one_liner_labels_utf8 ()
1015 " bb\xf0\x9f\x98\x82\xf0\x9f\x98\x82\n",
1016 pp_formatted_text (dc.printer));
1017 }
1018+
1019+ /* Example of escaping the source lines. */
1020+ {
1021+ text_range_label label0 ("label 0\xf0\x9f\x98\x82");
1022+ text_range_label label1 ("label 1\xcf\x80");
1023+ text_range_label label2 ("label 2\xcf\x80");
1024+ gcc_rich_location richloc (foo, &label0);
1025+ richloc.add_range (bar, SHOW_RANGE_WITHOUT_CARET, &label1);
1026+ richloc.add_range (field, SHOW_RANGE_WITHOUT_CARET, &label2);
1027+ richloc.set_escape_on_output (true);
1028+
1029+ {
1030+ test_diagnostic_context dc;
1031+ dc.escape_format = DIAGNOSTICS_ESCAPE_FORMAT_UNICODE;
1032+ diagnostic_show_locus (&dc, &richloc, DK_ERROR);
1033+ ASSERT_STREQ (" <U+1F602>_foo = <U+03C0>_bar.<U+1F602>_field<U+03C0>;\n"
1034+ " ^~~~~~~~~~~~~ ~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~\n"
1035+ " | | |\n"
1036+ " | | label 2\xcf\x80\n"
1037+ " | label 1\xcf\x80\n"
1038+ " label 0\xf0\x9f\x98\x82\n",
1039+ pp_formatted_text (dc.printer));
1040+ }
1041+ {
1042+ test_diagnostic_context dc;
1043+ dc.escape_format = DIAGNOSTICS_ESCAPE_FORMAT_BYTES;
1044+ diagnostic_show_locus (&dc, &richloc, DK_ERROR);
1045+ ASSERT_STREQ
1046+ (" <f0><9f><98><82>_foo = <cf><80>_bar.<f0><9f><98><82>_field<cf><80>;\n"
1047+ " ^~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
1048+ " | | |\n"
1049+ " | | label 2\xcf\x80\n"
1050+ " | label 1\xcf\x80\n"
1051+ " label 0\xf0\x9f\x98\x82\n",
1052+ pp_formatted_text (dc.printer));
1053+ }
1054+ }
1055 }
1056
1057 /* Make sure that colorization codes don't interrupt a multibyte
1058@@ -4057,9 +4357,9 @@ test_diagnostic_show_locus_one_liner_utf
1059
1060 char_span lspan = location_get_source_line (tmp.get_filename (), 1);
1061 ASSERT_EQ (25, cpp_display_width (lspan.get_buffer (), lspan.length (),
1062- def_tabstop));
1063+ def_policy ()));
1064 ASSERT_EQ (25, location_compute_display_column (expand_location (line_end),
1065- def_tabstop));
1066+ def_policy ()));
1067
1068 test_one_liner_simple_caret_utf8 ();
1069 test_one_liner_caret_and_range_utf8 ();
1070@@ -4445,30 +4745,31 @@ test_overlapped_fixit_printing (const li
1071 pp_formatted_text (dc.printer));
1072
1073 /* Unit-test the line_corrections machinery. */
1074+ char_display_policy policy (make_policy (dc, richloc));
1075 ASSERT_EQ (3, richloc.get_num_fixit_hints ());
1076 const fixit_hint *hint_0 = richloc.get_fixit_hint (0);
1077 ASSERT_EQ (column_range (12, 12),
1078- get_affected_range (&dc, hint_0, CU_BYTES));
1079+ get_affected_range (policy, hint_0, CU_BYTES));
1080 ASSERT_EQ (column_range (12, 12),
1081- get_affected_range (&dc, hint_0, CU_DISPLAY_COLS));
1082- ASSERT_EQ (column_range (12, 22), get_printed_columns (&dc, hint_0));
1083+ get_affected_range (policy, hint_0, CU_DISPLAY_COLS));
1084+ ASSERT_EQ (column_range (12, 22), get_printed_columns (policy, hint_0));
1085 const fixit_hint *hint_1 = richloc.get_fixit_hint (1);
1086 ASSERT_EQ (column_range (18, 18),
1087- get_affected_range (&dc, hint_1, CU_BYTES));
1088+ get_affected_range (policy, hint_1, CU_BYTES));
1089 ASSERT_EQ (column_range (18, 18),
1090- get_affected_range (&dc, hint_1, CU_DISPLAY_COLS));
1091- ASSERT_EQ (column_range (18, 20), get_printed_columns (&dc, hint_1));
1092+ get_affected_range (policy, hint_1, CU_DISPLAY_COLS));
1093+ ASSERT_EQ (column_range (18, 20), get_printed_columns (policy, hint_1));
1094 const fixit_hint *hint_2 = richloc.get_fixit_hint (2);
1095 ASSERT_EQ (column_range (29, 28),
1096- get_affected_range (&dc, hint_2, CU_BYTES));
1097+ get_affected_range (policy, hint_2, CU_BYTES));
1098 ASSERT_EQ (column_range (29, 28),
1099- get_affected_range (&dc, hint_2, CU_DISPLAY_COLS));
1100- ASSERT_EQ (column_range (29, 29), get_printed_columns (&dc, hint_2));
1101+ get_affected_range (policy, hint_2, CU_DISPLAY_COLS));
1102+ ASSERT_EQ (column_range (29, 29), get_printed_columns (policy, hint_2));
1103
1104 /* Add each hint in turn to a line_corrections instance,
1105 and verify that they are consolidated into one correction instance
1106 as expected. */
1107- line_corrections lc (&dc, tmp.get_filename (), 1);
1108+ line_corrections lc (policy, tmp.get_filename (), 1);
1109
1110 /* The first replace hint by itself. */
1111 lc.add_hint (hint_0);
1112@@ -4660,30 +4961,31 @@ test_overlapped_fixit_printing_utf8 (con
1113 pp_formatted_text (dc.printer));
1114
1115 /* Unit-test the line_corrections machinery. */
1116+ char_display_policy policy (make_policy (dc, richloc));
1117 ASSERT_EQ (3, richloc.get_num_fixit_hints ());
1118 const fixit_hint *hint_0 = richloc.get_fixit_hint (0);
1119 ASSERT_EQ (column_range (14, 14),
1120- get_affected_range (&dc, hint_0, CU_BYTES));
1121+ get_affected_range (policy, hint_0, CU_BYTES));
1122 ASSERT_EQ (column_range (12, 12),
1123- get_affected_range (&dc, hint_0, CU_DISPLAY_COLS));
1124- ASSERT_EQ (column_range (12, 22), get_printed_columns (&dc, hint_0));
1125+ get_affected_range (policy, hint_0, CU_DISPLAY_COLS));
1126+ ASSERT_EQ (column_range (12, 22), get_printed_columns (policy, hint_0));
1127 const fixit_hint *hint_1 = richloc.get_fixit_hint (1);
1128 ASSERT_EQ (column_range (22, 22),
1129- get_affected_range (&dc, hint_1, CU_BYTES));
1130+ get_affected_range (policy, hint_1, CU_BYTES));
1131 ASSERT_EQ (column_range (18, 18),
1132- get_affected_range (&dc, hint_1, CU_DISPLAY_COLS));
1133- ASSERT_EQ (column_range (18, 20), get_printed_columns (&dc, hint_1));
1134+ get_affected_range (policy, hint_1, CU_DISPLAY_COLS));
1135+ ASSERT_EQ (column_range (18, 20), get_printed_columns (policy, hint_1));
1136 const fixit_hint *hint_2 = richloc.get_fixit_hint (2);
1137 ASSERT_EQ (column_range (35, 34),
1138- get_affected_range (&dc, hint_2, CU_BYTES));
1139+ get_affected_range (policy, hint_2, CU_BYTES));
1140 ASSERT_EQ (column_range (30, 29),
1141- get_affected_range (&dc, hint_2, CU_DISPLAY_COLS));
1142- ASSERT_EQ (column_range (30, 30), get_printed_columns (&dc, hint_2));
1143+ get_affected_range (policy, hint_2, CU_DISPLAY_COLS));
1144+ ASSERT_EQ (column_range (30, 30), get_printed_columns (policy, hint_2));
1145
1146 /* Add each hint in turn to a line_corrections instance,
1147 and verify that they are consolidated into one correction instance
1148 as expected. */
1149- line_corrections lc (&dc, tmp.get_filename (), 1);
1150+ line_corrections lc (policy, tmp.get_filename (), 1);
1151
1152 /* The first replace hint by itself. */
1153 lc.add_hint (hint_0);
1154@@ -4877,15 +5179,16 @@ test_overlapped_fixit_printing_2 (const
1155 richloc.add_fixit_insert_before (col_21, "}");
1156
1157 /* These fixits should be accepted; they can't be consolidated. */
1158+ char_display_policy policy (make_policy (dc, richloc));
1159 ASSERT_EQ (2, richloc.get_num_fixit_hints ());
1160 const fixit_hint *hint_0 = richloc.get_fixit_hint (0);
1161 ASSERT_EQ (column_range (23, 22),
1162- get_affected_range (&dc, hint_0, CU_BYTES));
1163- ASSERT_EQ (column_range (23, 23), get_printed_columns (&dc, hint_0));
1164+ get_affected_range (policy, hint_0, CU_BYTES));
1165+ ASSERT_EQ (column_range (23, 23), get_printed_columns (policy, hint_0));
1166 const fixit_hint *hint_1 = richloc.get_fixit_hint (1);
1167 ASSERT_EQ (column_range (21, 20),
1168- get_affected_range (&dc, hint_1, CU_BYTES));
1169- ASSERT_EQ (column_range (21, 21), get_printed_columns (&dc, hint_1));
1170+ get_affected_range (policy, hint_1, CU_BYTES));
1171+ ASSERT_EQ (column_range (21, 21), get_printed_columns (policy, hint_1));
1172
1173 /* Verify that they're printed correctly. */
1174 diagnostic_show_locus (&dc, &richloc, DK_ERROR);
1175@@ -5152,10 +5455,11 @@ test_tab_expansion (const line_table_cas
1176 ....................123 45678901234 56789012345 columns */
1177
1178 const int tabstop = 8;
1179+ cpp_char_column_policy policy (tabstop, cpp_wcwidth);
1180 const int first_non_ws_byte_col = 7;
1181 const int right_quote_byte_col = 15;
1182 const int last_byte_col = 25;
1183- ASSERT_EQ (35, cpp_display_width (content, last_byte_col, tabstop));
1184+ ASSERT_EQ (35, cpp_display_width (content, last_byte_col, policy));
1185
1186 temp_source_file tmp (SELFTEST_LOCATION, ".c", content);
1187 line_table_test ltt (case_);
1188@@ -5198,6 +5502,114 @@ test_tab_expansion (const line_table_cas
1189 }
1190 }
1191
1192+/* Verify that the escaping machinery can cope with a variety of different
1193+ invalid bytes. */
1194+
1195+static void
1196+test_escaping_bytes_1 (const line_table_case &case_)
1197+{
1198+ const char content[] = "before\0\1\2\3\r\x80\xff""after\n";
1199+ const size_t sz = sizeof (content);
1200+ temp_source_file tmp (SELFTEST_LOCATION, ".c", content, sz);
1201+ line_table_test ltt (case_);
1202+ const line_map_ordinary *ord_map = linemap_check_ordinary
1203+ (linemap_add (line_table, LC_ENTER, false, tmp.get_filename (), 0));
1204+ linemap_line_start (line_table, 1, 100);
1205+
1206+ location_t finish
1207+ = linemap_position_for_line_and_column (line_table, ord_map, 1,
1208+ strlen (content));
1209+
1210+ if (finish > LINE_MAP_MAX_LOCATION_WITH_COLS)
1211+ return;
1212+
1213+ /* Locations of the NUL and \r bytes. */
1214+ location_t nul_loc
1215+ = linemap_position_for_line_and_column (line_table, ord_map, 1, 7);
1216+ location_t r_loc
1217+ = linemap_position_for_line_and_column (line_table, ord_map, 1, 11);
1218+ gcc_rich_location richloc (nul_loc);
1219+ richloc.add_range (r_loc);
1220+
1221+ {
1222+ test_diagnostic_context dc;
1223+ diagnostic_show_locus (&dc, &richloc, DK_ERROR);
1224+ ASSERT_STREQ (" before \1\2\3 \x80\xff""after\n"
1225+ " ^ ~\n",
1226+ pp_formatted_text (dc.printer));
1227+ }
1228+ richloc.set_escape_on_output (true);
1229+ {
1230+ test_diagnostic_context dc;
1231+ dc.escape_format = DIAGNOSTICS_ESCAPE_FORMAT_UNICODE;
1232+ diagnostic_show_locus (&dc, &richloc, DK_ERROR);
1233+ ASSERT_STREQ
1234+ (" before<U+0000><U+0001><U+0002><U+0003><U+000D><80><ff>after\n"
1235+ " ^~~~~~~~ ~~~~~~~~\n",
1236+ pp_formatted_text (dc.printer));
1237+ }
1238+ {
1239+ test_diagnostic_context dc;
1240+ dc.escape_format = DIAGNOSTICS_ESCAPE_FORMAT_BYTES;
1241+ diagnostic_show_locus (&dc, &richloc, DK_ERROR);
1242+ ASSERT_STREQ (" before<00><01><02><03><0d><80><ff>after\n"
1243+ " ^~~~ ~~~~\n",
1244+ pp_formatted_text (dc.printer));
1245+ }
1246+}
1247+
1248+/* As above, but verify that we handle the initial byte of a line
1249+ correctly. */
1250+
1251+static void
1252+test_escaping_bytes_2 (const line_table_case &case_)
1253+{
1254+ const char content[] = "\0after\n";
1255+ const size_t sz = sizeof (content);
1256+ temp_source_file tmp (SELFTEST_LOCATION, ".c", content, sz);
1257+ line_table_test ltt (case_);
1258+ const line_map_ordinary *ord_map = linemap_check_ordinary
1259+ (linemap_add (line_table, LC_ENTER, false, tmp.get_filename (), 0));
1260+ linemap_line_start (line_table, 1, 100);
1261+
1262+ location_t finish
1263+ = linemap_position_for_line_and_column (line_table, ord_map, 1,
1264+ strlen (content));
1265+
1266+ if (finish > LINE_MAP_MAX_LOCATION_WITH_COLS)
1267+ return;
1268+
1269+ /* Location of the NUL byte. */
1270+ location_t nul_loc
1271+ = linemap_position_for_line_and_column (line_table, ord_map, 1, 1);
1272+ gcc_rich_location richloc (nul_loc);
1273+
1274+ {
1275+ test_diagnostic_context dc;
1276+ diagnostic_show_locus (&dc, &richloc, DK_ERROR);
1277+ ASSERT_STREQ (" after\n"
1278+ " ^\n",
1279+ pp_formatted_text (dc.printer));
1280+ }
1281+ richloc.set_escape_on_output (true);
1282+ {
1283+ test_diagnostic_context dc;
1284+ dc.escape_format = DIAGNOSTICS_ESCAPE_FORMAT_UNICODE;
1285+ diagnostic_show_locus (&dc, &richloc, DK_ERROR);
1286+ ASSERT_STREQ (" <U+0000>after\n"
1287+ " ^~~~~~~~\n",
1288+ pp_formatted_text (dc.printer));
1289+ }
1290+ {
1291+ test_diagnostic_context dc;
1292+ dc.escape_format = DIAGNOSTICS_ESCAPE_FORMAT_BYTES;
1293+ diagnostic_show_locus (&dc, &richloc, DK_ERROR);
1294+ ASSERT_STREQ (" <00>after\n"
1295+ " ^~~~\n",
1296+ pp_formatted_text (dc.printer));
1297+ }
1298+}
1299+
1300 /* Verify that line numbers are correctly printed for the case of
1301 a multiline range in which the width of the line numbers changes
1302 (e.g. from "9" to "10"). */
1303@@ -5254,6 +5666,8 @@ diagnostic_show_locus_c_tests ()
1304 test_layout_range_for_single_line ();
1305 test_layout_range_for_multiple_lines ();
1306
1307+ test_display_widths ();
1308+
1309 for_each_line_table_case (test_layout_x_offset_display_utf8);
1310 for_each_line_table_case (test_layout_x_offset_display_tab);
1311
1312@@ -5274,6 +5688,8 @@ diagnostic_show_locus_c_tests ()
1313 for_each_line_table_case (test_fixit_replace_containing_newline);
1314 for_each_line_table_case (test_fixit_deletion_affecting_newline);
1315 for_each_line_table_case (test_tab_expansion);
1316+ for_each_line_table_case (test_escaping_bytes_1);
1317+ for_each_line_table_case (test_escaping_bytes_2);
1318
1319 test_line_numbers_multiline_range ();
1320 }
1321diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
1322--- a/gcc/doc/invoke.texi 2021-12-13 23:23:05.764437151 -0800
1323+++ b/gcc/doc/invoke.texi 2021-12-14 01:16:01.553943061 -0800
1324@@ -312,7 +312,8 @@ Objective-C and Objective-C++ Dialects}.
1325 -fdiagnostics-show-path-depths @gol
1326 -fno-show-column @gol
1327 -fdiagnostics-column-unit=@r{[}display@r{|}byte@r{]} @gol
1328--fdiagnostics-column-origin=@var{origin}}
1329+-fdiagnostics-column-origin=@var{origin} @gol
1330+-fdiagnostics-escape-format=@r{[}unicode@r{|}bytes@r{]}}
1331
1332 @item Warning Options
1333 @xref{Warning Options,,Options to Request or Suppress Warnings}.
1334@@ -5083,6 +5084,38 @@ first column. The default value of 1 co
1335 behavior and to the GNU style guide. Some utilities may perform better with an
1336 origin of 0; any non-negative value may be specified.
1337
1338+@item -fdiagnostics-escape-format=@var{FORMAT}
1339+@opindex fdiagnostics-escape-format
1340+When GCC prints pertinent source lines for a diagnostic it normally attempts
1341+to print the source bytes directly. However, some diagnostics relate to encoding
1342+issues in the source file, such as malformed UTF-8, or issues with Unicode
1343+normalization. These diagnostics are flagged so that GCC will escape bytes
1344+that are not printable ASCII when printing their pertinent source lines.
1345+
1346+This option controls how such bytes should be escaped.
1347+
1348+The default @var{FORMAT}, @samp{unicode} displays Unicode characters that
1349+are not printable ASCII in the form @samp{<U+XXXX>}, and bytes that do not
1350+correspond to a Unicode character validly-encoded in UTF-8-encoded will be
1351+displayed as hexadecimal in the form @samp{<XX>}.
1352+
1353+For example, a source line containing the string @samp{before} followed by the
1354+Unicode character U+03C0 (``GREEK SMALL LETTER PI'', with UTF-8 encoding
1355+0xCF 0x80) followed by the byte 0xBF (a stray UTF-8 trailing byte), followed by
1356+the string @samp{after} will be printed for such a diagnostic as:
1357+
1358+@smallexample
1359+ before<U+03C0><BF>after
1360+@end smallexample
1361+
1362+Setting @var{FORMAT} to @samp{bytes} will display all non-printable-ASCII bytes
1363+in the form @samp{<XX>}, thus showing the underlying encoding of non-ASCII
1364+Unicode characters. For the example above, the following will be printed:
1365+
1366+@smallexample
1367+ before<CF><80><BF>after
1368+@end smallexample
1369+
1370 @item -fdiagnostics-format=@var{FORMAT}
1371 @opindex fdiagnostics-format
1372 Select a different format for printing diagnostics.
1373@@ -5150,9 +5183,11 @@ might be printed in JSON form (after for
1374 @}
1375 @}
1376 ],
1377+ "escape-source": false,
1378 "message": "...this statement, but the latter is @dots{}"
1379 @}
1380 ]
1381+ "escape-source": false,
1382 "column-origin": 1,
1383 @},
1384 @dots{}
1385@@ -5239,6 +5274,7 @@ of the expression, which have labels. I
1386 "label": "T @{aka struct t@}"
1387 @}
1388 ],
1389+ "escape-source": false,
1390 "message": "invalid operands to binary + @dots{}"
1391 @}
1392 @end smallexample
1393@@ -5292,6 +5328,7 @@ might be printed in JSON form as:
1394 @}
1395 @}
1396 ],
1397+ "escape-source": false,
1398 "message": "\u2018struct s\u2019 has no member named @dots{}"
1399 @}
1400 @end smallexample
1401@@ -5349,6 +5386,10 @@ For example, the intraprocedural example
1402 ]
1403 @end smallexample
1404
1405+Diagnostics have a boolean attribute @code{escape-source}, hinting whether
1406+non-ASCII bytes should be escaped when printing the pertinent lines of
1407+source code (@code{true} for diagnostics involving source encoding issues).
1408+
1409 @end table
1410
1411 @node Warning Options
1412diff --git a/gcc/input.c b/gcc/input.c
1413--- a/gcc/input.c 2021-07-27 23:55:07.328287915 -0700
1414+++ b/gcc/input.c 2021-12-14 01:16:01.553943061 -0800
1415@@ -913,7 +913,8 @@ make_location (location_t caret, source_
1416 source line in order to calculate the display width. If that cannot be done
1417 for any reason, then returns the byte column as a fallback. */
1418 int
1419-location_compute_display_column (expanded_location exploc, int tabstop)
1420+location_compute_display_column (expanded_location exploc,
1421+ const cpp_char_column_policy &policy)
1422 {
1423 if (!(exploc.file && *exploc.file && exploc.line && exploc.column))
1424 return exploc.column;
1425@@ -921,7 +922,7 @@ location_compute_display_column (expande
1426 /* If line is NULL, this function returns exploc.column which is the
1427 desired fallback. */
1428 return cpp_byte_column_to_display_column (line.get_buffer (), line.length (),
1429- exploc.column, tabstop);
1430+ exploc.column, policy);
1431 }
1432
1433 /* Dump statistics to stderr about the memory usage of the line_table
1434@@ -3611,43 +3612,50 @@ test_line_offset_overflow ()
1435 void test_cpp_utf8 ()
1436 {
1437 const int def_tabstop = 8;
1438+ cpp_char_column_policy policy (def_tabstop, cpp_wcwidth);
1439+
1440 /* Verify that wcwidth of invalid UTF-8 or control bytes is 1. */
1441 {
1442- int w_bad = cpp_display_width ("\xf0!\x9f!\x98!\x82!", 8, def_tabstop);
1443+ int w_bad = cpp_display_width ("\xf0!\x9f!\x98!\x82!", 8, policy);
1444 ASSERT_EQ (8, w_bad);
1445- int w_ctrl = cpp_display_width ("\r\n\v\0\1", 5, def_tabstop);
1446+ int w_ctrl = cpp_display_width ("\r\n\v\0\1", 5, policy);
1447 ASSERT_EQ (5, w_ctrl);
1448 }
1449
1450 /* Verify that wcwidth of valid UTF-8 is as expected. */
1451 {
1452- const int w_pi = cpp_display_width ("\xcf\x80", 2, def_tabstop);
1453+ const int w_pi = cpp_display_width ("\xcf\x80", 2, policy);
1454 ASSERT_EQ (1, w_pi);
1455- const int w_emoji = cpp_display_width ("\xf0\x9f\x98\x82", 4, def_tabstop);
1456+ const int w_emoji = cpp_display_width ("\xf0\x9f\x98\x82", 4, policy);
1457 ASSERT_EQ (2, w_emoji);
1458 const int w_umlaut_precomposed = cpp_display_width ("\xc3\xbf", 2,
1459- def_tabstop);
1460+ policy);
1461 ASSERT_EQ (1, w_umlaut_precomposed);
1462 const int w_umlaut_combining = cpp_display_width ("y\xcc\x88", 3,
1463- def_tabstop);
1464+ policy);
1465 ASSERT_EQ (1, w_umlaut_combining);
1466- const int w_han = cpp_display_width ("\xe4\xb8\xba", 3, def_tabstop);
1467+ const int w_han = cpp_display_width ("\xe4\xb8\xba", 3, policy);
1468 ASSERT_EQ (2, w_han);
1469- const int w_ascii = cpp_display_width ("GCC", 3, def_tabstop);
1470+ const int w_ascii = cpp_display_width ("GCC", 3, policy);
1471 ASSERT_EQ (3, w_ascii);
1472 const int w_mixed = cpp_display_width ("\xcf\x80 = 3.14 \xf0\x9f\x98\x82"
1473 "\x9f! \xe4\xb8\xba y\xcc\x88",
1474- 24, def_tabstop);
1475+ 24, policy);
1476 ASSERT_EQ (18, w_mixed);
1477 }
1478
1479 /* Verify that display width properly expands tabs. */
1480 {
1481 const char *tstr = "\tabc\td";
1482- ASSERT_EQ (6, cpp_display_width (tstr, 6, 1));
1483- ASSERT_EQ (10, cpp_display_width (tstr, 6, 3));
1484- ASSERT_EQ (17, cpp_display_width (tstr, 6, 8));
1485- ASSERT_EQ (1, cpp_display_column_to_byte_column (tstr, 6, 7, 8));
1486+ ASSERT_EQ (6, cpp_display_width (tstr, 6,
1487+ cpp_char_column_policy (1, cpp_wcwidth)));
1488+ ASSERT_EQ (10, cpp_display_width (tstr, 6,
1489+ cpp_char_column_policy (3, cpp_wcwidth)));
1490+ ASSERT_EQ (17, cpp_display_width (tstr, 6,
1491+ cpp_char_column_policy (8, cpp_wcwidth)));
1492+ ASSERT_EQ (1,
1493+ cpp_display_column_to_byte_column
1494+ (tstr, 6, 7, cpp_char_column_policy (8, cpp_wcwidth)));
1495 }
1496
1497 /* Verify that cpp_byte_column_to_display_column can go past the end,
1498@@ -3660,13 +3668,13 @@ void test_cpp_utf8 ()
1499 /* 111122223456
1500 Byte columns. */
1501
1502- ASSERT_EQ (5, cpp_display_width (str, 6, def_tabstop));
1503+ ASSERT_EQ (5, cpp_display_width (str, 6, policy));
1504 ASSERT_EQ (105,
1505- cpp_byte_column_to_display_column (str, 6, 106, def_tabstop));
1506+ cpp_byte_column_to_display_column (str, 6, 106, policy));
1507 ASSERT_EQ (10000,
1508- cpp_byte_column_to_display_column (NULL, 0, 10000, def_tabstop));
1509+ cpp_byte_column_to_display_column (NULL, 0, 10000, policy));
1510 ASSERT_EQ (0,
1511- cpp_byte_column_to_display_column (NULL, 10000, 0, def_tabstop));
1512+ cpp_byte_column_to_display_column (NULL, 10000, 0, policy));
1513 }
1514
1515 /* Verify that cpp_display_column_to_byte_column can go past the end,
1516@@ -3680,25 +3688,25 @@ void test_cpp_utf8 ()
1517 /* 000000000000000000000000000000000111111
1518 111122223333444456666777788889999012345
1519 Byte columns. */
1520- ASSERT_EQ (4, cpp_display_column_to_byte_column (str, 15, 2, def_tabstop));
1521+ ASSERT_EQ (4, cpp_display_column_to_byte_column (str, 15, 2, policy));
1522 ASSERT_EQ (15,
1523- cpp_display_column_to_byte_column (str, 15, 11, def_tabstop));
1524+ cpp_display_column_to_byte_column (str, 15, 11, policy));
1525 ASSERT_EQ (115,
1526- cpp_display_column_to_byte_column (str, 15, 111, def_tabstop));
1527+ cpp_display_column_to_byte_column (str, 15, 111, policy));
1528 ASSERT_EQ (10000,
1529- cpp_display_column_to_byte_column (NULL, 0, 10000, def_tabstop));
1530+ cpp_display_column_to_byte_column (NULL, 0, 10000, policy));
1531 ASSERT_EQ (0,
1532- cpp_display_column_to_byte_column (NULL, 10000, 0, def_tabstop));
1533+ cpp_display_column_to_byte_column (NULL, 10000, 0, policy));
1534
1535 /* Verify that we do not interrupt a UTF-8 sequence. */
1536- ASSERT_EQ (4, cpp_display_column_to_byte_column (str, 15, 1, def_tabstop));
1537+ ASSERT_EQ (4, cpp_display_column_to_byte_column (str, 15, 1, policy));
1538
1539 for (int byte_col = 1; byte_col <= 15; ++byte_col)
1540 {
1541 const int disp_col
1542- = cpp_byte_column_to_display_column (str, 15, byte_col, def_tabstop);
1543+ = cpp_byte_column_to_display_column (str, 15, byte_col, policy);
1544 const int byte_col2
1545- = cpp_display_column_to_byte_column (str, 15, disp_col, def_tabstop);
1546+ = cpp_display_column_to_byte_column (str, 15, disp_col, policy);
1547
1548 /* If we ask for the display column in the middle of a UTF-8
1549 sequence, it will return the length of the partial sequence,
1550diff --git a/gcc/input.h b/gcc/input.h
1551--- a/gcc/input.h 2021-07-27 23:55:07.328287915 -0700
1552+++ b/gcc/input.h 2021-12-14 01:16:01.553943061 -0800
1553@@ -39,8 +39,11 @@ STATIC_ASSERT (BUILTINS_LOCATION < RESER
1554 extern bool is_location_from_builtin_token (location_t);
1555 extern expanded_location expand_location (location_t);
1556
1557-extern int location_compute_display_column (expanded_location exploc,
1558- int tabstop);
1559+class cpp_char_column_policy;
1560+
1561+extern int
1562+location_compute_display_column (expanded_location exploc,
1563+ const cpp_char_column_policy &policy);
1564
1565 /* A class capturing the bounds of a buffer, to allow for run-time
1566 bounds-checking in a checked build. */
1567diff --git a/gcc/opts.c b/gcc/opts.c
1568--- a/gcc/opts.c 2021-07-27 23:55:07.364288417 -0700
1569+++ b/gcc/opts.c 2021-12-14 01:16:01.553943061 -0800
1570@@ -2573,6 +2573,10 @@ common_handle_option (struct gcc_options
1571 dc->column_origin = value;
1572 break;
1573
1574+ case OPT_fdiagnostics_escape_format_:
1575+ dc->escape_format = (enum diagnostics_escape_format)value;
1576+ break;
1577+
1578 case OPT_fdiagnostics_show_cwe:
1579 dc->show_cwe = value;
1580 break;
1581diff --git a/gcc/selftest.c b/gcc/selftest.c
1582--- a/gcc/selftest.c 2021-07-27 23:55:07.500290315 -0700
1583+++ b/gcc/selftest.c 2021-12-14 01:16:01.557942991 -0800
1584@@ -193,6 +193,21 @@ temp_source_file::temp_source_file (cons
1585 fclose (out);
1586 }
1587
1588+/* As above, but with a size, to allow for NUL bytes in CONTENT. */
1589+
1590+temp_source_file::temp_source_file (const location &loc,
1591+ const char *suffix,
1592+ const char *content,
1593+ size_t sz)
1594+: named_temp_file (suffix)
1595+{
1596+ FILE *out = fopen (get_filename (), "w");
1597+ if (!out)
1598+ fail_formatted (loc, "unable to open tempfile: %s", get_filename ());
1599+ fwrite (content, sz, 1, out);
1600+ fclose (out);
1601+}
1602+
1603 /* Avoid introducing locale-specific differences in the results
1604 by hardcoding open_quote and close_quote. */
1605
1606diff --git a/gcc/selftest.h b/gcc/selftest.h
1607--- a/gcc/selftest.h 2021-07-27 23:55:07.500290315 -0700
1608+++ b/gcc/selftest.h 2021-12-14 01:16:01.557942991 -0800
1609@@ -112,6 +112,8 @@ class temp_source_file : public named_te
1610 public:
1611 temp_source_file (const location &loc, const char *suffix,
1612 const char *content);
1613+ temp_source_file (const location &loc, const char *suffix,
1614+ const char *content, size_t sz);
1615 };
1616
1617 /* RAII-style class for avoiding introducing locale-specific differences
1618diff --git a/gcc/testsuite/c-c++-common/diagnostic-format-json-1.c b/gcc/testsuite/c-c++-common/diagnostic-format-json-1.c
1619--- a/gcc/testsuite/c-c++-common/diagnostic-format-json-1.c 2021-07-27 23:55:07.596291654 -0700
1620+++ b/gcc/testsuite/c-c++-common/diagnostic-format-json-1.c 2021-12-14 01:16:01.557942991 -0800
1621@@ -9,6 +9,7 @@
1622
1623 /* { dg-regexp "\"kind\": \"error\"" } */
1624 /* { dg-regexp "\"column-origin\": 1" } */
1625+/* { dg-regexp "\"escape-source\": false" } */
1626 /* { dg-regexp "\"message\": \"#error message\"" } */
1627
1628 /* { dg-regexp "\"caret\": \{" } */
1629diff --git a/gcc/testsuite/c-c++-common/diagnostic-format-json-2.c b/gcc/testsuite/c-c++-common/diagnostic-format-json-2.c
1630--- a/gcc/testsuite/c-c++-common/diagnostic-format-json-2.c 2021-07-27 23:55:07.596291654 -0700
1631+++ b/gcc/testsuite/c-c++-common/diagnostic-format-json-2.c 2021-12-14 01:16:01.557942991 -0800
1632@@ -9,6 +9,7 @@
1633
1634 /* { dg-regexp "\"kind\": \"warning\"" } */
1635 /* { dg-regexp "\"column-origin\": 1" } */
1636+/* { dg-regexp "\"escape-source\": false" } */
1637 /* { dg-regexp "\"message\": \"#warning message\"" } */
1638 /* { dg-regexp "\"option\": \"-Wcpp\"" } */
1639 /* { dg-regexp "\"option_url\": \"https:\[^\n\r\"\]*#index-Wcpp\"" } */
1640diff --git a/gcc/testsuite/c-c++-common/diagnostic-format-json-3.c b/gcc/testsuite/c-c++-common/diagnostic-format-json-3.c
1641--- a/gcc/testsuite/c-c++-common/diagnostic-format-json-3.c 2021-07-27 23:55:07.596291654 -0700
1642+++ b/gcc/testsuite/c-c++-common/diagnostic-format-json-3.c 2021-12-14 01:16:01.557942991 -0800
1643@@ -9,6 +9,7 @@
1644
1645 /* { dg-regexp "\"kind\": \"error\"" } */
1646 /* { dg-regexp "\"column-origin\": 1" } */
1647+/* { dg-regexp "\"escape-source\": false" } */
1648 /* { dg-regexp "\"message\": \"#warning message\"" } */
1649 /* { dg-regexp "\"option\": \"-Werror=cpp\"" } */
1650 /* { dg-regexp "\"option_url\": \"https:\[^\n\r\"\]*#index-Wcpp\"" } */
1651diff --git a/gcc/testsuite/c-c++-common/diagnostic-format-json-4.c b/gcc/testsuite/c-c++-common/diagnostic-format-json-4.c
1652--- a/gcc/testsuite/c-c++-common/diagnostic-format-json-4.c 2021-07-27 23:55:07.596291654 -0700
1653+++ b/gcc/testsuite/c-c++-common/diagnostic-format-json-4.c 2021-12-14 01:16:01.557942991 -0800
1654@@ -19,6 +19,7 @@ int test (void)
1655
1656 /* { dg-regexp "\"kind\": \"note\"" } */
1657 /* { dg-regexp "\"message\": \"...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'\"" } */
1658+/* { dg-regexp "\"escape-source\": false" } */
1659
1660 /* { dg-regexp "\"caret\": \{" } */
1661 /* { dg-regexp "\"file\": \"\[^\n\r\"\]*diagnostic-format-json-4.c\"" } */
1662@@ -39,6 +40,7 @@ int test (void)
1663 /* { dg-regexp "\"kind\": \"warning\"" } */
1664 /* { dg-regexp "\"column-origin\": 1" } */
1665 /* { dg-regexp "\"message\": \"this 'if' clause does not guard...\"" } */
1666+/* { dg-regexp "\"escape-source\": false" } */
1667 /* { dg-regexp "\"option\": \"-Wmisleading-indentation\"" } */
1668 /* { dg-regexp "\"option_url\": \"https:\[^\n\r\"\]*#index-Wmisleading-indentation\"" } */
1669
1670diff --git a/gcc/testsuite/c-c++-common/diagnostic-format-json-5.c b/gcc/testsuite/c-c++-common/diagnostic-format-json-5.c
1671--- a/gcc/testsuite/c-c++-common/diagnostic-format-json-5.c 2021-07-27 23:55:07.596291654 -0700
1672+++ b/gcc/testsuite/c-c++-common/diagnostic-format-json-5.c 2021-12-14 01:16:01.557942991 -0800
1673@@ -14,6 +14,7 @@ int test (struct s *ptr)
1674
1675 /* { dg-regexp "\"kind\": \"error\"" } */
1676 /* { dg-regexp "\"column-origin\": 1" } */
1677+/* { dg-regexp "\"escape-source\": false" } */
1678 /* { dg-regexp "\"message\": \".*\"" } */
1679
1680 /* Verify fix-it hints. */
1681diff --git a/gcc/testsuite/gcc.dg/cpp/warn-normalized-4-bytes.c b/gcc/testsuite/gcc.dg/cpp/warn-normalized-4-bytes.c
1682--- a/gcc/testsuite/gcc.dg/cpp/warn-normalized-4-bytes.c 1969-12-31 16:00:00.000000000 -0800
1683+++ b/gcc/testsuite/gcc.dg/cpp/warn-normalized-4-bytes.c 2021-12-14 01:16:01.557942991 -0800
1684@@ -0,0 +1,21 @@
1685+// { dg-do preprocess }
1686+// { dg-options "-std=gnu99 -Werror=normalized=nfc -fdiagnostics-show-caret -fdiagnostics-escape-format=bytes" }
1687+/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */
1688+
1689+/* འ= U+0F43 TIBETAN LETTER GHA, which has decomposition "0F42 0FB7" i.e.
1690+ U+0F42 TIBETAN LETTER GA: à½
1691+ U+0FB7 TIBETAN SUBJOINED LETTER HA: ྷ
1692+
1693+ The UTF-8 encoding of U+0F43 TIBETAN LETTER GHA is: E0 BD 83. */
1694+
1695+foo before_\u0F43_after bar // { dg-error "`before_.U00000f43_after' is not in NFC .-Werror=normalized=." }
1696+/* { dg-begin-multiline-output "" }
1697+ foo before_\u0F43_after bar
1698+ ^~~~~~~~~~~~~~~~~~~
1699+ { dg-end-multiline-output "" } */
1700+
1701+foo before_à½_after bar // { dg-error "`before_.U00000f43_after' is not in NFC .-Werror=normalized=." }
1702+/* { dg-begin-multiline-output "" }
1703+ foo before_<e0><bd><83>_after bar
1704+ ^~~~~~~~~~~~~~~~~~~~~~~~~
1705+ { dg-end-multiline-output "" } */
1706diff --git a/gcc/testsuite/gcc.dg/cpp/warn-normalized-4-unicode.c b/gcc/testsuite/gcc.dg/cpp/warn-normalized-4-unicode.c
1707--- a/gcc/testsuite/gcc.dg/cpp/warn-normalized-4-unicode.c 1969-12-31 16:00:00.000000000 -0800
1708+++ b/gcc/testsuite/gcc.dg/cpp/warn-normalized-4-unicode.c 2021-12-14 01:16:01.557942991 -0800
1709@@ -0,0 +1,19 @@
1710+// { dg-do preprocess }
1711+// { dg-options "-std=gnu99 -Werror=normalized=nfc -fdiagnostics-show-caret -fdiagnostics-escape-format=unicode" }
1712+/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */
1713+
1714+/* འ= U+0F43 TIBETAN LETTER GHA, which has decomposition "0F42 0FB7" i.e.
1715+ U+0F42 TIBETAN LETTER GA: à½
1716+ U+0FB7 TIBETAN SUBJOINED LETTER HA: ྷ */
1717+
1718+foo before_\u0F43_after bar // { dg-error "`before_.U00000f43_after' is not in NFC .-Werror=normalized=." }
1719+/* { dg-begin-multiline-output "" }
1720+ foo before_\u0F43_after bar
1721+ ^~~~~~~~~~~~~~~~~~~
1722+ { dg-end-multiline-output "" } */
1723+
1724+foo before_à½_after bar // { dg-error "`before_.U00000f43_after' is not in NFC .-Werror=normalized=." }
1725+/* { dg-begin-multiline-output "" }
1726+ foo before_<U+0F43>_after bar
1727+ ^~~~~~~~~~~~~~~~~~~~~
1728+ { dg-end-multiline-output "" } */
1729diff --git a/gcc/testsuite/gfortran.dg/diagnostic-format-json-1.F90 b/gcc/testsuite/gfortran.dg/diagnostic-format-json-1.F90
1730--- a/gcc/testsuite/gfortran.dg/diagnostic-format-json-1.F90 2021-07-27 23:55:08.472303878 -0700
1731+++ b/gcc/testsuite/gfortran.dg/diagnostic-format-json-1.F90 2021-12-14 01:16:01.557942991 -0800
1732@@ -9,6 +9,7 @@
1733
1734 ! { dg-regexp "\"kind\": \"error\"" }
1735 ! { dg-regexp "\"column-origin\": 1" }
1736+! { dg-regexp "\"escape-source\": false" }
1737 ! { dg-regexp "\"message\": \"#error message\"" }
1738
1739 ! { dg-regexp "\"caret\": \{" }
1740diff --git a/gcc/testsuite/gfortran.dg/diagnostic-format-json-2.F90 b/gcc/testsuite/gfortran.dg/diagnostic-format-json-2.F90
1741--- a/gcc/testsuite/gfortran.dg/diagnostic-format-json-2.F90 2021-07-27 23:55:08.472303878 -0700
1742+++ b/gcc/testsuite/gfortran.dg/diagnostic-format-json-2.F90 2021-12-14 01:16:01.557942991 -0800
1743@@ -9,6 +9,7 @@
1744
1745 ! { dg-regexp "\"kind\": \"warning\"" }
1746 ! { dg-regexp "\"column-origin\": 1" }
1747+! { dg-regexp "\"escape-source\": false" }
1748 ! { dg-regexp "\"message\": \"#warning message\"" }
1749 ! { dg-regexp "\"option\": \"-Wcpp\"" }
1750 ! { dg-regexp "\"option_url\": \"\[^\n\r\"\]*#index-Wcpp\"" }
1751diff --git a/gcc/testsuite/gfortran.dg/diagnostic-format-json-3.F90 b/gcc/testsuite/gfortran.dg/diagnostic-format-json-3.F90
1752--- a/gcc/testsuite/gfortran.dg/diagnostic-format-json-3.F90 2021-07-27 23:55:08.472303878 -0700
1753+++ b/gcc/testsuite/gfortran.dg/diagnostic-format-json-3.F90 2021-12-14 01:16:01.557942991 -0800
1754@@ -9,6 +9,7 @@
1755
1756 ! { dg-regexp "\"kind\": \"error\"" }
1757 ! { dg-regexp "\"column-origin\": 1" }
1758+! { dg-regexp "\"escape-source\": false" }
1759 ! { dg-regexp "\"message\": \"#warning message\"" }
1760 ! { dg-regexp "\"option\": \"-Werror=cpp\"" }
1761 ! { dg-regexp "\"option_url\": \"\[^\n\r\"\]*#index-Wcpp\"" }
1762diff --git a/libcpp/charset.c b/libcpp/charset.c
1763--- a/libcpp/charset.c 2021-07-27 23:55:08.712307227 -0700
1764+++ b/libcpp/charset.c 2021-12-14 01:16:01.557942991 -0800
1765@@ -1552,12 +1552,14 @@ convert_escape (cpp_reader *pfile, const
1766 "unknown escape sequence: '\\%c'", (int) c);
1767 else
1768 {
1769+ encoding_rich_location rich_loc (pfile);
1770+
1771 /* diagnostic.c does not support "%03o". When it does, this
1772 code can use %03o directly in the diagnostic again. */
1773 char buf[32];
1774 sprintf(buf, "%03o", (int) c);
1775- cpp_error (pfile, CPP_DL_PEDWARN,
1776- "unknown escape sequence: '\\%s'", buf);
1777+ cpp_error_at (pfile, CPP_DL_PEDWARN, &rich_loc,
1778+ "unknown escape sequence: '\\%s'", buf);
1779 }
1780 }
1781
1782@@ -2280,14 +2282,16 @@ cpp_string_location_reader::get_next ()
1783 }
1784
1785 cpp_display_width_computation::
1786-cpp_display_width_computation (const char *data, int data_length, int tabstop) :
1787+cpp_display_width_computation (const char *data, int data_length,
1788+ const cpp_char_column_policy &policy) :
1789 m_begin (data),
1790 m_next (m_begin),
1791 m_bytes_left (data_length),
1792- m_tabstop (tabstop),
1793+ m_policy (policy),
1794 m_display_cols (0)
1795 {
1796- gcc_assert (m_tabstop > 0);
1797+ gcc_assert (policy.m_tabstop > 0);
1798+ gcc_assert (policy.m_width_cb);
1799 }
1800
1801
1802@@ -2299,19 +2303,28 @@ cpp_display_width_computation (const cha
1803 point to a valid UTF-8-encoded sequence, then it will be treated as a single
1804 byte with display width 1. m_cur_display_col is the current display column,
1805 relative to which tab stops should be expanded. Returns the display width of
1806- the codepoint just processed. */
1807+ the codepoint just processed.
1808+ If OUT is non-NULL, it is populated. */
1809
1810 int
1811-cpp_display_width_computation::process_next_codepoint ()
1812+cpp_display_width_computation::process_next_codepoint (cpp_decoded_char *out)
1813 {
1814 cppchar_t c;
1815 int next_width;
1816
1817+ if (out)
1818+ out->m_start_byte = m_next;
1819+
1820 if (*m_next == '\t')
1821 {
1822 ++m_next;
1823 --m_bytes_left;
1824- next_width = m_tabstop - (m_display_cols % m_tabstop);
1825+ next_width = m_policy.m_tabstop - (m_display_cols % m_policy.m_tabstop);
1826+ if (out)
1827+ {
1828+ out->m_ch = '\t';
1829+ out->m_valid_ch = true;
1830+ }
1831 }
1832 else if (one_utf8_to_cppchar ((const uchar **) &m_next, &m_bytes_left, &c)
1833 != 0)
1834@@ -2321,14 +2334,24 @@ cpp_display_width_computation::process_n
1835 of one. */
1836 ++m_next;
1837 --m_bytes_left;
1838- next_width = 1;
1839+ next_width = m_policy.m_undecoded_byte_width;
1840+ if (out)
1841+ out->m_valid_ch = false;
1842 }
1843 else
1844 {
1845 /* one_utf8_to_cppchar() has updated m_next and m_bytes_left for us. */
1846- next_width = cpp_wcwidth (c);
1847+ next_width = m_policy.m_width_cb (c);
1848+ if (out)
1849+ {
1850+ out->m_ch = c;
1851+ out->m_valid_ch = true;
1852+ }
1853 }
1854
1855+ if (out)
1856+ out->m_next_byte = m_next;
1857+
1858 m_display_cols += next_width;
1859 return next_width;
1860 }
1861@@ -2344,7 +2367,7 @@ cpp_display_width_computation::advance_d
1862 const int start = m_display_cols;
1863 const int target = start + n;
1864 while (m_display_cols < target && !done ())
1865- process_next_codepoint ();
1866+ process_next_codepoint (NULL);
1867 return m_display_cols - start;
1868 }
1869
1870@@ -2352,29 +2375,33 @@ cpp_display_width_computation::advance_d
1871 how many display columns are occupied by the first COLUMN bytes. COLUMN
1872 may exceed DATA_LENGTH, in which case the phantom bytes at the end are
1873 treated as if they have display width 1. Tabs are expanded to the next tab
1874- stop, relative to the start of DATA. */
1875+ stop, relative to the start of DATA, and non-printable-ASCII characters
1876+ will be escaped as per POLICY. */
1877
1878 int
1879 cpp_byte_column_to_display_column (const char *data, int data_length,
1880- int column, int tabstop)
1881+ int column,
1882+ const cpp_char_column_policy &policy)
1883 {
1884 const int offset = MAX (0, column - data_length);
1885- cpp_display_width_computation dw (data, column - offset, tabstop);
1886+ cpp_display_width_computation dw (data, column - offset, policy);
1887 while (!dw.done ())
1888- dw.process_next_codepoint ();
1889+ dw.process_next_codepoint (NULL);
1890 return dw.display_cols_processed () + offset;
1891 }
1892
1893 /* For the string of length DATA_LENGTH bytes that begins at DATA, compute
1894 the least number of bytes that will result in at least DISPLAY_COL display
1895 columns. The return value may exceed DATA_LENGTH if the entire string does
1896- not occupy enough display columns. */
1897+ not occupy enough display columns. Non-printable-ASCII characters
1898+ will be escaped as per POLICY. */
1899
1900 int
1901 cpp_display_column_to_byte_column (const char *data, int data_length,
1902- int display_col, int tabstop)
1903+ int display_col,
1904+ const cpp_char_column_policy &policy)
1905 {
1906- cpp_display_width_computation dw (data, data_length, tabstop);
1907+ cpp_display_width_computation dw (data, data_length, policy);
1908 const int avail_display = dw.advance_display_cols (display_col);
1909 return dw.bytes_processed () + MAX (0, display_col - avail_display);
1910 }
1911diff --git a/libcpp/errors.c b/libcpp/errors.c
1912--- a/libcpp/errors.c 2021-07-27 23:55:08.712307227 -0700
1913+++ b/libcpp/errors.c 2021-12-14 01:16:01.557942991 -0800
1914@@ -27,6 +27,31 @@ along with this program; see the file CO
1915 #include "cpplib.h"
1916 #include "internal.h"
1917
1918+/* Get a location_t for the current location in PFILE,
1919+ generally that of the previously lexed token. */
1920+
1921+location_t
1922+cpp_diagnostic_get_current_location (cpp_reader *pfile)
1923+{
1924+ if (CPP_OPTION (pfile, traditional))
1925+ {
1926+ if (pfile->state.in_directive)
1927+ return pfile->directive_line;
1928+ else
1929+ return pfile->line_table->highest_line;
1930+ }
1931+ /* We don't want to refer to a token before the beginning of the
1932+ current run -- that is invalid. */
1933+ else if (pfile->cur_token == pfile->cur_run->base)
1934+ {
1935+ return 0;
1936+ }
1937+ else
1938+ {
1939+ return pfile->cur_token[-1].src_loc;
1940+ }
1941+}
1942+
1943 /* Print a diagnostic at the given location. */
1944
1945 ATTRIBUTE_FPTR_PRINTF(5,0)
1946@@ -52,25 +77,7 @@ cpp_diagnostic (cpp_reader * pfile, enum
1947 enum cpp_warning_reason reason,
1948 const char *msgid, va_list *ap)
1949 {
1950- location_t src_loc;
1951-
1952- if (CPP_OPTION (pfile, traditional))
1953- {
1954- if (pfile->state.in_directive)
1955- src_loc = pfile->directive_line;
1956- else
1957- src_loc = pfile->line_table->highest_line;
1958- }
1959- /* We don't want to refer to a token before the beginning of the
1960- current run -- that is invalid. */
1961- else if (pfile->cur_token == pfile->cur_run->base)
1962- {
1963- src_loc = 0;
1964- }
1965- else
1966- {
1967- src_loc = pfile->cur_token[-1].src_loc;
1968- }
1969+ location_t src_loc = cpp_diagnostic_get_current_location (pfile);
1970 rich_location richloc (pfile->line_table, src_loc);
1971 return cpp_diagnostic_at (pfile, level, reason, &richloc, msgid, ap);
1972 }
1973@@ -142,6 +149,43 @@ cpp_warning_syshdr (cpp_reader * pfile,
1974
1975 va_end (ap);
1976 return ret;
1977+}
1978+
1979+/* As cpp_warning above, but use RICHLOC as the location of the diagnostic. */
1980+
1981+bool cpp_warning_at (cpp_reader *pfile, enum cpp_warning_reason reason,
1982+ rich_location *richloc, const char *msgid, ...)
1983+{
1984+ va_list ap;
1985+ bool ret;
1986+
1987+ va_start (ap, msgid);
1988+
1989+ ret = cpp_diagnostic_at (pfile, CPP_DL_WARNING, reason, richloc,
1990+ msgid, &ap);
1991+
1992+ va_end (ap);
1993+ return ret;
1994+
1995+}
1996+
1997+/* As cpp_pedwarning above, but use RICHLOC as the location of the
1998+ diagnostic. */
1999+
2000+bool
2001+cpp_pedwarning_at (cpp_reader * pfile, enum cpp_warning_reason reason,
2002+ rich_location *richloc, const char *msgid, ...)
2003+{
2004+ va_list ap;
2005+ bool ret;
2006+
2007+ va_start (ap, msgid);
2008+
2009+ ret = cpp_diagnostic_at (pfile, CPP_DL_PEDWARN, reason, richloc,
2010+ msgid, &ap);
2011+
2012+ va_end (ap);
2013+ return ret;
2014 }
2015
2016 /* Print a diagnostic at a specific location. */
2017diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
2018--- a/libcpp/include/cpplib.h 2021-12-13 23:23:05.768437079 -0800
2019+++ b/libcpp/include/cpplib.h 2021-12-14 01:20:16.189507386 -0800
2020@@ -1275,6 +1275,14 @@ extern bool cpp_warning_syshdr (cpp_read
2021 const char *msgid, ...)
2022 ATTRIBUTE_PRINTF_3;
2023
2024+/* As their counterparts above, but use RICHLOC. */
2025+extern bool cpp_warning_at (cpp_reader *, enum cpp_warning_reason,
2026+ rich_location *richloc, const char *msgid, ...)
2027+ ATTRIBUTE_PRINTF_4;
2028+extern bool cpp_pedwarning_at (cpp_reader *, enum cpp_warning_reason,
2029+ rich_location *richloc, const char *msgid, ...)
2030+ ATTRIBUTE_PRINTF_4;
2031+
2032 /* Output a diagnostic with "MSGID: " preceding the
2033 error string of errno. No location is printed. */
2034 extern bool cpp_errno (cpp_reader *, enum cpp_diagnostic_level,
2035@@ -1435,42 +1443,95 @@ extern const char * cpp_get_userdef_suff
2036
2037 /* In charset.c */
2038
2039+/* The result of attempting to decode a run of UTF-8 bytes. */
2040+
2041+struct cpp_decoded_char
2042+{
2043+ const char *m_start_byte;
2044+ const char *m_next_byte;
2045+
2046+ bool m_valid_ch;
2047+ cppchar_t m_ch;
2048+};
2049+
2050+/* Information for mapping between code points and display columns.
2051+
2052+ This is a tabstop value, along with a callback for getting the
2053+ widths of characters. Normally this callback is cpp_wcwidth, but we
2054+ support other schemes for escaping non-ASCII unicode as a series of
2055+ ASCII chars when printing the user's source code in diagnostic-show-locus.c
2056+
2057+ For example, consider:
2058+ - the Unicode character U+03C0 "GREEK SMALL LETTER PI" (UTF-8: 0xCF 0x80)
2059+ - the Unicode character U+1F642 "SLIGHTLY SMILING FACE"
2060+ (UTF-8: 0xF0 0x9F 0x99 0x82)
2061+ - the byte 0xBF (a stray trailing byte of a UTF-8 character)
2062+ Normally U+03C0 would occupy one display column, U+1F642
2063+ would occupy two display columns, and the stray byte would be
2064+ printed verbatim as one display column.
2065+
2066+ However when escaping them as unicode code points as "<U+03C0>"
2067+ and "<U+1F642>" they occupy 8 and 9 display columns respectively,
2068+ and when escaping them as bytes as "<CF><80>" and "<F0><9F><99><82>"
2069+ they occupy 8 and 16 display columns respectively. In both cases
2070+ the stray byte is escaped to <BF> as 4 display columns. */
2071+
2072+struct cpp_char_column_policy
2073+{
2074+ cpp_char_column_policy (int tabstop,
2075+ int (*width_cb) (cppchar_t c))
2076+ : m_tabstop (tabstop),
2077+ m_undecoded_byte_width (1),
2078+ m_width_cb (width_cb)
2079+ {}
2080+
2081+ int m_tabstop;
2082+ /* Width in display columns of a stray byte that isn't decodable
2083+ as UTF-8. */
2084+ int m_undecoded_byte_width;
2085+ int (*m_width_cb) (cppchar_t c);
2086+};
2087+
2088 /* A class to manage the state while converting a UTF-8 sequence to cppchar_t
2089 and computing the display width one character at a time. */
2090 class cpp_display_width_computation {
2091 public:
2092 cpp_display_width_computation (const char *data, int data_length,
2093- int tabstop);
2094+ const cpp_char_column_policy &policy);
2095 const char *next_byte () const { return m_next; }
2096 int bytes_processed () const { return m_next - m_begin; }
2097 int bytes_left () const { return m_bytes_left; }
2098 bool done () const { return !bytes_left (); }
2099 int display_cols_processed () const { return m_display_cols; }
2100
2101- int process_next_codepoint ();
2102+ int process_next_codepoint (cpp_decoded_char *out);
2103 int advance_display_cols (int n);
2104
2105 private:
2106 const char *const m_begin;
2107 const char *m_next;
2108 size_t m_bytes_left;
2109- const int m_tabstop;
2110+ const cpp_char_column_policy &m_policy;
2111 int m_display_cols;
2112 };
2113
2114 /* Convenience functions that are simple use cases for class
2115 cpp_display_width_computation. Tab characters will be expanded to spaces
2116- as determined by TABSTOP. */
2117+ as determined by POLICY.m_tabstop, and non-printable-ASCII characters
2118+ will be escaped as per POLICY. */
2119+
2120 int cpp_byte_column_to_display_column (const char *data, int data_length,
2121- int column, int tabstop);
2122+ int column,
2123+ const cpp_char_column_policy &policy);
2124 inline int cpp_display_width (const char *data, int data_length,
2125- int tabstop)
2126+ const cpp_char_column_policy &policy)
2127 {
2128 return cpp_byte_column_to_display_column (data, data_length, data_length,
2129- tabstop);
2130+ policy);
2131 }
2132 int cpp_display_column_to_byte_column (const char *data, int data_length,
2133- int display_col, int tabstop);
2134+ int display_col,
2135+ const cpp_char_column_policy &policy);
2136 int cpp_wcwidth (cppchar_t c);
2137
2138 #endif /* ! LIBCPP_CPPLIB_H */
2139diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h
2140--- a/libcpp/include/line-map.h 2021-07-27 23:55:08.716307283 -0700
2141+++ b/libcpp/include/line-map.h 2021-12-14 01:16:01.557942991 -0800
2142@@ -1781,6 +1781,18 @@ class rich_location
2143 const diagnostic_path *get_path () const { return m_path; }
2144 void set_path (const diagnostic_path *path) { m_path = path; }
2145
2146+ /* A flag for hinting that the diagnostic involves character encoding
2147+ issues, and thus that it will be helpful to the user if we show some
2148+ representation of how the characters in the pertinent source lines
2149+ are encoded.
2150+ The default is false (i.e. do not escape).
2151+ When set to true, non-ASCII bytes in the pertinent source lines will
2152+ be escaped in a manner controlled by the user-supplied option
2153+ -fdiagnostics-escape-format=, so that the user can better understand
2154+ what's going on with the encoding in their source file. */
2155+ bool escape_on_output_p () const { return m_escape_on_output; }
2156+ void set_escape_on_output (bool flag) { m_escape_on_output = flag; }
2157+
2158 private:
2159 bool reject_impossible_fixit (location_t where);
2160 void stop_supporting_fixits ();
2161@@ -1807,6 +1819,7 @@ protected:
2162 bool m_fixits_cannot_be_auto_applied;
2163
2164 const diagnostic_path *m_path;
2165+ bool m_escape_on_output;
2166 };
2167
2168 /* A struct for the result of range_label::get_text: a NUL-terminated buffer
2169diff --git a/libcpp/internal.h b/libcpp/internal.h
2170--- a/libcpp/internal.h 2021-12-13 23:23:05.768437079 -0800
2171+++ b/libcpp/internal.h 2021-12-14 01:16:01.557942991 -0800
2172@@ -776,6 +776,9 @@ extern void _cpp_do_file_change (cpp_rea
2173 extern void _cpp_pop_buffer (cpp_reader *);
2174 extern char *_cpp_bracket_include (cpp_reader *);
2175
2176+/* In errors.c */
2177+extern location_t cpp_diagnostic_get_current_location (cpp_reader *);
2178+
2179 /* In traditional.c. */
2180 extern bool _cpp_scan_out_logical_line (cpp_reader *, cpp_macro *, bool);
2181 extern bool _cpp_read_logical_line_trad (cpp_reader *);
2182@@ -942,6 +945,26 @@ int linemap_get_expansion_line (class li
2183 const char* linemap_get_expansion_filename (class line_maps *,
2184 location_t);
2185
2186+/* A subclass of rich_location for emitting a diagnostic
2187+ at the current location of the reader, but flagging
2188+ it with set_escape_on_output (true). */
2189+class encoding_rich_location : public rich_location
2190+{
2191+ public:
2192+ encoding_rich_location (cpp_reader *pfile)
2193+ : rich_location (pfile->line_table,
2194+ cpp_diagnostic_get_current_location (pfile))
2195+ {
2196+ set_escape_on_output (true);
2197+ }
2198+
2199+ encoding_rich_location (cpp_reader *pfile, location_t loc)
2200+ : rich_location (pfile->line_table, loc)
2201+ {
2202+ set_escape_on_output (true);
2203+ }
2204+};
2205+
2206 #ifdef __cplusplus
2207 }
2208 #endif
2209diff --git a/libcpp/lex.c b/libcpp/lex.c
2210--- a/libcpp/lex.c 2021-12-14 01:14:48.435225968 -0800
2211+++ b/libcpp/lex.c 2021-12-14 01:24:37.220995816 -0800
2212@@ -1774,7 +1774,11 @@ skip_whitespace (cpp_reader *pfile, cppc
2213 while (is_nvspace (c));
2214
2215 if (saw_NUL)
2216- cpp_error (pfile, CPP_DL_WARNING, "null character(s) ignored");
2217+ {
2218+ encoding_rich_location rich_loc (pfile);
2219+ cpp_error_at (pfile, CPP_DL_WARNING, &rich_loc,
2220+ "null character(s) ignored");
2221+ }
2222
2223 buffer->cur--;
2224 }
2225@@ -1803,6 +1807,28 @@ warn_about_normalization (cpp_reader *pf
2226 if (CPP_OPTION (pfile, warn_normalize) < NORMALIZE_STATE_RESULT (s)
2227 && !pfile->state.skipping)
2228 {
2229+ location_t loc = token->src_loc;
2230+
2231+ /* If possible, create a location range for the token. */
2232+ if (loc >= RESERVED_LOCATION_COUNT
2233+ && token->type != CPP_EOF
2234+ /* There must be no line notes to process. */
2235+ && (!(pfile->buffer->cur
2236+ >= pfile->buffer->notes[pfile->buffer->cur_note].pos
2237+ && !pfile->overlaid_buffer)))
2238+ {
2239+ source_range tok_range;
2240+ tok_range.m_start = loc;
2241+ tok_range.m_finish
2242+ = linemap_position_for_column (pfile->line_table,
2243+ CPP_BUF_COLUMN (pfile->buffer,
2244+ pfile->buffer->cur));
2245+ loc = COMBINE_LOCATION_DATA (pfile->line_table,
2246+ loc, tok_range, NULL);
2247+ }
2248+
2249+ encoding_rich_location rich_loc (pfile, loc);
2250+
2251 /* Make sure that the token is printed using UCNs, even
2252 if we'd otherwise happily print UTF-8. */
2253 unsigned char *buf = XNEWVEC (unsigned char, cpp_token_len (token));
2254@@ -1810,11 +1836,11 @@ warn_about_normalization (cpp_reader *pf
2255
2256 sz = cpp_spell_token (pfile, token, buf, false) - buf;
2257 if (NORMALIZE_STATE_RESULT (s) == normalized_C)
2258- cpp_warning_with_line (pfile, CPP_W_NORMALIZE, token->src_loc, 0,
2259- "`%.*s' is not in NFKC", (int) sz, buf);
2260+ cpp_warning_at (pfile, CPP_W_NORMALIZE, &rich_loc,
2261+ "`%.*s' is not in NFKC", (int) sz, buf);
2262 else
2263- cpp_warning_with_line (pfile, CPP_W_NORMALIZE, token->src_loc, 0,
2264- "`%.*s' is not in NFC", (int) sz, buf);
2265+ cpp_warning_at (pfile, CPP_W_NORMALIZE, &rich_loc,
2266+ "`%.*s' is not in NFC", (int) sz, buf);
2267 free (buf);
2268 }
2269 }
2270diff --git a/libcpp/line-map.c b/libcpp/line-map.c
2271--- a/libcpp/line-map.c 2021-07-27 23:55:08.716307283 -0700
2272+++ b/libcpp/line-map.c 2021-12-14 01:16:01.561942921 -0800
2273@@ -2086,7 +2086,8 @@ rich_location::rich_location (line_maps
2274 m_fixit_hints (),
2275 m_seen_impossible_fixit (false),
2276 m_fixits_cannot_be_auto_applied (false),
2277- m_path (NULL)
2278+ m_path (NULL),
2279+ m_escape_on_output (false)
2280 {
2281 add_range (loc, SHOW_RANGE_WITH_CARET, label);
2282 }
diff --git a/meta/recipes-devtools/gcc/gcc/0001-CVE-2021-46195.patch b/meta/recipes-devtools/gcc/gcc/0001-CVE-2021-46195.patch
new file mode 100644
index 0000000000..7b3651c73e
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc/0001-CVE-2021-46195.patch
@@ -0,0 +1,128 @@
1From f10bec5ffa487ad3033ed5f38cfd0fc7d696deab Mon Sep 17 00:00:00 2001
2From: Nick Clifton <nickc@redhat.com>
3Date: Mon, 31 Jan 2022 14:28:42 +0000
4Subject: [PATCH] libiberty: Fix infinite recursion in rust demangler.
5
6libiberty/
7 PR demangler/98886
8 PR demangler/99935
9 * rust-demangle.c (struct rust_demangler): Add a recursion
10 counter.
11 (demangle_path): Increment/decrement the recursion counter upon
12 entry and exit. Fail if the counter exceeds a fixed limit.
13 (demangle_type): Likewise.
14 (rust_demangle_callback): Initialise the recursion counter,
15 disabling if requested by the option flags.
16
17CVE: CVE-2021-46195
18Upstream-Status: Backport
19[https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=f10bec5ffa487ad3033ed5f38cfd0fc7d696deab]
20Signed-off-by: Pgowda <pgowda.cve@gmail.com>
21---
22 libiberty/rust-demangle.c | 47 ++++++++++++++++++++++++++++++++++-----
23 1 file changed, 41 insertions(+), 6 deletions(-)
24
25diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c
26index 18c760491bd..3b24d63892a 100644
27--- a/libiberty/rust-demangle.c
28+++ b/libiberty/rust-demangle.c
29@@ -74,6 +74,12 @@ struct rust_demangler
30 /* Rust mangling version, with legacy mangling being -1. */
31 int version;
32
33+ /* Recursion depth. */
34+ unsigned int recursion;
35+ /* Maximum number of times demangle_path may be called recursively. */
36+#define RUST_MAX_RECURSION_COUNT 1024
37+#define RUST_NO_RECURSION_LIMIT ((unsigned int) -1)
38+
39 uint64_t bound_lifetime_depth;
40 };
41
42@@ -671,6 +677,15 @@ demangle_path (struct rust_demangler *rdm, int in_value)
43 if (rdm->errored)
44 return;
45
46+ if (rdm->recursion != RUST_NO_RECURSION_LIMIT)
47+ {
48+ ++ rdm->recursion;
49+ if (rdm->recursion > RUST_MAX_RECURSION_COUNT)
50+ /* FIXME: There ought to be a way to report
51+ that the recursion limit has been reached. */
52+ goto fail_return;
53+ }
54+
55 switch (tag = next (rdm))
56 {
57 case 'C':
58@@ -688,10 +703,7 @@ demangle_path (struct rust_demangler *rdm, int in_value)
59 case 'N':
60 ns = next (rdm);
61 if (!ISLOWER (ns) && !ISUPPER (ns))
62- {
63- rdm->errored = 1;
64- return;
65- }
66+ goto fail_return;
67
68 demangle_path (rdm, in_value);
69
70@@ -776,9 +788,15 @@ demangle_path (struct rust_demangler *rdm, int in_value)
71 }
72 break;
73 default:
74- rdm->errored = 1;
75- return;
76+ goto fail_return;
77 }
78+ goto pass_return;
79+
80+ fail_return:
81+ rdm->errored = 1;
82+ pass_return:
83+ if (rdm->recursion != RUST_NO_RECURSION_LIMIT)
84+ -- rdm->recursion;
85 }
86
87 static void
88@@ -870,6 +888,19 @@ demangle_type (struct rust_demangler *rdm)
89 return;
90 }
91
92+ if (rdm->recursion != RUST_NO_RECURSION_LIMIT)
93+ {
94+ ++ rdm->recursion;
95+ if (rdm->recursion > RUST_MAX_RECURSION_COUNT)
96+ /* FIXME: There ought to be a way to report
97+ that the recursion limit has been reached. */
98+ {
99+ rdm->errored = 1;
100+ -- rdm->recursion;
101+ return;
102+ }
103+ }
104+
105 switch (tag)
106 {
107 case 'R':
108@@ -1030,6 +1061,9 @@ demangle_type (struct rust_demangler *rdm)
109 rdm->next--;
110 demangle_path (rdm, 0);
111 }
112+
113+ if (rdm->recursion != RUST_NO_RECURSION_LIMIT)
114+ -- rdm->recursion;
115 }
116
117 /* A trait in a trait object may have some "existential projections"
118@@ -1320,6 +1354,7 @@ rust_demangle_callback (const char *mangled, int options,
119 rdm.skipping_printing = 0;
120 rdm.verbose = (options & DMGL_VERBOSE) != 0;
121 rdm.version = 0;
122+ rdm.recursion = (options & DMGL_NO_RECURSE_LIMIT) ? RUST_NO_RECURSION_LIMIT : 0;
123 rdm.bound_lifetime_depth = 0;
124
125 /* Rust symbols always start with _R (v0) or _ZN (legacy). */
126--
1272.27.0
128
diff --git a/meta/recipes-devtools/gcc/gcc/0002-CVE-2021-35465.patch b/meta/recipes-devtools/gcc/gcc/0002-CVE-2021-35465.patch
new file mode 100644
index 0000000000..98841e6d7c
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc/0002-CVE-2021-35465.patch
@@ -0,0 +1,39 @@
1From 574e7950bd6b34e9e2cacce18c802b45505d1d0a Mon Sep 17 00:00:00 2001
2From: Richard Earnshaw <rearnsha@arm.com>
3Date: Fri, 18 Jun 2021 17:16:25 +0100
4Subject: [PATCH] arm: add erratum mitigation to __gnu_cmse_nonsecure_call
5 [PR102035]
6
7Add the recommended erratum mitigation sequence to
8__gnu_cmse_nonsecure_call for use on Armv8-m.main devices. Since this
9is in the library code we cannot know in advance whether the core we
10are running on will be affected by this, so always enable it.
11
12libgcc:
13 PR target/102035
14 * config/arm/cmse_nonsecure_call.S (__gnu_cmse_nonsecure_call):
15 Add vlldm erratum work-around.
16
17CVE: CVE-2021-35465
18Upstream-Status: Backport[https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=574e7950bd6b34e9e2cacce18c802b45505d1d0a]
19Signed-off-by: Pgowda <pgowda.cve@gmail.com>
20
21---
22 libgcc/config/arm/cmse_nonsecure_call.S | 5 +++++
23 1 file changed, 5 insertions(+)
24
25diff --git a/libgcc/config/arm/cmse_nonsecure_call.S b/libgcc/config/arm/cmse_nonsecure_call.S
26--- a/libgcc/config/arm/cmse_nonsecure_call.S
27+++ b/libgcc/config/arm/cmse_nonsecure_call.S
28@@ -102,6 +102,11 @@ blxns r4
29 #ifdef __ARM_PCS_VFP
30 vpop.f64 {d8-d15}
31 #else
32+/* VLLDM erratum mitigation sequence. */
33+mrs r5, control
34+tst r5, #8 /* CONTROL_S.SFPA */
35+it ne
36+.inst.w 0xeeb00a40 /* vmovne s0, s0 */
37 vlldm sp /* Lazy restore of d0-d16 and FPSCR. */
38 add sp, sp, #0x88 /* Free space used to save floating point registers. */
39 #endif /* __ARM_PCS_VFP */
diff --git a/meta/recipes-devtools/gcc/gcc/0002-CVE-2021-42574.patch b/meta/recipes-devtools/gcc/gcc/0002-CVE-2021-42574.patch
new file mode 100644
index 0000000000..9bad81d4d0
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc/0002-CVE-2021-42574.patch
@@ -0,0 +1,1765 @@
1From 51c500269bf53749b107807d84271385fad35628 Mon Sep 17 00:00:00 2001
2From: Marek Polacek <polacek@redhat.com>
3Date: Wed, 6 Oct 2021 14:33:59 -0400
4Subject: [PATCH] libcpp: Implement -Wbidi-chars for CVE-2021-42574 [PR103026]
5
6From a link below:
7"An issue was discovered in the Bidirectional Algorithm in the Unicode
8Specification through 14.0. It permits the visual reordering of
9characters via control sequences, which can be used to craft source code
10that renders different logic than the logical ordering of tokens
11ingested by compilers and interpreters. Adversaries can leverage this to
12encode source code for compilers accepting Unicode such that targeted
13vulnerabilities are introduced invisibly to human reviewers."
14
15More info:
16https://nvd.nist.gov/vuln/detail/CVE-2021-42574
17https://trojansource.codes/
18
19This is not a compiler bug. However, to mitigate the problem, this patch
20implements -Wbidi-chars=[none|unpaired|any] to warn about possibly
21misleading Unicode bidirectional control characters the preprocessor may
22encounter.
23
24The default is =unpaired, which warns about improperly terminated
25bidirectional control characters; e.g. a LRE without its corresponding PDF.
26The level =any warns about any use of bidirectional control characters.
27
28This patch handles both UCNs and UTF-8 characters. UCNs designating
29bidi characters in identifiers are accepted since r204886. Then r217144
30enabled -fextended-identifiers by default. Extended characters in C/C++
31identifiers have been accepted since r275979. However, this patch still
32warns about mixing UTF-8 and UCN bidi characters; there seems to be no
33good reason to allow mixing them.
34
35We warn in different contexts: comments (both C and C++-style), string
36literals, character constants, and identifiers. Expectedly, UCNs are ignored
37in comments and raw string literals. The bidirectional control characters
38can nest so this patch handles that as well.
39
40I have not included nor tested this at all with Fortran (which also has
41string literals and line comments).
42
43Dave M. posted patches improving diagnostic involving Unicode characters.
44This patch does not make use of this new infrastructure yet.
45
46 PR preprocessor/103026
47
48gcc/c-family/ChangeLog:
49
50 * c.opt (Wbidi-chars, Wbidi-chars=): New option.
51
52gcc/ChangeLog:
53
54 * doc/invoke.texi: Document -Wbidi-chars.
55
56libcpp/ChangeLog:
57
58 * include/cpplib.h (enum cpp_bidirectional_level): New.
59 (struct cpp_options): Add cpp_warn_bidirectional.
60 (enum cpp_warning_reason): Add CPP_W_BIDIRECTIONAL.
61 * internal.h (struct cpp_reader): Add warn_bidi_p member
62 function.
63 * init.c (cpp_create_reader): Set cpp_warn_bidirectional.
64 * lex.c (bidi): New namespace.
65 (get_bidi_utf8): New function.
66 (get_bidi_ucn): Likewise.
67 (maybe_warn_bidi_on_close): Likewise.
68 (maybe_warn_bidi_on_char): Likewise.
69 (_cpp_skip_block_comment): Implement warning about bidirectional
70 control characters.
71 (skip_line_comment): Likewise.
72 (forms_identifier_p): Likewise.
73 (lex_identifier): Likewise.
74 (lex_string): Likewise.
75 (lex_raw_string): Likewise.
76
77gcc/testsuite/ChangeLog:
78
79 * c-c++-common/Wbidi-chars-1.c: New test.
80 * c-c++-common/Wbidi-chars-2.c: New test.
81 * c-c++-common/Wbidi-chars-3.c: New test.
82 * c-c++-common/Wbidi-chars-4.c: New test.
83 * c-c++-common/Wbidi-chars-5.c: New test.
84 * c-c++-common/Wbidi-chars-6.c: New test.
85 * c-c++-common/Wbidi-chars-7.c: New test.
86 * c-c++-common/Wbidi-chars-8.c: New test.
87 * c-c++-common/Wbidi-chars-9.c: New test.
88 * c-c++-common/Wbidi-chars-10.c: New test.
89 * c-c++-common/Wbidi-chars-11.c: New test.
90 * c-c++-common/Wbidi-chars-12.c: New test.
91 * c-c++-common/Wbidi-chars-13.c: New test.
92 * c-c++-common/Wbidi-chars-14.c: New test.
93 * c-c++-common/Wbidi-chars-15.c: New test.
94 * c-c++-common/Wbidi-chars-16.c: New test.
95 * c-c++-common/Wbidi-chars-17.c: New test.
96
97CVE: CVE-2021-42574
98Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=51c500269bf53749b107807d84271385fad35628]
99Signed-off-by: Pgowda <pgowda.cve@gmail.com>
100
101---
102 gcc/c-family/c.opt | 24 ++
103 gcc/doc/invoke.texi | 21 +-
104 gcc/testsuite/c-c++-common/Wbidi-chars-1.c | 12 +
105 gcc/testsuite/c-c++-common/Wbidi-chars-10.c | 27 ++
106 gcc/testsuite/c-c++-common/Wbidi-chars-11.c | 13 +
107 gcc/testsuite/c-c++-common/Wbidi-chars-12.c | 19 +
108 gcc/testsuite/c-c++-common/Wbidi-chars-13.c | 17 +
109 gcc/testsuite/c-c++-common/Wbidi-chars-14.c | 38 ++
110 gcc/testsuite/c-c++-common/Wbidi-chars-15.c | 59 +++
111 gcc/testsuite/c-c++-common/Wbidi-chars-16.c | 26 ++
112 gcc/testsuite/c-c++-common/Wbidi-chars-17.c | 30 ++
113 gcc/testsuite/c-c++-common/Wbidi-chars-2.c | 9 +
114 gcc/testsuite/c-c++-common/Wbidi-chars-3.c | 11 +
115 gcc/testsuite/c-c++-common/Wbidi-chars-4.c | 188 +++++++++
116 gcc/testsuite/c-c++-common/Wbidi-chars-5.c | 188 +++++++++
117 gcc/testsuite/c-c++-common/Wbidi-chars-6.c | 155 ++++++++
118 gcc/testsuite/c-c++-common/Wbidi-chars-7.c | 9 +
119 gcc/testsuite/c-c++-common/Wbidi-chars-8.c | 13 +
120 gcc/testsuite/c-c++-common/Wbidi-chars-9.c | 29 ++
121 libcpp/include/cpplib.h | 18 +-
122 libcpp/init.c | 1 +
123 libcpp/internal.h | 7 +
124 libcpp/lex.c | 408 +++++++++++++++++++-
125 23 files changed, 1315 insertions(+), 7 deletions(-)
126 create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-1.c
127 create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-10.c
128 create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-11.c
129 create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-12.c
130 create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-13.c
131 create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-14.c
132 create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-15.c
133 create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-16.c
134 create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-17.c
135 create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-2.c
136 create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-3.c
137 create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-4.c
138 create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-5.c
139 create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-6.c
140 create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-7.c
141 create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-8.c
142 create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-9.c
143
144diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
145index 8a4cd634f77..3976fc368db 100644
146--- a/gcc/c-family/c.opt
147+++ b/gcc/c-family/c.opt
148@@ -370,6 +370,30 @@ Wbad-function-cast
149 C ObjC Var(warn_bad_function_cast) Warning
150 Warn about casting functions to incompatible types.
151
152+Wbidi-chars
153+C ObjC C++ ObjC++ Warning Alias(Wbidi-chars=,any,none)
154+;
155+
156+Wbidi-chars=
157+C ObjC C++ ObjC++ RejectNegative Joined Warning CPP(cpp_warn_bidirectional) CppReason(CPP_W_BIDIRECTIONAL) Var(warn_bidirectional) Init(bidirectional_unpaired) Enum(cpp_bidirectional_level)
158+-Wbidi-chars=[none|unpaired|any] Warn about UTF-8 bidirectional control characters.
159+
160+; Required for these enum values.
161+SourceInclude
162+cpplib.h
163+
164+Enum
165+Name(cpp_bidirectional_level) Type(int) UnknownError(argument %qs to %<-Wbidi-chars%> not recognized)
166+
167+EnumValue
168+Enum(cpp_bidirectional_level) String(none) Value(bidirectional_none)
169+
170+EnumValue
171+Enum(cpp_bidirectional_level) String(unpaired) Value(bidirectional_unpaired)
172+
173+EnumValue
174+Enum(cpp_bidirectional_level) String(any) Value(bidirectional_any)
175+
176 Wbool-compare
177 C ObjC C++ ObjC++ Var(warn_bool_compare) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
178 Warn about boolean expression compared with an integer value different from true/false.
179diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
180index 6070288856c..a22758d18ee 100644
181--- a/gcc/doc/invoke.texi
182+++ b/gcc/doc/invoke.texi
183@@ -326,7 +326,9 @@ Objective-C and Objective-C++ Dialects}.
184 -Warith-conversion @gol
185 -Warray-bounds -Warray-bounds=@var{n} @gol
186 -Wno-attributes -Wattribute-alias=@var{n} -Wno-attribute-alias @gol
187--Wno-attribute-warning -Wbool-compare -Wbool-operation @gol
188+-Wno-attribute-warning @gol
189+-Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{]} @gol
190+-Wbool-compare -Wbool-operation @gol
191 -Wno-builtin-declaration-mismatch @gol
192 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
193 -Wc11-c2x-compat @gol
194@@ -7559,6 +7561,23 @@ Attributes considered include @code{allo
195 This is the default. You can disable these warnings with either
196 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
197
198+@item -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{]}
199+@opindex Wbidi-chars=
200+@opindex Wbidi-chars
201+@opindex Wno-bidi-chars
202+Warn about possibly misleading UTF-8 bidirectional control characters in
203+comments, string literals, character constants, and identifiers. Such
204+characters can change left-to-right writing direction into right-to-left
205+(and vice versa), which can cause confusion between the logical order and
206+visual order. This may be dangerous; for instance, it may seem that a piece
207+of code is not commented out, whereas it in fact is.
208+
209+There are three levels of warning supported by GCC@. The default is
210+@option{-Wbidi-chars=unpaired}, which warns about improperly terminated
211+bidi contexts. @option{-Wbidi-chars=none} turns the warning off.
212+@option{-Wbidi-chars=any} warns about any use of bidirectional control
213+characters.
214+
215 @item -Wbool-compare
216 @opindex Wno-bool-compare
217 @opindex Wbool-compare
218diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-10.c b/gcc/testsuite/c-c++-common/Wbidi-chars-10.c
219new file mode 100644
220index 00000000000..34f5ac19271
221--- /dev/null
222+++ b/gcc/testsuite/c-c++-common/Wbidi-chars-10.c
223@@ -0,0 +1,27 @@
224+/* PR preprocessor/103026 */
225+/* { dg-do compile } */
226+/* { dg-options "-Wbidi-chars=unpaired" } */
227+/* More nesting testing. */
228+
229+/* RLEâ« LRI⦠PDF⬠PDIâ©*/
230+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
231+int LRE_\u202a_PDF_\u202c;
232+int LRE_\u202a_PDF_\u202c_LRE_\u202a_PDF_\u202c;
233+int LRE_\u202a_LRI_\u2066_PDF_\u202c_PDI_\u2069;
234+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
235+int RLE_\u202b_RLI_\u2067_PDF_\u202c_PDI_\u2069;
236+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
237+int RLE_\u202b_RLI_\u2067_PDI_\u2069_PDF_\u202c;
238+int FSI_\u2068_LRO_\u202d_PDI_\u2069_PDF_\u202c;
239+int FSI_\u2068;
240+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
241+int FSI_\u2068_PDI_\u2069;
242+int FSI_\u2068_FSI_\u2068_PDI_\u2069;
243+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
244+int RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069;
245+int RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069;
246+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
247+int RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDF_\u202c;
248+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
249+int RLI_\u2067_RLI_\u2067_RLI_\u2067_RLI_\u2067_FSI_\u2068_PDI_\u2069_PDI_\u2069_PDI_\u2069_PDI_\u2069;
250+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
251diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-11.c b/gcc/testsuite/c-c++-common/Wbidi-chars-11.c
252new file mode 100644
253index 00000000000..270ce2368a9
254--- /dev/null
255+++ b/gcc/testsuite/c-c++-common/Wbidi-chars-11.c
256@@ -0,0 +1,13 @@
257+/* PR preprocessor/103026 */
258+/* { dg-do compile } */
259+/* { dg-options "-Wbidi-chars=unpaired" } */
260+/* Test that we warn when mixing UCN and UTF-8. */
261+
262+int LRE_âª_PDF_\u202c;
263+/* { dg-warning "mismatch" "" { target *-*-* } .-1 } */
264+int LRE_\u202a_PDF_â¬_;
265+/* { dg-warning "mismatch" "" { target *-*-* } .-1 } */
266+const char *s1 = "LRE_âª_PDF_\u202c";
267+/* { dg-warning "mismatch" "" { target *-*-* } .-1 } */
268+const char *s2 = "LRE_\u202a_PDF_â¬";
269+/* { dg-warning "mismatch" "" { target *-*-* } .-1 } */
270diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-12.c b/gcc/testsuite/c-c++-common/Wbidi-chars-12.c
271new file mode 100644
272index 00000000000..b07eec1da91
273--- /dev/null
274+++ b/gcc/testsuite/c-c++-common/Wbidi-chars-12.c
275@@ -0,0 +1,19 @@
276+/* PR preprocessor/103026 */
277+/* { dg-do compile { target { c || c++11 } } } */
278+/* { dg-options "-Wbidi-chars=any" } */
279+/* Test raw strings. */
280+
281+const char *s1 = R"(a b c LRE⪠1 2 3 PDF⬠x y z)";
282+/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
283+const char *s2 = R"(a b c RLE⫠1 2 3 PDF⬠x y z)";
284+/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
285+const char *s3 = R"(a b c LRO⭠1 2 3 PDF⬠x y z)";
286+/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
287+const char *s4 = R"(a b c RLO⮠1 2 3 PDF⬠x y z)";
288+/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
289+const char *s7 = R"(a b c FSI⨠1 2 3 PDI⩠x y) z";
290+/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */
291+const char *s8 = R"(a b c PDIâ© x y )z";
292+/* { dg-warning "U\\+2069" "" { target *-*-* } .-1 } */
293+const char *s9 = R"(a b c PDF⬠x y z)";
294+/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */
295diff -uprN '-x*.orig' '-x*.rej' del/gcc-11.2.0/gcc/testsuite/c-c++-common/Wbidi-chars-13.c gcc-11.2.0/gcc/testsuite/c-c++-common/Wbidi-chars-13.c
296--- del/gcc-11.2.0/gcc/testsuite/c-c++-common/Wbidi-chars-13.c 1969-12-31 16:00:00.000000000 -0800
297+++ gcc-11.2.0/gcc/testsuite/c-c++-common/Wbidi-chars-13.c 2021-12-13 23:11:22.328439287 -0800
298@@ -0,0 +1,17 @@
299+/* PR preprocessor/103026 */
300+/* { dg-do compile { target { c || c++11 } } } */
301+/* { dg-options "-Wbidi-chars=unpaired" } */
302+/* Test raw strings. */
303+
304+const char *s1 = R"(a b c LRE⪠1 2 3)";
305+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
306+const char *s2 = R"(a b c RLEâ« 1 2 3)";
307+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
308+const char *s3 = R"(a b c LROâ­ 1 2 3)";
309+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
310+const char *s4 = R"(a b c FSI⨠1 2 3)";
311+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
312+const char *s5 = R"(a b c LRI⦠1 2 3)";
313+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
314+const char *s6 = R"(a b c RLI⧠1 2 3)";
315+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
316diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-14.c b/gcc/testsuite/c-c++-common/Wbidi-chars-14.c
317new file mode 100644
318index 00000000000..ba5f75d9553
319--- /dev/null
320+++ b/gcc/testsuite/c-c++-common/Wbidi-chars-14.c
321@@ -0,0 +1,38 @@
322+/* PR preprocessor/103026 */
323+/* { dg-do compile } */
324+/* { dg-options "-Wbidi-chars=unpaired" } */
325+/* Test PDI handling, which also pops any subsequent LREs, RLEs, LROs,
326+ or RLOs. */
327+
328+/* LRI_â¦_LRI_â¦_RLE_â«_RLE_â«_RLE_â«_PDI_â©*/
329+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
330+// LRI_â¦_RLE_â«_RLE_â«_RLE_â«_PDI_â©
331+// LRI_â¦_RLO_â®_RLE_â«_RLE_â«_PDI_â©
332+// LRI_â¦_RLO_â®_RLE_â«_PDI_â©
333+// FSI_â¨_RLO_â®_PDI_â©
334+// FSI_â¨_FSI_â¨_RLO_â®_PDI_â©
335+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
336+
337+int LRI_\u2066_LRI_\u2066_LRE_\u202a_LRE_\u202a_LRE_\u202a_PDI_\u2069;
338+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
339+int LRI_\u2066_LRI_\u2066_LRE_\u202a_LRE_\u202a_LRE_\u202a_PDI_\u2069_PDI_\u2069;
340+int LRI_\u2066_LRI_\u2066_LRI_\u2066_LRE_\u202a_LRE_\u202a_LRE_\u202a_PDI_\u2069_PDI_\u2069;
341+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
342+int PDI_\u2069;
343+int LRI_\u2066_PDI_\u2069;
344+int RLI_\u2067_PDI_\u2069;
345+int LRE_\u202a_LRI_\u2066_PDI_\u2069;
346+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
347+int LRI_\u2066_LRE_\u202a_PDF_\u202c_PDI_\u2069;
348+int LRI_\u2066_LRE_\u202a_LRE_\u202a_PDF_\u202c_PDI_\u2069;
349+int RLI_\u2067_LRI_\u2066_LRE_\u202a_LRE_\u202a_PDF_\u202c_PDI_\u2069;
350+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
351+int FSI_\u2068_LRI_\u2066_LRE_\u202a_LRE_\u202a_PDF_\u202c_PDI_\u2069;
352+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
353+int RLO_\u202e_PDI_\u2069;
354+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
355+int RLI_\u2067_PDI_\u2069_RLI_\u2067;
356+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
357+int FSI_\u2068_PDF_\u202c_PDI_\u2069;
358+int FSI_\u2068_FSI_\u2068_PDF_\u202c_PDI_\u2069;
359+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
360diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-15.c b/gcc/testsuite/c-c++-common/Wbidi-chars-15.c
361new file mode 100644
362index 00000000000..a0ce8ff5e2c
363--- /dev/null
364+++ b/gcc/testsuite/c-c++-common/Wbidi-chars-15.c
365@@ -0,0 +1,59 @@
366+/* PR preprocessor/103026 */
367+/* { dg-do compile } */
368+/* { dg-options "-Wbidi-chars=unpaired" } */
369+/* Test unpaired bidi control chars in multiline comments. */
370+
371+/*
372+ * LRE⪠end
373+ */
374+/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
375+/*
376+ * RLEâ« end
377+ */
378+/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
379+/*
380+ * LROâ­ end
381+ */
382+/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
383+/*
384+ * RLOâ® end
385+ */
386+/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
387+/*
388+ * LRI⦠end
389+ */
390+/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
391+/*
392+ * RLI⧠end
393+ */
394+/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
395+/*
396+ * FSI⨠end
397+ */
398+/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
399+/* LREâª
400+ PDF⬠*/
401+/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
402+/* FSIâ¨
403+ PDIâ© */
404+/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
405+
406+/* LRE<âª>
407+ *
408+ */
409+/* { dg-warning "unpaired" "" { target *-*-* } .-3 } */
410+
411+/*
412+ * LRE<âª>
413+ */
414+/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
415+
416+/*
417+ *
418+ * LRE<âª> */
419+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
420+
421+/* RLI<â§> */ /* PDI<â©> */
422+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
423+/* LRE<âª> */ /* PDF<â¬> */
424+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
425diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-16.c b/gcc/testsuite/c-c++-common/Wbidi-chars-16.c
426new file mode 100644
427index 00000000000..baa0159861c
428--- /dev/null
429+++ b/gcc/testsuite/c-c++-common/Wbidi-chars-16.c
430@@ -0,0 +1,26 @@
431+/* PR preprocessor/103026 */
432+/* { dg-do compile } */
433+/* { dg-options "-Wbidi-chars=any" } */
434+/* Test LTR/RTL chars. */
435+
436+/* LTR<â> */
437+/* { dg-warning "U\\+200E" "" { target *-*-* } .-1 } */
438+// LTR<â>
439+/* { dg-warning "U\\+200E" "" { target *-*-* } .-1 } */
440+/* RTL<â> */
441+/* { dg-warning "U\\+200F" "" { target *-*-* } .-1 } */
442+// RTL<â>
443+/* { dg-warning "U\\+200F" "" { target *-*-* } .-1 } */
444+
445+const char *s1 = "LTR<â>";
446+/* { dg-warning "U\\+200E" "" { target *-*-* } .-1 } */
447+const char *s2 = "LTR\u200e";
448+/* { dg-warning "U\\+200E" "" { target *-*-* } .-1 } */
449+const char *s3 = "LTR\u200E";
450+/* { dg-warning "U\\+200E" "" { target *-*-* } .-1 } */
451+const char *s4 = "RTL<â>";
452+/* { dg-warning "U\\+200F" "" { target *-*-* } .-1 } */
453+const char *s5 = "RTL\u200f";
454+/* { dg-warning "U\\+200F" "" { target *-*-* } .-1 } */
455+const char *s6 = "RTL\u200F";
456+/* { dg-warning "U\\+200F" "" { target *-*-* } .-1 } */
457diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-17.c b/gcc/testsuite/c-c++-common/Wbidi-chars-17.c
458new file mode 100644
459index 00000000000..07cb4321f96
460--- /dev/null
461+++ b/gcc/testsuite/c-c++-common/Wbidi-chars-17.c
462@@ -0,0 +1,30 @@
463+/* PR preprocessor/103026 */
464+/* { dg-do compile } */
465+/* { dg-options "-Wbidi-chars=unpaired" } */
466+/* Test LTR/RTL chars. */
467+
468+/* LTR<â> */
469+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
470+// LTR<â>
471+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
472+/* RTL<â> */
473+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
474+// RTL<â>
475+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
476+int ltr_\u200e;
477+/* { dg-error "universal character " "" { target *-*-* } .-1 } */
478+int rtl_\u200f;
479+/* { dg-error "universal character " "" { target *-*-* } .-1 } */
480+
481+const char *s1 = "LTR<â>";
482+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
483+const char *s2 = "LTR\u200e";
484+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
485+const char *s3 = "LTR\u200E";
486+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
487+const char *s4 = "RTL<â>";
488+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
489+const char *s5 = "RTL\u200f";
490+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
491+const char *s6 = "RTL\u200F";
492+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
493diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-1.c b/gcc/testsuite/c-c++-common/Wbidi-chars-1.c
494new file mode 100644
495index 00000000000..2340374f276
496--- /dev/null
497+++ b/gcc/testsuite/c-c++-common/Wbidi-chars-1.c
498@@ -0,0 +1,12 @@
499+/* PR preprocessor/103026 */
500+/* { dg-do compile } */
501+
502+int main() {
503+ int isAdmin = 0;
504+ /*â® } â¦if (isAdmin)⩠⦠begin admins only */
505+/* { dg-warning "bidirectional" "" { target *-*-* } .-1 } */
506+ __builtin_printf("You are an admin.\n");
507+ /* end admins only â® { â¦*/
508+/* { dg-warning "bidirectional" "" { target *-*-* } .-1 } */
509+ return 0;
510+}
511diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-2.c b/gcc/testsuite/c-c++-common/Wbidi-chars-2.c
512new file mode 100644
513index 00000000000..2340374f276
514--- /dev/null
515+++ b/gcc/testsuite/c-c++-common/Wbidi-chars-2.c
516@@ -0,0 +1,9 @@
517+/* PR preprocessor/103026 */
518+/* { dg-do compile } */
519+
520+int main() {
521+ /* Say hello; newlineâ§/*/ return 0 ;
522+/* { dg-warning "bidirectional" "" { target *-*-* } .-1 } */
523+ __builtin_printf("Hello world.\n");
524+ return 0;
525+}
526diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-3.c b/gcc/testsuite/c-c++-common/Wbidi-chars-3.c
527new file mode 100644
528index 00000000000..9dc7edb6e64
529--- /dev/null
530+++ b/gcc/testsuite/c-c++-common/Wbidi-chars-3.c
531@@ -0,0 +1,11 @@
532+/* PR preprocessor/103026 */
533+/* { dg-do compile } */
534+
535+int main() {
536+ const char* access_level = "user";
537+ if (__builtin_strcmp(access_level, "userâ® â¦// Check if adminâ© â¦")) {
538+/* { dg-warning "bidirectional" "" { target *-*-* } .-1 } */
539+ __builtin_printf("You are an admin.\n");
540+ }
541+ return 0;
542+}
543diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-4.c b/gcc/testsuite/c-c++-common/Wbidi-chars-4.c
544new file mode 100644
545index 00000000000..639e5c62e88
546--- /dev/null
547+++ b/gcc/testsuite/c-c++-common/Wbidi-chars-4.c
548@@ -0,0 +1,188 @@
549+/* PR preprocessor/103026 */
550+/* { dg-do compile } */
551+/* { dg-options "-Wbidi-chars=any -Wno-multichar -Wno-overflow" } */
552+/* Test all bidi chars in various contexts (identifiers, comments,
553+ string literals, character constants), both UCN and UTF-8. The bidi
554+ chars here are properly terminated, except for the character constants. */
555+
556+/* a b c LRE⪠1 2 3 PDF⬠x y z */
557+/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
558+/* a b c RLE⫠1 2 3 PDF⬠x y z */
559+/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
560+/* a b c LRO⭠1 2 3 PDF⬠x y z */
561+/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
562+/* a b c RLO⮠1 2 3 PDF⬠x y z */
563+/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
564+/* a b c LRI⦠1 2 3 PDI⩠x y z */
565+/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */
566+/* a b c RLI⧠1 2 3 PDI⩠x y */
567+/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */
568+/* a b c FSI⨠1 2 3 PDI⩠x y z */
569+/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */
570+
571+/* Same but C++ comments instead. */
572+// a b c LRE⪠1 2 3 PDF⬠x y z
573+/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
574+// a b c RLE⫠1 2 3 PDF⬠x y z
575+/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
576+// a b c LRO⭠1 2 3 PDF⬠x y z
577+/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
578+// a b c RLO⮠1 2 3 PDF⬠x y z
579+/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
580+// a b c LRI⦠1 2 3 PDI⩠x y z
581+/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */
582+// a b c RLI⧠1 2 3 PDI⩠x y
583+/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */
584+// a b c FSI⨠1 2 3 PDI⩠x y z
585+/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */
586+
587+/* Here we're closing an unopened context, warn when =any. */
588+/* a b c PDIâ© x y z */
589+/* { dg-warning "U\\+2069" "" { target *-*-* } .-1 } */
590+/* a b c PDF⬠x y z */
591+/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */
592+// a b c PDIâ© x y z
593+/* { dg-warning "U\\+2069" "" { target *-*-* } .-1 } */
594+// a b c PDF⬠x y z
595+/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */
596+
597+/* Multiline comments. */
598+/* a b c PDIâ© x y z
599+ */
600+/* { dg-warning "U\\+2069" "" { target *-*-* } .-2 } */
601+/* a b c PDF⬠x y z
602+ */
603+/* { dg-warning "U\\+202C" "" { target *-*-* } .-2 } */
604+/* first
605+ a b c PDIâ© x y z
606+ */
607+/* { dg-warning "U\\+2069" "" { target *-*-* } .-2 } */
608+/* first
609+ a b c PDF⬠x y z
610+ */
611+/* { dg-warning "U\\+202C" "" { target *-*-* } .-2 } */
612+/* first
613+ a b c PDIâ© x y z */
614+/* { dg-warning "U\\+2069" "" { target *-*-* } .-1 } */
615+/* first
616+ a b c PDF⬠x y z */
617+/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */
618+
619+void
620+g1 ()
621+{
622+ const char *s1 = "a b c LRE⪠1 2 3 PDF⬠x y z";
623+/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
624+ const char *s2 = "a b c RLE⫠1 2 3 PDF⬠x y z";
625+/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
626+ const char *s3 = "a b c LRO⭠1 2 3 PDF⬠x y z";
627+/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
628+ const char *s4 = "a b c RLO⮠1 2 3 PDF⬠x y z";
629+/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
630+ const char *s5 = "a b c LRI⦠1 2 3 PDI⩠x y z";
631+/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */
632+ const char *s6 = "a b c RLI⧠1 2 3 PDI⩠x y z";
633+/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */
634+ const char *s7 = "a b c FSI⨠1 2 3 PDI⩠x y z";
635+/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */
636+ const char *s8 = "a b c PDIâ© x y z";
637+/* { dg-warning "U\\+2069" "" { target *-*-* } .-1 } */
638+ const char *s9 = "a b c PDF⬠x y z";
639+/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */
640+
641+ const char *s10 = "a b c LRE\u202a 1 2 3 PDF\u202c x y z";
642+/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
643+ const char *s11 = "a b c LRE\u202A 1 2 3 PDF\u202c x y z";
644+/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
645+ const char *s12 = "a b c RLE\u202b 1 2 3 PDF\u202c x y z";
646+/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
647+ const char *s13 = "a b c RLE\u202B 1 2 3 PDF\u202c x y z";
648+/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
649+ const char *s14 = "a b c LRO\u202d 1 2 3 PDF\u202c x y z";
650+/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
651+ const char *s15 = "a b c LRO\u202D 1 2 3 PDF\u202c x y z";
652+/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
653+ const char *s16 = "a b c RLO\u202e 1 2 3 PDF\u202c x y z";
654+/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
655+ const char *s17 = "a b c RLO\u202E 1 2 3 PDF\u202c x y z";
656+/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
657+ const char *s18 = "a b c LRI\u2066 1 2 3 PDI\u2069 x y z";
658+/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */
659+ const char *s19 = "a b c RLI\u2067 1 2 3 PDI\u2069 x y z";
660+/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */
661+ const char *s20 = "a b c FSI\u2068 1 2 3 PDI\u2069 x y z";
662+/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */
663+}
664+
665+void
666+g2 ()
667+{
668+ const char c1 = '\u202a';
669+/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
670+ const char c2 = '\u202A';
671+/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
672+ const char c3 = '\u202b';
673+/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
674+ const char c4 = '\u202B';
675+/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
676+ const char c5 = '\u202d';
677+/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
678+ const char c6 = '\u202D';
679+/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
680+ const char c7 = '\u202e';
681+/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
682+ const char c8 = '\u202E';
683+/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
684+ const char c9 = '\u2066';
685+/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */
686+ const char c10 = '\u2067';
687+/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */
688+ const char c11 = '\u2068';
689+/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */
690+}
691+
692+int aâªbâ¬c;
693+/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
694+int aâ«bâ¬c;
695+/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
696+int aâ­bâ¬c;
697+/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
698+int aâ®bâ¬c;
699+/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
700+int aâ¦bâ©c;
701+/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */
702+int aâ§bâ©c;
703+/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */
704+int aâ¨bâ©c;
705+/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */
706+int Aâ¬X;
707+/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */
708+int A\u202cY;
709+/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */
710+int A\u202CY2;
711+/* { dg-warning "U\\+202C" "" { target *-*-* } .-1 } */
712+
713+int d\u202ae\u202cf;
714+/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
715+int d\u202Ae\u202cf2;
716+/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
717+int d\u202be\u202cf;
718+/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
719+int d\u202Be\u202cf2;
720+/* { dg-warning "U\\+202B" "" { target *-*-* } .-1 } */
721+int d\u202de\u202cf;
722+/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
723+int d\u202De\u202cf2;
724+/* { dg-warning "U\\+202D" "" { target *-*-* } .-1 } */
725+int d\u202ee\u202cf;
726+/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
727+int d\u202Ee\u202cf2;
728+/* { dg-warning "U\\+202E" "" { target *-*-* } .-1 } */
729+int d\u2066e\u2069f;
730+/* { dg-warning "U\\+2066" "" { target *-*-* } .-1 } */
731+int d\u2067e\u2069f;
732+/* { dg-warning "U\\+2067" "" { target *-*-* } .-1 } */
733+int d\u2068e\u2069f;
734+/* { dg-warning "U\\+2068" "" { target *-*-* } .-1 } */
735+int X\u2069;
736+/* { dg-warning "U\\+2069" "" { target *-*-* } .-1 } */
737diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-5.c b/gcc/testsuite/c-c++-common/Wbidi-chars-5.c
738new file mode 100644
739index 00000000000..68cb053144b
740--- /dev/null
741+++ b/gcc/testsuite/c-c++-common/Wbidi-chars-5.c
742@@ -0,0 +1,188 @@
743+/* PR preprocessor/103026 */
744+/* { dg-do compile } */
745+/* { dg-options "-Wbidi-chars=unpaired -Wno-multichar -Wno-overflow" } */
746+/* Test all bidi chars in various contexts (identifiers, comments,
747+ string literals, character constants), both UCN and UTF-8. The bidi
748+ chars here are properly terminated, except for the character constants. */
749+
750+/* a b c LRE⪠1 2 3 PDF⬠x y z */
751+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
752+/* a b c RLE⫠1 2 3 PDF⬠x y z */
753+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
754+/* a b c LRO⭠1 2 3 PDF⬠x y z */
755+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
756+/* a b c RLO⮠1 2 3 PDF⬠x y z */
757+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
758+/* a b c LRI⦠1 2 3 PDI⩠x y z */
759+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
760+/* a b c RLI⧠1 2 3 PDI⩠x y */
761+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
762+/* a b c FSI⨠1 2 3 PDI⩠x y z */
763+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
764+
765+/* Same but C++ comments instead. */
766+// a b c LRE⪠1 2 3 PDF⬠x y z
767+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
768+// a b c RLE⫠1 2 3 PDF⬠x y z
769+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
770+// a b c LRO⭠1 2 3 PDF⬠x y z
771+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
772+// a b c RLO⮠1 2 3 PDF⬠x y z
773+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
774+// a b c LRI⦠1 2 3 PDI⩠x y z
775+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
776+// a b c RLI⧠1 2 3 PDI⩠x y
777+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
778+// a b c FSI⨠1 2 3 PDI⩠x y z
779+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
780+
781+/* Here we're closing an unopened context, warn when =any. */
782+/* a b c PDIâ© x y z */
783+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
784+/* a b c PDF⬠x y z */
785+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
786+// a b c PDIâ© x y z
787+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
788+// a b c PDF⬠x y z
789+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
790+
791+/* Multiline comments. */
792+/* a b c PDIâ© x y z
793+ */
794+/* { dg-bogus "unpaired" "" { target *-*-* } .-2 } */
795+/* a b c PDF⬠x y z
796+ */
797+/* { dg-bogus "unpaired" "" { target *-*-* } .-2 } */
798+/* first
799+ a b c PDIâ© x y z
800+ */
801+/* { dg-bogus "unpaired" "" { target *-*-* } .-2 } */
802+/* first
803+ a b c PDF⬠x y z
804+ */
805+/* { dg-bogus "unpaired" "" { target *-*-* } .-2 } */
806+/* first
807+ a b c PDIâ© x y z */
808+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
809+/* first
810+ a b c PDF⬠x y z */
811+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
812+
813+void
814+g1 ()
815+{
816+ const char *s1 = "a b c LRE⪠1 2 3 PDF⬠x y z";
817+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
818+ const char *s2 = "a b c RLE⫠1 2 3 PDF⬠x y z";
819+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
820+ const char *s3 = "a b c LRO⭠1 2 3 PDF⬠x y z";
821+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
822+ const char *s4 = "a b c RLO⮠1 2 3 PDF⬠x y z";
823+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
824+ const char *s5 = "a b c LRI⦠1 2 3 PDI⩠x y z";
825+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
826+ const char *s6 = "a b c RLI⧠1 2 3 PDI⩠x y z";
827+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
828+ const char *s7 = "a b c FSI⨠1 2 3 PDI⩠x y z";
829+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
830+ const char *s8 = "a b c PDIâ© x y z";
831+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
832+ const char *s9 = "a b c PDF⬠x y z";
833+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
834+
835+ const char *s10 = "a b c LRE\u202a 1 2 3 PDF\u202c x y z";
836+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
837+ const char *s11 = "a b c LRE\u202A 1 2 3 PDF\u202c x y z";
838+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
839+ const char *s12 = "a b c RLE\u202b 1 2 3 PDF\u202c x y z";
840+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
841+ const char *s13 = "a b c RLE\u202B 1 2 3 PDF\u202c x y z";
842+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
843+ const char *s14 = "a b c LRO\u202d 1 2 3 PDF\u202c x y z";
844+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
845+ const char *s15 = "a b c LRO\u202D 1 2 3 PDF\u202c x y z";
846+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
847+ const char *s16 = "a b c RLO\u202e 1 2 3 PDF\u202c x y z";
848+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
849+ const char *s17 = "a b c RLO\u202E 1 2 3 PDF\u202c x y z";
850+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
851+ const char *s18 = "a b c LRI\u2066 1 2 3 PDI\u2069 x y z";
852+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
853+ const char *s19 = "a b c RLI\u2067 1 2 3 PDI\u2069 x y z";
854+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
855+ const char *s20 = "a b c FSI\u2068 1 2 3 PDI\u2069 x y z";
856+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
857+}
858+
859+void
860+g2 ()
861+{
862+ const char c1 = '\u202a';
863+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
864+ const char c2 = '\u202A';
865+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
866+ const char c3 = '\u202b';
867+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
868+ const char c4 = '\u202B';
869+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
870+ const char c5 = '\u202d';
871+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
872+ const char c6 = '\u202D';
873+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
874+ const char c7 = '\u202e';
875+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
876+ const char c8 = '\u202E';
877+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
878+ const char c9 = '\u2066';
879+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
880+ const char c10 = '\u2067';
881+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
882+ const char c11 = '\u2068';
883+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
884+}
885+
886+int aâªbâ¬c;
887+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
888+int aâ«bâ¬c;
889+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
890+int aâ­bâ¬c;
891+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
892+int aâ®bâ¬c;
893+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
894+int aâ¦bâ©c;
895+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
896+int aâ§bâ©c;
897+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
898+int aâ¨bâ©c;
899+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
900+int Aâ¬X;
901+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
902+int A\u202cY;
903+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
904+int A\u202CY2;
905+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
906+
907+int d\u202ae\u202cf;
908+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
909+int d\u202Ae\u202cf2;
910+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
911+int d\u202be\u202cf;
912+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
913+int d\u202Be\u202cf2;
914+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
915+int d\u202de\u202cf;
916+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
917+int d\u202De\u202cf2;
918+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
919+int d\u202ee\u202cf;
920+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
921+int d\u202Ee\u202cf2;
922+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
923+int d\u2066e\u2069f;
924+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
925+int d\u2067e\u2069f;
926+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
927+int d\u2068e\u2069f;
928+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
929+int X\u2069;
930+/* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
931diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-6.c b/gcc/testsuite/c-c++-common/Wbidi-chars-6.c
932new file mode 100644
933index 00000000000..0ce6fff2dee
934--- /dev/null
935+++ b/gcc/testsuite/c-c++-common/Wbidi-chars-6.c
936@@ -0,0 +1,155 @@
937+/* PR preprocessor/103026 */
938+/* { dg-do compile } */
939+/* { dg-options "-Wbidi-chars=unpaired" } */
940+/* Test nesting of bidi chars in various contexts. */
941+
942+/* Terminated by the wrong char: */
943+/* a b c LRE⪠1 2 3 PDI⩠x y z */
944+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
945+/* a b c RLEâ« 1 2 3 PDIâ© x y z*/
946+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
947+/* a b c LROâ­ 1 2 3 PDIâ© x y z */
948+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
949+/* a b c RLOâ® 1 2 3 PDIâ© x y z */
950+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
951+/* a b c LRI⦠1 2 3 PDF⬠x y z */
952+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
953+/* a b c RLI⧠1 2 3 PDF⬠x y z */
954+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
955+/* a b c FSI⨠1 2 3 PDF⬠x y z*/
956+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
957+
958+/* LRE⪠PDF⬠*/
959+/* LRE⪠LRE⪠PDF⬠PDF⬠*/
960+/* PDF⬠LRE⪠PDF⬠*/
961+/* LRE⪠PDF⬠LRE⪠PDF⬠*/
962+/* LRE⪠LRE⪠PDF⬠*/
963+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
964+/* PDF⬠LRE⪠*/
965+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
966+
967+// a b c LRE⪠1 2 3 PDI⩠x y z
968+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
969+// a b c RLEâ« 1 2 3 PDIâ© x y z*/
970+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
971+// a b c LROâ­ 1 2 3 PDIâ© x y z
972+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
973+// a b c RLOâ® 1 2 3 PDIâ© x y z
974+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
975+// a b c LRI⦠1 2 3 PDF⬠x y z
976+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
977+// a b c RLI⧠1 2 3 PDF⬠x y z
978+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
979+// a b c FSI⨠1 2 3 PDF⬠x y z
980+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
981+
982+// LRE⪠PDFâ¬
983+// LRE⪠LRE⪠PDF⬠PDFâ¬
984+// PDF⬠LRE⪠PDFâ¬
985+// LRE⪠PDF⬠LRE⪠PDFâ¬
986+// LRE⪠LRE⪠PDFâ¬
987+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
988+// PDF⬠LREâª
989+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
990+
991+void
992+g1 ()
993+{
994+ const char *s1 = "a b c LRE⪠1 2 3 PDI⩠x y z";
995+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
996+ const char *s2 = "a b c LRE\u202a 1 2 3 PDI\u2069 x y z";
997+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
998+ const char *s3 = "a b c RLEâ« 1 2 3 PDIâ© x y ";
999+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1000+ const char *s4 = "a b c RLE\u202b 1 2 3 PDI\u2069 x y z";
1001+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1002+ const char *s5 = "a b c LROâ­ 1 2 3 PDIâ© x y z";
1003+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1004+ const char *s6 = "a b c LRO\u202d 1 2 3 PDI\u2069 x y z";
1005+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1006+ const char *s7 = "a b c RLOâ® 1 2 3 PDIâ© x y z";
1007+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1008+ const char *s8 = "a b c RLO\u202e 1 2 3 PDI\u2069 x y z";
1009+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1010+ const char *s9 = "a b c LRI⦠1 2 3 PDF⬠x y z";
1011+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1012+ const char *s10 = "a b c LRI\u2066 1 2 3 PDF\u202c x y z";
1013+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1014+ const char *s11 = "a b c RLI⧠1 2 3 PDF⬠x y z\
1015+ ";
1016+/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
1017+ const char *s12 = "a b c RLI\u2067 1 2 3 PDF\u202c x y z";
1018+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1019+ const char *s13 = "a b c FSI⨠1 2 3 PDF⬠x y z";
1020+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1021+ const char *s14 = "a b c FSI\u2068 1 2 3 PDF\u202c x y z";
1022+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1023+ const char *s15 = "PDF⬠LREâª";
1024+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1025+ const char *s16 = "PDF\u202c LRE\u202a";
1026+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1027+ const char *s17 = "LRE⪠PDFâ¬";
1028+ const char *s18 = "LRE\u202a PDF\u202c";
1029+ const char *s19 = "LRE⪠LRE⪠PDF⬠PDFâ¬";
1030+ const char *s20 = "LRE\u202a LRE\u202a PDF\u202c PDF\u202c";
1031+ const char *s21 = "PDF⬠LRE⪠PDFâ¬";
1032+ const char *s22 = "PDF\u202c LRE\u202a PDF\u202c";
1033+ const char *s23 = "LRE⪠LRE⪠PDFâ¬";
1034+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1035+ const char *s24 = "LRE\u202a LRE\u202a PDF\u202c";
1036+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1037+ const char *s25 = "PDF⬠LREâª";
1038+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1039+ const char *s26 = "PDF\u202c LRE\u202a";
1040+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1041+ const char *s27 = "PDF⬠LRE\u202a";
1042+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1043+ const char *s28 = "PDF\u202c LREâª";
1044+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1045+}
1046+
1047+int aLREâªbPDIâ©;
1048+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1049+int A\u202aB\u2069C;
1050+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1051+int aRLEâ«bPDIâ©;
1052+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1053+int a\u202bB\u2069c;
1054+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1055+int aLROâ­bPDIâ©;
1056+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1057+int a\u202db\u2069c2;
1058+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1059+int aRLOâ®bPDIâ©;
1060+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1061+int a\u202eb\u2069;
1062+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1063+int aLRIâ¦bPDFâ¬;
1064+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1065+int a\u2066b\u202c;
1066+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1067+int aRLIâ§bPDFâ¬c
1068+;
1069+/* { dg-warning "unpaired" "" { target *-*-* } .-2 } */
1070+int a\u2067b\u202c;
1071+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1072+int aFSIâ¨bPDFâ¬;
1073+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1074+int a\u2068b\u202c;
1075+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1076+int aFSIâ¨bPD\u202C;
1077+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1078+int aFSI\u2068bPDFâ¬_;
1079+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1080+int aLREâªbPDFâ¬b;
1081+int A\u202aB\u202c;
1082+int a_LREâª_LREâª_b_PDFâ¬_PDFâ¬;
1083+int A\u202aA\u202aB\u202cB\u202c;
1084+int aPDFâ¬bLREadPDFâ¬;
1085+int a_\u202C_\u202a_\u202c;
1086+int a_LREâª_b_PDFâ¬_c_LREâª_PDFâ¬;
1087+int a_\u202a_\u202c_\u202a_\u202c_;
1088+int a_LREâª_b_PDFâ¬_c_LREâª;
1089+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1090+int a_\u202a_\u202c_\u202a_;
1091+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1092diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-7.c b/gcc/testsuite/c-c++-common/Wbidi-chars-7.c
1093new file mode 100644
1094index 00000000000..d012d420ec0
1095--- /dev/null
1096+++ b/gcc/testsuite/c-c++-common/Wbidi-chars-7.c
1097@@ -0,0 +1,9 @@
1098+/* PR preprocessor/103026 */
1099+/* { dg-do compile } */
1100+/* { dg-options "-Wbidi-chars=any" } */
1101+/* Test we ignore UCNs in comments. */
1102+
1103+// a b c \u202a 1 2 3
1104+// a b c \u202A 1 2 3
1105+/* a b c \u202a 1 2 3 */
1106+/* a b c \u202A 1 2 3 */
1107diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-8.c b/gcc/testsuite/c-c++-common/Wbidi-chars-8.c
1108new file mode 100644
1109index 00000000000..4f54c5092ec
1110--- /dev/null
1111+++ b/gcc/testsuite/c-c++-common/Wbidi-chars-8.c
1112@@ -0,0 +1,13 @@
1113+/* PR preprocessor/103026 */
1114+/* { dg-do compile } */
1115+/* { dg-options "-Wbidi-chars=any" } */
1116+/* Test \u vs \U. */
1117+
1118+int a_\u202A;
1119+/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
1120+int a_\u202a_2;
1121+/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
1122+int a_\U0000202A_3;
1123+/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
1124+int a_\U0000202a_4;
1125+/* { dg-warning "U\\+202A" "" { target *-*-* } .-1 } */
1126diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-9.c b/gcc/testsuite/c-c++-common/Wbidi-chars-9.c
1127new file mode 100644
1128index 00000000000..e2af1b1ca97
1129--- /dev/null
1130+++ b/gcc/testsuite/c-c++-common/Wbidi-chars-9.c
1131@@ -0,0 +1,29 @@
1132+/* PR preprocessor/103026 */
1133+/* { dg-do compile } */
1134+/* { dg-options "-Wbidi-chars=unpaired" } */
1135+/* Test that we properly separate bidi contexts (comment/identifier/character
1136+ constant/string literal). */
1137+
1138+/* LRE ->âª<- */ int pdf_\u202c_1;
1139+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1140+/* RLE ->â«<- */ int pdf_\u202c_2;
1141+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1142+/* LRO ->â­<- */ int pdf_\u202c_3;
1143+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1144+/* RLO ->â®<- */ int pdf_\u202c_4;
1145+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1146+/* LRI ->â¦<-*/ int pdi_\u2069_1;
1147+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1148+/* RLI ->â§<- */ int pdi_\u2069_12;
1149+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1150+/* FSI ->â¨<- */ int pdi_\u2069_3;
1151+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1152+
1153+const char *s1 = "LRE\u202a"; /* PDF ->â¬<- */
1154+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1155+/* LRE ->âª<- */ const char *s2 = "PDF\u202c";
1156+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1157+const char *s3 = "LRE\u202a"; int pdf_\u202c_5;
1158+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1159+int lre_\u202a; const char *s4 = "PDF\u202c";
1160+/* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
1161diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
1162index 176f8c5bbce..112b9c24751 100644
1163--- a/libcpp/include/cpplib.h
1164+++ b/libcpp/include/cpplib.h
1165@@ -318,6 +318,17 @@ enum cpp_main_search
1166 CMS_system, /* Search the system INCLUDE path. */
1167 };
1168
1169+/* The possible bidirectional control characters checking levels, from least
1170+ restrictive to most. */
1171+enum cpp_bidirectional_level {
1172+ /* No checking. */
1173+ bidirectional_none,
1174+ /* Only detect unpaired uses of bidirectional control characters. */
1175+ bidirectional_unpaired,
1176+ /* Detect any use of bidirectional control characters. */
1177+ bidirectional_any
1178+};
1179+
1180 /* This structure is nested inside struct cpp_reader, and
1181 carries all the options visible to the command line. */
1182 struct cpp_options
1183@@ -531,6 +542,10 @@ struct cpp_options
1184 /* True if warn about differences between C++98 and C++11. */
1185 bool cpp_warn_cxx11_compat;
1186
1187+ /* Nonzero if bidirectional control characters checking is on. See enum
1188+ cpp_bidirectional_level. */
1189+ unsigned char cpp_warn_bidirectional;
1190+
1191 /* Dependency generation. */
1192 struct
1193 {
1194@@ -635,7 +650,8 @@ enum cpp_warning_reason {
1195 CPP_W_C90_C99_COMPAT,
1196 CPP_W_C11_C2X_COMPAT,
1197 CPP_W_CXX11_COMPAT,
1198- CPP_W_EXPANSION_TO_DEFINED
1199+ CPP_W_EXPANSION_TO_DEFINED,
1200+ CPP_W_BIDIRECTIONAL
1201 };
1202
1203 /* Callback for header lookup for HEADER, which is the name of a
1204diff --git a/libcpp/init.c b/libcpp/init.c
1205index 5a424e23553..f9a8f5f088f 100644
1206--- a/libcpp/init.c
1207+++ b/libcpp/init.c
1208@@ -219,6 +219,7 @@ cpp_create_reader (enum c_lang lang, cpp
1209 = ENABLE_CANONICAL_SYSTEM_HEADERS;
1210 CPP_OPTION (pfile, ext_numeric_literals) = 1;
1211 CPP_OPTION (pfile, warn_date_time) = 0;
1212+ CPP_OPTION (pfile, cpp_warn_bidirectional) = bidirectional_unpaired;
1213
1214 /* Default CPP arithmetic to something sensible for the host for the
1215 benefit of dumb users like fix-header. */
1216diff --git a/libcpp/internal.h b/libcpp/internal.h
1217index 8577cab6c83..0ce0246c5a2 100644
1218--- a/libcpp/internal.h
1219+++ b/libcpp/internal.h
1220@@ -597,6 +597,13 @@ struct cpp_reader
1221 /* Location identifying the main source file -- intended to be line
1222 zero of said file. */
1223 location_t main_loc;
1224+
1225+ /* Returns true iff we should warn about UTF-8 bidirectional control
1226+ characters. */
1227+ bool warn_bidi_p () const
1228+ {
1229+ return CPP_OPTION (this, cpp_warn_bidirectional) != bidirectional_none;
1230+ }
1231 };
1232
1233 /* Character classes. Based on the more primitive macros in safe-ctype.h.
1234diff --git a/libcpp/lex.c b/libcpp/lex.c
1235index fa2253d41c3..6a4fbce6030 100644
1236--- a/libcpp/lex.c
1237+++ b/libcpp/lex.c
1238@@ -1164,6 +1164,324 @@ _cpp_process_line_notes (cpp_reader *pfi
1239 }
1240 }
1241
1242+namespace bidi {
1243+ enum class kind {
1244+ NONE, LRE, RLE, LRO, RLO, LRI, RLI, FSI, PDF, PDI, LTR, RTL
1245+ };
1246+
1247+ /* All the UTF-8 encodings of bidi characters start with E2. */
1248+ constexpr uchar utf8_start = 0xe2;
1249+
1250+ /* A vector holding currently open bidi contexts. We use a char for
1251+ each context, its LSB is 1 if it represents a PDF context, 0 if it
1252+ represents a PDI context. The next bit is 1 if this context was open
1253+ by a bidi character written as a UCN, and 0 when it was UTF-8. */
1254+ semi_embedded_vec <unsigned char, 16> vec;
1255+
1256+ /* Close the whole comment/identifier/string literal/character constant
1257+ context. */
1258+ void on_close ()
1259+ {
1260+ vec.truncate (0);
1261+ }
1262+
1263+ /* Pop the last element in the vector. */
1264+ void pop ()
1265+ {
1266+ unsigned int len = vec.count ();
1267+ gcc_checking_assert (len > 0);
1268+ vec.truncate (len - 1);
1269+ }
1270+
1271+ /* Return the context of the Ith element. */
1272+ kind ctx_at (unsigned int i)
1273+ {
1274+ return (vec[i] & 1) ? kind::PDF : kind::PDI;
1275+ }
1276+
1277+ /* Return which context is currently opened. */
1278+ kind current_ctx ()
1279+ {
1280+ unsigned int len = vec.count ();
1281+ if (len == 0)
1282+ return kind::NONE;
1283+ return ctx_at (len - 1);
1284+ }
1285+
1286+ /* Return true if the current context comes from a UCN origin, that is,
1287+ the bidi char which started this bidi context was written as a UCN. */
1288+ bool current_ctx_ucn_p ()
1289+ {
1290+ unsigned int len = vec.count ();
1291+ gcc_checking_assert (len > 0);
1292+ return (vec[len - 1] >> 1) & 1;
1293+ }
1294+
1295+ /* We've read a bidi char, update the current vector as necessary. */
1296+ void on_char (kind k, bool ucn_p)
1297+ {
1298+ switch (k)
1299+ {
1300+ case kind::LRE:
1301+ case kind::RLE:
1302+ case kind::LRO:
1303+ case kind::RLO:
1304+ vec.push (ucn_p ? 3u : 1u);
1305+ break;
1306+ case kind::LRI:
1307+ case kind::RLI:
1308+ case kind::FSI:
1309+ vec.push (ucn_p ? 2u : 0u);
1310+ break;
1311+ /* PDF terminates the scope of the last LRE, RLE, LRO, or RLO
1312+ whose scope has not yet been terminated. */
1313+ case kind::PDF:
1314+ if (current_ctx () == kind::PDF)
1315+ pop ();
1316+ break;
1317+ /* PDI terminates the scope of the last LRI, RLI, or FSI whose
1318+ scope has not yet been terminated, as well as the scopes of
1319+ any subsequent LREs, RLEs, LROs, or RLOs whose scopes have not
1320+ yet been terminated. */
1321+ case kind::PDI:
1322+ for (int i = vec.count () - 1; i >= 0; --i)
1323+ if (ctx_at (i) == kind::PDI)
1324+ {
1325+ vec.truncate (i);
1326+ break;
1327+ }
1328+ break;
1329+ case kind::LTR:
1330+ case kind::RTL:
1331+ /* These aren't popped by a PDF/PDI. */
1332+ break;
1333+ [[likely]] case kind::NONE:
1334+ break;
1335+ default:
1336+ abort ();
1337+ }
1338+ }
1339+
1340+ /* Return a descriptive string for K. */
1341+ const char *to_str (kind k)
1342+ {
1343+ switch (k)
1344+ {
1345+ case kind::LRE:
1346+ return "U+202A (LEFT-TO-RIGHT EMBEDDING)";
1347+ case kind::RLE:
1348+ return "U+202B (RIGHT-TO-LEFT EMBEDDING)";
1349+ case kind::LRO:
1350+ return "U+202D (LEFT-TO-RIGHT OVERRIDE)";
1351+ case kind::RLO:
1352+ return "U+202E (RIGHT-TO-LEFT OVERRIDE)";
1353+ case kind::LRI:
1354+ return "U+2066 (LEFT-TO-RIGHT ISOLATE)";
1355+ case kind::RLI:
1356+ return "U+2067 (RIGHT-TO-LEFT ISOLATE)";
1357+ case kind::FSI:
1358+ return "U+2068 (FIRST STRONG ISOLATE)";
1359+ case kind::PDF:
1360+ return "U+202C (POP DIRECTIONAL FORMATTING)";
1361+ case kind::PDI:
1362+ return "U+2069 (POP DIRECTIONAL ISOLATE)";
1363+ case kind::LTR:
1364+ return "U+200E (LEFT-TO-RIGHT MARK)";
1365+ case kind::RTL:
1366+ return "U+200F (RIGHT-TO-LEFT MARK)";
1367+ default:
1368+ abort ();
1369+ }
1370+ }
1371+}
1372+
1373+/* Parse a sequence of 3 bytes starting with P and return its bidi code. */
1374+
1375+static bidi::kind
1376+get_bidi_utf8 (const unsigned char *const p)
1377+{
1378+ gcc_checking_assert (p[0] == bidi::utf8_start);
1379+
1380+ if (p[1] == 0x80)
1381+ switch (p[2])
1382+ {
1383+ case 0xaa:
1384+ return bidi::kind::LRE;
1385+ case 0xab:
1386+ return bidi::kind::RLE;
1387+ case 0xac:
1388+ return bidi::kind::PDF;
1389+ case 0xad:
1390+ return bidi::kind::LRO;
1391+ case 0xae:
1392+ return bidi::kind::RLO;
1393+ case 0x8e:
1394+ return bidi::kind::LTR;
1395+ case 0x8f:
1396+ return bidi::kind::RTL;
1397+ default:
1398+ break;
1399+ }
1400+ else if (p[1] == 0x81)
1401+ switch (p[2])
1402+ {
1403+ case 0xa6:
1404+ return bidi::kind::LRI;
1405+ case 0xa7:
1406+ return bidi::kind::RLI;
1407+ case 0xa8:
1408+ return bidi::kind::FSI;
1409+ case 0xa9:
1410+ return bidi::kind::PDI;
1411+ default:
1412+ break;
1413+ }
1414+
1415+ return bidi::kind::NONE;
1416+}
1417+
1418+/* Parse a UCN where P points just past \u or \U and return its bidi code. */
1419+
1420+static bidi::kind
1421+get_bidi_ucn (const unsigned char *p, bool is_U)
1422+{
1423+ /* 6.4.3 Universal Character Names
1424+ \u hex-quad
1425+ \U hex-quad hex-quad
1426+ where \unnnn means \U0000nnnn. */
1427+
1428+ if (is_U)
1429+ {
1430+ if (p[0] != '0' || p[1] != '0' || p[2] != '0' || p[3] != '0')
1431+ return bidi::kind::NONE;
1432+ /* Skip 4B so we can treat \u and \U the same below. */
1433+ p += 4;
1434+ }
1435+
1436+ /* All code points we are looking for start with 20xx. */
1437+ if (p[0] != '2' || p[1] != '0')
1438+ return bidi::kind::NONE;
1439+ else if (p[2] == '2')
1440+ switch (p[3])
1441+ {
1442+ case 'a':
1443+ case 'A':
1444+ return bidi::kind::LRE;
1445+ case 'b':
1446+ case 'B':
1447+ return bidi::kind::RLE;
1448+ case 'c':
1449+ case 'C':
1450+ return bidi::kind::PDF;
1451+ case 'd':
1452+ case 'D':
1453+ return bidi::kind::LRO;
1454+ case 'e':
1455+ case 'E':
1456+ return bidi::kind::RLO;
1457+ default:
1458+ break;
1459+ }
1460+ else if (p[2] == '6')
1461+ switch (p[3])
1462+ {
1463+ case '6':
1464+ return bidi::kind::LRI;
1465+ case '7':
1466+ return bidi::kind::RLI;
1467+ case '8':
1468+ return bidi::kind::FSI;
1469+ case '9':
1470+ return bidi::kind::PDI;
1471+ default:
1472+ break;
1473+ }
1474+ else if (p[2] == '0')
1475+ switch (p[3])
1476+ {
1477+ case 'e':
1478+ case 'E':
1479+ return bidi::kind::LTR;
1480+ case 'f':
1481+ case 'F':
1482+ return bidi::kind::RTL;
1483+ default:
1484+ break;
1485+ }
1486+
1487+ return bidi::kind::NONE;
1488+}
1489+
1490+/* We're closing a bidi context, that is, we've encountered a newline,
1491+ are closing a C-style comment, or are at the end of a string literal,
1492+ character constant, or identifier. Warn if this context was not
1493+ properly terminated by a PDI or PDF. P points to the last character
1494+ in this context. */
1495+
1496+static void
1497+maybe_warn_bidi_on_close (cpp_reader *pfile, const uchar *p)
1498+{
1499+ if (CPP_OPTION (pfile, cpp_warn_bidirectional) == bidirectional_unpaired
1500+ && bidi::vec.count () > 0)
1501+ {
1502+ const location_t loc
1503+ = linemap_position_for_column (pfile->line_table,
1504+ CPP_BUF_COLUMN (pfile->buffer, p));
1505+ cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0,
1506+ "unpaired UTF-8 bidirectional control character "
1507+ "detected");
1508+ }
1509+ /* We're done with this context. */
1510+ bidi::on_close ();
1511+}
1512+
1513+/* We're at the beginning or in the middle of an identifier/comment/string
1514+ literal/character constant. Warn if we've encountered a bidi character.
1515+ KIND says which bidi character it was; P points to it in the character
1516+ stream. UCN_P is true iff this bidi character was written as a UCN. */
1517+
1518+static void
1519+maybe_warn_bidi_on_char (cpp_reader *pfile, const uchar *p, bidi::kind kind,
1520+ bool ucn_p)
1521+{
1522+ if (__builtin_expect (kind == bidi::kind::NONE, 1))
1523+ return;
1524+
1525+ const auto warn_bidi = CPP_OPTION (pfile, cpp_warn_bidirectional);
1526+
1527+ if (warn_bidi != bidirectional_none)
1528+ {
1529+ const location_t loc
1530+ = linemap_position_for_column (pfile->line_table,
1531+ CPP_BUF_COLUMN (pfile->buffer, p));
1532+ /* It seems excessive to warn about a PDI/PDF that is closing
1533+ an opened context because we've already warned about the
1534+ opening character. Except warn when we have a UCN x UTF-8
1535+ mismatch. */
1536+ if (kind == bidi::current_ctx ())
1537+ {
1538+ if (warn_bidi == bidirectional_unpaired
1539+ && bidi::current_ctx_ucn_p () != ucn_p)
1540+ cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0,
1541+ "UTF-8 vs UCN mismatch when closing "
1542+ "a context by \"%s\"", bidi::to_str (kind));
1543+ }
1544+ else if (warn_bidi == bidirectional_any)
1545+ {
1546+ if (kind == bidi::kind::PDF || kind == bidi::kind::PDI)
1547+ cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0,
1548+ "\"%s\" is closing an unopened context",
1549+ bidi::to_str (kind));
1550+ else
1551+ cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0,
1552+ "found problematic Unicode character \"%s\"",
1553+ bidi::to_str (kind));
1554+ }
1555+ }
1556+ /* We're done with this context. */
1557+ bidi::on_char (kind, ucn_p);
1558+}
1559+
1560 /* Skip a C-style block comment. We find the end of the comment by
1561 seeing if an asterisk is before every '/' we encounter. Returns
1562 nonzero if comment terminated by EOF, zero otherwise.
1563@@ -1175,6 +1493,7 @@ _cpp_skip_block_comment (cpp_reader *pfi
1564 cpp_buffer *buffer = pfile->buffer;
1565 const uchar *cur = buffer->cur;
1566 uchar c;
1567+ const bool warn_bidi_p = pfile->warn_bidi_p ();
1568
1569 cur++;
1570 if (*cur == '/')
1571@@ -1189,7 +1508,11 @@ _cpp_skip_block_comment (cpp_reader *pfi
1572 if (c == '/')
1573 {
1574 if (cur[-2] == '*')
1575- break;
1576+ {
1577+ if (warn_bidi_p)
1578+ maybe_warn_bidi_on_close (pfile, cur);
1579+ break;
1580+ }
1581
1582 /* Warn about potential nested comments, but not if the '/'
1583 comes immediately before the true comment delimiter.
1584@@ -1208,6 +1531,8 @@ _cpp_skip_block_comment (cpp_reader *pfi
1585 {
1586 unsigned int cols;
1587 buffer->cur = cur - 1;
1588+ if (warn_bidi_p)
1589+ maybe_warn_bidi_on_close (pfile, cur);
1590 _cpp_process_line_notes (pfile, true);
1591 if (buffer->next_line >= buffer->rlimit)
1592 return true;
1593@@ -1218,6 +1543,13 @@ _cpp_skip_block_comment (cpp_reader *pfi
1594
1595 cur = buffer->cur;
1596 }
1597+ /* If this is a beginning of a UTF-8 encoding, it might be
1598+ a bidirectional control character. */
1599+ else if (__builtin_expect (c == bidi::utf8_start, 0) && warn_bidi_p)
1600+ {
1601+ bidi::kind kind = get_bidi_utf8 (cur - 1);
1602+ maybe_warn_bidi_on_char (pfile, cur, kind, /*ucn_p=*/false);
1603+ }
1604 }
1605
1606 buffer->cur = cur;
1607@@ -1233,9 +1565,31 @@ skip_line_comment (cpp_reader *pfile)
1608 {
1609 cpp_buffer *buffer = pfile->buffer;
1610 location_t orig_line = pfile->line_table->highest_line;
1611+ const bool warn_bidi_p = pfile->warn_bidi_p ();
1612
1613- while (*buffer->cur != '\n')
1614- buffer->cur++;
1615+ if (!warn_bidi_p)
1616+ while (*buffer->cur != '\n')
1617+ buffer->cur++;
1618+ else
1619+ {
1620+ while (*buffer->cur != '\n'
1621+ && *buffer->cur != bidi::utf8_start)
1622+ buffer->cur++;
1623+ if (__builtin_expect (*buffer->cur == bidi::utf8_start, 0))
1624+ {
1625+ while (*buffer->cur != '\n')
1626+ {
1627+ if (__builtin_expect (*buffer->cur == bidi::utf8_start, 0))
1628+ {
1629+ bidi::kind kind = get_bidi_utf8 (buffer->cur);
1630+ maybe_warn_bidi_on_char (pfile, buffer->cur, kind,
1631+ /*ucn_p=*/false);
1632+ }
1633+ buffer->cur++;
1634+ }
1635+ maybe_warn_bidi_on_close (pfile, buffer->cur);
1636+ }
1637+ }
1638
1639 _cpp_process_line_notes (pfile, true);
1640 return orig_line != pfile->line_table->highest_line;
1641@@ -1317,11 +1671,13 @@ static const cppchar_t utf8_signifier =
1642
1643 /* Returns TRUE if the sequence starting at buffer->cur is valid in
1644 an identifier. FIRST is TRUE if this starts an identifier. */
1645+
1646 static bool
1647 forms_identifier_p (cpp_reader *pfile, int first,
1648 struct normalize_state *state)
1649 {
1650 cpp_buffer *buffer = pfile->buffer;
1651+ const bool warn_bidi_p = pfile->warn_bidi_p ();
1652
1653 if (*buffer->cur == '$')
1654 {
1655@@ -1344,6 +1700,13 @@ forms_identifier_p (cpp_reader *pfile, i
1656 cppchar_t s;
1657 if (*buffer->cur >= utf8_signifier)
1658 {
1659+ if (__builtin_expect (*buffer->cur == bidi::utf8_start, 0)
1660+ && warn_bidi_p)
1661+ {
1662+ bidi::kind kind = get_bidi_utf8 (buffer->cur);
1663+ maybe_warn_bidi_on_char (pfile, buffer->cur, kind,
1664+ /*ucn_p=*/false);
1665+ }
1666 if (_cpp_valid_utf8 (pfile, &buffer->cur, buffer->rlimit, 1 + !first,
1667 state, &s))
1668 return true;
1669@@ -1352,6 +1715,13 @@ forms_identifier_p (cpp_reader *pfile, i
1670 && (buffer->cur[1] == 'u' || buffer->cur[1] == 'U'))
1671 {
1672 buffer->cur += 2;
1673+ if (warn_bidi_p)
1674+ {
1675+ bidi::kind kind = get_bidi_ucn (buffer->cur,
1676+ buffer->cur[-1] == 'U');
1677+ maybe_warn_bidi_on_char (pfile, buffer->cur, kind,
1678+ /*ucn_p=*/true);
1679+ }
1680 if (_cpp_valid_ucn (pfile, &buffer->cur, buffer->rlimit, 1 + !first,
1681 state, &s, NULL, NULL))
1682 return true;
1683@@ -1460,6 +1830,7 @@ lex_identifier (cpp_reader *pfile, const
1684 const uchar *cur;
1685 unsigned int len;
1686 unsigned int hash = HT_HASHSTEP (0, *base);
1687+ const bool warn_bidi_p = pfile->warn_bidi_p ();
1688
1689 cur = pfile->buffer->cur;
1690 if (! starts_ucn)
1691@@ -1483,6 +1854,8 @@ lex_identifier (cpp_reader *pfile, const
1692 pfile->buffer->cur++;
1693 }
1694 } while (forms_identifier_p (pfile, false, nst));
1695+ if (warn_bidi_p)
1696+ maybe_warn_bidi_on_close (pfile, pfile->buffer->cur);
1697 result = _cpp_interpret_identifier (pfile, base,
1698 pfile->buffer->cur - base);
1699 *spelling = cpp_lookup (pfile, base, pfile->buffer->cur - base);
1700@@ -1719,6 +2092,7 @@ static void
1701 lex_raw_string (cpp_reader *pfile, cpp_token *token, const uchar *base)
1702 {
1703 const uchar *pos = base;
1704+ const bool warn_bidi_p = pfile->warn_bidi_p ();
1705
1706 /* 'tis a pity this information isn't passed down from the lexer's
1707 initial categorization of the token. */
1708@@ -1955,8 +2329,15 @@ lex_raw_string (cpp_reader *pfile, cpp_t
1709 pos = base = pfile->buffer->cur;
1710 note = &pfile->buffer->notes[pfile->buffer->cur_note];
1711 }
1712+ else if (__builtin_expect ((unsigned char) c == bidi::utf8_start, 0)
1713+ && warn_bidi_p)
1714+ maybe_warn_bidi_on_char (pfile, pos - 1, get_bidi_utf8 (pos - 1),
1715+ /*ucn_p=*/false);
1716 }
1717
1718+ if (warn_bidi_p)
1719+ maybe_warn_bidi_on_close (pfile, pos);
1720+
1721 if (CPP_OPTION (pfile, user_literals))
1722 {
1723 /* If a string format macro, say from inttypes.h, is placed touching
1724@@ -2051,15 +2432,27 @@ lex_string (cpp_reader *pfile, cpp_token
1725 else
1726 terminator = '>', type = CPP_HEADER_NAME;
1727
1728+ const bool warn_bidi_p = pfile->warn_bidi_p ();
1729 for (;;)
1730 {
1731 cppchar_t c = *cur++;
1732
1733 /* In #include-style directives, terminators are not escapable. */
1734 if (c == '\\' && !pfile->state.angled_headers && *cur != '\n')
1735- cur++;
1736+ {
1737+ if ((cur[0] == 'u' || cur[0] == 'U') && warn_bidi_p)
1738+ {
1739+ bidi::kind kind = get_bidi_ucn (cur + 1, cur[0] == 'U');
1740+ maybe_warn_bidi_on_char (pfile, cur, kind, /*ucn_p=*/true);
1741+ }
1742+ cur++;
1743+ }
1744 else if (c == terminator)
1745- break;
1746+ {
1747+ if (warn_bidi_p)
1748+ maybe_warn_bidi_on_close (pfile, cur - 1);
1749+ break;
1750+ }
1751 else if (c == '\n')
1752 {
1753 cur--;
1754@@ -2076,6 +2469,11 @@ lex_string (cpp_reader *pfile, cpp_token
1755 }
1756 else if (c == '\0')
1757 saw_NUL = true;
1758+ else if (__builtin_expect (c == bidi::utf8_start, 0) && warn_bidi_p)
1759+ {
1760+ bidi::kind kind = get_bidi_utf8 (cur - 1);
1761+ maybe_warn_bidi_on_char (pfile, cur - 1, kind, /*ucn_p=*/false);
1762+ }
1763 }
1764
1765 if (saw_NUL && !pfile->state.skipping)
diff --git a/meta/recipes-devtools/gcc/gcc/0003-CVE-2021-35465.patch b/meta/recipes-devtools/gcc/gcc/0003-CVE-2021-35465.patch
new file mode 100644
index 0000000000..d87be19866
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc/0003-CVE-2021-35465.patch
@@ -0,0 +1,103 @@
1From 30461cf8dba3d3adb15a125e4da48800eb2b9b8f Mon Sep 17 00:00:00 2001
2From: Richard Earnshaw <rearnsha@arm.com>
3Date: Fri, 18 Jun 2021 17:18:37 +0100
4Subject: [PATCH] arm: fix vlldm erratum for Armv8.1-m [PR102035]
5
6For Armv8.1-m we generate code that emits VLLDM directly and do not
7rely on support code in the library, so emit the mitigation directly
8as well, when required. In this case, we can use the compiler options
9to determine when to apply the fix and when it is safe to omit it.
10
11gcc:
12 PR target/102035
13 * config/arm/arm.md (attribute arch): Add fix_vlldm.
14 (arch_enabled): Use it.
15 * config/arm/vfp.md (lazy_store_multiple_insn): Add alternative to
16 use when erratum mitigation is needed.
17
18CVE: CVE-2021-35465
19Upstream-Status: Backport[https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=30461cf8dba3d3adb15a125e4da48800eb2b9b8f]
20Signed-off-by: Pgowda <pgowda.cve@gmail.com>
21
22---
23 gcc/config/arm/arm.md | 11 +++++++++--
24 gcc/config/arm/vfp.md | 10 +++++++---
25 2 files changed, 16 insertions(+), 5 deletions(-)
26
27diff -upr a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
28--- a/gcc/config/arm/arm.md 2020-07-22 23:35:17.344384552 -0700
29+++ b/gcc/config/arm/arm.md 2021-11-11 20:33:58.431543947 -0800
30@@ -132,9 +132,12 @@
31 ; TARGET_32BIT, "t1" or "t2" to specify a specific Thumb mode. "v6"
32 ; for ARM or Thumb-2 with arm_arch6, and nov6 for ARM without
33 ; arm_arch6. "v6t2" for Thumb-2 with arm_arch6 and "v8mb" for ARMv8-M
34-; Baseline. This attribute is used to compute attribute "enabled",
35+; Baseline. "fix_vlldm" is for fixing the v8-m/v8.1-m VLLDM erratum.
36+; This attribute is used to compute attribute "enabled",
37 ; use type "any" to enable an alternative in all cases.
38-(define_attr "arch" "any,a,t,32,t1,t2,v6,nov6,v6t2,v8mb,iwmmxt,iwmmxt2,armv6_or_vfpv3,neon,mve"
39+(define_attr "arch" "any, a, t, 32, t1, t2, v6,nov6, v6t2, \
40+ v8mb, fix_vlldm, iwmmxt, iwmmxt2, armv6_or_vfpv3, \
41+ neon, mve"
42 (const_string "any"))
43
44 (define_attr "arch_enabled" "no,yes"
45@@ -177,6 +180,10 @@
46 (match_test "TARGET_THUMB1 && arm_arch8"))
47 (const_string "yes")
48
49+ (and (eq_attr "arch" "fix_vlldm")
50+ (match_test "fix_vlldm"))
51+ (const_string "yes")
52+
53 (and (eq_attr "arch" "iwmmxt2")
54 (match_test "TARGET_REALLY_IWMMXT2"))
55 (const_string "yes")
56diff -upr a/gcc/config/arm/vfp.md b/gcc/config/arm/vfp.md
57--- a/gcc/config/arm/vfp.md 2020-07-22 23:35:17.356384684 -0700
58+++ b/gcc/config/arm/vfp.md 2021-11-11 20:33:58.431543947 -0800
59@@ -1703,12 +1703,15 @@
60 (set_attr "type" "mov_reg")]
61 )
62
63+;; Both this and the next instruction are treated by GCC in the same
64+;; way as a blockage pattern. That's perhaps stronger than it needs
65+;; to be, but we do not want accesses to the VFP register bank to be
66+;; moved across either instruction.
67+
68 (define_insn "lazy_store_multiple_insn"
69- [(set (match_operand:SI 0 "s_register_operand" "+&rk")
70- (post_dec:SI (match_dup 0)))
71- (unspec_volatile [(const_int 0)
72- (mem:SI (post_dec:SI (match_dup 0)))]
73- VUNSPEC_VLSTM)]
74+ [(unspec_volatile
75+ [(mem:BLK (match_operand:SI 0 "s_register_operand" "rk"))]
76+ VUNSPEC_VLSTM)]
77 "use_cmse && reload_completed"
78 "vlstm%?\\t%0"
79 [(set_attr "predicable" "yes")
80@@ -1716,14 +1719,16 @@
81 )
82
83 (define_insn "lazy_load_multiple_insn"
84- [(set (match_operand:SI 0 "s_register_operand" "+&rk")
85- (post_inc:SI (match_dup 0)))
86- (unspec_volatile:SI [(const_int 0)
87- (mem:SI (match_dup 0))]
88- VUNSPEC_VLLDM)]
89+ [(unspec_volatile
90+ [(mem:BLK (match_operand:SI 0 "s_register_operand" "rk,rk"))]
91+ VUNSPEC_VLLDM)]
92 "use_cmse && reload_completed"
93- "vlldm%?\\t%0"
94- [(set_attr "predicable" "yes")
95+ "@
96+ vscclrm\\t{vpr}\;vlldm\\t%0
97+ vlldm\\t%0"
98+ [(set_attr "arch" "fix_vlldm,*")
99+ (set_attr "predicable" "no")
100+ (set_attr "length" "8,4")
101 (set_attr "type" "load_4")]
102 )
103
diff --git a/meta/recipes-devtools/gcc/gcc/0003-CVE-2021-42574.patch b/meta/recipes-devtools/gcc/gcc/0003-CVE-2021-42574.patch
new file mode 100644
index 0000000000..2995a6fc61
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc/0003-CVE-2021-42574.patch
@@ -0,0 +1,142 @@
1From 1a7f2c0774129750fdf73e9f1b78f0ce983c9ab3 Mon Sep 17 00:00:00 2001
2From: David Malcolm <dmalcolm@redhat.com>
3Date: Tue, 2 Nov 2021 09:54:32 -0400
4Subject: [PATCH] libcpp: escape non-ASCII source bytes in -Wbidi-chars=
5 [PR103026]
6MIME-Version: 1.0
7Content-Type: text/plain; charset=utf8
8Content-Transfer-Encoding: 8bit
9
10This flags rich_locations associated with -Wbidi-chars= so that
11non-ASCII bytes will be escaped when printing the source lines
12(using the diagnostics support I added in
13r12-4825-gbd5e882cf6e0def3dd1bc106075d59a303fe0d1e).
14
15In particular, this ensures that the printed source lines will
16be pure ASCII, and thus the visual ordering of the characters
17will be the same as the logical ordering.
18
19Before:
20
21 Wbidi-chars-1.c: In function âmainâ:
22 Wbidi-chars-1.c:6:43: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
23 6 | /*â® } â¦if (isAdmin)⩠⦠begin admins only */
24 | ^
25 Wbidi-chars-1.c:9:28: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
26 9 | /* end admins only â® { â¦*/
27 | ^
28
29 Wbidi-chars-11.c:6:15: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
30 6 | int LRE_âª_PDF_\u202c;
31 | ^
32 Wbidi-chars-11.c:8:19: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
33 8 | int LRE_\u202a_PDF_â¬_;
34 | ^
35 Wbidi-chars-11.c:10:28: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
36 10 | const char *s1 = "LRE_âª_PDF_\u202c";
37 | ^
38 Wbidi-chars-11.c:12:33: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
39 12 | const char *s2 = "LRE_\u202a_PDF_â¬";
40 | ^
41
42After:
43
44 Wbidi-chars-1.c: In function âmainâ:
45 Wbidi-chars-1.c:6:43: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
46 6 | /*<U+202E> } <U+2066>if (isAdmin)<U+2069> <U+2066> begin admins only */
47 | ^
48 Wbidi-chars-1.c:9:28: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
49 9 | /* end admins only <U+202E> { <U+2066>*/
50 | ^
51
52 Wbidi-chars-11.c:6:15: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
53 6 | int LRE_<U+202A>_PDF_\u202c;
54 | ^
55 Wbidi-chars-11.c:8:19: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
56 8 | int LRE_\u202a_PDF_<U+202C>_;
57 | ^
58 Wbidi-chars-11.c:10:28: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
59 10 | const char *s1 = "LRE_<U+202A>_PDF_\u202c";
60 | ^
61 Wbidi-chars-11.c:12:33: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
62 12 | const char *s2 = "LRE_\u202a_PDF_<U+202C>";
63 | ^
64
65libcpp/ChangeLog:
66 PR preprocessor/103026
67 * lex.c (maybe_warn_bidi_on_close): Use a rich_location
68 and call set_escape_on_output (true) on it.
69 (maybe_warn_bidi_on_char): Likewise.
70
71Signed-off-by: David Malcolm <dmalcolm@redhat.com>
72
73CVE: CVE-2021-42574
74Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=1a7f2c0774129750fdf73e9f1b78f0ce983c9ab3]
75Signed-off-by: Pgowda <pgowda.cve@gmail.com>
76
77---
78 libcpp/lex.c | 29 +++++++++++++++++------------
79 1 file changed, 17 insertions(+), 12 deletions(-)
80
81diff --git a/libcpp/lex.c b/libcpp/lex.c
82index 8188e33b07d..2421d6c0f40 100644
83--- a/libcpp/lex.c
84+++ b/libcpp/lex.c
85@@ -1427,9 +1427,11 @@ maybe_warn_bidi_on_close (cpp_reader *pfile, const uchar *p)
86 const location_t loc
87 = linemap_position_for_column (pfile->line_table,
88 CPP_BUF_COLUMN (pfile->buffer, p));
89- cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0,
90- "unpaired UTF-8 bidirectional control character "
91- "detected");
92+ rich_location rich_loc (pfile->line_table, loc);
93+ rich_loc.set_escape_on_output (true);
94+ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
95+ "unpaired UTF-8 bidirectional control character "
96+ "detected");
97 }
98 /* We're done with this context. */
99 bidi::on_close ();
100@@ -1454,6 +1456,9 @@ maybe_warn_bidi_on_char (cpp_reader *pfile, const uchar *p, bidi::kind kind,
101 const location_t loc
102 = linemap_position_for_column (pfile->line_table,
103 CPP_BUF_COLUMN (pfile->buffer, p));
104+ rich_location rich_loc (pfile->line_table, loc);
105+ rich_loc.set_escape_on_output (true);
106+
107 /* It seems excessive to warn about a PDI/PDF that is closing
108 an opened context because we've already warned about the
109 opening character. Except warn when we have a UCN x UTF-8
110@@ -1462,20 +1467,20 @@ maybe_warn_bidi_on_char (cpp_reader *pfile, const uchar *p, bidi::kind kind,
111 {
112 if (warn_bidi == bidirectional_unpaired
113 && bidi::current_ctx_ucn_p () != ucn_p)
114- cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0,
115- "UTF-8 vs UCN mismatch when closing "
116- "a context by \"%s\"", bidi::to_str (kind));
117+ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
118+ "UTF-8 vs UCN mismatch when closing "
119+ "a context by \"%s\"", bidi::to_str (kind));
120 }
121 else if (warn_bidi == bidirectional_any)
122 {
123 if (kind == bidi::kind::PDF || kind == bidi::kind::PDI)
124- cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0,
125- "\"%s\" is closing an unopened context",
126- bidi::to_str (kind));
127+ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
128+ "\"%s\" is closing an unopened context",
129+ bidi::to_str (kind));
130 else
131- cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0,
132- "found problematic Unicode character \"%s\"",
133- bidi::to_str (kind));
134+ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
135+ "found problematic Unicode character \"%s\"",
136+ bidi::to_str (kind));
137 }
138 }
139 /* We're done with this context. */
140--
1412.27.0
142
diff --git a/meta/recipes-devtools/gcc/gcc/0004-CVE-2021-35465.patch b/meta/recipes-devtools/gcc/gcc/0004-CVE-2021-35465.patch
new file mode 100644
index 0000000000..12dfe682fa
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc/0004-CVE-2021-35465.patch
@@ -0,0 +1,304 @@
1From 809330ab8450261e05919b472783bf15e4b000f7 Mon Sep 17 00:00:00 2001
2From: Richard Earnshaw <rearnsha@arm.com>
3Date: Tue, 6 Jul 2021 15:10:18 +0100
4Subject: [PATCH] arm: Add tests for VLLDM mitigation [PR102035]
5
6New tests for the erratum mitigation.
7
8gcc/testsuite:
9 PR target/102035
10 * gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c: New test.
11 * gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c: Likewise.
12 * gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c: Likewise.
13 * gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c: Likewise.
14 * gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c: Likewise.
15 * gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c: Likewise.
16 * gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c: Likewise.
17 * gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c: Likewise.
18
19CVE: CVE-2021-35465
20Upstream-Status: Backport[https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=809330ab8450261e05919b472783bf15e4b000f7]
21Signed-off-by: Pgowda <pgowda.cve@gmail.com>
22
23---
24 .../arm/cmse/mainline/8_1m/soft/cmse-13a.c | 31 +++++++++++++++++++
25 .../arm/cmse/mainline/8_1m/soft/cmse-7a.c | 28 +++++++++++++++++
26 .../arm/cmse/mainline/8_1m/soft/cmse-8a.c | 30 ++++++++++++++++++
27 .../cmse/mainline/8_1m/softfp-sp/cmse-7a.c | 27 ++++++++++++++++
28 .../cmse/mainline/8_1m/softfp-sp/cmse-8a.c | 29 +++++++++++++++++
29 .../arm/cmse/mainline/8_1m/softfp/cmse-13a.c | 30 ++++++++++++++++++
30 .../arm/cmse/mainline/8_1m/softfp/cmse-7a.c | 27 ++++++++++++++++
31 .../arm/cmse/mainline/8_1m/softfp/cmse-8a.c | 29 +++++++++++++++++
32 8 files changed, 231 insertions(+)
33 create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c
34 create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c
35 create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c
36 create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c
37 create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c
38 create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c
39 create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c
40 create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c
41
42diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c
43--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c 1969-12-31 16:00:00.000000000 -0800
44+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c 2021-11-15 02:30:37.210637445 -0800
45@@ -0,0 +1,31 @@
46+/* { dg-do compile } */
47+/* { dg-options "-mcmse -mfloat-abi=soft -mfix-cmse-cve-2021-35465" } */
48+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */
49+
50+#include "../../../cmse-13.x"
51+
52+/* Checks for saving and clearing prior to function call. */
53+/* Shift on the same register as blxns. */
54+/* { dg-final { scan-assembler "lsrs\t(r\[1,4-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
55+/* { dg-final { scan-assembler "lsls\t(r\[1,4-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
56+/* { dg-final { scan-assembler-not "mov\tr0, r4" } } */
57+/* { dg-final { scan-assembler-not "mov\tr2, r4" } } */
58+/* { dg-final { scan-assembler-not "mov\tr3, r4" } } */
59+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
60+/* { dg-final { scan-assembler "vlstm\tsp" } } */
61+/* Check the right registers are cleared and none appears twice. */
62+/* { dg-final { scan-assembler "clrm\t\{(r1, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
63+/* Check that the right number of registers is cleared and thus only one
64+ register is missing. */
65+/* { dg-final { scan-assembler "clrm\t\{((r\[1,4-9\]|r10|fp|ip), ){9}APSR\}" } } */
66+/* Check that no cleared register is used for blxns. */
67+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[1,4-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
68+/* Check for v8.1-m variant of erratum work-around. */
69+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
70+/* { dg-final { scan-assembler "vlldm\tsp" } } */
71+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
72+/* { dg-final { scan-assembler-not "vmov" } } */
73+/* { dg-final { scan-assembler-not "vmsr" } } */
74+
75+/* Now we check that we use the correct intrinsic to call. */
76+/* { dg-final { scan-assembler "blxns" } } */
77diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c
78--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c 1969-12-31 16:00:00.000000000 -0800
79+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c 2021-11-15 02:30:37.210637445 -0800
80@@ -0,0 +1,28 @@
81+/* { dg-do compile } */
82+/* { dg-options "-mcmse -mfloat-abi=soft -mfix-cmse-cve-2021-35465" } */
83+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */
84+
85+#include "../../../cmse-7.x"
86+
87+/* Checks for saving and clearing prior to function call. */
88+/* Shift on the same register as blxns. */
89+/* { dg-final { scan-assembler "lsrs\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
90+/* { dg-final { scan-assembler "lsls\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
91+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
92+/* { dg-final { scan-assembler "vlstm\tsp" } } */
93+/* Check the right registers are cleared and none appears twice. */
94+/* { dg-final { scan-assembler "clrm\t\{(r0, )?(r1, )?(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
95+/* Check that the right number of registers is cleared and thus only one
96+ register is missing. */
97+/* { dg-final { scan-assembler "clrm\t\{((r\[0-9\]|r10|fp|ip), ){12}APSR\}" } } */
98+/* Check that no cleared register is used for blxns. */
99+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[0-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
100+/* Check for v8.1-m variant of erratum work-around. */
101+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
102+/* { dg-final { scan-assembler "vlldm\tsp" } } */
103+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
104+/* { dg-final { scan-assembler-not "vmov" } } */
105+/* { dg-final { scan-assembler-not "vmsr" } } */
106+
107+/* Now we check that we use the correct intrinsic to call. */
108+/* { dg-final { scan-assembler "blxns" } } */
109diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c
110--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c 1969-12-31 16:00:00.000000000 -0800
111+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c 2021-11-15 02:30:37.210637445 -0800
112@@ -0,0 +1,30 @@
113+/* { dg-do compile } */
114+/* { dg-options "-mcmse -mfloat-abi=soft -mfix-cmse-cve-2021-35465" } */
115+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */
116+
117+#include "../../../cmse-8.x"
118+
119+/* Checks for saving and clearing prior to function call. */
120+/* Shift on the same register as blxns. */
121+/* { dg-final { scan-assembler "lsrs\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
122+/* { dg-final { scan-assembler "lsls\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
123+/* { dg-final { scan-assembler-not "mov\tr0, r4" } } */
124+/* { dg-final { scan-assembler-not "mov\tr1, r4" } } */
125+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
126+/* { dg-final { scan-assembler "vlstm\tsp" } } */
127+/* Check the right registers are cleared and none appears twice. */
128+/* { dg-final { scan-assembler "clrm\t\{(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
129+/* Check that the right number of registers is cleared and thus only one
130+ register is missing. */
131+/* { dg-final { scan-assembler "clrm\t\{((r\[2-9\]|r10|fp|ip), ){10}APSR\}" } } */
132+/* Check that no cleared register is used for blxns. */
133+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[2-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
134+/* Check for v8.1-m variant of erratum work-around. */
135+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
136+/* { dg-final { scan-assembler "vlldm\tsp" } } */
137+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
138+/* { dg-final { scan-assembler-not "vmov" } } */
139+/* { dg-final { scan-assembler-not "vmsr" } } */
140+
141+/* Now we check that we use the correct intrinsic to call. */
142+/* { dg-final { scan-assembler "blxns" } } */
143diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c
144--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c 1969-12-31 16:00:00.000000000 -0800
145+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c 2021-11-15 02:30:37.210637445 -0800
146@@ -0,0 +1,30 @@
147+/* { dg-do compile } */
148+/* { dg-options "-mcmse -mfloat-abi=softfp -mfpu=fpv5-d16 -mfix-cmse-cve-2021-35465" } */
149+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=softfp" } } */
150+/* { dg-skip-if "Skip these if testing single precision" {*-*-*} {"-mfpu=*-sp-*"} {""} } */
151+
152+#include "../../../cmse-13.x"
153+
154+/* Checks for saving and clearing prior to function call. */
155+/* Shift on the same register as blxns. */
156+/* { dg-final { scan-assembler "lsrs\t(r\[1,4-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
157+/* { dg-final { scan-assembler "lsls\t(r\[1,4-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
158+/* { dg-final { scan-assembler-not "mov\tr0, r4" } } */
159+/* { dg-final { scan-assembler-not "mov\tr2, r4" } } */
160+/* { dg-final { scan-assembler-not "mov\tr3, r4" } } */
161+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
162+/* { dg-final { scan-assembler "vlstm\tsp" } } */
163+/* Check the right registers are cleared and none appears twice. */
164+/* { dg-final { scan-assembler "clrm\t\{(r1, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
165+/* Check that the right number of registers is cleared and thus only one
166+ register is missing. */
167+/* { dg-final { scan-assembler "clrm\t\{((r\[1,4-9\]|r10|fp|ip), ){9}APSR\}" } } */
168+/* Check that no cleared register is used for blxns. */
169+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[1,4-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
170+/* Check for v8.1-m variant of erratum work-around. */
171+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
172+/* { dg-final { scan-assembler "vlldm\tsp" } } */
173+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
174+
175+/* Now we check that we use the correct intrinsic to call. */
176+/* { dg-final { scan-assembler "blxns" } } */
177diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c
178--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c 1969-12-31 16:00:00.000000000 -0800
179+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c 2021-11-15 02:30:37.210637445 -0800
180@@ -0,0 +1,27 @@
181+/* { dg-do compile } */
182+/* { dg-options "-mcmse -mfloat-abi=softfp -mfpu=fpv5-d16 -mfix-cmse-cve-2021-35465" } */
183+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=softfp" } } */
184+/* { dg-skip-if "Skip these if testing single precision" {*-*-*} {"-mfpu=*-sp-*"} {""} } */
185+
186+#include "../../../cmse-7.x"
187+
188+/* Checks for saving and clearing prior to function call. */
189+/* Shift on the same register as blxns. */
190+/* { dg-final { scan-assembler "lsrs\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
191+/* { dg-final { scan-assembler "lsls\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
192+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
193+/* { dg-final { scan-assembler "vlstm\tsp" } } */
194+/* Check the right registers are cleared and none appears twice. */
195+/* { dg-final { scan-assembler "clrm\t\{(r0, )?(r1, )?(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
196+/* Check that the right number of registers is cleared and thus only one
197+ register is missing. */
198+/* { dg-final { scan-assembler "clrm\t\{((r\[0-9\]|r10|fp|ip), ){12}APSR\}" } } */
199+/* Check that no cleared register is used for blxns. */
200+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[0-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
201+/* Check for v8.1-m variant of erratum work-around. */
202+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
203+/* { dg-final { scan-assembler "vlldm\tsp" } } */
204+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
205+
206+/* Now we check that we use the correct intrinsic to call. */
207+/* { dg-final { scan-assembler "blxns" } } */
208diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c
209--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c 1969-12-31 16:00:00.000000000 -0800
210+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c 2021-11-15 02:30:37.210637445 -0800
211@@ -0,0 +1,29 @@
212+/* { dg-do compile } */
213+/* { dg-options "-mcmse -mfloat-abi=softfp -mfpu=fpv5-d16 -mfix-cmse-cve-2021-35465" } */
214+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=softfp" } } */
215+/* { dg-skip-if "Skip these if testing single precision" {*-*-*} {"-mfpu=*-sp-*"} {""} } */
216+
217+#include "../../../cmse-8.x"
218+
219+/* Checks for saving and clearing prior to function call. */
220+/* Shift on the same register as blxns. */
221+/* { dg-final { scan-assembler "lsrs\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
222+/* { dg-final { scan-assembler "lsls\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
223+/* { dg-final { scan-assembler-not "mov\tr0, r4" } } */
224+/* { dg-final { scan-assembler-not "mov\tr1, r4" } } */
225+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
226+/* { dg-final { scan-assembler "vlstm\tsp" } } */
227+/* Check the right registers are cleared and none appears twice. */
228+/* { dg-final { scan-assembler "clrm\t\{(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
229+/* Check that the right number of registers is cleared and thus only one
230+ register is missing. */
231+/* { dg-final { scan-assembler "clrm\t\{((r\[2-9\]|r10|fp|ip), ){10}APSR\}" } } */
232+/* Check that no cleared register is used for blxns. */
233+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[2-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
234+/* Check for v8.1-m variant of erratum work-around. */
235+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
236+/* { dg-final { scan-assembler "vlldm\tsp" } } */
237+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
238+
239+/* Now we check that we use the correct intrinsic to call. */
240+/* { dg-final { scan-assembler "blxns" } } */
241diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c
242--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c 1969-12-31 16:00:00.000000000 -0800
243+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c 2021-11-15 02:30:37.210637445 -0800
244@@ -0,0 +1,27 @@
245+/* { dg-do compile } */
246+/* { dg-options "-mcmse -mfloat-abi=softfp -mfpu=fpv5-sp-d16 -mfix-cmse-cve-2021-35465" } */
247+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=softfp" } } */
248+/* { dg-skip-if "Skip these if testing double precision" {*-*-*} {"-mfpu=fpv[4-5]-d16"} {""} } */
249+
250+#include "../../../cmse-7.x"
251+
252+/* Checks for saving and clearing prior to function call. */
253+/* Shift on the same register as blxns. */
254+/* { dg-final { scan-assembler "lsrs\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
255+/* { dg-final { scan-assembler "lsls\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
256+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
257+/* { dg-final { scan-assembler "vlstm\tsp" } } */
258+/* Check the right registers are cleared and none appears twice. */
259+/* { dg-final { scan-assembler "clrm\t\{(r0, )?(r1, )?(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
260+/* Check that the right number of registers is cleared and thus only one
261+ register is missing. */
262+/* { dg-final { scan-assembler "clrm\t\{((r\[0-9\]|r10|fp|ip), ){12}APSR\}" } } */
263+/* Check that no cleared register is used for blxns. */
264+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[0-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
265+/* Check for v8.1-m variant of erratum work-around. */
266+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
267+/* { dg-final { scan-assembler "vlldm\tsp" } } */
268+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
269+
270+/* Now we check that we use the correct intrinsic to call. */
271+/* { dg-final { scan-assembler "blxns" } } */
272diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c
273--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c 1969-12-31 16:00:00.000000000 -0800
274+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c 2021-11-15 02:30:37.210637445 -0800
275@@ -0,0 +1,29 @@
276+/* { dg-do compile } */
277+/* { dg-options "-mcmse -mfloat-abi=softfp -mfpu=fpv5-sp-d16 -mfix-cmse-cve-2021-35465" } */
278+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=softfp" } } */
279+/* { dg-skip-if "Skip these if testing double precision" {*-*-*} {"-mfpu=fpv[4-5]-d16"} {""} } */
280+
281+#include "../../../cmse-8.x"
282+
283+/* Checks for saving and clearing prior to function call. */
284+/* Shift on the same register as blxns. */
285+/* { dg-final { scan-assembler "lsrs\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
286+/* { dg-final { scan-assembler "lsls\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
287+/* { dg-final { scan-assembler-not "mov\tr0, r4" } } */
288+/* { dg-final { scan-assembler-not "mov\tr1, r4" } } */
289+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
290+/* { dg-final { scan-assembler "vlstm\tsp" } } */
291+/* Check the right registers are cleared and none appears twice. */
292+/* { dg-final { scan-assembler "clrm\t\{(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
293+/* Check that the right number of registers is cleared and thus only one
294+ register is missing. */
295+/* { dg-final { scan-assembler "clrm\t\{((r\[2-9\]|r10|fp|ip), ){10}APSR\}" } } */
296+/* Check that no cleared register is used for blxns. */
297+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[2-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
298+/* Check for v8.1-m variant of erratum work-around. */
299+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
300+/* { dg-final { scan-assembler "vlldm\tsp" } } */
301+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
302+
303+/* Now we check that we use the correct intrinsic to call. */
304+/* { dg-final { scan-assembler "blxns" } } */
diff --git a/meta/recipes-devtools/gcc/gcc/0004-CVE-2021-42574.patch b/meta/recipes-devtools/gcc/gcc/0004-CVE-2021-42574.patch
new file mode 100644
index 0000000000..4999c71b64
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc/0004-CVE-2021-42574.patch
@@ -0,0 +1,573 @@
1From bef32d4a28595e933f24fef378cf052a30b674a7 Mon Sep 17 00:00:00 2001
2From: David Malcolm <dmalcolm@redhat.com>
3Date: Tue, 2 Nov 2021 15:45:22 -0400
4Subject: [PATCH] libcpp: capture and underline ranges in -Wbidi-chars=
5 [PR103026]
6MIME-Version: 1.0
7Content-Type: text/plain; charset=utf8
8Content-Transfer-Encoding: 8bit
9
10This patch converts the bidi::vec to use a struct so that we can
11capture location_t values for the bidirectional control characters.
12
13Before:
14
15 Wbidi-chars-1.c: In function âmainâ:
16 Wbidi-chars-1.c:6:43: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
17 6 | /*<U+202E> } <U+2066>if (isAdmin)<U+2069> <U+2066> begin admins only */
18 | ^
19 Wbidi-chars-1.c:9:28: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
20 9 | /* end admins only <U+202E> { <U+2066>*/
21 | ^
22
23After:
24
25 Wbidi-chars-1.c: In function âmainâ:
26 Wbidi-chars-1.c:6:43: warning: unpaired UTF-8 bidirectional control characters detected [-Wbidi-chars=]
27 6 | /*<U+202E> } <U+2066>if (isAdmin)<U+2069> <U+2066> begin admins only */
28 | ~~~~~~~~ ~~~~~~~~ ^
29 | | | |
30 | | | end of bidirectional context
31 | U+202E (RIGHT-TO-LEFT OVERRIDE) U+2066 (LEFT-TO-RIGHT ISOLATE)
32 Wbidi-chars-1.c:9:28: warning: unpaired UTF-8 bidirectional control characters detected [-Wbidi-chars=]
33 9 | /* end admins only <U+202E> { <U+2066>*/
34 | ~~~~~~~~ ~~~~~~~~ ^
35 | | | |
36 | | | end of bidirectional context
37 | | U+2066 (LEFT-TO-RIGHT ISOLATE)
38 | U+202E (RIGHT-TO-LEFT OVERRIDE)
39
40Signed-off-by: David Malcolm <dmalcolm@redhat.com>
41
42gcc/testsuite/ChangeLog:
43 PR preprocessor/103026
44 * c-c++-common/Wbidi-chars-ranges.c: New test.
45
46libcpp/ChangeLog:
47 PR preprocessor/103026
48 * lex.c (struct bidi::context): New.
49 (bidi::vec): Convert to a vec of context rather than unsigned
50 char.
51 (bidi::ctx_at): Rename to...
52 (bidi::pop_kind_at): ...this and reimplement for above change.
53 (bidi::current_ctx): Update for change to vec.
54 (bidi::current_ctx_ucn_p): Likewise.
55 (bidi::current_ctx_loc): New.
56 (bidi::on_char): Update for usage of context struct. Add "loc"
57 param and pass it when pushing contexts.
58 (get_location_for_byte_range_in_cur_line): New.
59 (get_bidi_utf8): Rename to...
60 (get_bidi_utf8_1): ...this, reintroducing...
61 (get_bidi_utf8): ...as a wrapper, setting *OUT when the result is
62 not NONE.
63 (get_bidi_ucn): Rename to...
64 (get_bidi_ucn_1): ...this, reintroducing...
65 (get_bidi_ucn): ...as a wrapper, setting *OUT when the result is
66 not NONE.
67 (class unpaired_bidi_rich_location): New.
68 (maybe_warn_bidi_on_close): Use unpaired_bidi_rich_location when
69 reporting on unpaired bidi chars. Split into singular vs plural
70 spellings.
71 (maybe_warn_bidi_on_char): Pass in a location_t rather than a
72 const uchar * and use it when emitting warnings, and when calling
73 bidi::on_char.
74 (_cpp_skip_block_comment): Capture location when kind is not NONE
75 and pass it to maybe_warn_bidi_on_char.
76 (skip_line_comment): Likewise.
77 (forms_identifier_p): Likewise.
78 (lex_raw_string): Likewise.
79 (lex_string): Likewise.
80
81Signed-off-by: David Malcolm <dmalcolm@redhat.com>
82
83CVE: CVE-2021-42574
84Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=bef32d4a28595e933f24fef378cf052a30b674a7]
85Signed-off-by: Pgowda <pgowda.cve@gmail.com>
86
87---
88 .../c-c++-common/Wbidi-chars-ranges.c | 54 ++++
89 libcpp/lex.c | 251 ++++++++++++++----
90 2 files changed, 257 insertions(+), 48 deletions(-)
91 create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-ranges.c
92
93diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-ranges.c b/gcc/testsuite/c-c++-common/Wbidi-chars-ranges.c
94new file mode 100644
95index 00000000000..298750a2a64
96--- /dev/null
97+++ b/gcc/testsuite/c-c++-common/Wbidi-chars-ranges.c
98@@ -0,0 +1,54 @@
99+/* PR preprocessor/103026 */
100+/* { dg-do compile } */
101+/* { dg-options "-Wbidi-chars=unpaired -fdiagnostics-show-caret" } */
102+/* Verify that we escape and underline pertinent bidirectional
103+ control characters when quoting the source. */
104+
105+int test_unpaired_bidi () {
106+ int isAdmin = 0;
107+ /*â® } â¦if (isAdmin)⩠⦠begin admins only */
108+/* { dg-warning "bidirectional" "" { target *-*-* } .-1 } */
109+#if 0
110+ { dg-begin-multiline-output "" }
111+ /*<U+202E> } <U+2066>if (isAdmin)<U+2069> <U+2066> begin admins only */
112+ ~~~~~~~~ ~~~~~~~~ ^
113+ | | |
114+ | | end of bidirectional context
115+ U+202E (RIGHT-TO-LEFT OVERRIDE) U+2066 (LEFT-TO-RIGHT ISOLATE)
116+ { dg-end-multiline-output "" }
117+#endif
118+
119+ __builtin_printf("You are an admin.\n");
120+ /* end admins only â® { â¦*/
121+/* { dg-warning "bidirectional" "" { target *-*-* } .-1 } */
122+#if 0
123+ { dg-begin-multiline-output "" }
124+ /* end admins only <U+202E> { <U+2066>*/
125+ ~~~~~~~~ ~~~~~~~~ ^
126+ | | |
127+ | | end of bidirectional context
128+ | U+2066 (LEFT-TO-RIGHT ISOLATE)
129+ U+202E (RIGHT-TO-LEFT OVERRIDE)
130+ { dg-end-multiline-output "" }
131+#endif
132+
133+ return 0;
134+}
135+
136+int LRE_âª_PDF_\u202c;
137+/* { dg-warning "mismatch" "" { target *-*-* } .-1 } */
138+#if 0
139+ { dg-begin-multiline-output "" }
140+ int LRE_<U+202A>_PDF_\u202c;
141+ ~~~~~~~~ ^~~~~~
142+ { dg-end-multiline-output "" }
143+#endif
144+
145+const char *s1 = "LRE_âª_PDF_\u202c";
146+/* { dg-warning "mismatch" "" { target *-*-* } .-1 } */
147+#if 0
148+ { dg-begin-multiline-output "" }
149+ const char *s1 = "LRE_<U+202A>_PDF_\u202c";
150+ ~~~~~~~~ ^~~~~~
151+ { dg-end-multiline-output "" }
152+#endif
153diff --git a/libcpp/lex.c b/libcpp/lex.c
154index 2421d6c0f40..94c36f0d014 100644
155--- a/libcpp/lex.c
156+++ b/libcpp/lex.c
157@@ -1172,11 +1172,34 @@ namespace bidi {
158 /* All the UTF-8 encodings of bidi characters start with E2. */
159 constexpr uchar utf8_start = 0xe2;
160
161+ struct context
162+ {
163+ context () {}
164+ context (location_t loc, kind k, bool pdf, bool ucn)
165+ : m_loc (loc), m_kind (k), m_pdf (pdf), m_ucn (ucn)
166+ {
167+ }
168+
169+ kind get_pop_kind () const
170+ {
171+ return m_pdf ? kind::PDF : kind::PDI;
172+ }
173+ bool ucn_p () const
174+ {
175+ return m_ucn;
176+ }
177+
178+ location_t m_loc;
179+ kind m_kind;
180+ unsigned m_pdf : 1;
181+ unsigned m_ucn : 1;
182+ };
183+
184 /* A vector holding currently open bidi contexts. We use a char for
185 each context, its LSB is 1 if it represents a PDF context, 0 if it
186 represents a PDI context. The next bit is 1 if this context was open
187 by a bidi character written as a UCN, and 0 when it was UTF-8. */
188- semi_embedded_vec <unsigned char, 16> vec;
189+ semi_embedded_vec <context, 16> vec;
190
191 /* Close the whole comment/identifier/string literal/character constant
192 context. */
193@@ -1193,19 +1216,19 @@ namespace bidi {
194 vec.truncate (len - 1);
195 }
196
197- /* Return the context of the Ith element. */
198- kind ctx_at (unsigned int i)
199+ /* Return the pop kind of the context of the Ith element. */
200+ kind pop_kind_at (unsigned int i)
201 {
202- return (vec[i] & 1) ? kind::PDF : kind::PDI;
203+ return vec[i].get_pop_kind ();
204 }
205
206- /* Return which context is currently opened. */
207+ /* Return the pop kind of the context that is currently opened. */
208 kind current_ctx ()
209 {
210 unsigned int len = vec.count ();
211 if (len == 0)
212 return kind::NONE;
213- return ctx_at (len - 1);
214+ return vec[len - 1].get_pop_kind ();
215 }
216
217 /* Return true if the current context comes from a UCN origin, that is,
218@@ -1214,11 +1237,19 @@ namespace bidi {
219 {
220 unsigned int len = vec.count ();
221 gcc_checking_assert (len > 0);
222- return (vec[len - 1] >> 1) & 1;
223+ return vec[len - 1].m_ucn;
224 }
225
226- /* We've read a bidi char, update the current vector as necessary. */
227- void on_char (kind k, bool ucn_p)
228+ location_t current_ctx_loc ()
229+ {
230+ unsigned int len = vec.count ();
231+ gcc_checking_assert (len > 0);
232+ return vec[len - 1].m_loc;
233+ }
234+
235+ /* We've read a bidi char, update the current vector as necessary.
236+ LOC is only valid when K is not kind::NONE. */
237+ void on_char (kind k, bool ucn_p, location_t loc)
238 {
239 switch (k)
240 {
241@@ -1226,12 +1257,12 @@ namespace bidi {
242 case kind::RLE:
243 case kind::LRO:
244 case kind::RLO:
245- vec.push (ucn_p ? 3u : 1u);
246+ vec.push (context (loc, k, true, ucn_p));
247 break;
248 case kind::LRI:
249 case kind::RLI:
250 case kind::FSI:
251- vec.push (ucn_p ? 2u : 0u);
252+ vec.push (context (loc, k, false, ucn_p));
253 break;
254 /* PDF terminates the scope of the last LRE, RLE, LRO, or RLO
255 whose scope has not yet been terminated. */
256@@ -1245,7 +1276,7 @@ namespace bidi {
257 yet been terminated. */
258 case kind::PDI:
259 for (int i = vec.count () - 1; i >= 0; --i)
260- if (ctx_at (i) == kind::PDI)
261+ if (pop_kind_at (i) == kind::PDI)
262 {
263 vec.truncate (i);
264 break;
265@@ -1295,10 +1326,47 @@ namespace bidi {
266 }
267 }
268
269+/* Get location_t for the range of bytes [START, START + NUM_BYTES)
270+ within the current line in FILE, with the caret at START. */
271+
272+static location_t
273+get_location_for_byte_range_in_cur_line (cpp_reader *pfile,
274+ const unsigned char *const start,
275+ size_t num_bytes)
276+{
277+ gcc_checking_assert (num_bytes > 0);
278+
279+ /* CPP_BUF_COLUMN and linemap_position_for_column both refer
280+ to offsets in bytes, but CPP_BUF_COLUMN is 0-based,
281+ whereas linemap_position_for_column is 1-based. */
282+
283+ /* Get 0-based offsets within the line. */
284+ size_t start_offset = CPP_BUF_COLUMN (pfile->buffer, start);
285+ size_t end_offset = start_offset + num_bytes - 1;
286+
287+ /* Now convert to location_t, where "columns" are 1-based byte offsets. */
288+ location_t start_loc = linemap_position_for_column (pfile->line_table,
289+ start_offset + 1);
290+ location_t end_loc = linemap_position_for_column (pfile->line_table,
291+ end_offset + 1);
292+
293+ if (start_loc == end_loc)
294+ return start_loc;
295+
296+ source_range src_range;
297+ src_range.m_start = start_loc;
298+ src_range.m_finish = end_loc;
299+ location_t combined_loc = COMBINE_LOCATION_DATA (pfile->line_table,
300+ start_loc,
301+ src_range,
302+ NULL);
303+ return combined_loc;
304+}
305+
306 /* Parse a sequence of 3 bytes starting with P and return its bidi code. */
307
308 static bidi::kind
309-get_bidi_utf8 (const unsigned char *const p)
310+get_bidi_utf8_1 (const unsigned char *const p)
311 {
312 gcc_checking_assert (p[0] == bidi::utf8_start);
313
314@@ -1340,10 +1408,25 @@ get_bidi_utf8 (const unsigned char *cons
315 return bidi::kind::NONE;
316 }
317
318+/* Parse a sequence of 3 bytes starting with P and return its bidi code.
319+ If the kind is not NONE, write the location to *OUT.*/
320+
321+static bidi::kind
322+get_bidi_utf8 (cpp_reader *pfile, const unsigned char *const p, location_t *out)
323+{
324+ bidi::kind result = get_bidi_utf8_1 (p);
325+ if (result != bidi::kind::NONE)
326+ {
327+ /* We have a sequence of 3 bytes starting at P. */
328+ *out = get_location_for_byte_range_in_cur_line (pfile, p, 3);
329+ }
330+ return result;
331+}
332+
333 /* Parse a UCN where P points just past \u or \U and return its bidi code. */
334
335 static bidi::kind
336-get_bidi_ucn (const unsigned char *p, bool is_U)
337+get_bidi_ucn_1 (const unsigned char *p, bool is_U)
338 {
339 /* 6.4.3 Universal Character Names
340 \u hex-quad
341@@ -1412,6 +1495,62 @@ get_bidi_ucn (const unsigned char *p, bo
342 return bidi::kind::NONE;
343 }
344
345+/* Parse a UCN where P points just past \u or \U and return its bidi code.
346+ If the kind is not NONE, write the location to *OUT.*/
347+
348+static bidi::kind
349+get_bidi_ucn (cpp_reader *pfile, const unsigned char *p, bool is_U,
350+ location_t *out)
351+{
352+ bidi::kind result = get_bidi_ucn_1 (p, is_U);
353+ if (result != bidi::kind::NONE)
354+ {
355+ const unsigned char *start = p - 2;
356+ size_t num_bytes = 2 + (is_U ? 8 : 4);
357+ *out = get_location_for_byte_range_in_cur_line (pfile, start, num_bytes);
358+ }
359+ return result;
360+}
361+
362+/* Subclass of rich_location for reporting on unpaired UTF-8
363+ bidirectional control character(s).
364+ Escape the source lines on output, and show all unclosed
365+ bidi context, labelling everything. */
366+
367+class unpaired_bidi_rich_location : public rich_location
368+{
369+ public:
370+ class custom_range_label : public range_label
371+ {
372+ public:
373+ label_text get_text (unsigned range_idx) const FINAL OVERRIDE
374+ {
375+ /* range 0 is the primary location; each subsequent range i + 1
376+ is for bidi::vec[i]. */
377+ if (range_idx > 0)
378+ {
379+ const bidi::context &ctxt (bidi::vec[range_idx - 1]);
380+ return label_text::borrow (bidi::to_str (ctxt.m_kind));
381+ }
382+ else
383+ return label_text::borrow (_("end of bidirectional context"));
384+ }
385+ };
386+
387+ unpaired_bidi_rich_location (cpp_reader *pfile, location_t loc)
388+ : rich_location (pfile->line_table, loc, &m_custom_label)
389+ {
390+ set_escape_on_output (true);
391+ for (unsigned i = 0; i < bidi::vec.count (); i++)
392+ add_range (bidi::vec[i].m_loc,
393+ SHOW_RANGE_WITHOUT_CARET,
394+ &m_custom_label);
395+ }
396+
397+ private:
398+ custom_range_label m_custom_label;
399+};
400+
401 /* We're closing a bidi context, that is, we've encountered a newline,
402 are closing a C-style comment, or are at the end of a string literal,
403 character constant, or identifier. Warn if this context was not
404@@ -1427,11 +1566,17 @@ maybe_warn_bidi_on_close (cpp_reader *pf
405 const location_t loc
406 = linemap_position_for_column (pfile->line_table,
407 CPP_BUF_COLUMN (pfile->buffer, p));
408- rich_location rich_loc (pfile->line_table, loc);
409- rich_loc.set_escape_on_output (true);
410- cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
411- "unpaired UTF-8 bidirectional control character "
412- "detected");
413+ unpaired_bidi_rich_location rich_loc (pfile, loc);
414+ /* cpp_callbacks doesn't yet have a way to handle singular vs plural
415+ forms of a diagnostic, so fake it for now. */
416+ if (bidi::vec.count () > 1)
417+ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
418+ "unpaired UTF-8 bidirectional control characters "
419+ "detected");
420+ else
421+ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
422+ "unpaired UTF-8 bidirectional control character "
423+ "detected");
424 }
425 /* We're done with this context. */
426 bidi::on_close ();
427@@ -1439,12 +1584,13 @@ maybe_warn_bidi_on_close (cpp_reader *pf
428
429 /* We're at the beginning or in the middle of an identifier/comment/string
430 literal/character constant. Warn if we've encountered a bidi character.
431- KIND says which bidi character it was; P points to it in the character
432- stream. UCN_P is true iff this bidi character was written as a UCN. */
433+ KIND says which bidi control character it was; UCN_P is true iff this bidi
434+ control character was written as a UCN. LOC is the location of the
435+ character, but is only valid if KIND != bidi::kind::NONE. */
436
437 static void
438-maybe_warn_bidi_on_char (cpp_reader *pfile, const uchar *p, bidi::kind kind,
439- bool ucn_p)
440+maybe_warn_bidi_on_char (cpp_reader *pfile, bidi::kind kind,
441+ bool ucn_p, location_t loc)
442 {
443 if (__builtin_expect (kind == bidi::kind::NONE, 1))
444 return;
445@@ -1453,9 +1599,6 @@ maybe_warn_bidi_on_char (cpp_reader *pfi
446
447 if (warn_bidi != bidirectional_none)
448 {
449- const location_t loc
450- = linemap_position_for_column (pfile->line_table,
451- CPP_BUF_COLUMN (pfile->buffer, p));
452 rich_location rich_loc (pfile->line_table, loc);
453 rich_loc.set_escape_on_output (true);
454
455@@ -1467,9 +1610,12 @@ maybe_warn_bidi_on_char (cpp_reader *pfi
456 {
457 if (warn_bidi == bidirectional_unpaired
458 && bidi::current_ctx_ucn_p () != ucn_p)
459- cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
460- "UTF-8 vs UCN mismatch when closing "
461- "a context by \"%s\"", bidi::to_str (kind));
462+ {
463+ rich_loc.add_range (bidi::current_ctx_loc ());
464+ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
465+ "UTF-8 vs UCN mismatch when closing "
466+ "a context by \"%s\"", bidi::to_str (kind));
467+ }
468 }
469 else if (warn_bidi == bidirectional_any)
470 {
471@@ -1484,7 +1630,7 @@ maybe_warn_bidi_on_char (cpp_reader *pfi
472 }
473 }
474 /* We're done with this context. */
475- bidi::on_char (kind, ucn_p);
476+ bidi::on_char (kind, ucn_p, loc);
477 }
478
479 /* Skip a C-style block comment. We find the end of the comment by
480@@ -1552,8 +1698,9 @@ _cpp_skip_block_comment (cpp_reader *pfi
481 a bidirectional control character. */
482 else if (__builtin_expect (c == bidi::utf8_start, 0) && warn_bidi_p)
483 {
484- bidi::kind kind = get_bidi_utf8 (cur - 1);
485- maybe_warn_bidi_on_char (pfile, cur, kind, /*ucn_p=*/false);
486+ location_t loc;
487+ bidi::kind kind = get_bidi_utf8 (pfile, cur - 1, &loc);
488+ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/false, loc);
489 }
490 }
491
492@@ -1586,9 +1733,9 @@ skip_line_comment (cpp_reader *pfile)
493 {
494 if (__builtin_expect (*buffer->cur == bidi::utf8_start, 0))
495 {
496- bidi::kind kind = get_bidi_utf8 (buffer->cur);
497- maybe_warn_bidi_on_char (pfile, buffer->cur, kind,
498- /*ucn_p=*/false);
499+ location_t loc;
500+ bidi::kind kind = get_bidi_utf8 (pfile, buffer->cur, &loc);
501+ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/false, loc);
502 }
503 buffer->cur++;
504 }
505@@ -1708,9 +1855,9 @@ forms_identifier_p (cpp_reader *pfile, i
506 if (__builtin_expect (*buffer->cur == bidi::utf8_start, 0)
507 && warn_bidi_p)
508 {
509- bidi::kind kind = get_bidi_utf8 (buffer->cur);
510- maybe_warn_bidi_on_char (pfile, buffer->cur, kind,
511- /*ucn_p=*/false);
512+ location_t loc;
513+ bidi::kind kind = get_bidi_utf8 (pfile, buffer->cur, &loc);
514+ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/false, loc);
515 }
516 if (_cpp_valid_utf8 (pfile, &buffer->cur, buffer->rlimit, 1 + !first,
517 state, &s))
518@@ -1722,10 +1869,12 @@ forms_identifier_p (cpp_reader *pfile, i
519 buffer->cur += 2;
520 if (warn_bidi_p)
521 {
522- bidi::kind kind = get_bidi_ucn (buffer->cur,
523- buffer->cur[-1] == 'U');
524- maybe_warn_bidi_on_char (pfile, buffer->cur, kind,
525- /*ucn_p=*/true);
526+ location_t loc;
527+ bidi::kind kind = get_bidi_ucn (pfile,
528+ buffer->cur,
529+ buffer->cur[-1] == 'U',
530+ &loc);
531+ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/true, loc);
532 }
533 if (_cpp_valid_ucn (pfile, &buffer->cur, buffer->rlimit, 1 + !first,
534 state, &s, NULL, NULL))
535@@ -2336,8 +2485,11 @@ lex_raw_string (cpp_reader *pfile, cpp_t
536 }
537 else if (__builtin_expect ((unsigned char) c == bidi::utf8_start, 0)
538 && warn_bidi_p)
539- maybe_warn_bidi_on_char (pfile, pos - 1, get_bidi_utf8 (pos - 1),
540- /*ucn_p=*/false);
541+ {
542+ location_t loc;
543+ bidi::kind kind = get_bidi_utf8 (pfile, pos - 1, &loc);
544+ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/false, loc);
545+ }
546 }
547
548 if (warn_bidi_p)
549@@ -2447,8 +2599,10 @@ lex_string (cpp_reader *pfile, cpp_token
550 {
551 if ((cur[0] == 'u' || cur[0] == 'U') && warn_bidi_p)
552 {
553- bidi::kind kind = get_bidi_ucn (cur + 1, cur[0] == 'U');
554- maybe_warn_bidi_on_char (pfile, cur, kind, /*ucn_p=*/true);
555+ location_t loc;
556+ bidi::kind kind = get_bidi_ucn (pfile, cur + 1, cur[0] == 'U',
557+ &loc);
558+ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/true, loc);
559 }
560 cur++;
561 }
562@@ -2476,8 +2630,9 @@ lex_string (cpp_reader *pfile, cpp_token
563 saw_NUL = true;
564 else if (__builtin_expect (c == bidi::utf8_start, 0) && warn_bidi_p)
565 {
566- bidi::kind kind = get_bidi_utf8 (cur - 1);
567- maybe_warn_bidi_on_char (pfile, cur - 1, kind, /*ucn_p=*/false);
568+ location_t loc;
569+ bidi::kind kind = get_bidi_utf8 (pfile, cur - 1, &loc);
570+ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/false, loc);
571 }
572 }
573
diff --git a/meta/recipes-devtools/gnu-config/gnu-config_git.bb b/meta/recipes-devtools/gnu-config/gnu-config_git.bb
index 794e39546c..f4bc752d9f 100644
--- a/meta/recipes-devtools/gnu-config/gnu-config_git.bb
+++ b/meta/recipes-devtools/gnu-config/gnu-config_git.bb
@@ -12,7 +12,7 @@ INHIBIT_DEFAULT_DEPS = "1"
12SRCREV = "805517123cbfe33d17c989a18e78c5789fab0437" 12SRCREV = "805517123cbfe33d17c989a18e78c5789fab0437"
13PV = "20210722+git${SRCPV}" 13PV = "20210722+git${SRCPV}"
14 14
15SRC_URI = "git://git.savannah.gnu.org/config.git;branch=master \ 15SRC_URI = "git://git.savannah.gnu.org/git/config.git;protocol=https;branch=master \
16 file://gnu-configize.in" 16 file://gnu-configize.in"
17S = "${WORKDIR}/git" 17S = "${WORKDIR}/git"
18UPSTREAM_CHECK_COMMITS = "1" 18UPSTREAM_CHECK_COMMITS = "1"
diff --git a/meta/recipes-devtools/go/go-1.16.8.inc b/meta/recipes-devtools/go/go-1.16.15.inc
index 925bf46965..50772346df 100644
--- a/meta/recipes-devtools/go/go-1.16.8.inc
+++ b/meta/recipes-devtools/go/go-1.16.15.inc
@@ -1,7 +1,7 @@
1require go-common.inc 1require go-common.inc
2 2
3GO_BASEVERSION = "1.16" 3GO_BASEVERSION = "1.16"
4PV = "1.16.8" 4PV = "1.16.15"
5FILESEXTRAPATHS:prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:" 5FILESEXTRAPATHS:prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:"
6 6
7LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707" 7LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
@@ -17,7 +17,7 @@ SRC_URI += "\
17 file://0008-use-GOBUILDMODE-to-set-buildmode.patch \ 17 file://0008-use-GOBUILDMODE-to-set-buildmode.patch \
18 file://0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch \ 18 file://0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch \
19" 19"
20SRC_URI[main.sha256sum] = "8f2a8c24b793375b3243df82fdb0c8387486dcc8a892ca1c991aa99ace086b98" 20SRC_URI[main.sha256sum] = "90a08c689279e35f3865ba510998c33a63255c36089b3ec206c912fc0568c3d3"
21 21
22# Upstream don't believe it is a signifiant real world issue and will only 22# Upstream don't believe it is a signifiant real world issue and will only
23# fix in 1.17 onwards where we can drop this. 23# fix in 1.17 onwards where we can drop this.
diff --git a/meta/recipes-devtools/go/go-binary-native_1.16.8.bb b/meta/recipes-devtools/go/go-binary-native_1.16.15.bb
index 926222089d..ba11ee5695 100644
--- a/meta/recipes-devtools/go/go-binary-native_1.16.8.bb
+++ b/meta/recipes-devtools/go/go-binary-native_1.16.15.bb
@@ -8,8 +8,8 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
8PROVIDES = "go-native" 8PROVIDES = "go-native"
9 9
10SRC_URI = "https://dl.google.com/go/go${PV}.${BUILD_GOOS}-${BUILD_GOARCH}.tar.gz;name=go_${BUILD_GOTUPLE}" 10SRC_URI = "https://dl.google.com/go/go${PV}.${BUILD_GOOS}-${BUILD_GOARCH}.tar.gz;name=go_${BUILD_GOTUPLE}"
11SRC_URI[go_linux_amd64.sha256sum] = "f32501aeb8b7b723bc7215f6c373abb6981bbc7e1c7b44e9f07317e1a300dce2" 11SRC_URI[go_linux_amd64.sha256sum] = "77c782a633186d78c384f972fb113a43c24be0234c42fef22c2d8c4c4c8e7475"
12SRC_URI[go_linux_arm64.sha256sum] = "430dbe185417204f6788913197ab3b189b6deae9c9b524f262858e53dab239c2" 12SRC_URI[go_linux_arm64.sha256sum] = "c2f27f0ce5620a9bc2ff3446165d1974ef94e9b885ec12dbfa3c07e0e198b7ce"
13 13
14UPSTREAM_CHECK_URI = "https://golang.org/dl/" 14UPSTREAM_CHECK_URI = "https://golang.org/dl/"
15UPSTREAM_CHECK_REGEX = "go(?P<pver>\d+(\.\d+)+)\.linux" 15UPSTREAM_CHECK_REGEX = "go(?P<pver>\d+(\.\d+)+)\.linux"
diff --git a/meta/recipes-devtools/go/go-cross-canadian_1.16.8.bb b/meta/recipes-devtools/go/go-cross-canadian_1.16.15.bb
index 7ac9449e47..7ac9449e47 100644
--- a/meta/recipes-devtools/go/go-cross-canadian_1.16.8.bb
+++ b/meta/recipes-devtools/go/go-cross-canadian_1.16.15.bb
diff --git a/meta/recipes-devtools/go/go-cross_1.16.8.bb b/meta/recipes-devtools/go/go-cross_1.16.15.bb
index 80b5a03f6c..80b5a03f6c 100644
--- a/meta/recipes-devtools/go/go-cross_1.16.8.bb
+++ b/meta/recipes-devtools/go/go-cross_1.16.15.bb
diff --git a/meta/recipes-devtools/go/go-crosssdk_1.16.8.bb b/meta/recipes-devtools/go/go-crosssdk_1.16.15.bb
index 1857c8a577..1857c8a577 100644
--- a/meta/recipes-devtools/go/go-crosssdk_1.16.8.bb
+++ b/meta/recipes-devtools/go/go-crosssdk_1.16.15.bb
diff --git a/meta/recipes-devtools/go/go-native_1.16.8.bb b/meta/recipes-devtools/go/go-native_1.16.15.bb
index ffe4ef3523..ffe4ef3523 100644
--- a/meta/recipes-devtools/go/go-native_1.16.8.bb
+++ b/meta/recipes-devtools/go/go-native_1.16.15.bb
diff --git a/meta/recipes-devtools/go/go-runtime_1.16.8.bb b/meta/recipes-devtools/go/go-runtime_1.16.15.bb
index 63464a1501..63464a1501 100644
--- a/meta/recipes-devtools/go/go-runtime_1.16.8.bb
+++ b/meta/recipes-devtools/go/go-runtime_1.16.15.bb
diff --git a/meta/recipes-devtools/go/go_1.16.8.bb b/meta/recipes-devtools/go/go_1.16.15.bb
index 34dc89bb0c..34dc89bb0c 100644
--- a/meta/recipes-devtools/go/go_1.16.8.bb
+++ b/meta/recipes-devtools/go/go_1.16.15.bb
diff --git a/meta/recipes-devtools/libtool/libtool-2.4.6.inc b/meta/recipes-devtools/libtool/libtool-2.4.6.inc
index 7104c98c20..a636926ef9 100644
--- a/meta/recipes-devtools/libtool/libtool-2.4.6.inc
+++ b/meta/recipes-devtools/libtool/libtool-2.4.6.inc
@@ -9,22 +9,23 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
9 file://libltdl/COPYING.LIB;md5=4fbd65380cdd255951079008b364516c " 9 file://libltdl/COPYING.LIB;md5=4fbd65380cdd255951079008b364516c "
10 10
11SRC_URI = "${GNU_MIRROR}/libtool/libtool-${PV}.tar.gz \ 11SRC_URI = "${GNU_MIRROR}/libtool/libtool-${PV}.tar.gz \
12 file://trailingslash.patch \ 12 file://0001-ltmain.in-Handle-trailing-slashes-on-install-command.patch \
13 file://rename-with-sysroot.patch \ 13 file://0002-libtool.m4-Rename-the-with-sysroot-option-to-avoid-c.patch \
14 file://use-sysroot-in-libpath.patch \ 14 file://0003-ltmain.in-Add-missing-sysroot-to-library-path.patch \
15 file://fix-final-rpath.patch \ 15 file://0004-ltmain.sh-Fix-sysroot-paths-being-encoded-into-RPATH.patch \
16 file://fix-rpath.patch \ 16 file://0005-ltmain.in-Don-t-encode-RATHS-which-match-default-lin.patch \
17 file://norm-rpath.patch \
18 file://dont-depend-on-help2man.patch \ 17 file://dont-depend-on-help2man.patch \
19 file://fix-resolve-lt-sysroot.patch \ 18 file://0006-libtool.m4-Handle-as-a-sysroot-correctly.patch \
20 file://nohardcodepaths.patch \ 19 file://nohardcodepaths.patch \
21 file://unwind-opt-parsing.patch \ 20 file://unwind-opt-parsing.patch \
22 file://0001-libtool-Fix-support-for-NIOS2-processor.patch \ 21 file://0007-libtool-Fix-support-for-NIOS2-processor.patch \
23 file://0001-libtool-Check-for-static-libs-for-internal-compiler-.patch \ 22 file://0008-libtool-Check-for-static-libs-for-internal-compiler-.patch \
24 file://0001-Makefile.am-make-sure-autoheader-run-before-autoconf.patch \ 23 file://0009-Makefile.am-make-sure-autoheader-run-before-autoconf.patch \
25 file://0001-Makefile.am-make-sure-autoheader-run-before-automake.patch \ 24 file://0010-Makefile.am-make-sure-autoheader-run-before-automake.patch \
26 file://lto-prefix.patch \ 25 file://0011-ltmain.in-Handle-prefix-map-compiler-options-correct.patch \
27 file://debian-no_hostname.patch \ 26 file://0012-libtool.m4-For-reproducibility-stop-encoding-hostnam.patch \
27 file://libool.m4-add-ARFLAGS-variable.patch \
28 file://ARFLAGS-use-cr-instead-of-cru-by-default.patch \
28 " 29 "
29 30
30SRC_URI[md5sum] = "addf44b646ddb4e3919805aa88fa7c5e" 31SRC_URI[md5sum] = "addf44b646ddb4e3919805aa88fa7c5e"
diff --git a/meta/recipes-devtools/libtool/libtool/0001-ltmain.in-Handle-trailing-slashes-on-install-command.patch b/meta/recipes-devtools/libtool/libtool/0001-ltmain.in-Handle-trailing-slashes-on-install-command.patch
new file mode 100644
index 0000000000..eeb5ebf416
--- /dev/null
+++ b/meta/recipes-devtools/libtool/libtool/0001-ltmain.in-Handle-trailing-slashes-on-install-command.patch
@@ -0,0 +1,35 @@
1From: Richard Purdie <richard.purdie@linuxfoundation.org>
2Subject: [PATCH 01/12] ltmain.in: Handle trailing slashes on install commands correctly
3
4A command like:
5
6libtool --mode=install /usr/bin/install -c gck-roots-store-standalone.la '/image/usr/lib/gnome-keyring/standalone/'
7
8where the path ends with a trailing slash currently fails. This occurs in
9software like gnome-keyring or pulseaudio and is because the comparision
10code doesn't see the paths as equal. Strip both paths to ensure this works
11reliably.
12
13Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
14
15Upstream-Status: Submitted [https://lists.gnu.org/archive/html/libtool-patches/2021-10/msg00010.html]
16
17diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
18--- a/build-aux/ltmain.in
19+++ b/build-aux/ltmain.in
20@@ -2356,8 +2356,14 @@ func_mode_install ()
21 func_append dir "$objdir"
22
23 if test -n "$relink_command"; then
24+ # Strip any trailing slash from the destination.
25+ func_stripname '' '/' "$libdir"
26+ destlibdir=$func_stripname_result
27+ func_stripname '' '/' "$destdir"
28+ s_destdir=$func_stripname_result
29+
30 # Determine the prefix the user has applied to our future dir.
31- inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
32+ inst_prefix_dir=`$ECHO "X$s_destdir" | $Xsed -e "s%$destlibdir\$%%"`
33
34 # Don't allow the user to place us outside of our expected
35 # location b/c this prevents finding dependent libraries that
diff --git a/meta/recipes-devtools/libtool/libtool/rename-with-sysroot.patch b/meta/recipes-devtools/libtool/libtool/0002-libtool.m4-Rename-the-with-sysroot-option-to-avoid-c.patch
index ad2b110530..6da283959e 100644
--- a/meta/recipes-devtools/libtool/libtool/rename-with-sysroot.patch
+++ b/meta/recipes-devtools/libtool/libtool/0002-libtool.m4-Rename-the-with-sysroot-option-to-avoid-c.patch
@@ -1,16 +1,17 @@
1Upstream-Status: Pending 1From: Khem Raj <raj.khem@gmail.com>
2Subject: [PATCH 02/12] libtool.m4: Rename the --with-sysroot option to avoid conflict with gcc/binutils
2 3
3This patch renames the --with-sysroot option to --with-libtool-sysroot 4This patch renames the --with-sysroot option to --with-libtool-sysroot
4to avoid namespace conflict with binutils, gcc and other toolchain 5to avoid namespace conflict with binutils, gcc and other toolchain
5components. 6components since these componets also add that option to configure
7and this becomes confusing and conflicting otherwise.
6 8
7I also reported the problem to libtool here 9Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
8 10
11Upstream report:
9http://lists.gnu.org/archive/html/libtool/2010-10/msg00048.html 12http://lists.gnu.org/archive/html/libtool/2010-10/msg00048.html
10 13
11-Khem Raj <raj.khem@gmail.com> 14Upstream-Status: Submitted [https://lists.gnu.org/archive/html/libtool-patches/2021-10/msg00014.html]
12
13Updated by: Robert Yang <liezhi.yang@windriver.com>
14 15
15diff --git a/m4/libtool.m4 b/m4/libtool.m4 16diff --git a/m4/libtool.m4 b/m4/libtool.m4
16--- a/m4/libtool.m4 17--- a/m4/libtool.m4
diff --git a/meta/recipes-devtools/libtool/libtool/use-sysroot-in-libpath.patch b/meta/recipes-devtools/libtool/libtool/0003-ltmain.in-Add-missing-sysroot-to-library-path.patch
index 6af99f327c..0103a00451 100644
--- a/meta/recipes-devtools/libtool/libtool/use-sysroot-in-libpath.patch
+++ b/meta/recipes-devtools/libtool/libtool/0003-ltmain.in-Add-missing-sysroot-to-library-path.patch
@@ -1,12 +1,14 @@
1Upstream-Status: Pending 1From: Khem Raj <raj.khem@gmail.com>
2Subject: [PATCH 03/12] ltmain.in: Add missing sysroot to library path
2 3
3When using sysroot we should append it to libdir, which is helpful in 4When using a sysroot we should append it to libdir, which is helpful in
4cross builds as the system is staged in the sysroot. For normal builds, 5cross builds as the system is staged in the sysroot. For normal builds,
5i.e. when lt_sysroot is not set, it will still behave the same and add 6i.e. when lt_sysroot is not set, it will still behave the same and add
6-L/usr/lib to the relink command. 7-L/usr/lib to the relink command.
7 8
8-Khem Raj <raj.khem@gmail.com> 9Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9Updated by: Robert Yang <liezhi.yang@windriver.com> 10
11Upstream-Status: Submitted [https://lists.gnu.org/archive/html/libtool-patches/2021-10/msg00017.html]
10 12
11diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in 13diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
12--- a/build-aux/ltmain.in 14--- a/build-aux/ltmain.in
diff --git a/meta/recipes-devtools/libtool/libtool/fix-final-rpath.patch b/meta/recipes-devtools/libtool/libtool/0004-ltmain.sh-Fix-sysroot-paths-being-encoded-into-RPATH.patch
index 5c9f8cc9c0..21b3dfe306 100644
--- a/meta/recipes-devtools/libtool/libtool/fix-final-rpath.patch
+++ b/meta/recipes-devtools/libtool/libtool/0004-ltmain.sh-Fix-sysroot-paths-being-encoded-into-RPATH.patch
@@ -1,13 +1,13 @@
1Upstream-Status: Inappropriate [embedded specific] 1From: Richard Purdie <richard.purdie@linuxfoundation.org>
2Subject: [PATCH 04/12] ltmain.sh: Fix sysroot paths being encoded into RPATHs
2 3
3Enalbing sysroot support exposed a bug where the final library 4There is a bug where RPATHs could end up containing sysroot values when
4had an RPATH encoded into it which still pointed to the sysroot. 5cross compiling which is obviously incorrect. Strip out sysroot components
5This works around the issue until it gets sorted out upstream. 6from libdir when building RPATH values to avoid this.
6 7
7Fix suggested by Richard Purdie <richard.purdie@intel.com> 8Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
8Signed-off-by: Scott Garman <scott.a.garman@intel.com> 9
9Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> 10Upstream-Status: Submitted [https://lists.gnu.org/archive/html/libtool-patches/2021-10/msg00009.html]
10Updated by: Robert Yang <liezhi.yang@windriver.com>
11 11
12diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in 12diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
13--- a/build-aux/ltmain.in 13--- a/build-aux/ltmain.in
diff --git a/meta/recipes-devtools/libtool/libtool/fix-rpath.patch b/meta/recipes-devtools/libtool/libtool/0005-ltmain.in-Don-t-encode-RATHS-which-match-default-lin.patch
index a2ec9473e7..50d47d9f7a 100644
--- a/meta/recipes-devtools/libtool/libtool/fix-rpath.patch
+++ b/meta/recipes-devtools/libtool/libtool/0005-ltmain.in-Don-t-encode-RATHS-which-match-default-lin.patch
@@ -1,18 +1,21 @@
1We don't want to add RPATHS which match default linker 1From: Richard Purdie <richard.purdie@linuxfoundation.org>
2search paths, they're a waste of space. This patch 2Subject: [PATCH 05/12] ltmain.in: Don't encode RATHS which match default linker paths
3filters libtools list and removes the ones we don't need.
4 3
5RP 23/9/2011 4We don't want to add RPATHS which match default linker search paths, they're
5a waste of space. This patch filters libtools list of paths to encoode and
6removes the ones we don't need.
6 7
7Upstream-Status: Pending 8Libtool may be passed link paths of the form "/usr/lib/../lib" so normalize
9the paths before comparision.
8 10
9Updated by: Robert Yang <liezhi.yang@windriver.com> 11Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10 12
11Index: libtool-2.4.2/build-aux/ltmain.in 13Upstream-Status: Submitted [https://lists.gnu.org/archive/html/libtool-patches/2021-10/msg00013.html]
12=================================================================== 14
13--- libtool-2.4.2.orig/build-aux/ltmain.in 15diff -u b/build-aux/ltmain.in b/build-aux/ltmain.in
14+++ libtool-2.4.2/build-aux/ltmain.in 16--- b/build-aux/ltmain.in
15@@ -7286,8 +7286,14 @@ EOF 17+++ b/build-aux/ltmain.in 2012-08-22 11:01:34.191345989 -0700
18@@ -7286,8 +7286,16 @@
16 esac 19 esac
17 fi 20 fi
18 else 21 else
@@ -20,8 +23,10 @@ Index: libtool-2.4.2/build-aux/ltmain.in
20- func_append dep_rpath " $flag" 23- func_append dep_rpath " $flag"
21+ # We only want to hardcode in an rpath if it isn't in the 24+ # We only want to hardcode in an rpath if it isn't in the
22+ # default dlsearch path. 25+ # default dlsearch path.
26+ func_normal_abspath "$libdir"
27+ libdir_norm=$func_normal_abspath_result
23+ case " $sys_lib_dlsearch_path " in 28+ case " $sys_lib_dlsearch_path " in
24+ *" $libdir "*) ;; 29+ *" $libdir_norm "*) ;;
25+ *) eval flag=\"$hardcode_libdir_flag_spec\" 30+ *) eval flag=\"$hardcode_libdir_flag_spec\"
26+ func_append dep_rpath " $flag" 31+ func_append dep_rpath " $flag"
27+ ;; 32+ ;;
@@ -29,7 +34,7 @@ Index: libtool-2.4.2/build-aux/ltmain.in
29 fi 34 fi
30 elif test -n "$runpath_var"; then 35 elif test -n "$runpath_var"; then
31 case "$perm_rpath " in 36 case "$perm_rpath " in
32@@ -8019,8 +8025,14 @@ EOF 37@@ -8019,8 +8027,16 @@
33 esac 38 esac
34 fi 39 fi
35 else 40 else
@@ -37,8 +42,10 @@ Index: libtool-2.4.2/build-aux/ltmain.in
37- func_append rpath " $flag" 42- func_append rpath " $flag"
38+ # We only want to hardcode in an rpath if it isn't in the 43+ # We only want to hardcode in an rpath if it isn't in the
39+ # default dlsearch path. 44+ # default dlsearch path.
45+ func_normal_abspath "$libdir"
46+ libdir_norm=$func_normal_abspath_result
40+ case " $sys_lib_dlsearch_path " in 47+ case " $sys_lib_dlsearch_path " in
41+ *" $libdir "*) ;; 48+ *" $libdir_norm "*) ;;
42+ *) eval flag=\"$hardcode_libdir_flag_spec\" 49+ *) eval flag=\"$hardcode_libdir_flag_spec\"
43+ rpath+=" $flag" 50+ rpath+=" $flag"
44+ ;; 51+ ;;
@@ -46,7 +53,7 @@ Index: libtool-2.4.2/build-aux/ltmain.in
46 fi 53 fi
47 elif test -n "$runpath_var"; then 54 elif test -n "$runpath_var"; then
48 case "$perm_rpath " in 55 case "$perm_rpath " in
49@@ -8070,8 +8082,14 @@ EOF 56@@ -8070,8 +8086,14 @@
50 esac 57 esac
51 fi 58 fi
52 else 59 else
diff --git a/meta/recipes-devtools/libtool/libtool/fix-resolve-lt-sysroot.patch b/meta/recipes-devtools/libtool/libtool/0006-libtool.m4-Handle-as-a-sysroot-correctly.patch
index 1bd95980c0..999971241f 100644
--- a/meta/recipes-devtools/libtool/libtool/fix-resolve-lt-sysroot.patch
+++ b/meta/recipes-devtools/libtool/libtool/0006-libtool.m4-Handle-as-a-sysroot-correctly.patch
@@ -1,16 +1,18 @@
1Upstream-Status: Pending 1From: Richard Purdie <richard.purdie@linuxfoundation.org>
2Subject: [PATCH 06/12] libtool.m4: Handle "/" as a sysroot correctly
2 3
3This patch updates libtool.m4 (and its output) to resolve a problem 4Update libtool.m4 to resolve a problem with lt_sysroot not being properly
4with variable 'lt_sysroot' not being properly updated if the option 5updated if the option '--with[-libtool]-sysroot' is not provided when
5'--with[-libtool]-sysroot' is not provided when running the 'configure' 6running the 'configure' script for a package so that "/" as a sysroot
6script for a package. 7is handled correctly by libtool.
7 8
8I have also reported the problem to libtool here 9Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9 10
11Upstream Report:
10http://lists.gnu.org/archive/html/bug-libtool/2013-09/msg00005.html 12http://lists.gnu.org/archive/html/bug-libtool/2013-09/msg00005.html
11 13
12Signed-off-by: Hans Beckerus <hans.beckerus at gmail.com> 14Upstream-Status: Submitted [https://lists.gnu.org/archive/html/libtool-patches/2021-10/msg00018.html]
13Updated by: Robert Yang <liezhi.yang@windriver.com> 15
14--- 16---
15diff --git a/m4/libtool.m4 b/m4/libtool.m4 17diff --git a/m4/libtool.m4 b/m4/libtool.m4
16--- a/m4/libtool.m4 18--- a/m4/libtool.m4
diff --git a/meta/recipes-devtools/libtool/libtool/0001-libtool-Fix-support-for-NIOS2-processor.patch b/meta/recipes-devtools/libtool/libtool/0007-libtool-Fix-support-for-NIOS2-processor.patch
index bbd36d8dc1..395464e908 100644
--- a/meta/recipes-devtools/libtool/libtool/0001-libtool-Fix-support-for-NIOS2-processor.patch
+++ b/meta/recipes-devtools/libtool/libtool/0007-libtool-Fix-support-for-NIOS2-processor.patch
@@ -1,7 +1,5 @@
1From df2cd898e48208f26320d40c3ed6b19c75c27142 Mon Sep 17 00:00:00 2001
2From: Marek Vasut <marex@denx.de> 1From: Marek Vasut <marex@denx.de>
3Date: Thu, 17 Sep 2015 00:43:15 +0200 2Subject: [PATCH 07/12] libtool: Fix support for NIOS2 processor
4Subject: [PATCH] libtool: Fix support for NIOS2 processor
5 3
6The name of the system contains the string "nios2". This string 4The name of the system contains the string "nios2". This string
7is caught by the some of the greedy checks for OS/2 in libtool, 5is caught by the some of the greedy checks for OS/2 in libtool,
@@ -13,7 +11,10 @@ checks to prevent the OS/2 check incorrectly trapping the nios2
13as well. 11as well.
14 12
15Signed-off-by: Marek Vasut <marex@denx.de> 13Signed-off-by: Marek Vasut <marex@denx.de>
16Upstream-Status: Submitted 14Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
15
16Upstream-Status: Submitted [https://lists.gnu.org/archive/html/libtool-patches/2021-10/msg00021.html]
17
17--- 18---
18 build-aux/ltmain.in | 20 ++++++++++++++++++++ 19 build-aux/ltmain.in | 20 ++++++++++++++++++++
19 1 file changed, 20 insertions(+) 20 1 file changed, 20 insertions(+)
diff --git a/meta/recipes-devtools/libtool/libtool/0001-libtool-Check-for-static-libs-for-internal-compiler-.patch b/meta/recipes-devtools/libtool/libtool/0008-libtool-Check-for-static-libs-for-internal-compiler-.patch
index 8c7c39feb6..afffdb9fd4 100644
--- a/meta/recipes-devtools/libtool/libtool/0001-libtool-Check-for-static-libs-for-internal-compiler-.patch
+++ b/meta/recipes-devtools/libtool/libtool/0008-libtool-Check-for-static-libs-for-internal-compiler-.patch
@@ -1,8 +1,7 @@
1From 40a2da75e6d95cc7c498ebda95ab19ae0db2ebfb Mon Sep 17 00:00:00 2001 1From b9993338080325a6e2b2ec94ca0ece80e7fa3fb6 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 26 Jan 2019 12:54:26 -0800 3Date: Sat, 26 Jan 2019 12:54:26 -0800
4Subject: [PATCH] libtool: Check for static libs for internal compiler 4Subject: [PATCH 08/12] libtool: Check for static libs for internal compiler libraries
5 libraries
6 5
7Libtool checks only for libraries linked as -l* when trying to 6Libtool checks only for libraries linked as -l* when trying to
8find internal compiler libraries. Clang, however uses the absolute 7find internal compiler libraries. Clang, however uses the absolute
@@ -10,11 +9,13 @@ path to link its internal libraries e.g. compiler_rt. This patch
10handles clang's statically linked libraries when finding internal 9handles clang's statically linked libraries when finding internal
11compiler libraries. 10compiler libraries.
12 11
13https://crbug.com/749263 12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
14 14
15Upstream-Status: Submitted [https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27866] 15https://crbug.com/749263
16https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27866
16 17
17Signed-off-by: Khem Raj <raj.khem@gmail.com> 18Upstream-Status: Submitted [https://lists.gnu.org/archive/html/libtool-patches/2021-10/msg00016.html]
18--- 19---
19 m4/libtool.m4 | 2 +- 20 m4/libtool.m4 | 2 +-
20 1 file changed, 1 insertion(+), 1 deletion(-) 21 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/recipes-devtools/libtool/libtool/0001-Makefile.am-make-sure-autoheader-run-before-autoconf.patch b/meta/recipes-devtools/libtool/libtool/0009-Makefile.am-make-sure-autoheader-run-before-autoconf.patch
index 2e9908725e..348cd3c1ae 100644
--- a/meta/recipes-devtools/libtool/libtool/0001-Makefile.am-make-sure-autoheader-run-before-autoconf.patch
+++ b/meta/recipes-devtools/libtool/libtool/0009-Makefile.am-make-sure-autoheader-run-before-autoconf.patch
@@ -1,7 +1,5 @@
1From dfbbbd359e43e0a55fbea06f2647279ad8761cb9 Mon Sep 17 00:00:00 2001
2From: Mingli Yu <mingli.yu@windriver.com> 1From: Mingli Yu <mingli.yu@windriver.com>
3Date: Wed, 24 Mar 2021 03:04:13 +0000 2Subject: [PATCH 09/12] Makefile.am: make sure autoheader run before autoconf
4Subject: [PATCH] Makefile.am: make sure autoheader run before autoconf
5 3
6autoheader will update ../libtool-2.4.6/libltdl/config-h.in which 4autoheader will update ../libtool-2.4.6/libltdl/config-h.in which
7autoconf needs, so there comes a race sometimes as below: 5autoconf needs, so there comes a race sometimes as below:
@@ -10,9 +8,11 @@ autoconf needs, so there comes a race sometimes as below:
10 8
11So make sure autoheader run before autoconf to avoid this race. 9So make sure autoheader run before autoconf to avoid this race.
12 10
13Upstream-Status: Submitted [libtool-patches@gnu.org maillist]
14
15Signed-off-by: Mingli Yu <mingli.yu@windriver.com> 11Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
12Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
13
14Upstream-Status: Submitted [https://lists.gnu.org/archive/html/libtool-patches/2021-10/msg00015.html]
15
16--- 16---
17 Makefile.am | 2 +- 17 Makefile.am | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-) 18 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/recipes-devtools/libtool/libtool/0001-Makefile.am-make-sure-autoheader-run-before-automake.patch b/meta/recipes-devtools/libtool/libtool/0010-Makefile.am-make-sure-autoheader-run-before-automake.patch
index 87f8492346..cd963ef1be 100644
--- a/meta/recipes-devtools/libtool/libtool/0001-Makefile.am-make-sure-autoheader-run-before-automake.patch
+++ b/meta/recipes-devtools/libtool/libtool/0010-Makefile.am-make-sure-autoheader-run-before-automake.patch
@@ -1,7 +1,5 @@
1From e82c06584f02e3e4487aa73aa05981e2a35dc6d1 Mon Sep 17 00:00:00 2001
2From: Mingli Yu <mingli.yu@windriver.com> 1From: Mingli Yu <mingli.yu@windriver.com>
3Date: Tue, 13 Apr 2021 07:17:29 +0000 2Subject: [PATCH 10/12] Makefile.am: make sure autoheader run before automake
4Subject: [PATCH] Makefile.am: make sure autoheader run before automake
5 3
6When use automake to generate Makefile.in from Makefile.am, there 4When use automake to generate Makefile.in from Makefile.am, there
7comes below race: 5comes below race:
@@ -10,7 +8,10 @@ comes below race:
10It is because the file config-h.in in updating process by autoheader, 8It is because the file config-h.in in updating process by autoheader,
11so make automake run after autoheader to avoid the above race. 9so make automake run after autoheader to avoid the above race.
12 10
13Upstream-Status: Submitted [libtool-patches@gnu.org maillist] 11Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
12Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
13
14Upstream-Status: Submitted [https://lists.gnu.org/archive/html/libtool-patches/2021-10/msg00020.html]
14 15
15Signed-off-by: Mingli Yu <mingli.yu@windriver.com> 16Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
16--- 17---
diff --git a/meta/recipes-devtools/libtool/libtool/lto-prefix.patch b/meta/recipes-devtools/libtool/libtool/0011-ltmain.in-Handle-prefix-map-compiler-options-correct.patch
index 2bd010b8e4..b121a3c750 100644
--- a/meta/recipes-devtools/libtool/libtool/lto-prefix.patch
+++ b/meta/recipes-devtools/libtool/libtool/0011-ltmain.in-Handle-prefix-map-compiler-options-correct.patch
@@ -1,9 +1,13 @@
1From: Richard Purdie <richard.purdie@linuxfoundation.org>
2Subject: [PATCH 11/12] ltmain.in: Handle prefix-map compiler options correctly
3
1If lto is enabled, we need the prefix-map variables to be passed to the linker. 4If lto is enabled, we need the prefix-map variables to be passed to the linker.
2Add these to the list of options libtool passes through. 5Add these to the list of options libtool passes through.
3 6
4Upstream-Status: Pending
5Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> 7Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
6 8
9Upstream-Status: Submitted [https://lists.gnu.org/archive/html/libtool-patches/2021-10/msg00019.html]
10
7Index: libtool-2.4.6/build-aux/ltmain.in 11Index: libtool-2.4.6/build-aux/ltmain.in
8=================================================================== 12===================================================================
9--- libtool-2.4.6.orig/build-aux/ltmain.in 13--- libtool-2.4.6.orig/build-aux/ltmain.in
diff --git a/meta/recipes-devtools/libtool/libtool/debian-no_hostname.patch b/meta/recipes-devtools/libtool/libtool/0012-libtool.m4-For-reproducibility-stop-encoding-hostnam.patch
index 5add0cca3b..64f911d46c 100755..100644
--- a/meta/recipes-devtools/libtool/libtool/debian-no_hostname.patch
+++ b/meta/recipes-devtools/libtool/libtool/0012-libtool.m4-For-reproducibility-stop-encoding-hostnam.patch
@@ -1,10 +1,16 @@
1libtool: remove host specific info from header file 1From: Richard Purdie <richard.purdie@linuxfoundation.org>
2Subject: [PATCH 12/12] libtool.m4: For reproducibility stop encoding hostname in libtool script
3
4For reproducibilty, stop encoding the hostname into the libtool script, this isn't
5really adding much to debugging and most distros are carrying such a patch now as
6reproducibility is important.
7
8Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2 9
3https://sources.debian.org/data/main/libt/libtool/2.4.6-10/debian/patches/ 10https://sources.debian.org/data/main/libt/libtool/2.4.6-10/debian/patches/
4 no_hostname.patch 11 no_hostname.patch
5 12
6Upstream-Status: Inappropriate [not author] 13Upstream-Status: Submitted [https://lists.gnu.org/archive/html/libtool-patches/2021-10/msg00011.html]
7Signed-off-by: Joe Slater <joe.slater@windriver.com>
8 14
9--- 15---
10Index: libtool-2.4.6/m4/libtool.m4 16Index: libtool-2.4.6/m4/libtool.m4
diff --git a/meta/recipes-devtools/libtool/libtool/ARFLAGS-use-cr-instead-of-cru-by-default.patch b/meta/recipes-devtools/libtool/libtool/ARFLAGS-use-cr-instead-of-cru-by-default.patch
new file mode 100644
index 0000000000..447640cef6
--- /dev/null
+++ b/meta/recipes-devtools/libtool/libtool/ARFLAGS-use-cr-instead-of-cru-by-default.patch
@@ -0,0 +1,133 @@
1From 418129bc63afc312701e84cb8afa5ca413df1ab5 Mon Sep 17 00:00:00 2001
2From: Pavel Raiskup <praiskup@redhat.com>
3Date: Fri, 17 Apr 2015 16:54:58 +0200
4Subject: ARFLAGS: use 'cr' instead of 'cru' by default
5
6In some GNU/Linux distributions people started to compile 'ar'
7binary with --enable-deterministic-archives (binutils project).
8That, however, in combination with our previous long time working
9default AR_FLAGS=cru causes warnings on such installations:
10ar: `u' modifier ignored since `D' is the default (see `U')
11
12The 'u' option (at least with GNU binutils) did small optimization
13during repeated builds because it instructed 'ar' to not
14open/close unchanged *.o files and to rather read their contents
15from old archive file. However, its removal should not cause a
16big performance hit for usual workflows.
17
18Distributions started using --enable-deterministic-archives
19knowing that it would disable the 'u', just to rather have a bit
20more deterministic builds.
21
22Also, to justify this change a bit more, keeping 'u' in ARFLAGS
23could only result in many per-project changes to override
24Libtool's ARFLAGS default, just to silent such warnings.
25
26Fixes bug#19967. Reported by Eric Blake.
27
28* m4/libtool.m4 (_LT_PROG_AR): Default AR_FLAGS to 'cr'.
29(_LT_REQUIRED_DARWIN_CHECKS): Use $AR_FLAGS instead 'cru' string.
30* doc/libtool.texi: Do 's/ar cru/ar cr/' in whole documentation.
31* NEWS: Document.
32
33Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/libtool.git/commit/?id=418129bc63afc312701e84cb8afa5ca413df1ab5]
34
35Signed-off-by: Li Wang <li.wang@windriver.com>
36Signed-off-by: Changqing Li <changqing.li@windriver.com>
37---
38 NEWS | 4 ++++
39 doc/libtool.texi | 10 +++++-----
40 m4/libtool.m4 | 6 +++---
41 3 files changed, 12 insertions(+), 8 deletions(-)
42
43diff --git a/NEWS b/NEWS
44index 71a932d..1518f09 100644
45--- a/NEWS
46+++ b/NEWS
47@@ -13,6 +13,10 @@ NEWS - list of user-visible changes between releases of GNU Libtool
48 variable, which obsoletes AR_FLAGS. This is due to naming conventions
49 among other *FLAGS and to be consistent with Automake's ARFLAGS.
50
51+** Important incompatible changes:
52+
53+ - Libtool changed ARFLAGS/AR_FLAGS default from 'cru' to 'cr'.
54+
55 ** Bug fixes:
56
57 - Fix a race condition in ltdl dryrun test that would cause spurious
58diff --git a/doc/libtool.texi b/doc/libtool.texi
59index 0298627..4c664bb 100644
60--- a/doc/libtool.texi
61+++ b/doc/libtool.texi
62@@ -602,7 +602,7 @@ Without libtool, the programmer would invoke the @command{ar} command to
63 create a static library:
64
65 @example
66-burger$ @kbd{ar cru libhello.a hello.o foo.o}
67+burger$ @kbd{ar cr libhello.a hello.o foo.o}
68 burger$
69 @end example
70
71@@ -632,7 +632,7 @@ libtool are the same ones you would use to produce an executable named
72 a23$ @kbd{libtool --mode=link gcc -g -O -o libhello.la foo.o hello.o}
73 *** Warning: Linking the shared library libhello.la against the
74 *** non-libtool objects foo.o hello.o is not portable!
75-ar cru .libs/libhello.a
76+ar cr .libs/libhello.a
77 ranlib .libs/libhello.a
78 creating libhello.la
79 (cd .libs && rm -f libhello.la && ln -s ../libhello.la libhello.la)
80@@ -662,7 +662,7 @@ archive, not a shared library (@pxref{Static libraries}).}:
81 @example
82 a23$ @kbd{libtool --mode=link gcc -g -O -o libhello.la foo.lo hello.lo \
83 -rpath /usr/local/lib -lm}
84-ar cru @value{objdir}/libhello.a foo.o hello.o
85+ar cr @value{objdir}/libhello.a foo.o hello.o
86 ranlib @value{objdir}/libhello.a
87 creating libhello.la
88 (cd @value{objdir} && rm -f libhello.la && ln -s ../libhello.la libhello.la)
89@@ -676,7 +676,7 @@ burger$ @kbd{libtool --mode=link gcc -g -O -o libhello.la foo.lo hello.lo \
90 -rpath /usr/local/lib -lm}
91 rm -fr @value{objdir}/libhello.a @value{objdir}/libhello.la
92 ld -Bshareable -o @value{objdir}/libhello.so.0.0 @value{objdir}/foo.o @value{objdir}/hello.o -lm
93-ar cru @value{objdir}/libhello.a foo.o hello.o
94+ar cr @value{objdir}/libhello.a foo.o hello.o
95 ranlib @value{objdir}/libhello.a
96 creating libhello.la
97 (cd @value{objdir} && rm -f libhello.la && ln -s ../libhello.la libhello.la)
98@@ -6001,7 +6001,7 @@ in cases where it is necessary.
99 @subsection Archivers
100
101 On all known systems, building a static library can be accomplished by
102-running @kbd{ar cru lib@var{name}.a @var{obj1}.o @var{obj2}.o @dots{}},
103+running @kbd{ar cr lib@var{name}.a @var{obj1}.o @var{obj2}.o @dots{}},
104 where the @file{.a} file is the output library, and each @file{.o} file is an
105 object file.
106
107diff --git a/m4/libtool.m4 b/m4/libtool.m4
108index 6514196..add06ee 100644
109--- a/m4/libtool.m4
110+++ b/m4/libtool.m4
111@@ -1041,8 +1041,8 @@ int forced_loaded() { return 2;}
112 _LT_EOF
113 echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
114 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
115- echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
116- $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
117+ echo "$AR $AR_FLAGS libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
118+ $AR $AR_FLAGS libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
119 echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
120 $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
121 cat > conftest.c << _LT_EOF
122@@ -1505,7 +1505,7 @@ _LT_DECL([], [AR], [1], [The archiver])
123 # ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS
124 # variable obsoleted/removed.
125
126-test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cru}
127+test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr}
128 lt_ar_flags=$AR_FLAGS
129 _LT_DECL([], [lt_ar_flags], [0], [Flags to create an archive (by configure)])
130
131--
1322.23.0
133
diff --git a/meta/recipes-devtools/libtool/libtool/fixinstall.patch b/meta/recipes-devtools/libtool/libtool/fixinstall.patch
index 8f343bf436..48330d82fb 100644
--- a/meta/recipes-devtools/libtool/libtool/fixinstall.patch
+++ b/meta/recipes-devtools/libtool/libtool/fixinstall.patch
@@ -27,9 +27,9 @@ diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
27 27
28- if test -n "$relink_command"; then 28- if test -n "$relink_command"; then
29+ if test "$fast_install" = no && test -n "$relink_command"; then 29+ if test "$fast_install" = no && test -n "$relink_command"; then
30 # Strip any trailing slash from the destination. 30 # Strip any trailing slash from the destination.
31 func_stripname '' '/' "$libdir" 31 func_stripname '' '/' "$libdir"
32 destlibdir=$func_stripname_result 32 destlibdir=$func_stripname_result
33@@ -2394,7 +2394,7 @@ func_mode_install () 33@@ -2394,7 +2394,7 @@ func_mode_install ()
34 shift 34 shift
35 35
diff --git a/meta/recipes-devtools/libtool/libtool/libool.m4-add-ARFLAGS-variable.patch b/meta/recipes-devtools/libtool/libtool/libool.m4-add-ARFLAGS-variable.patch
new file mode 100644
index 0000000000..bb11887cda
--- /dev/null
+++ b/meta/recipes-devtools/libtool/libtool/libool.m4-add-ARFLAGS-variable.patch
@@ -0,0 +1,77 @@
1From 4335de1dfb7d2ec728427e07a54136b94a2d40f6 Mon Sep 17 00:00:00 2001
2From: Pavel Raiskup <praiskup@redhat.com>
3Date: Fri, 17 Apr 2015 15:05:42 +0200
4Subject: libool.m4: add ARFLAGS variable
5
6Libtool has used $AR_FLAGS since 2000-05-29 commit
78300de4c54e6f04f0d, Automake ARFLAGS since 2003-04-06 commit
8a71b3490639831ca. Even though ARFLAGS is younger, it sounds like
9better name according GNU Coding Standards.
10
11Related to bug#20082.
12
13* m4/libtool.m4 (_LT_PROG_AR): Copy ARFLAGS value into AR_FLAGS
14variable if AR_FLAGS is not set. Add new _LT_DECL'ed variable
15'lt_ar_flags' to keep the configure-time value of AR_FLAGS. The
16new 'lt_ar_flags' is to be used as the default value for AR_FLAGS
17at libtool-runtime.
18* NEWS: Document.
19
20Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/libtool.git/commit/?id=4335de1dfb7d2ec728427e07a54136b94a2d40f6]
21
22Signed-off-by: Li Wang <li.wang@windriver.com>
23Signed-off-by: Changqing Li <changqing.li@windriver.com>
24---
25 NEWS | 6 ++++++
26 m4/libtool.m4 | 17 +++++++++++++++--
27 2 files changed, 21 insertions(+), 2 deletions(-)
28
29diff --git a/NEWS b/NEWS
30index d7ca434..71a932d 100644
31--- a/NEWS
32+++ b/NEWS
33@@ -7,6 +7,12 @@ NEWS - list of user-visible changes between releases of GNU Libtool
34 - LT_SYS_LIBRARY_PATH can be set in config.site, or at configure time
35 and persists correctly in the generated libtool script.
36
37+** New features:
38+
39+ - Libtool script now supports (configure-time and runtime) ARFLAGS
40+ variable, which obsoletes AR_FLAGS. This is due to naming conventions
41+ among other *FLAGS and to be consistent with Automake's ARFLAGS.
42+
43 ** Bug fixes:
44
45 - Fix a race condition in ltdl dryrun test that would cause spurious
46diff --git a/m4/libtool.m4 b/m4/libtool.m4
47index 63acd09..6514196 100644
48--- a/m4/libtool.m4
49+++ b/m4/libtool.m4
50@@ -1497,9 +1497,22 @@ need_locks=$enable_libtool_lock
51 m4_defun([_LT_PROG_AR],
52 [AC_CHECK_TOOLS(AR, [ar], false)
53 : ${AR=ar}
54-: ${AR_FLAGS=cru}
55 _LT_DECL([], [AR], [1], [The archiver])
56-_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
57+
58+# Use ARFLAGS variable as AR's operation code to sync the variable naming with
59+# Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have
60+# higher priority because thats what people were doing historically (setting
61+# ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS
62+# variable obsoleted/removed.
63+
64+test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cru}
65+lt_ar_flags=$AR_FLAGS
66+_LT_DECL([], [lt_ar_flags], [0], [Flags to create an archive (by configure)])
67+
68+# Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override
69+# by AR_FLAGS because that was never working and AR_FLAGS is about to die.
70+_LT_DECL([], [AR_FLAGS], [\@S|@{ARFLAGS-"\@S|@lt_ar_flags"}],
71+ [Flags to create an archive])
72
73 AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
74 [lt_cv_ar_at_file=no
75--
762.23.0
77
diff --git a/meta/recipes-devtools/libtool/libtool/norm-rpath.patch b/meta/recipes-devtools/libtool/libtool/norm-rpath.patch
deleted file mode 100644
index 1e4c65e024..0000000000
--- a/meta/recipes-devtools/libtool/libtool/norm-rpath.patch
+++ /dev/null
@@ -1,38 +0,0 @@
1libtool: normalize link paths before considering for RPATH
2
3Libtool may be passed link paths of the form "/usr/lib/../lib", which
4fool its detection code into thinking it should be included as an
5RPATH in the generated binary. Normalize before comparision.
6
7Signed-off-by: Andy Ross <andy.ross@windriver.com>
8Upstream-Status: Pending
9
10Updated by: Robert Yang <liezhi.yang@windriver.com>
11
12diff -ur a/build-aux/ltmain.in b/build-aux/ltmain.in
13--- a/build-aux/ltmain.in 2012-08-16 13:58:55.058900363 -0700
14+++ b/build-aux/ltmain.in 2012-08-22 11:01:34.191345989 -0700
15@@ -7288,8 +7288,10 @@
16 else
17 # We only want to hardcode in an rpath if it isn't in the
18 # default dlsearch path.
19+ func_normal_abspath "$libdir"
20+ libdir_norm=$func_normal_abspath_result
21 case " $sys_lib_dlsearch_path " in
22- *" $libdir "*) ;;
23+ *" $libdir_norm "*) ;;
24 *) eval flag=\"$hardcode_libdir_flag_spec\"
25 func_append dep_rpath " $flag"
26 ;;
27@@ -8027,8 +8029,10 @@
28 else
29 # We only want to hardcode in an rpath if it isn't in the
30 # default dlsearch path.
31+ func_normal_abspath "$libdir"
32+ libdir_norm=$func_normal_abspath_result
33 case " $sys_lib_dlsearch_path " in
34- *" $libdir "*) ;;
35+ *" $libdir_norm "*) ;;
36 *) eval flag=\"$hardcode_libdir_flag_spec\"
37 rpath+=" $flag"
38 ;;
diff --git a/meta/recipes-devtools/libtool/libtool/trailingslash.patch b/meta/recipes-devtools/libtool/libtool/trailingslash.patch
deleted file mode 100644
index e8824d7db9..0000000000
--- a/meta/recipes-devtools/libtool/libtool/trailingslash.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1Upstream-Status: Pending
2
3A command like /bin/sh ../../i586-poky-linux-libtool --mode=install /usr/bin/install -c gck-roots-store-standalone.la '/media/data1/builds/poky1/tmp/work/core2-poky-linux/gnome-keyring-2.26.1-r1/image/usr/lib/gnome-keyring/standalone/' fails (e.g. gnome-keyring or pulseaudio)
4
5This is because libdir has a trailing slash which breaks the comparision.
6
7RP 2/1/10
8
9Merged a patch received from Gary Thomas <gary@mlbassoc.com>
10
11Date: 2010/07/12
12Nitin A Kamble <nitin.a.kamble@intel.com>
13
14Updated by: Robert Yang <liezhi.yang@windriver.com>
15
16diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
17--- a/build-aux/ltmain.in
18+++ b/build-aux/ltmain.in
19@@ -2356,8 +2356,15 @@ func_mode_install ()
20 func_append dir "$objdir"
21
22 if test -n "$relink_command"; then
23+ # Strip any trailing slash from the destination.
24+ func_stripname '' '/' "$libdir"
25+ destlibdir=$func_stripname_result
26+
27+ func_stripname '' '/' "$destdir"
28+ s_destdir=$func_stripname_result
29+
30 # Determine the prefix the user has applied to our future dir.
31- inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
32+ inst_prefix_dir=`$ECHO "X$s_destdir" | $Xsed -e "s%$destlibdir\$%%"`
33
34 # Don't allow the user to place us outside of our expected
35 # location b/c this prevents finding dependent libraries that
diff --git a/meta/recipes-devtools/perl/files/perl-rdepends.txt b/meta/recipes-devtools/perl/files/perl-rdepends.txt
index dd23dc222a..3415f32ab1 100644
--- a/meta/recipes-devtools/perl/files/perl-rdepends.txt
+++ b/meta/recipes-devtools/perl/files/perl-rdepends.txt
@@ -1,7 +1,15 @@
1 1
2# Some additional dependencies that the above doesn't manage to figure out 2# Some additional dependencies that the above doesn't manage to figure out
3RDEPENDS:perl-module-file-spec += "perl-module-file-spec-unix" 3RDEPENDS:perl-module-file-spec += "perl-module-file-spec-unix"
4RDEPENDS:perl-module-io-file += "perl-module-symbol"
4RDEPENDS:perl-module-math-bigint += "perl-module-math-bigint-calc" 5RDEPENDS:perl-module-math-bigint += "perl-module-math-bigint-calc"
6RDEPENDS:perl-module-test-builder += "perl-module-list-util"
7RDEPENDS:perl-module-test-builder += "perl-module-scalar-util"
8RDEPENDS:perl-module-test-builder-formatter += "perl-module-test2-formatter-tap"
9RDEPENDS:perl-module-test2-api += "perl-module-test2-event-fail"
10RDEPENDS:perl-module-test2-api += "perl-module-test2-event-pass"
11RDEPENDS:perl-module-test2-api += "perl-module-test2-event-v2"
12RDEPENDS:perl-module-test2-formatter-tap += "perl-module-test2-formatter"
5RDEPENDS:perl-module-thread-queue += "perl-module-attributes" 13RDEPENDS:perl-module-thread-queue += "perl-module-attributes"
6RDEPENDS:perl-module-overload += "perl-module-overloading" 14RDEPENDS:perl-module-overload += "perl-module-overloading"
7 15
@@ -50,6 +58,7 @@ RDEPENDS:perl-module-archive-tar-constant += "perl-module-exporter"
50RDEPENDS:perl-module-archive-tar-constant += "perl-module-io-compress-bzip2" 58RDEPENDS:perl-module-archive-tar-constant += "perl-module-io-compress-bzip2"
51RDEPENDS:perl-module-archive-tar-constant += "perl-module-strict" 59RDEPENDS:perl-module-archive-tar-constant += "perl-module-strict"
52RDEPENDS:perl-module-archive-tar-constant += "perl-module-time-local" 60RDEPENDS:perl-module-archive-tar-constant += "perl-module-time-local"
61RDEPENDS:perl-module-archive-tar-constant += "perl-module-vars"
53RDEPENDS:perl-module-archive-tar-constant += "perl-module-warnings" 62RDEPENDS:perl-module-archive-tar-constant += "perl-module-warnings"
54RDEPENDS:perl-module-archive-tar-file += "perl-module-archive-tar" 63RDEPENDS:perl-module-archive-tar-file += "perl-module-archive-tar"
55RDEPENDS:perl-module-archive-tar-file += "perl-module-archive-tar-constant" 64RDEPENDS:perl-module-archive-tar-file += "perl-module-archive-tar-constant"
@@ -157,6 +166,8 @@ RDEPENDS:perl-module-b-xref += "perl-module-b"
157RDEPENDS:perl-module-b-xref += "perl-module-config" 166RDEPENDS:perl-module-b-xref += "perl-module-config"
158RDEPENDS:perl-module-b-xref += "perl-module-strict" 167RDEPENDS:perl-module-b-xref += "perl-module-strict"
159RDEPENDS:perl-module-bytes += "perl-module-bytes-heavy" 168RDEPENDS:perl-module-bytes += "perl-module-bytes-heavy"
169RDEPENDS:perl-module-bytes += "perl-module-strict"
170RDEPENDS:perl-module-bytes += "perl-module-warnings"
160RDEPENDS:perl-module--charnames += "perl-module-bytes" 171RDEPENDS:perl-module--charnames += "perl-module-bytes"
161RDEPENDS:perl-module-charnames += "perl-module-bytes" 172RDEPENDS:perl-module-charnames += "perl-module-bytes"
162RDEPENDS:perl-module-charnames += "perl-module--charnames" 173RDEPENDS:perl-module-charnames += "perl-module--charnames"
@@ -245,14 +256,9 @@ RDEPENDS:perl-module-cwd += "perl-module-xsloader"
245RDEPENDS:perl-module-data-dumper += "perl-module-config" 256RDEPENDS:perl-module-data-dumper += "perl-module-config"
246RDEPENDS:perl-module-data-dumper += "perl-module-constant" 257RDEPENDS:perl-module-data-dumper += "perl-module-constant"
247RDEPENDS:perl-module-data-dumper += "perl-module-exporter" 258RDEPENDS:perl-module-data-dumper += "perl-module-exporter"
259RDEPENDS:perl-module-data-dumper += "perl-module-strict"
260RDEPENDS:perl-module-data-dumper += "perl-module-warnings"
248RDEPENDS:perl-module-data-dumper += "perl-module-xsloader" 261RDEPENDS:perl-module-data-dumper += "perl-module-xsloader"
249RDEPENDS:perl-module-db-file += "perl-module-dynaloader"
250RDEPENDS:perl-module-db-file += "perl-module-exporter"
251RDEPENDS:perl-module-db-file += "perl-module-fcntl"
252RDEPENDS:perl-module-db-file += "perl-module-strict "
253RDEPENDS:perl-module-db-file += "perl-module-strict"
254RDEPENDS:perl-module-db-file += "perl-module-tie-hash"
255RDEPENDS:perl-module-db-file += "perl-module-warnings"
256RDEPENDS:perl-module-dbm-filter-compress += "perl-module-strict" 262RDEPENDS:perl-module-dbm-filter-compress += "perl-module-strict"
257RDEPENDS:perl-module-dbm-filter-compress += "perl-module-warnings" 263RDEPENDS:perl-module-dbm-filter-compress += "perl-module-warnings"
258RDEPENDS:perl-module-dbm-filter-encode += "perl-module-strict" 264RDEPENDS:perl-module-dbm-filter-encode += "perl-module-strict"
@@ -281,18 +287,18 @@ RDEPENDS:perl-module-diagnostics += "perl-module-strict"
281RDEPENDS:perl-module-diagnostics += "perl-module-text-tabs" 287RDEPENDS:perl-module-diagnostics += "perl-module-text-tabs"
282RDEPENDS:perl-module-digest-base += "perl-module-mime-base64" 288RDEPENDS:perl-module-digest-base += "perl-module-mime-base64"
283RDEPENDS:perl-module-digest-base += "perl-module-strict" 289RDEPENDS:perl-module-digest-base += "perl-module-strict"
284RDEPENDS:perl-module-digest-base += "perl-module-vars" 290RDEPENDS:perl-module-digest-base += "perl-module-warnings"
285RDEPENDS:perl-module-digest-file += "perl-module-digest" 291RDEPENDS:perl-module-digest-file += "perl-module-digest"
286RDEPENDS:perl-module-digest-file += "perl-module-exporter" 292RDEPENDS:perl-module-digest-file += "perl-module-exporter"
287RDEPENDS:perl-module-digest-file += "perl-module-strict" 293RDEPENDS:perl-module-digest-file += "perl-module-strict"
288RDEPENDS:perl-module-digest-file += "perl-module-vars" 294RDEPENDS:perl-module-digest-file += "perl-module-warnings"
289RDEPENDS:perl-module-digest-md5 += "perl-module-digest-base" 295RDEPENDS:perl-module-digest-md5 += "perl-module-digest-base"
290RDEPENDS:perl-module-digest-md5 += "perl-module-exporter" 296RDEPENDS:perl-module-digest-md5 += "perl-module-exporter"
291RDEPENDS:perl-module-digest-md5 += "perl-module-strict" 297RDEPENDS:perl-module-digest-md5 += "perl-module-strict"
292RDEPENDS:perl-module-digest-md5 += "perl-module-vars" 298RDEPENDS:perl-module-digest-md5 += "perl-module-warnings"
293RDEPENDS:perl-module-digest-md5 += "perl-module-xsloader" 299RDEPENDS:perl-module-digest-md5 += "perl-module-xsloader"
294RDEPENDS:perl-module-digest += "perl-module-strict" 300RDEPENDS:perl-module-digest += "perl-module-strict"
295RDEPENDS:perl-module-digest += "perl-module-vars" 301RDEPENDS:perl-module-digest += "perl-module-warnings"
296RDEPENDS:perl-module-digest-sha += "perl-module-digest-base" 302RDEPENDS:perl-module-digest-sha += "perl-module-digest-base"
297RDEPENDS:perl-module-digest-sha += "perl-module-dynaloader" 303RDEPENDS:perl-module-digest-sha += "perl-module-dynaloader"
298RDEPENDS:perl-module-digest-sha += "perl-module-exporter" 304RDEPENDS:perl-module-digest-sha += "perl-module-exporter"
@@ -444,9 +450,9 @@ RDEPENDS:perl-module-errno += "perl-module-strict"
444RDEPENDS:perl-module-experimental += "perl-module-strict" 450RDEPENDS:perl-module-experimental += "perl-module-strict"
445RDEPENDS:perl-module-experimental += "perl-module-version" 451RDEPENDS:perl-module-experimental += "perl-module-version"
446RDEPENDS:perl-module-experimental += "perl-module-warnings" 452RDEPENDS:perl-module-experimental += "perl-module-warnings"
447RDEPENDS:perl-module-exporter-heavy += "perl-module-exporter"
448RDEPENDS:perl-module-exporter-heavy += "perl-module-strict" 453RDEPENDS:perl-module-exporter-heavy += "perl-module-strict"
449RDEPENDS:perl-module-exporter += "perl-module-exporter-heavy" 454RDEPENDS:perl-module-exporter += "perl-module-exporter-heavy"
455RDEPENDS:perl-module-exporter += "perl-module-strict"
450RDEPENDS:perl-module-extutils-cbuilder-base += "perl-module-config" 456RDEPENDS:perl-module-extutils-cbuilder-base += "perl-module-config"
451RDEPENDS:perl-module-extutils-cbuilder-base += "perl-module-cwd" 457RDEPENDS:perl-module-extutils-cbuilder-base += "perl-module-cwd"
452RDEPENDS:perl-module-extutils-cbuilder-base += "perl-module-dynaloader" 458RDEPENDS:perl-module-extutils-cbuilder-base += "perl-module-dynaloader"
@@ -511,6 +517,7 @@ RDEPENDS:perl-module-extutils-command += "perl-module-file-find"
511RDEPENDS:perl-module-extutils-command += "perl-module-file-path" 517RDEPENDS:perl-module-extutils-command += "perl-module-file-path"
512RDEPENDS:perl-module-extutils-command += "perl-module-strict" 518RDEPENDS:perl-module-extutils-command += "perl-module-strict"
513RDEPENDS:perl-module-extutils-command += "perl-module-vars" 519RDEPENDS:perl-module-extutils-command += "perl-module-vars"
520RDEPENDS:perl-module-extutils-command += "perl-module-warnings"
514RDEPENDS:perl-module-extutils-constant-base += "perl-module-constant" 521RDEPENDS:perl-module-extutils-constant-base += "perl-module-constant"
515RDEPENDS:perl-module-extutils-constant-base += "perl-module-extutils-constant-utils" 522RDEPENDS:perl-module-extutils-constant-base += "perl-module-extutils-constant-utils"
516RDEPENDS:perl-module-extutils-constant-base += "perl-module-strict" 523RDEPENDS:perl-module-extutils-constant-base += "perl-module-strict"
@@ -550,7 +557,6 @@ RDEPENDS:perl-module-extutils-installed += "perl-module-extutils-packlist"
550RDEPENDS:perl-module-extutils-installed += "perl-module-file-basename" 557RDEPENDS:perl-module-extutils-installed += "perl-module-file-basename"
551RDEPENDS:perl-module-extutils-installed += "perl-module-file-find" 558RDEPENDS:perl-module-extutils-installed += "perl-module-file-find"
552RDEPENDS:perl-module-extutils-installed += "perl-module-strict" 559RDEPENDS:perl-module-extutils-installed += "perl-module-strict"
553RDEPENDS:perl-module-extutils-installed += "perl-module-vars"
554RDEPENDS:perl-module-extutils-install += "perl-module-autosplit" 560RDEPENDS:perl-module-extutils-install += "perl-module-autosplit"
555RDEPENDS:perl-module-extutils-install += "perl-module-config" 561RDEPENDS:perl-module-extutils-install += "perl-module-config"
556RDEPENDS:perl-module-extutils-install += "perl-module-cwd" 562RDEPENDS:perl-module-extutils-install += "perl-module-cwd"
@@ -570,13 +576,16 @@ RDEPENDS:perl-module-extutils-liblist-kid += "perl-module-text-parsewords"
570RDEPENDS:perl-module-extutils-liblist-kid += "perl-module-warnings" 576RDEPENDS:perl-module-extutils-liblist-kid += "perl-module-warnings"
571RDEPENDS:perl-module-extutils-liblist += "perl-module-extutils-liblist-kid" 577RDEPENDS:perl-module-extutils-liblist += "perl-module-extutils-liblist-kid"
572RDEPENDS:perl-module-extutils-liblist += "perl-module-strict" 578RDEPENDS:perl-module-extutils-liblist += "perl-module-strict"
579RDEPENDS:perl-module-extutils-liblist += "perl-module-warnings"
573RDEPENDS:perl-module-extutils-makemaker-config += "perl-module-config" 580RDEPENDS:perl-module-extutils-makemaker-config += "perl-module-config"
574RDEPENDS:perl-module-extutils-makemaker-config += "perl-module-strict" 581RDEPENDS:perl-module-extutils-makemaker-config += "perl-module-strict"
582RDEPENDS:perl-module-extutils-makemaker-config += "perl-module-warnings"
575RDEPENDS:perl-module-extutils-makemaker-locale += "perl-module-base" 583RDEPENDS:perl-module-extutils-makemaker-locale += "perl-module-base"
576RDEPENDS:perl-module-extutils-makemaker-locale += "perl-module-encode" 584RDEPENDS:perl-module-extutils-makemaker-locale += "perl-module-encode"
577RDEPENDS:perl-module-extutils-makemaker-locale += "perl-module-encode-alias" 585RDEPENDS:perl-module-extutils-makemaker-locale += "perl-module-encode-alias"
578RDEPENDS:perl-module-extutils-makemaker-locale += "perl-module-i18n-langinfo" 586RDEPENDS:perl-module-extutils-makemaker-locale += "perl-module-i18n-langinfo"
579RDEPENDS:perl-module-extutils-makemaker-locale += "perl-module-strict" 587RDEPENDS:perl-module-extutils-makemaker-locale += "perl-module-strict"
588RDEPENDS:perl-module-extutils-makemaker-locale += "perl-module-warnings"
580RDEPENDS:perl-module-extutils-makemaker += "perl-module-b" 589RDEPENDS:perl-module-extutils-makemaker += "perl-module-b"
581RDEPENDS:perl-module-extutils-makemaker += "perl-module-cpan" 590RDEPENDS:perl-module-extutils-makemaker += "perl-module-cpan"
582RDEPENDS:perl-module-extutils-makemaker += "perl-module-cwd" 591RDEPENDS:perl-module-extutils-makemaker += "perl-module-cwd"
@@ -589,8 +598,10 @@ RDEPENDS:perl-module-extutils-makemaker += "perl-module-extutils-my"
589RDEPENDS:perl-module-extutils-makemaker += "perl-module-file-path" 598RDEPENDS:perl-module-extutils-makemaker += "perl-module-file-path"
590RDEPENDS:perl-module-extutils-makemaker += "perl-module-strict" 599RDEPENDS:perl-module-extutils-makemaker += "perl-module-strict"
591RDEPENDS:perl-module-extutils-makemaker += "perl-module-version" 600RDEPENDS:perl-module-extutils-makemaker += "perl-module-version"
601RDEPENDS:perl-module-extutils-makemaker += "perl-module-warnings"
592RDEPENDS:perl-module-extutils-makemaker-version += "perl-module-strict" 602RDEPENDS:perl-module-extutils-makemaker-version += "perl-module-strict"
593RDEPENDS:perl-module-extutils-makemaker-version += "perl-module-vars" 603RDEPENDS:perl-module-extutils-makemaker-version += "perl-module-vars"
604RDEPENDS:perl-module-extutils-makemaker-version += "perl-module-warnings"
594RDEPENDS:perl-module-extutils-manifest += "perl-module-config" 605RDEPENDS:perl-module-extutils-manifest += "perl-module-config"
595RDEPENDS:perl-module-extutils-manifest += "perl-module-exporter" 606RDEPENDS:perl-module-extutils-manifest += "perl-module-exporter"
596RDEPENDS:perl-module-extutils-manifest += "perl-module-file-basename" 607RDEPENDS:perl-module-extutils-manifest += "perl-module-file-basename"
@@ -606,12 +617,15 @@ RDEPENDS:perl-module-extutils-mkbootstrap += "perl-module-config"
606RDEPENDS:perl-module-extutils-mkbootstrap += "perl-module-dynaloader" 617RDEPENDS:perl-module-extutils-mkbootstrap += "perl-module-dynaloader"
607RDEPENDS:perl-module-extutils-mkbootstrap += "perl-module-exporter" 618RDEPENDS:perl-module-extutils-mkbootstrap += "perl-module-exporter"
608RDEPENDS:perl-module-extutils-mkbootstrap += "perl-module-strict" 619RDEPENDS:perl-module-extutils-mkbootstrap += "perl-module-strict"
620RDEPENDS:perl-module-extutils-mkbootstrap += "perl-module-warnings"
609RDEPENDS:perl-module-extutils-mksymlists += "perl-module-config" 621RDEPENDS:perl-module-extutils-mksymlists += "perl-module-config"
610RDEPENDS:perl-module-extutils-mksymlists += "perl-module-exporter" 622RDEPENDS:perl-module-extutils-mksymlists += "perl-module-exporter"
611RDEPENDS:perl-module-extutils-mksymlists += "perl-module-strict" 623RDEPENDS:perl-module-extutils-mksymlists += "perl-module-strict"
624RDEPENDS:perl-module-extutils-mksymlists += "perl-module-warnings"
612RDEPENDS:perl-module-extutils-mm-aix += "perl-module-extutils-makemaker-config" 625RDEPENDS:perl-module-extutils-mm-aix += "perl-module-extutils-makemaker-config"
613RDEPENDS:perl-module-extutils-mm-aix += "perl-module-extutils-mm-unix" 626RDEPENDS:perl-module-extutils-mm-aix += "perl-module-extutils-mm-unix"
614RDEPENDS:perl-module-extutils-mm-aix += "perl-module-strict" 627RDEPENDS:perl-module-extutils-mm-aix += "perl-module-strict"
628RDEPENDS:perl-module-extutils-mm-aix += "perl-module-warnings"
615RDEPENDS:perl-module-extutils-mm-any += "perl-module-autosplit" 629RDEPENDS:perl-module-extutils-mm-any += "perl-module-autosplit"
616RDEPENDS:perl-module-extutils-mm-any += "perl-module-cpan" 630RDEPENDS:perl-module-extutils-mm-any += "perl-module-cpan"
617RDEPENDS:perl-module-extutils-mm-any += "perl-module-data-dumper" 631RDEPENDS:perl-module-extutils-mm-any += "perl-module-data-dumper"
@@ -621,35 +635,49 @@ RDEPENDS:perl-module-extutils-mm-any += "perl-module-file-basename"
621RDEPENDS:perl-module-extutils-mm-any += "perl-module-file-find" 635RDEPENDS:perl-module-extutils-mm-any += "perl-module-file-find"
622RDEPENDS:perl-module-extutils-mm-any += "perl-module-strict" 636RDEPENDS:perl-module-extutils-mm-any += "perl-module-strict"
623RDEPENDS:perl-module-extutils-mm-any += "perl-module-version" 637RDEPENDS:perl-module-extutils-mm-any += "perl-module-version"
638RDEPENDS:perl-module-extutils-mm-any += "perl-module-warnings"
624RDEPENDS:perl-module-extutils-mm-beos += "perl-module-extutils-makemaker-config" 639RDEPENDS:perl-module-extutils-mm-beos += "perl-module-extutils-makemaker-config"
625RDEPENDS:perl-module-extutils-mm-beos += "perl-module-extutils-mm-any" 640RDEPENDS:perl-module-extutils-mm-beos += "perl-module-extutils-mm-any"
626RDEPENDS:perl-module-extutils-mm-beos += "perl-module-extutils-mm-unix" 641RDEPENDS:perl-module-extutils-mm-beos += "perl-module-extutils-mm-unix"
627RDEPENDS:perl-module-extutils-mm-beos += "perl-module-strict" 642RDEPENDS:perl-module-extutils-mm-beos += "perl-module-strict"
643RDEPENDS:perl-module-extutils-mm-beos += "perl-module-warnings"
628RDEPENDS:perl-module-extutils-mm-cygwin += "perl-module-extutils-makemaker-config" 644RDEPENDS:perl-module-extutils-mm-cygwin += "perl-module-extutils-makemaker-config"
629RDEPENDS:perl-module-extutils-mm-cygwin += "perl-module-extutils-mm-unix" 645RDEPENDS:perl-module-extutils-mm-cygwin += "perl-module-extutils-mm-unix"
630RDEPENDS:perl-module-extutils-mm-cygwin += "perl-module-extutils-mm-win32" 646RDEPENDS:perl-module-extutils-mm-cygwin += "perl-module-extutils-mm-win32"
631RDEPENDS:perl-module-extutils-mm-cygwin += "perl-module-strict" 647RDEPENDS:perl-module-extutils-mm-cygwin += "perl-module-strict"
648RDEPENDS:perl-module-extutils-mm-cygwin += "perl-module-warnings"
632RDEPENDS:perl-module-extutils-mm-darwin += "perl-module-extutils-mm-unix" 649RDEPENDS:perl-module-extutils-mm-darwin += "perl-module-extutils-mm-unix"
633RDEPENDS:perl-module-extutils-mm-darwin += "perl-module-strict" 650RDEPENDS:perl-module-extutils-mm-darwin += "perl-module-strict"
651RDEPENDS:perl-module-extutils-mm-darwin += "perl-module-warnings"
634RDEPENDS:perl-module-extutils-mm-dos += "perl-module-extutils-mm-any" 652RDEPENDS:perl-module-extutils-mm-dos += "perl-module-extutils-mm-any"
635RDEPENDS:perl-module-extutils-mm-dos += "perl-module-extutils-mm-unix" 653RDEPENDS:perl-module-extutils-mm-dos += "perl-module-extutils-mm-unix"
636RDEPENDS:perl-module-extutils-mm-dos += "perl-module-strict" 654RDEPENDS:perl-module-extutils-mm-dos += "perl-module-strict"
655RDEPENDS:perl-module-extutils-mm-dos += "perl-module-warnings"
637RDEPENDS:perl-module-extutils-mm-macos += "perl-module-strict" 656RDEPENDS:perl-module-extutils-mm-macos += "perl-module-strict"
657RDEPENDS:perl-module-extutils-mm-macos += "perl-module-warnings"
638RDEPENDS:perl-module-extutils-mm-nw5 += "perl-module-extutils-makemaker" 658RDEPENDS:perl-module-extutils-mm-nw5 += "perl-module-extutils-makemaker"
639RDEPENDS:perl-module-extutils-mm-nw5 += "perl-module-extutils-makemaker-config" 659RDEPENDS:perl-module-extutils-mm-nw5 += "perl-module-extutils-makemaker-config"
640RDEPENDS:perl-module-extutils-mm-nw5 += "perl-module-extutils-mm-win32" 660RDEPENDS:perl-module-extutils-mm-nw5 += "perl-module-extutils-mm-win32"
641RDEPENDS:perl-module-extutils-mm-nw5 += "perl-module-file-basename" 661RDEPENDS:perl-module-extutils-mm-nw5 += "perl-module-file-basename"
642RDEPENDS:perl-module-extutils-mm-nw5 += "perl-module-strict" 662RDEPENDS:perl-module-extutils-mm-nw5 += "perl-module-strict"
663RDEPENDS:perl-module-extutils-mm-nw5 += "perl-module-warnings"
643RDEPENDS:perl-module-extutils-mm-os2 += "perl-module-extutils-makemaker" 664RDEPENDS:perl-module-extutils-mm-os2 += "perl-module-extutils-makemaker"
644RDEPENDS:perl-module-extutils-mm-os2 += "perl-module-extutils-mm-any" 665RDEPENDS:perl-module-extutils-mm-os2 += "perl-module-extutils-mm-any"
645RDEPENDS:perl-module-extutils-mm-os2 += "perl-module-extutils-mm-unix" 666RDEPENDS:perl-module-extutils-mm-os2 += "perl-module-extutils-mm-unix"
646RDEPENDS:perl-module-extutils-mm-os2 += "perl-module-strict" 667RDEPENDS:perl-module-extutils-mm-os2 += "perl-module-strict"
668RDEPENDS:perl-module-extutils-mm-os2 += "perl-module-warnings"
669RDEPENDS:perl-module-extutils-mm-os390 += "perl-module-extutils-makemaker-config"
670RDEPENDS:perl-module-extutils-mm-os390 += "perl-module-extutils-mm-unix"
671RDEPENDS:perl-module-extutils-mm-os390 += "perl-module-strict"
672RDEPENDS:perl-module-extutils-mm-os390 += "perl-module-warnings"
647RDEPENDS:perl-module-extutils-mm += "perl-module-extutils-liblist" 673RDEPENDS:perl-module-extutils-mm += "perl-module-extutils-liblist"
648RDEPENDS:perl-module-extutils-mm += "perl-module-extutils-makemaker" 674RDEPENDS:perl-module-extutils-mm += "perl-module-extutils-makemaker"
649RDEPENDS:perl-module-extutils-mm += "perl-module-extutils-makemaker-config" 675RDEPENDS:perl-module-extutils-mm += "perl-module-extutils-makemaker-config"
650RDEPENDS:perl-module-extutils-mm += "perl-module-strict" 676RDEPENDS:perl-module-extutils-mm += "perl-module-strict"
677RDEPENDS:perl-module-extutils-mm += "perl-module-warnings"
651RDEPENDS:perl-module-extutils-mm-qnx += "perl-module-extutils-mm-unix" 678RDEPENDS:perl-module-extutils-mm-qnx += "perl-module-extutils-mm-unix"
652RDEPENDS:perl-module-extutils-mm-qnx += "perl-module-strict" 679RDEPENDS:perl-module-extutils-mm-qnx += "perl-module-strict"
680RDEPENDS:perl-module-extutils-mm-qnx += "perl-module-warnings"
653RDEPENDS:perl-module-extutils-mm-unix += "perl-module-cwd" 681RDEPENDS:perl-module-extutils-mm-unix += "perl-module-cwd"
654RDEPENDS:perl-module-extutils-mm-unix += "perl-module-encode" 682RDEPENDS:perl-module-extutils-mm-unix += "perl-module-encode"
655RDEPENDS:perl-module-extutils-mm-unix += "perl-module-extutils-liblist" 683RDEPENDS:perl-module-extutils-mm-unix += "perl-module-extutils-liblist"
@@ -661,8 +689,10 @@ RDEPENDS:perl-module-extutils-mm-unix += "perl-module-file-find"
661RDEPENDS:perl-module-extutils-mm-unix += "perl-module-strict" 689RDEPENDS:perl-module-extutils-mm-unix += "perl-module-strict"
662RDEPENDS:perl-module-extutils-mm-unix += "perl-module-vars" 690RDEPENDS:perl-module-extutils-mm-unix += "perl-module-vars"
663RDEPENDS:perl-module-extutils-mm-unix += "perl-module-version" 691RDEPENDS:perl-module-extutils-mm-unix += "perl-module-version"
692RDEPENDS:perl-module-extutils-mm-unix += "perl-module-warnings"
664RDEPENDS:perl-module-extutils-mm-uwin += "perl-module-extutils-mm-unix" 693RDEPENDS:perl-module-extutils-mm-uwin += "perl-module-extutils-mm-unix"
665RDEPENDS:perl-module-extutils-mm-uwin += "perl-module-strict" 694RDEPENDS:perl-module-extutils-mm-uwin += "perl-module-strict"
695RDEPENDS:perl-module-extutils-mm-uwin += "perl-module-warnings"
666RDEPENDS:perl-module-extutils-mm-vms += "perl-module-exporter" 696RDEPENDS:perl-module-extutils-mm-vms += "perl-module-exporter"
667RDEPENDS:perl-module-extutils-mm-vms += "perl-module-extutils-liblist-kid" 697RDEPENDS:perl-module-extutils-mm-vms += "perl-module-extutils-liblist-kid"
668RDEPENDS:perl-module-extutils-mm-vms += "perl-module-extutils-makemaker" 698RDEPENDS:perl-module-extutils-mm-vms += "perl-module-extutils-makemaker"
@@ -672,23 +702,26 @@ RDEPENDS:perl-module-extutils-mm-vms += "perl-module-extutils-mm-unix"
672RDEPENDS:perl-module-extutils-mm-vms += "perl-module-file-basename" 702RDEPENDS:perl-module-extutils-mm-vms += "perl-module-file-basename"
673RDEPENDS:perl-module-extutils-mm-vms += "perl-module-file-find" 703RDEPENDS:perl-module-extutils-mm-vms += "perl-module-file-find"
674RDEPENDS:perl-module-extutils-mm-vms += "perl-module-strict" 704RDEPENDS:perl-module-extutils-mm-vms += "perl-module-strict"
705RDEPENDS:perl-module-extutils-mm-vms += "perl-module-warnings"
675RDEPENDS:perl-module-extutils-mm-vos += "perl-module-extutils-mm-unix" 706RDEPENDS:perl-module-extutils-mm-vos += "perl-module-extutils-mm-unix"
676RDEPENDS:perl-module-extutils-mm-vos += "perl-module-strict" 707RDEPENDS:perl-module-extutils-mm-vos += "perl-module-strict"
708RDEPENDS:perl-module-extutils-mm-vos += "perl-module-warnings"
677RDEPENDS:perl-module-extutils-mm-win32 += "perl-module-extutils-makemaker" 709RDEPENDS:perl-module-extutils-mm-win32 += "perl-module-extutils-makemaker"
678RDEPENDS:perl-module-extutils-mm-win32 += "perl-module-extutils-makemaker-config" 710RDEPENDS:perl-module-extutils-mm-win32 += "perl-module-extutils-makemaker-config"
679RDEPENDS:perl-module-extutils-mm-win32 += "perl-module-extutils-mm-any" 711RDEPENDS:perl-module-extutils-mm-win32 += "perl-module-extutils-mm-any"
680RDEPENDS:perl-module-extutils-mm-win32 += "perl-module-extutils-mm-unix" 712RDEPENDS:perl-module-extutils-mm-win32 += "perl-module-extutils-mm-unix"
681RDEPENDS:perl-module-extutils-mm-win32 += "perl-module-file-basename" 713RDEPENDS:perl-module-extutils-mm-win32 += "perl-module-file-basename"
682RDEPENDS:perl-module-extutils-mm-win32 += "perl-module-strict" 714RDEPENDS:perl-module-extutils-mm-win32 += "perl-module-strict"
715RDEPENDS:perl-module-extutils-mm-win32 += "perl-module-warnings"
683RDEPENDS:perl-module-extutils-mm-win95 += "perl-module-extutils-makemaker-config" 716RDEPENDS:perl-module-extutils-mm-win95 += "perl-module-extutils-makemaker-config"
684RDEPENDS:perl-module-extutils-mm-win95 += "perl-module-extutils-mm-win32" 717RDEPENDS:perl-module-extutils-mm-win95 += "perl-module-extutils-mm-win32"
685RDEPENDS:perl-module-extutils-mm-win95 += "perl-module-strict" 718RDEPENDS:perl-module-extutils-mm-win95 += "perl-module-strict"
719RDEPENDS:perl-module-extutils-mm-win95 += "perl-module-warnings"
686RDEPENDS:perl-module-extutils-my += "perl-module-extutils-mm" 720RDEPENDS:perl-module-extutils-my += "perl-module-extutils-mm"
687RDEPENDS:perl-module-extutils-my += "perl-module-strict" 721RDEPENDS:perl-module-extutils-my += "perl-module-strict"
688RDEPENDS:perl-module-extutils-packlist += "perl-module-config" 722RDEPENDS:perl-module-extutils-packlist += "perl-module-config"
689RDEPENDS:perl-module-extutils-packlist += "perl-module-cwd" 723RDEPENDS:perl-module-extutils-packlist += "perl-module-cwd"
690RDEPENDS:perl-module-extutils-packlist += "perl-module-strict" 724RDEPENDS:perl-module-extutils-packlist += "perl-module-strict"
691RDEPENDS:perl-module-extutils-packlist += "perl-module-vars"
692RDEPENDS:perl-module-extutils-parsexs-constants += "perl-module-strict" 725RDEPENDS:perl-module-extutils-parsexs-constants += "perl-module-strict"
693RDEPENDS:perl-module-extutils-parsexs-constants += "perl-module-warnings" 726RDEPENDS:perl-module-extutils-parsexs-constants += "perl-module-warnings"
694RDEPENDS:perl-module-extutils-parsexs-countlines += "perl-module-strict" 727RDEPENDS:perl-module-extutils-parsexs-countlines += "perl-module-strict"
@@ -709,6 +742,9 @@ RDEPENDS:perl-module-extutils-parsexs-utilities += "perl-module-extutils-parsexs
709RDEPENDS:perl-module-extutils-parsexs-utilities += "perl-module-extutils-typemaps" 742RDEPENDS:perl-module-extutils-parsexs-utilities += "perl-module-extutils-typemaps"
710RDEPENDS:perl-module-extutils-parsexs-utilities += "perl-module-strict" 743RDEPENDS:perl-module-extutils-parsexs-utilities += "perl-module-strict"
711RDEPENDS:perl-module-extutils-parsexs-utilities += "perl-module-warnings" 744RDEPENDS:perl-module-extutils-parsexs-utilities += "perl-module-warnings"
745RDEPENDS:perl-module-extutils-pl2bat += "perl-module-config"
746RDEPENDS:perl-module-extutils-pl2bat += "perl-module-strict"
747RDEPENDS:perl-module-extutils-pl2bat += "perl-module-warnings"
712RDEPENDS:perl-module-extutils-testlib += "perl-module-cwd" 748RDEPENDS:perl-module-extutils-testlib += "perl-module-cwd"
713RDEPENDS:perl-module-extutils-testlib += "perl-module-lib" 749RDEPENDS:perl-module-extutils-testlib += "perl-module-lib"
714RDEPENDS:perl-module-extutils-testlib += "perl-module-strict" 750RDEPENDS:perl-module-extutils-testlib += "perl-module-strict"
@@ -829,6 +865,8 @@ RDEPENDS:perl-module-filter-util-call += "perl-module-xsloader"
829RDEPENDS:perl-module-findbin += "perl-module-cwd" 865RDEPENDS:perl-module-findbin += "perl-module-cwd"
830RDEPENDS:perl-module-findbin += "perl-module-exporter" 866RDEPENDS:perl-module-findbin += "perl-module-exporter"
831RDEPENDS:perl-module-findbin += "perl-module-file-basename" 867RDEPENDS:perl-module-findbin += "perl-module-file-basename"
868RDEPENDS:perl-module-findbin += "perl-module-strict"
869RDEPENDS:perl-module-findbin += "perl-module-warnings"
832RDEPENDS:perl-module-gdbm-file += "perl-module-exporter" 870RDEPENDS:perl-module-gdbm-file += "perl-module-exporter"
833RDEPENDS:perl-module-gdbm-file += "perl-module-strict" 871RDEPENDS:perl-module-gdbm-file += "perl-module-strict"
834RDEPENDS:perl-module-gdbm-file += "perl-module-tie-hash" 872RDEPENDS:perl-module-gdbm-file += "perl-module-tie-hash"
@@ -843,6 +881,8 @@ RDEPENDS:perl-module-getopt-long += "perl-module-text-parsewords"
843RDEPENDS:perl-module-getopt-long += "perl-module-vars" 881RDEPENDS:perl-module-getopt-long += "perl-module-vars"
844RDEPENDS:perl-module-getopt-long += "perl-module-warnings" 882RDEPENDS:perl-module-getopt-long += "perl-module-warnings"
845RDEPENDS:perl-module-getopt-std += "perl-module-exporter" 883RDEPENDS:perl-module-getopt-std += "perl-module-exporter"
884RDEPENDS:perl-module-getopt-std += "perl-module-strict"
885RDEPENDS:perl-module-getopt-std += "perl-module-warnings"
846RDEPENDS:perl-module-hash-util-fieldhash += "perl-module-exporter" 886RDEPENDS:perl-module-hash-util-fieldhash += "perl-module-exporter"
847RDEPENDS:perl-module-hash-util-fieldhash += "perl-module-strict" 887RDEPENDS:perl-module-hash-util-fieldhash += "perl-module-strict"
848RDEPENDS:perl-module-hash-util-fieldhash += "perl-module-warnings" 888RDEPENDS:perl-module-hash-util-fieldhash += "perl-module-warnings"
@@ -867,6 +907,7 @@ RDEPENDS:perl-module-i18n-langtags-detect += "perl-module-strict"
867RDEPENDS:perl-module-i18n-langtags-list += "perl-module-strict" 907RDEPENDS:perl-module-i18n-langtags-list += "perl-module-strict"
868RDEPENDS:perl-module-i18n-langtags += "perl-module-exporter" 908RDEPENDS:perl-module-i18n-langtags += "perl-module-exporter"
869RDEPENDS:perl-module-i18n-langtags += "perl-module-strict" 909RDEPENDS:perl-module-i18n-langtags += "perl-module-strict"
910RDEPENDS:perl-module-if += "perl-module-strict"
870RDEPENDS:perl-module-io-compress-adapter-bzip2 += "perl-module-bytes" 911RDEPENDS:perl-module-io-compress-adapter-bzip2 += "perl-module-bytes"
871RDEPENDS:perl-module-io-compress-adapter-bzip2 += "perl-module-compress-raw-bzip2" 912RDEPENDS:perl-module-io-compress-adapter-bzip2 += "perl-module-compress-raw-bzip2"
872RDEPENDS:perl-module-io-compress-adapter-bzip2 += "perl-module-io-compress-base-common" 913RDEPENDS:perl-module-io-compress-adapter-bzip2 += "perl-module-io-compress-base-common"
@@ -1105,7 +1146,7 @@ RDEPENDS:perl-module-io-zlib += "perl-module-fcntl"
1105RDEPENDS:perl-module-io-zlib += "perl-module-io-handle" 1146RDEPENDS:perl-module-io-zlib += "perl-module-io-handle"
1106RDEPENDS:perl-module-io-zlib += "perl-module-strict" 1147RDEPENDS:perl-module-io-zlib += "perl-module-strict"
1107RDEPENDS:perl-module-io-zlib += "perl-module-tie-handle" 1148RDEPENDS:perl-module-io-zlib += "perl-module-tie-handle"
1108RDEPENDS:perl-module-io-zlib += "perl-module-vars" 1149RDEPENDS:perl-module-io-zlib += "perl-module-warnings"
1109RDEPENDS:perl-module-ipc-cmd += "perl-module-constant" 1150RDEPENDS:perl-module-ipc-cmd += "perl-module-constant"
1110RDEPENDS:perl-module-ipc-cmd += "perl-module-exporter" 1151RDEPENDS:perl-module-ipc-cmd += "perl-module-exporter"
1111RDEPENDS:perl-module-ipc-cmd += "perl-module-extutils-makemaker" 1152RDEPENDS:perl-module-ipc-cmd += "perl-module-extutils-makemaker"
@@ -1144,10 +1185,10 @@ RDEPENDS:perl-module-ipc-sharedmem += "perl-module-ipc-sysv"
1144RDEPENDS:perl-module-ipc-sharedmem += "perl-module-strict" 1185RDEPENDS:perl-module-ipc-sharedmem += "perl-module-strict"
1145RDEPENDS:perl-module-ipc-sharedmem += "perl-module-vars" 1186RDEPENDS:perl-module-ipc-sharedmem += "perl-module-vars"
1146RDEPENDS:perl-module-ipc-sysv += "perl-module-config" 1187RDEPENDS:perl-module-ipc-sysv += "perl-module-config"
1147RDEPENDS:perl-module-ipc-sysv += "perl-module-dynaloader"
1148RDEPENDS:perl-module-ipc-sysv += "perl-module-exporter" 1188RDEPENDS:perl-module-ipc-sysv += "perl-module-exporter"
1149RDEPENDS:perl-module-ipc-sysv += "perl-module-strict" 1189RDEPENDS:perl-module-ipc-sysv += "perl-module-strict"
1150RDEPENDS:perl-module-ipc-sysv += "perl-module-vars" 1190RDEPENDS:perl-module-ipc-sysv += "perl-module-vars"
1191RDEPENDS:perl-module-ipc-sysv += "perl-module-xsloader"
1151RDEPENDS:perl-module-json-pp-boolean += "perl-module-overload" 1192RDEPENDS:perl-module-json-pp-boolean += "perl-module-overload"
1152RDEPENDS:perl-module-json-pp-boolean += "perl-module-strict" 1193RDEPENDS:perl-module-json-pp-boolean += "perl-module-strict"
1153RDEPENDS:perl-module-json-pp += "perl-module-b" 1194RDEPENDS:perl-module-json-pp += "perl-module-b"
@@ -1195,6 +1236,8 @@ RDEPENDS:perl-module-locale-maketext += "perl-module-strict"
1195RDEPENDS:perl-module-locale-maketext-simple += "perl-module-base" 1236RDEPENDS:perl-module-locale-maketext-simple += "perl-module-base"
1196RDEPENDS:perl-module-locale-maketext-simple += "perl-module-strict" 1237RDEPENDS:perl-module-locale-maketext-simple += "perl-module-strict"
1197RDEPENDS:perl-module-locale += "perl-module-config" 1238RDEPENDS:perl-module-locale += "perl-module-config"
1239RDEPENDS:perl-module-locale += "perl-module-strict"
1240RDEPENDS:perl-module-locale += "perl-module-warnings"
1198RDEPENDS:perl-module-math-bigfloat += "perl-module-exporter" 1241RDEPENDS:perl-module-math-bigfloat += "perl-module-exporter"
1199RDEPENDS:perl-module-math-bigfloat += "perl-module-math-bigint" 1242RDEPENDS:perl-module-math-bigfloat += "perl-module-math-bigint"
1200RDEPENDS:perl-module-math-bigfloat += "perl-module-math-complex" 1243RDEPENDS:perl-module-math-bigfloat += "perl-module-math-complex"
@@ -1251,12 +1294,12 @@ RDEPENDS:perl-module-memoize-sdbm-file += "perl-module-sdbm-file"
1251RDEPENDS:perl-module-memoize-storable += "perl-module-storable" 1294RDEPENDS:perl-module-memoize-storable += "perl-module-storable"
1252RDEPENDS:perl-module-mime-base64 += "perl-module-exporter" 1295RDEPENDS:perl-module-mime-base64 += "perl-module-exporter"
1253RDEPENDS:perl-module-mime-base64 += "perl-module-strict" 1296RDEPENDS:perl-module-mime-base64 += "perl-module-strict"
1254RDEPENDS:perl-module-mime-base64 += "perl-module-vars" 1297RDEPENDS:perl-module-mime-base64 += "perl-module-warnings"
1255RDEPENDS:perl-module-mime-base64 += "perl-module-xsloader" 1298RDEPENDS:perl-module-mime-base64 += "perl-module-xsloader"
1256RDEPENDS:perl-module-mime-quotedprint += "perl-module-exporter" 1299RDEPENDS:perl-module-mime-quotedprint += "perl-module-exporter"
1257RDEPENDS:perl-module-mime-quotedprint += "perl-module-mime-base64" 1300RDEPENDS:perl-module-mime-quotedprint += "perl-module-mime-base64"
1258RDEPENDS:perl-module-mime-quotedprint += "perl-module-strict" 1301RDEPENDS:perl-module-mime-quotedprint += "perl-module-strict"
1259RDEPENDS:perl-module-mime-quotedprint += "perl-module-vars" 1302RDEPENDS:perl-module-mime-quotedprint += "perl-module-warnings"
1260RDEPENDS:perl-module-mro += "perl-module-strict" 1303RDEPENDS:perl-module-mro += "perl-module-strict"
1261RDEPENDS:perl-module-mro += "perl-module-warnings" 1304RDEPENDS:perl-module-mro += "perl-module-warnings"
1262RDEPENDS:perl-module-mro += "perl-module-xsloader" 1305RDEPENDS:perl-module-mro += "perl-module-xsloader"
@@ -1331,6 +1374,7 @@ RDEPENDS:perl-module-net-ping += "perl-module-posix"
1331RDEPENDS:perl-module-net-ping += "perl-module-socket" 1374RDEPENDS:perl-module-net-ping += "perl-module-socket"
1332RDEPENDS:perl-module-net-ping += "perl-module-strict" 1375RDEPENDS:perl-module-net-ping += "perl-module-strict"
1333RDEPENDS:perl-module-net-ping += "perl-module-time-hires" 1376RDEPENDS:perl-module-net-ping += "perl-module-time-hires"
1377RDEPENDS:perl-module-net-ping += "perl-module-vars"
1334RDEPENDS:perl-module-net-pop3 += "perl-module-io-socket" 1378RDEPENDS:perl-module-net-pop3 += "perl-module-io-socket"
1335RDEPENDS:perl-module-net-pop3 += "perl-module-io-socket-ip" 1379RDEPENDS:perl-module-net-pop3 += "perl-module-io-socket-ip"
1336RDEPENDS:perl-module-net-pop3 += "perl-module-mime-base64" 1380RDEPENDS:perl-module-net-pop3 += "perl-module-mime-base64"
@@ -1376,6 +1420,7 @@ RDEPENDS:perl-module-ops += "perl-module-opcode"
1376RDEPENDS:perl-module-overloading += "perl-module-overload-numbers" 1420RDEPENDS:perl-module-overloading += "perl-module-overload-numbers"
1377RDEPENDS:perl-module-overloading += "perl-module-warnings" 1421RDEPENDS:perl-module-overloading += "perl-module-warnings"
1378RDEPENDS:perl-module-overload += "perl-module-mro" 1422RDEPENDS:perl-module-overload += "perl-module-mro"
1423RDEPENDS:perl-module-overload += "perl-module-strict"
1379RDEPENDS:perl-module-overload += "perl-module-warnings-register" 1424RDEPENDS:perl-module-overload += "perl-module-warnings-register"
1380RDEPENDS:perl-module-params-check += "perl-module-exporter" 1425RDEPENDS:perl-module-params-check += "perl-module-exporter"
1381RDEPENDS:perl-module-params-check += "perl-module-locale-maketext-simple" 1426RDEPENDS:perl-module-params-check += "perl-module-locale-maketext-simple"
@@ -1585,7 +1630,6 @@ RDEPENDS:perl-module-pod-text-termcap += "perl-module-warnings"
1585RDEPENDS:perl-module-pod-usage += "perl-module-config" 1630RDEPENDS:perl-module-pod-usage += "perl-module-config"
1586RDEPENDS:perl-module-pod-usage += "perl-module-exporter" 1631RDEPENDS:perl-module-pod-usage += "perl-module-exporter"
1587RDEPENDS:perl-module-pod-usage += "perl-module-strict" 1632RDEPENDS:perl-module-pod-usage += "perl-module-strict"
1588RDEPENDS:perl-module-pod-usage += "perl-module-vars"
1589RDEPENDS:perl-module-posix += "perl-module-exporter" 1633RDEPENDS:perl-module-posix += "perl-module-exporter"
1590RDEPENDS:perl-module-posix += "perl-module-fcntl" 1634RDEPENDS:perl-module-posix += "perl-module-fcntl"
1591RDEPENDS:perl-module-posix += "perl-module-strict" 1635RDEPENDS:perl-module-posix += "perl-module-strict"
@@ -1619,6 +1663,8 @@ RDEPENDS:perl-module-socket += "perl-module-xsloader"
1619RDEPENDS:perl-module-sort += "perl-module-strict" 1663RDEPENDS:perl-module-sort += "perl-module-strict"
1620RDEPENDS:perl-module-storable += "perl-module-exporter" 1664RDEPENDS:perl-module-storable += "perl-module-exporter"
1621RDEPENDS:perl-module-storable += "perl-module-io-file" 1665RDEPENDS:perl-module-storable += "perl-module-io-file"
1666RDEPENDS:perl-module-subs += "perl-module-strict"
1667RDEPENDS:perl-module-subs += "perl-module-warnings"
1622RDEPENDS:perl-module-sub-util += "perl-module-exporter" 1668RDEPENDS:perl-module-sub-util += "perl-module-exporter"
1623RDEPENDS:perl-module-sub-util += "perl-module-list-util" 1669RDEPENDS:perl-module-sub-util += "perl-module-list-util"
1624RDEPENDS:perl-module-sub-util += "perl-module-strict" 1670RDEPENDS:perl-module-sub-util += "perl-module-strict"
@@ -1838,7 +1884,251 @@ RDEPENDS:perl-module-term-complete += "perl-module-exporter"
1838RDEPENDS:perl-module-term-complete += "perl-module-strict" 1884RDEPENDS:perl-module-term-complete += "perl-module-strict"
1839RDEPENDS:perl-module-term-readline += "perl-module-strict" 1885RDEPENDS:perl-module-term-readline += "perl-module-strict"
1840RDEPENDS:perl-module-term-readline += "perl-module-term-cap" 1886RDEPENDS:perl-module-term-readline += "perl-module-term-cap"
1887RDEPENDS:perl-module-test2-api-breakage += "perl-module-strict"
1888RDEPENDS:perl-module-test2-api-breakage += "perl-module-test2-util"
1889RDEPENDS:perl-module-test2-api-breakage += "perl-module-warnings"
1890RDEPENDS:perl-module-test2-api-context += "perl-module-strict"
1891RDEPENDS:perl-module-test2-api-context += "perl-module-test2-api"
1892RDEPENDS:perl-module-test2-api-context += "perl-module-test2-eventfacet-trace"
1893RDEPENDS:perl-module-test2-api-context += "perl-module-test2-util"
1894RDEPENDS:perl-module-test2-api-context += "perl-module-test2-util-externalmeta"
1895RDEPENDS:perl-module-test2-api-context += "perl-module-test2-util-hashbase"
1896RDEPENDS:perl-module-test2-api-context += "perl-module-warnings"
1897RDEPENDS:perl-module-test2-api-instance += "perl-module-strict"
1898RDEPENDS:perl-module-test2-api-instance += "perl-module-test2-api-stack"
1899RDEPENDS:perl-module-test2-api-instance += "perl-module-test2-eventfacet-trace"
1900RDEPENDS:perl-module-test2-api-instance += "perl-module-test2-util"
1901RDEPENDS:perl-module-test2-api-instance += "perl-module-test2-util-hashbase"
1902RDEPENDS:perl-module-test2-api-instance += "perl-module-warnings"
1903RDEPENDS:perl-module-test2-api-interceptresult-event += "perl-module-list-util"
1904RDEPENDS:perl-module-test2-api-interceptresult-event += "perl-module-storable"
1905RDEPENDS:perl-module-test2-api-interceptresult-event += "perl-module-strict"
1906RDEPENDS:perl-module-test2-api-interceptresult-event += "perl-module-test2-api-interceptresult-facet"
1907RDEPENDS:perl-module-test2-api-interceptresult-event += "perl-module-test2-api-interceptresult-hub"
1908RDEPENDS:perl-module-test2-api-interceptresult-event += "perl-module-test2-util"
1909RDEPENDS:perl-module-test2-api-interceptresult-event += "perl-module-test2-util-hashbase"
1910RDEPENDS:perl-module-test2-api-interceptresult-event += "perl-module-warnings"
1911RDEPENDS:perl-module-test2-api-interceptresult-facet += "perl-module-strict"
1912RDEPENDS:perl-module-test2-api-interceptresult-facet += "perl-module-test2-eventfacet"
1913RDEPENDS:perl-module-test2-api-interceptresult-facet += "perl-module-warnings"
1914RDEPENDS:perl-module-test2-api-interceptresult-hub += "perl-module-strict"
1915RDEPENDS:perl-module-test2-api-interceptresult-hub += "perl-module-test2-util-hashbase"
1916RDEPENDS:perl-module-test2-api-interceptresult-hub += "perl-module-warnings"
1917RDEPENDS:perl-module-test2-api-interceptresult += "perl-module-storable"
1918RDEPENDS:perl-module-test2-api-interceptresult += "perl-module-strict"
1919RDEPENDS:perl-module-test2-api-interceptresult += "perl-module-test2-api-interceptresult-event"
1920RDEPENDS:perl-module-test2-api-interceptresult += "perl-module-test2-api-interceptresult-hub"
1921RDEPENDS:perl-module-test2-api-interceptresult += "perl-module-test2-api-interceptresult-squasher"
1922RDEPENDS:perl-module-test2-api-interceptresult += "perl-module-test2-util"
1923RDEPENDS:perl-module-test2-api-interceptresult += "perl-module-warnings"
1924RDEPENDS:perl-module-test2-api-interceptresult-squasher += "perl-module-list-util"
1925RDEPENDS:perl-module-test2-api-interceptresult-squasher += "perl-module-strict"
1926RDEPENDS:perl-module-test2-api-interceptresult-squasher += "perl-module-test2-util-hashbase"
1927RDEPENDS:perl-module-test2-api-interceptresult-squasher += "perl-module-warnings"
1928RDEPENDS:perl-module-test2-api += "perl-module-strict"
1929RDEPENDS:perl-module-test2-api += "perl-module-test2-api-context"
1930RDEPENDS:perl-module-test2-api += "perl-module-test2-api-interceptresult"
1931RDEPENDS:perl-module-test2-api += "perl-module-test2-event-bail"
1932RDEPENDS:perl-module-test2-api += "perl-module-test2-event-diag"
1933RDEPENDS:perl-module-test2-api += "perl-module-test2-event-exception"
1934RDEPENDS:perl-module-test2-api += "perl-module-test2-eventfacet-trace"
1935RDEPENDS:perl-module-test2-api += "perl-module-test2-event-note"
1936RDEPENDS:perl-module-test2-api += "perl-module-test2-event-ok"
1937RDEPENDS:perl-module-test2-api += "perl-module-test2-event-plan"
1938RDEPENDS:perl-module-test2-api += "perl-module-test2-event-skip"
1939RDEPENDS:perl-module-test2-api += "perl-module-test2-event-subtest"
1940RDEPENDS:perl-module-test2-api += "perl-module-test2-event-waiting"
1941RDEPENDS:perl-module-test2-api += "perl-module-test2-hub-interceptor"
1942RDEPENDS:perl-module-test2-api += "perl-module-test2-hub-interceptor-terminator"
1943RDEPENDS:perl-module-test2-api += "perl-module-test2-hub-subtest"
1944RDEPENDS:perl-module-test2-api += "perl-module-test2-util"
1945RDEPENDS:perl-module-test2-api += "perl-module-test2-util-trace"
1946RDEPENDS:perl-module-test2-api += "perl-module-warnings"
1947RDEPENDS:perl-module-test2-api-stack += "perl-module-strict"
1948RDEPENDS:perl-module-test2-api-stack += "perl-module-test2-api"
1949RDEPENDS:perl-module-test2-api-stack += "perl-module-test2-hub"
1950RDEPENDS:perl-module-test2-api-stack += "perl-module-warnings"
1951RDEPENDS:perl-module-test2-event-bail += "perl-module-strict"
1952RDEPENDS:perl-module-test2-event-bail += "perl-module-test2-util-hashbase"
1953RDEPENDS:perl-module-test2-event-bail += "perl-module-warnings"
1954RDEPENDS:perl-module-test2-event-diag += "perl-module-strict"
1955RDEPENDS:perl-module-test2-event-diag += "perl-module-test2-util-hashbase"
1956RDEPENDS:perl-module-test2-event-diag += "perl-module-warnings"
1957RDEPENDS:perl-module-test2-event-encoding += "perl-module-strict"
1958RDEPENDS:perl-module-test2-event-encoding += "perl-module-test2-util-hashbase"
1959RDEPENDS:perl-module-test2-event-encoding += "perl-module-warnings"
1960RDEPENDS:perl-module-test2-event-exception += "perl-module-strict"
1961RDEPENDS:perl-module-test2-event-exception += "perl-module-test2-util-hashbase"
1962RDEPENDS:perl-module-test2-event-exception += "perl-module-warnings"
1963RDEPENDS:perl-module-test2-eventfacet-about += "perl-module-strict"
1964RDEPENDS:perl-module-test2-eventfacet-about += "perl-module-test2-util-hashbase"
1965RDEPENDS:perl-module-test2-eventfacet-about += "perl-module-warnings"
1966RDEPENDS:perl-module-test2-eventfacet-amnesty += "perl-module-strict"
1967RDEPENDS:perl-module-test2-eventfacet-amnesty += "perl-module-test2-util-hashbase"
1968RDEPENDS:perl-module-test2-eventfacet-amnesty += "perl-module-warnings"
1969RDEPENDS:perl-module-test2-eventfacet-assert += "perl-module-strict"
1970RDEPENDS:perl-module-test2-eventfacet-assert += "perl-module-test2-util-hashbase"
1971RDEPENDS:perl-module-test2-eventfacet-assert += "perl-module-warnings"
1972RDEPENDS:perl-module-test2-eventfacet-control += "perl-module-strict"
1973RDEPENDS:perl-module-test2-eventfacet-control += "perl-module-test2-util-hashbase"
1974RDEPENDS:perl-module-test2-eventfacet-control += "perl-module-warnings"
1975RDEPENDS:perl-module-test2-eventfacet-error += "perl-module-strict"
1976RDEPENDS:perl-module-test2-eventfacet-error += "perl-module-test2-util-hashbase"
1977RDEPENDS:perl-module-test2-eventfacet-error += "perl-module-warnings"
1978RDEPENDS:perl-module-test2-eventfacet-hub += "perl-module-strict"
1979RDEPENDS:perl-module-test2-eventfacet-hub += "perl-module-test2-util-hashbase"
1980RDEPENDS:perl-module-test2-eventfacet-hub += "perl-module-warnings"
1981RDEPENDS:perl-module-test2-eventfacet-info += "perl-module-strict"
1982RDEPENDS:perl-module-test2-eventfacet-info += "perl-module-test2-util-hashbase"
1983RDEPENDS:perl-module-test2-eventfacet-info += "perl-module-warnings"
1984RDEPENDS:perl-module-test2-eventfacet-info-table += "perl-module-strict"
1985RDEPENDS:perl-module-test2-eventfacet-info-table += "perl-module-test2-util-hashbase"
1986RDEPENDS:perl-module-test2-eventfacet-info-table += "perl-module-warnings"
1987RDEPENDS:perl-module-test2-eventfacet-meta += "perl-module-strict"
1988RDEPENDS:perl-module-test2-eventfacet-meta += "perl-module-vars"
1989RDEPENDS:perl-module-test2-eventfacet-meta += "perl-module-warnings"
1990RDEPENDS:perl-module-test2-eventfacet-parent += "perl-module-strict"
1991RDEPENDS:perl-module-test2-eventfacet-parent += "perl-module-test2-util-hashbase"
1992RDEPENDS:perl-module-test2-eventfacet-parent += "perl-module-warnings"
1993RDEPENDS:perl-module-test2-eventfacet += "perl-module-strict"
1994RDEPENDS:perl-module-test2-eventfacet += "perl-module-test2-util-hashbase"
1995RDEPENDS:perl-module-test2-eventfacet += "perl-module-warnings"
1996RDEPENDS:perl-module-test2-eventfacet-plan += "perl-module-strict"
1997RDEPENDS:perl-module-test2-eventfacet-plan += "perl-module-test2-util-hashbase"
1998RDEPENDS:perl-module-test2-eventfacet-plan += "perl-module-warnings"
1999RDEPENDS:perl-module-test2-eventfacet-render += "perl-module-strict"
2000RDEPENDS:perl-module-test2-eventfacet-render += "perl-module-test2-util-hashbase"
2001RDEPENDS:perl-module-test2-eventfacet-render += "perl-module-warnings"
2002RDEPENDS:perl-module-test2-eventfacet-trace += "perl-module-strict"
2003RDEPENDS:perl-module-test2-eventfacet-trace += "perl-module-test2-util"
2004RDEPENDS:perl-module-test2-eventfacet-trace += "perl-module-test2-util-hashbase"
2005RDEPENDS:perl-module-test2-eventfacet-trace += "perl-module-warnings"
2006RDEPENDS:perl-module-test2-event-fail += "perl-module-strict"
2007RDEPENDS:perl-module-test2-event-fail += "perl-module-test2-event"
2008RDEPENDS:perl-module-test2-event-fail += "perl-module-test2-eventfacet-info"
2009RDEPENDS:perl-module-test2-event-fail += "perl-module-test2-util-hashbase"
2010RDEPENDS:perl-module-test2-event-fail += "perl-module-warnings"
2011RDEPENDS:perl-module-test2-event-generic += "perl-module-strict"
2012RDEPENDS:perl-module-test2-event-generic += "perl-module-test2-util-hashbase"
2013RDEPENDS:perl-module-test2-event-generic += "perl-module-warnings"
2014RDEPENDS:perl-module-test2-event-note += "perl-module-strict"
2015RDEPENDS:perl-module-test2-event-note += "perl-module-test2-util-hashbase"
2016RDEPENDS:perl-module-test2-event-note += "perl-module-warnings"
2017RDEPENDS:perl-module-test2-event-ok += "perl-module-strict"
2018RDEPENDS:perl-module-test2-event-ok += "perl-module-test2-util-hashbase"
2019RDEPENDS:perl-module-test2-event-ok += "perl-module-warnings"
2020RDEPENDS:perl-module-test2-event-pass += "perl-module-strict"
2021RDEPENDS:perl-module-test2-event-pass += "perl-module-test2-event"
2022RDEPENDS:perl-module-test2-event-pass += "perl-module-test2-eventfacet-info"
2023RDEPENDS:perl-module-test2-event-pass += "perl-module-test2-util-hashbase"
2024RDEPENDS:perl-module-test2-event-pass += "perl-module-warnings"
2025RDEPENDS:perl-module-test2-event += "perl-module-strict"
2026RDEPENDS:perl-module-test2-event += "perl-module-test2-eventfacet-about"
2027RDEPENDS:perl-module-test2-event += "perl-module-test2-eventfacet-amnesty"
2028RDEPENDS:perl-module-test2-event += "perl-module-test2-eventfacet-assert"
2029RDEPENDS:perl-module-test2-event += "perl-module-test2-eventfacet-control"
2030RDEPENDS:perl-module-test2-event += "perl-module-test2-eventfacet-error"
2031RDEPENDS:perl-module-test2-event += "perl-module-test2-eventfacet-hub"
2032RDEPENDS:perl-module-test2-event += "perl-module-test2-eventfacet-info"
2033RDEPENDS:perl-module-test2-event += "perl-module-test2-eventfacet-meta"
2034RDEPENDS:perl-module-test2-event += "perl-module-test2-eventfacet-parent"
2035RDEPENDS:perl-module-test2-event += "perl-module-test2-eventfacet-plan"
2036RDEPENDS:perl-module-test2-event += "perl-module-test2-eventfacet-trace"
2037RDEPENDS:perl-module-test2-event += "perl-module-test2-util"
2038RDEPENDS:perl-module-test2-event += "perl-module-test2-util-externalmeta"
2039RDEPENDS:perl-module-test2-event += "perl-module-test2-util-hashbase"
2040RDEPENDS:perl-module-test2-event += "perl-module-test2-util-trace"
2041RDEPENDS:perl-module-test2-event += "perl-module-warnings"
2042RDEPENDS:perl-module-test2-event-plan += "perl-module-strict"
2043RDEPENDS:perl-module-test2-event-plan += "perl-module-test2-util-hashbase"
2044RDEPENDS:perl-module-test2-event-plan += "perl-module-warnings"
2045RDEPENDS:perl-module-test2-event-skip += "perl-module-strict"
2046RDEPENDS:perl-module-test2-event-skip += "perl-module-test2-util-hashbase"
2047RDEPENDS:perl-module-test2-event-skip += "perl-module-warnings"
2048RDEPENDS:perl-module-test2-event-subtest += "perl-module-strict"
2049RDEPENDS:perl-module-test2-event-subtest += "perl-module-test2-util-hashbase"
2050RDEPENDS:perl-module-test2-event-subtest += "perl-module-warnings"
2051RDEPENDS:perl-module-test2-event-tap-version += "perl-module-strict"
2052RDEPENDS:perl-module-test2-event-tap-version += "perl-module-test2-util-hashbase"
2053RDEPENDS:perl-module-test2-event-tap-version += "perl-module-warnings"
2054RDEPENDS:perl-module-test2-event-v2 += "perl-module-strict"
2055RDEPENDS:perl-module-test2-event-v2 += "perl-module-test2-util-facets2legacy"
2056RDEPENDS:perl-module-test2-event-v2 += "perl-module-test2-util-hashbase"
2057RDEPENDS:perl-module-test2-event-v2 += "perl-module-warnings"
2058RDEPENDS:perl-module-test2-event-waiting += "perl-module-strict"
2059RDEPENDS:perl-module-test2-event-waiting += "perl-module-test2-util-hashbase"
2060RDEPENDS:perl-module-test2-event-waiting += "perl-module-warnings"
2061RDEPENDS:perl-module-test2-formatter += "perl-module-strict"
2062RDEPENDS:perl-module-test2-formatter += "perl-module-test2-api"
2063RDEPENDS:perl-module-test2-formatter += "perl-module-warnings"
2064RDEPENDS:perl-module-test2-formatter-tap += "perl-module-data-dumper"
2065RDEPENDS:perl-module-test2-formatter-tap += "perl-module-strict"
2066RDEPENDS:perl-module-test2-formatter-tap += "perl-module-test2-api"
2067RDEPENDS:perl-module-test2-formatter-tap += "perl-module-test2-util"
2068RDEPENDS:perl-module-test2-formatter-tap += "perl-module-test2-util-hashbase"
2069RDEPENDS:perl-module-test2-formatter-tap += "perl-module-warnings"
2070RDEPENDS:perl-module-test2-hub-interceptor += "perl-module-strict"
2071RDEPENDS:perl-module-test2-hub-interceptor += "perl-module-test2-hub-interceptor-terminator"
2072RDEPENDS:perl-module-test2-hub-interceptor += "perl-module-test2-util-hashbase"
2073RDEPENDS:perl-module-test2-hub-interceptor += "perl-module-warnings"
2074RDEPENDS:perl-module-test2-hub-interceptor-terminator += "perl-module-strict"
2075RDEPENDS:perl-module-test2-hub-interceptor-terminator += "perl-module-warnings"
2076RDEPENDS:perl-module-test2-hub += "perl-module-list-util"
2077RDEPENDS:perl-module-test2-hub += "perl-module-strict"
2078RDEPENDS:perl-module-test2-hub += "perl-module-test2-util"
2079RDEPENDS:perl-module-test2-hub += "perl-module-test2-util-externalmeta"
2080RDEPENDS:perl-module-test2-hub += "perl-module-test2-util-hashbase"
2081RDEPENDS:perl-module-test2-hub += "perl-module-warnings"
2082RDEPENDS:perl-module-test2-hub-subtest += "perl-module-strict"
2083RDEPENDS:perl-module-test2-hub-subtest += "perl-module-test2-util"
2084RDEPENDS:perl-module-test2-hub-subtest += "perl-module-test2-util-hashbase"
2085RDEPENDS:perl-module-test2-hub-subtest += "perl-module-warnings"
2086RDEPENDS:perl-module-test2-ipc-driver-files += "perl-module-data-dumper"
2087RDEPENDS:perl-module-test2-ipc-driver-files += "perl-module-file-temp"
2088RDEPENDS:perl-module-test2-ipc-driver-files += "perl-module-json-pp"
2089RDEPENDS:perl-module-test2-ipc-driver-files += "perl-module-posix"
2090RDEPENDS:perl-module-test2-ipc-driver-files += "perl-module-storable"
2091RDEPENDS:perl-module-test2-ipc-driver-files += "perl-module-strict"
2092RDEPENDS:perl-module-test2-ipc-driver-files += "perl-module-test2-api"
2093RDEPENDS:perl-module-test2-ipc-driver-files += "perl-module-test2-event-waiting"
2094RDEPENDS:perl-module-test2-ipc-driver-files += "perl-module-test2-util"
2095RDEPENDS:perl-module-test2-ipc-driver-files += "perl-module-test2-util-hashbase"
2096RDEPENDS:perl-module-test2-ipc-driver-files += "perl-module-warnings"
2097RDEPENDS:perl-module-test2-ipc-driver += "perl-module-strict"
2098RDEPENDS:perl-module-test2-ipc-driver += "perl-module-test2-api"
2099RDEPENDS:perl-module-test2-ipc-driver += "perl-module-test2-util-hashbase"
2100RDEPENDS:perl-module-test2-ipc-driver += "perl-module-warnings"
2101RDEPENDS:perl-module-test2-ipc += "perl-module-strict"
2102RDEPENDS:perl-module-test2-ipc += "perl-module-test2-api"
2103RDEPENDS:perl-module-test2-ipc += "perl-module-test2-api-instance"
2104RDEPENDS:perl-module-test2-ipc += "perl-module-test2-ipc-driver-files"
2105RDEPENDS:perl-module-test2-ipc += "perl-module-test2-util"
2106RDEPENDS:perl-module-test2-ipc += "perl-module-warnings"
2107RDEPENDS:perl-module-test2 += "perl-module-strict"
2108RDEPENDS:perl-module-test2 += "perl-module-warnings"
2109RDEPENDS:perl-module-test2-tools-tiny += "perl-module-data-dumper"
2110RDEPENDS:perl-module-test2-tools-tiny += "perl-module-strict"
2111RDEPENDS:perl-module-test2-tools-tiny += "perl-module-test2-api"
2112RDEPENDS:perl-module-test2-tools-tiny += "perl-module-test2-hub-interceptor"
2113RDEPENDS:perl-module-test2-tools-tiny += "perl-module-test2-hub-interceptor-terminator"
2114RDEPENDS:perl-module-test2-tools-tiny += "perl-module-test2-util"
2115RDEPENDS:perl-module-test2-tools-tiny += "perl-module-warnings"
2116RDEPENDS:perl-module-test2-util-externalmeta += "perl-module-strict"
2117RDEPENDS:perl-module-test2-util-externalmeta += "perl-module-warnings"
2118RDEPENDS:perl-module-test2-util-facets2legacy += "perl-module-base"
2119RDEPENDS:perl-module-test2-util-facets2legacy += "perl-module-strict"
2120RDEPENDS:perl-module-test2-util-facets2legacy += "perl-module-warnings"
2121RDEPENDS:perl-module-test2-util-hashbase += "perl-module-strict"
2122RDEPENDS:perl-module-test2-util-hashbase += "perl-module-warnings"
2123RDEPENDS:perl-module-test2-util += "perl-module-config"
2124RDEPENDS:perl-module-test2-util += "perl-module-posix"
2125RDEPENDS:perl-module-test2-util += "perl-module-strict"
2126RDEPENDS:perl-module-test2-util += "perl-module-warnings"
2127RDEPENDS:perl-module-test2-util-trace += "perl-module-strict"
2128RDEPENDS:perl-module-test2-util-trace += "perl-module-test2-eventfacet-trace"
2129RDEPENDS:perl-module-test2-util-trace += "perl-module-warnings"
1841RDEPENDS:perl-module-test-builder-formatter += "perl-module-strict" 2130RDEPENDS:perl-module-test-builder-formatter += "perl-module-strict"
2131RDEPENDS:perl-module-test-builder-formatter += "perl-module-test2-util-hashbase"
1842RDEPENDS:perl-module-test-builder-formatter += "perl-module-warnings" 2132RDEPENDS:perl-module-test-builder-formatter += "perl-module-warnings"
1843RDEPENDS:perl-module-test-builder-module += "perl-module-exporter" 2133RDEPENDS:perl-module-test-builder-module += "perl-module-exporter"
1844RDEPENDS:perl-module-test-builder-module += "perl-module-strict" 2134RDEPENDS:perl-module-test-builder-module += "perl-module-strict"
@@ -1846,6 +2136,12 @@ RDEPENDS:perl-module-test-builder-module += "perl-module-test-builder"
1846RDEPENDS:perl-module-test-builder += "perl-module-data-dumper" 2136RDEPENDS:perl-module-test-builder += "perl-module-data-dumper"
1847RDEPENDS:perl-module-test-builder += "perl-module-overload" 2137RDEPENDS:perl-module-test-builder += "perl-module-overload"
1848RDEPENDS:perl-module-test-builder += "perl-module-strict" 2138RDEPENDS:perl-module-test-builder += "perl-module-strict"
2139RDEPENDS:perl-module-test-builder += "perl-module-test2-api"
2140RDEPENDS:perl-module-test-builder += "perl-module-test2-event-subtest"
2141RDEPENDS:perl-module-test-builder += "perl-module-test2-hub-subtest"
2142RDEPENDS:perl-module-test-builder += "perl-module-test2-ipc"
2143RDEPENDS:perl-module-test-builder += "perl-module-test2-ipc-driver-files"
2144RDEPENDS:perl-module-test-builder += "perl-module-test2-util"
1849RDEPENDS:perl-module-test-builder += "perl-module-test-builder-formatter" 2145RDEPENDS:perl-module-test-builder += "perl-module-test-builder-formatter"
1850RDEPENDS:perl-module-test-builder += "perl-module-test-builder-tododiag" 2146RDEPENDS:perl-module-test-builder += "perl-module-test-builder-tododiag"
1851RDEPENDS:perl-module-test-builder += "perl-module-warnings" 2147RDEPENDS:perl-module-test-builder += "perl-module-warnings"
@@ -1893,7 +2189,6 @@ RDEPENDS:perl-module-test-tester += "perl-module-vars"
1893RDEPENDS:perl-module-text-abbrev += "perl-module-exporter" 2189RDEPENDS:perl-module-text-abbrev += "perl-module-exporter"
1894RDEPENDS:perl-module-text-balanced += "perl-module-exporter" 2190RDEPENDS:perl-module-text-balanced += "perl-module-exporter"
1895RDEPENDS:perl-module-text-balanced += "perl-module-overload" 2191RDEPENDS:perl-module-text-balanced += "perl-module-overload"
1896RDEPENDS:perl-module-text-balanced += "perl-module-selfloader"
1897RDEPENDS:perl-module-text-balanced += "perl-module-strict" 2192RDEPENDS:perl-module-text-balanced += "perl-module-strict"
1898RDEPENDS:perl-module-text-balanced += "perl-module-vars" 2193RDEPENDS:perl-module-text-balanced += "perl-module-vars"
1899RDEPENDS:perl-module-text-parsewords += "perl-module-exporter" 2194RDEPENDS:perl-module-text-parsewords += "perl-module-exporter"
@@ -1943,7 +2238,6 @@ RDEPENDS:perl-module-tie-refhash += "perl-module-config"
1943RDEPENDS:perl-module-tie-refhash += "perl-module-overload" 2238RDEPENDS:perl-module-tie-refhash += "perl-module-overload"
1944RDEPENDS:perl-module-tie-refhash += "perl-module-strict" 2239RDEPENDS:perl-module-tie-refhash += "perl-module-strict"
1945RDEPENDS:perl-module-tie-refhash += "perl-module-tie-hash" 2240RDEPENDS:perl-module-tie-refhash += "perl-module-tie-hash"
1946RDEPENDS:perl-module-tie-refhash += "perl-module-vars"
1947RDEPENDS:perl-module-tie-scalar += "perl-module-warnings-register" 2241RDEPENDS:perl-module-tie-scalar += "perl-module-warnings-register"
1948RDEPENDS:perl-module-tie-stdhandle += "perl-module-strict" 2242RDEPENDS:perl-module-tie-stdhandle += "perl-module-strict"
1949RDEPENDS:perl-module-tie-stdhandle += "perl-module-tie-handle" 2243RDEPENDS:perl-module-tie-stdhandle += "perl-module-tie-handle"
@@ -2018,6 +2312,8 @@ RDEPENDS:perl-module-user-pwent += "perl-module-config"
2018RDEPENDS:perl-module-user-pwent += "perl-module-exporter" 2312RDEPENDS:perl-module-user-pwent += "perl-module-exporter"
2019RDEPENDS:perl-module-user-pwent += "perl-module-strict" 2313RDEPENDS:perl-module-user-pwent += "perl-module-strict"
2020RDEPENDS:perl-module-user-pwent += "perl-module-warnings" 2314RDEPENDS:perl-module-user-pwent += "perl-module-warnings"
2315RDEPENDS:perl-module-utf8 += "perl-module-strict"
2316RDEPENDS:perl-module-utf8 += "perl-module-warnings"
2021RDEPENDS:perl-module-version += "perl-module-strict" 2317RDEPENDS:perl-module-version += "perl-module-strict"
2022RDEPENDS:perl-module-version += "perl-module-version-regex" 2318RDEPENDS:perl-module-version += "perl-module-version-regex"
2023RDEPENDS:perl-module-version += "perl-module-warnings-register" 2319RDEPENDS:perl-module-version += "perl-module-warnings-register"
diff --git a/meta/recipes-devtools/perl/libxml-parser-perl_2.46.bb b/meta/recipes-devtools/perl/libxml-parser-perl_2.46.bb
index 3b9206e984..7e72b70418 100644
--- a/meta/recipes-devtools/perl/libxml-parser-perl_2.46.bb
+++ b/meta/recipes-devtools/perl/libxml-parser-perl_2.46.bb
@@ -53,6 +53,7 @@ do_install_ptest() {
53 chown -R root:root ${D}${PTEST_PATH}/samples 53 chown -R root:root ${D}${PTEST_PATH}/samples
54} 54}
55 55
56RDEPENDS:${PN} += "perl-module-carp perl-module-file-spec"
56RDEPENDS:${PN}-ptest += "perl-module-filehandle perl-module-if perl-module-test perl-module-test-more" 57RDEPENDS:${PN}-ptest += "perl-module-filehandle perl-module-if perl-module-test perl-module-test-more"
57 58
58BBCLASSEXTEND="native nativesdk" 59BBCLASSEXTEND="native nativesdk"
diff --git a/meta/recipes-devtools/perl/perl_5.34.0.bb b/meta/recipes-devtools/perl/perl_5.34.0.bb
index 175db4ee31..0a1998a6f5 100644
--- a/meta/recipes-devtools/perl/perl_5.34.0.bb
+++ b/meta/recipes-devtools/perl/perl_5.34.0.bb
@@ -348,7 +348,15 @@ do_create_rdepends_inc() {
348 348
349# Some additional dependencies that the above doesn't manage to figure out 349# Some additional dependencies that the above doesn't manage to figure out
350RDEPENDS:${PN}-module-file-spec += "${PN}-module-file-spec-unix" 350RDEPENDS:${PN}-module-file-spec += "${PN}-module-file-spec-unix"
351RDEPENDS:${PN}-module-io-file += "${PN}-module-symbol"
351RDEPENDS:${PN}-module-math-bigint += "${PN}-module-math-bigint-calc" 352RDEPENDS:${PN}-module-math-bigint += "${PN}-module-math-bigint-calc"
353RDEPENDS:${PN}-module-test-builder += "${PN}-module-list-util"
354RDEPENDS:${PN}-module-test-builder += "${PN}-module-scalar-util"
355RDEPENDS:${PN}-module-test-builder-formatter += "${PN}-module-test2-formatter-tap"
356RDEPENDS:${PN}-module-test2-api += "${PN}-module-test2-event-fail"
357RDEPENDS:${PN}-module-test2-api += "${PN}-module-test2-event-pass"
358RDEPENDS:${PN}-module-test2-api += "${PN}-module-test2-event-v2"
359RDEPENDS:${PN}-module-test2-formatter-tap += "${PN}-module-test2-formatter"
352RDEPENDS:${PN}-module-thread-queue += "${PN}-module-attributes" 360RDEPENDS:${PN}-module-thread-queue += "${PN}-module-attributes"
353RDEPENDS:${PN}-module-overload += "${PN}-module-overloading" 361RDEPENDS:${PN}-module-overload += "${PN}-module-overloading"
354 362
@@ -358,12 +366,12 @@ EOPREAMBLE
358 cp -r packages-split packages-split.new && cd packages-split.new 366 cp -r packages-split packages-split.new && cd packages-split.new
359 find . -name \*.pm | xargs sed -i '/^=head/,/^=cut/d' 367 find . -name \*.pm | xargs sed -i '/^=head/,/^=cut/d'
360 egrep -r "^\s*(\<use .*|\<require .*);?" perl-module-* --include="*.pm" | \ 368 egrep -r "^\s*(\<use .*|\<require .*);?" perl-module-* --include="*.pm" | \
361 sed "s/\/.*\.pm: */ += /g;s/[\"\']//g;s/;.*/\"/g;s/+= .*\(require\|use\)\> */+= \"perl-module-/g;s/CPANPLUS::.*/cpanplus/g;s/CPAN::.*/cpan/g;s/::/-/g;s/ [^+\"].*//g;s/_/-/g;s/\.pl\"$/\"/;s/\"\?\$/\"/;s/(//;" | tr [:upper:] [:lower:] | \ 369 sed "s/\/.*\.pm: */ += /g;s/[\"\']//g;s/;.*/\"/g;s/+= .*\(require\|use\)\> */+= \"perl-module-/g;s/CPANPLUS::.*/cpanplus/g;s/CPAN::.*/cpan/g;s/::/-/g;s/ [^+\"].*//g;s/_/-/g;s/\.pl\"$/\"/;s/\"\?\$/\"/;s/(//;s/)//;" | tr [:upper:] [:lower:] | \
362 awk '{if ($3 != "\x22"$1"\x22"){ print $0}}'| \ 370 awk '{if ($3 != "\x22"$1"\x22"){ print $0}}'| \
363 grep -v -e "\-vms\-" -e module-5 -e "^$" -e "\\$" -e your -e tk -e autoperl -e html -e http -e parse-cpan -e perl-ostype -e ndbm-file -e module-mac -e fcgi -e lwp -e dbd -e dbix | \ 371 grep -v -e "\-vms\-" -e module-5 -e "^$" -e "\\$" -e your -e tk -e autoperl -e html -e http -e parse-cpan -e perl-ostype -e ndbm-file -e module-mac -e fcgi -e lwp -e dbd -e dbix | \
364 sort -u | \ 372 sort -u | \
365 sed 's/^/RDEPENDS:/;s/perl-module-/${PN}-module-/g;s/module-\(module-\)/\1/g;s/\(module-load\)-conditional/\1/g;s/encode-configlocal/&-pm/;' | \ 373 sed 's/^/RDEPENDS:/;s/perl-module-/${PN}-module-/g;s/module-\(module-\)/\1/g;s/\(module-load\)-conditional/\1/g;s/encode-configlocal/&-pm/;' | \
366 egrep -wv '=>|module-a|module-apache.?|module-apr|module-authen-sasl|module-b-asmdata|module-convert-ebcdic|module-devel-size|module-digest-perl-md5|module-dumpvalue|module-extutils-constant-aaargh56hash|module-extutils-xssymset|module-file-bsdglob|module-for|module-it|module-io-socket-inet6|module-io-socket-ssl|module-io-string|module-ipc-system-simple|module-lexical|module-local-lib|metadata|module-modperl-util|module-pluggable-object|module-test-builder-io-scalar|module-test2|module-text-unidecode|module-unicore|module-win32|objects\sload|syscall.ph|systeminfo.ph|%s' | \ 374 egrep -wv '=>|module-a|module-apache.?|module-apr|module-authen-sasl|module-b-asmdata|module-convert-ebcdic|module-devel-size|module-digest-perl-md5|module-dumpvalue|module-extutils-constant-aaargh56hash|module-extutils-xssymset|module-file-bsdglob|module-for|module-it|module-io-socket-inet6|module-io-socket-ssl|module-io-string|module-ipc-system-simple|module-lexical|module-local-lib|metadata|module-modperl-util|module-pluggable-object|module-test-builder-io-scalar|module-text-unidecode|module-unicore|module-win32|objects\sload|syscall.ph|systeminfo.ph|%s' | \
367 egrep -wv '=>|module-algorithm-diff|module-carp|module-c<extutils-mm-unix>|module-l<extutils-mm-unix>|module-encode-hanextra|module-extutils-makemaker-version-regex|module-file-spec|module-io-compress-lzma|module-io-uncompress-unxz|module-locale-maketext-lexicon|module-log-agent|module-meta-notation|module-net-localcfg|module-net-ping-external|module-b-deparse|module-scalar-util|module-some-module|module-symbol|module-uri|module-win32api-file' > ${WORKDIR}/perl-rdepends.generated 375 egrep -wv '=>|module-algorithm-diff|module-carp|module-c<extutils-mm-unix>|module-l<extutils-mm-unix>|module-encode-hanextra|module-extutils-makemaker-version-regex|module-file-spec|module-io-compress-lzma|module-io-uncompress-unxz|module-locale-maketext-lexicon|module-log-agent|module-meta-notation|module-net-localcfg|module-net-ping-external|module-b-deparse|module-scalar-util|module-some-module|module-symbol|module-uri|module-win32api-file' > ${WORKDIR}/perl-rdepends.generated
368 cat ${WORKDIR}/perl-rdepends.inc ${WORKDIR}/perl-rdepends.generated > ${THISDIR}/files/perl-rdepends.txt 376 cat ${WORKDIR}/perl-rdepends.inc ${WORKDIR}/perl-rdepends.generated > ${THISDIR}/files/perl-rdepends.txt
369} 377}
diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
index f9e3b46910..e7ef6a730c 100644
--- a/meta/recipes-devtools/pseudo/pseudo_git.bb
+++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
@@ -13,7 +13,7 @@ SRC_URI:append:class-nativesdk = " \
13 file://older-glibc-symbols.patch" 13 file://older-glibc-symbols.patch"
14SRC_URI[prebuilt.sha256sum] = "ed9f456856e9d86359f169f46a70ad7be4190d6040282b84c8d97b99072485aa" 14SRC_URI[prebuilt.sha256sum] = "ed9f456856e9d86359f169f46a70ad7be4190d6040282b84c8d97b99072485aa"
15 15
16SRCREV = "d34f2f6cedccf8488730001bcbde6bb7499f8814" 16SRCREV = "2b4b88eb513335b0ece55fe51854693d9b20de35"
17S = "${WORKDIR}/git" 17S = "${WORKDIR}/git"
18PV = "1.9.0+git${SRCPV}" 18PV = "1.9.0+git${SRCPV}"
19 19
diff --git a/meta/recipes-devtools/python/python3-pyelftools_0.27.bb b/meta/recipes-devtools/python/python3-pyelftools_0.27.bb
index 0cfd99504b..e2d0e18277 100644
--- a/meta/recipes-devtools/python/python3-pyelftools_0.27.bb
+++ b/meta/recipes-devtools/python/python3-pyelftools_0.27.bb
@@ -11,3 +11,5 @@ PYPI_PACKAGE = "pyelftools"
11inherit pypi setuptools3 11inherit pypi setuptools3
12 12
13BBCLASSEXTEND = "native" 13BBCLASSEXTEND = "native"
14
15RDEPENDS:${PN} += "${PYTHON_PN}-debugger ${PYTHON_PN}-pprint"
diff --git a/meta/recipes-devtools/python/python3/0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch b/meta/recipes-devtools/python/python3/0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch
index c4fae09a5b..99968b81de 100644
--- a/meta/recipes-devtools/python/python3/0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch
+++ b/meta/recipes-devtools/python/python3/0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch
@@ -1,7 +1,8 @@
1From 1ad771d86728ee2ed30e202e9768d8d825f96467 Mon Sep 17 00:00:00 2001 1From d9eb634b3d2e6ba831e864c50f6a37c48edfc4f3 Mon Sep 17 00:00:00 2001
2From: Matthias Schoepfer <matthias.schoepfer@ithinx.io> 2From: Matthias Schoepfer <matthias.schoepfer@ithinx.io>
3Date: Fri, 31 May 2019 15:34:34 +0200 3Date: Fri, 31 May 2019 15:34:34 +0200
4Subject: [PATCH] bpo-36852: proper detection of mips architecture for soft 4Subject: [PATCH] bpo-36852: proper detection of mips architecture for soft
5
5 float 6 float
6 7
7When (cross) compiling for softfloat mips, __mips_hard_float will not be 8When (cross) compiling for softfloat mips, __mips_hard_float will not be
@@ -13,18 +14,18 @@ to do this in a more autoconf/autotools manner.
13Upstream-Status: Submitted [https://github.com/python/cpython/pull/13196] 14Upstream-Status: Submitted [https://github.com/python/cpython/pull/13196]
14Signed-off-by: Matthias Schoepfer <matthias.schoepfer@ithinx.io> 15Signed-off-by: Matthias Schoepfer <matthias.schoepfer@ithinx.io>
15 16
16%% original patch: 0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch 17
17--- 18---
18 configure.ac | 175 +++++++-------------------------------------------- 19 configure.ac | 175 +++++++--------------------------------------------
19 1 file changed, 21 insertions(+), 154 deletions(-) 20 1 file changed, 21 insertions(+), 154 deletions(-)
20 21
21diff --git a/configure.ac b/configure.ac 22diff --git a/configure.ac b/configure.ac
22index ede710e..bc81b0b 100644 23index e2979a8..337182d 100644
23--- a/configure.ac 24--- a/configure.ac
24+++ b/configure.ac 25+++ b/configure.ac
25@@ -710,160 +710,27 @@ fi 26@@ -728,160 +728,27 @@ then
26 MULTIARCH=$($CC --print-multiarch 2>/dev/null) 27 fi
27 AC_SUBST(MULTIARCH) 28
28 29
29-AC_MSG_CHECKING([for the platform triplet based on compiler characteristics]) 30-AC_MSG_CHECKING([for the platform triplet based on compiler characteristics])
30-cat >> conftest.c <<EOF 31-cat >> conftest.c <<EOF
@@ -202,8 +203,5 @@ index ede710e..bc81b0b 100644
202+ ;; 203+ ;;
203+esac 204+esac
204 205
205 if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then 206 if test x$PLATFORM_TRIPLET != xdarwin; then
206 if test x$PLATFORM_TRIPLET != x$MULTIARCH; then 207 MULTIARCH=$($CC --print-multiarch 2>/dev/null)
207--
2082.24.1
209
diff --git a/meta/recipes-devtools/python/python3_3.9.7.bb b/meta/recipes-devtools/python/python3_3.9.9.bb
index 772dcb8d9d..5c6077a467 100644
--- a/meta/recipes-devtools/python/python3_3.9.7.bb
+++ b/meta/recipes-devtools/python/python3_3.9.9.bb
@@ -39,7 +39,7 @@ SRC_URI:append:class-native = " \
39 file://12-distutils-prefix-is-inside-staging-area.patch \ 39 file://12-distutils-prefix-is-inside-staging-area.patch \
40 file://0001-Don-t-search-system-for-headers-libraries.patch \ 40 file://0001-Don-t-search-system-for-headers-libraries.patch \
41 " 41 "
42SRC_URI[sha256sum] = "f8145616e68c00041d1a6399b76387390388f8359581abc24432bb969b5e3c57" 42SRC_URI[sha256sum] = "06828c04a573c073a4e51c4292a27c1be4ae26621c3edc7cf9318418ce3b6d27"
43 43
44# exclude pre-releases for both python 2.x and 3.x 44# exclude pre-releases for both python 2.x and 3.x
45UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar" 45UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar"
diff --git a/meta/recipes-devtools/quilt/quilt.inc b/meta/recipes-devtools/quilt/quilt.inc
index f85de384d2..4a725cb327 100644
--- a/meta/recipes-devtools/quilt/quilt.inc
+++ b/meta/recipes-devtools/quilt/quilt.inc
@@ -26,8 +26,9 @@ PATCHTOOL:class-native = "patch"
26 26
27CLEANBROKEN = "1" 27CLEANBROKEN = "1"
28 28
29EXTRA_OECONF = "--with-perl='${USRBINPATH}/env perl' --with-patch=patch" 29EXTRA_OECONF = "--with-perl='${USRBINPATH}/env perl' --with-patch=patch --without-sendmail"
30EXTRA_OECONF:append:class-native = " --disable-nls" 30EXTRA_OECONF:append:class-native = " --disable-nls"
31
31EXTRA_AUTORECONF += "--exclude=aclocal" 32EXTRA_AUTORECONF += "--exclude=aclocal"
32 33
33CACHED_CONFIGUREVARS += "ac_cv_path_BASH=/bin/bash ac_cv_path_COLUMN=column" 34CACHED_CONFIGUREVARS += "ac_cv_path_BASH=/bin/bash ac_cv_path_COLUMN=column"
diff --git a/meta/recipes-devtools/rpm/rpm_4.16.1.3.bb b/meta/recipes-devtools/rpm/rpm_4.16.1.3.bb
index cb15415d7f..48cd79f9cb 100644
--- a/meta/recipes-devtools/rpm/rpm_4.16.1.3.bb
+++ b/meta/recipes-devtools/rpm/rpm_4.16.1.3.bb
@@ -133,6 +133,9 @@ do_install:append:class-nativesdk() {
133do_install:append:class-target() { 133do_install:append:class-target() {
134 rm -rf ${D}/var 134 rm -rf ${D}/var
135} 135}
136do_install:append:class-nativesdk() {
137 rm -rf ${D}${SDKPATHNATIVE}/var
138}
136 139
137do_install:append () { 140do_install:append () {
138 sed -i -e 's:${HOSTTOOLS_DIR}/::g' \ 141 sed -i -e 's:${HOSTTOOLS_DIR}/::g' \
diff --git a/meta/recipes-devtools/ruby/ruby_3.0.2.bb b/meta/recipes-devtools/ruby/ruby_3.0.3.bb
index 2abf504d91..95feb94dd4 100644
--- a/meta/recipes-devtools/ruby/ruby_3.0.2.bb
+++ b/meta/recipes-devtools/ruby/ruby_3.0.3.bb
@@ -13,7 +13,7 @@ SRC_URI += " \
13 file://0006-Make-gemspecs-reproducible.patch \ 13 file://0006-Make-gemspecs-reproducible.patch \
14 " 14 "
15 15
16SRC_URI[sha256sum] = "5085dee0ad9f06996a8acec7ebea4a8735e6fac22f22e2d98c3f2bc3bef7e6f1" 16SRC_URI[sha256sum] = "3586861cb2df56970287f0fd83f274bd92058872d830d15570b36def7f1a92ac"
17 17
18PACKAGECONFIG ??= "" 18PACKAGECONFIG ??= ""
19PACKAGECONFIG += "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}" 19PACKAGECONFIG += "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}"
@@ -83,8 +83,6 @@ do_install_ptest () {
83 -i ${D}${PTEST_PATH}/test/erb/test_erb_command.rb 83 -i ${D}${PTEST_PATH}/test/erb/test_erb_command.rb
84 84
85 cp -r ${S}/include ${D}/${libdir}/ruby/ 85 cp -r ${S}/include ${D}/${libdir}/ruby/
86 test_case_rb=`grep rubygems/test_case.rb ${B}/.installed.list`
87 sed -i -e 's:../../../test/:../../../ptest/test/:g' ${D}/$test_case_rb
88} 86}
89 87
90PACKAGES =+ "${PN}-ri-docs ${PN}-rdoc" 88PACKAGES =+ "${PN}-ri-docs ${PN}-rdoc"
diff --git a/meta/recipes-devtools/rust/rust-cross.inc b/meta/recipes-devtools/rust/rust-cross.inc
index bee7c9f12f..5f8671257e 100644
--- a/meta/recipes-devtools/rust/rust-cross.inc
+++ b/meta/recipes-devtools/rust/rust-cross.inc
@@ -32,7 +32,7 @@ DEPENDS += "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}compilerlibs vir
32DEPENDS += "rust-native" 32DEPENDS += "rust-native"
33 33
34PROVIDES = "virtual/${TARGET_PREFIX}rust" 34PROVIDES = "virtual/${TARGET_PREFIX}rust"
35PN = "rust-cross-${TARGET_ARCH}" 35PN = "rust-cross-${TUNE_PKGARCH}-${TCLIBC}"
36 36
37# In the cross compilation case, rustc doesn't seem to get the rpath quite 37# In the cross compilation case, rustc doesn't seem to get the rpath quite
38# right. It manages to include '../../lib/${TARGET_PREFIX}', but doesn't 38# right. It manages to include '../../lib/${TARGET_PREFIX}', but doesn't
diff --git a/meta/recipes-extended/asciidoc/asciidoc_9.1.0.bb b/meta/recipes-extended/asciidoc/asciidoc_9.1.0.bb
index dd9f8e32c4..6d52b5ba04 100644
--- a/meta/recipes-extended/asciidoc/asciidoc_9.1.0.bb
+++ b/meta/recipes-extended/asciidoc/asciidoc_9.1.0.bb
@@ -8,7 +8,7 @@ LICENSE = "GPLv2"
8LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=4e5d1baf6f20559e3bec172226a47e4e \ 8LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=4e5d1baf6f20559e3bec172226a47e4e \
9 file://LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263 " 9 file://LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263 "
10 10
11SRC_URI = "git://github.com/asciidoc/asciidoc-py3;protocol=https;branch=9.x" 11SRC_URI = "git://github.com/asciidoc/asciidoc-py;protocol=https;branch=9.x"
12SRCREV = "9705d428439530104ce55d0ba12e8ef9d1b57ad1" 12SRCREV = "9705d428439530104ce55d0ba12e8ef9d1b57ad1"
13 13
14DEPENDS = "libxml2-native libxslt-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native" 14DEPENDS = "libxml2-native libxslt-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native"
diff --git a/meta/recipes-extended/cups/cups.inc b/meta/recipes-extended/cups/cups.inc
index 0f5c2e730f..a8e790bd8f 100644
--- a/meta/recipes-extended/cups/cups.inc
+++ b/meta/recipes-extended/cups/cups.inc
@@ -49,6 +49,7 @@ PACKAGECONFIG[xinetd] = "--with-xinetd=${sysconfdir}/xinetd.d,--without-xinetd,x
49 49
50EXTRA_OECONF = " \ 50EXTRA_OECONF = " \
51 --enable-dbus \ 51 --enable-dbus \
52 --with-dbusdir=${sysconfdir}/dbus-1 \
52 --enable-browsing \ 53 --enable-browsing \
53 --disable-gssapi \ 54 --disable-gssapi \
54 --enable-debug \ 55 --enable-debug \
diff --git a/meta/recipes-extended/ghostscript/ghostscript/CVE-2021-3781.patch b/meta/recipes-extended/ghostscript/ghostscript/CVE-2021-3781.patch
new file mode 100644
index 0000000000..27ef83bb85
--- /dev/null
+++ b/meta/recipes-extended/ghostscript/ghostscript/CVE-2021-3781.patch
@@ -0,0 +1,236 @@
1From a9bd3dec9fde03327a4a2c69dad1036bf9632e20 Mon Sep 17 00:00:00 2001
2From: Chris Liddell <chris.liddell@artifex.com>
3Date: Tue, 7 Sep 2021 20:36:12 +0100
4Subject: [PATCH] Bug 704342: Include device specifier strings in access
5 validation
6
7for the "%pipe%", %handle%" and %printer% io devices.
8
9We previously validated only the part after the "%pipe%" Postscript device
10specifier, but this proved insufficient.
11
12This rebuilds the original file name string, and validates it complete. The
13slight complication for "%pipe%" is it can be reached implicitly using
14"|" so we have to check both prefixes.
15
16Addresses CVE-2021-3781
17
18Upstream-Status: Backport[https://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=a9bd3dec9fde03327a4a2c69dad1036bf9632e20]
19CVE: CVE-2021-3781
20Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
21---
22 base/gdevpipe.c | 22 +++++++++++++++-
23 base/gp_mshdl.c | 11 +++++++-
24 base/gp_msprn.c | 10 ++++++-
25 base/gp_os2pr.c | 13 +++++++++-
26 base/gslibctx.c | 69 ++++++++++---------------------------------------
27 5 files changed, 65 insertions(+), 60 deletions(-)
28
29diff --git a/base/gdevpipe.c b/base/gdevpipe.c
30index 96d71f5d8..5bdc485be 100644
31--- a/base/gdevpipe.c
32+++ b/base/gdevpipe.c
33@@ -72,8 +72,28 @@ pipe_fopen(gx_io_device * iodev, const char *fname, const char *access,
34 #else
35 gs_lib_ctx_t *ctx = mem->gs_lib_ctx;
36 gs_fs_list_t *fs = ctx->core->fs;
37+ /* The pipe device can be reached in two ways, explicltly with %pipe%
38+ or implicitly with "|", so we have to check for both
39+ */
40+ char f[gp_file_name_sizeof];
41+ const char *pipestr = "|";
42+ const size_t pipestrlen = strlen(pipestr);
43+ const size_t preflen = strlen(iodev->dname);
44+ const size_t nlen = strlen(fname);
45+ int code1;
46+
47+ if (preflen + nlen >= gp_file_name_sizeof)
48+ return_error(gs_error_invalidaccess);
49+
50+ memcpy(f, iodev->dname, preflen);
51+ memcpy(f + preflen, fname, nlen + 1);
52+
53+ code1 = gp_validate_path(mem, f, access);
54+
55+ memcpy(f, pipestr, pipestrlen);
56+ memcpy(f + pipestrlen, fname, nlen + 1);
57
58- if (gp_validate_path(mem, fname, access) != 0)
59+ if (code1 != 0 && gp_validate_path(mem, f, access) != 0 )
60 return gs_error_invalidfileaccess;
61
62 /*
63diff --git a/base/gp_mshdl.c b/base/gp_mshdl.c
64index 2b964ed74..8d87ceadc 100644
65--- a/base/gp_mshdl.c
66+++ b/base/gp_mshdl.c
67@@ -95,8 +95,17 @@ mswin_handle_fopen(gx_io_device * iodev, const char *fname, const char *access,
68 long hfile; /* Correct for Win32, may be wrong for Win64 */
69 gs_lib_ctx_t *ctx = mem->gs_lib_ctx;
70 gs_fs_list_t *fs = ctx->core->fs;
71+ char f[gp_file_name_sizeof];
72+ const size_t preflen = strlen(iodev->dname);
73+ const size_t nlen = strlen(fname);
74
75- if (gp_validate_path(mem, fname, access) != 0)
76+ if (preflen + nlen >= gp_file_name_sizeof)
77+ return_error(gs_error_invalidaccess);
78+
79+ memcpy(f, iodev->dname, preflen);
80+ memcpy(f + preflen, fname, nlen + 1);
81+
82+ if (gp_validate_path(mem, f, access) != 0)
83 return gs_error_invalidfileaccess;
84
85 /* First we try the open_handle method. */
86diff --git a/base/gp_msprn.c b/base/gp_msprn.c
87index ed4827968..746a974f7 100644
88--- a/base/gp_msprn.c
89+++ b/base/gp_msprn.c
90@@ -168,8 +168,16 @@ mswin_printer_fopen(gx_io_device * iodev, const char *fname, const char *access,
91 uintptr_t *ptid = &((tid_t *)(iodev->state))->tid;
92 gs_lib_ctx_t *ctx = mem->gs_lib_ctx;
93 gs_fs_list_t *fs = ctx->core->fs;
94+ const size_t preflen = strlen(iodev->dname);
95+ const size_t nlen = strlen(fname);
96
97- if (gp_validate_path(mem, fname, access) != 0)
98+ if (preflen + nlen >= gp_file_name_sizeof)
99+ return_error(gs_error_invalidaccess);
100+
101+ memcpy(pname, iodev->dname, preflen);
102+ memcpy(pname + preflen, fname, nlen + 1);
103+
104+ if (gp_validate_path(mem, pname, access) != 0)
105 return gs_error_invalidfileaccess;
106
107 /* First we try the open_printer method. */
108diff --git a/base/gp_os2pr.c b/base/gp_os2pr.c
109index f852c71fc..ba54cde66 100644
110--- a/base/gp_os2pr.c
111+++ b/base/gp_os2pr.c
112@@ -107,9 +107,20 @@ os2_printer_fopen(gx_io_device * iodev, const char *fname, const char *access,
113 FILE ** pfile, char *rfname, uint rnamelen)
114 {
115 os2_printer_t *pr = (os2_printer_t *)iodev->state;
116- char driver_name[256];
117+ char driver_name[gp_file_name_sizeof];
118 gs_lib_ctx_t *ctx = mem->gs_lib_ctx;
119 gs_fs_list_t *fs = ctx->core->fs;
120+ const size_t preflen = strlen(iodev->dname);
121+ const int size_t = strlen(fname);
122+
123+ if (preflen + nlen >= gp_file_name_sizeof)
124+ return_error(gs_error_invalidaccess);
125+
126+ memcpy(driver_name, iodev->dname, preflen);
127+ memcpy(driver_name + preflen, fname, nlen + 1);
128+
129+ if (gp_validate_path(mem, driver_name, access) != 0)
130+ return gs_error_invalidfileaccess;
131
132 /* First we try the open_printer method. */
133 /* Note that the loop condition here ensures we don't
134diff --git a/base/gslibctx.c b/base/gslibctx.c
135index 6dfed6cd5..318039fad 100644
136--- a/base/gslibctx.c
137+++ b/base/gslibctx.c
138@@ -655,82 +655,39 @@ rewrite_percent_specifiers(char *s)
139 int
140 gs_add_outputfile_control_path(gs_memory_t *mem, const char *fname)
141 {
142- char *fp, f[gp_file_name_sizeof];
143- const int pipe = 124; /* ASCII code for '|' */
144- const int len = strlen(fname);
145- int i, code;
146+ char f[gp_file_name_sizeof];
147+ int code;
148
149 /* Be sure the string copy will fit */
150- if (len >= gp_file_name_sizeof)
151+ if (strlen(fname) >= gp_file_name_sizeof)
152 return gs_error_rangecheck;
153 strcpy(f, fname);
154- fp = f;
155 /* Try to rewrite any %d (or similar) in the string */
156 rewrite_percent_specifiers(f);
157- for (i = 0; i < len; i++) {
158- if (f[i] == pipe) {
159- fp = &f[i + 1];
160- /* Because we potentially have to check file permissions at two levels
161- for the output file (gx_device_open_output_file and the low level
162- fopen API, if we're using a pipe, we have to add both the full string,
163- (including the '|', and just the command to which we pipe - since at
164- the pipe_fopen(), the leading '|' has been stripped.
165- */
166- code = gs_add_control_path(mem, gs_permit_file_writing, f);
167- if (code < 0)
168- return code;
169- code = gs_add_control_path(mem, gs_permit_file_control, f);
170- if (code < 0)
171- return code;
172- break;
173- }
174- if (!IS_WHITESPACE(f[i]))
175- break;
176- }
177- code = gs_add_control_path(mem, gs_permit_file_control, fp);
178+
179+ code = gs_add_control_path(mem, gs_permit_file_control, f);
180 if (code < 0)
181 return code;
182- return gs_add_control_path(mem, gs_permit_file_writing, fp);
183+ return gs_add_control_path(mem, gs_permit_file_writing, f);
184 }
185
186 int
187 gs_remove_outputfile_control_path(gs_memory_t *mem, const char *fname)
188 {
189- char *fp, f[gp_file_name_sizeof];
190- const int pipe = 124; /* ASCII code for '|' */
191- const int len = strlen(fname);
192- int i, code;
193+ char f[gp_file_name_sizeof];
194+ int code;
195
196 /* Be sure the string copy will fit */
197- if (len >= gp_file_name_sizeof)
198+ if (strlen(fname) >= gp_file_name_sizeof)
199 return gs_error_rangecheck;
200 strcpy(f, fname);
201- fp = f;
202 /* Try to rewrite any %d (or similar) in the string */
203- for (i = 0; i < len; i++) {
204- if (f[i] == pipe) {
205- fp = &f[i + 1];
206- /* Because we potentially have to check file permissions at two levels
207- for the output file (gx_device_open_output_file and the low level
208- fopen API, if we're using a pipe, we have to add both the full string,
209- (including the '|', and just the command to which we pipe - since at
210- the pipe_fopen(), the leading '|' has been stripped.
211- */
212- code = gs_remove_control_path(mem, gs_permit_file_writing, f);
213- if (code < 0)
214- return code;
215- code = gs_remove_control_path(mem, gs_permit_file_control, f);
216- if (code < 0)
217- return code;
218- break;
219- }
220- if (!IS_WHITESPACE(f[i]))
221- break;
222- }
223- code = gs_remove_control_path(mem, gs_permit_file_control, fp);
224+ rewrite_percent_specifiers(f);
225+
226+ code = gs_remove_control_path(mem, gs_permit_file_control, f);
227 if (code < 0)
228 return code;
229- return gs_remove_control_path(mem, gs_permit_file_writing, fp);
230+ return gs_remove_control_path(mem, gs_permit_file_writing, f);
231 }
232
233 int
234--
2352.25.1
236
diff --git a/meta/recipes-extended/ghostscript/ghostscript/CVE-2021-45949.patch b/meta/recipes-extended/ghostscript/ghostscript/CVE-2021-45949.patch
new file mode 100644
index 0000000000..8e4fd40932
--- /dev/null
+++ b/meta/recipes-extended/ghostscript/ghostscript/CVE-2021-45949.patch
@@ -0,0 +1,68 @@
1From 2a3129365d3bc0d4a41f107ef175920d1505d1f7 Mon Sep 17 00:00:00 2001
2From: Chris Liddell <chris.liddell@artifex.com>
3Date: Tue, 1 Jun 2021 19:57:16 +0100
4Subject: [PATCH] Bug 703902: Fix op stack management in
5 sampled_data_continue()
6
7Replace pop() (which does no checking, and doesn't handle stack extension
8blocks) with ref_stack_pop() which does do all that.
9
10We still use pop() in one case (it's faster), but we have to later use
11ref_stack_pop() before calling sampled_data_sample() which also accesses the
12op stack.
13
14Fixes:
15https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34675
16
17Upstream-Status: Backported [https://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=2a3129365d3bc0d4a41f107ef175920d1505d1f7]
18CVE: CVE-2021-45949
19Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
20---
21 psi/zfsample.c | 16 ++++++++++------
22 1 file changed, 10 insertions(+), 6 deletions(-)
23
24diff --git a/psi/zfsample.c b/psi/zfsample.c
25index 0e8e4bc8d..00cd0cfdd 100644
26--- a/psi/zfsample.c
27+++ b/psi/zfsample.c
28@@ -533,15 +533,19 @@ sampled_data_continue(i_ctx_t *i_ctx_p)
29 for (j = 0; j < bps; j++)
30 data_ptr[bps * i + j] = (byte)(cv >> ((bps - 1 - j) * 8)); /* MSB first */
31 }
32- pop(num_out); /* Move op to base of result values */
33
34- /* Check if we are done collecting data. */
35+ pop(num_out); /* Move op to base of result values */
36
37+ /* From here on, we have to use ref_stack_pop() rather than pop()
38+ so that it handles stack extension blocks properly, before calling
39+ sampled_data_sample() which also uses the op stack.
40+ */
41+ /* Check if we are done collecting data. */
42 if (increment_cube_indexes(params, penum->indexes)) {
43 if (stack_depth_adjust == 0)
44- pop(O_STACK_PAD); /* Remove spare stack space */
45+ ref_stack_pop(&o_stack, O_STACK_PAD); /* Remove spare stack space */
46 else
47- pop(stack_depth_adjust - num_out);
48+ ref_stack_pop(&o_stack, stack_depth_adjust - num_out);
49 /* Execute the closing procedure, if given */
50 code = 0;
51 if (esp_finish_proc != 0)
52@@ -554,11 +558,11 @@ sampled_data_continue(i_ctx_t *i_ctx_p)
53 if ((O_STACK_PAD - stack_depth_adjust) < 0) {
54 stack_depth_adjust = -(O_STACK_PAD - stack_depth_adjust);
55 check_op(stack_depth_adjust);
56- pop(stack_depth_adjust);
57+ ref_stack_pop(&o_stack, stack_depth_adjust);
58 }
59 else {
60 check_ostack(O_STACK_PAD - stack_depth_adjust);
61- push(O_STACK_PAD - stack_depth_adjust);
62+ ref_stack_push(&o_stack, O_STACK_PAD - stack_depth_adjust);
63 for (i=0;i<O_STACK_PAD - stack_depth_adjust;i++)
64 make_null(op - i);
65 }
66--
672.25.1
68
diff --git a/meta/recipes-extended/ghostscript/ghostscript_9.54.0.bb b/meta/recipes-extended/ghostscript/ghostscript_9.54.0.bb
index 59cc560cf8..28d064a1a8 100644
--- a/meta/recipes-extended/ghostscript/ghostscript_9.54.0.bb
+++ b/meta/recipes-extended/ghostscript/ghostscript_9.54.0.bb
@@ -33,6 +33,8 @@ SRC_URI_BASE = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/d
33 file://do-not-check-local-libpng-source.patch \ 33 file://do-not-check-local-libpng-source.patch \
34 file://avoid-host-contamination.patch \ 34 file://avoid-host-contamination.patch \
35 file://mkdir-p.patch \ 35 file://mkdir-p.patch \
36 file://CVE-2021-45949.patch \
37 file://CVE-2021-3781.patch \
36" 38"
37 39
38SRC_URI = "${SRC_URI_BASE} \ 40SRC_URI = "${SRC_URI_BASE} \
diff --git a/meta/recipes-extended/libarchive/libarchive_3.5.1.bb b/meta/recipes-extended/libarchive/libarchive_3.5.3.bb
index 7d98e573b8..dd607aca0a 100644
--- a/meta/recipes-extended/libarchive/libarchive_3.5.1.bb
+++ b/meta/recipes-extended/libarchive/libarchive_3.5.3.bb
@@ -34,7 +34,7 @@ EXTRA_OECONF += "--enable-largefile"
34 34
35SRC_URI = "http://libarchive.org/downloads/libarchive-${PV}.tar.gz" 35SRC_URI = "http://libarchive.org/downloads/libarchive-${PV}.tar.gz"
36 36
37SRC_URI[sha256sum] = "9015d109ec00bb9ae1a384b172bf2fc1dff41e2c66e5a9eeddf933af9db37f5a" 37SRC_URI[sha256sum] = "72788e5f58d16febddfa262a5215e05fc9c79f2670f641ac039e6df44330ef51"
38 38
39inherit autotools update-alternatives pkgconfig 39inherit autotools update-alternatives pkgconfig
40 40
diff --git a/meta/recipes-extended/lighttpd/lighttpd/0001-mod_extforward-fix-out-of-bounds-OOB-write-fixes-313.patch b/meta/recipes-extended/lighttpd/lighttpd/0001-mod_extforward-fix-out-of-bounds-OOB-write-fixes-313.patch
new file mode 100644
index 0000000000..f4e93d1065
--- /dev/null
+++ b/meta/recipes-extended/lighttpd/lighttpd/0001-mod_extforward-fix-out-of-bounds-OOB-write-fixes-313.patch
@@ -0,0 +1,97 @@
1Upstream-Status: Backport
2CVE: CVE-2022-22707
3Signed-off-by: Ross Burton <ross.burton@arm.com>
4
5From 27103f3f8b1a2857aa45b889e775435f7daf141f Mon Sep 17 00:00:00 2001
6From: povcfe <povcfe@qq.com>
7Date: Wed, 5 Jan 2022 11:11:09 +0000
8Subject: [PATCH] [mod_extforward] fix out-of-bounds (OOB) write (fixes #3134)
9
10(thx povcfe)
11
12(edited: gstrauss)
13
14There is a potential remote denial of service in lighttpd mod_extforward
15under specific, non-default and uncommon 32-bit lighttpd mod_extforward
16configurations.
17
18Under specific, non-default and uncommon lighttpd mod_extforward
19configurations, a remote attacker can trigger a 4-byte out-of-bounds
20write of value '-1' to the stack. This is not believed to be exploitable
21in any way beyond triggering a crash of the lighttpd server on systems
22where the lighttpd server has been built 32-bit and with compiler flags
23which enable a stack canary -- gcc/clang -fstack-protector-strong or
24-fstack-protector-all, but bug not visible with only -fstack-protector.
25
26With standard lighttpd builds using -O2 optimization on 64-bit x86_64,
27this bug has not been observed to cause adverse behavior, even with
28gcc/clang -fstack-protector-strong.
29
30For the bug to be reachable, the user must be using a non-default
31lighttpd configuration which enables mod_extforward and configures
32mod_extforward to accept and parse the "Forwarded" header from a trusted
33proxy. At this time, support for RFC7239 Forwarded is not common in CDN
34providers or popular web server reverse proxies. It bears repeating that
35for the user to desire to configure lighttpd mod_extforward to accept
36"Forwarded", the user must also be using a trusted proxy (in front of
37lighttpd) which understands and actively modifies the "Forwarded" header
38sent to lighttpd.
39
40lighttpd natively supports RFC7239 "Forwarded"
41hiawatha natively supports RFC7239 "Forwarded"
42
43nginx can be manually configured to add a "Forwarded" header
44https://www.nginx.com/resources/wiki/start/topics/examples/forwarded/
45
46A 64-bit build of lighttpd on x86_64 (not known to be affected by bug)
47in front of another 32-bit lighttpd will detect and reject a malicious
48"Forwarded" request header, thereby thwarting an attempt to trigger
49this bug in an upstream 32-bit lighttpd.
50
51The following servers currently do not natively support RFC7239 Forwarded:
52nginx
53apache2
54caddy
55node.js
56haproxy
57squid
58varnish-cache
59litespeed
60
61Given the general dearth of support for RFC7239 Forwarded in popular
62CDNs and web server reverse proxies, and given the prerequisites in
63lighttpd mod_extforward needed to reach this bug, the number of lighttpd
64servers vulnerable to this bug is estimated to be vanishingly small.
65Large systems using reverse proxies are likely running 64-bit lighttpd,
66which is not known to be adversely affected by this bug.
67
68In the future, it is desirable for more servers to implement RFC7239
69Forwarded. lighttpd developers would like to thank povcfe for reporting
70this bug so that it can be fixed before more CDNs and web servers
71implement RFC7239 Forwarded.
72
73x-ref:
74 "mod_extforward plugin has out-of-bounds (OOB) write of 4-byte -1"
75 https://redmine.lighttpd.net/issues/3134
76 (not yet written or published)
77 CVE-2022-22707
78---
79 src/mod_extforward.c | 2 +-
80 1 file changed, 1 insertion(+), 1 deletion(-)
81
82diff --git a/src/mod_extforward.c b/src/mod_extforward.c
83index ba957e04..fdaef7f6 100644
84--- a/src/mod_extforward.c
85+++ b/src/mod_extforward.c
86@@ -715,7 +715,7 @@ static handler_t mod_extforward_Forwarded (request_st * const r, plugin_data * c
87 while (s[i] == ' ' || s[i] == '\t') ++i;
88 if (s[i] == ';') { ++i; continue; }
89 if (s[i] == ',') {
90- if (j >= (int)(sizeof(offsets)/sizeof(int))) break;
91+ if (j >= (int)(sizeof(offsets)/sizeof(int))-1) break;
92 offsets[++j] = -1; /*("offset" separating params from next proxy)*/
93 ++i;
94 continue;
95--
962.25.1
97
diff --git a/meta/recipes-extended/lighttpd/lighttpd_1.4.59.bb b/meta/recipes-extended/lighttpd/lighttpd_1.4.59.bb
index 8cb3a9a18c..12d3db937d 100644
--- a/meta/recipes-extended/lighttpd/lighttpd_1.4.59.bb
+++ b/meta/recipes-extended/lighttpd/lighttpd_1.4.59.bb
@@ -14,6 +14,7 @@ RRECOMMENDS:${PN} = "lighttpd-module-access \
14 lighttpd-module-accesslog" 14 lighttpd-module-accesslog"
15 15
16SRC_URI = "http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-${PV}.tar.xz \ 16SRC_URI = "http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-${PV}.tar.xz \
17 file://0001-mod_extforward-fix-out-of-bounds-OOB-write-fixes-313.patch \
17 file://index.html.lighttpd \ 18 file://index.html.lighttpd \
18 file://lighttpd.conf \ 19 file://lighttpd.conf \
19 file://lighttpd \ 20 file://lighttpd \
diff --git a/meta/recipes-extended/mc/files/0001-Ticket-4200-fix-FTBFS-with-ncurses-build-with-disabl.patch b/meta/recipes-extended/mc/files/0001-Ticket-4200-fix-FTBFS-with-ncurses-build-with-disabl.patch
new file mode 100644
index 0000000000..408473664f
--- /dev/null
+++ b/meta/recipes-extended/mc/files/0001-Ticket-4200-fix-FTBFS-with-ncurses-build-with-disabl.patch
@@ -0,0 +1,87 @@
1From e7bbf72544ab62db9c92bfe7bd1155227e78c621 Mon Sep 17 00:00:00 2001
2From: Andrew Borodin <aborodin@vmail.ru>
3Date: Sat, 28 Aug 2021 11:46:53 +0300
4Subject: [PATCH] Ticket #4200: fix FTBFS with ncurses build with
5 --disable-widec.
6
7Upstream-Status: Accepted [https://github.com/MidnightCommander/mc/commit/e7bbf72544]
8Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
9---
10 lib/tty/tty-ncurses.c | 8 ++++++++
11 lib/tty/tty-ncurses.h | 5 +++++
12 lib/tty/tty-slang.h | 2 ++
13 src/filemanager/boxes.c | 2 ++
14 4 files changed, 17 insertions(+)
15
16diff --git a/lib/tty/tty-ncurses.c b/lib/tty/tty-ncurses.c
17index f619c0a7bf31..13058a624208 100644
18--- a/lib/tty/tty-ncurses.c
19+++ b/lib/tty/tty-ncurses.c
20@@ -560,6 +560,7 @@ tty_fill_region (int y, int x, int rows, int cols, unsigned char ch)
21 void
22 tty_colorize_area (int y, int x, int rows, int cols, int color)
23 {
24+#ifdef ENABLE_SHADOWS
25 cchar_t *ctext;
26 wchar_t wch[10]; /* TODO not sure if the length is correct */
27 attr_t attrs;
28@@ -585,6 +586,13 @@ tty_colorize_area (int y, int x, int rows, int cols, int color)
29 }
30
31 g_free (ctext);
32+#else
33+ (void) y;
34+ (void) x;
35+ (void) rows;
36+ (void) cols;
37+ (void) color;
38+#endif /* ENABLE_SHADOWS */
39 }
40
41 /* --------------------------------------------------------------------------------------------- */
42diff --git a/lib/tty/tty-ncurses.h b/lib/tty/tty-ncurses.h
43index d75df9533ab9..8feb17ccd045 100644
44--- a/lib/tty/tty-ncurses.h
45+++ b/lib/tty/tty-ncurses.h
46@@ -30,6 +30,11 @@
47 #define NCURSES_CONST const
48 #endif
49
50+/* do not draw shadows if NCurses is built with --disable-widec */
51+#if defined(NCURSES_WIDECHAR) && NCURSES_WIDECHAR
52+#define ENABLE_SHADOWS 1
53+#endif
54+
55 /*** typedefs(not structures) and defined constants **********************************************/
56
57 /*** enums ***************************************************************************************/
58diff --git a/lib/tty/tty-slang.h b/lib/tty/tty-slang.h
59index 5b12c6512853..eeaade388af4 100644
60--- a/lib/tty/tty-slang.h
61+++ b/lib/tty/tty-slang.h
62@@ -23,6 +23,8 @@
63 #define COLS SLtt_Screen_Cols
64 #define LINES SLtt_Screen_Rows
65
66+#define ENABLE_SHADOWS 1
67+
68 /*** enums ***************************************************************************************/
69
70 enum
71diff --git a/src/filemanager/boxes.c b/src/filemanager/boxes.c
72index 3eb525be4a9b..98df5ff2ed9a 100644
73--- a/src/filemanager/boxes.c
74+++ b/src/filemanager/boxes.c
75@@ -280,7 +280,9 @@ appearance_box_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm
76 switch (msg)
77 {
78 case MSG_INIT:
79+#ifdef ENABLE_SHADOWS
80 if (!tty_use_colors ())
81+#endif
82 {
83 Widget *shadow;
84
85--
862.34.1
87
diff --git a/meta/recipes-extended/mc/mc_4.8.27.bb b/meta/recipes-extended/mc/mc_4.8.27.bb
index 546e615d1d..e877780ea0 100644
--- a/meta/recipes-extended/mc/mc_4.8.27.bb
+++ b/meta/recipes-extended/mc/mc_4.8.27.bb
@@ -11,6 +11,7 @@ RRECOMMENDS:${PN} = "ncurses-terminfo"
11SRC_URI = "http://www.midnight-commander.org/downloads/${BPN}-${PV}.tar.bz2 \ 11SRC_URI = "http://www.midnight-commander.org/downloads/${BPN}-${PV}.tar.bz2 \
12 file://0001-mc-replace-perl-w-with-use-warnings.patch \ 12 file://0001-mc-replace-perl-w-with-use-warnings.patch \
13 file://nomandate.patch \ 13 file://nomandate.patch \
14 file://0001-Ticket-4200-fix-FTBFS-with-ncurses-build-with-disabl.patch \
14 " 15 "
15SRC_URI[sha256sum] = "2f52dd9c75c20d8eac7701bd3a8c6c125aaf8cdd9cf12b78ca50a0102b543407" 16SRC_URI[sha256sum] = "2f52dd9c75c20d8eac7701bd3a8c6c125aaf8cdd9cf12b78ca50a0102b543407"
16 17
@@ -27,7 +28,9 @@ PACKAGECONFIG ??= ""
27PACKAGECONFIG[smb] = "--enable-vfs-smb,--disable-vfs-smb,samba," 28PACKAGECONFIG[smb] = "--enable-vfs-smb,--disable-vfs-smb,samba,"
28PACKAGECONFIG[sftp] = "--enable-vfs-sftp,--disable-vfs-sftp,libssh2," 29PACKAGECONFIG[sftp] = "--enable-vfs-sftp,--disable-vfs-sftp,libssh2,"
29 30
30CFLAGS:append:libc-musl = ' -DNCURSES_WIDECHAR=1 ' 31# enable NCURSES_WIDECHAR=1 only if ENABLE_WIDEC has not been explicitly disabled (e.g. by the distro config).
32# When compiling against the ncurses library, NCURSES_WIDECHAR needs to explicitly set to 0 in this case.
33CFLAGS:append:libc-musl = "${@' -DNCURSES_WIDECHAR=1' if bb.utils.to_boolean((d.getVar('ENABLE_WIDEC') or 'True')) else ' -DNCURSES_WIDECHAR=0'}"
31EXTRA_OECONF = "--with-screen=ncurses --without-gpm-mouse --without-x --disable-configure-args" 34EXTRA_OECONF = "--with-screen=ncurses --without-gpm-mouse --without-x --disable-configure-args"
32EXTRANATIVEPATH += "file-native" 35EXTRANATIVEPATH += "file-native"
33 36
diff --git a/meta/recipes-extended/pigz/files/0001-Fix-bug-when-combining-l-with-d.patch b/meta/recipes-extended/pigz/files/0001-Fix-bug-when-combining-l-with-d.patch
new file mode 100644
index 0000000000..9c301f2054
--- /dev/null
+++ b/meta/recipes-extended/pigz/files/0001-Fix-bug-when-combining-l-with-d.patch
@@ -0,0 +1,50 @@
1From 65986f3d12d434b9bc428ceb6fcb1f6eeeb2c47d Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Mon, 17 Jan 2022 15:36:56 +0800
4Subject: [PATCH] Fix bug when combining -l with -d.
5
6Though it makes no sense to do pigz -ld, that is implicit when
7doing unpigz -l. This commit fixes a bug for that combination.
8
9Upstream-Status: Backport [https://github.com/madler/pigz/commit/326bba44aa102c707dd6ebcd2fc3f413b3119db0]
10
11Signed-off-by: Changqing Li <changqing.li@windriver.com>
12---
13 pigz.c | 14 +++++++-------
14 1 file changed, 7 insertions(+), 7 deletions(-)
15
16diff --git a/pigz.c b/pigz.c
17index f90157f..d648216 100644
18--- a/pigz.c
19+++ b/pigz.c
20@@ -4007,6 +4007,13 @@ local void process(char *path) {
21 }
22 SET_BINARY_MODE(g.ind);
23
24+ // if requested, just list information about the input file
25+ if (g.list && g.decode != 2) {
26+ list_info();
27+ load_end();
28+ return;
29+ }
30+
31 // if decoding or testing, try to read gzip header
32 if (g.decode) {
33 in_init();
34@@ -4048,13 +4055,6 @@ local void process(char *path) {
35 }
36 }
37
38- // if requested, just list information about input file
39- if (g.list) {
40- list_info();
41- load_end();
42- return;
43- }
44-
45 // create output file out, descriptor outd
46 if (path == NULL || g.pipeout) {
47 // write to stdout
48--
492.17.1
50
diff --git a/meta/recipes-extended/pigz/pigz_2.6.bb b/meta/recipes-extended/pigz/pigz_2.6.bb
index 3566e18b7e..d490a6a722 100644
--- a/meta/recipes-extended/pigz/pigz_2.6.bb
+++ b/meta/recipes-extended/pigz/pigz_2.6.bb
@@ -8,7 +8,8 @@ SECTION = "console/utils"
8LICENSE = "Zlib & Apache-2.0" 8LICENSE = "Zlib & Apache-2.0"
9LIC_FILES_CHKSUM = "file://pigz.c;md5=9ae6dee8ceba9610596ed0ada493d142;beginline=7;endline=21" 9LIC_FILES_CHKSUM = "file://pigz.c;md5=9ae6dee8ceba9610596ed0ada493d142;beginline=7;endline=21"
10 10
11SRC_URI = "http://zlib.net/${BPN}/fossils/${BP}.tar.gz" 11SRC_URI = "http://zlib.net/${BPN}/fossils/${BP}.tar.gz \
12 file://0001-Fix-bug-when-combining-l-with-d.patch"
12SRC_URI[sha256sum] = "2eed7b0d7449d1d70903f2a62cd6005d262eb3a8c9e98687bc8cbb5809db2a7d" 13SRC_URI[sha256sum] = "2eed7b0d7449d1d70903f2a62cd6005d262eb3a8c9e98687bc8cbb5809db2a7d"
13PROVIDES:class-native += "gzip-native" 14PROVIDES:class-native += "gzip-native"
14 15
diff --git a/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch b/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch
index 95728bcd3f..628db42136 100644
--- a/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch
+++ b/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch
@@ -1,124 +1,52 @@
1From 30a3906a0a21120fa6bbc918b6258ab9303fbeaa Mon Sep 17 00:00:00 2001 1From 8b845fff891798a03bdf21354b52e4487c2c0200 Mon Sep 17 00:00:00 2001
2From: Scott Garman <scott.a.garman@intel.com> 2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Thu, 14 Apr 2016 12:28:57 +0200 3Date: Thu, 14 Apr 2022 23:11:53 +0000
4Subject: [PATCH] Disable use of syslog for sysroot 4Subject: [PATCH] Disable use of syslog for shadow-native tools
5 5
6Disable use of syslog to prevent sysroot user and group additions from 6Disable use of syslog to prevent sysroot user and group additions from
7writing entries to the host's syslog. This patch should only be used 7writing entries to the host's syslog. This patch should only be used
8with the shadow-native recipe. 8with the shadow-native recipe.
9 9
10Upstream-Status: Inappropriate [disable feature] 10Upstream-Status: Inappropriate [OE specific configuration]
11 11Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
12Signed-off-by: Scott Garman <scott.a.garman@intel.com>
13Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> 12Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
14Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
15 13
16--- 14---
17 src/groupadd.c | 3 +++ 15 configure.ac | 2 +-
18 src/groupdel.c | 3 +++ 16 src/login_nopam.c | 3 ++-
19 src/groupmems.c | 3 +++ 17 2 files changed, 3 insertions(+), 2 deletions(-)
20 src/groupmod.c | 3 +++
21 src/useradd.c | 3 +++
22 src/userdel.c | 4 ++++
23 src/usermod.c | 3 +++
24 7 files changed, 22 insertions(+)
25 18
26diff --git a/src/groupadd.c b/src/groupadd.c 19diff --git a/configure.ac b/configure.ac
27index d7f68b1..5fe5f43 100644 20index 5dcae19..b2c58f5 100644
28--- a/src/groupadd.c 21--- a/configure.ac
29+++ b/src/groupadd.c 22+++ b/configure.ac
30@@ -34,6 +34,9 @@ 23@@ -204,7 +204,7 @@ AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",
31 24 [Path to passwd program.])
32 #ident "$Id$" 25
33 26 dnl XXX - quick hack, should disappear before anyone notices :).
34+/* Disable use of syslog since we're running this command against a sysroot */ 27-AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
35+#undef USE_SYSLOG 28+#AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
36+ 29 if test "$ac_cv_func_ruserok" = "yes"; then
37 #include <ctype.h> 30 AC_DEFINE(RLOGIN, 1, [Define if login should support the -r flag for rlogind.])
38 #include <fcntl.h> 31 AC_DEFINE(RUSEROK, 0, [Define to the ruserok() "success" return value (0 or 1).])
39 #include <getopt.h> 32diff --git a/src/login_nopam.c b/src/login_nopam.c
40diff --git a/src/groupdel.c b/src/groupdel.c 33index df6ba88..fc24e13 100644
41index 5c89312..2aefc5a 100644 34--- a/src/login_nopam.c
42--- a/src/groupdel.c 35+++ b/src/login_nopam.c
43+++ b/src/groupdel.c 36@@ -29,7 +29,6 @@
44@@ -34,6 +34,9 @@ 37 #ifndef USE_PAM
45
46 #ident "$Id$" 38 #ident "$Id$"
47 39
48+/* Disable use of syslog since we're running this command against a sysroot */ 40-#include "prototypes.h"
49+#undef USE_SYSLOG 41 /*
50+ 42 * This module implements a simple but effective form of login access
51 #include <ctype.h> 43 * control based on login names and on host (or domain) names, internet
52 #include <fcntl.h> 44@@ -57,6 +56,8 @@
53 #include <grp.h> 45 #include <netinet/in.h>
54diff --git a/src/groupmems.c b/src/groupmems.c 46 #include <arpa/inet.h> /* for inet_ntoa() */
55index 654a8f3..6b2026b 100644
56--- a/src/groupmems.c
57+++ b/src/groupmems.c
58@@ -32,6 +32,9 @@
59
60 #include <config.h>
61
62+/* Disable use of syslog since we're running this command against a sysroot */
63+#undef USE_SYSLOG
64+
65 #include <fcntl.h>
66 #include <getopt.h>
67 #include <grp.h>
68diff --git a/src/groupmod.c b/src/groupmod.c
69index acd6f35..a2c5247 100644
70--- a/src/groupmod.c
71+++ b/src/groupmod.c
72@@ -34,6 +34,9 @@
73
74 #ident "$Id$"
75
76+/* Disable use of syslog since we're running this command against a sysroot */
77+#undef USE_SYSLOG
78+
79 #include <ctype.h>
80 #include <fcntl.h>
81 #include <getopt.h>
82diff --git a/src/useradd.c b/src/useradd.c
83index 127177e..b80e505 100644
84--- a/src/useradd.c
85+++ b/src/useradd.c
86@@ -34,6 +34,9 @@
87
88 #ident "$Id$"
89
90+/* Disable use of syslog since we're running this command against a sysroot */
91+#undef USE_SYSLOG
92+
93 #include <assert.h>
94 #include <ctype.h>
95 #include <errno.h>
96diff --git a/src/userdel.c b/src/userdel.c
97index 79a7c89..c1e010a 100644
98--- a/src/userdel.c
99+++ b/src/userdel.c
100@@ -31,6 +31,10 @@
101 */
102
103 #include <config.h>
104+
105+/* Disable use of syslog since we're running this command against a sysroot */
106+#undef USE_SYSLOG
107+
108 #include <assert.h>
109 #include <dirent.h>
110 #include <errno.h>
111diff --git a/src/usermod.c b/src/usermod.c
112index 03bb9b9..e15fdd4 100644
113--- a/src/usermod.c
114+++ b/src/usermod.c
115@@ -34,6 +34,9 @@
116
117 #ident "$Id$"
118 47
119+/* Disable use of syslog since we're running this command against a sysroot */ 48+#include "prototypes.h"
120+#undef USE_SYSLOG
121+ 49+
122 #include <assert.h> 50 #if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 64)
123 #include <ctype.h> 51 #undef MAXHOSTNAMELEN
124 #include <errno.h> 52 #define MAXHOSTNAMELEN 256
diff --git a/meta/recipes-extended/unzip/unzip/CVE-2021-4217.patch b/meta/recipes-extended/unzip/unzip/CVE-2021-4217.patch
new file mode 100644
index 0000000000..6ba2b879a3
--- /dev/null
+++ b/meta/recipes-extended/unzip/unzip/CVE-2021-4217.patch
@@ -0,0 +1,67 @@
1From 731d698377dbd1f5b1b90efeb8094602ed59fc40 Mon Sep 17 00:00:00 2001
2From: Nils Bars <nils.bars@t-online.de>
3Date: Mon, 17 Jan 2022 16:53:16 +0000
4Subject: [PATCH] Fix null pointer dereference and use of uninitialized data
5
6This fixes a bug that causes use of uninitialized heap data if `readbuf` fails
7to read as many bytes as indicated by the extra field length attribute.
8Furthermore, this fixes a null pointer dereference if an archive contains an
9`EF_UNIPATH` extra field but does not have a filename set.
10---
11 fileio.c | 5 ++++-
12 process.c | 6 +++++-
13 2 files changed, 9 insertions(+), 2 deletions(-)
14---
15
16Patch from:
17https://bugs.launchpad.net/ubuntu/+source/unzip/+bug/1957077
18https://launchpadlibrarian.net/580782282/0001-Fix-null-pointer-dereference-and-use-of-uninitialized-data.patch
19Regenerated to apply without offsets.
20
21CVE: CVE-2021-4217
22
23Upstream-Status: Pending [infozip upstream inactive]
24
25Signed-off-by: Joe Slater <joe.slater@windriver.com>
26
27
28diff --git a/fileio.c b/fileio.c
29index 14460f3..1dc319e 100644
30--- a/fileio.c
31+++ b/fileio.c
32@@ -2301,8 +2301,11 @@ int do_string(__G__ length, option) /* return PK-type error code */
33 seek_zipf(__G__ G.cur_zipfile_bufstart - G.extra_bytes +
34 (G.inptr-G.inbuf) + length);
35 } else {
36- if (readbuf(__G__ (char *)G.extra_field, length) == 0)
37+ unsigned bytes_read = readbuf(__G__ (char *)G.extra_field, length);
38+ if (bytes_read == 0)
39 return PK_EOF;
40+ if (bytes_read != length)
41+ return PK_ERR;
42 /* Looks like here is where extra fields are read */
43 if (getZip64Data(__G__ G.extra_field, length) != PK_COOL)
44 {
45diff --git a/process.c b/process.c
46index 5f8f6c6..de843a5 100644
47--- a/process.c
48+++ b/process.c
49@@ -2058,10 +2058,14 @@ int getUnicodeData(__G__ ef_buf, ef_len)
50 G.unipath_checksum = makelong(offset + ef_buf);
51 offset += 4;
52
53+ if (!G.filename_full) {
54+ /* Check if we have a unicode extra section but no filename set */
55+ return PK_ERR;
56+ }
57+
58 /*
59 * Compute 32-bit crc
60 */
61-
62 chksum = crc32(chksum, (uch *)(G.filename_full),
63 strlen(G.filename_full));
64
65--
662.32.0
67
diff --git a/meta/recipes-extended/unzip/unzip_6.0.bb b/meta/recipes-extended/unzip/unzip_6.0.bb
index 0bc6abcd4b..d074db37b4 100644
--- a/meta/recipes-extended/unzip/unzip_6.0.bb
+++ b/meta/recipes-extended/unzip/unzip_6.0.bb
@@ -27,6 +27,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/infozip/UnZip%206.x%20%28latest%29/UnZip%206.0/
27 file://CVE-2019-13232_p2.patch \ 27 file://CVE-2019-13232_p2.patch \
28 file://CVE-2019-13232_p3.patch \ 28 file://CVE-2019-13232_p3.patch \
29 file://unzip_optimization.patch \ 29 file://unzip_optimization.patch \
30 file://CVE-2021-4217.patch \
30" 31"
31UPSTREAM_VERSION_UNKNOWN = "1" 32UPSTREAM_VERSION_UNKNOWN = "1"
32 33
diff --git a/meta/recipes-extended/xz/xz/CVE-2022-1271.patch b/meta/recipes-extended/xz/xz/CVE-2022-1271.patch
new file mode 100644
index 0000000000..e43e73cf12
--- /dev/null
+++ b/meta/recipes-extended/xz/xz/CVE-2022-1271.patch
@@ -0,0 +1,96 @@
1From dc932a1e9c0d9f1db71be11a9b82496e3a72f112 Mon Sep 17 00:00:00 2001
2From: Lasse Collin <lasse.collin@tukaani.org>
3Date: Tue, 29 Mar 2022 19:19:12 +0300
4Subject: [PATCH] xzgrep: Fix escaping of malicious filenames (ZDI-CAN-16587).
5
6Malicious filenames can make xzgrep to write to arbitrary files
7or (with a GNU sed extension) lead to arbitrary code execution.
8
9xzgrep from XZ Utils versions up to and including 5.2.5 are
10affected. 5.3.1alpha and 5.3.2alpha are affected as well.
11This patch works for all of them.
12
13This bug was inherited from gzip's zgrep. gzip 1.12 includes
14a fix for zgrep.
15
16The issue with the old sed script is that with multiple newlines,
17the N-command will read the second line of input, then the
18s-commands will be skipped because it's not the end of the
19file yet, then a new sed cycle starts and the pattern space
20is printed and emptied. So only the last line or two get escaped.
21
22One way to fix this would be to read all lines into the pattern
23space first. However, the included fix is even simpler: All lines
24except the last line get a backslash appended at the end. To ensure
25that shell command substitution doesn't eat a possible trailing
26newline, a colon is appended to the filename before escaping.
27The colon is later used to separate the filename from the grep
28output so it is fine to add it here instead of a few lines later.
29
30The old code also wasn't POSIX compliant as it used \n in the
31replacement section of the s-command. Using \<newline> is the
32POSIX compatible method.
33
34LC_ALL=C was added to the two critical sed commands. POSIX sed
35manual recommends it when using sed to manipulate pathnames
36because in other locales invalid multibyte sequences might
37cause issues with some sed implementations. In case of GNU sed,
38these particular sed scripts wouldn't have such problems but some
39other scripts could have, see:
40
41 info '(sed)Locale Considerations'
42
43This vulnerability was discovered by:
44cleemy desu wayo working with Trend Micro Zero Day Initiative
45
46Thanks to Jim Meyering and Paul Eggert discussing the different
47ways to fix this and for coordinating the patch release schedule
48with gzip.
49
50Upstream-Status: Backport [https://tukaani.org/xz/xzgrep-ZDI-CAN-16587.patch]
51CVE: CVE-2022-1271
52
53Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
54---
55 src/scripts/xzgrep.in | 20 ++++++++++++--------
56 1 file changed, 12 insertions(+), 8 deletions(-)
57
58diff --git a/src/scripts/xzgrep.in b/src/scripts/xzgrep.in
59index 9db5c3a..f64dddb 100644
60--- a/src/scripts/xzgrep.in
61+++ b/src/scripts/xzgrep.in
62@@ -179,22 +179,26 @@ for i; do
63 { test $# -eq 1 || test $no_filename -eq 1; }; then
64 eval "$grep"
65 else
66+ # Append a colon so that the last character will never be a newline
67+ # which would otherwise get lost in shell command substitution.
68+ i="$i:"
69+
70+ # Escape & \ | and newlines only if such characters are present
71+ # (speed optimization).
72 case $i in
73 (*'
74 '* | *'&'* | *'\'* | *'|'*)
75- i=$(printf '%s\n' "$i" |
76- sed '
77- $!N
78- $s/[&\|]/\\&/g
79- $s/\n/\\n/g
80- ');;
81+ i=$(printf '%s\n' "$i" | LC_ALL=C sed 's/[&\|]/\\&/g; $!s/$/\\/');;
82 esac
83- sed_script="s|^|$i:|"
84+
85+ # $i already ends with a colon so don't add it here.
86+ sed_script="s|^|$i|"
87
88 # Fail if grep or sed fails.
89 r=$(
90 exec 4>&1
91- (eval "$grep" 4>&-; echo $? >&4) 3>&- | sed "$sed_script" >&3 4>&-
92+ (eval "$grep" 4>&-; echo $? >&4) 3>&- |
93+ LC_ALL=C sed "$sed_script" >&3 4>&-
94 ) || r=2
95 exit $r
96 fi >&3 5>&-
diff --git a/meta/recipes-extended/xz/xz_5.2.5.bb b/meta/recipes-extended/xz/xz_5.2.5.bb
index 8021ebd9bc..200af0e672 100644
--- a/meta/recipes-extended/xz/xz_5.2.5.bb
+++ b/meta/recipes-extended/xz/xz_5.2.5.bb
@@ -23,7 +23,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=97d554a32881fee0aa283d96e47cb24a \
23 file://lib/getopt.c;endline=23;md5=2069b0ee710572c03bb3114e4532cd84 \ 23 file://lib/getopt.c;endline=23;md5=2069b0ee710572c03bb3114e4532cd84 \
24 " 24 "
25 25
26SRC_URI = "https://tukaani.org/xz/xz-${PV}.tar.gz" 26SRC_URI = "https://tukaani.org/xz/xz-${PV}.tar.gz \
27 file://CVE-2022-1271.patch \
28 "
27SRC_URI[md5sum] = "0d270c997aff29708c74d53f599ef717" 29SRC_URI[md5sum] = "0d270c997aff29708c74d53f599ef717"
28SRC_URI[sha256sum] = "f6f4910fd033078738bd82bfba4f49219d03b17eb0794eb91efbae419f4aba10" 30SRC_URI[sha256sum] = "f6f4910fd033078738bd82bfba4f49219d03b17eb0794eb91efbae419f4aba10"
29UPSTREAM_CHECK_REGEX = "xz-(?P<pver>\d+(\.\d+)+)\.tar" 31UPSTREAM_CHECK_REGEX = "xz-(?P<pver>\d+(\.\d+)+)\.tar"
diff --git a/meta/recipes-extended/zip/zip-3.0/0001-configure-use-correct-CPP.patch b/meta/recipes-extended/zip/zip-3.0/0001-configure-use-correct-CPP.patch
new file mode 100644
index 0000000000..02253f968c
--- /dev/null
+++ b/meta/recipes-extended/zip/zip-3.0/0001-configure-use-correct-CPP.patch
@@ -0,0 +1,47 @@
1From 7a2729ee7f5d9b9d4a0d9b83fe641a2ab03c4ee0 Mon Sep 17 00:00:00 2001
2From: Joe Slater <joe.slater@windriver.com>
3Date: Thu, 24 Feb 2022 17:36:59 -0800
4Subject: [PATCH 1/2] configure: use correct CPP
5
6configure uses CPP to test that two assembler routines
7can be built. Unfortunately, it will use /usr/bin/cpp
8if it exists, invalidating the tests. We use the $CC
9passed to configure.
10
11Upstream-Status: Inappropriate [openembedded specific]
12
13Signed-off-by: Joe Slater <joe.slater@windriver.com>
14---
15 unix/configure | 15 +++++++++------
16 1 file changed, 9 insertions(+), 6 deletions(-)
17
18diff --git a/unix/configure b/unix/configure
19index 73ba803..7e21070 100644
20--- a/unix/configure
21+++ b/unix/configure
22@@ -220,13 +220,16 @@ fi
23 echo Check for the C preprocessor
24 # on SVR4, cc -E does not produce correct assembler files. Need /lib/cpp.
25 CPP="${CC} -E"
26+
27+# We should not change CPP for yocto builds.
28+#
29 # solaris as(1) needs -P, maybe others as well ?
30-[ -f /usr/ccs/lib/cpp ] && CPP="/usr/ccs/lib/cpp -P"
31-[ -f /usr/lib/cpp ] && CPP=/usr/lib/cpp
32-[ -f /lib/cpp ] && CPP=/lib/cpp
33-[ -f /usr/bin/cpp ] && CPP=/usr/bin/cpp
34-[ -f /xenix ] && CPP="${CC} -E"
35-[ -f /lynx.os ] && CPP="${CC} -E"
36+# [ -f /usr/ccs/lib/cpp ] && CPP="/usr/ccs/lib/cpp -P"
37+# [ -f /usr/lib/cpp ] && CPP=/usr/lib/cpp
38+# [ -f /lib/cpp ] && CPP=/lib/cpp
39+# [ -f /usr/bin/cpp ] && CPP=/usr/bin/cpp
40+# [ -f /xenix ] && CPP="${CC} -E"
41+# [ -f /lynx.os ] && CPP="${CC} -E"
42
43 echo "#include <stdio.h>" > conftest.c
44 $CPP conftest.c >/dev/null 2>/dev/null || CPP="${CC} -E"
45--
462.24.1
47
diff --git a/meta/recipes-extended/zip/zip-3.0/0002-configure-support-PIC-code-build.patch b/meta/recipes-extended/zip/zip-3.0/0002-configure-support-PIC-code-build.patch
new file mode 100644
index 0000000000..6e0879616a
--- /dev/null
+++ b/meta/recipes-extended/zip/zip-3.0/0002-configure-support-PIC-code-build.patch
@@ -0,0 +1,34 @@
1From b0492506d2c28581193906e9d260d4f0451e2c39 Mon Sep 17 00:00:00 2001
2From: Joe Slater <joe.slater@windriver.com>
3Date: Thu, 24 Feb 2022 17:46:03 -0800
4Subject: [PATCH 2/2] configure: support PIC code build
5
6Disable building match.S. The code requires
7relocation in .text.
8
9Upstream-Status: Inappropriate [openembedded specific]
10
11Signed-off-by: Joe Slater <joe.slater@windriver.com>
12---
13 unix/configure | 5 +++--
14 1 file changed, 3 insertions(+), 2 deletions(-)
15
16diff --git a/unix/configure b/unix/configure
17index 7e21070..1bc698b 100644
18--- a/unix/configure
19+++ b/unix/configure
20@@ -242,8 +242,9 @@ if eval "$CPP match.S > _match.s 2>/dev/null"; then
21 if test ! -s _match.s || grep error < _match.s > /dev/null; then
22 :
23 elif eval "$CC -c _match.s >/dev/null 2>/dev/null" && [ -f _match.o ]; then
24- CFLAGS="${CFLAGS} -DASMV"
25- OBJA="match.o"
26+ # disable match.S for PIC code
27+ # CFLAGS="${CFLAGS} -DASMV"
28+ # OBJA="match.o"
29 echo "int foo() { return 0;}" > conftest.c
30 $CC -c conftest.c >/dev/null 2>/dev/null
31 echo Check if compiler generates underlines
32--
332.24.1
34
diff --git a/meta/recipes-extended/zip/zip_3.0.bb b/meta/recipes-extended/zip/zip_3.0.bb
index 18b5d8648e..f8e0b6e259 100644
--- a/meta/recipes-extended/zip/zip_3.0.bb
+++ b/meta/recipes-extended/zip/zip_3.0.bb
@@ -14,6 +14,8 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/infozip/Zip%203.x%20%28latest%29/3.0/zip30.tar.
14 file://fix-security-format.patch \ 14 file://fix-security-format.patch \
15 file://10-remove-build-date.patch \ 15 file://10-remove-build-date.patch \
16 file://zipnote-crashes-with-segfault.patch \ 16 file://zipnote-crashes-with-segfault.patch \
17 file://0001-configure-use-correct-CPP.patch \
18 file://0002-configure-support-PIC-code-build.patch \
17 " 19 "
18UPSTREAM_VERSION_UNKNOWN = "1" 20UPSTREAM_VERSION_UNKNOWN = "1"
19 21
diff --git a/meta/recipes-gnome/epiphany/epiphany_40.3.bb b/meta/recipes-gnome/epiphany/epiphany_40.6.bb
index c5dc0baefa..1f3fab3c4a 100644
--- a/meta/recipes-gnome/epiphany/epiphany_40.3.bb
+++ b/meta/recipes-gnome/epiphany/epiphany_40.6.bb
@@ -20,7 +20,7 @@ SRC_URI = "${GNOME_MIRROR}/${GNOMEBN}/${@oe.utils.trim_version("${PV}", 1)}/${GN
20 file://migrator.patch \ 20 file://migrator.patch \
21 file://distributor.patch \ 21 file://distributor.patch \
22 " 22 "
23SRC_URI[archive.sha256sum] = "dad138b9f2d55de271128fca38b61f53fd980c587d29e1ba6b508fff3b19f564" 23SRC_URI[archive.sha256sum] = "a2abf71b165b4302643147d637808847d64df6a97ce460703542dec75e81b5f7"
24 24
25# Developer mode enables debugging 25# Developer mode enables debugging
26PACKAGECONFIG[developer-mode] = "-Ddeveloper_mode=true,-Ddeveloper_mode=false" 26PACKAGECONFIG[developer-mode] = "-Ddeveloper_mode=true,-Ddeveloper_mode=false"
diff --git a/meta/recipes-graphics/drm/libdrm_2.4.107.bb b/meta/recipes-graphics/drm/libdrm_2.4.109.bb
index b645898481..fb5ddd82c0 100644
--- a/meta/recipes-graphics/drm/libdrm_2.4.107.bb
+++ b/meta/recipes-graphics/drm/libdrm_2.4.109.bb
@@ -13,7 +13,7 @@ DEPENDS = "libpthread-stubs"
13SRC_URI = "http://dri.freedesktop.org/libdrm/${BP}.tar.xz \ 13SRC_URI = "http://dri.freedesktop.org/libdrm/${BP}.tar.xz \
14 " 14 "
15 15
16SRC_URI[sha256sum] = "c554cef03b033636a975543eab363cc19081cb464595d3da1ec129f87370f888" 16SRC_URI[sha256sum] = "629352e08c1fe84862ca046598d8a08ce14d26ab25ee1f4704f993d074cb7f26"
17 17
18inherit meson pkgconfig manpages 18inherit meson pkgconfig manpages
19 19
diff --git a/meta/recipes-graphics/harfbuzz/harfbuzz_2.9.0.bb b/meta/recipes-graphics/harfbuzz/harfbuzz_2.9.1.bb
index bc91a8c03c..694553beef 100644
--- a/meta/recipes-graphics/harfbuzz/harfbuzz_2.9.0.bb
+++ b/meta/recipes-graphics/harfbuzz/harfbuzz_2.9.1.bb
@@ -12,7 +12,7 @@ UPSTREAM_CHECK_URI = "https://github.com/${BPN}/${BPN}/releases"
12UPSTREAM_CHECK_REGEX = "harfbuzz-(?P<pver>\d+(\.\d+)+).tar" 12UPSTREAM_CHECK_REGEX = "harfbuzz-(?P<pver>\d+(\.\d+)+).tar"
13 13
14SRC_URI = "https://github.com/${BPN}/${BPN}/releases/download/${PV}/${BPN}-${PV}.tar.xz" 14SRC_URI = "https://github.com/${BPN}/${BPN}/releases/download/${PV}/${BPN}-${PV}.tar.xz"
15SRC_URI[sha256sum] = "3e1c2e1d2c65d56364fd16d1c41a06b2a35795496f78dfff635c2b7414b54c5a" 15SRC_URI[sha256sum] = "0edcc980f526a338452180e701d6aba6323aef457b6686976a7d17ccbddc51cf"
16 16
17inherit meson pkgconfig lib_package gtk-doc gobject-introspection 17inherit meson pkgconfig lib_package gtk-doc gobject-introspection
18 18
diff --git a/meta/recipes-graphics/virglrenderer/virglrenderer/cve-2022-0135.patch b/meta/recipes-graphics/virglrenderer/virglrenderer/cve-2022-0135.patch
new file mode 100644
index 0000000000..ae42dc8f6c
--- /dev/null
+++ b/meta/recipes-graphics/virglrenderer/virglrenderer/cve-2022-0135.patch
@@ -0,0 +1,117 @@
1From 63aee871365f9c9e7fa9125672302a0fb250d34d Mon Sep 17 00:00:00 2001
2From: Gert Wollny <gert.wollny@collabora.com>
3Date: Tue, 30 Nov 2021 09:16:24 +0100
4Subject: [PATCH 2/2] vrend: propperly check whether the shader image range is
5 correct
6
7Also add a test to check the integer underflow.
8
9Closes: #251
10Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
11Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
12
13cherry-pick from anongit.freedesktop.org/virglrenderer
14commit 2aed5d4...
15
16CVE: CVE-2022-0135
17Upstream-Status: Backport
18Signed-off-by: Joe Slater <joe.slater@windriver.com>
19
20---
21 src/vrend_decode.c | 3 +-
22 tests/test_fuzzer_formats.c | 57 +++++++++++++++++++++++++++++++++++++
23 2 files changed, 59 insertions(+), 1 deletion(-)
24
25diff --git a/src/vrend_decode.c b/src/vrend_decode.c
26index 91f5f24..6771b10 100644
27--- a/src/vrend_decode.c
28+++ b/src/vrend_decode.c
29@@ -1249,8 +1249,9 @@ static int vrend_decode_set_shader_images(struct vrend_context *ctx, const uint3
30 if (num_images < 1) {
31 return 0;
32 }
33+
34 if (start_slot > PIPE_MAX_SHADER_IMAGES ||
35- start_slot > PIPE_MAX_SHADER_IMAGES - num_images)
36+ start_slot + num_images > PIPE_MAX_SHADER_IMAGES)
37 return EINVAL;
38
39 for (uint32_t i = 0; i < num_images; i++) {
40diff --git a/tests/test_fuzzer_formats.c b/tests/test_fuzzer_formats.c
41index 154a2e5..e32caf0 100644
42--- a/tests/test_fuzzer_formats.c
43+++ b/tests/test_fuzzer_formats.c
44@@ -958,6 +958,61 @@ static void test_vrend_set_signle_abo_heap_overflow() {
45 virgl_renderer_submit_cmd((void *) cmd, ctx_id, 0xde);
46 }
47
48+static void test_vrend_set_shader_images_overflow()
49+{
50+ uint32_t num_shaders = PIPE_MAX_SHADER_IMAGES + 1;
51+ uint32_t size = num_shaders * VIRGL_SET_SHADER_IMAGE_ELEMENT_SIZE + 3;
52+ uint32_t cmd[size];
53+ int i = 0;
54+ cmd[i++] = ((size - 1)<< 16) | 0 << 8 | VIRGL_CCMD_SET_SHADER_IMAGES;
55+ cmd[i++] = PIPE_SHADER_FRAGMENT;
56+ memset(&cmd[i], 0, size - i);
57+
58+ virgl_renderer_submit_cmd((void *) cmd, ctx_id, size);
59+}
60+
61+/* Test adapted from yaojun8558363@gmail.com:
62+ * https://gitlab.freedesktop.org/virgl/virglrenderer/-/issues/250
63+*/
64+static void test_vrend_3d_resource_overflow() {
65+
66+ struct virgl_renderer_resource_create_args resource;
67+ resource.handle = 0x4c474572;
68+ resource.target = PIPE_TEXTURE_2D_ARRAY;
69+ resource.format = VIRGL_FORMAT_Z24X8_UNORM;
70+ resource.nr_samples = 2;
71+ resource.last_level = 0;
72+ resource.array_size = 3;
73+ resource.bind = VIRGL_BIND_SAMPLER_VIEW;
74+ resource.depth = 1;
75+ resource.width = 8;
76+ resource.height = 4;
77+ resource.flags = 0;
78+
79+ virgl_renderer_resource_create(&resource, NULL, 0);
80+ virgl_renderer_ctx_attach_resource(ctx_id, resource.handle);
81+
82+ uint32_t size = 0x400;
83+ uint32_t cmd[size];
84+ int i = 0;
85+ cmd[i++] = (size - 1) << 16 | 0 << 8 | VIRGL_CCMD_RESOURCE_INLINE_WRITE;
86+ cmd[i++] = resource.handle;
87+ cmd[i++] = 0; // level
88+ cmd[i++] = 0; // usage
89+ cmd[i++] = 0; // stride
90+ cmd[i++] = 0; // layer_stride
91+ cmd[i++] = 0; // x
92+ cmd[i++] = 0; // y
93+ cmd[i++] = 0; // z
94+ cmd[i++] = 8; // w
95+ cmd[i++] = 4; // h
96+ cmd[i++] = 3; // d
97+ memset(&cmd[i], 0, size - i);
98+
99+ virgl_renderer_submit_cmd((void *) cmd, ctx_id, size);
100+}
101+
102+
103 int main()
104 {
105 initialize_environment();
106@@ -980,6 +1035,8 @@ int main()
107 test_cs_nullpointer_deference();
108 test_vrend_set_signle_abo_heap_overflow();
109
110+ test_vrend_set_shader_images_overflow();
111+ test_vrend_3d_resource_overflow();
112
113 virgl_renderer_context_destroy(ctx_id);
114 virgl_renderer_cleanup(&cookie);
115--
1162.25.1
117
diff --git a/meta/recipes-graphics/virglrenderer/virglrenderer/cve-2022-0175.patch b/meta/recipes-graphics/virglrenderer/virglrenderer/cve-2022-0175.patch
new file mode 100644
index 0000000000..7fbab75091
--- /dev/null
+++ b/meta/recipes-graphics/virglrenderer/virglrenderer/cve-2022-0175.patch
@@ -0,0 +1,107 @@
1From 5ca7aca001092c557f0b6fc1ba3db7dcdab860b7 Mon Sep 17 00:00:00 2001
2From: Gert Wollny <gert.wollny@collabora.com>
3Date: Tue, 30 Nov 2021 09:29:42 +0100
4Subject: [PATCH 1/2] vrend: clear memory when allocating a host-backed memory
5 resource
6
7Closes: #249
8Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
9Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
10
11cherry-pick from anongit.freedesktop.org/virglrenderer
12commit b05bb61...
13
14CVE: CVE-2022-0175
15Upstream-Status: Backport
16Signed-off-by: Joe Slater <joe.slater@windriver.com>
17
18---
19 src/vrend_renderer.c | 2 +-
20 tests/test_virgl_transfer.c | 51 +++++++++++++++++++++++++++++++++++++
21 2 files changed, 52 insertions(+), 1 deletion(-)
22
23diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
24index b8b2a36..2650cf2 100644
25--- a/src/vrend_renderer.c
26+++ b/src/vrend_renderer.c
27@@ -6788,7 +6788,7 @@ vrend_resource_alloc_buffer(struct vrend_resource *gr, uint32_t flags)
28 if (bind == VIRGL_BIND_CUSTOM) {
29 /* use iovec directly when attached */
30 gr->storage_bits |= VREND_STORAGE_HOST_SYSTEM_MEMORY;
31- gr->ptr = malloc(size);
32+ gr->ptr = calloc(1, size);
33 if (!gr->ptr)
34 return -ENOMEM;
35 } else if (bind == VIRGL_BIND_STAGING) {
36diff --git a/tests/test_virgl_transfer.c b/tests/test_virgl_transfer.c
37index bf7f438..3c53c3d 100644
38--- a/tests/test_virgl_transfer.c
39+++ b/tests/test_virgl_transfer.c
40@@ -952,6 +952,56 @@ START_TEST(virgl_test_transfer_near_res_bounds_with_stride_succeeds)
41 }
42 END_TEST
43
44+START_TEST(test_vrend_host_backed_memory_no_data_leak)
45+{
46+ struct iovec iovs[1];
47+ int niovs = 1;
48+
49+ struct virgl_context ctx = {0};
50+
51+ int ret = testvirgl_init_ctx_cmdbuf(&ctx);
52+
53+ struct virgl_renderer_resource_create_args res;
54+ res.handle = 0x400;
55+ res.target = PIPE_BUFFER;
56+ res.format = VIRGL_FORMAT_R8_UNORM;
57+ res.nr_samples = 0;
58+ res.last_level = 0;
59+ res.array_size = 1;
60+ res.bind = VIRGL_BIND_CUSTOM;
61+ res.depth = 1;
62+ res.width = 32;
63+ res.height = 1;
64+ res.flags = 0;
65+
66+ uint32_t size = 32;
67+ uint8_t* data = calloc(1, size);
68+ memset(data, 1, 32);
69+ iovs[0].iov_base = data;
70+ iovs[0].iov_len = size;
71+
72+ struct pipe_box box = {0,0,0, size, 1,1};
73+
74+ virgl_renderer_resource_create(&res, NULL, 0);
75+ virgl_renderer_ctx_attach_resource(ctx.ctx_id, res.handle);
76+
77+ ret = virgl_renderer_transfer_read_iov(res.handle, ctx.ctx_id, 0, 0, 0,
78+ (struct virgl_box *)&box, 0, iovs, niovs);
79+
80+ ck_assert_int_eq(ret, 0);
81+
82+ for (int i = 0; i < 32; ++i)
83+ ck_assert_int_eq(data[i], 0);
84+
85+ virgl_renderer_ctx_detach_resource(1, res.handle);
86+
87+ virgl_renderer_resource_unref(res.handle);
88+ free(data);
89+
90+}
91+END_TEST
92+
93+
94 static Suite *virgl_init_suite(void)
95 {
96 Suite *s;
97@@ -981,6 +1031,7 @@ static Suite *virgl_init_suite(void)
98 tcase_add_test(tc_core, virgl_test_transfer_buffer_bad_strides);
99 tcase_add_test(tc_core, virgl_test_transfer_2d_array_bad_layer_stride);
100 tcase_add_test(tc_core, virgl_test_transfer_2d_bad_level);
101+ tcase_add_test(tc_core, test_vrend_host_backed_memory_no_data_leak);
102
103 tcase_add_loop_test(tc_core, virgl_test_transfer_res_read_valid, 0, PIPE_MAX_TEXTURE_TYPES);
104 tcase_add_loop_test(tc_core, virgl_test_transfer_res_write_valid, 0, PIPE_MAX_TEXTURE_TYPES);
105--
1062.25.1
107
diff --git a/meta/recipes-graphics/virglrenderer/virglrenderer_0.9.1.bb b/meta/recipes-graphics/virglrenderer/virglrenderer_0.9.1.bb
index 65bd1af942..14e39fdb20 100644
--- a/meta/recipes-graphics/virglrenderer/virglrenderer_0.9.1.bb
+++ b/meta/recipes-graphics/virglrenderer/virglrenderer_0.9.1.bb
@@ -10,8 +10,10 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=c81c08eeefd9418fca8f88309a76db10"
10 10
11DEPENDS = "libdrm virtual/libgl virtual/libgbm libepoxy" 11DEPENDS = "libdrm virtual/libgl virtual/libgbm libepoxy"
12SRCREV = "363915595e05fb252e70d6514be2f0c0b5ca312b" 12SRCREV = "363915595e05fb252e70d6514be2f0c0b5ca312b"
13SRC_URI = "git://anongit.freedesktop.org/virglrenderer;branch=branch-0.9.1 \ 13SRC_URI = "git://anongit.freedesktop.org/git/virglrenderer;branch=branch-0.9.1 \
14 file://0001-meson.build-use-python3-directly-for-python.patch \ 14 file://0001-meson.build-use-python3-directly-for-python.patch \
15 file://cve-2022-0135.patch \
16 file://cve-2022-0175.patch \
15 " 17 "
16 18
17S = "${WORKDIR}/git" 19S = "${WORKDIR}/git"
diff --git a/meta/recipes-graphics/vulkan/vulkan-loader_1.2.182.0.bb b/meta/recipes-graphics/vulkan/vulkan-loader_1.2.182.0.bb
index 41632f25ce..984dc1253f 100644
--- a/meta/recipes-graphics/vulkan/vulkan-loader_1.2.182.0.bb
+++ b/meta/recipes-graphics/vulkan/vulkan-loader_1.2.182.0.bb
@@ -17,7 +17,7 @@ S = "${WORKDIR}/git"
17 17
18REQUIRED_DISTRO_FEATURES = "vulkan" 18REQUIRED_DISTRO_FEATURES = "vulkan"
19 19
20inherit cmake features_check 20inherit cmake features_check pkgconfig
21ANY_OF_DISTRO_FEATURES = "x11 wayland" 21ANY_OF_DISTRO_FEATURES = "x11 wayland"
22 22
23DEPENDS += "vulkan-headers" 23DEPENDS += "vulkan-headers"
diff --git a/meta/recipes-graphics/xorg-lib/libxshmfence_1.3.bb b/meta/recipes-graphics/xorg-lib/libxshmfence_1.3.bb
index d153c7a603..b0b6cb6b56 100644
--- a/meta/recipes-graphics/xorg-lib/libxshmfence_1.3.bb
+++ b/meta/recipes-graphics/xorg-lib/libxshmfence_1.3.bb
@@ -6,7 +6,7 @@ using file descriptor passing."
6 6
7require xorg-lib-common.inc 7require xorg-lib-common.inc
8 8
9LICENSE = "MIT-style" 9LICENSE = "HPND"
10LIC_FILES_CHKSUM = "file://COPYING;md5=47e508ca280fde97906eacb77892c3ac" 10LIC_FILES_CHKSUM = "file://COPYING;md5=47e508ca280fde97906eacb77892c3ac"
11 11
12DEPENDS += "virtual/libx11" 12DEPENDS += "virtual/libx11"
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc b/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc
index e1fc0a06dc..8864564b3e 100644
--- a/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc
+++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc
@@ -19,7 +19,15 @@ SRC_URI = "${XORG_MIRROR}/individual/xserver/${XORG_PN}-${PV}.tar.xz"
19 19
20UPSTREAM_CHECK_REGEX = "xorg-server-(?P<pver>\d+(\.(?!99)\d+)+)\.tar" 20UPSTREAM_CHECK_REGEX = "xorg-server-(?P<pver>\d+(\.(?!99)\d+)+)\.tar"
21 21
22CVE_PRODUCT = "xorg-server" 22CVE_PRODUCT = "xorg-server x_server"
23# This is specific to Debian's xserver-wrapper.c
24CVE_CHECK_WHITELIST += "CVE-2011-4613"
25# As per upstream, exploiting this flaw is non-trivial and it requires exact
26# timing on the behalf of the attacker. Many graphical applications exit if their
27# connection to the X server is lost, so a typical desktop session is either
28# impossible or difficult to exploit. There is currently no upstream patch
29# available for this flaw.
30CVE_CHECK_WHITELIST += "CVE-2020-25697"
23 31
24S = "${WORKDIR}/${XORG_PN}-${PV}" 32S = "${WORKDIR}/${XORG_PN}-${PV}"
25 33
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg_1.20.13.bb b/meta/recipes-graphics/xorg-xserver/xserver-xorg_1.20.14.bb
index 01a54070c7..71367c247e 100644
--- a/meta/recipes-graphics/xorg-xserver/xserver-xorg_1.20.13.bb
+++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg_1.20.14.bb
@@ -8,7 +8,7 @@ SRC_URI += "file://0001-xf86pciBus.c-use-Intel-ddx-only-for-pre-gen4-hardwar.pat
8 file://0001-Avoid-duplicate-definitions-of-IOPortBase.patch \ 8 file://0001-Avoid-duplicate-definitions-of-IOPortBase.patch \
9 file://0001-Fix-segfault-on-probing-a-non-PCI-platform-device-on.patch \ 9 file://0001-Fix-segfault-on-probing-a-non-PCI-platform-device-on.patch \
10 " 10 "
11SRC_URI[sha256sum] = "40aa4e96a56a81a301f15a9b10e06a22700f12b42d9e0e453c7f11d354386300" 11SRC_URI[sha256sum] = "5cc5b70b9be89443e2594b93656c60bd5e82cd7f01deb4ce4faf81dcf546a16b"
12 12
13# These extensions are now integrated into the server, so declare the migration 13# These extensions are now integrated into the server, so declare the migration
14# path for in-place upgrades. 14# path for in-place upgrades.
diff --git a/meta/recipes-kernel/dtc/python3-dtschema-wrapper/dt-doc-validate b/meta/recipes-kernel/dtc/python3-dtschema-wrapper/dt-doc-validate
new file mode 100644
index 0000000000..2aa57851c7
--- /dev/null
+++ b/meta/recipes-kernel/dtc/python3-dtschema-wrapper/dt-doc-validate
@@ -0,0 +1,20 @@
1#!/bin/sh
2# dt-doc-validate wrapper to allow kernel dt-validation to pass
3#
4# Copyright (C) 2021 Bruce Ashfield <bruce.ashfield@gmail.com>
5# License: MIT (see COPYING.MIT at the root of the repository for terms)
6
7for arg; do
8 case "$arg" in
9 --version)
10 echo "v2021.10"
11 ;;
12 esac
13done
14
15# TBD: left for future consideration
16# exec dt-doc-validate.real "$@"
17
18# we always succeed
19exit 0
20
diff --git a/meta/recipes-kernel/dtc/python3-dtschema-wrapper/dt-mk-schema b/meta/recipes-kernel/dtc/python3-dtschema-wrapper/dt-mk-schema
new file mode 100644
index 0000000000..24b89d8619
--- /dev/null
+++ b/meta/recipes-kernel/dtc/python3-dtschema-wrapper/dt-mk-schema
@@ -0,0 +1,20 @@
1#!/bin/sh
2# dt-mk-schema wrapper to allow kernel dt-validation to pass
3#
4# Copyright (C) 2021 Bruce Ashfield <bruce.ashfield@gmail.com>
5# License: MIT (see COPYING.MIT at the root of the repository for terms)
6
7for arg; do
8 case "$arg" in
9 --version)
10 echo "v2021.10"
11 ;;
12 esac
13done
14
15# TBD: left for future consideration
16# exec dt-mk-schema.real "$@"
17
18# we always succeed
19exit 0
20
diff --git a/meta/recipes-kernel/dtc/python3-dtschema-wrapper/dt-validate b/meta/recipes-kernel/dtc/python3-dtschema-wrapper/dt-validate
new file mode 100644
index 0000000000..8a4710a7ed
--- /dev/null
+++ b/meta/recipes-kernel/dtc/python3-dtschema-wrapper/dt-validate
@@ -0,0 +1,20 @@
1#!/bin/sh
2# dt-validate wrapper to allow kernel dt-validation to pass
3#
4# Copyright (C) 2021 Bruce Ashfield <bruce.ashfield@gmail.com>
5# License: MIT (see COPYING.MIT at the root of the repository for terms)
6
7for arg; do
8 case "$arg" in
9 --version)
10 echo "v2021.10"
11 ;;
12 esac
13done
14
15# TBD: left for future consideration
16# exec dt-validate.real "$@"
17
18# we always succeed
19exit 0
20
diff --git a/meta/recipes-kernel/dtc/python3-dtschema-wrapper_2021.10.bb b/meta/recipes-kernel/dtc/python3-dtschema-wrapper_2021.10.bb
new file mode 100644
index 0000000000..c869274d09
--- /dev/null
+++ b/meta/recipes-kernel/dtc/python3-dtschema-wrapper_2021.10.bb
@@ -0,0 +1,17 @@
1DESCRIPTION = "Wrapper for tooling for devicetree validation using YAML and jsonschema"
2HOMEPAGE = "https://yoctoproject.org"
3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
5
6SRC_URI = "file://dt-doc-validate \
7 file://dt-mk-schema \
8 file://dt-validate"
9
10do_install() {
11 install -d ${D}${bindir}/
12 install -m 755 ${WORKDIR}/dt-doc-validate ${D}${bindir}/
13 install -m 755 ${WORKDIR}/dt-mk-schema ${D}${bindir}/
14 install -m 755 ${WORKDIR}/dt-validate ${D}${bindir}/
15}
16
17BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb b/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
index ef035aed23..95983fe69b 100644
--- a/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
+++ b/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb
@@ -8,9 +8,8 @@ LIC_FILES_CHKSUM = "file://tools/kgit;beginline=5;endline=9;md5=9c30e971d435e249
8 8
9DEPENDS = "git-native" 9DEPENDS = "git-native"
10 10
11SRCREV = "d220b063852245fdd16b9731a395ace525f932d6" 11SRCREV = "90598a5fae1172e3f7782a1b02f7b7518efd32c8"
12PR = "r12" 12PV = "0.3+git${SRCPV}"
13PV = "0.2+git${SRCPV}"
14 13
15inherit native 14inherit native
16 15
diff --git a/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb b/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb
index 9a172675af..04fc14a6d2 100644
--- a/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb
+++ b/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb
@@ -32,9 +32,9 @@ fi
32 32
33if [ ! -r ${PKGDATA_DIR}/kernel-depmod/System.map-\$4 ] || [ "\$kernelabi" != "\$4" ]; then 33if [ ! -r ${PKGDATA_DIR}/kernel-depmod/System.map-\$4 ] || [ "\$kernelabi" != "\$4" ]; then
34 echo "Unable to read: ${PKGDATA_DIR}/kernel-depmod/System.map-\$4" >&2 34 echo "Unable to read: ${PKGDATA_DIR}/kernel-depmod/System.map-\$4" >&2
35 exec env depmod "\$1" "\$2" "\$3" "\$4" 35 exec env depmod -C "\$3${sysconfdir}/depmod.d" "\$1" "\$2" "\$3" "\$4"
36else 36else
37 exec env depmod "\$1" "\$2" "\$3" -F "${PKGDATA_DIR}/kernel-depmod/System.map-\$4" "\$4" 37 exec env depmod -C "\$3${sysconfdir}/depmod.d" "\$1" "\$2" "\$3" -F "${PKGDATA_DIR}/kernel-depmod/System.map-\$4" "\$4"
38fi 38fi
39EOF 39EOF
40 chmod +x ${D}${bindir_crossscripts}/depmodwrapper 40 chmod +x ${D}${bindir_crossscripts}/depmodwrapper
diff --git a/meta/recipes-kernel/linux-firmware/linux-firmware_20211027.bb b/meta/recipes-kernel/linux-firmware/linux-firmware_20220509.bb
index 97d42e98e2..ed6cdb5c16 100644
--- a/meta/recipes-kernel/linux-firmware/linux-firmware_20211027.bb
+++ b/meta/recipes-kernel/linux-firmware/linux-firmware_20220509.bb
@@ -72,7 +72,7 @@ LICENSE = "\
72LIC_FILES_CHKSUM = "file://LICENCE.Abilis;md5=b5ee3f410780e56711ad48eadc22b8bc \ 72LIC_FILES_CHKSUM = "file://LICENCE.Abilis;md5=b5ee3f410780e56711ad48eadc22b8bc \
73 file://LICENCE.adsp_sst;md5=615c45b91a5a4a9fe046d6ab9a2df728 \ 73 file://LICENCE.adsp_sst;md5=615c45b91a5a4a9fe046d6ab9a2df728 \
74 file://LICENCE.agere;md5=af0133de6b4a9b2522defd5f188afd31 \ 74 file://LICENCE.agere;md5=af0133de6b4a9b2522defd5f188afd31 \
75 file://LICENSE.amdgpu;md5=d357524f5099e2a3db3c1838921c593f \ 75 file://LICENSE.amdgpu;md5=44c1166d052226cb2d6c8d7400090203 \
76 file://LICENSE.amd-ucode;md5=3c5399dc9148d7f0e1f41e34b69cf14f \ 76 file://LICENSE.amd-ucode;md5=3c5399dc9148d7f0e1f41e34b69cf14f \
77 file://LICENSE.amlogic_vdec;md5=dc44f59bf64a81643e500ad3f39a468a \ 77 file://LICENSE.amlogic_vdec;md5=dc44f59bf64a81643e500ad3f39a468a \
78 file://LICENCE.atheros_firmware;md5=30a14c7823beedac9fa39c64fdd01a13 \ 78 file://LICENCE.atheros_firmware;md5=30a14c7823beedac9fa39c64fdd01a13 \
@@ -132,7 +132,7 @@ LIC_FILES_CHKSUM = "file://LICENCE.Abilis;md5=b5ee3f410780e56711ad48eadc22b8bc \
132 file://LICENCE.xc4000;md5=0ff51d2dc49fce04814c9155081092f0 \ 132 file://LICENCE.xc4000;md5=0ff51d2dc49fce04814c9155081092f0 \
133 file://LICENCE.xc5000;md5=1e170c13175323c32c7f4d0998d53f66 \ 133 file://LICENCE.xc5000;md5=1e170c13175323c32c7f4d0998d53f66 \
134 file://LICENCE.xc5000c;md5=12b02efa3049db65d524aeb418dd87ca \ 134 file://LICENCE.xc5000c;md5=12b02efa3049db65d524aeb418dd87ca \
135 file://WHENCE;md5=d627873bd934d7c52b2c8191304a8eb7 \ 135 file://WHENCE;md5=d3eb82686904888f8bbbe8d865371404 \
136 " 136 "
137 137
138# These are not common licenses, set NO_GENERIC_LICENSE for them 138# These are not common licenses, set NO_GENERIC_LICENSE for them
@@ -205,7 +205,7 @@ PE = "1"
205 205
206SRC_URI = "${KERNELORG_MIRROR}/linux/kernel/firmware/${BPN}-${PV}.tar.xz" 206SRC_URI = "${KERNELORG_MIRROR}/linux/kernel/firmware/${BPN}-${PV}.tar.xz"
207 207
208SRC_URI[sha256sum] = "bc2657dd8eb82386a9a7ec6df9ccf31c32c7e9073c05d37786c1edc273f9440a" 208SRC_URI[sha256sum] = "376e0b3d7b4f8aaa2abf7f5ab74803dcf14b06b94e3d841b1467cd9a2848255e"
209 209
210inherit allarch 210inherit allarch
211 211
@@ -352,7 +352,7 @@ FILES:${PN}-carl9170 = " \
352RDEPENDS:${PN}-carl9170 += "${PN}-gplv2-license" 352RDEPENDS:${PN}-carl9170 += "${PN}-gplv2-license"
353 353
354# For QualCommAthos 354# For QualCommAthos
355LICENSE:${PN}-ar3k = "Firmware-qualcommAthos_ar3k" 355LICENSE:${PN}-ar3k = "Firmware-qualcommAthos_ar3k & Firmware-atheros_firmware"
356LICENSE:${PN}-ar3k-license = "Firmware-qualcommAthos_ar3k" 356LICENSE:${PN}-ar3k-license = "Firmware-qualcommAthos_ar3k"
357LICENSE:${PN}-ath10k = "Firmware-qualcommAthos_ath10k" 357LICENSE:${PN}-ath10k = "Firmware-qualcommAthos_ath10k"
358LICENSE:${PN}-ath10k-license = "Firmware-qualcommAthos_ath10k" 358LICENSE:${PN}-ath10k-license = "Firmware-qualcommAthos_ath10k"
@@ -376,7 +376,7 @@ FILES:${PN}-qca = " \
376 ${nonarch_base_libdir}/firmware/qca \ 376 ${nonarch_base_libdir}/firmware/qca \
377" 377"
378 378
379RDEPENDS:${PN}-ar3k += "${PN}-ar3k-license" 379RDEPENDS:${PN}-ar3k += "${PN}-ar3k-license ${PN}-atheros-license"
380RDEPENDS:${PN}-ath10k += "${PN}-ath10k-license" 380RDEPENDS:${PN}-ath10k += "${PN}-ath10k-license"
381RDEPENDS:${PN}-ath11k += "${PN}-ath10k-license" 381RDEPENDS:${PN}-ath11k += "${PN}-ath10k-license"
382RDEPENDS:${PN}-qca += "${PN}-ath10k-license" 382RDEPENDS:${PN}-qca += "${PN}-ath10k-license"
@@ -751,6 +751,7 @@ FILES:${PN}-bcm4356-pcie = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4356-pc
751FILES:${PN}-bcm4373 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4373-sdio.bin \ 751FILES:${PN}-bcm4373 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4373-sdio.bin \
752 ${nonarch_base_libdir}/firmware/brcm/brcmfmac4373.bin \ 752 ${nonarch_base_libdir}/firmware/brcm/brcmfmac4373.bin \
753 ${nonarch_base_libdir}/firmware/cypress/cyfmac4373-sdio.bin \ 753 ${nonarch_base_libdir}/firmware/cypress/cyfmac4373-sdio.bin \
754 ${nonarch_base_libdir}/firmware/brcm/brcmfmac4373-sdio.clm_blob \
754" 755"
755 756
756LICENSE:${PN}-bcm-0bb4-0306 = "Firmware-cypress" 757LICENSE:${PN}-bcm-0bb4-0306 = "Firmware-cypress"
diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb b/meta/recipes-kernel/linux/kernel-devsrc.bb
index f22fac5bd6..264726d08c 100644
--- a/meta/recipes-kernel/linux/kernel-devsrc.bb
+++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
@@ -72,7 +72,9 @@ do_install() {
72 ( 72 (
73 cd ${B} 73 cd ${B}
74 74
75 cp Module.symvers $kerneldir/build 75 if [ -s Module.symvers ]; then
76 cp Module.symvers $kerneldir/build
77 fi
76 cp System.map* $kerneldir/build 78 cp System.map* $kerneldir/build
77 if [ -s Module.markers ]; then 79 if [ -s Module.markers ]; then
78 cp Module.markers $kerneldir/build 80 cp Module.markers $kerneldir/build
diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_5.10.bb b/meta/recipes-kernel/linux/linux-yocto-rt_5.10.bb
index f666ac0611..62d7494b88 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_5.10.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_5.10.bb
@@ -11,13 +11,13 @@ python () {
11 raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") 11 raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
12} 12}
13 13
14SRCREV_machine ?= "12f6a7187b3c8abab5e139dbfdf7f58f265f4169" 14SRCREV_machine ?= "88b754b80392e1f1ac7df46595f9712edc8aec02"
15SRCREV_meta ?= "a0238f7f4f2222d08bb18147bb5e24cc877b0546" 15SRCREV_meta ?= "7767ab05bd3e525a287a7f9bfd780005b5eb25a3"
16 16
17SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;branch=${KBRANCH};name=machine \ 17SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;branch=${KBRANCH};name=machine \
18 git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.10;destsuffix=${KMETA}" 18 git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.10;destsuffix=${KMETA}"
19 19
20LINUX_VERSION ?= "5.10.78" 20LINUX_VERSION ?= "5.10.113"
21 21
22LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" 22LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
23 23
diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_5.14.bb b/meta/recipes-kernel/linux/linux-yocto-rt_5.14.bb
index 7e02f83d51..6f22173b1e 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_5.14.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_5.14.bb
@@ -11,13 +11,13 @@ python () {
11 raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") 11 raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
12} 12}
13 13
14SRCREV_machine ?= "672665c11dd86abd71bbad0537e6388c6a5a84ca" 14SRCREV_machine ?= "b18aaa90f5ce15336aacf4cc24c7a086aeb4bc84"
15SRCREV_meta ?= "b3ac9c40a22d6b00545b7ce51ef6dfb0cb9d2933" 15SRCREV_meta ?= "f9e349e174542980f72dcd087445d0106b7a5e75"
16 16
17SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;branch=${KBRANCH};name=machine \ 17SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;branch=${KBRANCH};name=machine \
18 git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.14;destsuffix=${KMETA}" 18 git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.14;destsuffix=${KMETA}"
19 19
20LINUX_VERSION ?= "5.14.17" 20LINUX_VERSION ?= "5.14.21"
21 21
22LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" 22LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
23 23
diff --git a/meta/recipes-kernel/linux/linux-yocto-tiny_5.10.bb b/meta/recipes-kernel/linux/linux-yocto-tiny_5.10.bb
index 86010f106f..e0c693fed2 100644
--- a/meta/recipes-kernel/linux/linux-yocto-tiny_5.10.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-tiny_5.10.bb
@@ -6,7 +6,7 @@ KCONFIG_MODE = "--allnoconfig"
6 6
7require recipes-kernel/linux/linux-yocto.inc 7require recipes-kernel/linux/linux-yocto.inc
8 8
9LINUX_VERSION ?= "5.10.78" 9LINUX_VERSION ?= "5.10.113"
10LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" 10LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
11 11
12DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}" 12DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
@@ -15,9 +15,9 @@ DEPENDS += "openssl-native util-linux-native"
15KMETA = "kernel-meta" 15KMETA = "kernel-meta"
16KCONF_BSP_AUDIT_LEVEL = "2" 16KCONF_BSP_AUDIT_LEVEL = "2"
17 17
18SRCREV_machine:qemuarm ?= "cdec5045c5323846adaf2510e539843d0cfe74ae" 18SRCREV_machine:qemuarm ?= "7dacc8332b0bc5600d97583f45b841c9724f2191"
19SRCREV_machine ?= "344c0c38f5b892312b0a1db7f613d2704dd4942f" 19SRCREV_machine ?= "8dc46fa883d7b9a3412791f6731096e2e516d949"
20SRCREV_meta ?= "a0238f7f4f2222d08bb18147bb5e24cc877b0546" 20SRCREV_meta ?= "7767ab05bd3e525a287a7f9bfd780005b5eb25a3"
21 21
22PV = "${LINUX_VERSION}+git${SRCPV}" 22PV = "${LINUX_VERSION}+git${SRCPV}"
23 23
diff --git a/meta/recipes-kernel/linux/linux-yocto-tiny_5.14.bb b/meta/recipes-kernel/linux/linux-yocto-tiny_5.14.bb
index 9ad9549554..d44fac6094 100644
--- a/meta/recipes-kernel/linux/linux-yocto-tiny_5.14.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-tiny_5.14.bb
@@ -6,7 +6,7 @@ KCONFIG_MODE = "--allnoconfig"
6 6
7require recipes-kernel/linux/linux-yocto.inc 7require recipes-kernel/linux/linux-yocto.inc
8 8
9LINUX_VERSION ?= "5.14.17" 9LINUX_VERSION ?= "5.14.21"
10LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" 10LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
11 11
12DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}" 12DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
@@ -15,9 +15,9 @@ DEPENDS += "openssl-native util-linux-native"
15KMETA = "kernel-meta" 15KMETA = "kernel-meta"
16KCONF_BSP_AUDIT_LEVEL = "2" 16KCONF_BSP_AUDIT_LEVEL = "2"
17 17
18SRCREV_machine:qemuarm ?= "566227d5b0913910467a7736d78cad37e60217f8" 18SRCREV_machine:qemuarm ?= "159f57f8e022351d5193e51c02c951f2e255db1a"
19SRCREV_machine ?= "35888b3a9a222963b856c960e8f0c72c2de18d4a" 19SRCREV_machine ?= "9d5572038eacda2e2a86e3f743f35ec415319fb4"
20SRCREV_meta ?= "b3ac9c40a22d6b00545b7ce51ef6dfb0cb9d2933" 20SRCREV_meta ?= "f9e349e174542980f72dcd087445d0106b7a5e75"
21 21
22PV = "${LINUX_VERSION}+git${SRCPV}" 22PV = "${LINUX_VERSION}+git${SRCPV}"
23 23
diff --git a/meta/recipes-kernel/linux/linux-yocto_5.10.bb b/meta/recipes-kernel/linux/linux-yocto_5.10.bb
index 2e81068330..e05a4769d1 100644
--- a/meta/recipes-kernel/linux/linux-yocto_5.10.bb
+++ b/meta/recipes-kernel/linux/linux-yocto_5.10.bb
@@ -13,17 +13,17 @@ KBRANCH:qemux86 ?= "v5.10/standard/base"
13KBRANCH:qemux86-64 ?= "v5.10/standard/base" 13KBRANCH:qemux86-64 ?= "v5.10/standard/base"
14KBRANCH:qemumips64 ?= "v5.10/standard/mti-malta64" 14KBRANCH:qemumips64 ?= "v5.10/standard/mti-malta64"
15 15
16SRCREV_machine:qemuarm ?= "f98b917d7826304daeecf11cc52be2562a9304ff" 16SRCREV_machine:qemuarm ?= "6092497574895b1179a3c7a9e07c7f40c2d4c136"
17SRCREV_machine:qemuarm64 ?= "13ff8a3ae368724e008e3bcd77833611de7962b2" 17SRCREV_machine:qemuarm64 ?= "97ad6c5f9ffdb6b108cbbf99d9061dd0fe03e4e8"
18SRCREV_machine:qemumips ?= "7b94dec2b0f5b582b97cdb3ac97fe153559869e4" 18SRCREV_machine:qemumips ?= "e53b2d1867f7bdc2c0cc904a15992178688c3ad4"
19SRCREV_machine:qemuppc ?= "652531fb0cc8eb3607109bb8d878253be2d3d534" 19SRCREV_machine:qemuppc ?= "b12ed76165bfc9fe2b99fcc224b5e0134b7b533f"
20SRCREV_machine:qemuriscv64 ?= "2daa192783edd4974da8e900c0dc93186e57a838" 20SRCREV_machine:qemuriscv64 ?= "a8b4c628f382412e5e7df5750f2be711df95fa06"
21SRCREV_machine:qemuriscv32 ?= "2daa192783edd4974da8e900c0dc93186e57a838" 21SRCREV_machine:qemuriscv32 ?= "a8b4c628f382412e5e7df5750f2be711df95fa06"
22SRCREV_machine:qemux86 ?= "2daa192783edd4974da8e900c0dc93186e57a838" 22SRCREV_machine:qemux86 ?= "a8b4c628f382412e5e7df5750f2be711df95fa06"
23SRCREV_machine:qemux86-64 ?= "2daa192783edd4974da8e900c0dc93186e57a838" 23SRCREV_machine:qemux86-64 ?= "a8b4c628f382412e5e7df5750f2be711df95fa06"
24SRCREV_machine:qemumips64 ?= "4c817df0fd06350e18693551699c33361e16a193" 24SRCREV_machine:qemumips64 ?= "07580586b738406b4dec9bf91d4eecdb933f2a07"
25SRCREV_machine ?= "2daa192783edd4974da8e900c0dc93186e57a838" 25SRCREV_machine ?= "a8b4c628f382412e5e7df5750f2be711df95fa06"
26SRCREV_meta ?= "a0238f7f4f2222d08bb18147bb5e24cc877b0546" 26SRCREV_meta ?= "7767ab05bd3e525a287a7f9bfd780005b5eb25a3"
27 27
28# remap qemuarm to qemuarma15 for the 5.8 kernel 28# remap qemuarm to qemuarma15 for the 5.8 kernel
29# KMACHINE:qemuarm ?= "qemuarma15" 29# KMACHINE:qemuarm ?= "qemuarma15"
@@ -32,11 +32,11 @@ SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRA
32 git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.10;destsuffix=${KMETA}" 32 git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.10;destsuffix=${KMETA}"
33 33
34LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" 34LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
35LINUX_VERSION ?= "5.10.78" 35LINUX_VERSION ?= "5.10.113"
36 36
37DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}" 37DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
38DEPENDS += "openssl-native util-linux-native" 38DEPENDS += "openssl-native util-linux-native"
39DEPENDS += "gmp-native" 39DEPENDS += "gmp-native libmpc-native"
40 40
41PV = "${LINUX_VERSION}+git${SRCPV}" 41PV = "${LINUX_VERSION}+git${SRCPV}"
42 42
@@ -53,6 +53,9 @@ KERNEL_FEATURES:append = " ${KERNEL_EXTRA_FEATURES}"
53KERNEL_FEATURES:append:qemuall=" cfg/virtio.scc features/drm-bochs/drm-bochs.scc" 53KERNEL_FEATURES:append:qemuall=" cfg/virtio.scc features/drm-bochs/drm-bochs.scc"
54KERNEL_FEATURES:append:qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc" 54KERNEL_FEATURES:append:qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc"
55KERNEL_FEATURES:append:qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc" 55KERNEL_FEATURES:append:qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc"
56KERNEL_FEATURES:append:powerpc =" arch/powerpc/powerpc-debug.scc"
57KERNEL_FEATURES:append:powerpc64 =" arch/powerpc/powerpc-debug.scc"
58KERNEL_FEATURES:append:powerpc64le =" arch/powerpc/powerpc-debug.scc"
56KERNEL_FEATURES:append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "", d)}" 59KERNEL_FEATURES:append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "", d)}"
57KERNEL_FEATURES:append = " ${@bb.utils.contains("DISTRO_FEATURES", "ptest", " features/scsi/scsi-debug.scc", "", d)}" 60KERNEL_FEATURES:append = " ${@bb.utils.contains("DISTRO_FEATURES", "ptest", " features/scsi/scsi-debug.scc", "", d)}"
58KERNEL_FEATURES:append = " ${@bb.utils.contains("DISTRO_FEATURES", "ptest", " features/gpio/mockup.scc", "", d)}" 61KERNEL_FEATURES:append = " ${@bb.utils.contains("DISTRO_FEATURES", "ptest", " features/gpio/mockup.scc", "", d)}"
diff --git a/meta/recipes-kernel/linux/linux-yocto_5.14.bb b/meta/recipes-kernel/linux/linux-yocto_5.14.bb
index f034f36d45..b5be96b7c9 100644
--- a/meta/recipes-kernel/linux/linux-yocto_5.14.bb
+++ b/meta/recipes-kernel/linux/linux-yocto_5.14.bb
@@ -13,17 +13,17 @@ KBRANCH:qemux86 ?= "v5.14/standard/base"
13KBRANCH:qemux86-64 ?= "v5.14/standard/base" 13KBRANCH:qemux86-64 ?= "v5.14/standard/base"
14KBRANCH:qemumips64 ?= "v5.14/standard/mti-malta64" 14KBRANCH:qemumips64 ?= "v5.14/standard/mti-malta64"
15 15
16SRCREV_machine:qemuarm ?= "eef94a78151c2227eba9a8468ac611d9507482b5" 16SRCREV_machine:qemuarm ?= "5ca7fd91b258a07ed1b6f38593ff8c48cc574b1c"
17SRCREV_machine:qemuarm64 ?= "35888b3a9a222963b856c960e8f0c72c2de18d4a" 17SRCREV_machine:qemuarm64 ?= "9d5572038eacda2e2a86e3f743f35ec415319fb4"
18SRCREV_machine:qemumips ?= "607d94618b35382f38ab2bc0d37494372897ae4d" 18SRCREV_machine:qemumips ?= "1e7a6d0d29015bf1f383cf5f52fc451c1969561d"
19SRCREV_machine:qemuppc ?= "35888b3a9a222963b856c960e8f0c72c2de18d4a" 19SRCREV_machine:qemuppc ?= "9d5572038eacda2e2a86e3f743f35ec415319fb4"
20SRCREV_machine:qemuriscv64 ?= "35888b3a9a222963b856c960e8f0c72c2de18d4a" 20SRCREV_machine:qemuriscv64 ?= "9d5572038eacda2e2a86e3f743f35ec415319fb4"
21SRCREV_machine:qemuriscv32 ?= "35888b3a9a222963b856c960e8f0c72c2de18d4a" 21SRCREV_machine:qemuriscv32 ?= "9d5572038eacda2e2a86e3f743f35ec415319fb4"
22SRCREV_machine:qemux86 ?= "35888b3a9a222963b856c960e8f0c72c2de18d4a" 22SRCREV_machine:qemux86 ?= "9d5572038eacda2e2a86e3f743f35ec415319fb4"
23SRCREV_machine:qemux86-64 ?= "35888b3a9a222963b856c960e8f0c72c2de18d4a" 23SRCREV_machine:qemux86-64 ?= "9d5572038eacda2e2a86e3f743f35ec415319fb4"
24SRCREV_machine:qemumips64 ?= "9ed182ebbcd4c77b8f99439d2feb6c4591148324" 24SRCREV_machine:qemumips64 ?= "f6646a344afbf6cacc91cbeaaec4240b372dd192"
25SRCREV_machine ?= "35888b3a9a222963b856c960e8f0c72c2de18d4a" 25SRCREV_machine ?= "9d5572038eacda2e2a86e3f743f35ec415319fb4"
26SRCREV_meta ?= "b3ac9c40a22d6b00545b7ce51ef6dfb0cb9d2933" 26SRCREV_meta ?= "f9e349e174542980f72dcd087445d0106b7a5e75"
27 27
28# set your preferred provider of linux-yocto to 'linux-yocto-upstream', and you'll 28# set your preferred provider of linux-yocto to 'linux-yocto-upstream', and you'll
29# get the <version>/base branch, which is pure upstream -stable, and the same 29# get the <version>/base branch, which is pure upstream -stable, and the same
@@ -31,7 +31,7 @@ SRCREV_meta ?= "b3ac9c40a22d6b00545b7ce51ef6dfb0cb9d2933"
31# normal PREFERRED_VERSION settings. 31# normal PREFERRED_VERSION settings.
32BBCLASSEXTEND = "devupstream:target" 32BBCLASSEXTEND = "devupstream:target"
33DEFAULT_PREFERENCE:class-devupstream = "-1" 33DEFAULT_PREFERENCE:class-devupstream = "-1"
34SRCREV_machine:class-devupstream ?= "3dfa869cb79d60a2fe66efb4a11517ec7c89de16" 34SRCREV_machine:class-devupstream ?= "545728d9e08593767dd55192b0324dd4f9b71151"
35PN:class-devupstream = "linux-yocto-upstream" 35PN:class-devupstream = "linux-yocto-upstream"
36KBRANCH:class-devupstream = "v5.14/base" 36KBRANCH:class-devupstream = "v5.14/base"
37 37
@@ -42,7 +42,7 @@ SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRA
42 git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.14;destsuffix=${KMETA}" 42 git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.14;destsuffix=${KMETA}"
43 43
44LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" 44LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
45LINUX_VERSION ?= "5.14.17" 45LINUX_VERSION ?= "5.14.21"
46 46
47DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}" 47DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
48DEPENDS += "openssl-native util-linux-native" 48DEPENDS += "openssl-native util-linux-native"
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-Fix-compaction-migratepages-event-name.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-Fix-compaction-migratepages-event-name.patch
new file mode 100644
index 0000000000..e988f7a3d5
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0001-Fix-compaction-migratepages-event-name.patch
@@ -0,0 +1,37 @@
1From c312bda00d2dc10ce5f6c1189acbefee5c6c8c6c Mon Sep 17 00:00:00 2001
2From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3Date: Tue, 29 Mar 2022 16:34:07 -0400
4Subject: [PATCH 01/10] Fix: compaction migratepages event name
5
6The commit "fix: mm: compaction: fix the migration stats in trace_mm_compaction_migratepages() (v5.17)"
7
8Triggers this warning:
9
10 LTTng: event provider mismatch: The event name needs to start with provider name + _ + one or more letter, provider: compaction, event name: mm_compaction_migratepages
11
12Upstream-Status: Backport
13
14Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
15Change-Id: I01c7485af765084dafb33bf33ae392e60bfbf1e7
16---
17 include/instrumentation/events/compaction.h | 4 +++-
18 1 file changed, 3 insertions(+), 1 deletion(-)
19
20diff --git a/include/instrumentation/events/compaction.h b/include/instrumentation/events/compaction.h
21index 340e41f5..15964537 100644
22--- a/include/instrumentation/events/compaction.h
23+++ b/include/instrumentation/events/compaction.h
24@@ -98,7 +98,9 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template,
25 #endif /* #else #if LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0) */
26
27 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
28-LTTNG_TRACEPOINT_EVENT(mm_compaction_migratepages,
29+LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
30+
31+ compaction_migratepages,
32
33 TP_PROTO(unsigned long nr_all,
34 unsigned int nr_succeeded),
35--
362.19.1
37
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-fix-cpu-hotplug-Remove-deprecated-CPU-hotplug-functi.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-fix-cpu-hotplug-Remove-deprecated-CPU-hotplug-functi.patch
deleted file mode 100644
index 4e52e5f122..0000000000
--- a/meta/recipes-kernel/lttng/lttng-modules/0001-fix-cpu-hotplug-Remove-deprecated-CPU-hotplug-functi.patch
+++ /dev/null
@@ -1,394 +0,0 @@
1From 8be4c8a38ee1e297578e094a6e4c143ec5259aba Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 13 Sep 2021 12:00:38 -0400
4Subject: [PATCH 1/2] fix: cpu/hotplug: Remove deprecated CPU-hotplug
5 functions. (v5.15)
6
7The CPU-hotplug functions get|put_online_cpus() were deprecated in v4.13
8and removed in v5.15.
9
10See upstream commits :
11
12commit 8c854303ce0e38e5bbedd725ff39da7e235865d8
13Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
14Date: Tue Aug 3 16:16:21 2021 +0200
15
16 cpu/hotplug: Remove deprecated CPU-hotplug functions.
17
18 No users in tree use the deprecated CPU-hotplug functions anymore.
19
20 Remove them.
21
22Introduced in v4.13 :
23
24 commit 8f553c498e1772cccb39a114da4a498d22992758
25 Author: Thomas Gleixner <tglx@linutronix.de>
26 Date: Wed May 24 10:15:12 2017 +0200
27
28 cpu/hotplug: Provide cpus_read|write_[un]lock()
29
30 The counting 'rwsem' hackery of get|put_online_cpus() is going to be
31 replaced by percpu rwsem.
32
33 Rename the functions to make it clear that it's locking and not some
34 refcount style interface. These new functions will be used for the
35 preparatory patches which make the code ready for the percpu rwsem
36 conversion.
37
38 Rename all instances in the cpu hotplug code while at it.
39
40Upstream-Status: backport [https://git.lttng.org/?p=lttng-modules.git;a=commit;h=ffcc873470121ef1ebb110df3d9038a38d9cb7cb]
41
42Change-Id: I5a37cf5afc075a402b7347989fac637dfa60a1ed
43Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
44Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
45---
46 include/wrapper/cpu.h | 44 +++++++++++++++++++++++
47 src/lib/ringbuffer/ring_buffer_backend.c | 8 ++---
48 src/lib/ringbuffer/ring_buffer_frontend.c | 17 ++++-----
49 src/lib/ringbuffer/ring_buffer_iterator.c | 15 ++++----
50 src/lttng-context-perf-counters.c | 11 +++---
51 src/lttng-statedump-impl.c | 6 ++--
52 6 files changed, 74 insertions(+), 27 deletions(-)
53 create mode 100644 include/wrapper/cpu.h
54
55diff --git a/include/wrapper/cpu.h b/include/wrapper/cpu.h
56new file mode 100644
57index 00000000..cbee1962
58--- /dev/null
59+++ b/include/wrapper/cpu.h
60@@ -0,0 +1,44 @@
61+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
62+ *
63+ * wrapper/cpu.h
64+ *
65+ * Copyright (C) 2021 Michael Jeanson <mjeanson@efficios.com>
66+ */
67+
68+#ifndef _LTTNG_WRAPPER_CPU_H
69+#define _LTTNG_WRAPPER_CPU_H
70+
71+#include <linux/cpu.h>
72+#include <lttng/kernel-version.h>
73+
74+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,13,0))
75+
76+static inline
77+void lttng_cpus_read_lock(void)
78+{
79+ cpus_read_lock();
80+}
81+
82+static inline
83+void lttng_cpus_read_unlock(void)
84+{
85+ cpus_read_unlock();
86+}
87+
88+#else /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,13,0) */
89+
90+static inline
91+void lttng_cpus_read_lock(void)
92+{
93+ get_online_cpus();
94+}
95+
96+static inline
97+void lttng_cpus_read_unlock(void)
98+{
99+ put_online_cpus();
100+}
101+
102+#endif /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,13,0) */
103+
104+#endif /* _LTTNG_WRAPPER_CPU_H */
105diff --git a/src/lib/ringbuffer/ring_buffer_backend.c b/src/lib/ringbuffer/ring_buffer_backend.c
106index 26efb2bc..9a339be0 100644
107--- a/src/lib/ringbuffer/ring_buffer_backend.c
108+++ b/src/lib/ringbuffer/ring_buffer_backend.c
109@@ -12,10 +12,10 @@
110 #include <linux/delay.h>
111 #include <linux/errno.h>
112 #include <linux/slab.h>
113-#include <linux/cpu.h>
114 #include <linux/mm.h>
115 #include <linux/vmalloc.h>
116
117+#include <wrapper/cpu.h>
118 #include <wrapper/mm.h>
119 #include <wrapper/vmalloc.h> /* for wrapper_vmalloc_sync_mappings() */
120 #include <ringbuffer/config.h>
121@@ -445,14 +445,14 @@ int channel_backend_init(struct channel_backend *chanb,
122 chanb->cpu_hp_notifier.priority = 5;
123 register_hotcpu_notifier(&chanb->cpu_hp_notifier);
124
125- get_online_cpus();
126+ lttng_cpus_read_lock();
127 for_each_online_cpu(i) {
128 ret = lib_ring_buffer_create(per_cpu_ptr(chanb->buf, i),
129 chanb, i);
130 if (ret)
131 goto free_bufs; /* cpu hotplug locked */
132 }
133- put_online_cpus();
134+ lttng_cpus_read_unlock();
135 #else
136 for_each_possible_cpu(i) {
137 ret = lib_ring_buffer_create(per_cpu_ptr(chanb->buf, i),
138@@ -485,7 +485,7 @@ free_bufs:
139 */
140 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
141 #ifdef CONFIG_HOTPLUG_CPU
142- put_online_cpus();
143+ lttng_cpus_read_unlock();
144 unregister_hotcpu_notifier(&chanb->cpu_hp_notifier);
145 #endif
146 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
147diff --git a/src/lib/ringbuffer/ring_buffer_frontend.c b/src/lib/ringbuffer/ring_buffer_frontend.c
148index e9056118..87a575d0 100644
149--- a/src/lib/ringbuffer/ring_buffer_frontend.c
150+++ b/src/lib/ringbuffer/ring_buffer_frontend.c
151@@ -48,6 +48,7 @@
152 #include <ringbuffer/iterator.h>
153 #include <ringbuffer/nohz.h>
154 #include <wrapper/atomic.h>
155+#include <wrapper/cpu.h>
156 #include <wrapper/kref.h>
157 #include <wrapper/percpu-defs.h>
158 #include <wrapper/timer.h>
159@@ -724,7 +725,7 @@ static void channel_unregister_notifiers(struct lttng_kernel_ring_buffer_channel
160 int cpu;
161
162 #ifdef CONFIG_HOTPLUG_CPU
163- get_online_cpus();
164+ lttng_cpus_read_lock();
165 chan->cpu_hp_enable = 0;
166 for_each_online_cpu(cpu) {
167 struct lttng_kernel_ring_buffer *buf = per_cpu_ptr(chan->backend.buf,
168@@ -732,7 +733,7 @@ static void channel_unregister_notifiers(struct lttng_kernel_ring_buffer_channel
169 lib_ring_buffer_stop_switch_timer(buf);
170 lib_ring_buffer_stop_read_timer(buf);
171 }
172- put_online_cpus();
173+ lttng_cpus_read_unlock();
174 unregister_cpu_notifier(&chan->cpu_hp_notifier);
175 #else
176 for_each_possible_cpu(cpu) {
177@@ -772,14 +773,14 @@ void lib_ring_buffer_set_quiescent_channel(struct lttng_kernel_ring_buffer_chann
178 const struct lttng_kernel_ring_buffer_config *config = &chan->backend.config;
179
180 if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) {
181- get_online_cpus();
182+ lttng_cpus_read_lock();
183 for_each_channel_cpu(cpu, chan) {
184 struct lttng_kernel_ring_buffer *buf = per_cpu_ptr(chan->backend.buf,
185 cpu);
186
187 lib_ring_buffer_set_quiescent(buf);
188 }
189- put_online_cpus();
190+ lttng_cpus_read_unlock();
191 } else {
192 struct lttng_kernel_ring_buffer *buf = chan->backend.buf;
193
194@@ -794,14 +795,14 @@ void lib_ring_buffer_clear_quiescent_channel(struct lttng_kernel_ring_buffer_cha
195 const struct lttng_kernel_ring_buffer_config *config = &chan->backend.config;
196
197 if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) {
198- get_online_cpus();
199+ lttng_cpus_read_lock();
200 for_each_channel_cpu(cpu, chan) {
201 struct lttng_kernel_ring_buffer *buf = per_cpu_ptr(chan->backend.buf,
202 cpu);
203
204 lib_ring_buffer_clear_quiescent(buf);
205 }
206- put_online_cpus();
207+ lttng_cpus_read_unlock();
208 } else {
209 struct lttng_kernel_ring_buffer *buf = chan->backend.buf;
210
211@@ -899,7 +900,7 @@ struct lttng_kernel_ring_buffer_channel *channel_create(const struct lttng_kerne
212 chan->cpu_hp_notifier.priority = 6;
213 register_cpu_notifier(&chan->cpu_hp_notifier);
214
215- get_online_cpus();
216+ lttng_cpus_read_lock();
217 for_each_online_cpu(cpu) {
218 struct lttng_kernel_ring_buffer *buf = per_cpu_ptr(chan->backend.buf,
219 cpu);
220@@ -909,7 +910,7 @@ struct lttng_kernel_ring_buffer_channel *channel_create(const struct lttng_kerne
221 spin_unlock(&per_cpu(ring_buffer_nohz_lock, cpu));
222 }
223 chan->cpu_hp_enable = 1;
224- put_online_cpus();
225+ lttng_cpus_read_unlock();
226 #else
227 for_each_possible_cpu(cpu) {
228 struct lttng_kernel_ring_buffer *buf = per_cpu_ptr(chan->backend.buf,
229diff --git a/src/lib/ringbuffer/ring_buffer_iterator.c b/src/lib/ringbuffer/ring_buffer_iterator.c
230index 25839af6..60c95ca6 100644
231--- a/src/lib/ringbuffer/ring_buffer_iterator.c
232+++ b/src/lib/ringbuffer/ring_buffer_iterator.c
233@@ -10,6 +10,7 @@
234 */
235
236 #include <ringbuffer/iterator.h>
237+#include <wrapper/cpu.h>
238 #include <wrapper/file.h>
239 #include <wrapper/uaccess.h>
240 #include <linux/jiffies.h>
241@@ -440,13 +441,13 @@ int channel_iterator_init(struct lttng_kernel_ring_buffer_channel *chan)
242 chan->hp_iter_notifier.priority = 10;
243 register_cpu_notifier(&chan->hp_iter_notifier);
244
245- get_online_cpus();
246+ lttng_cpus_read_lock();
247 for_each_online_cpu(cpu) {
248 buf = per_cpu_ptr(chan->backend.buf, cpu);
249 lib_ring_buffer_iterator_init(chan, buf);
250 }
251 chan->hp_iter_enable = 1;
252- put_online_cpus();
253+ lttng_cpus_read_unlock();
254 #else
255 for_each_possible_cpu(cpu) {
256 buf = per_cpu_ptr(chan->backend.buf, cpu);
257@@ -519,7 +520,7 @@ int channel_iterator_open(struct lttng_kernel_ring_buffer_channel *chan)
258 CHAN_WARN_ON(chan, config->output != RING_BUFFER_ITERATOR);
259
260 if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) {
261- get_online_cpus();
262+ lttng_cpus_read_lock();
263 /* Allow CPU hotplug to keep track of opened reader */
264 chan->iter.read_open = 1;
265 for_each_channel_cpu(cpu, chan) {
266@@ -529,7 +530,7 @@ int channel_iterator_open(struct lttng_kernel_ring_buffer_channel *chan)
267 goto error;
268 buf->iter.read_open = 1;
269 }
270- put_online_cpus();
271+ lttng_cpus_read_unlock();
272 } else {
273 buf = channel_get_ring_buffer(config, chan, 0);
274 ret = lib_ring_buffer_iterator_open(buf);
275@@ -538,7 +539,7 @@ int channel_iterator_open(struct lttng_kernel_ring_buffer_channel *chan)
276 error:
277 /* Error should always happen on CPU 0, hence no close is required. */
278 CHAN_WARN_ON(chan, cpu != 0);
279- put_online_cpus();
280+ lttng_cpus_read_unlock();
281 return ret;
282 }
283 EXPORT_SYMBOL_GPL(channel_iterator_open);
284@@ -550,7 +551,7 @@ void channel_iterator_release(struct lttng_kernel_ring_buffer_channel *chan)
285 int cpu;
286
287 if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) {
288- get_online_cpus();
289+ lttng_cpus_read_lock();
290 for_each_channel_cpu(cpu, chan) {
291 buf = channel_get_ring_buffer(config, chan, cpu);
292 if (buf->iter.read_open) {
293@@ -559,7 +560,7 @@ void channel_iterator_release(struct lttng_kernel_ring_buffer_channel *chan)
294 }
295 }
296 chan->iter.read_open = 0;
297- put_online_cpus();
298+ lttng_cpus_read_unlock();
299 } else {
300 buf = channel_get_ring_buffer(config, chan, 0);
301 lib_ring_buffer_iterator_release(buf);
302diff --git a/src/lttng-context-perf-counters.c b/src/lttng-context-perf-counters.c
303index b0227d47..372f05e0 100644
304--- a/src/lttng-context-perf-counters.c
305+++ b/src/lttng-context-perf-counters.c
306@@ -16,6 +16,7 @@
307 #include <lttng/events.h>
308 #include <lttng/events-internal.h>
309 #include <ringbuffer/frontend_types.h>
310+#include <wrapper/cpu.h>
311 #include <wrapper/vmalloc.h>
312 #include <wrapper/perf.h>
313 #include <lttng/tracer.h>
314@@ -97,10 +98,10 @@ void lttng_destroy_perf_counter_ctx_field(void *priv)
315 {
316 int cpu;
317
318- get_online_cpus();
319+ lttng_cpus_read_lock();
320 for_each_online_cpu(cpu)
321 perf_event_release_kernel(events[cpu]);
322- put_online_cpus();
323+ lttng_cpus_read_unlock();
324 #ifdef CONFIG_HOTPLUG_CPU
325 unregister_cpu_notifier(&perf_field->nb);
326 #endif
327@@ -304,7 +305,7 @@ int lttng_add_perf_counter_to_ctx(uint32_t type,
328 perf_field->nb.priority = 0;
329 register_cpu_notifier(&perf_field->nb);
330 #endif
331- get_online_cpus();
332+ lttng_cpus_read_lock();
333 for_each_online_cpu(cpu) {
334 events[cpu] = wrapper_perf_event_create_kernel_counter(attr,
335 cpu, NULL, overflow_callback);
336@@ -317,7 +318,7 @@ int lttng_add_perf_counter_to_ctx(uint32_t type,
337 goto counter_busy;
338 }
339 }
340- put_online_cpus();
341+ lttng_cpus_read_unlock();
342 perf_field->hp_enable = 1;
343 }
344 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
345@@ -351,7 +352,7 @@ counter_error:
346 if (events[cpu] && !IS_ERR(events[cpu]))
347 perf_event_release_kernel(events[cpu]);
348 }
349- put_online_cpus();
350+ lttng_cpus_read_unlock();
351 #ifdef CONFIG_HOTPLUG_CPU
352 unregister_cpu_notifier(&perf_field->nb);
353 #endif
354diff --git a/src/lttng-statedump-impl.c b/src/lttng-statedump-impl.c
355index 4dfbca0b..2b42783a 100644
356--- a/src/lttng-statedump-impl.c
357+++ b/src/lttng-statedump-impl.c
358@@ -23,7 +23,6 @@
359 #include <linux/file.h>
360 #include <linux/interrupt.h>
361 #include <linux/irqnr.h>
362-#include <linux/cpu.h>
363 #include <linux/netdevice.h>
364 #include <linux/inetdevice.h>
365 #include <linux/mm.h>
366@@ -34,6 +33,7 @@
367
368 #include <lttng/events.h>
369 #include <lttng/tracer.h>
370+#include <wrapper/cpu.h>
371 #include <wrapper/irqdesc.h>
372 #include <wrapper/fdtable.h>
373 #include <wrapper/namespace.h>
374@@ -770,7 +770,7 @@ int do_lttng_statedump(struct lttng_kernel_session *session)
375 * is to guarantee that each CPU has been in a state where is was in
376 * syscall mode (i.e. not in a trap, an IRQ or a soft IRQ).
377 */
378- get_online_cpus();
379+ lttng_cpus_read_lock();
380 atomic_set(&kernel_threads_to_run, num_online_cpus());
381 for_each_online_cpu(cpu) {
382 INIT_DELAYED_WORK(&cpu_work[cpu], lttng_statedump_work_func);
383@@ -778,7 +778,7 @@ int do_lttng_statedump(struct lttng_kernel_session *session)
384 }
385 /* Wait for all threads to run */
386 __wait_event(statedump_wq, (atomic_read(&kernel_threads_to_run) == 0));
387- put_online_cpus();
388+ lttng_cpus_read_unlock();
389 /* Our work is done */
390 trace_lttng_statedump_end(session);
391 return 0;
392--
3932.19.1
394
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0002-Fix-tracepoint-event-allow-same-provider-and-event-n.patch b/meta/recipes-kernel/lttng/lttng-modules/0002-Fix-tracepoint-event-allow-same-provider-and-event-n.patch
new file mode 100644
index 0000000000..00367eebf8
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0002-Fix-tracepoint-event-allow-same-provider-and-event-n.patch
@@ -0,0 +1,48 @@
1From a7eb2e3d0a4beb1ee80b132927641dd05ef2d542 Mon Sep 17 00:00:00 2001
2From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3Date: Mon, 4 Apr 2022 15:49:32 -0400
4Subject: [PATCH 02/10] Fix: tracepoint event: allow same provider and event
5 name
6
7Using the same name for the provider (TRACE_SYSTEM) and event name
8causes a compilation error because the same identifiers are emitted
9twice.
10
11Fix this by prefixing the provider identifier with
12"__provider_event_desc___".
13
14Upstream-Status: Backport
15
16Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
17Change-Id: I8cdf8f859e35b8bd5c19737860d12f1ed546dfc2
18---
19 include/lttng/tracepoint-event-impl.h | 6 +++---
20 1 file changed, 3 insertions(+), 3 deletions(-)
21
22diff --git a/include/lttng/tracepoint-event-impl.h b/include/lttng/tracepoint-event-impl.h
23index 38b1dc43..dcb22247 100644
24--- a/include/lttng/tracepoint-event-impl.h
25+++ b/include/lttng/tracepoint-event-impl.h
26@@ -1255,7 +1255,7 @@ static const struct lttng_kernel_event_desc __event_desc___##_map = { \
27 #define TP_ID1(_token, _system) _token##_system
28 #define TP_ID(_token, _system) TP_ID1(_token, _system)
29
30-static const struct lttng_kernel_event_desc * const TP_ID(__event_desc___, TRACE_SYSTEM)[] = {
31+static const struct lttng_kernel_event_desc * const TP_ID(__provider_event_desc___, TRACE_SYSTEM)[] = {
32 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
33 };
34
35@@ -1274,8 +1274,8 @@ static const struct lttng_kernel_event_desc * const TP_ID(__event_desc___, TRACE
36 /* non-const because list head will be modified when registered. */
37 static __used struct lttng_kernel_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM) = {
38 .provider_name = __stringify(TRACE_SYSTEM),
39- .event_desc = TP_ID(__event_desc___, TRACE_SYSTEM),
40- .nr_events = ARRAY_SIZE(TP_ID(__event_desc___, TRACE_SYSTEM)),
41+ .event_desc = TP_ID(__provider_event_desc___, TRACE_SYSTEM),
42+ .nr_events = ARRAY_SIZE(TP_ID(__provider_event_desc___, TRACE_SYSTEM)),
43 .head = { NULL, NULL },
44 .lazy_init_head = { NULL, NULL },
45 .lazy = 0,
46--
472.19.1
48
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Revert-Makefile-Enable-Wimplicit-fallthrough-for.patch b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Revert-Makefile-Enable-Wimplicit-fallthrough-for.patch
deleted file mode 100644
index 5b5edc5319..0000000000
--- a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Revert-Makefile-Enable-Wimplicit-fallthrough-for.patch
+++ /dev/null
@@ -1,829 +0,0 @@
1From c570be0da77e963d77bac099d468bc0cd5f1bd63 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 13 Sep 2021 14:16:22 -0400
4Subject: [PATCH 2/2] fix: Revert "Makefile: Enable -Wimplicit-fallthrough for
5 Clang" (v5.15)
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10Starting with v5.15, "-Wimplicit-fallthrough=5" was added to the build
11flags which requires the use of "__attribute__((__fallthrough__))" to
12annotate fallthrough case statements.
13
14See upstream commit by the man himself:
15
16 commit d936eb23874433caa3e3d841cfa16f5434b85dcf
17 Author: Linus Torvalds <torvalds@linux-foundation.org>
18 Date: Thu Jul 15 18:05:31 2021 -0700
19
20 Revert "Makefile: Enable -Wimplicit-fallthrough for Clang"
21
22 This reverts commit b7eb335e26a9c7f258c96b3962c283c379d3ede0.
23
24 It turns out that the problem with the clang -Wimplicit-fallthrough
25 warning is not about the kernel source code, but about clang itself, and
26 that the warning is unusable until clang fixes its broken ways.
27
28 In particular, when you enable this warning for clang, you not only get
29 warnings about implicit fallthroughs. You also get this:
30
31 warning: fallthrough annotation in unreachable code [-Wimplicit-fallthrough]
32
33 which is completely broken becasue it
34
35 (a) doesn't even tell you where the problem is (seriously: no line
36 numbers, no filename, no nothing).
37
38 (b) is fundamentally broken anyway, because there are perfectly valid
39 reasons to have a fallthrough statement even if it turns out that
40 it can perhaps not be reached.
41
42 In the kernel, an example of that second case is code in the scheduler:
43
44 switch (state) {
45 case cpuset:
46 if (IS_ENABLED(CONFIG_CPUSETS)) {
47 cpuset_cpus_allowed_fallback(p);
48 state = possible;
49 break;
50 }
51 fallthrough;
52 case possible:
53
54 where if CONFIG_CPUSETS is enabled you actually never hit the
55 fallthrough case at all. But that in no way makes the fallthrough
56 wrong.
57
58 So the warning is completely broken, and enabling it for clang is a very
59 bad idea.
60
61 In the meantime, we can keep the gcc option enabled, and make the gcc
62 build use
63
64 -Wimplicit-fallthrough=5
65
66 which means that we will at least continue to require a proper
67 fallthrough statement, and that gcc won't silently accept the magic
68 comment versions. Because gcc does this all correctly, and while the odd
69 "=5" part is kind of obscure, it's documented in [1]:
70
71 "-Wimplicit-fallthrough=5 doesn’t recognize any comments as
72 fallthrough comments, only attributes disable the warning"
73
74 so if clang ever fixes its bad behavior we can try enabling it there again.
75
76Upstream-Status: backport [https://git.lttng.org/?p=lttng-modules.git;a=commit;h=c190d76e8c7b44d62b3651ab845b765c1b1f8104]
77
78Change-Id: Iea69849592fb69ac04fb9bb28efcd6b8dce8ba88
79Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
80Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
81---
82 include/counter/counter-api.h | 4 +-
83 include/lttng/events-internal.h | 11 ++-
84 include/wrapper/compiler_attributes.h | 34 +++++++
85 src/lib/counter/counter.c | 13 ++-
86 src/lttng-abi.c | 91 ++++++++++++------
87 src/lttng-bytecode-interpreter.c | 4 +-
88 src/lttng-bytecode-specialize.c | 5 +-
89 src/lttng-events.c | 129 +++++++++++++++++---------
90 src/lttng-string-utils.c | 3 +-
91 src/probes/lttng-kretprobes.c | 7 +-
92 10 files changed, 215 insertions(+), 86 deletions(-)
93 create mode 100644 include/wrapper/compiler_attributes.h
94
95diff --git a/include/counter/counter-api.h b/include/counter/counter-api.h
96index fbc65818..c9f2b141 100644
97--- a/include/counter/counter-api.h
98+++ b/include/counter/counter-api.h
99@@ -15,6 +15,7 @@
100 #include <linux/bitops.h>
101 #include <counter/counter.h>
102 #include <counter/counter-internal.h>
103+#include <wrapper/compiler_attributes.h>
104 #include <wrapper/limits.h>
105
106 /*
107@@ -256,7 +257,8 @@ static __always_inline int lttng_counter_add(const struct lib_counter_config *co
108 const size_t *dimension_indexes, int64_t v)
109 {
110 switch (config->alloc) {
111- case COUNTER_ALLOC_PER_CPU: /* Fallthrough */
112+ case COUNTER_ALLOC_PER_CPU:
113+ lttng_fallthrough;
114 case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL:
115 return __lttng_counter_add_percpu(config, counter, dimension_indexes, v);
116 case COUNTER_ALLOC_GLOBAL:
117diff --git a/include/lttng/events-internal.h b/include/lttng/events-internal.h
118index cd560de8..ca2190c4 100644
119--- a/include/lttng/events-internal.h
120+++ b/include/lttng/events-internal.h
121@@ -8,6 +8,8 @@
122 #ifndef _LTTNG_EVENTS_INTERNAL_H
123 #define _LTTNG_EVENTS_INTERNAL_H
124
125+#include <wrapper/compiler_attributes.h>
126+
127 #include <lttng/events.h>
128
129 struct lttng_syscall_filter;
130@@ -561,9 +563,12 @@ static inline bool lttng_kernel_type_is_bytewise_integer(const struct lttng_kern
131 if (!type_integer)
132 return false;
133 switch (type_integer->size) {
134- case 8: /* Fall-through. */
135- case 16: /* Fall-through. */
136- case 32: /* Fall-through. */
137+ case 8:
138+ lttng_fallthrough;
139+ case 16:
140+ lttng_fallthrough;
141+ case 32:
142+ lttng_fallthrough;
143 case 64:
144 break;
145 default:
146diff --git a/include/wrapper/compiler_attributes.h b/include/wrapper/compiler_attributes.h
147new file mode 100644
148index 00000000..c2c96e76
149--- /dev/null
150+++ b/include/wrapper/compiler_attributes.h
151@@ -0,0 +1,34 @@
152+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
153+ *
154+ * wrapper/compiler_attributes.h
155+ *
156+ * Copyright (C) 2021 Michael Jeanson <mjeanson@efficios.com>
157+ */
158+
159+#ifndef _LTTNG_WRAPPER_COMPILER_ATTRIBUTES_H
160+#define _LTTNG_WRAPPER_COMPILER_ATTRIBUTES_H
161+
162+#include <lttng/kernel-version.h>
163+
164+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,20,0))
165+#include <linux/compiler_attributes.h>
166+#endif
167+
168+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,4,0))
169+
170+/*
171+ * Use the kernel provided fallthrough attribute macro.
172+ */
173+#define lttng_fallthrough fallthrough
174+
175+#else /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,4,0) */
176+
177+/*
178+ * Fallback to the comment for kernels pre 5.15 that don't build with
179+ * '-Wimplicit-fallthrough=5'.
180+ */
181+#define lttng_fallthrough do {} while (0) /* fallthrough */
182+
183+#endif /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,4,0) */
184+
185+#endif /* _LTTNG_WRAPPER_COMPILER_ATTRIBUTES_H */
186diff --git a/src/lib/counter/counter.c b/src/lib/counter/counter.c
187index a4500a0e..bf038aac 100644
188--- a/src/lib/counter/counter.c
189+++ b/src/lib/counter/counter.c
190@@ -11,6 +11,7 @@
191 #include <linux/cpumask.h>
192 #include <counter/counter.h>
193 #include <counter/counter-internal.h>
194+#include <wrapper/compiler_attributes.h>
195 #include <wrapper/vmalloc.h>
196 #include <wrapper/limits.h>
197
198@@ -324,7 +325,8 @@ int lttng_counter_aggregate(const struct lib_counter_config *config,
199 *underflow = false;
200
201 switch (config->alloc) {
202- case COUNTER_ALLOC_GLOBAL: /* Fallthrough */
203+ case COUNTER_ALLOC_GLOBAL:
204+ lttng_fallthrough;
205 case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL:
206 /* Read global counter. */
207 ret = lttng_counter_read(config, counter, dimension_indexes,
208@@ -342,7 +344,8 @@ int lttng_counter_aggregate(const struct lib_counter_config *config,
209 switch (config->alloc) {
210 case COUNTER_ALLOC_GLOBAL:
211 break;
212- case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL: /* Fallthrough */
213+ case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL:
214+ lttng_fallthrough;
215 case COUNTER_ALLOC_PER_CPU:
216 //TODO: integrate with CPU hotplug and online cpus
217 for (cpu = 0; cpu < num_possible_cpus(); cpu++) {
218@@ -448,7 +451,8 @@ int lttng_counter_clear(const struct lib_counter_config *config,
219 int cpu, ret;
220
221 switch (config->alloc) {
222- case COUNTER_ALLOC_GLOBAL: /* Fallthrough */
223+ case COUNTER_ALLOC_GLOBAL:
224+ lttng_fallthrough;
225 case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL:
226 /* Clear global counter. */
227 ret = lttng_counter_clear_cpu(config, counter, dimension_indexes, -1);
228@@ -462,7 +466,8 @@ int lttng_counter_clear(const struct lib_counter_config *config,
229 switch (config->alloc) {
230 case COUNTER_ALLOC_GLOBAL:
231 break;
232- case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL: /* Fallthrough */
233+ case COUNTER_ALLOC_PER_CPU | COUNTER_ALLOC_GLOBAL:
234+ lttng_fallthrough;
235 case COUNTER_ALLOC_PER_CPU:
236 //TODO: integrate with CPU hotplug and online cpus
237 for (cpu = 0; cpu < num_possible_cpus(); cpu++) {
238diff --git a/src/lttng-abi.c b/src/lttng-abi.c
239index cc453894..eac1afd1 100644
240--- a/src/lttng-abi.c
241+++ b/src/lttng-abi.c
242@@ -34,6 +34,7 @@
243 #include <ringbuffer/vfs.h>
244 #include <ringbuffer/backend.h>
245 #include <ringbuffer/frontend.h>
246+#include <wrapper/compiler_attributes.h>
247 #include <wrapper/poll.h>
248 #include <wrapper/file.h>
249 #include <wrapper/kref.h>
250@@ -1332,7 +1333,8 @@ long lttng_metadata_ring_buffer_ioctl(struct file *filp,
251 */
252 return -ENOSYS;
253 }
254- case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY: /* Fall-through. */
255+ case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY:
256+ lttng_fallthrough;
257 case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH:
258 {
259 struct lttng_metadata_stream *stream = filp->private_data;
260@@ -1441,7 +1443,8 @@ long lttng_metadata_ring_buffer_compat_ioctl(struct file *filp,
261 */
262 return -ENOSYS;
263 }
264- case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY: /* Fall-through. */
265+ case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY:
266+ lttng_fallthrough;
267 case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH:
268 {
269 struct lttng_metadata_stream *stream = filp->private_data;
270@@ -1758,8 +1761,10 @@ int lttng_abi_validate_event_param(struct lttng_kernel_abi_event *event_param)
271 switch (event_param->instrumentation) {
272 case LTTNG_KERNEL_ABI_SYSCALL:
273 switch (event_param->u.syscall.entryexit) {
274- case LTTNG_KERNEL_ABI_SYSCALL_ENTRY: /* Fall-through */
275- case LTTNG_KERNEL_ABI_SYSCALL_EXIT: /* Fall-through */
276+ case LTTNG_KERNEL_ABI_SYSCALL_ENTRY:
277+ lttng_fallthrough;
278+ case LTTNG_KERNEL_ABI_SYSCALL_EXIT:
279+ lttng_fallthrough;
280 case LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT:
281 break;
282 default:
283@@ -1783,20 +1788,26 @@ int lttng_abi_validate_event_param(struct lttng_kernel_abi_event *event_param)
284 switch (event_param->u.kretprobe.entryexit) {
285 case LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT:
286 break;
287- case LTTNG_KERNEL_ABI_SYSCALL_ENTRY: /* Fall-through */
288- case LTTNG_KERNEL_ABI_SYSCALL_EXIT: /* Fall-through */
289+ case LTTNG_KERNEL_ABI_SYSCALL_ENTRY:
290+ lttng_fallthrough;
291+ case LTTNG_KERNEL_ABI_SYSCALL_EXIT:
292+ lttng_fallthrough;
293 default:
294 return -EINVAL;
295 }
296 break;
297
298- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
299- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
300+ case LTTNG_KERNEL_ABI_TRACEPOINT:
301+ lttng_fallthrough;
302+ case LTTNG_KERNEL_ABI_KPROBE:
303+ lttng_fallthrough;
304 case LTTNG_KERNEL_ABI_UPROBE:
305 break;
306
307- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
308- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
309+ case LTTNG_KERNEL_ABI_FUNCTION:
310+ lttng_fallthrough;
311+ case LTTNG_KERNEL_ABI_NOOP:
312+ lttng_fallthrough;
313 default:
314 return -EINVAL;
315 }
316@@ -1830,18 +1841,23 @@ int lttng_abi_create_event(struct file *channel_file,
317 }
318
319 switch (event_param->instrumentation) {
320- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
321+ case LTTNG_KERNEL_ABI_TRACEPOINT:
322+ lttng_fallthrough;
323 case LTTNG_KERNEL_ABI_SYSCALL:
324 fops = &lttng_event_recorder_enabler_fops;
325 break;
326- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
327- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
328+ case LTTNG_KERNEL_ABI_KPROBE:
329+ lttng_fallthrough;
330+ case LTTNG_KERNEL_ABI_KRETPROBE:
331+ lttng_fallthrough;
332 case LTTNG_KERNEL_ABI_UPROBE:
333 fops = &lttng_event_recorder_event_fops;
334 break;
335
336- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
337- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
338+ case LTTNG_KERNEL_ABI_FUNCTION:
339+ lttng_fallthrough;
340+ case LTTNG_KERNEL_ABI_NOOP:
341+ lttng_fallthrough;
342 default:
343 return -EINVAL;
344 }
345@@ -1867,7 +1883,8 @@ int lttng_abi_create_event(struct file *channel_file,
346 goto event_error;
347
348 switch (event_param->instrumentation) {
349- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
350+ case LTTNG_KERNEL_ABI_TRACEPOINT:
351+ lttng_fallthrough;
352 case LTTNG_KERNEL_ABI_SYSCALL:
353 {
354 struct lttng_event_enabler *event_enabler;
355@@ -1887,8 +1904,10 @@ int lttng_abi_create_event(struct file *channel_file,
356 break;
357 }
358
359- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
360- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
361+ case LTTNG_KERNEL_ABI_KPROBE:
362+ lttng_fallthrough;
363+ case LTTNG_KERNEL_ABI_KRETPROBE:
364+ lttng_fallthrough;
365 case LTTNG_KERNEL_ABI_UPROBE:
366 {
367 struct lttng_kernel_event_recorder *event;
368@@ -1908,8 +1927,10 @@ int lttng_abi_create_event(struct file *channel_file,
369 break;
370 }
371
372- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
373- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
374+ case LTTNG_KERNEL_ABI_FUNCTION:
375+ lttng_fallthrough;
376+ case LTTNG_KERNEL_ABI_NOOP:
377+ lttng_fallthrough;
378 default:
379 ret = -EINVAL;
380 goto event_error;
381@@ -2043,18 +2064,23 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file,
382 }
383
384 switch (event_notifier_param->event.instrumentation) {
385- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
386+ case LTTNG_KERNEL_ABI_TRACEPOINT:
387+ lttng_fallthrough;
388 case LTTNG_KERNEL_ABI_SYSCALL:
389 fops = &lttng_event_notifier_enabler_fops;
390 break;
391- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
392- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
393+ case LTTNG_KERNEL_ABI_KPROBE:
394+ lttng_fallthrough;
395+ case LTTNG_KERNEL_ABI_KRETPROBE:
396+ lttng_fallthrough;
397 case LTTNG_KERNEL_ABI_UPROBE:
398 fops = &lttng_event_notifier_event_fops;
399 break;
400
401- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
402- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
403+ case LTTNG_KERNEL_ABI_FUNCTION:
404+ lttng_fallthrough;
405+ case LTTNG_KERNEL_ABI_NOOP:
406+ lttng_fallthrough;
407 default:
408 ret = -EINVAL;
409 goto inval_instr;
410@@ -2086,7 +2112,8 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file,
411 goto event_notifier_error;
412
413 switch (event_notifier_param->event.instrumentation) {
414- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
415+ case LTTNG_KERNEL_ABI_TRACEPOINT:
416+ lttng_fallthrough;
417 case LTTNG_KERNEL_ABI_SYSCALL:
418 {
419 struct lttng_event_notifier_enabler *enabler;
420@@ -2110,8 +2137,10 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file,
421 break;
422 }
423
424- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
425- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
426+ case LTTNG_KERNEL_ABI_KPROBE:
427+ lttng_fallthrough;
428+ case LTTNG_KERNEL_ABI_KRETPROBE:
429+ lttng_fallthrough;
430 case LTTNG_KERNEL_ABI_UPROBE:
431 {
432 struct lttng_kernel_event_notifier *event_notifier;
433@@ -2135,8 +2164,10 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file,
434 break;
435 }
436
437- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
438- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
439+ case LTTNG_KERNEL_ABI_FUNCTION:
440+ lttng_fallthrough;
441+ case LTTNG_KERNEL_ABI_NOOP:
442+ lttng_fallthrough;
443 default:
444 ret = -EINVAL;
445 goto event_notifier_error;
446diff --git a/src/lttng-bytecode-interpreter.c b/src/lttng-bytecode-interpreter.c
447index b46a23b7..a2a932c6 100644
448--- a/src/lttng-bytecode-interpreter.c
449+++ b/src/lttng-bytecode-interpreter.c
450@@ -7,6 +7,7 @@
451 * Copyright (C) 2010-2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
452 */
453
454+#include <wrapper/compiler_attributes.h>
455 #include <wrapper/uaccess.h>
456 #include <wrapper/objtool.h>
457 #include <wrapper/types.h>
458@@ -421,7 +422,8 @@ static int dynamic_get_index(struct lttng_kernel_probe_ctx *lttng_probe_ctx,
459 }
460 break;
461 case LOAD_ROOT_CONTEXT:
462- case LOAD_ROOT_APP_CONTEXT: /* Fall-through */
463+ lttng_fallthrough;
464+ case LOAD_ROOT_APP_CONTEXT:
465 {
466 ret = context_get_index(lttng_probe_ctx,
467 &stack_top->u.ptr,
468diff --git a/src/lttng-bytecode-specialize.c b/src/lttng-bytecode-specialize.c
469index c4b9d04b..f8b5f19d 100644
470--- a/src/lttng-bytecode-specialize.c
471+++ b/src/lttng-bytecode-specialize.c
472@@ -8,6 +8,8 @@
473 */
474
475 #include <linux/slab.h>
476+#include <wrapper/compiler_attributes.h>
477+
478 #include <lttng/lttng-bytecode.h>
479 #include <lttng/align.h>
480 #include <lttng/events-internal.h>
481@@ -271,7 +273,8 @@ static int specialize_get_index(struct bytecode_runtime *runtime,
482 }
483 case OBJECT_TYPE_STRUCT:
484 /* Only generated by the specialize phase. */
485- case OBJECT_TYPE_VARIANT: /* Fall-through */
486+ case OBJECT_TYPE_VARIANT:
487+ lttng_fallthrough;
488 default:
489 printk(KERN_WARNING "LTTng: bytecode: Unexpected get index type %d",
490 (int) stack_top->load.object_type);
491diff --git a/src/lttng-events.c b/src/lttng-events.c
492index e785fe4d..230e3934 100644
493--- a/src/lttng-events.c
494+++ b/src/lttng-events.c
495@@ -28,6 +28,7 @@
496 #include <linux/vmalloc.h>
497 #include <linux/dmi.h>
498
499+#include <wrapper/compiler_attributes.h>
500 #include <wrapper/uuid.h>
501 #include <wrapper/vmalloc.h> /* for wrapper_vmalloc_sync_mappings() */
502 #include <wrapper/random.h>
503@@ -659,12 +660,14 @@ int lttng_event_enable(struct lttng_kernel_event_common *event)
504 goto end;
505 }
506 switch (event->priv->instrumentation) {
507- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
508+ case LTTNG_KERNEL_ABI_TRACEPOINT:
509+ lttng_fallthrough;
510 case LTTNG_KERNEL_ABI_SYSCALL:
511 ret = -EINVAL;
512 break;
513
514- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
515+ case LTTNG_KERNEL_ABI_KPROBE:
516+ lttng_fallthrough;
517 case LTTNG_KERNEL_ABI_UPROBE:
518 WRITE_ONCE(event->enabled, 1);
519 break;
520@@ -673,8 +676,10 @@ int lttng_event_enable(struct lttng_kernel_event_common *event)
521 ret = lttng_kretprobes_event_enable_state(event, 1);
522 break;
523
524- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
525- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
526+ case LTTNG_KERNEL_ABI_FUNCTION:
527+ lttng_fallthrough;
528+ case LTTNG_KERNEL_ABI_NOOP:
529+ lttng_fallthrough;
530 default:
531 WARN_ON_ONCE(1);
532 ret = -EINVAL;
533@@ -719,12 +724,14 @@ int lttng_event_disable(struct lttng_kernel_event_common *event)
534 goto end;
535 }
536 switch (event->priv->instrumentation) {
537- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
538+ case LTTNG_KERNEL_ABI_TRACEPOINT:
539+ lttng_fallthrough;
540 case LTTNG_KERNEL_ABI_SYSCALL:
541 ret = -EINVAL;
542 break;
543
544- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
545+ case LTTNG_KERNEL_ABI_KPROBE:
546+ lttng_fallthrough;
547 case LTTNG_KERNEL_ABI_UPROBE:
548 WRITE_ONCE(event->enabled, 0);
549 break;
550@@ -733,8 +740,10 @@ int lttng_event_disable(struct lttng_kernel_event_common *event)
551 ret = lttng_kretprobes_event_enable_state(event, 0);
552 break;
553
554- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
555- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
556+ case LTTNG_KERNEL_ABI_FUNCTION:
557+ lttng_fallthrough;
558+ case LTTNG_KERNEL_ABI_NOOP:
559+ lttng_fallthrough;
560 default:
561 WARN_ON_ONCE(1);
562 ret = -EINVAL;
563@@ -873,15 +882,20 @@ struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct l
564 event_name = event_desc->event_name;
565 break;
566
567- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
568- case LTTNG_KERNEL_ABI_UPROBE: /* Fall-through */
569- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
570+ case LTTNG_KERNEL_ABI_KPROBE:
571+ lttng_fallthrough;
572+ case LTTNG_KERNEL_ABI_UPROBE:
573+ lttng_fallthrough;
574+ case LTTNG_KERNEL_ABI_KRETPROBE:
575+ lttng_fallthrough;
576 case LTTNG_KERNEL_ABI_SYSCALL:
577 event_name = event_param->name;
578 break;
579
580- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
581- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
582+ case LTTNG_KERNEL_ABI_FUNCTION:
583+ lttng_fallthrough;
584+ case LTTNG_KERNEL_ABI_NOOP:
585+ lttng_fallthrough;
586 default:
587 WARN_ON_ONCE(1);
588 ret = -EINVAL;
589@@ -1093,8 +1107,10 @@ struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct l
590 WARN_ON_ONCE(!ret);
591 break;
592
593- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
594- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
595+ case LTTNG_KERNEL_ABI_FUNCTION:
596+ lttng_fallthrough;
597+ case LTTNG_KERNEL_ABI_NOOP:
598+ lttng_fallthrough;
599 default:
600 WARN_ON_ONCE(1);
601 ret = -EINVAL;
602@@ -1141,15 +1157,20 @@ struct lttng_kernel_event_notifier *_lttng_event_notifier_create(
603 event_name = event_desc->event_name;
604 break;
605
606- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
607- case LTTNG_KERNEL_ABI_UPROBE: /* Fall-through */
608+ case LTTNG_KERNEL_ABI_KPROBE:
609+ lttng_fallthrough;
610+ case LTTNG_KERNEL_ABI_UPROBE:
611+ lttng_fallthrough;
612 case LTTNG_KERNEL_ABI_SYSCALL:
613 event_name = event_notifier_param->event.name;
614 break;
615
616- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
617- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
618- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
619+ case LTTNG_KERNEL_ABI_KRETPROBE:
620+ lttng_fallthrough;
621+ case LTTNG_KERNEL_ABI_FUNCTION:
622+ lttng_fallthrough;
623+ case LTTNG_KERNEL_ABI_NOOP:
624+ lttng_fallthrough;
625 default:
626 WARN_ON_ONCE(1);
627 ret = -EINVAL;
628@@ -1296,9 +1317,12 @@ struct lttng_kernel_event_notifier *_lttng_event_notifier_create(
629 WARN_ON_ONCE(!ret);
630 break;
631
632- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
633- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
634- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
635+ case LTTNG_KERNEL_ABI_KRETPROBE:
636+ lttng_fallthrough;
637+ case LTTNG_KERNEL_ABI_FUNCTION:
638+ lttng_fallthrough;
639+ case LTTNG_KERNEL_ABI_NOOP:
640+ lttng_fallthrough;
641 default:
642 WARN_ON_ONCE(1);
643 ret = -EINVAL;
644@@ -1423,14 +1447,18 @@ void register_event(struct lttng_kernel_event_recorder *event_recorder)
645 ret = lttng_syscall_filter_enable_event(event_recorder->chan, event_recorder);
646 break;
647
648- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
649- case LTTNG_KERNEL_ABI_UPROBE: /* Fall-through */
650+ case LTTNG_KERNEL_ABI_KPROBE:
651+ lttng_fallthrough;
652+ case LTTNG_KERNEL_ABI_UPROBE:
653+ lttng_fallthrough;
654 case LTTNG_KERNEL_ABI_KRETPROBE:
655 ret = 0;
656 break;
657
658- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
659- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
660+ case LTTNG_KERNEL_ABI_FUNCTION:
661+ lttng_fallthrough;
662+ case LTTNG_KERNEL_ABI_NOOP:
663+ lttng_fallthrough;
664 default:
665 WARN_ON_ONCE(1);
666 }
667@@ -1481,7 +1509,8 @@ int _lttng_event_unregister(struct lttng_kernel_event_recorder *event_recorder)
668 ret = 0;
669 break;
670
671- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
672+ case LTTNG_KERNEL_ABI_FUNCTION:
673+ lttng_fallthrough;
674 default:
675 WARN_ON_ONCE(1);
676 }
677@@ -1512,14 +1541,18 @@ void register_event_notifier(struct lttng_kernel_event_notifier *event_notifier)
678 ret = lttng_syscall_filter_enable_event_notifier(event_notifier);
679 break;
680
681- case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
682+ case LTTNG_KERNEL_ABI_KPROBE:
683+ lttng_fallthrough;
684 case LTTNG_KERNEL_ABI_UPROBE:
685 ret = 0;
686 break;
687
688- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
689- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
690- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
691+ case LTTNG_KERNEL_ABI_KRETPROBE:
692+ lttng_fallthrough;
693+ case LTTNG_KERNEL_ABI_FUNCTION:
694+ lttng_fallthrough;
695+ case LTTNG_KERNEL_ABI_NOOP:
696+ lttng_fallthrough;
697 default:
698 WARN_ON_ONCE(1);
699 }
700@@ -1559,9 +1592,12 @@ int _lttng_event_notifier_unregister(
701 ret = lttng_syscall_filter_disable_event_notifier(event_notifier);
702 break;
703
704- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
705- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
706- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
707+ case LTTNG_KERNEL_ABI_KRETPROBE:
708+ lttng_fallthrough;
709+ case LTTNG_KERNEL_ABI_FUNCTION:
710+ lttng_fallthrough;
711+ case LTTNG_KERNEL_ABI_NOOP:
712+ lttng_fallthrough;
713 default:
714 WARN_ON_ONCE(1);
715 }
716@@ -1614,8 +1650,10 @@ void _lttng_event_destroy(struct lttng_kernel_event_common *event)
717 lttng_uprobes_destroy_event_private(event_recorder);
718 break;
719
720- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
721- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
722+ case LTTNG_KERNEL_ABI_FUNCTION:
723+ lttng_fallthrough;
724+ case LTTNG_KERNEL_ABI_NOOP:
725+ lttng_fallthrough;
726 default:
727 WARN_ON_ONCE(1);
728 }
729@@ -1647,9 +1685,12 @@ void _lttng_event_destroy(struct lttng_kernel_event_common *event)
730 lttng_uprobes_destroy_event_notifier_private(event_notifier);
731 break;
732
733- case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
734- case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
735- case LTTNG_KERNEL_ABI_NOOP: /* Fall-through */
736+ case LTTNG_KERNEL_ABI_KRETPROBE:
737+ lttng_fallthrough;
738+ case LTTNG_KERNEL_ABI_FUNCTION:
739+ lttng_fallthrough;
740+ case LTTNG_KERNEL_ABI_NOOP:
741+ lttng_fallthrough;
742 default:
743 WARN_ON_ONCE(1);
744 }
745@@ -2713,7 +2754,8 @@ void lttng_session_sync_event_enablers(struct lttng_kernel_session *session)
746 int nr_filters = 0;
747
748 switch (event_recorder_priv->parent.instrumentation) {
749- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
750+ case LTTNG_KERNEL_ABI_TRACEPOINT:
751+ lttng_fallthrough;
752 case LTTNG_KERNEL_ABI_SYSCALL:
753 /* Enable events */
754 list_for_each_entry(enabler_ref,
755@@ -2807,7 +2849,8 @@ void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group
756 int nr_filters = 0, nr_captures = 0;
757
758 switch (event_notifier_priv->parent.instrumentation) {
759- case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
760+ case LTTNG_KERNEL_ABI_TRACEPOINT:
761+ lttng_fallthrough;
762 case LTTNG_KERNEL_ABI_SYSCALL:
763 /* Enable event_notifiers */
764 list_for_each_entry(enabler_ref,
765@@ -3877,7 +3920,7 @@ int print_escaped_ctf_string(struct lttng_kernel_session *session, const char *s
766 if (ret)
767 goto error;
768 /* We still print the current char */
769- /* Fallthrough */
770+ lttng_fallthrough;
771 default:
772 ret = lttng_metadata_printf(session, "%c", cur);
773 break;
774diff --git a/src/lttng-string-utils.c b/src/lttng-string-utils.c
775index d9447903..65946193 100644
776--- a/src/lttng-string-utils.c
777+++ b/src/lttng-string-utils.c
778@@ -4,6 +4,7 @@
779 */
780
781 #include <linux/types.h>
782+#include <wrapper/compiler_attributes.h>
783
784 #include <lttng/string-utils.h>
785
786@@ -302,7 +303,7 @@ retry:
787 p = pattern_get_char_at_cb(p_at,
788 pattern_get_char_at_cb_data);
789
790- /* Fall-through. */
791+ lttng_fallthrough;
792 default:
793 /*
794 * Default case which will compare the escaped
795diff --git a/src/probes/lttng-kretprobes.c b/src/probes/lttng-kretprobes.c
796index 0fa6a1bf..1d0a5ecb 100644
797--- a/src/probes/lttng-kretprobes.c
798+++ b/src/probes/lttng-kretprobes.c
799@@ -14,6 +14,7 @@
800 #include <lttng/events.h>
801 #include <lttng/events-internal.h>
802 #include <ringbuffer/frontend_types.h>
803+#include <wrapper/compiler_attributes.h>
804 #include <wrapper/vmalloc.h>
805 #include <wrapper/irqflags.h>
806 #include <lttng/tracer.h>
807@@ -61,7 +62,8 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
808 return 0;
809 break;
810 }
811- case LTTNG_KERNEL_EVENT_TYPE_NOTIFIER: /* Fall-through. */
812+ case LTTNG_KERNEL_EVENT_TYPE_NOTIFIER:
813+ lttng_fallthrough;
814 default:
815 WARN_ON_ONCE(1);
816 }
817@@ -90,7 +92,8 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
818 chan->ops->event_commit(&ctx);
819 break;
820 }
821- case LTTNG_KERNEL_EVENT_TYPE_NOTIFIER: /* Fall-through. */
822+ case LTTNG_KERNEL_EVENT_TYPE_NOTIFIER:
823+ lttng_fallthrough;
824 default:
825 WARN_ON_ONCE(1);
826 }
827--
8282.19.1
829
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0003-fix-sched-tracing-Don-t-re-read-p-state-when-emittin.patch b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-sched-tracing-Don-t-re-read-p-state-when-emittin.patch
new file mode 100644
index 0000000000..afe514de82
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-sched-tracing-Don-t-re-read-p-state-when-emittin.patch
@@ -0,0 +1,183 @@
1From 8e52fd71e693619f7a58de2692e59f0c826e9988 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 4 Apr 2022 13:52:57 -0400
4Subject: [PATCH 03/10] fix: sched/tracing: Don't re-read p->state when
5 emitting sched_switch event (v5.18)
6
7See upstream commit :
8
9 commit fa2c3254d7cfff5f7a916ab928a562d1165f17bb
10 Author: Valentin Schneider <valentin.schneider@arm.com>
11 Date: Thu Jan 20 16:25:19 2022 +0000
12
13 sched/tracing: Don't re-read p->state when emitting sched_switch event
14
15 As of commit
16
17 c6e7bd7afaeb ("sched/core: Optimize ttwu() spinning on p->on_cpu")
18
19 the following sequence becomes possible:
20
21 p->__state = TASK_INTERRUPTIBLE;
22 __schedule()
23 deactivate_task(p);
24 ttwu()
25 READ !p->on_rq
26 p->__state=TASK_WAKING
27 trace_sched_switch()
28 __trace_sched_switch_state()
29 task_state_index()
30 return 0;
31
32 TASK_WAKING isn't in TASK_REPORT, so the task appears as TASK_RUNNING in
33 the trace event.
34
35 Prevent this by pushing the value read from __schedule() down the trace
36 event.
37
38Upstream-Status: Backport
39
40Change-Id: I46743cd006be4b4d573cae2d77df7d6d16744d04
41Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
42Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
43---
44 include/instrumentation/events/sched.h | 88 +++++++++++++++++++++++---
45 1 file changed, 78 insertions(+), 10 deletions(-)
46
47diff --git a/include/instrumentation/events/sched.h b/include/instrumentation/events/sched.h
48index 91953a6f..339bec94 100644
49--- a/include/instrumentation/events/sched.h
50+++ b/include/instrumentation/events/sched.h
51@@ -20,7 +20,37 @@
52 #ifndef _TRACE_SCHED_DEF_
53 #define _TRACE_SCHED_DEF_
54
55-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,15,0))
56+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
57+
58+static inline long __trace_sched_switch_state(bool preempt,
59+ unsigned int prev_state,
60+ struct task_struct *p)
61+{
62+ unsigned int state;
63+
64+#ifdef CONFIG_SCHED_DEBUG
65+ BUG_ON(p != current);
66+#endif /* CONFIG_SCHED_DEBUG */
67+
68+ /*
69+ * Preemption ignores task state, therefore preempted tasks are always
70+ * RUNNING (we will not have dequeued if state != RUNNING).
71+ */
72+ if (preempt)
73+ return TASK_REPORT_MAX;
74+
75+ /*
76+ * task_state_index() uses fls() and returns a value from 0-8 range.
77+ * Decrement it by 1 (except TASK_RUNNING state i.e 0) before using
78+ * it for left shift operation to get the correct task->state
79+ * mapping.
80+ */
81+ state = __task_state_index(prev_state, p->exit_state);
82+
83+ return state ? (1 << (state - 1)) : state;
84+}
85+
86+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,15,0))
87
88 static inline long __trace_sched_switch_state(bool preempt, struct task_struct *p)
89 {
90@@ -321,43 +351,81 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(sched_wakeup_template, sched_wakeup_new,
91 /*
92 * Tracepoint for task switches, performed by the scheduler:
93 */
94+
95+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
96 LTTNG_TRACEPOINT_EVENT(sched_switch,
97
98-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,4,0))
99 TP_PROTO(bool preempt,
100- struct task_struct *prev,
101- struct task_struct *next),
102+ unsigned int prev_state,
103+ struct task_struct *prev,
104+ struct task_struct *next),
105
106- TP_ARGS(preempt, prev, next),
107+ TP_ARGS(preempt, prev_state, prev, next),
108+
109+ TP_FIELDS(
110+ ctf_array_text(char, prev_comm, prev->comm, TASK_COMM_LEN)
111+ ctf_integer(pid_t, prev_tid, prev->pid)
112+ ctf_integer(int, prev_prio, prev->prio - MAX_RT_PRIO)
113+#ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
114+ ctf_enum(task_state, long, prev_state, __trace_sched_switch_state(preempt, prev_state, prev))
115 #else
116- TP_PROTO(struct task_struct *prev,
117+ ctf_integer(long, prev_state, __trace_sched_switch_state(preempt, prev_state, prev))
118+#endif
119+ ctf_array_text(char, next_comm, next->comm, TASK_COMM_LEN)
120+ ctf_integer(pid_t, next_tid, next->pid)
121+ ctf_integer(int, next_prio, next->prio - MAX_RT_PRIO)
122+ )
123+)
124+
125+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,4,0))
126+
127+LTTNG_TRACEPOINT_EVENT(sched_switch,
128+
129+ TP_PROTO(bool preempt,
130+ struct task_struct *prev,
131 struct task_struct *next),
132
133- TP_ARGS(prev, next),
134-#endif /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,4,0)) */
135+ TP_ARGS(preempt, prev, next),
136
137 TP_FIELDS(
138 ctf_array_text(char, prev_comm, prev->comm, TASK_COMM_LEN)
139 ctf_integer(pid_t, prev_tid, prev->pid)
140 ctf_integer(int, prev_prio, prev->prio - MAX_RT_PRIO)
141-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,4,0))
142 #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
143 ctf_enum(task_state, long, prev_state, __trace_sched_switch_state(preempt, prev))
144 #else
145 ctf_integer(long, prev_state, __trace_sched_switch_state(preempt, prev))
146 #endif
147+ ctf_array_text(char, next_comm, next->comm, TASK_COMM_LEN)
148+ ctf_integer(pid_t, next_tid, next->pid)
149+ ctf_integer(int, next_prio, next->prio - MAX_RT_PRIO)
150+ )
151+)
152+
153 #else
154+
155+LTTNG_TRACEPOINT_EVENT(sched_switch,
156+
157+ TP_PROTO(struct task_struct *prev,
158+ struct task_struct *next),
159+
160+ TP_ARGS(prev, next),
161+
162+ TP_FIELDS(
163+ ctf_array_text(char, prev_comm, prev->comm, TASK_COMM_LEN)
164+ ctf_integer(pid_t, prev_tid, prev->pid)
165+ ctf_integer(int, prev_prio, prev->prio - MAX_RT_PRIO)
166 #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
167 ctf_enum(task_state, long, prev_state, __trace_sched_switch_state(prev))
168 #else
169 ctf_integer(long, prev_state, __trace_sched_switch_state(prev))
170-#endif
171 #endif
172 ctf_array_text(char, next_comm, next->comm, TASK_COMM_LEN)
173 ctf_integer(pid_t, next_tid, next->pid)
174 ctf_integer(int, next_prio, next->prio - MAX_RT_PRIO)
175 )
176 )
177+#endif
178
179 /*
180 * Tracepoint for a task being migrated:
181--
1822.19.1
183
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0004-fix-block-remove-genhd.h-v5.18.patch b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-block-remove-genhd.h-v5.18.patch
new file mode 100644
index 0000000000..9248ffe4ff
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-block-remove-genhd.h-v5.18.patch
@@ -0,0 +1,45 @@
1From 868e0b6db59159197c2cec3550fa4ad5e6572bc5 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 4 Apr 2022 13:54:59 -0400
4Subject: [PATCH 04/10] fix: block: remove genhd.h (v5.18)
5
6See upstream commit :
7
8 commit 322cbb50de711814c42fb088f6d31901502c711a
9 Author: Christoph Hellwig <hch@lst.de>
10 Date: Mon Jan 24 10:39:13 2022 +0100
11
12 block: remove genhd.h
13
14 There is no good reason to keep genhd.h separate from the main blkdev.h
15 header that includes it. So fold the contents of genhd.h into blkdev.h
16 and remove genhd.h entirely.
17
18Upstream-Status: Backport
19
20Change-Id: I7cf2aaa3a4c133320b95f2edde49f790f9515dbd
21Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
22Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23---
24 include/wrapper/genhd.h | 4 ++++
25 1 file changed, 4 insertions(+)
26
27diff --git a/include/wrapper/genhd.h b/include/wrapper/genhd.h
28index 3c6dbcbe..4a59b68e 100644
29--- a/include/wrapper/genhd.h
30+++ b/include/wrapper/genhd.h
31@@ -12,7 +12,11 @@
32 #ifndef _LTTNG_WRAPPER_GENHD_H
33 #define _LTTNG_WRAPPER_GENHD_H
34
35+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
36+#include <linux/blkdev.h>
37+#else
38 #include <linux/genhd.h>
39+#endif
40
41 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
42 #define LTTNG_GENHD_FL_HIDDEN GENHD_FL_HIDDEN
43--
442.19.1
45
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0005-fix-scsi-block-Remove-REQ_OP_WRITE_SAME-support-v5.1.patch b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-scsi-block-Remove-REQ_OP_WRITE_SAME-support-v5.1.patch
new file mode 100644
index 0000000000..0751827613
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-scsi-block-Remove-REQ_OP_WRITE_SAME-support-v5.1.patch
@@ -0,0 +1,79 @@
1From 2bc7cb7193124d20aa4e1b5dbad0410bfb97a470 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 4 Apr 2022 14:12:13 -0400
4Subject: [PATCH 05/10] fix: scsi: block: Remove REQ_OP_WRITE_SAME support
5 (v5.18)
6
7See upstream commit :
8
9 commit 73bd66d9c834220579c881a3eb020fd8917075d8
10 Author: Christoph Hellwig <hch@lst.de>
11 Date: Wed Feb 9 09:28:28 2022 +0100
12
13 scsi: block: Remove REQ_OP_WRITE_SAME support
14
15 No more users of REQ_OP_WRITE_SAME or drivers implementing it are left,
16 so remove the infrastructure.
17
18Upstream-Status: Backport
19
20Change-Id: Ifbff71f79f8b590436fc7cb79f82d90c6e033d84
21Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
22Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23---
24 include/instrumentation/events/block.h | 32 ++++++++++++++++++++++++++
25 1 file changed, 32 insertions(+)
26
27diff --git a/include/instrumentation/events/block.h b/include/instrumentation/events/block.h
28index 3e1104d7..050a59a2 100644
29--- a/include/instrumentation/events/block.h
30+++ b/include/instrumentation/events/block.h
31@@ -66,6 +66,37 @@ LTTNG_TRACEPOINT_ENUM(block_rq_type,
32 #define lttng_bio_op(bio) bio_op(bio)
33 #define lttng_bio_rw(bio) ((bio)->bi_opf)
34
35+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
36+#ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
37+#define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
38+ ctf_enum(block_rq_type, type, rwbs, \
39+ ( (op) == REQ_OP_WRITE ? RWBS_FLAG_WRITE : \
40+ ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
41+ ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
42+ ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
43+ ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
44+ ( 0 )))))) \
45+ | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
46+ | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
47+ | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
48+ | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
49+ | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
50+#else
51+#define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
52+ ctf_integer(type, rwbs, \
53+ ( (op) == REQ_OP_WRITE ? RWBS_FLAG_WRITE : \
54+ ( (op) == REQ_OP_DISCARD ? RWBS_FLAG_DISCARD : \
55+ ( (op) == REQ_OP_SECURE_ERASE ? (RWBS_FLAG_DISCARD | RWBS_FLAG_SECURE) : \
56+ ( (op) == REQ_OP_FLUSH ? RWBS_FLAG_FLUSH : \
57+ ( (op) == REQ_OP_READ ? RWBS_FLAG_READ : \
58+ ( 0 )))))) \
59+ | ((rw) & REQ_RAHEAD ? RWBS_FLAG_RAHEAD : 0) \
60+ | ((rw) & REQ_SYNC ? RWBS_FLAG_SYNC : 0) \
61+ | ((rw) & REQ_META ? RWBS_FLAG_META : 0) \
62+ | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
63+ | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
64+#endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
65+#else
66 #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM
67 #define blk_rwbs_ctf_integer(type, rwbs, op, rw, bytes) \
68 ctf_enum(block_rq_type, type, rwbs, \
69@@ -95,6 +126,7 @@ LTTNG_TRACEPOINT_ENUM(block_rq_type,
70 | ((rw) & REQ_PREFLUSH ? RWBS_FLAG_PREFLUSH : 0) \
71 | ((rw) & REQ_FUA ? RWBS_FLAG_FUA : 0))
72 #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */
73+#endif
74
75 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,1,0))
76
77--
782.19.1
79
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0006-fix-random-remove-unused-tracepoints-v5.18.patch b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-random-remove-unused-tracepoints-v5.18.patch
new file mode 100644
index 0000000000..9c2f70d4af
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-random-remove-unused-tracepoints-v5.18.patch
@@ -0,0 +1,47 @@
1From 369d82bb1746447514c877088d7c5fd0f39140f8 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 4 Apr 2022 14:33:42 -0400
4Subject: [PATCH 06/10] fix: random: remove unused tracepoints (v5.18)
5
6See upstream commit :
7
8 commit 14c174633f349cb41ea90c2c0aaddac157012f74
9 Author: Jason A. Donenfeld <Jason@zx2c4.com>
10 Date: Thu Feb 10 16:40:44 2022 +0100
11
12 random: remove unused tracepoints
13
14 These explicit tracepoints aren't really used and show sign of aging.
15 It's work to keep these up to date, and before I attempted to keep them
16 up to date, they weren't up to date, which indicates that they're not
17 really used. These days there are better ways of introspecting anyway.
18
19Upstream-Status: Backport
20
21Change-Id: I3b8c3e2732e7efdd76ce63204ac53a48784d0df6
22Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
23Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
24---
25 src/probes/Kbuild | 5 ++++-
26 1 file changed, 4 insertions(+), 1 deletion(-)
27
28diff --git a/src/probes/Kbuild b/src/probes/Kbuild
29index e26b4359..8d6ff0f2 100644
30--- a/src/probes/Kbuild
31+++ b/src/probes/Kbuild
32@@ -187,8 +187,11 @@ ifneq ($(CONFIG_FRAME_WARN),0)
33 CFLAGS_lttng-probe-printk.o += -Wframe-larger-than=2200
34 endif
35
36+# Introduced in v3.6, remove in v5.18
37 obj-$(CONFIG_LTTNG) += $(shell \
38- if [ $(VERSION) -ge 4 \
39+ if [ \( ! \( $(VERSION) -ge 6 -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -ge 18 \) \) \) \
40+ -a \
41+ $(VERSION) -ge 4 \
42 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 6 \) \
43 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 5 -a $(SUBLEVEL) -ge 2 \) \
44 -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 4 -a $(SUBLEVEL) -ge 9 \) \
45--
462.19.1
47
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0007-fix-kprobes-Use-rethook-for-kretprobe-if-possible-v5.patch b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-kprobes-Use-rethook-for-kretprobe-if-possible-v5.patch
new file mode 100644
index 0000000000..effd37ffe1
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-kprobes-Use-rethook-for-kretprobe-if-possible-v5.patch
@@ -0,0 +1,72 @@
1From 3c46ddc134621dba65030263aa321dd6bdae3ba3 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 4 Apr 2022 15:02:10 -0400
4Subject: [PATCH 07/10] fix: kprobes: Use rethook for kretprobe if possible
5 (v5.18)
6
7See upstream commit :
8
9 commit 73f9b911faa74ac5107879de05c9489c419f41bb
10 Author: Masami Hiramatsu <mhiramat@kernel.org>
11 Date: Sat Mar 26 11:27:05 2022 +0900
12
13 kprobes: Use rethook for kretprobe if possible
14
15 Use rethook for kretprobe function return hooking if the arch sets
16 CONFIG_HAVE_RETHOOK=y. In this case, CONFIG_KRETPROBE_ON_RETHOOK is
17 set to 'y' automatically, and the kretprobe internal data fields
18 switches to use rethook. If not, it continues to use kretprobe
19 specific function return hooks.
20
21Upstream-Status: Backport
22
23Change-Id: I2b7670dc04e4769c1e3c372582ad2f555f6d7a66
24Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
25Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
26---
27 include/wrapper/kprobes.h | 17 +++++++++++++++++
28 src/probes/lttng-kretprobes.c | 2 +-
29 2 files changed, 18 insertions(+), 1 deletion(-)
30
31diff --git a/include/wrapper/kprobes.h b/include/wrapper/kprobes.h
32index b546d615..51d32b7c 100644
33--- a/include/wrapper/kprobes.h
34+++ b/include/wrapper/kprobes.h
35@@ -29,4 +29,21 @@ struct kretprobe *lttng_get_kretprobe(struct kretprobe_instance *ri)
36
37 #endif /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0) */
38
39+
40+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
41+static inline
42+unsigned long lttng_get_kretprobe_retaddr(struct kretprobe_instance *ri)
43+{
44+ return get_kretprobe_retaddr(ri);
45+}
46+
47+#else
48+
49+static inline
50+unsigned long lttng_get_kretprobe_retaddr(struct kretprobe_instance *ri)
51+{
52+ return (unsigned long) ri->ret_addr;
53+}
54+#endif
55+
56 #endif /* _LTTNG_WRAPPER_KPROBES_H */
57diff --git a/src/probes/lttng-kretprobes.c b/src/probes/lttng-kretprobes.c
58index 5cb2e953..565df739 100644
59--- a/src/probes/lttng-kretprobes.c
60+++ b/src/probes/lttng-kretprobes.c
61@@ -81,7 +81,7 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
62 int ret;
63
64 payload.ip = (unsigned long) lttng_get_kretprobe(krpi)->kp.addr;
65- payload.parent_ip = (unsigned long) krpi->ret_addr;
66+ payload.parent_ip = lttng_get_kretprobe_retaddr(krpi);
67
68 lib_ring_buffer_ctx_init(&ctx, event_recorder, sizeof(payload),
69 lttng_alignof(payload), &lttng_probe_ctx);
70--
712.19.1
72
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0008-fix-scsi-core-Remove-scsi-scsi_request.h-v5.18.patch b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-scsi-core-Remove-scsi-scsi_request.h-v5.18.patch
new file mode 100644
index 0000000000..13c504b859
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-scsi-core-Remove-scsi-scsi_request.h-v5.18.patch
@@ -0,0 +1,44 @@
1From e8d2f286b5b208ac8870d0a9c167b170e96169b3 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 4 Apr 2022 15:08:48 -0400
4Subject: [PATCH 08/10] fix: scsi: core: Remove <scsi/scsi_request.h> (v5.18)
5
6See upstream commit :
7
8 commit 26440303310591e29121964ede0048583cb3126d
9 Author: Christoph Hellwig <hch@lst.de>
10 Date: Thu Feb 24 18:55:52 2022 +0100
11
12 scsi: core: Remove <scsi/scsi_request.h>
13
14 This header is empty now except for an include of <linux/blk-mq.h>, so
15 remove it.
16
17Upstream-Status: Backport
18
19Change-Id: Ic8ee3352f1e8bddfcd44c31be9b788db82f183aa
20Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
21Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
22---
23 include/instrumentation/events/block.h | 4 ++--
24 1 file changed, 2 insertions(+), 2 deletions(-)
25
26diff --git a/include/instrumentation/events/block.h b/include/instrumentation/events/block.h
27index 050a59a2..882e6e08 100644
28--- a/include/instrumentation/events/block.h
29+++ b/include/instrumentation/events/block.h
30@@ -11,9 +11,9 @@
31 #include <linux/trace_seq.h>
32 #include <lttng/kernel-version.h>
33
34-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0))
35+#if LTTNG_KERNEL_RANGE(4,11,0, 5,18,0)
36 #include <scsi/scsi_request.h>
37-#endif /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */
38+#endif /* LTTNG_KERNEL_RANGE(4,11,0, 5,18,0) */
39
40 #ifndef _TRACE_BLOCK_DEF_
41 #define _TRACE_BLOCK_DEF_
42--
432.19.1
44
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0009-Rename-genhd-wrapper-to-blkdev.patch b/meta/recipes-kernel/lttng/lttng-modules/0009-Rename-genhd-wrapper-to-blkdev.patch
new file mode 100644
index 0000000000..90fec9dc58
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0009-Rename-genhd-wrapper-to-blkdev.patch
@@ -0,0 +1,76 @@
1From 82fbf9d383ff9069808fb0f5f75c660098dbae52 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Tue, 5 Apr 2022 14:57:41 -0400
4Subject: [PATCH 09/10] Rename genhd wrapper to blkdev
5
6The genhd.h header was folded into blkdev.h in v5.18, rename our wrapper
7to follow upstream.
8
9Upstream-Status: Backport
10
11Change-Id: I4ec94fb94d11712dd20f0680aea1de77fbfa9d17
12Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
13Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
14---
15 include/wrapper/{genhd.h => blkdev.h} | 10 +++++-----
16 src/lttng-statedump-impl.c | 2 +-
17 2 files changed, 6 insertions(+), 6 deletions(-)
18 rename include/wrapper/{genhd.h => blkdev.h} (93%)
19
20diff --git a/include/wrapper/genhd.h b/include/wrapper/blkdev.h
21similarity index 93%
22rename from include/wrapper/genhd.h
23rename to include/wrapper/blkdev.h
24index 4a59b68e..0d5ad90f 100644
25--- a/include/wrapper/genhd.h
26+++ b/include/wrapper/blkdev.h
27@@ -1,6 +1,6 @@
28 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
29 *
30- * wrapper/genhd.h
31+ * wrapper/blkdev.h
32 *
33 * wrapper around block layer functions and data structures. Using
34 * KALLSYMS to get its address when available, else we need to have a
35@@ -9,8 +9,8 @@
36 * Copyright (C) 2011-2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
37 */
38
39-#ifndef _LTTNG_WRAPPER_GENHD_H
40-#define _LTTNG_WRAPPER_GENHD_H
41+#ifndef _LTTNG_WRAPPER_BLKDEV_H
42+#define _LTTNG_WRAPPER_BLKDEV_H
43
44 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
45 #include <linux/blkdev.h>
46@@ -45,7 +45,7 @@ struct class *wrapper_get_block_class(void)
47 /*
48 * Canary function to check for 'block_class' at compile time.
49 *
50- * From 'include/linux/genhd.h':
51+ * From 'include/linux/blkdev.h':
52 *
53 * extern struct class block_class;
54 */
55@@ -104,4 +104,4 @@ struct device_type *wrapper_get_disk_type(void)
56
57 #endif
58
59-#endif /* _LTTNG_WRAPPER_GENHD_H */
60+#endif /* _LTTNG_WRAPPER_BLKDEV_H */
61diff --git a/src/lttng-statedump-impl.c b/src/lttng-statedump-impl.c
62index 4d7b2921..0e753090 100644
63--- a/src/lttng-statedump-impl.c
64+++ b/src/lttng-statedump-impl.c
65@@ -41,7 +41,7 @@
66 #include <wrapper/namespace.h>
67 #include <wrapper/irq.h>
68 #include <wrapper/tracepoint.h>
69-#include <wrapper/genhd.h>
70+#include <wrapper/blkdev.h>
71 #include <wrapper/file.h>
72 #include <wrapper/fdtable.h>
73 #include <wrapper/sched.h>
74--
752.19.1
76
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0010-fix-mm-compaction-cleanup-the-compaction-trace-event.patch b/meta/recipes-kernel/lttng/lttng-modules/0010-fix-mm-compaction-cleanup-the-compaction-trace-event.patch
new file mode 100644
index 0000000000..892d3f0d23
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0010-fix-mm-compaction-cleanup-the-compaction-trace-event.patch
@@ -0,0 +1,106 @@
1From f9208dc00756dfa0a2f191799722030bdf3f793d Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 4 Apr 2022 15:14:01 -0400
4Subject: [PATCH 10/10] fix: mm: compaction: cleanup the compaction trace
5 events (v5.18)
6
7See upstream commit :
8
9 commit abd4349ff9b8d242376b67711254221f64f447c7
10 Author: Baolin Wang <baolin.wang@linux.alibaba.com>
11 Date: Tue Mar 22 14:45:56 2022 -0700
12
13 mm: compaction: cleanup the compaction trace events
14
15 As Steven suggested [1], we should access the pointers from the trace
16 event to avoid dereferencing them to the tracepoint function when the
17 tracepoint is disabled.
18
19 [1] https://lkml.org/lkml/2021/11/3/409
20
21Upstream-Status: Backport
22
23Change-Id: I6c08250df8596e8dbc76780ae5d95c899c12e6fe
24Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
25Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
26---
27 include/instrumentation/events/compaction.h | 17 ++++++++++++++++-
28 src/probes/Kbuild | 17 ++++++++++++++++-
29 src/probes/lttng-probe-compaction.c | 5 +++++
30 3 files changed, 37 insertions(+), 2 deletions(-)
31
32diff --git a/include/instrumentation/events/compaction.h b/include/instrumentation/events/compaction.h
33index 15964537..ecae39a8 100644
34--- a/include/instrumentation/events/compaction.h
35+++ b/include/instrumentation/events/compaction.h
36@@ -97,7 +97,22 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template,
37
38 #endif /* #else #if LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0) */
39
40-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
41+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
42+LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
43+
44+ compaction_migratepages,
45+
46+ TP_PROTO(struct compact_control *cc,
47+ unsigned int nr_succeeded),
48+
49+ TP_ARGS(cc, nr_succeeded),
50+
51+ TP_FIELDS(
52+ ctf_integer(unsigned long, nr_migrated, nr_succeeded)
53+ ctf_integer(unsigned long, nr_failed, cc->nr_migratepages - nr_succeeded)
54+ )
55+)
56+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
57 LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
58
59 compaction_migratepages,
60diff --git a/src/probes/Kbuild b/src/probes/Kbuild
61index 8d6ff0f2..54784477 100644
62--- a/src/probes/Kbuild
63+++ b/src/probes/Kbuild
64@@ -167,7 +167,22 @@ ifneq ($(CONFIG_BTRFS_FS),)
65 endif # $(wildcard $(btrfs_dep))
66 endif # CONFIG_BTRFS_FS
67
68-obj-$(CONFIG_LTTNG) += lttng-probe-compaction.o
69+# A dependency on internal header 'mm/internal.h' was introduced in v5.18
70+compaction_dep = $(srctree)/mm/internal.h
71+compaction_dep_wildcard = $(wildcard $(compaction_dep))
72+compaction_dep_check = $(shell \
73+if [ \( $(VERSION) -ge 6 \
74+ -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -ge 18 \) \) -a \
75+ -z "$(compaction_dep_wildcard)" ] ; then \
76+ echo "warn" ; \
77+else \
78+ echo "ok" ; \
79+fi ;)
80+ifeq ($(compaction_dep_check),ok)
81+ obj-$(CONFIG_LTTNG) += lttng-probe-compaction.o
82+else
83+ $(warning Files $(compaction_dep) not found. Probe "compaction" is disabled. Use full kernel source tree to enable it.)
84+endif # $(wildcard $(compaction_dep))
85
86 ifneq ($(CONFIG_EXT4_FS),)
87 ext4_dep = $(srctree)/fs/ext4/*.h
88diff --git a/src/probes/lttng-probe-compaction.c b/src/probes/lttng-probe-compaction.c
89index f8ddf384..ffaf45f0 100644
90--- a/src/probes/lttng-probe-compaction.c
91+++ b/src/probes/lttng-probe-compaction.c
92@@ -10,6 +10,11 @@
93
94 #include <linux/module.h>
95 #include <lttng/tracer.h>
96+#include <lttng/kernel-version.h>
97+
98+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
99+#include "../mm/internal.h"
100+#endif
101
102 /*
103 * Create the tracepoint static inlines from the kernel to validate that our
104--
1052.19.1
106
diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.13.0.bb b/meta/recipes-kernel/lttng/lttng-modules_2.13.3.bb
index 6dfde8dcad..c33920e0d0 100644
--- a/meta/recipes-kernel/lttng/lttng-modules_2.13.0.bb
+++ b/meta/recipes-kernel/lttng/lttng-modules_2.13.3.bb
@@ -10,13 +10,22 @@ inherit module
10include lttng-platforms.inc 10include lttng-platforms.inc
11 11
12SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \ 12SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
13 file://0001-fix-cpu-hotplug-Remove-deprecated-CPU-hotplug-functi.patch \ 13 file://0001-Fix-compaction-migratepages-event-name.patch \
14 file://0002-fix-Revert-Makefile-Enable-Wimplicit-fallthrough-for.patch \ 14 file://0002-Fix-tracepoint-event-allow-same-provider-and-event-n.patch \
15 file://0003-fix-sched-tracing-Don-t-re-read-p-state-when-emittin.patch \
16 file://0004-fix-block-remove-genhd.h-v5.18.patch \
17 file://0005-fix-scsi-block-Remove-REQ_OP_WRITE_SAME-support-v5.1.patch \
18 file://0006-fix-random-remove-unused-tracepoints-v5.18.patch \
19 file://0007-fix-kprobes-Use-rethook-for-kretprobe-if-possible-v5.patch \
20 file://0008-fix-scsi-core-Remove-scsi-scsi_request.h-v5.18.patch \
21 file://0009-Rename-genhd-wrapper-to-blkdev.patch \
22 file://0010-fix-mm-compaction-cleanup-the-compaction-trace-event.patch \
15 " 23 "
24
16# Use :append here so that the patch is applied also when using devupstream 25# Use :append here so that the patch is applied also when using devupstream
17SRC_URI:append = " file://0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch" 26SRC_URI:append = " file://0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch"
18 27
19SRC_URI[sha256sum] = "5ebf2b3cd128b3a1c8afaea1e98d5a6f7f0676fd524fcf72361c34d9dc603356" 28SRC_URI[sha256sum] = "7cf1acbb50b84116acc9b4281b81dcc2643d6018bbd1e8514ad1270239896c4b"
20 29
21export INSTALL_MOD_DIR="kernel/lttng-modules" 30export INSTALL_MOD_DIR="kernel/lttng-modules"
22 31
diff --git a/meta/recipes-kernel/perf/perf/sort-pmuevents.py b/meta/recipes-kernel/perf/perf/sort-pmuevents.py
index 5ddf0f144f..09ba3328a7 100755
--- a/meta/recipes-kernel/perf/perf/sort-pmuevents.py
+++ b/meta/recipes-kernel/perf/perf/sort-pmuevents.py
@@ -33,10 +33,10 @@ if os.path.exists(outfile):
33with open(infile, 'r') as file: 33with open(infile, 'r') as file:
34 data = file.read() 34 data = file.read()
35 35
36preamble_regex = re.compile( '^(.*?)^struct', re.MULTILINE | re.DOTALL ) 36preamble_regex = re.compile( '^(.*?)^(struct|const struct|static struct|static const struct)', re.MULTILINE | re.DOTALL )
37 37
38preamble = re.search( preamble_regex, data ) 38preamble = re.search( preamble_regex, data )
39struct_block_regex = re.compile( '^struct.*?(\w+) (.*?)\[\] = {(.*?)^};', re.MULTILINE | re.DOTALL ) 39struct_block_regex = re.compile( '^(struct|const struct|static struct|static const struct).*?(\w+) (.*?)\[\] = {(.*?)^};', re.MULTILINE | re.DOTALL )
40field_regex = re.compile( '{.*?},', re.MULTILINE | re.DOTALL ) 40field_regex = re.compile( '{.*?},', re.MULTILINE | re.DOTALL )
41cpuid_regex = re.compile( '\.cpuid = (.*?),', re.MULTILINE | re.DOTALL ) 41cpuid_regex = re.compile( '\.cpuid = (.*?),', re.MULTILINE | re.DOTALL )
42name_regex = re.compile( '\.name = (.*?),', re.MULTILINE | re.DOTALL ) 42name_regex = re.compile( '\.name = (.*?),', re.MULTILINE | re.DOTALL )
@@ -45,22 +45,25 @@ name_regex = re.compile( '\.name = (.*?),', re.MULTILINE | re.DOTALL )
45# types and then their fields. 45# types and then their fields.
46entry_dict = {} 46entry_dict = {}
47for struct in re.findall( struct_block_regex, data ): 47for struct in re.findall( struct_block_regex, data ):
48 # print( "struct: %s %s" % (struct[0],struct[1]) ) 48 # print( "struct: %s %s %s" % (struct[0],struct[1],struct[2]) )
49 entry_dict[struct[1]] = {} 49 entry_dict[struct[2]] = {}
50 entry_dict[struct[1]]['type'] = struct[0] 50 entry_dict[struct[2]]['type_prefix'] = struct[0]
51 entry_dict[struct[1]]['fields'] = {} 51 entry_dict[struct[2]]['type'] = struct[1]
52 for entry in re.findall( field_regex, struct[2] ): 52 entry_dict[struct[2]]['fields'] = {}
53 for entry in re.findall( field_regex, struct[3] ):
53 #print( " entry: %s" % entry ) 54 #print( " entry: %s" % entry )
54 cpuid = re.search( cpuid_regex, entry ) 55 cpuid = re.search( cpuid_regex, entry )
55 if cpuid: 56 if cpuid:
56 #print( " cpuid found: %s" % cpuid.group(1) ) 57 #print( " cpuid found: %s" % cpuid.group(1) )
57 entry_dict[struct[1]]['fields'][cpuid.group(1)] = entry 58 entry_dict[struct[2]]['fields'][cpuid.group(1)] = entry
58 59
59 name = re.search( name_regex, entry ) 60 name = re.search( name_regex, entry )
60 if name: 61 if name:
61 #print( " name found: %s" % name.group(1) ) 62 #print( " name found: %s" % name.group(1) )
62 entry_dict[struct[1]]['fields'][name.group(1)] = entry 63 entry_dict[struct[2]]['fields'][name.group(1)] = entry
63 64
65 if not entry_dict[struct[2]]['fields']:
66 entry_dict[struct[2]]['fields']['0'] = entry
64 67
65# created ordered dictionaries from the captured values. These are ordered by 68# created ordered dictionaries from the captured values. These are ordered by
66# a sorted() iteration of the keys. We don't care about the order we read 69# a sorted() iteration of the keys. We don't care about the order we read
@@ -72,6 +75,7 @@ for struct in re.findall( struct_block_regex, data ):
72entry_dict_sorted = OrderedDict() 75entry_dict_sorted = OrderedDict()
73for i in sorted(entry_dict.keys()): 76for i in sorted(entry_dict.keys()):
74 entry_dict_sorted[i] = {} 77 entry_dict_sorted[i] = {}
78 entry_dict_sorted[i]['type_prefix'] = entry_dict[i]['type_prefix']
75 entry_dict_sorted[i]['type'] = entry_dict[i]['type'] 79 entry_dict_sorted[i]['type'] = entry_dict[i]['type']
76 entry_dict_sorted[i]['fields'] = {} 80 entry_dict_sorted[i]['fields'] = {}
77 for f in sorted(entry_dict[i]['fields'].keys()): 81 for f in sorted(entry_dict[i]['fields'].keys()):
@@ -83,7 +87,7 @@ outf = open( outfile, 'w' )
83print( preamble.group(1) ) 87print( preamble.group(1) )
84outf.write( preamble.group(1) ) 88outf.write( preamble.group(1) )
85for d in entry_dict_sorted: 89for d in entry_dict_sorted:
86 outf.write( "struct %s %s[] = {\n" % (entry_dict_sorted[d]['type'],d) ) 90 outf.write( "%s %s %s[] = {\n" % (entry_dict_sorted[d]['type_prefix'], entry_dict_sorted[d]['type'],d) )
87 for f in entry_dict_sorted[d]['fields']: 91 for f in entry_dict_sorted[d]['fields']:
88 outf.write( entry_dict_sorted[d]['fields'][f] + '\n' ) 92 outf.write( entry_dict_sorted[d]['fields'][f] + '\n' )
89 93
diff --git a/meta/recipes-kernel/wireless-regdb/wireless-regdb_2021.08.28.bb b/meta/recipes-kernel/wireless-regdb/wireless-regdb_2022.04.08.bb
index c673f8044c..cd42039680 100644
--- a/meta/recipes-kernel/wireless-regdb/wireless-regdb_2021.08.28.bb
+++ b/meta/recipes-kernel/wireless-regdb/wireless-regdb_2022.04.08.bb
@@ -5,7 +5,7 @@ LICENSE = "ISC"
5LIC_FILES_CHKSUM = "file://LICENSE;md5=07c4f6dea3845b02a18dc00c8c87699c" 5LIC_FILES_CHKSUM = "file://LICENSE;md5=07c4f6dea3845b02a18dc00c8c87699c"
6 6
7SRC_URI = "https://www.kernel.org/pub/software/network/${BPN}/${BP}.tar.xz" 7SRC_URI = "https://www.kernel.org/pub/software/network/${BPN}/${BP}.tar.xz"
8SRC_URI[sha256sum] = "cff370c410d1e6d316ae0a7fa8ac6278fdf1efca5d3d664aca7cfd2aafa54446" 8SRC_URI[sha256sum] = "884ba2e3c1e8b98762b6dc25ff60b5ec75c8d33a39e019b3ed4aa615491460d3"
9 9
10inherit bin_package allarch 10inherit bin_package allarch
11 11
diff --git a/meta/recipes-multimedia/alsa/alsa-tools_1.2.5.bb b/meta/recipes-multimedia/alsa/alsa-tools_1.2.5.bb
index 540f4f79f4..e6fe83a186 100644
--- a/meta/recipes-multimedia/alsa/alsa-tools_1.2.5.bb
+++ b/meta/recipes-multimedia/alsa/alsa-tools_1.2.5.bb
@@ -71,6 +71,7 @@ python do_compile() {
71} 71}
72 72
73python do_install() { 73python do_install() {
74 d.delVarFlag("autotools_do_install", "cleandirs")
74 for subdir in d.getVar("PACKAGECONFIG").split(): 75 for subdir in d.getVar("PACKAGECONFIG").split():
75 subdir = subdir.replace("--", "/") 76 subdir = subdir.replace("--", "/")
76 bb.note("Installing %s" % subdir) 77 bb.note("Installing %s" % subdir)
diff --git a/meta/recipes-multimedia/gstreamer/gst-devtools_1.18.5.bb b/meta/recipes-multimedia/gstreamer/gst-devtools_1.18.6.bb
index 1b46b89cb9..4f4ded8d24 100644
--- a/meta/recipes-multimedia/gstreamer/gst-devtools_1.18.5.bb
+++ b/meta/recipes-multimedia/gstreamer/gst-devtools_1.18.6.bb
@@ -12,7 +12,7 @@ SRC_URI = "https://gstreamer.freedesktop.org/src/gst-devtools/gst-devtools-${PV}
12 file://0001-connect-has-a-different-signature-on-musl.patch \ 12 file://0001-connect-has-a-different-signature-on-musl.patch \
13 " 13 "
14 14
15SRC_URI[sha256sum] = "fecffc86447daf5c2a06843c757a991d745caa2069446a0d746e99b13f7cb079" 15SRC_URI[sha256sum] = "3725622c740a635452e54b79d065f963ab7706ca2403de6c43072ae7610a0de4"
16 16
17DEPENDS = "json-glib glib-2.0 glib-2.0-native gstreamer1.0 gstreamer1.0-plugins-base" 17DEPENDS = "json-glib glib-2.0 glib-2.0-native gstreamer1.0 gstreamer1.0-plugins-base"
18RRECOMMENDS:${PN} = "git" 18RRECOMMENDS:${PN} = "git"
diff --git a/meta/recipes-multimedia/gstreamer/gst-examples_1.18.5.bb b/meta/recipes-multimedia/gstreamer/gst-examples_1.18.6.bb
index a720bb73ff..2a7a3c3111 100644
--- a/meta/recipes-multimedia/gstreamer/gst-examples_1.18.5.bb
+++ b/meta/recipes-multimedia/gstreamer/gst-examples_1.18.6.bb
@@ -12,7 +12,7 @@ SRC_URI = "git://gitlab.freedesktop.org/gstreamer/gst-examples.git;protocol=http
12 file://gst-player.desktop \ 12 file://gst-player.desktop \
13 " 13 "
14 14
15SRCREV = "fe9a365dc0f1ff632abcfe3322ac5527a2cf30a0" 15SRCREV = "70e4fcf4fc8ae19641aa990de5f37d758cdfcea4"
16 16
17S = "${WORKDIR}/git" 17S = "${WORKDIR}/git"
18 18
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.18.5.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.18.6.bb
index a77ec62759..d46342285d 100644
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.18.5.bb
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.18.6.bb
@@ -12,7 +12,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=6762ed442b3822387a51c92d928ead0d \
12 " 12 "
13 13
14SRC_URI = "https://gstreamer.freedesktop.org/src/gst-libav/gst-libav-${PV}.tar.xz" 14SRC_URI = "https://gstreamer.freedesktop.org/src/gst-libav/gst-libav-${PV}.tar.xz"
15SRC_URI[sha256sum] = "822e008a910e9dd13aedbdd8dc63fedef4040c0ee2e927bab3112e9de693a548" 15SRC_URI[sha256sum] = "e4e50dcd5a29441ae34de60d2221057e8064ed824bb6ca4dc0fd9ee88fbe9b81"
16 16
17S = "${WORKDIR}/gst-libav-${PV}" 17S = "${WORKDIR}/gst-libav-${PV}"
18 18
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.18.5.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.18.6.bb
index b2c1eb3ea0..a220d677aa 100644
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.18.5.bb
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.18.6.bb
@@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c \
10 10
11SRC_URI = "https://gstreamer.freedesktop.org/src/gst-omx/gst-omx-${PV}.tar.xz" 11SRC_URI = "https://gstreamer.freedesktop.org/src/gst-omx/gst-omx-${PV}.tar.xz"
12 12
13SRC_URI[sha256sum] = "2cd457c1e8deb1a9b39608048fb36a44f6c9a864a6b6115b1453a32e7be93b42" 13SRC_URI[sha256sum] = "b5281c938e959fd2418e989cfb6065fdd9fe5f6f87ee86236c9427166e708163"
14 14
15S = "${WORKDIR}/gst-omx-${PV}" 15S = "${WORKDIR}/gst-omx-${PV}"
16 16
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.18.5.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.18.6.bb
index 6209a62712..df148c0aff 100644
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.18.5.bb
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.18.6.bb
@@ -11,7 +11,7 @@ SRC_URI = "https://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad
11 file://0004-opencv-resolve-missing-opencv-data-dir-in-yocto-buil.patch \ 11 file://0004-opencv-resolve-missing-opencv-data-dir-in-yocto-buil.patch \
12 file://0005-msdk-fix-includedir-path.patch \ 12 file://0005-msdk-fix-includedir-path.patch \
13 " 13 "
14SRC_URI[sha256sum] = "a164923b94f0d08578a6fcaeaac6e0c05da788a46903a1086870e9ca45ad678e" 14SRC_URI[sha256sum] = "0b1b50ac6311f0c510248b6cd64d6d3c94369344828baa602db85ded5bc70ec9"
15 15
16S = "${WORKDIR}/gst-plugins-bad-${PV}" 16S = "${WORKDIR}/gst-plugins-bad-${PV}"
17 17
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.18.5.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.18.6.bb
index 5e2cca3864..e20145ea8d 100644
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.18.5.bb
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.18.6.bb
@@ -12,7 +12,7 @@ SRC_URI = "https://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-ba
12 file://0002-ssaparse-enhance-SSA-text-lines-parsing.patch \ 12 file://0002-ssaparse-enhance-SSA-text-lines-parsing.patch \
13 file://0004-glimagesink-Downrank-to-marginal.patch \ 13 file://0004-glimagesink-Downrank-to-marginal.patch \
14 " 14 "
15SRC_URI[sha256sum] = "960b7af4585700db0fdd5b843554e11e2564fed9e061f591fae88a7be6446fa3" 15SRC_URI[sha256sum] = "56a9ff2fe9e6603b9e658cf6897d412a173d2180829fe01e92568549c6bd0f5b"
16 16
17S = "${WORKDIR}/gst-plugins-base-${PV}" 17S = "${WORKDIR}/gst-plugins-base-${PV}"
18 18
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.18.5.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.18.6.bb
index ade935df9e..a43b8095c5 100644
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.18.5.bb
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.18.6.bb
@@ -8,7 +8,7 @@ SRC_URI = "https://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-go
8 file://0001-qt-include-ext-qt-gstqtgl.h-instead-of-gst-gl-gstglf.patch \ 8 file://0001-qt-include-ext-qt-gstqtgl.h-instead-of-gst-gl-gstglf.patch \
9 " 9 "
10 10
11SRC_URI[sha256sum] = "3aaeeea7765fbf8801acce4a503a9b05f73f04e8a35352e9d00232cfd555796b" 11SRC_URI[sha256sum] = "26723ac01fcb360ade1f41d168c7c322d8af4ceb7e55c8c12ed2690d06a76eed"
12 12
13S = "${WORKDIR}/gst-plugins-good-${PV}" 13S = "${WORKDIR}/gst-plugins-good-${PV}"
14 14
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.18.5.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.18.6.bb
index 9777aaee19..5b31627141 100644
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.18.5.bb
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.18.6.bb
@@ -13,7 +13,7 @@ LICENSE_FLAGS = "commercial"
13SRC_URI = " \ 13SRC_URI = " \
14 https://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-${PV}.tar.xz \ 14 https://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-${PV}.tar.xz \
15 " 15 "
16SRC_URI[sha256sum] = "df32803e98f8a9979373fa2ca7e05e62f977b1097576d3a80619d9f5c69f66d9" 16SRC_URI[sha256sum] = "4969c409cb6a88317d2108b8577108e18623b2333d7b587ae3f39459c70e3a7f"
17 17
18S = "${WORKDIR}/gst-plugins-ugly-${PV}" 18S = "${WORKDIR}/gst-plugins-ugly-${PV}"
19 19
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.18.5.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.18.6.bb
index 74dd15b3eb..c80c3928eb 100644
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.18.5.bb
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.18.6.bb
@@ -8,7 +8,7 @@ LICENSE = "LGPLv2.1"
8LIC_FILES_CHKSUM = "file://COPYING;md5=c34deae4e395ca07e725ab0076a5f740" 8LIC_FILES_CHKSUM = "file://COPYING;md5=c34deae4e395ca07e725ab0076a5f740"
9 9
10SRC_URI = "https://gstreamer.freedesktop.org/src/${PNREAL}/${PNREAL}-${PV}.tar.xz" 10SRC_URI = "https://gstreamer.freedesktop.org/src/${PNREAL}/${PNREAL}-${PV}.tar.xz"
11SRC_URI[sha256sum] = "533685871305959d6db89507f3b3aa6c765c2f2b0dacdc32c5a6543e72e5bc52" 11SRC_URI[sha256sum] = "bdc0ea22fbd7335ad9decc151561aacc53c51206a9735b81eac700ce5b0bbd4a"
12 12
13DEPENDS = "gstreamer1.0 gstreamer1.0-plugins-base python3-pygobject" 13DEPENDS = "gstreamer1.0 gstreamer1.0-plugins-base python3-pygobject"
14RDEPENDS:${PN} += "gstreamer1.0 gstreamer1.0-plugins-base python3-pygobject" 14RDEPENDS:${PN} += "gstreamer1.0 gstreamer1.0-plugins-base python3-pygobject"
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.18.5.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.18.6.bb
index 50426ad46d..f105713f33 100644
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.18.5.bb
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.18.6.bb
@@ -10,7 +10,7 @@ PNREAL = "gst-rtsp-server"
10 10
11SRC_URI = "https://gstreamer.freedesktop.org/src/${PNREAL}/${PNREAL}-${PV}.tar.xz" 11SRC_URI = "https://gstreamer.freedesktop.org/src/${PNREAL}/${PNREAL}-${PV}.tar.xz"
12 12
13SRC_URI[sha256sum] = "04d63bf48816c6f41c73f6de0f912a7cef0aab39c44162a7bcece1923dfc9d1f" 13SRC_URI[sha256sum] = "826f32afbcf94b823541efcac4a0dacdb62f6145ef58f363095749f440262be9"
14 14
15S = "${WORKDIR}/${PNREAL}-${PV}" 15S = "${WORKDIR}/${PNREAL}-${PV}"
16 16
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi_1.18.5.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi_1.18.6.bb
index 9a68a3fadf..f3255e5554 100644
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi_1.18.5.bb
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi_1.18.6.bb
@@ -11,7 +11,7 @@ LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c"
11 11
12SRC_URI = "https://gstreamer.freedesktop.org/src/${REALPN}/${REALPN}-${PV}.tar.xz" 12SRC_URI = "https://gstreamer.freedesktop.org/src/${REALPN}/${REALPN}-${PV}.tar.xz"
13 13
14SRC_URI[sha256sum] = "4a460fb95559f41444eb24864ad2d9e37922b6eea941510310319fc3e0ba727b" 14SRC_URI[sha256sum] = "ab6270f1e5e4546fbe6f5ea246d86ca3d196282eb863d46e6cdcc96f867449e0"
15 15
16S = "${WORKDIR}/${REALPN}-${PV}" 16S = "${WORKDIR}/${REALPN}-${PV}"
17DEPENDS = "libva gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-bad" 17DEPENDS = "libva gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-bad"
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.18.5.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.18.6.bb
index 0d82dd338c..4bf89ed109 100644
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.18.5.bb
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.18.6.bb
@@ -25,7 +25,7 @@ SRC_URI = "https://gstreamer.freedesktop.org/src/gstreamer/gstreamer-${PV}.tar.x
25 file://0006-tests-use-a-dictionaries-for-environment.patch \ 25 file://0006-tests-use-a-dictionaries-for-environment.patch \
26 file://0007-tests-install-the-environment-for-installed_tests.patch \ 26 file://0007-tests-install-the-environment-for-installed_tests.patch \
27 " 27 "
28SRC_URI[sha256sum] = "55862232a63459bbf56abebde3085ca9aec211b478e891dacea4d6df8cafe80a" 28SRC_URI[sha256sum] = "4ec816010dd4d3a93cf470ad0a6f25315f52b204eb1d71dfa70ab8a1c3bd06e6"
29 29
30PACKAGECONFIG ??= "${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)} \ 30PACKAGECONFIG ??= "${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)} \
31 check \ 31 check \
diff --git a/meta/recipes-multimedia/libsndfile/libsndfile1/CVE-2021-4156.patch b/meta/recipes-multimedia/libsndfile/libsndfile1/CVE-2021-4156.patch
new file mode 100644
index 0000000000..b0ff1a0885
--- /dev/null
+++ b/meta/recipes-multimedia/libsndfile/libsndfile1/CVE-2021-4156.patch
@@ -0,0 +1,32 @@
1From 5adbc377cd90aa40f0cd56ae325ca70065a8aa19 Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Thu, 13 Jan 2022 16:45:59 +0800
4Subject: [PATCH] flac: Fix improper buffer reusing
5
6CVE: CVE-2021-4156.patch
7Upstream-Status: Backport [https://github.com/libsndfile/libsndfile/issues/731]
8
9Signed-off-by: Changqing Li <changqing.li@windriver.com>
10---
11 src/flac.c | 4 ++++
12 1 file changed, 4 insertions(+)
13
14diff --git a/src/flac.c b/src/flac.c
15index 0be82ac..6548bba 100644
16--- a/src/flac.c
17+++ b/src/flac.c
18@@ -952,7 +952,11 @@ flac_read_loop (SF_PRIVATE *psf, unsigned len)
19 /* Decode some more. */
20 while (pflac->pos < pflac->len)
21 { if (FLAC__stream_decoder_process_single (pflac->fsd) == 0)
22+ { psf_log_printf (psf, "FLAC__stream_decoder_process_single returned false\n") ;
23+ /* Current frame is busted, so NULL the pointer. */
24+ pflac->frame = NULL ;
25 break ;
26+ }
27 state = FLAC__stream_decoder_get_state (pflac->fsd) ;
28 if (state >= FLAC__STREAM_DECODER_END_OF_STREAM)
29 { psf_log_printf (psf, "FLAC__stream_decoder_get_state returned %s\n", FLAC__StreamDecoderStateString [state]) ;
30--
312.17.1
32
diff --git a/meta/recipes-multimedia/libsndfile/libsndfile1_1.0.28.bb b/meta/recipes-multimedia/libsndfile/libsndfile1_1.0.28.bb
index 443ca95e32..884d680fbe 100644
--- a/meta/recipes-multimedia/libsndfile/libsndfile1_1.0.28.bb
+++ b/meta/recipes-multimedia/libsndfile/libsndfile1_1.0.28.bb
@@ -20,6 +20,7 @@ SRC_URI = "http://www.mega-nerd.com/libsndfile/files/libsndfile-${PV}.tar.gz \
20 file://CVE-2017-12562.patch \ 20 file://CVE-2017-12562.patch \
21 file://CVE-2018-19758.patch \ 21 file://CVE-2018-19758.patch \
22 file://CVE-2019-3832.patch \ 22 file://CVE-2019-3832.patch \
23 file://CVE-2021-4156.patch \
23 " 24 "
24 25
25SRC_URI[md5sum] = "646b5f98ce89ac60cdb060fcd398247c" 26SRC_URI[md5sum] = "646b5f98ce89ac60cdb060fcd398247c"
diff --git a/meta/recipes-multimedia/libtiff/tiff/0001-tif_jbig.c-fix-crash-when-reading-a-file-with-multip.patch b/meta/recipes-multimedia/libtiff/tiff/0001-tif_jbig.c-fix-crash-when-reading-a-file-with-multip.patch
new file mode 100644
index 0000000000..f1a4ab4251
--- /dev/null
+++ b/meta/recipes-multimedia/libtiff/tiff/0001-tif_jbig.c-fix-crash-when-reading-a-file-with-multip.patch
@@ -0,0 +1,38 @@
1CVE: CVE-2022-0865
2Upstream-Status: Backport
3Signed-off-by: Ross Burton <ross.burton@arm.com>
4
5From 88da11ae3c4db527cb870fb1017456cc8fbac2e7 Mon Sep 17 00:00:00 2001
6From: Even Rouault <even.rouault@spatialys.com>
7Date: Thu, 24 Feb 2022 22:26:02 +0100
8Subject: [PATCH 1/6] tif_jbig.c: fix crash when reading a file with multiple
9 IFD in memory-mapped mode and when bit reversal is needed (fixes #385)
10
11---
12 libtiff/tif_jbig.c | 10 ++++++++++
13 1 file changed, 10 insertions(+)
14
15diff --git a/libtiff/tif_jbig.c b/libtiff/tif_jbig.c
16index 74086338..8bfa4cef 100644
17--- a/libtiff/tif_jbig.c
18+++ b/libtiff/tif_jbig.c
19@@ -209,6 +209,16 @@ int TIFFInitJBIG(TIFF* tif, int scheme)
20 */
21 tif->tif_flags |= TIFF_NOBITREV;
22 tif->tif_flags &= ~TIFF_MAPPED;
23+ /* We may have read from a previous IFD and thus set TIFF_BUFFERMMAP and
24+ * cleared TIFF_MYBUFFER. It is necessary to restore them to their initial
25+ * value to be consistent with the state of a non-memory mapped file.
26+ */
27+ if (tif->tif_flags&TIFF_BUFFERMMAP) {
28+ tif->tif_rawdata = NULL;
29+ tif->tif_rawdatasize = 0;
30+ tif->tif_flags &= ~TIFF_BUFFERMMAP;
31+ tif->tif_flags |= TIFF_MYBUFFER;
32+ }
33
34 /* Setup the function pointers for encode, decode, and cleanup. */
35 tif->tif_setupdecode = JBIGSetupDecode;
36--
372.25.1
38
diff --git a/meta/recipes-multimedia/libtiff/tiff/0001-tiffset-fix-global-buffer-overflow-for-ASCII-tags-wh.patch b/meta/recipes-multimedia/libtiff/tiff/0001-tiffset-fix-global-buffer-overflow-for-ASCII-tags-wh.patch
new file mode 100644
index 0000000000..72776f09ba
--- /dev/null
+++ b/meta/recipes-multimedia/libtiff/tiff/0001-tiffset-fix-global-buffer-overflow-for-ASCII-tags-wh.patch
@@ -0,0 +1,43 @@
1CVE: CVE-2022-22844
2Upstream-Status: Backport
3Signed-off-by: Ross Burton <ross.burton@arm.com>
4
5From b12a0326e6064b6e0b051d1184a219877472f69b Mon Sep 17 00:00:00 2001
6From: 4ugustus <wangdw.augustus@qq.com>
7Date: Tue, 25 Jan 2022 16:25:28 +0000
8Subject: [PATCH] tiffset: fix global-buffer-overflow for ASCII tags where
9 count is required (fixes #355)
10
11---
12 tools/tiffset.c | 16 +++++++++++++---
13 1 file changed, 13 insertions(+), 3 deletions(-)
14
15diff --git a/tools/tiffset.c b/tools/tiffset.c
16index 8c9e23c5..e7a88c09 100644
17--- a/tools/tiffset.c
18+++ b/tools/tiffset.c
19@@ -146,9 +146,19 @@ main(int argc, char* argv[])
20
21 arg_index++;
22 if (TIFFFieldDataType(fip) == TIFF_ASCII) {
23- if (TIFFSetField(tiff, TIFFFieldTag(fip), argv[arg_index]) != 1)
24- fprintf( stderr, "Failed to set %s=%s\n",
25- TIFFFieldName(fip), argv[arg_index] );
26+ if(TIFFFieldPassCount( fip )) {
27+ size_t len;
28+ len = strlen(argv[arg_index]) + 1;
29+ if (len > UINT16_MAX || TIFFSetField(tiff, TIFFFieldTag(fip),
30+ (uint16_t)len, argv[arg_index]) != 1)
31+ fprintf( stderr, "Failed to set %s=%s\n",
32+ TIFFFieldName(fip), argv[arg_index] );
33+ } else {
34+ if (TIFFSetField(tiff, TIFFFieldTag(fip),
35+ argv[arg_index]) != 1)
36+ fprintf( stderr, "Failed to set %s=%s\n",
37+ TIFFFieldName(fip), argv[arg_index] );
38+ }
39 } else if (TIFFFieldWriteCount(fip) > 0
40 || TIFFFieldWriteCount(fip) == TIFF_VARIABLE) {
41 int ret = 1;
42--
432.25.1
diff --git a/meta/recipes-multimedia/libtiff/tiff/0002-tiffcrop-fix-issue-380-and-382-heap-buffer-overflow-.patch b/meta/recipes-multimedia/libtiff/tiff/0002-tiffcrop-fix-issue-380-and-382-heap-buffer-overflow-.patch
new file mode 100644
index 0000000000..812ffb232d
--- /dev/null
+++ b/meta/recipes-multimedia/libtiff/tiff/0002-tiffcrop-fix-issue-380-and-382-heap-buffer-overflow-.patch
@@ -0,0 +1,219 @@
1CVE: CVE-2022-0891
2CVE: CVE-2022-1056
3Upstream-Status: Backport
4Signed-off-by: Ross Burton <ross.burton@arm.com>
5
6From e46b49e60fddb2e924302fb1751f79eb9cfb2253 Mon Sep 17 00:00:00 2001
7From: Su Laus <sulau@freenet.de>
8Date: Tue, 8 Mar 2022 17:02:44 +0000
9Subject: [PATCH 2/6] tiffcrop: fix issue #380 and #382 heap buffer overflow in
10 extractImageSection
11
12---
13 tools/tiffcrop.c | 92 +++++++++++++++++++-----------------------------
14 1 file changed, 36 insertions(+), 56 deletions(-)
15
16diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
17index b85c2ce7..302a7e91 100644
18--- a/tools/tiffcrop.c
19+++ b/tools/tiffcrop.c
20@@ -105,8 +105,8 @@
21 * of messages to monitor progress without enabling dump logs.
22 */
23
24-static char tiffcrop_version_id[] = "2.4";
25-static char tiffcrop_rev_date[] = "12-13-2010";
26+static char tiffcrop_version_id[] = "2.4.1";
27+static char tiffcrop_rev_date[] = "03-03-2010";
28
29 #include "tif_config.h"
30 #include "libport.h"
31@@ -6710,10 +6710,10 @@ extractImageSection(struct image_data *image, struct pageseg *section,
32 #ifdef DEVELMODE
33 uint32_t img_length;
34 #endif
35- uint32_t j, shift1, shift2, trailing_bits;
36+ uint32_t j, shift1, trailing_bits;
37 uint32_t row, first_row, last_row, first_col, last_col;
38 uint32_t src_offset, dst_offset, row_offset, col_offset;
39- uint32_t offset1, offset2, full_bytes;
40+ uint32_t offset1, full_bytes;
41 uint32_t sect_width;
42 #ifdef DEVELMODE
43 uint32_t sect_length;
44@@ -6723,7 +6723,6 @@ extractImageSection(struct image_data *image, struct pageseg *section,
45 #ifdef DEVELMODE
46 int k;
47 unsigned char bitset;
48- static char *bitarray = NULL;
49 #endif
50
51 img_width = image->width;
52@@ -6741,17 +6740,12 @@ extractImageSection(struct image_data *image, struct pageseg *section,
53 dst_offset = 0;
54
55 #ifdef DEVELMODE
56- if (bitarray == NULL)
57- {
58- if ((bitarray = (char *)malloc(img_width)) == NULL)
59- {
60- TIFFError ("", "DEBUG: Unable to allocate debugging bitarray");
61- return (-1);
62- }
63- }
64+ char bitarray[39];
65 #endif
66
67- /* rows, columns, width, length are expressed in pixels */
68+ /* rows, columns, width, length are expressed in pixels
69+ * first_row, last_row, .. are index into image array starting at 0 to width-1,
70+ * last_col shall be also extracted. */
71 first_row = section->y1;
72 last_row = section->y2;
73 first_col = section->x1;
74@@ -6761,9 +6755,14 @@ extractImageSection(struct image_data *image, struct pageseg *section,
75 #ifdef DEVELMODE
76 sect_length = last_row - first_row + 1;
77 #endif
78- img_rowsize = ((img_width * bps + 7) / 8) * spp;
79- full_bytes = (sect_width * spp * bps) / 8; /* number of COMPLETE bytes per row in section */
80- trailing_bits = (sect_width * bps) % 8;
81+ /* The read function loadImage() used copy separate plane data into a buffer as interleaved
82+ * samples rather than separate planes so the same logic works to extract regions
83+ * regardless of the way the data are organized in the input file.
84+ * Furthermore, bytes and bits are arranged in buffer according to COMPRESSION=1 and FILLORDER=1
85+ */
86+ img_rowsize = (((img_width * spp * bps) + 7) / 8); /* row size in full bytes of source image */
87+ full_bytes = (sect_width * spp * bps) / 8; /* number of COMPLETE bytes per row in section */
88+ trailing_bits = (sect_width * spp * bps) % 8; /* trailing bits within the last byte of destination buffer */
89
90 #ifdef DEVELMODE
91 TIFFError ("", "First row: %"PRIu32", last row: %"PRIu32", First col: %"PRIu32", last col: %"PRIu32"\n",
92@@ -6776,10 +6775,9 @@ extractImageSection(struct image_data *image, struct pageseg *section,
93
94 if ((bps % 8) == 0)
95 {
96- col_offset = first_col * spp * bps / 8;
97+ col_offset = (first_col * spp * bps) / 8;
98 for (row = first_row; row <= last_row; row++)
99 {
100- /* row_offset = row * img_width * spp * bps / 8; */
101 row_offset = row * img_rowsize;
102 src_offset = row_offset + col_offset;
103
104@@ -6792,14 +6790,12 @@ extractImageSection(struct image_data *image, struct pageseg *section,
105 }
106 else
107 { /* bps != 8 */
108- shift1 = spp * ((first_col * bps) % 8);
109- shift2 = spp * ((last_col * bps) % 8);
110+ shift1 = ((first_col * spp * bps) % 8); /* shift1 = bits to skip in the first byte of source buffer*/
111 for (row = first_row; row <= last_row; row++)
112 {
113 /* pull out the first byte */
114 row_offset = row * img_rowsize;
115- offset1 = row_offset + (first_col * bps / 8);
116- offset2 = row_offset + (last_col * bps / 8);
117+ offset1 = row_offset + ((first_col * spp * bps) / 8); /* offset1 = offset into source of byte with first bits to be extracted */
118
119 #ifdef DEVELMODE
120 for (j = 0, k = 7; j < 8; j++, k--)
121@@ -6811,12 +6807,12 @@ extractImageSection(struct image_data *image, struct pageseg *section,
122 sprintf(&bitarray[9], " ");
123 for (j = 10, k = 7; j < 18; j++, k--)
124 {
125- bitset = *(src_buff + offset2) & (((unsigned char)1 << k)) ? 1 : 0;
126+ bitset = *(src_buff + offset1 + full_bytes) & (((unsigned char)1 << k)) ? 1 : 0;
127 sprintf(&bitarray[j], (bitset) ? "1" : "0");
128 }
129 bitarray[18] = '\0';
130- TIFFError ("", "Row: %3d Offset1: %"PRIu32", Shift1: %"PRIu32", Offset2: %"PRIu32", Shift2: %"PRIu32"\n",
131- row, offset1, shift1, offset2, shift2);
132+ TIFFError ("", "Row: %3d Offset1: %"PRIu32", Shift1: %"PRIu32", Offset2: %"PRIu32", Trailing_bits: %"PRIu32"\n",
133+ row, offset1, shift1, offset1+full_bytes, trailing_bits);
134 #endif
135
136 bytebuff1 = bytebuff2 = 0;
137@@ -6840,11 +6836,12 @@ extractImageSection(struct image_data *image, struct pageseg *section,
138
139 if (trailing_bits != 0)
140 {
141- bytebuff2 = src_buff[offset2] & ((unsigned char)255 << (7 - shift2));
142+ /* Only copy higher bits of samples and mask lower bits of not wanted column samples to zero */
143+ bytebuff2 = src_buff[offset1 + full_bytes] & ((unsigned char)255 << (8 - trailing_bits));
144 sect_buff[dst_offset] = bytebuff2;
145 #ifdef DEVELMODE
146 TIFFError ("", " Trailing bits src offset: %8"PRIu32", Dst offset: %8"PRIu32"\n",
147- offset2, dst_offset);
148+ offset1 + full_bytes, dst_offset);
149 for (j = 30, k = 7; j < 38; j++, k--)
150 {
151 bitset = *(sect_buff + dst_offset) & (((unsigned char)1 << k)) ? 1 : 0;
152@@ -6863,8 +6860,10 @@ extractImageSection(struct image_data *image, struct pageseg *section,
153 #endif
154 for (j = 0; j <= full_bytes; j++)
155 {
156- bytebuff1 = src_buff[offset1 + j] & ((unsigned char)255 >> shift1);
157- bytebuff2 = src_buff[offset1 + j + 1] & ((unsigned char)255 << (7 - shift1));
158+ /* Skip the first shift1 bits and shift the source up by shift1 bits before save to destination.*/
159+ /* Attention: src_buff size needs to be some bytes larger than image size, because could read behind image here. */
160+ bytebuff1 = src_buff[offset1 + j] & ((unsigned char)255 >> shift1);
161+ bytebuff2 = src_buff[offset1 + j + 1] & ((unsigned char)255 << (8 - shift1));
162 sect_buff[dst_offset + j] = (bytebuff1 << shift1) | (bytebuff2 >> (8 - shift1));
163 }
164 #ifdef DEVELMODE
165@@ -6880,36 +6879,17 @@ extractImageSection(struct image_data *image, struct pageseg *section,
166 #endif
167 dst_offset += full_bytes;
168
169+ /* Copy the trailing_bits for the last byte in the destination buffer.
170+ Could come from one ore two bytes of the source buffer. */
171 if (trailing_bits != 0)
172 {
173 #ifdef DEVELMODE
174- TIFFError ("", " Trailing bits src offset: %8"PRIu32", Dst offset: %8"PRIu32"\n", offset1 + full_bytes, dst_offset);
175-#endif
176- if (shift2 > shift1)
177- {
178- bytebuff1 = src_buff[offset1 + full_bytes] & ((unsigned char)255 << (7 - shift2));
179- bytebuff2 = bytebuff1 & ((unsigned char)255 << shift1);
180- sect_buff[dst_offset] = bytebuff2;
181-#ifdef DEVELMODE
182- TIFFError ("", " Shift2 > Shift1\n");
183+ TIFFError("", " Trailing bits %4"PRIu32" src offset: %8"PRIu32", Dst offset: %8"PRIu32"\n", trailing_bits, offset1 + full_bytes, dst_offset);
184 #endif
185+ /* More than necessary bits are already copied into last destination buffer,
186+ * only masking of last byte in destination buffer is necessary.*/
187+ sect_buff[dst_offset] &= ((uint8_t)0xFF << (8 - trailing_bits));
188 }
189- else
190- {
191- if (shift2 < shift1)
192- {
193- bytebuff2 = ((unsigned char)255 << (shift1 - shift2 - 1));
194- sect_buff[dst_offset] &= bytebuff2;
195-#ifdef DEVELMODE
196- TIFFError ("", " Shift2 < Shift1\n");
197-#endif
198- }
199-#ifdef DEVELMODE
200- else
201- TIFFError ("", " Shift2 == Shift1\n");
202-#endif
203- }
204- }
205 #ifdef DEVELMODE
206 sprintf(&bitarray[28], " ");
207 sprintf(&bitarray[29], " ");
208@@ -7062,7 +7042,7 @@ writeImageSections(TIFF *in, TIFF *out, struct image_data *image,
209 width = sections[i].x2 - sections[i].x1 + 1;
210 length = sections[i].y2 - sections[i].y1 + 1;
211 sectsize = (uint32_t)
212- ceil((width * image->bps + 7) / (double)8) * image->spp * length;
213+ ceil((width * image->bps * image->spp + 7) / (double)8) * length;
214 /* allocate a buffer if we don't have one already */
215 if (createImageSection(sectsize, sect_buff_ptr))
216 {
217--
2182.25.1
219
diff --git a/meta/recipes-multimedia/libtiff/tiff/0003-add-checks-for-return-value-of-limitMalloc-392.patch b/meta/recipes-multimedia/libtiff/tiff/0003-add-checks-for-return-value-of-limitMalloc-392.patch
new file mode 100644
index 0000000000..a0b856b9e1
--- /dev/null
+++ b/meta/recipes-multimedia/libtiff/tiff/0003-add-checks-for-return-value-of-limitMalloc-392.patch
@@ -0,0 +1,93 @@
1CVE: CVE-2022-0907
2Upstream-Status: Backport
3Signed-off-by: Ross Burton <ross.burton@arm.com>
4
5From a139191cc86f4dc44c74a0f22928e0fb38ed2485 Mon Sep 17 00:00:00 2001
6From: Augustus <wangdw.augustus@qq.com>
7Date: Mon, 7 Mar 2022 18:21:49 +0800
8Subject: [PATCH 3/6] add checks for return value of limitMalloc (#392)
9
10---
11 tools/tiffcrop.c | 33 +++++++++++++++++++++------------
12 1 file changed, 21 insertions(+), 12 deletions(-)
13
14diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
15index 302a7e91..e407bf51 100644
16--- a/tools/tiffcrop.c
17+++ b/tools/tiffcrop.c
18@@ -7357,7 +7357,11 @@ createImageSection(uint32_t sectsize, unsigned char **sect_buff_ptr)
19 if (!sect_buff)
20 {
21 sect_buff = (unsigned char *)limitMalloc(sectsize);
22- *sect_buff_ptr = sect_buff;
23+ if (!sect_buff)
24+ {
25+ TIFFError("createImageSection", "Unable to allocate/reallocate section buffer");
26+ return (-1);
27+ }
28 _TIFFmemset(sect_buff, 0, sectsize);
29 }
30 else
31@@ -7373,15 +7377,15 @@ createImageSection(uint32_t sectsize, unsigned char **sect_buff_ptr)
32 else
33 sect_buff = new_buff;
34
35+ if (!sect_buff)
36+ {
37+ TIFFError("createImageSection", "Unable to allocate/reallocate section buffer");
38+ return (-1);
39+ }
40 _TIFFmemset(sect_buff, 0, sectsize);
41 }
42 }
43
44- if (!sect_buff)
45- {
46- TIFFError("createImageSection", "Unable to allocate/reallocate section buffer");
47- return (-1);
48- }
49 prev_sectsize = sectsize;
50 *sect_buff_ptr = sect_buff;
51
52@@ -7648,7 +7652,11 @@ createCroppedImage(struct image_data *image, struct crop_mask *crop,
53 if (!crop_buff)
54 {
55 crop_buff = (unsigned char *)limitMalloc(cropsize);
56- *crop_buff_ptr = crop_buff;
57+ if (!crop_buff)
58+ {
59+ TIFFError("createCroppedImage", "Unable to allocate/reallocate crop buffer");
60+ return (-1);
61+ }
62 _TIFFmemset(crop_buff, 0, cropsize);
63 prev_cropsize = cropsize;
64 }
65@@ -7664,15 +7672,15 @@ createCroppedImage(struct image_data *image, struct crop_mask *crop,
66 }
67 else
68 crop_buff = new_buff;
69+ if (!crop_buff)
70+ {
71+ TIFFError("createCroppedImage", "Unable to allocate/reallocate crop buffer");
72+ return (-1);
73+ }
74 _TIFFmemset(crop_buff, 0, cropsize);
75 }
76 }
77
78- if (!crop_buff)
79- {
80- TIFFError("createCroppedImage", "Unable to allocate/reallocate crop buffer");
81- return (-1);
82- }
83 *crop_buff_ptr = crop_buff;
84
85 if (crop->crop_mode & CROP_INVERT)
86@@ -9231,3 +9239,4 @@ invertImage(uint16_t photometric, uint16_t spp, uint16_t bps, uint32_t width, ui
87 * fill-column: 78
88 * End:
89 */
90+
91--
922.25.1
93
diff --git a/meta/recipes-multimedia/libtiff/tiff/0004-TIFFFetchNormalTag-avoid-calling-memcpy-with-a-null-.patch b/meta/recipes-multimedia/libtiff/tiff/0004-TIFFFetchNormalTag-avoid-calling-memcpy-with-a-null-.patch
new file mode 100644
index 0000000000..719dabaecc
--- /dev/null
+++ b/meta/recipes-multimedia/libtiff/tiff/0004-TIFFFetchNormalTag-avoid-calling-memcpy-with-a-null-.patch
@@ -0,0 +1,33 @@
1CVE: CVE-2022-0908
2Upstream-Status: Backport
3Signed-off-by: Ross Burton <ross.burton@arm.com>
4
5From ef5a0bf271823df168642444d051528a68205cb0 Mon Sep 17 00:00:00 2001
6From: Even Rouault <even.rouault@spatialys.com>
7Date: Thu, 17 Feb 2022 15:28:43 +0100
8Subject: [PATCH 4/6] TIFFFetchNormalTag(): avoid calling memcpy() with a null
9 source pointer and size of zero (fixes #383)
10
11---
12 libtiff/tif_dirread.c | 5 ++++-
13 1 file changed, 4 insertions(+), 1 deletion(-)
14
15diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c
16index d84147a0..4e8ce729 100644
17--- a/libtiff/tif_dirread.c
18+++ b/libtiff/tif_dirread.c
19@@ -5079,7 +5079,10 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
20 _TIFFfree(data);
21 return(0);
22 }
23- _TIFFmemcpy(o,data,(uint32_t)dp->tdir_count);
24+ if (dp->tdir_count > 0 )
25+ {
26+ _TIFFmemcpy(o,data,(uint32_t)dp->tdir_count);
27+ }
28 o[(uint32_t)dp->tdir_count]=0;
29 if (data!=0)
30 _TIFFfree(data);
31--
322.25.1
33
diff --git a/meta/recipes-multimedia/libtiff/tiff/0005-fix-the-FPE-in-tiffcrop-393.patch b/meta/recipes-multimedia/libtiff/tiff/0005-fix-the-FPE-in-tiffcrop-393.patch
new file mode 100644
index 0000000000..64dbe9ef92
--- /dev/null
+++ b/meta/recipes-multimedia/libtiff/tiff/0005-fix-the-FPE-in-tiffcrop-393.patch
@@ -0,0 +1,36 @@
1CVE: CVE-2022-0909
2Upstream-Status: Backport
3Signed-off-by: Ross Burton <ross.burton@arm.com>
4
5From 4768355a074d562177e0a8b551c561d1af7eb74a Mon Sep 17 00:00:00 2001
6From: 4ugustus <wangdw.augustus@qq.com>
7Date: Tue, 8 Mar 2022 16:22:04 +0000
8Subject: [PATCH 5/6] fix the FPE in tiffcrop (#393)
9
10---
11 libtiff/tif_dir.c | 4 ++--
12 1 file changed, 2 insertions(+), 2 deletions(-)
13
14diff --git a/libtiff/tif_dir.c b/libtiff/tif_dir.c
15index a6c254fc..77da6ea4 100644
16--- a/libtiff/tif_dir.c
17+++ b/libtiff/tif_dir.c
18@@ -335,13 +335,13 @@ _TIFFVSetField(TIFF* tif, uint32_t tag, va_list ap)
19 break;
20 case TIFFTAG_XRESOLUTION:
21 dblval = va_arg(ap, double);
22- if( dblval < 0 )
23+ if( dblval != dblval || dblval < 0 )
24 goto badvaluedouble;
25 td->td_xresolution = _TIFFClampDoubleToFloat( dblval );
26 break;
27 case TIFFTAG_YRESOLUTION:
28 dblval = va_arg(ap, double);
29- if( dblval < 0 )
30+ if( dblval != dblval || dblval < 0 )
31 goto badvaluedouble;
32 td->td_yresolution = _TIFFClampDoubleToFloat( dblval );
33 break;
34--
352.25.1
36
diff --git a/meta/recipes-multimedia/libtiff/tiff/0006-fix-heap-buffer-overflow-in-tiffcp-278.patch b/meta/recipes-multimedia/libtiff/tiff/0006-fix-heap-buffer-overflow-in-tiffcp-278.patch
new file mode 100644
index 0000000000..afd5e59960
--- /dev/null
+++ b/meta/recipes-multimedia/libtiff/tiff/0006-fix-heap-buffer-overflow-in-tiffcp-278.patch
@@ -0,0 +1,57 @@
1CVE: CVE-2022-0924
2Upstream-Status: Backport
3Signed-off-by: Ross Burton <ross.burton@arm.com>
4
5From 1074b9691322b1e3671cd8ea0b6b3509d08978fb Mon Sep 17 00:00:00 2001
6From: 4ugustus <wangdw.augustus@qq.com>
7Date: Thu, 10 Mar 2022 08:48:00 +0000
8Subject: [PATCH 6/6] fix heap buffer overflow in tiffcp (#278)
9
10---
11 tools/tiffcp.c | 17 ++++++++++++++++-
12 1 file changed, 16 insertions(+), 1 deletion(-)
13
14diff --git a/tools/tiffcp.c b/tools/tiffcp.c
15index 1f889516..552d8fad 100644
16--- a/tools/tiffcp.c
17+++ b/tools/tiffcp.c
18@@ -1661,12 +1661,27 @@ DECLAREwriteFunc(writeBufferToSeparateStrips)
19 tdata_t obuf;
20 tstrip_t strip = 0;
21 tsample_t s;
22+ uint16_t bps = 0, bytes_per_sample;
23
24 obuf = limitMalloc(stripsize);
25 if (obuf == NULL)
26 return (0);
27 _TIFFmemset(obuf, 0, stripsize);
28 (void) TIFFGetFieldDefaulted(out, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
29+ (void) TIFFGetField(out, TIFFTAG_BITSPERSAMPLE, &bps);
30+ if( bps == 0 )
31+ {
32+ TIFFError(TIFFFileName(out), "Error, cannot read BitsPerSample");
33+ _TIFFfree(obuf);
34+ return 0;
35+ }
36+ if( (bps % 8) != 0 )
37+ {
38+ TIFFError(TIFFFileName(out), "Error, cannot handle BitsPerSample that is not a multiple of 8");
39+ _TIFFfree(obuf);
40+ return 0;
41+ }
42+ bytes_per_sample = bps/8;
43 for (s = 0; s < spp; s++) {
44 uint32_t row;
45 for (row = 0; row < imagelength; row += rowsperstrip) {
46@@ -1676,7 +1691,7 @@ DECLAREwriteFunc(writeBufferToSeparateStrips)
47
48 cpContigBufToSeparateBuf(
49 obuf, (uint8_t*) buf + row * rowsize + s,
50- nrows, imagewidth, 0, 0, spp, 1);
51+ nrows, imagewidth, 0, 0, spp, bytes_per_sample);
52 if (TIFFWriteEncodedStrip(out, strip++, obuf, stripsize) < 0) {
53 TIFFError(TIFFFileName(out),
54 "Error, can't write strip %"PRIu32,
55--
562.25.1
57
diff --git a/meta/recipes-multimedia/libtiff/tiff/561599c99f987dc32ae110370cfdd7df7975586b.patch b/meta/recipes-multimedia/libtiff/tiff/561599c99f987dc32ae110370cfdd7df7975586b.patch
new file mode 100644
index 0000000000..0b41dde606
--- /dev/null
+++ b/meta/recipes-multimedia/libtiff/tiff/561599c99f987dc32ae110370cfdd7df7975586b.patch
@@ -0,0 +1,30 @@
1From 561599c99f987dc32ae110370cfdd7df7975586b Mon Sep 17 00:00:00 2001
2From: Even Rouault <even.rouault@spatialys.com>
3Date: Sat, 5 Feb 2022 20:36:41 +0100
4Subject: [PATCH] TIFFReadDirectory(): avoid calling memcpy() with a null
5 source pointer and size of zero (fixes #362)
6
7Upstream-Status: Backport
8CVE: CVE-2022-0562
9
10---
11 libtiff/tif_dirread.c | 3 ++-
12 1 file changed, 2 insertions(+), 1 deletion(-)
13
14diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c
15index 2bbc4585..23194ced 100644
16--- a/libtiff/tif_dirread.c
17+++ b/libtiff/tif_dirread.c
18@@ -4177,7 +4177,8 @@ TIFFReadDirectory(TIFF* tif)
19 goto bad;
20 }
21
22- memcpy(new_sampleinfo, tif->tif_dir.td_sampleinfo, old_extrasamples * sizeof(uint16_t));
23+ if (old_extrasamples > 0)
24+ memcpy(new_sampleinfo, tif->tif_dir.td_sampleinfo, old_extrasamples * sizeof(uint16_t));
25 _TIFFsetShortArray(&tif->tif_dir.td_sampleinfo, new_sampleinfo, tif->tif_dir.td_extrasamples);
26 _TIFFfree(new_sampleinfo);
27 }
28--
29GitLab
30
diff --git a/meta/recipes-multimedia/libtiff/tiff/eecb0712f4c3a5b449f70c57988260a667ddbdef.patch b/meta/recipes-multimedia/libtiff/tiff/eecb0712f4c3a5b449f70c57988260a667ddbdef.patch
new file mode 100644
index 0000000000..74f9649fdf
--- /dev/null
+++ b/meta/recipes-multimedia/libtiff/tiff/eecb0712f4c3a5b449f70c57988260a667ddbdef.patch
@@ -0,0 +1,32 @@
1From eecb0712f4c3a5b449f70c57988260a667ddbdef Mon Sep 17 00:00:00 2001
2From: Even Rouault <even.rouault@spatialys.com>
3Date: Sun, 6 Feb 2022 13:08:38 +0100
4Subject: [PATCH] TIFFFetchStripThing(): avoid calling memcpy() with a null
5 source pointer and size of zero (fixes #362)
6
7Upstream-Status: Backport
8CVE: CVE-2022-0561
9
10---
11 libtiff/tif_dirread.c | 5 +++--
12 1 file changed, 3 insertions(+), 2 deletions(-)
13
14diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c
15index 23194ced..50ebf8ac 100644
16--- a/libtiff/tif_dirread.c
17+++ b/libtiff/tif_dirread.c
18@@ -5777,8 +5777,9 @@ TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, uint32_t nstrips, uint64_t** l
19 _TIFFfree(data);
20 return(0);
21 }
22- _TIFFmemcpy(resizeddata,data, (uint32_t)dir->tdir_count * sizeof(uint64_t));
23- _TIFFmemset(resizeddata+(uint32_t)dir->tdir_count, 0, (nstrips - (uint32_t)dir->tdir_count) * sizeof(uint64_t));
24+ if( dir->tdir_count )
25+ _TIFFmemcpy(resizeddata,data, (uint32_t)dir->tdir_count * sizeof(uint64_t));
26+ _TIFFmemset(resizeddata+(uint32_t)dir->tdir_count, 0, (nstrips - (uint32_t)dir->tdir_count) * sizeof(uint64_t));
27 _TIFFfree(data);
28 data=resizeddata;
29 }
30--
31GitLab
32
diff --git a/meta/recipes-multimedia/libtiff/tiff_4.3.0.bb b/meta/recipes-multimedia/libtiff/tiff_4.3.0.bb
index 6852758c6a..0a82f0d780 100644
--- a/meta/recipes-multimedia/libtiff/tiff_4.3.0.bb
+++ b/meta/recipes-multimedia/libtiff/tiff_4.3.0.bb
@@ -9,7 +9,17 @@ LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=34da3db46fab7501992f9615d7e158cf"
9CVE_PRODUCT = "libtiff" 9CVE_PRODUCT = "libtiff"
10 10
11SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz \ 11SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz \
12 " 12 file://0001-tiffset-fix-global-buffer-overflow-for-ASCII-tags-wh.patch \
13 file://561599c99f987dc32ae110370cfdd7df7975586b.patch \
14 file://eecb0712f4c3a5b449f70c57988260a667ddbdef.patch \
15 file://0001-tif_jbig.c-fix-crash-when-reading-a-file-with-multip.patch \
16 file://0002-tiffcrop-fix-issue-380-and-382-heap-buffer-overflow-.patch \
17 file://0003-add-checks-for-return-value-of-limitMalloc-392.patch \
18 file://0004-TIFFFetchNormalTag-avoid-calling-memcpy-with-a-null-.patch \
19 file://0005-fix-the-FPE-in-tiffcrop-393.patch \
20 file://0006-fix-heap-buffer-overflow-in-tiffcp-278.patch \
21 "
22
13SRC_URI[sha256sum] = "0e46e5acb087ce7d1ac53cf4f56a09b221537fc86dfc5daaad1c2e89e1b37ac8" 23SRC_URI[sha256sum] = "0e46e5acb087ce7d1ac53cf4f56a09b221537fc86dfc5daaad1c2e89e1b37ac8"
14 24
15# exclude betas 25# exclude betas
diff --git a/meta/recipes-multimedia/speex/speex/CVE-2020-23903.patch b/meta/recipes-multimedia/speex/speex/CVE-2020-23903.patch
new file mode 100644
index 0000000000..eb16e95ffc
--- /dev/null
+++ b/meta/recipes-multimedia/speex/speex/CVE-2020-23903.patch
@@ -0,0 +1,30 @@
1Backport patch to fix CVE-2020-23903.
2
3CVE: CVE-2020-23903
4Upstream-Status: Backport [https://github.com/xiph/speex/commit/870ff84]
5
6Signed-off-by: Kai Kang <kai.kang@windriver.com>
7
8From 870ff845b32f314aec0036641ffe18aba4916887 Mon Sep 17 00:00:00 2001
9From: Tristan Matthews <tmatth@videolan.org>
10Date: Mon, 13 Jul 2020 23:25:03 -0400
11Subject: [PATCH] wav_io: guard against invalid channel numbers
12
13Fixes #13
14---
15 src/wav_io.c | 2 +-
16 1 file changed, 1 insertion(+), 1 deletion(-)
17
18diff --git a/src/wav_io.c b/src/wav_io.c
19index b5183015..09d62eb0 100644
20--- a/src/wav_io.c
21+++ b/src/wav_io.c
22@@ -111,7 +111,7 @@ int read_wav_header(FILE *file, int *rate, int *channels, int *format, spx_int32
23 stmp = le_short(stmp);
24 *channels = stmp;
25
26- if (stmp>2)
27+ if (stmp>2 || stmp<1)
28 {
29 fprintf (stderr, "Only mono and (intensity) stereo supported\n");
30 return -1;
diff --git a/meta/recipes-multimedia/speex/speex_1.2.0.bb b/meta/recipes-multimedia/speex/speex_1.2.0.bb
index 3a0911d6f8..ea475f0f1b 100644
--- a/meta/recipes-multimedia/speex/speex_1.2.0.bb
+++ b/meta/recipes-multimedia/speex/speex_1.2.0.bb
@@ -7,7 +7,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=314649d8ba9dd7045dfb6683f298d0a8 \
7 file://include/speex/speex.h;beginline=1;endline=34;md5=ef8c8ea4f7198d71cf3509c6ed05ea50" 7 file://include/speex/speex.h;beginline=1;endline=34;md5=ef8c8ea4f7198d71cf3509c6ed05ea50"
8DEPENDS = "libogg speexdsp" 8DEPENDS = "libogg speexdsp"
9 9
10SRC_URI = "http://downloads.xiph.org/releases/speex/speex-${PV}.tar.gz" 10SRC_URI = "http://downloads.xiph.org/releases/speex/speex-${PV}.tar.gz \
11 file://CVE-2020-23903.patch \
12 "
11UPSTREAM_CHECK_REGEX = "speex-(?P<pver>\d+(\.\d+)+)\.tar" 13UPSTREAM_CHECK_REGEX = "speex-(?P<pver>\d+(\.\d+)+)\.tar"
12 14
13SRC_URI[md5sum] = "8ab7bb2589110dfaf0ed7fa7757dc49c" 15SRC_URI[md5sum] = "8ab7bb2589110dfaf0ed7fa7757dc49c"
diff --git a/meta/recipes-sato/images/core-image-sato-sdk.bb b/meta/recipes-sato/images/core-image-sato-sdk.bb
index b52de0def0..afab473b52 100644
--- a/meta/recipes-sato/images/core-image-sato-sdk.bb
+++ b/meta/recipes-sato/images/core-image-sato-sdk.bb
@@ -10,3 +10,6 @@ IMAGE_FEATURES += "dev-pkgs tools-sdk \
10 10
11IMAGE_INSTALL += "kernel-devsrc" 11IMAGE_INSTALL += "kernel-devsrc"
12 12
13# Compiling stuff, specifically SystemTap probes, can require lots of memory
14# See https://bugzilla.yoctoproject.org/show_bug.cgi?id=14673
15QB_MEM = "-m 768"
diff --git a/meta/recipes-sato/webkit/webkitgtk/0001-Enable-THREADS_PREFER_PTHREAD_FLAG.patch b/meta/recipes-sato/webkit/webkitgtk/0001-Enable-THREADS_PREFER_PTHREAD_FLAG.patch
index 6d7d7067e4..5fc7be8d61 100644
--- a/meta/recipes-sato/webkit/webkitgtk/0001-Enable-THREADS_PREFER_PTHREAD_FLAG.patch
+++ b/meta/recipes-sato/webkit/webkitgtk/0001-Enable-THREADS_PREFER_PTHREAD_FLAG.patch
@@ -24,7 +24,7 @@ index f316f49..de81ce0 100644
24--- a/Source/cmake/OptionsGTK.cmake 24--- a/Source/cmake/OptionsGTK.cmake
25+++ b/Source/cmake/OptionsGTK.cmake 25+++ b/Source/cmake/OptionsGTK.cmake
26@@ -6,6 +6,7 @@ WEBKIT_OPTION_BEGIN() 26@@ -6,6 +6,7 @@ WEBKIT_OPTION_BEGIN()
27 SET_PROJECT_VERSION(2 32 3) 27 SET_PROJECT_VERSION(2 32 4)
28 28
29 set(USER_AGENT_BRANDING "" CACHE STRING "Branding to add to user agent string") 29 set(USER_AGENT_BRANDING "" CACHE STRING "Branding to add to user agent string")
30+set(THREADS_PREFER_PTHREAD_FLAG ON) 30+set(THREADS_PREFER_PTHREAD_FLAG ON)
diff --git a/meta/recipes-sato/webkit/webkitgtk/reproducibility.patch b/meta/recipes-sato/webkit/webkitgtk/reproducibility.patch
new file mode 100644
index 0000000000..e866a1a193
--- /dev/null
+++ b/meta/recipes-sato/webkit/webkitgtk/reproducibility.patch
@@ -0,0 +1,22 @@
1Injection a year based on the current date isn't reproducible. Hack this
2to a specific year for now for reproducibilty and to avoid autobuilder failures.
3
4The correct fix would be to use SOURCE_DATE_EPOCH from the environment and
5then this could be submitted upstream, sadly my ruby isn't up to that.
6
7Upstream-Status: Pending [could be reworked]
8Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
9
10Index: webkitgtk-2.34.2/Source/JavaScriptCore/generator/GeneratedFile.rb
11===================================================================
12--- webkitgtk-2.34.2.orig/Source/JavaScriptCore/generator/GeneratedFile.rb
13+++ webkitgtk-2.34.2/Source/JavaScriptCore/generator/GeneratedFile.rb
14@@ -25,7 +25,7 @@ require 'date'
15 require 'digest'
16
17 $LICENSE = <<-EOF
18-Copyright (C) #{Date.today.year} Apple Inc. All rights reserved.
19+Copyright (C) 2021 Apple Inc. All rights reserved.
20
21 Redistribution and use in source and binary forms, with or without
22 modification, are permitted provided that the following conditions
diff --git a/meta/recipes-sato/webkit/webkitgtk_2.32.3.bb b/meta/recipes-sato/webkit/webkitgtk_2.32.4.bb
index 1f3f7a9c00..3e0ecb4611 100644
--- a/meta/recipes-sato/webkit/webkitgtk_2.32.3.bb
+++ b/meta/recipes-sato/webkit/webkitgtk_2.32.4.bb
@@ -19,9 +19,10 @@ SRC_URI = "https://www.webkitgtk.org/releases/${BPN}-${PV}.tar.xz \
19 file://reduce-memory-overheads.patch \ 19 file://reduce-memory-overheads.patch \
20 file://musl-lower-stack-usage.patch \ 20 file://musl-lower-stack-usage.patch \
21 file://0001-MiniBrowser-Fix-reproduciblity.patch \ 21 file://0001-MiniBrowser-Fix-reproduciblity.patch \
22 file://reproducibility.patch \
22 " 23 "
23 24
24SRC_URI[sha256sum] = "c1f496f5ac654efe4cef62fbd4f2fbeeef265a07c5e7419e5d2900bfeea52cbc" 25SRC_URI[sha256sum] = "00ce2d3f798d7bc5e9039d9059f0c3c974d51de38c8b716f00e94452a177d3fd"
25 26
26inherit cmake pkgconfig gobject-introspection perlnative features_check upstream-version-is-even gtk-doc 27inherit cmake pkgconfig gobject-introspection perlnative features_check upstream-version-is-even gtk-doc
27 28
diff --git a/meta/recipes-support/boost/boost/0001-BoostConfig.cmake-allow-searching-for-python310.patch b/meta/recipes-support/boost/boost/0001-BoostConfig.cmake-allow-searching-for-python310.patch
new file mode 100644
index 0000000000..0a9ee2cc95
--- /dev/null
+++ b/meta/recipes-support/boost/boost/0001-BoostConfig.cmake-allow-searching-for-python310.patch
@@ -0,0 +1,50 @@
1From e193f080c7d209516ac9b712fa0c50bb08026fa2 Mon Sep 17 00:00:00 2001
2From: Martin Jansa <Martin.Jansa@gmail.com>
3Date: Tue, 19 Oct 2021 12:24:31 +0000
4Subject: [PATCH] BoostConfig.cmake: allow searching for python310
5
6* accept double digits in Python3_VERSION_MINOR
7
8* if someone is using e.g.:
9 find_package(Python3 REQUIRED)
10 find_package(Boost REQUIRED python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR})
11
12 with python-3.10 then it currently fails with:
13
14 -- Found PythonLibs: /usr/lib/libpython3.10.so (found version "3.10.0")
15 -- Found Python3: -native/usr/bin/python3-native/python3 (found version "3.10.0") found components: Interpreter
16 CMake Error at /usr/lib/cmake/Boost-1.77.0/BoostConfig.cmake:141 (find_package):
17 Could not find a package configuration file provided by "boost_python310"
18 (requested version 1.77.0) with any of the following names:
19
20 boost_python310Config.cmake
21 boost_python310-config.cmake
22
23 Add the installation prefix of "boost_python310" to CMAKE_PREFIX_PATH or
24 set "boost_python310_DIR" to a directory containing one of the above files.
25 If "boost_python310" provides a separate development package or SDK, be
26 sure it has been installed.
27 Call Stack (most recent call first):
28 /usr/lib/cmake/Boost-1.77.0/BoostConfig.cmake:258 (boost_find_component)
29 /usr/share/cmake-3.21/Modules/FindBoost.cmake:594 (find_package)
30 CMakeLists.txt:18 (find_package)
31
32Upstream-Status: Submitted [https://github.com/boostorg/boost_install/pull/53]
33Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
34---
35 tools/boost_install/BoostConfig.cmake | 2 +-
36 1 file changed, 1 insertion(+), 1 deletion(-)
37
38diff --git a/tools/boost_install/BoostConfig.cmake b/tools/boost_install/BoostConfig.cmake
39index fd17821..5dffa58 100644
40--- a/tools/boost_install/BoostConfig.cmake
41+++ b/tools/boost_install/BoostConfig.cmake
42@@ -113,7 +113,7 @@ macro(boost_find_component comp required quiet)
43 set(_BOOST_REQUIRED REQUIRED)
44 endif()
45
46- if("${comp}" MATCHES "^(python|numpy|mpi_python)([1-9])([0-9])$")
47+ if("${comp}" MATCHES "^(python|numpy|mpi_python)([1-9])([0-9][0-9]?)$")
48
49 # handle pythonXY and numpyXY versioned components for compatibility
50
diff --git a/meta/recipes-support/boost/boost/0002-math-allow-definition-of-boost_math_no_atomic_int-on-the-command-line.patch b/meta/recipes-support/boost/boost/0002-math-allow-definition-of-boost_math_no_atomic_int-on-the-command-line.patch
new file mode 100644
index 0000000000..b05b795084
--- /dev/null
+++ b/meta/recipes-support/boost/boost/0002-math-allow-definition-of-boost_math_no_atomic_int-on-the-command-line.patch
@@ -0,0 +1,53 @@
1From 32bd6197353f6ea8e5bef01f09e25c944141acfc Mon Sep 17 00:00:00 2001
2From: jzmaddock <john@johnmaddock.co.uk>
3Date: Wed, 1 Sep 2021 18:54:54 +0100
4Subject: [PATCH] Allow definition of BOOST_MATH_NO_ATOMIC_INT on the command
5 line. Allows us to test/emulate platforms with no atomic integers.
6
7[buildroot@heine.tech:
8 - backport from boostorg/math 32bd6197353f6ea8e5bef01f09e25c944141acfc
9 - alter path to match boost release
10]
11Signed-off-by: Michael Nosthoff <buildroot@heine.tech>
12---
13Upstream-Status: Backport [https://github.com/boostorg/math/pull/684/commits/32bd6197353f6ea8e5bef01f09e25c944141acfc]
14 boost/math/tools/atomic.hpp | 10 +++++-----
15 1 file changed, 5 insertions(+), 5 deletions(-)
16
17diff --git a/boost/math/tools/atomic.hpp b/boost/math/tools/atomic.hpp
18index cc76ed269f..e3cbf5db89 100644
19--- a/boost/math/tools/atomic.hpp
20+++ b/boost/math/tools/atomic.hpp
21@@ -16,27 +16,27 @@
22 namespace boost {
23 namespace math {
24 namespace detail {
25-#if ATOMIC_INT_LOCK_FREE == 2
26+#if (ATOMIC_INT_LOCK_FREE == 2) && !defined(BOOST_MATH_NO_ATOMIC_INT)
27 typedef std::atomic<int> atomic_counter_type;
28 typedef std::atomic<unsigned> atomic_unsigned_type;
29 typedef int atomic_integer_type;
30 typedef unsigned atomic_unsigned_integer_type;
31-#elif ATOMIC_SHORT_LOCK_FREE == 2
32+#elif (ATOMIC_SHORT_LOCK_FREE == 2) && !defined(BOOST_MATH_NO_ATOMIC_INT)
33 typedef std::atomic<short> atomic_counter_type;
34 typedef std::atomic<unsigned short> atomic_unsigned_type;
35 typedef short atomic_integer_type;
36 typedef unsigned short atomic_unsigned_type;
37-#elif ATOMIC_LONG_LOCK_FREE == 2
38+#elif (ATOMIC_LONG_LOCK_FREE == 2) && !defined(BOOST_MATH_NO_ATOMIC_INT)
39 typedef std::atomic<long> atomic_unsigned_integer_type;
40 typedef std::atomic<unsigned long> atomic_unsigned_type;
41 typedef unsigned long atomic_unsigned_type;
42 typedef long atomic_integer_type;
43-#elif ATOMIC_LLONG_LOCK_FREE == 2
44+#elif (ATOMIC_LLONG_LOCK_FREE == 2) && !defined(BOOST_MATH_NO_ATOMIC_INT)
45 typedef std::atomic<long long> atomic_unsigned_integer_type;
46 typedef std::atomic<unsigned long long> atomic_unsigned_type;
47 typedef long long atomic_integer_type;
48 typedef unsigned long long atomic_unsigned_integer_type;
49-#else
50+#elif !defined(BOOST_MATH_NO_ATOMIC_INT)
51 # define BOOST_MATH_NO_ATOMIC_INT
52 #endif
53 } // Namespace detail
diff --git a/meta/recipes-support/boost/boost/0003-math-make-no-atomics-a-soft-failure-in-bernoulli_details_hpp.patch b/meta/recipes-support/boost/boost/0003-math-make-no-atomics-a-soft-failure-in-bernoulli_details_hpp.patch
new file mode 100644
index 0000000000..f69e4f21f3
--- /dev/null
+++ b/meta/recipes-support/boost/boost/0003-math-make-no-atomics-a-soft-failure-in-bernoulli_details_hpp.patch
@@ -0,0 +1,151 @@
1From 7d482f6ebc356e6ec455ccb5f51a23971bf6ce5b Mon Sep 17 00:00:00 2001
2From: jzmaddock <john@johnmaddock.co.uk>
3Date: Wed, 1 Sep 2021 20:31:53 +0100
4Subject: [PATCH] Make no atomics a soft failure in bernoulli_details.hpp.
5 Include an "escape macro" so thread safety can be disabled if certain
6 bernoulli features are to be used in a no-atomics environment. Fixes
7 https://github.com/boostorg/math/issues/673.
8
9[buildroot@heine.tech:
10 - backport from boostorg/math 7d482f6ebc356e6ec455ccb5f51a23971bf6ce5b
11 - alter path to match boost release
12]
13Signed-off-by: Michael Nosthoff <buildroot@heine.tech>
14---
15Upstream-Status: Backport [https://github.com/boostorg/math/pull/684/commits/7d482f6ebc356e6ec455ccb5f51a23971bf6ce5b]
16 .../detail/bernoulli_details.hpp | 10 +++++++---
17 libs/math/test/Jamfile.v2 | 3 +++
18 test/compile_test/bernoulli_no_atomic_d.cpp | 14 ++++++++++++++
19 test/compile_test/bernoulli_no_atomic_fail.cpp | 15 +++++++++++++++
20 test/compile_test/bernoulli_no_atomic_mp.cpp | 16 ++++++++++++++++
21 5 files changed, 55 insertions(+), 3 deletions(-)
22 create mode 100644 test/compile_test/bernoulli_no_atomic_d.cpp
23 create mode 100644 test/compile_test/bernoulli_no_atomic_fail.cpp
24 create mode 100644 test/compile_test/bernoulli_no_atomic_mp.cpp
25
26diff --git a/boost/math/special_functions/detail/bernoulli_details.hpp b/boost/math/special_functions/detail/bernoulli_details.hpp
27index cf35545264..8519b7c89c 100644
28--- a/boost/math/special_functions/detail/bernoulli_details.hpp
29+++ b/boost/math/special_functions/detail/bernoulli_details.hpp
30@@ -360,7 +360,7 @@ class bernoulli_numbers_cache
31 return out;
32 }
33
34- #ifndef BOOST_HAS_THREADS
35+ #if !defined(BOOST_HAS_THREADS) || defined(BOOST_MATH_BERNOULLI_UNTHREADED)
36 //
37 // Single threaded code, very simple:
38 //
39@@ -382,6 +382,8 @@ class bernoulli_numbers_cache
40 *out = (i >= m_overflow_limit) ? policies::raise_overflow_error<T>("boost::math::bernoulli_b2n<%1%>(std::size_t)", 0, T(i), pol) : bn[i];
41 ++out;
42 }
43+ #elif defined(BOOST_MATH_NO_ATOMIC_INT)
44+ static_assert(sizeof(T) == 1, "Unsupported configuration: your platform appears to have no atomic integers. If you are happy with thread-unsafe code, then you may define BOOST_MATH_BERNOULLI_UNTHREADED to suppress this error.");
45 #else
46 //
47 // Double-checked locking pattern, lets us access cached already cached values
48@@ -464,7 +466,7 @@ class bernoulli_numbers_cache
49 return out;
50 }
51
52- #ifndef BOOST_HAS_THREADS
53+ #if !defined(BOOST_HAS_THREADS) || defined(BOOST_MATH_BERNOULLI_UNTHREADED)
54 //
55 // Single threaded code, very simple:
56 //
57@@ -494,6 +496,8 @@ class bernoulli_numbers_cache
58 }
59 ++out;
60 }
61+ #elif defined(BOOST_MATH_NO_ATOMIC_INT)
62+ static_assert(sizeof(T) == 1, "Unsupported configuration: your platform appears to have no atomic integers. If you are happy with thread-unsafe code, then you may define BOOST_MATH_BERNOULLI_UNTHREADED to suppress this error.");
63 #else
64 //
65 // Double-checked locking pattern, lets us access cached already cached values
66@@ -555,7 +559,7 @@ class bernoulli_numbers_cache
67 // The value at which we know overflow has already occurred for the Bn:
68 std::size_t m_overflow_limit;
69
70- #ifdef BOOST_HAS_THREADS
71+ #if defined(BOOST_HAS_THREADS) && !defined(BOOST_MATH_NO_ATOMIC_INT)
72 std::mutex m_mutex;
73 atomic_counter_type m_counter, m_current_precision;
74 #else
75diff --git a/libs/math/test/Jamfile.v2 b/libs/math/test/Jamfile.v2
76index 52fb87f5e5..3ac63f9279 100644
77--- a/libs/math/test/Jamfile.v2
78+++ b/libs/math/test/Jamfile.v2
79@@ -1137,6 +1137,9 @@ test-suite misc :
80
81 # [ run __temporary_test.cpp test_instances//test_instances : : : <test-info>always_show_run_output <pch>off ]
82 [ compile test_no_long_double_policy.cpp ]
83+ [ compile compile_test/bernoulli_no_atomic_d.cpp ]
84+ [ compile compile_test/bernoulli_no_atomic_mp.cpp ]
85+ [ compile-fail compile_test/bernoulli_no_atomic_fail.cpp ]
86 ;
87
88 test-suite interpolators :
89diff --git a/test/compile_test/bernoulli_no_atomic_d.cpp b/test/compile_test/bernoulli_no_atomic_d.cpp
90new file mode 100644
91index 0000000000..61926f7e1f
92--- /dev/null
93+++ b/test/compile_test/bernoulli_no_atomic_d.cpp
94@@ -0,0 +1,14 @@
95+// (C) Copyright John Maddock 2021.
96+// Use, modification and distribution are subject to the
97+// Boost Software License, Version 1.0. (See accompanying file
98+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
99+
100+#define BOOST_MATH_NO_ATOMIC_INT
101+
102+#include <boost/math/special_functions/bernoulli.hpp>
103+#include "test_compile_result.hpp"
104+
105+void compile_and_link_test()
106+{
107+ check_result<double>(boost::math::bernoulli_b2n<double>(4));
108+}
109diff --git a/test/compile_test/bernoulli_no_atomic_fail.cpp b/test/compile_test/bernoulli_no_atomic_fail.cpp
110new file mode 100644
111index 0000000000..bbd7152412
112--- /dev/null
113+++ b/test/compile_test/bernoulli_no_atomic_fail.cpp
114@@ -0,0 +1,15 @@
115+// (C) Copyright John Maddock 2021.
116+// Use, modification and distribution are subject to the
117+// Boost Software License, Version 1.0. (See accompanying file
118+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
119+
120+#define BOOST_MATH_NO_ATOMIC_INT
121+
122+#include <boost/math/special_functions/bernoulli.hpp>
123+#include <boost/multiprecision/cpp_bin_float.hpp>
124+#include "test_compile_result.hpp"
125+
126+void compile_and_link_test()
127+{
128+ check_result<boost::multiprecision::cpp_bin_float_50>(boost::math::bernoulli_b2n<boost::multiprecision::cpp_bin_float_50>(4));
129+}
130diff --git a/test/compile_test/bernoulli_no_atomic_mp.cpp b/test/compile_test/bernoulli_no_atomic_mp.cpp
131new file mode 100644
132index 0000000000..8d5a6e78e6
133--- /dev/null
134+++ b/test/compile_test/bernoulli_no_atomic_mp.cpp
135@@ -0,0 +1,16 @@
136+// (C) Copyright John Maddock 2021.
137+// Use, modification and distribution are subject to the
138+// Boost Software License, Version 1.0. (See accompanying file
139+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
140+
141+#define BOOST_MATH_NO_ATOMIC_INT
142+#define BOOST_MATH_BERNOULLI_UNTHREADED
143+
144+#include <boost/math/special_functions/bernoulli.hpp>
145+#include <boost/multiprecision/cpp_bin_float.hpp>
146+#include "test_compile_result.hpp"
147+
148+void compile_and_link_test()
149+{
150+ check_result<boost::multiprecision::cpp_bin_float_50>(boost::math::bernoulli_b2n<boost::multiprecision::cpp_bin_float_50>(4));
151+}
diff --git a/meta/recipes-support/boost/boost_1.77.0.bb b/meta/recipes-support/boost/boost_1.77.0.bb
index df8e08ad76..bde6b14a79 100644
--- a/meta/recipes-support/boost/boost_1.77.0.bb
+++ b/meta/recipes-support/boost/boost_1.77.0.bb
@@ -6,4 +6,7 @@ SRC_URI += "file://boost-CVE-2012-2677.patch \
6 file://0001-Don-t-set-up-arch-instruction-set-flags-we-do-that-o.patch \ 6 file://0001-Don-t-set-up-arch-instruction-set-flags-we-do-that-o.patch \
7 file://0001-dont-setup-compiler-flags-m32-m64.patch \ 7 file://0001-dont-setup-compiler-flags-m32-m64.patch \
8 file://0001-fiber-libs-Define-SYS_futex-if-it-does-not-exist.patch \ 8 file://0001-fiber-libs-Define-SYS_futex-if-it-does-not-exist.patch \
9 file://0001-BoostConfig.cmake-allow-searching-for-python310.patch \
10 file://0002-math-allow-definition-of-boost_math_no_atomic_int-on-the-command-line.patch \
11 file://0003-math-make-no-atomics-a-soft-failure-in-bernoulli_details_hpp.patch \
9 " 12 "
diff --git a/meta/recipes-support/gmp/gmp/cve-2021-43618.patch b/meta/recipes-support/gmp/gmp/cve-2021-43618.patch
new file mode 100644
index 0000000000..095fb21eaa
--- /dev/null
+++ b/meta/recipes-support/gmp/gmp/cve-2021-43618.patch
@@ -0,0 +1,27 @@
1CVE: CVE-2021-43618
2Upstream-Status: Backport
3Signed-off-by: Ross Burton <ross.burton@arm.com>
4
5# HG changeset patch
6# User Marco Bodrato <bodrato@mail.dm.unipi.it>
7# Date 1634836009 -7200
8# Node ID 561a9c25298e17bb01896801ff353546c6923dbd
9# Parent e1fd9db13b475209a864577237ea4b9105b3e96e
10mpz/inp_raw.c: Avoid bit size overflows
11
12diff -r e1fd9db13b47 -r 561a9c25298e mpz/inp_raw.c
13--- a/mpz/inp_raw.c Tue Dec 22 23:49:51 2020 +0100
14+++ b/mpz/inp_raw.c Thu Oct 21 19:06:49 2021 +0200
15@@ -88,8 +88,11 @@
16
17 abs_csize = ABS (csize);
18
19+ if (UNLIKELY (abs_csize > ~(mp_bitcnt_t) 0 / 8))
20+ return 0; /* Bit size overflows */
21+
22 /* round up to a multiple of limbs */
23- abs_xsize = BITS_TO_LIMBS (abs_csize*8);
24+ abs_xsize = BITS_TO_LIMBS ((mp_bitcnt_t) abs_csize * 8);
25
26 if (abs_xsize != 0)
27 {
diff --git a/meta/recipes-support/gmp/gmp_6.2.1.bb b/meta/recipes-support/gmp/gmp_6.2.1.bb
index d5996abd00..091a390511 100644
--- a/meta/recipes-support/gmp/gmp_6.2.1.bb
+++ b/meta/recipes-support/gmp/gmp_6.2.1.bb
@@ -2,9 +2,11 @@ require gmp.inc
2 2
3LICENSE = "GPLv2+ | LGPLv3+" 3LICENSE = "GPLv2+ | LGPLv3+"
4 4
5LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \ 5LIC_FILES_CHKSUM = "\
6 file://COPYING.LESSERv3;md5=6a6a8e020838b23406c81b19c1d46df6 \ 6 file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \
7 file://COPYINGv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ 7 file://COPYING.LESSERv3;md5=6a6a8e020838b23406c81b19c1d46df6 \
8 file://COPYINGv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
9 file://COPYINGv3;md5=11cc2d3ee574f9d6b7ee797bdce4d423 \
8" 10"
9 11
10REVISION = "" 12REVISION = ""
@@ -12,6 +14,7 @@ SRC_URI = "https://gmplib.org/download/${BPN}/${BP}${REVISION}.tar.bz2 \
12 file://use-includedir.patch \ 14 file://use-includedir.patch \
13 file://0001-Append-the-user-provided-flags-to-the-auto-detected-.patch \ 15 file://0001-Append-the-user-provided-flags-to-the-auto-detected-.patch \
14 file://0001-confiure.ac-Believe-the-cflags-from-environment.patch \ 16 file://0001-confiure.ac-Believe-the-cflags-from-environment.patch \
17 file://cve-2021-43618.patch \
15 " 18 "
16SRC_URI[md5sum] = "28971fc21cf028042d4897f02fd355ea" 19SRC_URI[md5sum] = "28971fc21cf028042d4897f02fd355ea"
17SRC_URI[sha256sum] = "eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c" 20SRC_URI[sha256sum] = "eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c"
diff --git a/meta/recipes-support/icu/icu_69.1.bb b/meta/recipes-support/icu/icu_69.1.bb
index 4daf0fe82e..848ae9ab19 100644
--- a/meta/recipes-support/icu/icu_69.1.bb
+++ b/meta/recipes-support/icu/icu_69.1.bb
@@ -147,4 +147,4 @@ do_make_icudata() {
147 : 147 :
148} 148}
149 149
150addtask make_icudata before do_configure after do_patch 150addtask make_icudata before do_configure after do_patch do_prepare_recipe_sysroot
diff --git a/meta/recipes-support/libusb/libusb1_1.0.24.bb b/meta/recipes-support/libusb/libusb1_1.0.24.bb
index 95a20958a1..e70021f4f7 100644
--- a/meta/recipes-support/libusb/libusb1_1.0.24.bb
+++ b/meta/recipes-support/libusb/libusb1_1.0.24.bb
@@ -1,7 +1,7 @@
1SUMMARY = "Userspace library to access USB (version 1.0)" 1SUMMARY = "Userspace library to access USB (version 1.0)"
2DESCRIPTION = "A cross-platform library to access USB devices from Linux, \ 2DESCRIPTION = "A cross-platform library to access USB devices from Linux, \
3macOS, Windows, OpenBSD/NetBSD, Haiku and Solaris userspace." 3macOS, Windows, OpenBSD/NetBSD, Haiku and Solaris userspace."
4HOMEPAGE = "http://libusb.sf.net" 4HOMEPAGE = "https://libusb.info"
5BUGTRACKER = "http://www.libusb.org/report" 5BUGTRACKER = "http://www.libusb.org/report"
6SECTION = "libs" 6SECTION = "libs"
7 7
@@ -10,10 +10,12 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=fbc093901857fcd118f065f900982c24"
10 10
11BBCLASSEXTEND = "native nativesdk" 11BBCLASSEXTEND = "native nativesdk"
12 12
13SRC_URI = "${SOURCEFORGE_MIRROR}/libusb/libusb-${PV}.tar.bz2 \ 13SRC_URI = "https://github.com/libusb/libusb/releases/download/v${PV}/libusb-${PV}.tar.bz2 \
14 file://run-ptest \ 14 file://run-ptest \
15 " 15 "
16 16
17UPSTREAM_CHECK_URI = "https://github.com/libusb/libusb/releases"
18
17SRC_URI[sha256sum] = "7efd2685f7b327326dcfb85cee426d9b871fd70e22caa15bb68d595ce2a2b12a" 19SRC_URI[sha256sum] = "7efd2685f7b327326dcfb85cee426d9b871fd70e22caa15bb68d595ce2a2b12a"
18 20
19S = "${WORKDIR}/libusb-${PV}" 21S = "${WORKDIR}/libusb-${PV}"
diff --git a/meta/recipes-support/vim/files/0001-src-Makefile-improve-reproducibility.patch b/meta/recipes-support/vim/files/0001-src-Makefile-improve-reproducibility.patch
index 63a7b78f12..2fc11dbdc2 100644
--- a/meta/recipes-support/vim/files/0001-src-Makefile-improve-reproducibility.patch
+++ b/meta/recipes-support/vim/files/0001-src-Makefile-improve-reproducibility.patch
@@ -16,11 +16,11 @@ Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
16 src/Makefile | 14 ++++---------- 16 src/Makefile | 14 ++++----------
17 1 file changed, 4 insertions(+), 10 deletions(-) 17 1 file changed, 4 insertions(+), 10 deletions(-)
18 18
19diff --git a/src/Makefile b/src/Makefile 19Index: git/src/Makefile
20index f2fafa4dc..7148d4bd9 100644 20===================================================================
21--- a/src/Makefile 21--- git.orig/src/Makefile
22+++ b/src/Makefile 22+++ git/src/Makefile
23@@ -2845,16 +2845,10 @@ auto/pathdef.c: Makefile auto/config.mk 23@@ -3101,16 +3101,10 @@ auto/pathdef.c: Makefile auto/config.mk
24 -@echo '#include "vim.h"' >> $@ 24 -@echo '#include "vim.h"' >> $@
25 -@echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' | $(QUOTESED) >> $@ 25 -@echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' | $(QUOTESED) >> $@
26 -@echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' | $(QUOTESED) >> $@ 26 -@echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' | $(QUOTESED) >> $@
@@ -41,6 +41,3 @@ index f2fafa4dc..7148d4bd9 100644
41 -@sh $(srcdir)/pathdef.sh 41 -@sh $(srcdir)/pathdef.sh
42 42
43 GUI_GTK_RES_INPUTS = \ 43 GUI_GTK_RES_INPUTS = \
44--
452.17.1
46
diff --git a/meta/recipes-support/vim/files/0002-patch-8.2.3428-using-freed-memory-when-replacing.patch b/meta/recipes-support/vim/files/0002-patch-8.2.3428-using-freed-memory-when-replacing.patch
deleted file mode 100644
index ecfae0301e..0000000000
--- a/meta/recipes-support/vim/files/0002-patch-8.2.3428-using-freed-memory-when-replacing.patch
+++ /dev/null
@@ -1,83 +0,0 @@
1CVE: CVE-2021-3796
2Upstream-Status: Backport
3Signed-off-by: Ross Burton <ross.burton@arm.com>
4
5From 1160e5f74b229336502fc376416f21108d36cfc2 Mon Sep 17 00:00:00 2001
6From: Bram Moolenaar <Bram@vim.org>
7Date: Sat, 11 Sep 2021 21:14:20 +0200
8Subject: [PATCH] patch 8.2.3428: using freed memory when replacing
9
10Problem: Using freed memory when replacing. (Dhiraj Mishra)
11Solution: Get the line pointer after calling ins_copychar().
12---
13 src/normal.c | 10 +++++++---
14 src/testdir/test_edit.vim | 14 ++++++++++++++
15 src/version.c | 2 ++
16 3 files changed, 23 insertions(+), 3 deletions(-)
17
18diff --git a/src/normal.c b/src/normal.c
19index c4963e621..d6333b948 100644
20--- a/src/normal.c
21+++ b/src/normal.c
22@@ -5009,19 +5009,23 @@ nv_replace(cmdarg_T *cap)
23 {
24 /*
25 * Get ptr again, because u_save and/or showmatch() will have
26- * released the line. At the same time we let know that the
27- * line will be changed.
28+ * released the line. This may also happen in ins_copychar().
29+ * At the same time we let know that the line will be changed.
30 */
31- ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);
32 if (cap->nchar == Ctrl_E || cap->nchar == Ctrl_Y)
33 {
34 int c = ins_copychar(curwin->w_cursor.lnum
35 + (cap->nchar == Ctrl_Y ? -1 : 1));
36+
37+ ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);
38 if (c != NUL)
39 ptr[curwin->w_cursor.col] = c;
40 }
41 else
42+ {
43+ ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);
44 ptr[curwin->w_cursor.col] = cap->nchar;
45+ }
46 if (p_sm && msg_silent == 0)
47 showmatch(cap->nchar);
48 ++curwin->w_cursor.col;
49diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim
50index 4e29e7fe1..f94e6c181 100644
51--- a/src/testdir/test_edit.vim
52+++ b/src/testdir/test_edit.vim
53@@ -1519,3 +1519,17 @@ func Test_edit_noesckeys()
54 bwipe!
55 set esckeys
56 endfunc
57+
58+" Test for getting the character of the line below after "p"
59+func Test_edit_put_CTRL_E()
60+ set encoding=latin1
61+ new
62+ let @" = ''
63+ sil! norm orggRx
64+ sil! norm pr
65+ call assert_equal(['r', 'r'], getline(1, 2))
66+ bwipe!
67+ set encoding=utf-8
68+endfunc
69+
70+" vim: shiftwidth=2 sts=2 expandtab
71diff --git a/src/version.c b/src/version.c
72index 85bdfc601..1046993d6 100644
73--- a/src/version.c
74+++ b/src/version.c
75@@ -742,6 +742,8 @@ static char *(features[]) =
76
77 static int included_patches[] =
78 { /* Add new patch number below this line */
79+/**/
80+ 3428,
81 /**/
82 3409,
83 /**/
diff --git a/meta/recipes-support/vim/files/0003-patch-8.2.3487-illegal-memory-access-if-buffer-name-.patch b/meta/recipes-support/vim/files/0003-patch-8.2.3487-illegal-memory-access-if-buffer-name-.patch
deleted file mode 100644
index 576664f436..0000000000
--- a/meta/recipes-support/vim/files/0003-patch-8.2.3487-illegal-memory-access-if-buffer-name-.patch
+++ /dev/null
@@ -1,86 +0,0 @@
1CVE: CVE-2021-3872
2Upstream-Status: Backport
3Signed-off-by: Ross Burton <ross.burton@arm.com>
4
5From 61629ea24a2fff1f89c37479d3fb52f17c3480fc Mon Sep 17 00:00:00 2001
6From: Bram Moolenaar <Bram@vim.org>
7Date: Fri, 8 Oct 2021 18:39:28 +0100
8Subject: [PATCH] patch 8.2.3487: illegal memory access if buffer name is very
9 long
10
11Problem: Illegal memory access if buffer name is very long.
12Solution: Make sure not to go over the end of the buffer.
13---
14 src/drawscreen.c | 10 +++++-----
15 src/testdir/test_statusline.vim | 11 +++++++++++
16 src/version.c | 2 ++
17 3 files changed, 18 insertions(+), 5 deletions(-)
18
19diff --git a/src/drawscreen.c b/src/drawscreen.c
20index 3a88ee979..9acb70552 100644
21--- a/src/drawscreen.c
22+++ b/src/drawscreen.c
23@@ -446,13 +446,13 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED)
24 *(p + len++) = ' ';
25 if (bt_help(wp->w_buffer))
26 {
27- STRCPY(p + len, _("[Help]"));
28+ vim_snprintf((char *)p + len, MAXPATHL - len, "%s", _("[Help]"));
29 len += (int)STRLEN(p + len);
30 }
31 #ifdef FEAT_QUICKFIX
32 if (wp->w_p_pvw)
33 {
34- STRCPY(p + len, _("[Preview]"));
35+ vim_snprintf((char *)p + len, MAXPATHL - len, "%s", _("[Preview]"));
36 len += (int)STRLEN(p + len);
37 }
38 #endif
39@@ -462,12 +462,12 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED)
40 #endif
41 )
42 {
43- STRCPY(p + len, "[+]");
44- len += 3;
45+ vim_snprintf((char *)p + len, MAXPATHL - len, "%s", "[+]");
46+ len += (int)STRLEN(p + len);
47 }
48 if (wp->w_buffer->b_p_ro)
49 {
50- STRCPY(p + len, _("[RO]"));
51+ vim_snprintf((char *)p + len, MAXPATHL - len, "%s", _("[RO]"));
52 len += (int)STRLEN(p + len);
53 }
54
55diff --git a/src/testdir/test_statusline.vim b/src/testdir/test_statusline.vim
56index 1f705b847..91bce1407 100644
57--- a/src/testdir/test_statusline.vim
58+++ b/src/testdir/test_statusline.vim
59@@ -393,3 +393,14 @@ func Test_statusline_visual()
60 bwipe! x1
61 bwipe! x2
62 endfunc
63+" Used to write beyond allocated memory. This assumes MAXPATHL is 4096 bytes.
64+func Test_statusline_verylong_filename()
65+ let fname = repeat('x', 4090)
66+ exe "new " .. fname
67+ set buftype=help
68+ set previewwindow
69+ redraw
70+ bwipe!
71+endfunc
72+
73+" vim: shiftwidth=2 sts=2 expandtab
74diff --git a/src/version.c b/src/version.c
75index 1046993d6..2b5de5ccf 100644
76--- a/src/version.c
77+++ b/src/version.c
78@@ -742,6 +742,8 @@ static char *(features[]) =
79
80 static int included_patches[] =
81 { /* Add new patch number below this line */
82+/**/
83+ 3487,
84 /**/
85 3428,
86 /**/
diff --git a/meta/recipes-support/vim/files/0004-patch-8.2.3489-ml_get-error-after-search-with-range.patch b/meta/recipes-support/vim/files/0004-patch-8.2.3489-ml_get-error-after-search-with-range.patch
deleted file mode 100644
index 045081579c..0000000000
--- a/meta/recipes-support/vim/files/0004-patch-8.2.3489-ml_get-error-after-search-with-range.patch
+++ /dev/null
@@ -1,72 +0,0 @@
1CVE: CVE-2021-3875
2Upstream-Status: Backport
3Signed-off-by: Ross Burton <ross.burton@arm.com>
4
5From b8968e26d7508e7d64bfc86808142818b0a9288c Mon Sep 17 00:00:00 2001
6From: Bram Moolenaar <Bram@vim.org>
7Date: Sat, 9 Oct 2021 13:58:55 +0100
8Subject: [PATCH] patch 8.2.3489: ml_get error after search with range
9
10Problem: ml_get error after search with range.
11Solution: Limit the line number to the buffer line count.
12---
13 src/ex_docmd.c | 6 ++++--
14 src/testdir/test_search.vim | 17 +++++++++++++++++
15 src/version.c | 2 ++
16 3 files changed, 23 insertions(+), 2 deletions(-)
17
18diff --git a/src/ex_docmd.c b/src/ex_docmd.c
19index fb07450f8..fde726477 100644
20--- a/src/ex_docmd.c
21+++ b/src/ex_docmd.c
22@@ -3586,8 +3586,10 @@ get_address(
23
24 // When '/' or '?' follows another address, start from
25 // there.
26- if (lnum != MAXLNUM)
27- curwin->w_cursor.lnum = lnum;
28+ if (lnum > 0 && lnum != MAXLNUM)
29+ curwin->w_cursor.lnum =
30+ lnum > curbuf->b_ml.ml_line_count
31+ ? curbuf->b_ml.ml_line_count : lnum;
32
33 // Start a forward search at the end of the line (unless
34 // before the first line).
35diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
36index 187671305..e142c3547 100644
37--- a/src/testdir/test_search.vim
38+++ b/src/testdir/test_search.vim
39@@ -1366,3 +1366,20 @@ func Test_searchdecl()
40
41 bwipe!
42 endfunc
43+
44+func Test_search_with_invalid_range()
45+ new
46+ let lines =<< trim END
47+ /\%.v
48+ 5/
49+ c
50+ END
51+ call writefile(lines, 'Xrangesearch')
52+ source Xrangesearch
53+
54+ bwipe!
55+ call delete('Xrangesearch')
56+endfunc
57+
58+
59+" vim: shiftwidth=2 sts=2 expandtab
60diff --git a/src/version.c b/src/version.c
61index 2b5de5ccf..092864bbb 100644
62--- a/src/version.c
63+++ b/src/version.c
64@@ -742,6 +742,8 @@ static char *(features[]) =
65
66 static int included_patches[] =
67 { /* Add new patch number below this line */
68+/**/
69+ 3489,
70 /**/
71 3487,
72 /**/
diff --git a/meta/recipes-support/vim/files/0005-patch-8.2.3564-invalid-memory-access-when-scrolling-.patch b/meta/recipes-support/vim/files/0005-patch-8.2.3564-invalid-memory-access-when-scrolling-.patch
deleted file mode 100644
index 7184b37cad..0000000000
--- a/meta/recipes-support/vim/files/0005-patch-8.2.3564-invalid-memory-access-when-scrolling-.patch
+++ /dev/null
@@ -1,97 +0,0 @@
1CVE: CVE-2021-3903
2Upstream-Status: Backport
3Signed-off-by: Ross Burton <ross.burton@arm.com>
4
5From b15919c1fe0f7fc3d98ff5207ed2feb43c59009d Mon Sep 17 00:00:00 2001
6From: Bram Moolenaar <Bram@vim.org>
7Date: Mon, 25 Oct 2021 17:07:04 +0100
8Subject: [PATCH] patch 8.2.3564: invalid memory access when scrolling without
9 valid screen
10
11Problem: Invalid memory access when scrolling without a valid screen.
12Solution: Do not set VALID_BOTLINE in w_valid.
13---
14 src/move.c | 1 -
15 src/testdir/test_normal.vim | 23 ++++++++++++++++++++---
16 src/version.c | 2 ++
17 3 files changed, 22 insertions(+), 4 deletions(-)
18
19diff --git a/src/move.c b/src/move.c
20index 8e53d8bcb..10165ef4d 100644
21--- a/src/move.c
22+++ b/src/move.c
23@@ -198,7 +198,6 @@ update_topline(void)
24 {
25 curwin->w_topline = curwin->w_cursor.lnum;
26 curwin->w_botline = curwin->w_topline;
27- curwin->w_valid |= VALID_BOTLINE|VALID_BOTLINE_AP;
28 curwin->w_scbind_pos = 1;
29 return;
30 }
31diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
32index d45cf4159..ca87928f5 100644
33--- a/src/testdir/test_normal.vim
34+++ b/src/testdir/test_normal.vim
35@@ -33,14 +33,14 @@ func CountSpaces(type, ...)
36 else
37 silent exe "normal! `[v`]y"
38 endif
39- let g:a=strlen(substitute(@@, '[^ ]', '', 'g'))
40+ let g:a = strlen(substitute(@@, '[^ ]', '', 'g'))
41 let &selection = sel_save
42 let @@ = reg_save
43 endfunc
44
45 func OpfuncDummy(type, ...)
46 " for testing operatorfunc
47- let g:opt=&linebreak
48+ let g:opt = &linebreak
49
50 if a:0 " Invoked from Visual mode, use gv command.
51 silent exe "normal! gvy"
52@@ -51,7 +51,7 @@ func OpfuncDummy(type, ...)
53 endif
54 " Create a new dummy window
55 new
56- let g:bufnr=bufnr('%')
57+ let g:bufnr = bufnr('%')
58 endfunc
59
60 fun! Test_normal00_optrans()
61@@ -718,6 +718,23 @@ func Test_normal17_z_scroll_hor2()
62 bw!
63 endfunc
64
65+
66+func Test_scroll_in_ex_mode()
67+ " This was using invalid memory because w_botline was invalid.
68+ let lines =<< trim END
69+ diffsplit
70+ norm os00(
71+ call writefile(['done'], 'Xdone')
72+ qa!
73+ END
74+ call writefile(lines, 'Xscript')
75+ call assert_equal(1, RunVim([], [], '--clean -X -Z -e -s -S Xscript'))
76+ call assert_equal(['done'], readfile('Xdone'))
77+
78+ call delete('Xscript')
79+ call delete('Xdone')
80+endfunc
81+
82 func Test_normal18_z_fold()
83 " basic tests for foldopen/folddelete
84 if !has("folding")
85diff --git a/src/version.c b/src/version.c
86index 092864bbb..a9e8be0e7 100644
87--- a/src/version.c
88+++ b/src/version.c
89@@ -742,6 +742,8 @@ static char *(features[]) =
90
91 static int included_patches[] =
92 { /* Add new patch number below this line */
93+/**/
94+ 3564,
95 /**/
96 3489,
97 /**/
diff --git a/meta/recipes-support/vim/files/CVE-2021-3778.patch b/meta/recipes-support/vim/files/CVE-2021-3778.patch
deleted file mode 100644
index 544af04458..0000000000
--- a/meta/recipes-support/vim/files/CVE-2021-3778.patch
+++ /dev/null
@@ -1,61 +0,0 @@
1From 6d351cec5b97cb72b226d03bd727e453a235ed8d Mon Sep 17 00:00:00 2001
2From: Minjae Kim <flowergom@gmail.com>
3Date: Sun, 26 Sep 2021 23:48:00 +0000
4Subject: [PATCH] patch 8.2.3409: reading beyond end of line with invalid utf-8
5 character
6
7Problem: Reading beyond end of line with invalid utf-8 character.
8Solution: Check for NUL when advancing.
9
10Upstream-Status: Accepted [https://github.com/vim/vim/commit/65b605665997fad54ef39a93199e305af2fe4d7f]
11CVE: CVE-2021-3778
12Signed-off-by: Minjae Kim <flowergom@gmail.com>
13
14---
15 src/regexp_nfa.c | 3 ++-
16 src/testdir/test_regexp_utf8.vim | 7 +++++++
17 src/version.c | 2 ++
18 3 files changed, 11 insertions(+), 1 deletion(-)
19
20diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
21index fb512f961..ace83a1a3 100644
22--- a/src/regexp_nfa.c
23+++ b/src/regexp_nfa.c
24@@ -5455,7 +5455,8 @@ find_match_text(colnr_T startcol, int regstart, char_u *match_text)
25 match = FALSE;
26 break;
27 }
28- len2 += MB_CHAR2LEN(c2);
29+ len2 += enc_utf8 ? utf_ptr2len(rex.line + col + len2)
30+ : MB_CHAR2LEN(c2);
31 }
32 if (match
33 // check that no composing char follows
34diff --git a/src/testdir/test_regexp_utf8.vim b/src/testdir/test_regexp_utf8.vim
35index 19ff882be..e0665818b 100644
36--- a/src/testdir/test_regexp_utf8.vim
37+++ b/src/testdir/test_regexp_utf8.vim
38@@ -215,3 +215,10 @@ func Test_optmatch_toolong()
39 set re=0
40 endfunc
41
42+func Test_match_invalid_byte()
43+ call writefile(0z630a.765d30aa0a.2e0a.790a.4030, 'Xinvalid')
44+ new
45+ source Xinvalid
46+ bwipe!
47+ call delete('Xinvalid')
48+endfunc
49diff --git a/src/version.c b/src/version.c
50index 8912f6215..85bdfc601 100644
51--- a/src/version.c
52+++ b/src/version.c
53@@ -742,6 +742,8 @@ static char *(features[]) =
54
55 static int included_patches[] =
56 { /* Add new patch number below this line */
57+/**/
58+ 3409,
59 /**/
60 3402,
61 /**/
diff --git a/meta/recipes-support/vim/files/b7081e135a16091c93f6f5f7525a5c58fb7ca9f9.patch b/meta/recipes-support/vim/files/b7081e135a16091c93f6f5f7525a5c58fb7ca9f9.patch
deleted file mode 100644
index 1cee759502..0000000000
--- a/meta/recipes-support/vim/files/b7081e135a16091c93f6f5f7525a5c58fb7ca9f9.patch
+++ /dev/null
@@ -1,207 +0,0 @@
1From b7081e135a16091c93f6f5f7525a5c58fb7ca9f9 Mon Sep 17 00:00:00 2001
2From: Bram Moolenaar <Bram@vim.org>
3Date: Sat, 4 Sep 2021 18:47:28 +0200
4Subject: [PATCH] patch 8.2.3402: invalid memory access when using :retab with
5 large value
6
7Problem: Invalid memory access when using :retab with large value.
8Solution: Check the number is positive.
9
10CVE: CVE-2021-3770
11Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
12Upstream-Status: Backport [https://github.com/vim/vim/commit/b7081e135a16091c93f6f5f7525a5c58fb7ca9f9]
13---
14 src/indent.c | 34 +++++++++++++++++++++-------------
15 src/option.c | 12 ++++++------
16 src/optionstr.c | 4 ++--
17 src/testdir/test_retab.vim | 3 +++
18 src/version.c | 2 ++
19 5 files changed, 34 insertions(+), 21 deletions(-)
20
21Index: git/src/indent.c
22===================================================================
23--- git.orig/src/indent.c
24+++ git/src/indent.c
25@@ -18,18 +18,19 @@
26 /*
27 * Set the integer values corresponding to the string setting of 'vartabstop'.
28 * "array" will be set, caller must free it if needed.
29+ * Return FAIL for an error.
30 */
31 int
32 tabstop_set(char_u *var, int **array)
33 {
34- int valcount = 1;
35- int t;
36- char_u *cp;
37+ int valcount = 1;
38+ int t;
39+ char_u *cp;
40
41 if (var[0] == NUL || (var[0] == '0' && var[1] == NUL))
42 {
43 *array = NULL;
44- return TRUE;
45+ return OK;
46 }
47
48 for (cp = var; *cp != NUL; ++cp)
49@@ -43,8 +44,8 @@ tabstop_set(char_u *var, int **array)
50 if (cp != end)
51 emsg(_(e_positive));
52 else
53- emsg(_(e_invarg));
54- return FALSE;
55+ semsg(_(e_invarg2), cp);
56+ return FAIL;
57 }
58 }
59
60@@ -55,26 +56,33 @@ tabstop_set(char_u *var, int **array)
61 ++valcount;
62 continue;
63 }
64- emsg(_(e_invarg));
65- return FALSE;
66+ semsg(_(e_invarg2), var);
67+ return FAIL;
68 }
69
70 *array = ALLOC_MULT(int, valcount + 1);
71 if (*array == NULL)
72- return FALSE;
73+ return FAIL;
74 (*array)[0] = valcount;
75
76 t = 1;
77 for (cp = var; *cp != NUL;)
78 {
79- (*array)[t++] = atoi((char *)cp);
80- while (*cp != NUL && *cp != ',')
81+ int n = atoi((char *)cp);
82+
83+ if (n < 0 || n > 9999)
84+ {
85+ semsg(_(e_invarg2), cp);
86+ return FAIL;
87+ }
88+ (*array)[t++] = n;
89+ while (*cp != NUL && *cp != ',')
90 ++cp;
91 if (*cp != NUL)
92 ++cp;
93 }
94
95- return TRUE;
96+ return OK;
97 }
98
99 /*
100@@ -1556,7 +1564,7 @@ ex_retab(exarg_T *eap)
101
102 #ifdef FEAT_VARTABS
103 new_ts_str = eap->arg;
104- if (!tabstop_set(eap->arg, &new_vts_array))
105+ if (tabstop_set(eap->arg, &new_vts_array) == FAIL)
106 return;
107 while (vim_isdigit(*(eap->arg)) || *(eap->arg) == ',')
108 ++(eap->arg);
109Index: git/src/option.c
110===================================================================
111--- git.orig/src/option.c
112+++ git/src/option.c
113@@ -2292,9 +2292,9 @@ didset_options2(void)
114 #endif
115 #ifdef FEAT_VARTABS
116 vim_free(curbuf->b_p_vsts_array);
117- tabstop_set(curbuf->b_p_vsts, &curbuf->b_p_vsts_array);
118+ (void)tabstop_set(curbuf->b_p_vsts, &curbuf->b_p_vsts_array);
119 vim_free(curbuf->b_p_vts_array);
120- tabstop_set(curbuf->b_p_vts, &curbuf->b_p_vts_array);
121+ (void)tabstop_set(curbuf->b_p_vts, &curbuf->b_p_vts_array);
122 #endif
123 }
124
125@@ -5756,7 +5756,7 @@ buf_copy_options(buf_T *buf, int flags)
126 buf->b_p_vsts = vim_strsave(p_vsts);
127 COPY_OPT_SCTX(buf, BV_VSTS);
128 if (p_vsts && p_vsts != empty_option)
129- tabstop_set(p_vsts, &buf->b_p_vsts_array);
130+ (void)tabstop_set(p_vsts, &buf->b_p_vsts_array);
131 else
132 buf->b_p_vsts_array = 0;
133 buf->b_p_vsts_nopaste = p_vsts_nopaste
134@@ -5914,7 +5914,7 @@ buf_copy_options(buf_T *buf, int flags)
135 buf->b_p_isk = save_p_isk;
136 #ifdef FEAT_VARTABS
137 if (p_vts && p_vts != empty_option && !buf->b_p_vts_array)
138- tabstop_set(p_vts, &buf->b_p_vts_array);
139+ (void)tabstop_set(p_vts, &buf->b_p_vts_array);
140 else
141 buf->b_p_vts_array = NULL;
142 #endif
143@@ -5929,7 +5929,7 @@ buf_copy_options(buf_T *buf, int flags)
144 buf->b_p_vts = vim_strsave(p_vts);
145 COPY_OPT_SCTX(buf, BV_VTS);
146 if (p_vts && p_vts != empty_option && !buf->b_p_vts_array)
147- tabstop_set(p_vts, &buf->b_p_vts_array);
148+ (void)tabstop_set(p_vts, &buf->b_p_vts_array);
149 else
150 buf->b_p_vts_array = NULL;
151 #endif
152@@ -6634,7 +6634,7 @@ paste_option_changed(void)
153 if (buf->b_p_vsts_array)
154 vim_free(buf->b_p_vsts_array);
155 if (buf->b_p_vsts && buf->b_p_vsts != empty_option)
156- tabstop_set(buf->b_p_vsts, &buf->b_p_vsts_array);
157+ (void)tabstop_set(buf->b_p_vsts, &buf->b_p_vsts_array);
158 else
159 buf->b_p_vsts_array = 0;
160 #endif
161Index: git/src/optionstr.c
162===================================================================
163--- git.orig/src/optionstr.c
164+++ git/src/optionstr.c
165@@ -2166,7 +2166,7 @@ did_set_string_option(
166 if (errmsg == NULL)
167 {
168 int *oldarray = curbuf->b_p_vsts_array;
169- if (tabstop_set(*varp, &(curbuf->b_p_vsts_array)))
170+ if (tabstop_set(*varp, &(curbuf->b_p_vsts_array)) == OK)
171 {
172 if (oldarray)
173 vim_free(oldarray);
174@@ -2205,7 +2205,7 @@ did_set_string_option(
175 {
176 int *oldarray = curbuf->b_p_vts_array;
177
178- if (tabstop_set(*varp, &(curbuf->b_p_vts_array)))
179+ if (tabstop_set(*varp, &(curbuf->b_p_vts_array)) == OK)
180 {
181 vim_free(oldarray);
182 #ifdef FEAT_FOLDING
183Index: git/src/testdir/test_retab.vim
184===================================================================
185--- git.orig/src/testdir/test_retab.vim
186+++ git/src/testdir/test_retab.vim
187@@ -74,4 +74,7 @@ endfunc
188 func Test_retab_error()
189 call assert_fails('retab -1', 'E487:')
190 call assert_fails('retab! -1', 'E487:')
191+ call assert_fails('ret -1000', 'E487:')
192+ call assert_fails('ret 10000', 'E475:')
193+ call assert_fails('ret 80000000000000000000', 'E475:')
194 endfunc
195Index: git/src/version.c
196===================================================================
197--- git.orig/src/version.c
198+++ git/src/version.c
199@@ -743,6 +743,8 @@ static char *(features[]) =
200 static int included_patches[] =
201 { /* Add new patch number below this line */
202 /**/
203+ 3402,
204+/**/
205 0
206 };
207
diff --git a/meta/recipes-support/vim/files/disable_acl_header_check.patch b/meta/recipes-support/vim/files/disable_acl_header_check.patch
index 33089162b4..533138245d 100644
--- a/meta/recipes-support/vim/files/disable_acl_header_check.patch
+++ b/meta/recipes-support/vim/files/disable_acl_header_check.patch
@@ -13,11 +13,11 @@ Signed-off-by: Changqing Li <changqing.li@windriver.com>
13 src/configure.ac | 3 ++- 13 src/configure.ac | 3 ++-
14 1 file changed, 2 insertions(+), 1 deletion(-) 14 1 file changed, 2 insertions(+), 1 deletion(-)
15 15
16diff --git a/src/configure.ac b/src/configure.ac 16Index: git/src/configure.ac
17index 2d409b3ca06a..dbcaf6140263 100644 17===================================================================
18--- a/src/configure.ac 18--- git.orig/src/configure.ac
19+++ b/src/configure.ac 19+++ git/src/configure.ac
20@@ -3257,7 +3257,7 @@ AC_CHECK_HEADERS(stdint.h stdlib.h string.h \ 20@@ -3292,7 +3292,7 @@ AC_CHECK_HEADERS(stdint.h stdlib.h strin
21 sys/systeminfo.h locale.h sys/stream.h termios.h \ 21 sys/systeminfo.h locale.h sys/stream.h termios.h \
22 libc.h sys/statfs.h poll.h sys/poll.h pwd.h \ 22 libc.h sys/statfs.h poll.h sys/poll.h pwd.h \
23 utime.h sys/param.h sys/ptms.h libintl.h libgen.h \ 23 utime.h sys/param.h sys/ptms.h libintl.h libgen.h \
@@ -26,7 +26,7 @@ index 2d409b3ca06a..dbcaf6140263 100644
26 sys/access.h sys/sysinfo.h wchar.h wctype.h) 26 sys/access.h sys/sysinfo.h wchar.h wctype.h)
27 27
28 dnl sys/ptem.h depends on sys/stream.h on Solaris 28 dnl sys/ptem.h depends on sys/stream.h on Solaris
29@@ -3886,6 +3886,7 @@ AC_ARG_ENABLE(acl, 29@@ -3974,6 +3974,7 @@ AC_ARG_ENABLE(acl,
30 , [enable_acl="yes"]) 30 , [enable_acl="yes"])
31 if test "$enable_acl" = "yes"; then 31 if test "$enable_acl" = "yes"; then
32 AC_MSG_RESULT(no) 32 AC_MSG_RESULT(no)
@@ -34,6 +34,3 @@ index 2d409b3ca06a..dbcaf6140263 100644
34 AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"], 34 AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
35 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl" 35 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
36 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),) 36 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
37--
382.7.4
39
diff --git a/meta/recipes-support/vim/files/no-path-adjust.patch b/meta/recipes-support/vim/files/no-path-adjust.patch
index 05c2d803f6..9d6da80913 100644
--- a/meta/recipes-support/vim/files/no-path-adjust.patch
+++ b/meta/recipes-support/vim/files/no-path-adjust.patch
@@ -7,9 +7,11 @@ Upstream-Status: Pending
7 7
8Signed-off-by: Joe Slater <joe.slater@windriver.com> 8Signed-off-by: Joe Slater <joe.slater@windriver.com>
9 9
10--- a/src/Makefile 10Index: git/src/Makefile
11+++ b/src/Makefile 11===================================================================
12@@ -2507,11 +2507,14 @@ installtools: $(TOOLS) $(DESTDIR)$(exec_ 12--- git.orig/src/Makefile
13+++ git/src/Makefile
14@@ -2565,11 +2565,14 @@ installtools: $(TOOLS) $(DESTDIR)$(exec_
13 rm -rf $$cvs; \ 15 rm -rf $$cvs; \
14 fi 16 fi
15 -chmod $(FILEMOD) $(DEST_TOOLS)/* 17 -chmod $(FILEMOD) $(DEST_TOOLS)/*
diff --git a/meta/recipes-support/vim/files/racefix.patch b/meta/recipes-support/vim/files/racefix.patch
index 48dca44cad..1cb8fb442f 100644
--- a/meta/recipes-support/vim/files/racefix.patch
+++ b/meta/recipes-support/vim/files/racefix.patch
@@ -9,9 +9,9 @@ Index: git/src/po/Makefile
9=================================================================== 9===================================================================
10--- git.orig/src/po/Makefile 10--- git.orig/src/po/Makefile
11+++ git/src/po/Makefile 11+++ git/src/po/Makefile
12@@ -165,17 +165,16 @@ $(PACKAGE).pot: ../*.c ../if_perl.xs ../ 12@@ -207,17 +207,16 @@ $(PACKAGE).pot: $(PO_INPUTLIST) $(PO_VIM
13 po/gvim.desktop.in po/vim.desktop.in 13 # Delete the temporary files
14 mv -f ../$(PACKAGE).po $(PACKAGE).pot 14 rm *.js
15 15
16-vim.desktop: vim.desktop.in $(POFILES) 16-vim.desktop: vim.desktop.in $(POFILES)
17+LINGUAS: 17+LINGUAS:
diff --git a/meta/recipes-support/vim/files/vim-add-knob-whether-elf.h-are-checked.patch b/meta/recipes-support/vim/files/vim-add-knob-whether-elf.h-are-checked.patch
index 37914d4cd9..5284ba45b6 100644
--- a/meta/recipes-support/vim/files/vim-add-knob-whether-elf.h-are-checked.patch
+++ b/meta/recipes-support/vim/files/vim-add-knob-whether-elf.h-are-checked.patch
@@ -14,11 +14,11 @@ Signed-off-by: Changqing Li <changqing.li@windriver.com>
14 src/configure.ac | 7 +++++++ 14 src/configure.ac | 7 +++++++
15 1 file changed, 7 insertions(+) 15 1 file changed, 7 insertions(+)
16 16
17diff --git a/src/configure.ac b/src/configure.ac 17Index: git/src/configure.ac
18index 0ee86ad..64736f0 100644 18===================================================================
19--- a/src/configure.ac 19--- git.orig/src/configure.ac
20+++ b/src/configure.ac 20+++ git/src/configure.ac
21@@ -3192,11 +3192,18 @@ AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));], 21@@ -3264,11 +3264,18 @@ AC_TRY_COMPILE([#include <stdio.h>], [in
22 AC_MSG_RESULT(no)) 22 AC_MSG_RESULT(no))
23 23
24 dnl Checks for header files. 24 dnl Checks for header files.
@@ -37,6 +37,3 @@ index 0ee86ad..64736f0 100644
37 37
38 AC_HEADER_DIRENT 38 AC_HEADER_DIRENT
39 39
40--
412.7.4
42
diff --git a/meta/recipes-support/vim/vim.inc b/meta/recipes-support/vim/vim.inc
index 943856e07c..087153c1d6 100644
--- a/meta/recipes-support/vim/vim.inc
+++ b/meta/recipes-support/vim/vim.inc
@@ -8,8 +8,10 @@ BUGTRACKER = "https://github.com/vim/vim/issues"
8DEPENDS = "ncurses gettext-native" 8DEPENDS = "ncurses gettext-native"
9# vimdiff doesn't like busybox diff 9# vimdiff doesn't like busybox diff
10RSUGGESTS:${PN} = "diffutils" 10RSUGGESTS:${PN} = "diffutils"
11
11LICENSE = "vim" 12LICENSE = "vim"
12LIC_FILES_CHKSUM = "file://runtime/doc/uganda.txt;endline=287;md5=a19edd7ec70d573a005d9e509375a99a" 13LIC_FILES_CHKSUM = "file://LICENSE;md5=6b30ea4fa660c483b619924bc709ef99 \
14 file://runtime/doc/uganda.txt;md5=daf48235bb824c77fe8ae88d5f575f74"
13 15
14SRC_URI = "git://github.com/vim/vim.git;branch=master;protocol=https \ 16SRC_URI = "git://github.com/vim/vim.git;branch=master;protocol=https \
15 file://disable_acl_header_check.patch \ 17 file://disable_acl_header_check.patch \
@@ -17,15 +19,10 @@ SRC_URI = "git://github.com/vim/vim.git;branch=master;protocol=https \
17 file://0001-src-Makefile-improve-reproducibility.patch \ 19 file://0001-src-Makefile-improve-reproducibility.patch \
18 file://no-path-adjust.patch \ 20 file://no-path-adjust.patch \
19 file://racefix.patch \ 21 file://racefix.patch \
20 file://b7081e135a16091c93f6f5f7525a5c58fb7ca9f9.patch \
21 file://CVE-2021-3778.patch \
22 file://0002-patch-8.2.3428-using-freed-memory-when-replacing.patch \
23 file://0003-patch-8.2.3487-illegal-memory-access-if-buffer-name-.patch \
24 file://0004-patch-8.2.3489-ml_get-error-after-search-with-range.patch \
25 file://0005-patch-8.2.3564-invalid-memory-access-when-scrolling-.patch \
26 " 22 "
27 23
28SRCREV = "98056533b96b6b5d8849641de93185dd7bcadc44" 24PV .= ".4912"
25SRCREV = "a7583c42cd6b64fd276a5d7bb0db5ce7bfafa730"
29 26
30# Do not consider .z in x.y.z, as that is updated with every commit 27# Do not consider .z in x.y.z, as that is updated with every commit
31UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+\.\d+)\.0" 28UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+\.\d+)\.0"
diff --git a/scripts/buildhistory-diff b/scripts/buildhistory-diff
index 3bd40a2a1e..a6e785aa23 100755
--- a/scripts/buildhistory-diff
+++ b/scripts/buildhistory-diff
@@ -11,7 +11,6 @@
11import sys 11import sys
12import os 12import os
13import argparse 13import argparse
14from distutils.version import LooseVersion
15 14
16# Ensure PythonGit is installed (buildhistory_analysis needs it) 15# Ensure PythonGit is installed (buildhistory_analysis needs it)
17try: 16try:
@@ -73,10 +72,6 @@ def main():
73 parser = get_args_parser() 72 parser = get_args_parser()
74 args = parser.parse_args() 73 args = parser.parse_args()
75 74
76 if LooseVersion(git.__version__) < '0.3.1':
77 sys.stderr.write("Version of GitPython is too old, please install GitPython (python-git) 0.3.1 or later in order to use this script\n")
78 sys.exit(1)
79
80 if len(args.revisions) > 2: 75 if len(args.revisions) > 2:
81 sys.stderr.write('Invalid argument(s) specified: %s\n\n' % ' '.join(args.revisions[2:])) 76 sys.stderr.write('Invalid argument(s) specified: %s\n\n' % ' '.join(args.revisions[2:]))
82 parser.print_help() 77 parser.print_help()
diff --git a/scripts/git b/scripts/git
new file mode 100755
index 0000000000..644055e540
--- /dev/null
+++ b/scripts/git
@@ -0,0 +1,26 @@
1#!/usr/bin/env python3
2#
3# Wrapper around 'git' that doesn't think we are root
4
5import os
6import shutil
7import sys
8
9os.environ['PSEUDO_UNLOAD'] = '1'
10
11# calculate path to the real 'git'
12path = os.environ['PATH']
13# we need to remove our path but also any other copy of this script which
14# may be present, e.g. eSDK.
15replacements = [os.path.dirname(sys.argv[0])]
16for p in path.split(":"):
17 if p.endswith("/scripts"):
18 replacements.append(p)
19for r in replacements:
20 path = path.replace(r, '/ignoreme')
21real_git = shutil.which('git', path=path)
22
23if len(sys.argv) == 1:
24 os.execl(real_git, 'git')
25
26os.execv(real_git, sys.argv)
diff --git a/scripts/lib/checklayer/cases/common.py b/scripts/lib/checklayer/cases/common.py
index b82304e361..4495f71b24 100644
--- a/scripts/lib/checklayer/cases/common.py
+++ b/scripts/lib/checklayer/cases/common.py
@@ -14,7 +14,7 @@ class CommonCheckLayer(OECheckLayerTestCase):
14 # The top-level README file may have a suffix (like README.rst or README.txt). 14 # The top-level README file may have a suffix (like README.rst or README.txt).
15 readme_files = glob.glob(os.path.join(self.tc.layer['path'], '[Rr][Ee][Aa][Dd][Mm][Ee]*')) 15 readme_files = glob.glob(os.path.join(self.tc.layer['path'], '[Rr][Ee][Aa][Dd][Mm][Ee]*'))
16 self.assertTrue(len(readme_files) > 0, 16 self.assertTrue(len(readme_files) > 0,
17 msg="Layer doesn't contains README file.") 17 msg="Layer doesn't contain a README file.")
18 18
19 # There might be more than one file matching the file pattern above 19 # There might be more than one file matching the file pattern above
20 # (for example, README.rst and README-COPYING.rst). The one with the shortest 20 # (for example, README.rst and README-COPYING.rst). The one with the shortest
diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
index 833322571f..e14a587417 100644
--- a/scripts/lib/devtool/deploy.py
+++ b/scripts/lib/devtool/deploy.py
@@ -170,7 +170,7 @@ def deploy(args, config, basepath, workspace):
170 srcdir = recipe_outdir 170 srcdir = recipe_outdir
171 recipe_outdir = os.path.join(rd.getVar('WORKDIR'), 'devtool-deploy-target-stripped') 171 recipe_outdir = os.path.join(rd.getVar('WORKDIR'), 'devtool-deploy-target-stripped')
172 if os.path.isdir(recipe_outdir): 172 if os.path.isdir(recipe_outdir):
173 bb.utils.remove(recipe_outdir, True) 173 exec_fakeroot(rd, "rm -rf %s" % recipe_outdir, shell=True)
174 exec_fakeroot(rd, "cp -af %s %s" % (os.path.join(srcdir, '.'), recipe_outdir), shell=True) 174 exec_fakeroot(rd, "cp -af %s %s" % (os.path.join(srcdir, '.'), recipe_outdir), shell=True)
175 os.environ['PATH'] = ':'.join([os.environ['PATH'], rd.getVar('PATH') or '']) 175 os.environ['PATH'] = ':'.join([os.environ['PATH'], rd.getVar('PATH') or ''])
176 oe.package.strip_execs(args.recipename, recipe_outdir, rd.getVar('STRIP'), rd.getVar('libdir'), 176 oe.package.strip_execs(args.recipename, recipe_outdir, rd.getVar('STRIP'), rd.getVar('libdir'),
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index 826a3f955f..0357ec07bf 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -192,14 +192,15 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, srcbranch, branch, kee
192 get_branch = [x.strip() for x in check_branch.splitlines()] 192 get_branch = [x.strip() for x in check_branch.splitlines()]
193 # Remove HEAD reference point and drop remote prefix 193 # Remove HEAD reference point and drop remote prefix
194 get_branch = [x.split('/', 1)[1] for x in get_branch if not x.startswith('origin/HEAD')] 194 get_branch = [x.split('/', 1)[1] for x in get_branch if not x.startswith('origin/HEAD')]
195 if 'master' in get_branch: 195 if len(get_branch) == 1:
196 # If it is master, we do not need to append 'branch=master' as this is default. 196 # If srcrev is on only ONE branch, then use that branch
197 # Even with the case where get_branch has multiple objects, if 'master' is one
198 # of them, we should default take from 'master'
199 srcbranch = ''
200 elif len(get_branch) == 1:
201 # If 'master' isn't in get_branch and get_branch contains only ONE object, then store result into 'srcbranch'
202 srcbranch = get_branch[0] 197 srcbranch = get_branch[0]
198 elif 'main' in get_branch:
199 # If srcrev is on multiple branches, then choose 'main' if it is one of them
200 srcbranch = 'main'
201 elif 'master' in get_branch:
202 # Otherwise choose 'master' if it is one of the branches
203 srcbranch = 'master'
203 else: 204 else:
204 # If get_branch contains more than one objects, then display error and exit. 205 # If get_branch contains more than one objects, then display error and exit.
205 mbrch = '\n ' + '\n '.join(get_branch) 206 mbrch = '\n ' + '\n '.join(get_branch)
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index a6607b97c6..b4b1f817f1 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -366,7 +366,7 @@ def supports_srcrev(uri):
366def reformat_git_uri(uri): 366def reformat_git_uri(uri):
367 '''Convert any http[s]://....git URI into git://...;protocol=http[s]''' 367 '''Convert any http[s]://....git URI into git://...;protocol=http[s]'''
368 checkuri = uri.split(';', 1)[0] 368 checkuri = uri.split(';', 1)[0]
369 if checkuri.endswith('.git') or '/git/' in checkuri or re.match('https?://github.com/[^/]+/[^/]+/?$', checkuri): 369 if checkuri.endswith('.git') or '/git/' in checkuri or re.match('https?://git(hub|lab).com/[^/]+/[^/]+/?$', checkuri):
370 # Appends scheme if the scheme is missing 370 # Appends scheme if the scheme is missing
371 if not '://' in uri: 371 if not '://' in uri:
372 uri = 'git://' + uri 372 uri = 'git://' + uri
@@ -389,9 +389,6 @@ def reformat_git_uri(uri):
389 parms.update({('protocol', 'ssh')}) 389 parms.update({('protocol', 'ssh')})
390 elif (scheme == "http" or scheme == 'https' or scheme == 'ssh') and not ('protocol' in parms): 390 elif (scheme == "http" or scheme == 'https' or scheme == 'ssh') and not ('protocol' in parms):
391 parms.update({('protocol', scheme)}) 391 parms.update({('protocol', scheme)})
392 # We assume 'master' branch if not set
393 if not 'branch' in parms:
394 parms.update({('branch', 'master')})
395 # Always append 'git://' 392 # Always append 'git://'
396 fUrl = bb.fetch2.encodeurl(('git', host, path, user, pswd, parms)) 393 fUrl = bb.fetch2.encodeurl(('git', host, path, user, pswd, parms))
397 return fUrl 394 return fUrl
@@ -438,7 +435,7 @@ def create_recipe(args):
438 if args.binary: 435 if args.binary:
439 # Assume the archive contains the directory structure verbatim 436 # Assume the archive contains the directory structure verbatim
440 # so we need to extract to a subdirectory 437 # so we need to extract to a subdirectory
441 fetchuri += ';subdir=${BP}' 438 fetchuri += ';subdir=${BPN}'
442 srcuri = fetchuri 439 srcuri = fetchuri
443 rev_re = re.compile(';rev=([^;]+)') 440 rev_re = re.compile(';rev=([^;]+)')
444 res = rev_re.search(srcuri) 441 res = rev_re.search(srcuri)
@@ -481,6 +478,9 @@ def create_recipe(args):
481 storeTagName = params['tag'] 478 storeTagName = params['tag']
482 params['nobranch'] = '1' 479 params['nobranch'] = '1'
483 del params['tag'] 480 del params['tag']
481 # Assume 'master' branch if not set
482 if scheme in ['git', 'gitsm'] and 'branch' not in params and 'nobranch' not in params:
483 params['branch'] = 'master'
484 fetchuri = bb.fetch2.encodeurl((scheme, network, path, user, passwd, params)) 484 fetchuri = bb.fetch2.encodeurl((scheme, network, path, user, passwd, params))
485 485
486 tmpparent = tinfoil.config_data.getVar('BASE_WORKDIR') 486 tmpparent = tinfoil.config_data.getVar('BASE_WORKDIR')
@@ -530,10 +530,9 @@ def create_recipe(args):
530 # Remove HEAD reference point and drop remote prefix 530 # Remove HEAD reference point and drop remote prefix
531 get_branch = [x.split('/', 1)[1] for x in get_branch if not x.startswith('origin/HEAD')] 531 get_branch = [x.split('/', 1)[1] for x in get_branch if not x.startswith('origin/HEAD')]
532 if 'master' in get_branch: 532 if 'master' in get_branch:
533 # If it is master, we do not need to append 'branch=master' as this is default.
534 # Even with the case where get_branch has multiple objects, if 'master' is one 533 # Even with the case where get_branch has multiple objects, if 'master' is one
535 # of them, we should default take from 'master' 534 # of them, we should default take from 'master'
536 srcbranch = '' 535 srcbranch = 'master'
537 elif len(get_branch) == 1: 536 elif len(get_branch) == 1:
538 # If 'master' isn't in get_branch and get_branch contains only ONE object, then store result into 'srcbranch' 537 # If 'master' isn't in get_branch and get_branch contains only ONE object, then store result into 'srcbranch'
539 srcbranch = get_branch[0] 538 srcbranch = get_branch[0]
@@ -546,8 +545,8 @@ def create_recipe(args):
546 # Since we might have a value in srcbranch, we need to 545 # Since we might have a value in srcbranch, we need to
547 # recontruct the srcuri to include 'branch' in params. 546 # recontruct the srcuri to include 'branch' in params.
548 scheme, network, path, user, passwd, params = bb.fetch2.decodeurl(srcuri) 547 scheme, network, path, user, passwd, params = bb.fetch2.decodeurl(srcuri)
549 if srcbranch: 548 if scheme in ['git', 'gitsm']:
550 params['branch'] = srcbranch 549 params['branch'] = srcbranch or 'master'
551 550
552 if storeTagName and scheme in ['git', 'gitsm']: 551 if storeTagName and scheme in ['git', 'gitsm']:
553 # Check srcrev using tag and check validity of the tag 552 # Check srcrev using tag and check validity of the tag
@@ -606,7 +605,7 @@ def create_recipe(args):
606 splitline = line.split() 605 splitline = line.split()
607 if len(splitline) > 1: 606 if len(splitline) > 1:
608 if splitline[0] == 'origin' and scriptutils.is_src_url(splitline[1]): 607 if splitline[0] == 'origin' and scriptutils.is_src_url(splitline[1]):
609 srcuri = reformat_git_uri(splitline[1]) 608 srcuri = reformat_git_uri(splitline[1]) + ';branch=master'
610 srcsubdir = 'git' 609 srcsubdir = 'git'
611 break 610 break
612 611
diff --git a/scripts/lib/recipetool/create_buildsys.py b/scripts/lib/recipetool/create_buildsys.py
index 35a97c9345..5015634476 100644
--- a/scripts/lib/recipetool/create_buildsys.py
+++ b/scripts/lib/recipetool/create_buildsys.py
@@ -545,7 +545,7 @@ class AutotoolsRecipeHandler(RecipeHandler):
545 deps.append('zlib') 545 deps.append('zlib')
546 elif keyword in ('AX_CHECK_OPENSSL', 'AX_LIB_CRYPTO'): 546 elif keyword in ('AX_CHECK_OPENSSL', 'AX_LIB_CRYPTO'):
547 deps.append('openssl') 547 deps.append('openssl')
548 elif keyword == 'AX_LIB_CURL': 548 elif keyword in ('AX_LIB_CURL', 'LIBCURL_CHECK_CONFIG'):
549 deps.append('curl') 549 deps.append('curl')
550 elif keyword == 'AX_LIB_BEECRYPT': 550 elif keyword == 'AX_LIB_BEECRYPT':
551 deps.append('beecrypt') 551 deps.append('beecrypt')
@@ -624,6 +624,7 @@ class AutotoolsRecipeHandler(RecipeHandler):
624 'AX_CHECK_OPENSSL', 624 'AX_CHECK_OPENSSL',
625 'AX_LIB_CRYPTO', 625 'AX_LIB_CRYPTO',
626 'AX_LIB_CURL', 626 'AX_LIB_CURL',
627 'LIBCURL_CHECK_CONFIG',
627 'AX_LIB_BEECRYPT', 628 'AX_LIB_BEECRYPT',
628 'AX_LIB_EXPAT', 629 'AX_LIB_EXPAT',
629 'AX_LIB_GCRYPT', 630 'AX_LIB_GCRYPT',
diff --git a/scripts/lib/scriptutils.py b/scripts/lib/scriptutils.py
index 3164171eb2..47a08194d0 100644
--- a/scripts/lib/scriptutils.py
+++ b/scripts/lib/scriptutils.py
@@ -18,7 +18,8 @@ import sys
18import tempfile 18import tempfile
19import threading 19import threading
20import importlib 20import importlib
21from importlib import machinery 21import importlib.machinery
22import importlib.util
22 23
23class KeepAliveStreamHandler(logging.StreamHandler): 24class KeepAliveStreamHandler(logging.StreamHandler):
24 def __init__(self, keepalive=True, **kwargs): 25 def __init__(self, keepalive=True, **kwargs):
@@ -82,7 +83,9 @@ def load_plugins(logger, plugins, pluginpath):
82 logger.debug('Loading plugin %s' % name) 83 logger.debug('Loading plugin %s' % name)
83 spec = importlib.machinery.PathFinder.find_spec(name, path=[pluginpath] ) 84 spec = importlib.machinery.PathFinder.find_spec(name, path=[pluginpath] )
84 if spec: 85 if spec:
85 return spec.loader.load_module() 86 mod = importlib.util.module_from_spec(spec)
87 spec.loader.exec_module(mod)
88 return mod
86 89
87 def plugin_name(filename): 90 def plugin_name(filename):
88 return os.path.splitext(os.path.basename(filename))[0] 91 return os.path.splitext(os.path.basename(filename))[0]
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index 018815b966..674ccfc244 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -19,10 +19,10 @@ import os
19import tempfile 19import tempfile
20import json 20import json
21import subprocess 21import subprocess
22import shutil
22import re 23import re
23 24
24from collections import namedtuple, OrderedDict 25from collections import namedtuple, OrderedDict
25from distutils.spawn import find_executable
26 26
27from wic import WicError 27from wic import WicError
28from wic.filemap import sparse_copy 28from wic.filemap import sparse_copy
@@ -245,7 +245,7 @@ class Disk:
245 for path in pathlist.split(':'): 245 for path in pathlist.split(':'):
246 self.paths = "%s%s:%s" % (native_sysroot, path, self.paths) 246 self.paths = "%s%s:%s" % (native_sysroot, path, self.paths)
247 247
248 self.parted = find_executable("parted", self.paths) 248 self.parted = shutil.which("parted", path=self.paths)
249 if not self.parted: 249 if not self.parted:
250 raise WicError("Can't find executable parted") 250 raise WicError("Can't find executable parted")
251 251
@@ -283,7 +283,7 @@ class Disk:
283 "resize2fs", "mkswap", "mkdosfs", "debugfs","blkid"): 283 "resize2fs", "mkswap", "mkdosfs", "debugfs","blkid"):
284 aname = "_%s" % name 284 aname = "_%s" % name
285 if aname not in self.__dict__: 285 if aname not in self.__dict__:
286 setattr(self, aname, find_executable(name, self.paths)) 286 setattr(self, aname, shutil.which(name, path=self.paths))
287 if aname not in self.__dict__ or self.__dict__[aname] is None: 287 if aname not in self.__dict__ or self.__dict__[aname] is None:
288 raise WicError("Can't find executable '{}'".format(name)) 288 raise WicError("Can't find executable '{}'".format(name))
289 return self.__dict__[aname] 289 return self.__dict__[aname]
diff --git a/scripts/lib/wic/misc.py b/scripts/lib/wic/misc.py
index 57c042c503..3e11822996 100644
--- a/scripts/lib/wic/misc.py
+++ b/scripts/lib/wic/misc.py
@@ -16,9 +16,9 @@ import logging
16import os 16import os
17import re 17import re
18import subprocess 18import subprocess
19import shutil
19 20
20from collections import defaultdict 21from collections import defaultdict
21from distutils import spawn
22 22
23from wic import WicError 23from wic import WicError
24 24
@@ -122,7 +122,7 @@ def find_executable(cmd, paths):
122 if provided and "%s-native" % recipe in provided: 122 if provided and "%s-native" % recipe in provided:
123 return True 123 return True
124 124
125 return spawn.find_executable(cmd, paths) 125 return shutil.which(cmd, path=paths)
126 126
127def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""): 127def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""):
128 """ 128 """
diff --git a/scripts/lib/wic/pluginbase.py b/scripts/lib/wic/pluginbase.py
index d9b4e57747..b64568339b 100644
--- a/scripts/lib/wic/pluginbase.py
+++ b/scripts/lib/wic/pluginbase.py
@@ -9,9 +9,11 @@ __all__ = ['ImagerPlugin', 'SourcePlugin']
9 9
10import os 10import os
11import logging 11import logging
12import types
12 13
13from collections import defaultdict 14from collections import defaultdict
14from importlib.machinery import SourceFileLoader 15import importlib
16import importlib.util
15 17
16from wic import WicError 18from wic import WicError
17from wic.misc import get_bitbake_var 19from wic.misc import get_bitbake_var
@@ -54,7 +56,9 @@ class PluginMgr:
54 mname = fname[:-3] 56 mname = fname[:-3]
55 mpath = os.path.join(ppath, fname) 57 mpath = os.path.join(ppath, fname)
56 logger.debug("loading plugin module %s", mpath) 58 logger.debug("loading plugin module %s", mpath)
57 SourceFileLoader(mname, mpath).load_module() 59 spec = importlib.util.spec_from_file_location(mname, mpath)
60 module = importlib.util.module_from_spec(spec)
61 spec.loader.exec_module(module)
58 62
59 return PLUGINS.get(ptype) 63 return PLUGINS.get(ptype)
60 64
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index 495518fac8..e57fba9c12 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -259,6 +259,8 @@ class DirectPlugin(ImagerPlugin):
259 if part.mountpoint == "/": 259 if part.mountpoint == "/":
260 if part.uuid: 260 if part.uuid:
261 return "PARTUUID=%s" % part.uuid 261 return "PARTUUID=%s" % part.uuid
262 elif part.label:
263 return "PARTLABEL=%s" % part.label
262 else: 264 else:
263 suffix = 'p' if part.disk.startswith('mmcblk') else '' 265 suffix = 'p' if part.disk.startswith('mmcblk') else ''
264 return "/dev/%s%s%-d" % (part.disk, suffix, part.realnum) 266 return "/dev/%s%s%-d" % (part.disk, suffix, part.realnum)
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
index 2e34e715ca..25bb41dd70 100644
--- a/scripts/lib/wic/plugins/source/rootfs.py
+++ b/scripts/lib/wic/plugins/source/rootfs.py
@@ -50,7 +50,7 @@ class RootfsPlugin(SourcePlugin):
50 50
51 @staticmethod 51 @staticmethod
52 def __get_rootfs_dir(rootfs_dir): 52 def __get_rootfs_dir(rootfs_dir):
53 if os.path.isdir(rootfs_dir): 53 if rootfs_dir and os.path.isdir(rootfs_dir):
54 return os.path.realpath(rootfs_dir) 54 return os.path.realpath(rootfs_dir)
55 55
56 image_rootfs_dir = get_bitbake_var("IMAGE_ROOTFS", rootfs_dir) 56 image_rootfs_dir = get_bitbake_var("IMAGE_ROOTFS", rootfs_dir)
@@ -97,6 +97,9 @@ class RootfsPlugin(SourcePlugin):
97 part.has_fstab = os.path.exists(os.path.join(part.rootfs_dir, "etc/fstab")) 97 part.has_fstab = os.path.exists(os.path.join(part.rootfs_dir, "etc/fstab"))
98 pseudo_dir = os.path.join(part.rootfs_dir, "../pseudo") 98 pseudo_dir = os.path.join(part.rootfs_dir, "../pseudo")
99 if not os.path.lexists(pseudo_dir): 99 if not os.path.lexists(pseudo_dir):
100 pseudo_dir = os.path.join(cls.__get_rootfs_dir(None), '../pseudo')
101
102 if not os.path.lexists(pseudo_dir):
100 logger.warn("%s folder does not exist. " 103 logger.warn("%s folder does not exist. "
101 "Usernames and permissions will be invalid " % pseudo_dir) 104 "Usernames and permissions will be invalid " % pseudo_dir)
102 pseudo_dir = None 105 pseudo_dir = None
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index 71656dadce..7412cc1f47 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -296,7 +296,7 @@ def package_info(args):
296 extra = '' 296 extra = ''
297 for line in f: 297 for line in f:
298 for var in vars: 298 for var in vars:
299 m = re.match(var + '(?:_\S+)?:\s*(.+?)\s*$', line) 299 m = re.match(var + '(?::\S+)?:\s*(.+?)\s*$', line)
300 if m: 300 if m:
301 vals[var] = m.group(1) 301 vals[var] = m.group(1)
302 pkg_version = vals['PKGV'] or '' 302 pkg_version = vals['PKGV'] or ''
diff --git a/scripts/runqemu b/scripts/runqemu
index c467b0eb19..1663fd829d 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -805,7 +805,7 @@ class BaseConfig(object):
805 self.set('QB_MEM', qb_mem) 805 self.set('QB_MEM', qb_mem)
806 806
807 mach = self.get('MACHINE') 807 mach = self.get('MACHINE')
808 if not mach.startswith('qemumips'): 808 if not mach.startswith(('qemumips', 'qemux86')):
809 self.kernel_cmdline_script += ' mem=%s' % self.get('QB_MEM').replace('-m','').strip() + 'M' 809 self.kernel_cmdline_script += ' mem=%s' % self.get('QB_MEM').replace('-m','').strip() + 'M'
810 810
811 self.qemu_opt_script += ' %s' % self.get('QB_MEM') 811 self.qemu_opt_script += ' %s' % self.get('QB_MEM')
@@ -1580,7 +1580,8 @@ def main():
1580 1580
1581 def sigterm_handler(signum, frame): 1581 def sigterm_handler(signum, frame):
1582 logger.info("SIGTERM received") 1582 logger.info("SIGTERM received")
1583 os.kill(config.qemupid, signal.SIGTERM) 1583 if config.qemupid:
1584 os.kill(config.qemupid, signal.SIGTERM)
1584 config.cleanup() 1585 config.cleanup()
1585 # Deliberately ignore the return code of 'tput smam'. 1586 # Deliberately ignore the return code of 'tput smam'.
1586 subprocess.call(["tput", "smam"]) 1587 subprocess.call(["tput", "smam"])
diff --git a/scripts/runqemu-ifdown b/scripts/runqemu-ifdown
index a104c37bf8..e0eb5344c6 100755
--- a/scripts/runqemu-ifdown
+++ b/scripts/runqemu-ifdown
@@ -64,3 +64,4 @@ n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ]
64dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ] 64dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ]
65$IPTABLES -D POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32 65$IPTABLES -D POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32
66$IPTABLES -D POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$dest/32 66$IPTABLES -D POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$dest/32
67true
diff --git a/scripts/wic b/scripts/wic
index 57197c2048..aee63a45aa 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -22,9 +22,9 @@ import sys
22import argparse 22import argparse
23import logging 23import logging
24import subprocess 24import subprocess
25import shutil
25 26
26from collections import namedtuple 27from collections import namedtuple
27from distutils import spawn
28 28
29# External modules 29# External modules
30scripts_path = os.path.dirname(os.path.realpath(__file__)) 30scripts_path = os.path.dirname(os.path.realpath(__file__))
@@ -47,7 +47,7 @@ if os.environ.get('SDKTARGETSYSROOT'):
47 break 47 break
48 sdkroot = os.path.dirname(sdkroot) 48 sdkroot = os.path.dirname(sdkroot)
49 49
50bitbake_exe = spawn.find_executable('bitbake') 50bitbake_exe = shutil.which('bitbake')
51if bitbake_exe: 51if bitbake_exe:
52 bitbake_path = scriptpath.add_bitbake_lib_path() 52 bitbake_path = scriptpath.add_bitbake_lib_path()
53 import bb 53 import bb
@@ -159,6 +159,9 @@ def wic_create_subcommand(options, usage_str):
159 "(Use -e/--image-name to specify it)") 159 "(Use -e/--image-name to specify it)")
160 native_sysroot = options.native_sysroot 160 native_sysroot = options.native_sysroot
161 161
162 if options.kernel_dir:
163 kernel_dir = options.kernel_dir
164
162 if not options.vars_dir and (not native_sysroot or not os.path.isdir(native_sysroot)): 165 if not options.vars_dir and (not native_sysroot or not os.path.isdir(native_sysroot)):
163 logger.info("Building wic-tools...\n") 166 logger.info("Building wic-tools...\n")
164 subprocess.check_call(["bitbake", "wic-tools"]) 167 subprocess.check_call(["bitbake", "wic-tools"])
diff --git a/scripts/yocto-check-layer b/scripts/yocto-check-layer
index 2445ad5e43..f3cf139d8a 100755
--- a/scripts/yocto-check-layer
+++ b/scripts/yocto-check-layer
@@ -41,6 +41,12 @@ def test_layer(td, layer, test_software_layer_signatures):
41 tc.loadTests(CASES_PATHS) 41 tc.loadTests(CASES_PATHS)
42 return tc.runTests() 42 return tc.runTests()
43 43
44def dump_layer_debug(layer):
45 logger.debug("Found layer %s (%s)" % (layer["name"], layer["path"]))
46 collections = layer.get("collections", {})
47 if collections:
48 logger.debug("%s collections: %s" % (layer["name"], ", ".join(collections)))
49
44def main(): 50def main():
45 parser = argparse.ArgumentParser( 51 parser = argparse.ArgumentParser(
46 description="Yocto Project layer checking tool", 52 description="Yocto Project layer checking tool",
@@ -106,6 +112,13 @@ def main():
106 else: 112 else:
107 dep_layers = layers 113 dep_layers = layers
108 114
115 logger.debug("Found additional layers:")
116 for l in additional_layers:
117 dump_layer_debug(l)
118 logger.debug("Found dependency layers:")
119 for l in dep_layers:
120 dump_layer_debug(l)
121
109 logger.info("Detected layers:") 122 logger.info("Detected layers:")
110 for layer in layers: 123 for layer in layers:
111 if layer['type'] == LayerType.ERROR_BSP_DISTRO: 124 if layer['type'] == LayerType.ERROR_BSP_DISTRO: