summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbitbake/bin/bitbake-server2
-rw-r--r--bitbake/lib/bb/__init__.py2
-rw-r--r--bitbake/lib/bb/cache.py4
-rw-r--r--bitbake/lib/bb/cooker.py14
-rw-r--r--bitbake/lib/bb/data_smart.py16
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py5
-rw-r--r--bitbake/lib/bb/fetch2/git.py48
-rw-r--r--bitbake/lib/bb/fetch2/wget.py2
-rw-r--r--bitbake/lib/bb/parse/ast.py2
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py2
-rw-r--r--bitbake/lib/bb/parse/parse_py/ConfHandler.py2
-rw-r--r--bitbake/lib/bb/providers.py4
-rw-r--r--bitbake/lib/bb/runqueue.py11
-rw-r--r--bitbake/lib/bb/server/process.py2
-rw-r--r--bitbake/lib/bb/tests/codeparser.py4
-rw-r--r--bitbake/lib/bb/tests/fetch.py38
-rw-r--r--documentation/conf.py21
-rw-r--r--documentation/poky.yaml12
-rw-r--r--documentation/releases.rst16
-rw-r--r--meta-poky/conf/distro/poky.conf2
-rw-r--r--meta-selftest/lib/pseudo_pyc_test1.py1
-rw-r--r--meta-selftest/lib/pseudo_pyc_test2.py1
-rw-r--r--meta-selftest/recipes-test/pseudo-pyc-test/pseudo-pyc-test.bb15
-rw-r--r--meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.4.bbappend8
-rw-r--r--meta/classes/archiver.bbclass1
-rw-r--r--meta/classes/base.bbclass1
-rw-r--r--meta/classes/buildhistory.bbclass5
-rw-r--r--meta/classes/cve-check.bbclass44
-rw-r--r--meta/classes/devshell.bbclass1
-rw-r--r--meta/classes/distutils-common-base.bbclass2
-rw-r--r--meta/classes/distutils3-base.bbclass2
-rw-r--r--meta/classes/externalsrc.bbclass18
-rw-r--r--meta/classes/go.bbclass1
-rw-r--r--meta/classes/image-live.bbclass2
-rw-r--r--meta/classes/image.bbclass4
-rw-r--r--meta/classes/image_types.bbclass12
-rw-r--r--meta/classes/image_types_wic.bbclass10
-rw-r--r--meta/classes/insane.bbclass12
-rw-r--r--meta/classes/kernel-devicetree.bbclass11
-rw-r--r--meta/classes/kernel-module-split.bbclass5
-rw-r--r--meta/classes/kernel.bbclass4
-rw-r--r--meta/classes/license.bbclass1
-rw-r--r--meta/classes/license_image.bbclass6
-rw-r--r--meta/classes/linuxloader.bbclass6
-rw-r--r--meta/classes/npm.bbclass39
-rw-r--r--meta/classes/package.bbclass3
-rw-r--r--meta/classes/package_rpm.bbclass1
-rw-r--r--meta/classes/populate_sdk_base.bbclass9
-rw-r--r--meta/classes/populate_sdk_ext.bbclass13
-rw-r--r--meta/classes/python3native.bbclass2
-rw-r--r--meta/classes/python3targetconfig.bbclass17
-rw-r--r--meta/classes/report-error.bbclass4
-rw-r--r--meta/classes/rootfs_deb.bbclass4
-rw-r--r--meta/classes/sanity.bbclass41
-rw-r--r--meta/classes/scons.bbclass3
-rw-r--r--meta/classes/sstate.bbclass4
-rw-r--r--meta/classes/staging.bbclass4
-rw-r--r--meta/classes/systemd.bbclass3
-rw-r--r--meta/conf/abi_version.conf2
-rw-r--r--meta/conf/bitbake.conf10
-rw-r--r--meta/conf/distro/include/ptest-packagelists.inc2
-rw-r--r--meta/conf/distro/include/yocto-uninative.inc10
-rw-r--r--meta/conf/machine/include/qemu.inc2
-rw-r--r--meta/files/fs-perms-persistent-log.txt2
-rw-r--r--meta/files/fs-perms.txt2
-rw-r--r--meta/files/toolchain-shar-extract.sh12
-rw-r--r--meta/files/toolchain-shar-relocate.sh7
-rw-r--r--meta/lib/oe/copy_buildsystem.py6
-rw-r--r--meta/lib/oe/cve_check.py65
-rw-r--r--meta/lib/oe/package_manager/__init__.py2
-rw-r--r--meta/lib/oe/package_manager/deb/__init__.py6
-rw-r--r--meta/lib/oe/package_manager/deb/sdk.py4
-rw-r--r--meta/lib/oe/patch.py14
-rw-r--r--meta/lib/oe/path.py21
-rw-r--r--meta/lib/oe/prservice.py4
-rw-r--r--meta/lib/oe/recipeutils.py2
-rw-r--r--meta/lib/oe/reproducible.py2
-rw-r--r--meta/lib/oe/sstatesig.py8
-rw-r--r--meta/lib/oe/terminal.py16
-rw-r--r--meta/lib/oe/utils.py2
-rw-r--r--meta/lib/oeqa/manual/oe-core.json2
-rw-r--r--meta/lib/oeqa/runtime/cases/df.py2
-rw-r--r--meta/lib/oeqa/runtime/cases/pam.py3
-rw-r--r--meta/lib/oeqa/selftest/cases/buildoptions.py6
-rw-r--r--meta/lib/oeqa/selftest/cases/cve_check.py44
-rw-r--r--meta/lib/oeqa/selftest/cases/devtool.py4
-rw-r--r--meta/lib/oeqa/selftest/cases/pseudo.py27
-rw-r--r--meta/lib/oeqa/selftest/cases/reproducible.py7
-rw-r--r--meta/lib/oeqa/selftest/cases/tinfoil.py6
-rw-r--r--meta/lib/oeqa/selftest/cases/wic.py36
-rw-r--r--meta/lib/oeqa/selftest/context.py17
-rw-r--r--meta/lib/oeqa/utils/commands.py7
-rw-r--r--meta/recipes-bsp/grub/files/CVE-2020-14309-CVE-2020-14310-CVE-2020-14311-malloc-Use-overflow-checking-primitives-where-we-do-.patch2
-rw-r--r--meta/recipes-bsp/grub/files/determinism.patch56
-rw-r--r--meta/recipes-bsp/grub/grub2.inc1
-rw-r--r--meta/recipes-bsp/u-boot/u-boot-tools.inc15
-rw-r--r--meta/recipes-connectivity/bind/bind-9.16.7/CVE-2020-8625.patch29
-rw-r--r--meta/recipes-connectivity/bind/bind_9.16.7.bb1
-rw-r--r--meta/recipes-connectivity/connman/connman_1.39.bb (renamed from meta/recipes-connectivity/connman/connman_1.38.bb)3
-rw-r--r--meta/recipes-connectivity/kea/files/0001-src-lib-log-logger_unittest_support.cc-do-not-write-.patch27
-rw-r--r--meta/recipes-connectivity/kea/kea_1.7.10.bb29
-rw-r--r--meta/recipes-connectivity/mobile-broadband-provider-info/mobile-broadband-provider-info_git.bb4
-rw-r--r--meta/recipes-connectivity/openssh/openssh/0f90440ca70abab947acbd77795e9f130967956c.patch28
-rw-r--r--meta/recipes-connectivity/openssh/openssh/CVE-2020-14145.patch90
-rw-r--r--meta/recipes-connectivity/openssh/openssh_8.3p1.bb2
-rw-r--r--meta/recipes-connectivity/openssl/openssl_1.1.1k.bb (renamed from meta/recipes-connectivity/openssl/openssl_1.1.1g.bb)4
-rw-r--r--meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/CVE-2021-0326.patch45
-rw-r--r--meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/CVE-2021-27803.patch58
-rw-r--r--meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/CVE-2021-30004.patch123
-rw-r--r--meta/recipes-connectivity/wpa-supplicant/wpa-supplicant_2.9.bb3
-rw-r--r--meta/recipes-core/busybox/busybox/0001-decompress_gunzip-Fix-DoS-if-gzip-is-corrupt.patch58
-rw-r--r--meta/recipes-core/busybox/busybox_1.32.0.bb3
-rw-r--r--meta/recipes-core/coreutils/coreutils_8.32.bb6
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/CVE-2020-35457.patch41
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/CVE-2021-27219.patch1444
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0_2.64.5.bb2
-rw-r--r--meta/recipes-core/glib-2.0/glib.inc6
-rw-r--r--meta/recipes-core/glibc/glibc-version.inc2
-rw-r--r--meta/recipes-core/glibc/glibc/0031-linux-Allow-adjtime-with-NULL-argument-BZ-26833.patch110
-rw-r--r--meta/recipes-core/glibc/glibc/CVE-2020-29562.patch155
-rw-r--r--meta/recipes-core/glibc/glibc/CVE-2020-29573.patch56
-rw-r--r--meta/recipes-core/glibc/glibc_2.32.bb6
-rw-r--r--meta/recipes-core/images/build-appliance-image_15.0.0.bb12
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install-efi.sh5
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/checkroot.sh2
-rw-r--r--meta/recipes-core/meta/buildtools-extended-tarball.bb13
-rw-r--r--meta/recipes-core/meta/cve-update-db-native.bb21
-rw-r--r--meta/recipes-core/ncurses/ncurses.inc7
-rw-r--r--meta/recipes-core/ovmf/ovmf-shell-image.bb1
-rw-r--r--meta/recipes-core/systemd/systemd-boot_246.9.bb (renamed from meta/recipes-core/systemd/systemd-boot_246.2.bb)0
-rw-r--r--meta/recipes-core/systemd/systemd-conf/wired.network1
-rw-r--r--meta/recipes-core/systemd/systemd-conf_246.9.bb (renamed from meta/recipes-core/systemd/systemd-conf_246.1.bb)3
-rw-r--r--meta/recipes-core/systemd/systemd.inc2
-rw-r--r--meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch36
-rw-r--r--meta/recipes-core/systemd/systemd/0001-logind-Restore-chvt-as-non-root-user-without-polkit.patch227
-rw-r--r--meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch55
-rw-r--r--meta/recipes-core/systemd/systemd_246.9.bb (renamed from meta/recipes-core/systemd/systemd_246.6.bb)19
-rwxr-xr-xmeta/recipes-core/sysvinit/sysvinit/rc2
-rw-r--r--meta/recipes-core/udev/eudev/init2
-rw-r--r--meta/recipes-devtools/binutils/binutils-2.35.1.inc (renamed from meta/recipes-devtools/binutils/binutils-2.35.inc)9
-rw-r--r--meta/recipes-devtools/binutils/binutils-cross-canadian_2.35.1.bb (renamed from meta/recipes-devtools/binutils/binutils-cross-canadian_2.35.bb)0
-rw-r--r--meta/recipes-devtools/binutils/binutils-cross-testsuite_2.35.1.bb (renamed from meta/recipes-devtools/binutils/binutils-cross-testsuite_2.35.bb)0
-rw-r--r--meta/recipes-devtools/binutils/binutils-cross_2.35.1.bb (renamed from meta/recipes-devtools/binutils/binutils-cross_2.35.bb)0
-rw-r--r--meta/recipes-devtools/binutils/binutils-crosssdk_2.35.1.bb (renamed from meta/recipes-devtools/binutils/binutils-crosssdk_2.35.bb)0
-rw-r--r--meta/recipes-devtools/binutils/binutils/0001-aarch64-Return-an-error-on-conditional-branch-to-an-.patch135
-rw-r--r--meta/recipes-devtools/binutils/binutils/0001-gold-ensure-file_counts_lock-is-initialized-before-u.patch41
-rw-r--r--meta/recipes-devtools/binutils/binutils/CVE-2020-35448.patch85
-rw-r--r--meta/recipes-devtools/binutils/binutils_2.35.1.bb (renamed from meta/recipes-devtools/binutils/binutils_2.35.bb)0
-rw-r--r--meta/recipes-devtools/bison/bison/0001-Use-mapped-file-name-for-symbols.patch62
-rw-r--r--meta/recipes-devtools/bison/bison_3.7.2.bb1
-rw-r--r--meta/recipes-devtools/diffstat/diffstat_1.63.bb4
-rw-r--r--meta/recipes-devtools/e2fsprogs/e2fsprogs_1.45.6.bb2
-rw-r--r--meta/recipes-devtools/flex/flex/0001-Emit-no-line-directives-if-gen_line_dirs-is-false.patch32
-rw-r--r--meta/recipes-devtools/flex/flex_2.6.4.bb1
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.2.inc1
-rw-r--r--meta/recipes-devtools/gcc/gcc-sanitizers.inc7
-rw-r--r--meta/recipes-devtools/gcc/gcc/0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch208
-rw-r--r--meta/recipes-devtools/git/git.inc5
-rw-r--r--meta/recipes-devtools/git/git/CVE-2021-21300.patch304
-rw-r--r--meta/recipes-devtools/git/git/fixsort.patch31
-rw-r--r--meta/recipes-devtools/go/go-1.15.inc5
-rw-r--r--meta/recipes-devtools/go/go-binary-native_1.15.8.bb (renamed from meta/recipes-devtools/go/go-binary-native_1.15.2.bb)4
-rw-r--r--meta/recipes-devtools/go/go-runtime_1.15.bb1
-rw-r--r--meta/recipes-devtools/go/go_1.15.bb3
-rw-r--r--meta/recipes-devtools/libtool/libtool-2.4.6.inc1
-rw-r--r--meta/recipes-devtools/libtool/libtool/0001-Makefile.am-make-sure-autoheader-run-before-autoconf.patch35
-rw-r--r--meta/recipes-devtools/llvm/llvm_git.bb5
-rw-r--r--meta/recipes-devtools/mtd/mtd-utils_git.bb2
-rw-r--r--meta/recipes-devtools/opkg/opkg/sourcedateepoch.patch24
-rw-r--r--meta/recipes-devtools/opkg/opkg_0.4.3.bb1
-rw-r--r--meta/recipes-devtools/patch/patch/CVE-2019-20633.patch31
-rw-r--r--meta/recipes-devtools/patch/patch_2.7.6.bb1
-rw-r--r--meta/recipes-devtools/perl/perl_5.32.0.bb5
-rw-r--r--meta/recipes-devtools/pseudo/pseudo_git.bb2
-rw-r--r--meta/recipes-devtools/python/python3-jinja2_2.11.2.bb2
-rw-r--r--meta/recipes-devtools/python/python3-pycairo_1.19.1.bb2
-rw-r--r--meta/recipes-devtools/python/python3/CVE-2021-23336.patch548
-rw-r--r--meta/recipes-devtools/python/python3/CVE-2021-3177.patch191
-rw-r--r--meta/recipes-devtools/python/python3_3.8.5.bb19
-rw-r--r--meta/recipes-devtools/qemu/qemu.inc8
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2020-24352.patch52
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2020-25624.patch101
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2020-25723.patch51
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2020-28916.patch49
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2020-29129-CVE-2020-29130.patch64
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2020-29443.patch46
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2020-35517.patch126
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2021-20203.patch74
-rw-r--r--meta/recipes-devtools/quilt/quilt.inc2
-rw-r--r--meta/recipes-devtools/rsync/files/0001-rsync-ssl-Verify-the-hostname-in-the-certificate-whe.patch31
-rw-r--r--meta/recipes-devtools/rsync/files/determism.patch28
-rw-r--r--meta/recipes-devtools/rsync/rsync_3.2.3.bb4
-rw-r--r--meta/recipes-devtools/ruby/ruby/0001-template-Makefile.in-do-not-write-host-cross-cc-item.patch32
-rw-r--r--meta/recipes-devtools/ruby/ruby_2.7.1.bb1
-rwxr-xr-xmeta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts10
-rwxr-xr-xmeta/recipes-devtools/strace/strace/run-ptest2
-rw-r--r--meta/recipes-devtools/tcf-agent/tcf-agent_git.bb1
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0001-gdbserver_tests-Disable-nlcontrolc.vgtest-for-x86-64.patch36
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0001-helgrind-Intercept-libc-functions.patch54
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch9
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/remove-for-aarch642
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/remove-for-all2
-rwxr-xr-xmeta/recipes-devtools/valgrind/valgrind/run-ptest10
-rw-r--r--meta/recipes-devtools/valgrind/valgrind_3.16.1.bb4
-rw-r--r--meta/recipes-devtools/xmlto/xmlto_0.0.28.bb2
-rw-r--r--meta/recipes-extended/acpica/acpica_20200717.bb2
-rw-r--r--meta/recipes-extended/asciidoc/asciidoc_9.0.2.bb2
-rw-r--r--meta/recipes-extended/cups/cups.inc10
-rw-r--r--meta/recipes-extended/cups/cups/CVE-2020-10001.patch74
-rw-r--r--meta/recipes-extended/cwautomacros/cwautomacros_20110201.bb2
-rw-r--r--meta/recipes-extended/groff/files/0001-Include-config.h.patch1026
-rw-r--r--meta/recipes-extended/groff/groff_1.22.4.bb13
-rw-r--r--meta/recipes-extended/man-db/man-db_2.9.3.bb6
-rw-r--r--meta/recipes-extended/minicom/minicom_2.7.1.bb2
-rw-r--r--meta/recipes-extended/parted/parted_3.3.bb6
-rw-r--r--meta/recipes-extended/screen/screen/CVE-2021-26937.patch68
-rw-r--r--meta/recipes-extended/screen/screen_4.8.0.bb1
-rw-r--r--meta/recipes-extended/shadow/shadow_4.8.1.bb5
-rw-r--r--meta/recipes-extended/sudo/files/0001-sudo.conf.in-fix-conflict-with-multilib.patch52
-rw-r--r--meta/recipes-extended/sudo/files/CVE-2021-23239.patch62
-rw-r--r--meta/recipes-extended/sudo/files/CVE-2021-23240.patch419
-rw-r--r--meta/recipes-extended/sudo/files/CVE-2021-3156-1.patch100
-rw-r--r--meta/recipes-extended/sudo/files/CVE-2021-3156-2.patch53
-rw-r--r--meta/recipes-extended/sudo/files/CVE-2021-3156-3.patch73
-rw-r--r--meta/recipes-extended/sudo/files/CVE-2021-3156-4.patch29
-rw-r--r--meta/recipes-extended/sudo/files/CVE-2021-3156-5.patch41
-rw-r--r--meta/recipes-extended/sudo/sudo.inc2
-rw-r--r--meta/recipes-extended/sudo/sudo_1.9.3.bb13
-rw-r--r--meta/recipes-extended/tar/tar/CVE-2021-20193.patch133
-rw-r--r--meta/recipes-extended/tar/tar_1.32.bb1
-rw-r--r--meta/recipes-extended/timezone/timezone.inc6
-rw-r--r--meta/recipes-extended/watchdog/watchdog_5.16.bb6
-rw-r--r--meta/recipes-extended/zip/zip_3.0.bb6
-rw-r--r--meta/recipes-gnome/epiphany/epiphany_3.36.4.bb2
-rw-r--r--meta/recipes-gnome/epiphany/files/distributor.patch17
-rw-r--r--meta/recipes-gnome/epiphany/files/migrator.patch24
-rw-r--r--meta/recipes-gnome/gcr/gcr_3.36.0.bb10
-rw-r--r--meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/CVE-2020-29385.patch55
-rw-r--r--meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/CVE-2021-20240.patch40
-rw-r--r--meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.40.0.bb2
-rw-r--r--meta/recipes-gnome/gobject-introspection/gobject-introspection_1.64.1.bb4
-rw-r--r--meta/recipes-gnome/libsecret/libsecret/determinism.patch37
-rw-r--r--meta/recipes-gnome/libsecret/libsecret_0.20.3.bb3
-rw-r--r--meta/recipes-graphics/cairo/cairo/CVE-2020-35492.patch121
-rw-r--r--meta/recipes-graphics/cairo/cairo/bug-image-compositor.ref.pngbin0 -> 185 bytes
-rw-r--r--meta/recipes-graphics/cairo/cairo_1.16.0.bb11
-rw-r--r--meta/recipes-graphics/igt-gpu-tools/igt-gpu-tools/reproducibility.patch38
-rw-r--r--meta/recipes-graphics/igt-gpu-tools/igt-gpu-tools_git.bb5
-rw-r--r--meta/recipes-graphics/libsdl2/libsdl2/CVE-2020-14409-14410.patch79
-rw-r--r--meta/recipes-graphics/libsdl2/libsdl2_2.0.12.bb3
-rw-r--r--meta/recipes-graphics/mesa/mesa.inc5
-rw-r--r--meta/recipes-graphics/wayland/libinput/run-ptest2
-rw-r--r--meta/recipes-graphics/wayland/weston-init/weston.ini2
-rw-r--r--meta/recipes-graphics/wayland/weston_9.0.0.bb2
-rw-r--r--meta/recipes-graphics/xorg-font/xorg-minimal-fonts.bb8
-rw-r--r--meta/recipes-graphics/xorg-proto/xcb-proto_1.14.1.bb (renamed from meta/recipes-graphics/xorg-proto/xcb-proto_1.14.bb)4
-rw-r--r--meta/recipes-kernel/dtc/dtc.inc2
-rw-r--r--meta/recipes-kernel/dtc/dtc/0001-dtc-Fix-Makefile-to-add-CFLAGS-not-override.patch36
-rw-r--r--meta/recipes-kernel/kmod/kmod.inc1
-rw-r--r--meta/recipes-kernel/linux-firmware/linux-firmware_20210208.bb (renamed from meta/recipes-kernel/linux-firmware/linux-firmware_20200817.bb)73
-rw-r--r--meta/recipes-kernel/linux/kernel-devsrc.bb4
-rw-r--r--meta/recipes-kernel/linux/linux-yocto-rt_5.4.bb6
-rw-r--r--meta/recipes-kernel/linux/linux-yocto-rt_5.8.bb4
-rw-r--r--meta/recipes-kernel/linux/linux-yocto-tiny_5.4.bb8
-rw-r--r--meta/recipes-kernel/linux/linux-yocto-tiny_5.8.bb6
-rw-r--r--meta/recipes-kernel/linux/linux-yocto_5.4.bb22
-rw-r--r--meta/recipes-kernel/linux/linux-yocto_5.8.bb20
-rw-r--r--meta/recipes-kernel/lttng/babeltrace2_2.0.3.bb2
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch54
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0001-fix-btrfs-tracepoints-output-proper-root-owner-for-t.patch318
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch41
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch39
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch84
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch63
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch391
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0007-fix-objtool-Rename-frame.h-objtool.h-v5.10.patch88
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch59
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch117
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0009-fix-btrfs-make-ordered-extent-tracepoint-take-btrfs_.patch179
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch52
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch918
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0010-fix-ext4-fast-commit-recovery-path-v5.10.patch99
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0012-fix-kvm-x86-mmu-Add-TDP-MMU-PF-handler-v5.10.patch82
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0014-fix-tracepoint-Optimize-using-static_call-v5.10.patch196
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0016-fix-statedump-undefined-symbols-caused-by-incorrect-.patch55
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules_2.12.3.bb (renamed from meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb)23
-rw-r--r--meta/recipes-kernel/wireless-regdb/wireless-regdb_2020.11.20.bb (renamed from meta/recipes-kernel/wireless-regdb/wireless-regdb_2020.04.29.bb)2
-rw-r--r--meta/recipes-multimedia/ffmpeg/ffmpeg/0001-libavutil-include-assembly-with-full-path-from-sourc.patch97
-rw-r--r--meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35964.patch75
-rw-r--r--meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35965.patch35
-rw-r--r--meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb8
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.16.3.bb2
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.16.3.bb2
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.16.3.bb2
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0/0001-tests-seek-Don-t-use-too-strict-timeout-for-validati.patch32
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0_1.16.3.bb1
-rw-r--r--meta/recipes-multimedia/libomxil/libomxil_0.9.3.bb6
-rw-r--r--meta/recipes-sato/images/core-image-sato-ptest-fast.bb3
-rw-r--r--meta/recipes-sato/images/core-image-sato-sdk-ptest.bb3
-rw-r--r--meta/recipes-sato/webkit/webkitgtk_2.28.4.bb12
-rw-r--r--meta/recipes-sato/webkit/wpebackend-fdo_1.7.1.bb3
-rw-r--r--meta/recipes-support/apr/apr-util_1.6.1.bb7
-rw-r--r--meta/recipes-support/boost/boost/arm-intrinsics.patch55
-rw-r--r--meta/recipes-support/boost/boost_1.74.0.bb2
-rw-r--r--meta/recipes-support/ca-certificates/ca-certificates/0001-certdata2pem.py-use-python3.patch37
-rw-r--r--meta/recipes-support/ca-certificates/ca-certificates_20210119.bb (renamed from meta/recipes-support/ca-certificates/ca-certificates_20200601.bb)9
-rw-r--r--meta/recipes-support/curl/curl/0002-remove-void-protop-create-union-p.patch1609
-rw-r--r--meta/recipes-support/curl/curl/CVE-2020-8284.patch210
-rw-r--r--meta/recipes-support/curl/curl/CVE-2020-8285.patch257
-rw-r--r--meta/recipes-support/curl/curl/CVE-2020-8286.patch131
-rw-r--r--meta/recipes-support/curl/curl_7.72.0.bb4
-rw-r--r--meta/recipes-support/gpgme/gpgme_1.14.0.bb2
-rw-r--r--meta/recipes-support/iso-codes/iso-codes_4.5.0.bb2
-rw-r--r--meta/recipes-support/libcroco/files/CVE-2020-12825.patch192
-rw-r--r--meta/recipes-support/libcroco/libcroco_0.6.13.bb3
-rw-r--r--meta/recipes-support/libevdev/libevdev/determinism.patch3
-rw-r--r--meta/recipes-support/libexif/files/CVE-2020-0198.patch66
-rw-r--r--meta/recipes-support/libexif/files/CVE-2020-0452.patch39
-rw-r--r--meta/recipes-support/libexif/libexif_0.6.22.bb2
-rw-r--r--meta/recipes-support/libgcrypt/libgcrypt_1.8.6.bb3
-rw-r--r--meta/recipes-support/lz4/lz4_1.9.2.bb2
-rw-r--r--meta/recipes-support/p11-kit/p11-kit_0.23.22.bb (renamed from meta/recipes-support/p11-kit/p11-kit_0.23.21.bb)7
-rw-r--r--meta/recipes-support/sqlite/sqlite3_3.33.0.bb2
-rw-r--r--meta/recipes-support/vim/files/racefix.patch33
-rw-r--r--meta/recipes-support/vim/vim.inc3
-rwxr-xr-xscripts/contrib/documentation-audit.sh2
-rw-r--r--scripts/lib/devtool/standard.py43
-rw-r--r--scripts/lib/devtool/upgrade.py4
-rw-r--r--scripts/lib/recipetool/create_npm.py6
-rw-r--r--scripts/lib/wic/canned-wks/common.wks.inc2
-rw-r--r--scripts/lib/wic/canned-wks/directdisk-gpt.wks2
-rw-r--r--scripts/lib/wic/canned-wks/mkefidisk.wks2
-rw-r--r--scripts/lib/wic/ksparser.py17
-rw-r--r--scripts/lib/wic/misc.py8
-rw-r--r--scripts/lib/wic/partition.py82
-rw-r--r--scripts/lib/wic/plugins/imager/direct.py61
-rw-r--r--scripts/lib/wic/plugins/source/rootfs.py33
-rwxr-xr-xscripts/oe-pkgdata-util3
-rwxr-xr-xscripts/oe-run-native2
-rwxr-xr-xscripts/runqemu2
-rwxr-xr-xscripts/verify-bashisms2
-rwxr-xr-xscripts/wic2
-rwxr-xr-xscripts/yocto-check-layer3
343 files changed, 11858 insertions, 3429 deletions
diff --git a/bitbake/bin/bitbake-server b/bitbake/bin/bitbake-server
index ffbc7894ef..65796be747 100755
--- a/bitbake/bin/bitbake-server
+++ b/bitbake/bin/bitbake-server
@@ -26,7 +26,7 @@ readypipeinfd = int(sys.argv[3])
26logfile = sys.argv[4] 26logfile = sys.argv[4]
27lockname = sys.argv[5] 27lockname = sys.argv[5]
28sockname = sys.argv[6] 28sockname = sys.argv[6]
29timeout = sys.argv[7] 29timeout = float(sys.argv[7])
30xmlrpcinterface = (sys.argv[8], int(sys.argv[9])) 30xmlrpcinterface = (sys.argv[8], int(sys.argv[9]))
31if xmlrpcinterface[0] == "None": 31if xmlrpcinterface[0] == "None":
32 xmlrpcinterface = (None, xmlrpcinterface[1]) 32 xmlrpcinterface = (None, xmlrpcinterface[1])
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py
index 09e161fef1..c7bc372ec8 100644
--- a/bitbake/lib/bb/__init__.py
+++ b/bitbake/lib/bb/__init__.py
@@ -49,7 +49,7 @@ class BBLoggerMixin(object):
49 if not bb.event.worker_pid: 49 if not bb.event.worker_pid:
50 if self.name in bb.msg.loggerDefaultDomains and loglevel > (bb.msg.loggerDefaultDomains[self.name]): 50 if self.name in bb.msg.loggerDefaultDomains and loglevel > (bb.msg.loggerDefaultDomains[self.name]):
51 return 51 return
52 if loglevel > bb.msg.loggerDefaultLogLevel: 52 if loglevel < bb.msg.loggerDefaultLogLevel:
53 return 53 return
54 return self.log(loglevel, msg, *args, **kwargs) 54 return self.log(loglevel, msg, *args, **kwargs)
55 55
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index 9e0c931a07..029753fea0 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -26,7 +26,7 @@ import re
26 26
27logger = logging.getLogger("BitBake.Cache") 27logger = logging.getLogger("BitBake.Cache")
28 28
29__cache_version__ = "153" 29__cache_version__ = "154"
30 30
31def getCacheFile(path, filename, mc, data_hash): 31def getCacheFile(path, filename, mc, data_hash):
32 mcspec = '' 32 mcspec = ''
@@ -94,6 +94,7 @@ class CoreRecipeInfo(RecipeInfoCommon):
94 if not self.packages: 94 if not self.packages:
95 self.packages.append(self.pn) 95 self.packages.append(self.pn)
96 self.packages_dynamic = self.listvar('PACKAGES_DYNAMIC', metadata) 96 self.packages_dynamic = self.listvar('PACKAGES_DYNAMIC', metadata)
97 self.rprovides_pkg = self.pkgvar('RPROVIDES', self.packages, metadata)
97 98
98 self.skipreason = self.getvar('__SKIPPED', metadata) 99 self.skipreason = self.getvar('__SKIPPED', metadata)
99 if self.skipreason: 100 if self.skipreason:
@@ -120,7 +121,6 @@ class CoreRecipeInfo(RecipeInfoCommon):
120 self.depends = self.depvar('DEPENDS', metadata) 121 self.depends = self.depvar('DEPENDS', metadata)
121 self.rdepends = self.depvar('RDEPENDS', metadata) 122 self.rdepends = self.depvar('RDEPENDS', metadata)
122 self.rrecommends = self.depvar('RRECOMMENDS', metadata) 123 self.rrecommends = self.depvar('RRECOMMENDS', metadata)
123 self.rprovides_pkg = self.pkgvar('RPROVIDES', self.packages, metadata)
124 self.rdepends_pkg = self.pkgvar('RDEPENDS', self.packages, metadata) 124 self.rdepends_pkg = self.pkgvar('RDEPENDS', self.packages, metadata)
125 self.rrecommends_pkg = self.pkgvar('RRECOMMENDS', self.packages, metadata) 125 self.rrecommends_pkg = self.pkgvar('RRECOMMENDS', self.packages, metadata)
126 self.inherits = self.getvar('__inherit_cache', metadata, expand=False) 126 self.inherits = self.getvar('__inherit_cache', metadata, expand=False)
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 1f4cc1e96d..4b5ef07eaa 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -73,7 +73,9 @@ class SkippedPackage:
73 self.pn = info.pn 73 self.pn = info.pn
74 self.skipreason = info.skipreason 74 self.skipreason = info.skipreason
75 self.provides = info.provides 75 self.provides = info.provides
76 self.rprovides = info.rprovides 76 self.rprovides = info.packages + info.rprovides
77 for package in info.packages:
78 self.rprovides += info.rprovides_pkg[package]
77 elif reason: 79 elif reason:
78 self.skipreason = reason 80 self.skipreason = reason
79 81
@@ -2207,18 +2209,18 @@ class CookerParser(object):
2207 except bb.BBHandledException as exc: 2209 except bb.BBHandledException as exc:
2208 self.error += 1 2210 self.error += 1
2209 logger.error('Failed to parse recipe: %s' % exc.recipe) 2211 logger.error('Failed to parse recipe: %s' % exc.recipe)
2210 self.shutdown(clean=False) 2212 self.shutdown(clean=False, force=True)
2211 return False 2213 return False
2212 except ParsingFailure as exc: 2214 except ParsingFailure as exc:
2213 self.error += 1 2215 self.error += 1
2214 logger.error('Unable to parse %s: %s' % 2216 logger.error('Unable to parse %s: %s' %
2215 (exc.recipe, bb.exceptions.to_string(exc.realexception))) 2217 (exc.recipe, bb.exceptions.to_string(exc.realexception)))
2216 self.shutdown(clean=False) 2218 self.shutdown(clean=False, force=True)
2217 return False 2219 return False
2218 except bb.parse.ParseError as exc: 2220 except bb.parse.ParseError as exc:
2219 self.error += 1 2221 self.error += 1
2220 logger.error(str(exc)) 2222 logger.error(str(exc))
2221 self.shutdown(clean=False) 2223 self.shutdown(clean=False, force=True)
2222 return False 2224 return False
2223 except bb.data_smart.ExpansionError as exc: 2225 except bb.data_smart.ExpansionError as exc:
2224 self.error += 1 2226 self.error += 1
@@ -2227,7 +2229,7 @@ class CookerParser(object):
2227 tb = list(itertools.dropwhile(lambda e: e.filename.startswith(bbdir), exc.traceback)) 2229 tb = list(itertools.dropwhile(lambda e: e.filename.startswith(bbdir), exc.traceback))
2228 logger.error('ExpansionError during parsing %s', value.recipe, 2230 logger.error('ExpansionError during parsing %s', value.recipe,
2229 exc_info=(etype, value, tb)) 2231 exc_info=(etype, value, tb))
2230 self.shutdown(clean=False) 2232 self.shutdown(clean=False, force=True)
2231 return False 2233 return False
2232 except Exception as exc: 2234 except Exception as exc:
2233 self.error += 1 2235 self.error += 1
@@ -2239,7 +2241,7 @@ class CookerParser(object):
2239 # Most likely, an exception occurred during raising an exception 2241 # Most likely, an exception occurred during raising an exception
2240 import traceback 2242 import traceback
2241 logger.error('Exception during parse: %s' % traceback.format_exc()) 2243 logger.error('Exception during parse: %s' % traceback.format_exc())
2242 self.shutdown(clean=False) 2244 self.shutdown(clean=False, force=True)
2243 return False 2245 return False
2244 2246
2245 self.current += 1 2247 self.current += 1
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index c559102cf5..b4ed62a4e5 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -28,7 +28,7 @@ logger = logging.getLogger("BitBake.Data")
28 28
29__setvar_keyword__ = ["_append", "_prepend", "_remove"] 29__setvar_keyword__ = ["_append", "_prepend", "_remove"]
30__setvar_regexp__ = re.compile(r'(?P<base>.*?)(?P<keyword>_append|_prepend|_remove)(_(?P<add>[^A-Z]*))?$') 30__setvar_regexp__ = re.compile(r'(?P<base>.*?)(?P<keyword>_append|_prepend|_remove)(_(?P<add>[^A-Z]*))?$')
31__expand_var_regexp__ = re.compile(r"\${[a-zA-Z0-9\-_+./~]+?}") 31__expand_var_regexp__ = re.compile(r"\${[a-zA-Z0-9\-_+./~:]+?}")
32__expand_python_regexp__ = re.compile(r"\${@.+?}") 32__expand_python_regexp__ = re.compile(r"\${@.+?}")
33__whitespace_split__ = re.compile(r'(\s)') 33__whitespace_split__ = re.compile(r'(\s)')
34__override_regexp__ = re.compile(r'[a-z0-9]+') 34__override_regexp__ = re.compile(r'[a-z0-9]+')
@@ -481,6 +481,7 @@ class DataSmart(MutableMapping):
481 481
482 def setVar(self, var, value, **loginfo): 482 def setVar(self, var, value, **loginfo):
483 #print("var=" + str(var) + " val=" + str(value)) 483 #print("var=" + str(var) + " val=" + str(value))
484 var = var.replace(":", "_")
484 self.expand_cache = {} 485 self.expand_cache = {}
485 parsing=False 486 parsing=False
486 if 'parsing' in loginfo: 487 if 'parsing' in loginfo:
@@ -589,6 +590,8 @@ class DataSmart(MutableMapping):
589 """ 590 """
590 Rename the variable key to newkey 591 Rename the variable key to newkey
591 """ 592 """
593 key = key.replace(":", "_")
594 newkey = newkey.replace(":", "_")
592 if key == newkey: 595 if key == newkey:
593 bb.warn("Calling renameVar with equivalent keys (%s) is invalid" % key) 596 bb.warn("Calling renameVar with equivalent keys (%s) is invalid" % key)
594 return 597 return
@@ -637,6 +640,7 @@ class DataSmart(MutableMapping):
637 self.setVar(var + "_prepend", value, ignore=True, parsing=True) 640 self.setVar(var + "_prepend", value, ignore=True, parsing=True)
638 641
639 def delVar(self, var, **loginfo): 642 def delVar(self, var, **loginfo):
643 var = var.replace(":", "_")
640 self.expand_cache = {} 644 self.expand_cache = {}
641 645
642 loginfo['detail'] = "" 646 loginfo['detail'] = ""
@@ -664,6 +668,7 @@ class DataSmart(MutableMapping):
664 override = None 668 override = None
665 669
666 def setVarFlag(self, var, flag, value, **loginfo): 670 def setVarFlag(self, var, flag, value, **loginfo):
671 var = var.replace(":", "_")
667 self.expand_cache = {} 672 self.expand_cache = {}
668 673
669 if 'op' not in loginfo: 674 if 'op' not in loginfo:
@@ -687,6 +692,7 @@ class DataSmart(MutableMapping):
687 self.dict["__exportlist"]["_content"].add(var) 692 self.dict["__exportlist"]["_content"].add(var)
688 693
689 def getVarFlag(self, var, flag, expand=True, noweakdefault=False, parsing=False, retparser=False): 694 def getVarFlag(self, var, flag, expand=True, noweakdefault=False, parsing=False, retparser=False):
695 var = var.replace(":", "_")
690 if flag == "_content": 696 if flag == "_content":
691 cachename = var 697 cachename = var
692 else: 698 else:
@@ -814,6 +820,7 @@ class DataSmart(MutableMapping):
814 return value 820 return value
815 821
816 def delVarFlag(self, var, flag, **loginfo): 822 def delVarFlag(self, var, flag, **loginfo):
823 var = var.replace(":", "_")
817 self.expand_cache = {} 824 self.expand_cache = {}
818 825
819 local_var, _ = self._findVar(var) 826 local_var, _ = self._findVar(var)
@@ -831,6 +838,7 @@ class DataSmart(MutableMapping):
831 del self.dict[var][flag] 838 del self.dict[var][flag]
832 839
833 def appendVarFlag(self, var, flag, value, **loginfo): 840 def appendVarFlag(self, var, flag, value, **loginfo):
841 var = var.replace(":", "_")
834 loginfo['op'] = 'append' 842 loginfo['op'] = 'append'
835 loginfo['flag'] = flag 843 loginfo['flag'] = flag
836 self.varhistory.record(**loginfo) 844 self.varhistory.record(**loginfo)
@@ -838,6 +846,7 @@ class DataSmart(MutableMapping):
838 self.setVarFlag(var, flag, newvalue, ignore=True) 846 self.setVarFlag(var, flag, newvalue, ignore=True)
839 847
840 def prependVarFlag(self, var, flag, value, **loginfo): 848 def prependVarFlag(self, var, flag, value, **loginfo):
849 var = var.replace(":", "_")
841 loginfo['op'] = 'prepend' 850 loginfo['op'] = 'prepend'
842 loginfo['flag'] = flag 851 loginfo['flag'] = flag
843 self.varhistory.record(**loginfo) 852 self.varhistory.record(**loginfo)
@@ -845,6 +854,7 @@ class DataSmart(MutableMapping):
845 self.setVarFlag(var, flag, newvalue, ignore=True) 854 self.setVarFlag(var, flag, newvalue, ignore=True)
846 855
847 def setVarFlags(self, var, flags, **loginfo): 856 def setVarFlags(self, var, flags, **loginfo):
857 var = var.replace(":", "_")
848 self.expand_cache = {} 858 self.expand_cache = {}
849 infer_caller_details(loginfo) 859 infer_caller_details(loginfo)
850 if not var in self.dict: 860 if not var in self.dict:
@@ -859,6 +869,7 @@ class DataSmart(MutableMapping):
859 self.dict[var][i] = flags[i] 869 self.dict[var][i] = flags[i]
860 870
861 def getVarFlags(self, var, expand = False, internalflags=False): 871 def getVarFlags(self, var, expand = False, internalflags=False):
872 var = var.replace(":", "_")
862 local_var, _ = self._findVar(var) 873 local_var, _ = self._findVar(var)
863 flags = {} 874 flags = {}
864 875
@@ -875,6 +886,7 @@ class DataSmart(MutableMapping):
875 886
876 887
877 def delVarFlags(self, var, **loginfo): 888 def delVarFlags(self, var, **loginfo):
889 var = var.replace(":", "_")
878 self.expand_cache = {} 890 self.expand_cache = {}
879 if not var in self.dict: 891 if not var in self.dict:
880 self._makeShadowCopy(var) 892 self._makeShadowCopy(var)
@@ -1005,7 +1017,7 @@ class DataSmart(MutableMapping):
1005 else: 1017 else:
1006 data.update({key:value}) 1018 data.update({key:value})
1007 1019
1008 varflags = d.getVarFlags(key, internalflags = True) 1020 varflags = d.getVarFlags(key, internalflags = True, expand=["vardepvalue"])
1009 if not varflags: 1021 if not varflags:
1010 continue 1022 continue
1011 for f in varflags: 1023 for f in varflags:
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 551bfb70f2..524165bd5f 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -853,11 +853,6 @@ def runfetchcmd(cmd, d, quiet=False, cleanup=None, log=None, workdir=None):
853 if val: 853 if val:
854 cmd = 'export ' + var + '=\"%s\"; %s' % (val, cmd) 854 cmd = 'export ' + var + '=\"%s\"; %s' % (val, cmd)
855 855
856 # Ensure that a _PYTHON_SYSCONFIGDATA_NAME value set by a recipe
857 # (for example via python3native.bbclass since warrior) is not set for
858 # host Python (otherwise tools like git-make-shallow will fail)
859 cmd = 'unset _PYTHON_SYSCONFIGDATA_NAME; ' + cmd
860
861 # Disable pseudo as it may affect ssh, potentially causing it to hang. 856 # Disable pseudo as it may affect ssh, potentially causing it to hang.
862 cmd = 'export PSEUDO_DISABLED=1; ' + cmd 857 cmd = 'export PSEUDO_DISABLED=1; ' + cmd
863 858
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index b97967b487..f2cc02258e 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -141,6 +141,10 @@ class Git(FetchMethod):
141 ud.proto = 'file' 141 ud.proto = 'file'
142 else: 142 else:
143 ud.proto = "git" 143 ud.proto = "git"
144 if ud.host == "github.com" and ud.proto == "git":
145 # github stopped supporting git protocol
146 # https://github.blog/2021-09-01-improving-git-protocol-security-github/#no-more-unauthenticated-git
147 ud.proto = "https"
144 148
145 if not ud.proto in ('git', 'file', 'ssh', 'http', 'https', 'rsync'): 149 if not ud.proto in ('git', 'file', 'ssh', 'http', 'https', 'rsync'):
146 raise bb.fetch2.ParameterError("Invalid protocol type", ud.url) 150 raise bb.fetch2.ParameterError("Invalid protocol type", ud.url)
@@ -379,6 +383,35 @@ class Git(FetchMethod):
379 if missing_rev: 383 if missing_rev:
380 raise bb.fetch2.FetchError("Unable to find revision %s even from upstream" % missing_rev) 384 raise bb.fetch2.FetchError("Unable to find revision %s even from upstream" % missing_rev)
381 385
386 if self._contains_lfs(ud, d, ud.clonedir) and self._need_lfs(ud):
387 # Unpack temporary working copy, use it to run 'git checkout' to force pre-fetching
388 # of all LFS blobs needed at the the srcrev.
389 #
390 # It would be nice to just do this inline here by running 'git-lfs fetch'
391 # on the bare clonedir, but that operation requires a working copy on some
392 # releases of Git LFS.
393 tmpdir = tempfile.mkdtemp(dir=d.getVar('DL_DIR'))
394 try:
395 # Do the checkout. This implicitly involves a Git LFS fetch.
396 Git.unpack(self, ud, tmpdir, d)
397
398 # Scoop up a copy of any stuff that Git LFS downloaded. Merge them into
399 # the bare clonedir.
400 #
401 # As this procedure is invoked repeatedly on incremental fetches as
402 # a recipe's SRCREV is bumped throughout its lifetime, this will
403 # result in a gradual accumulation of LFS blobs in <ud.clonedir>/lfs
404 # corresponding to all the blobs reachable from the different revs
405 # fetched across time.
406 #
407 # Only do this if the unpack resulted in a .git/lfs directory being
408 # created; this only happens if at least one blob needed to be
409 # downloaded.
410 if os.path.exists(os.path.join(tmpdir, "git", ".git", "lfs")):
411 runfetchcmd("tar -cf - lfs | tar -xf - -C %s" % ud.clonedir, d, workdir="%s/git/.git" % tmpdir)
412 finally:
413 bb.utils.remove(tmpdir, recurse=True)
414
382 def build_mirror_data(self, ud, d): 415 def build_mirror_data(self, ud, d):
383 if ud.shallow and ud.write_shallow_tarballs: 416 if ud.shallow and ud.write_shallow_tarballs:
384 if not os.path.exists(ud.fullshallow): 417 if not os.path.exists(ud.fullshallow):
@@ -474,7 +507,7 @@ class Git(FetchMethod):
474 if os.path.exists(destdir): 507 if os.path.exists(destdir):
475 bb.utils.prunedir(destdir) 508 bb.utils.prunedir(destdir)
476 509
477 need_lfs = ud.parm.get("lfs", "1") == "1" 510 need_lfs = self._need_lfs(ud)
478 511
479 if not need_lfs: 512 if not need_lfs:
480 ud.basecmd = "GIT_LFS_SKIP_SMUDGE=1 " + ud.basecmd 513 ud.basecmd = "GIT_LFS_SKIP_SMUDGE=1 " + ud.basecmd
@@ -563,6 +596,9 @@ class Git(FetchMethod):
563 raise bb.fetch2.FetchError("The command '%s' gave output with more then 1 line unexpectedly, output: '%s'" % (cmd, output)) 596 raise bb.fetch2.FetchError("The command '%s' gave output with more then 1 line unexpectedly, output: '%s'" % (cmd, output))
564 return output.split()[0] != "0" 597 return output.split()[0] != "0"
565 598
599 def _need_lfs(self, ud):
600 return ud.parm.get("lfs", "1") == "1"
601
566 def _contains_lfs(self, ud, d, wd): 602 def _contains_lfs(self, ud, d, wd):
567 """ 603 """
568 Check if the repository has 'lfs' (large file) content 604 Check if the repository has 'lfs' (large file) content
@@ -573,8 +609,14 @@ class Git(FetchMethod):
573 else: 609 else:
574 branchname = "master" 610 branchname = "master"
575 611
576 cmd = "%s grep lfs origin/%s:.gitattributes | wc -l" % ( 612 # The bare clonedir doesn't use the remote names; it has the branch immediately.
577 ud.basecmd, ud.branches[ud.names[0]]) 613 if wd == ud.clonedir:
614 refname = ud.branches[ud.names[0]]
615 else:
616 refname = "origin/%s" % ud.branches[ud.names[0]]
617
618 cmd = "%s grep lfs %s:.gitattributes | wc -l" % (
619 ud.basecmd, refname)
578 620
579 try: 621 try:
580 output = runfetchcmd(cmd, d, quiet=True, workdir=wd) 622 output = runfetchcmd(cmd, d, quiet=True, workdir=wd)
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index e6d9f528d0..83acd85bae 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -316,7 +316,7 @@ class Wget(FetchMethod):
316 except (TypeError, ImportError, IOError, netrc.NetrcParseError): 316 except (TypeError, ImportError, IOError, netrc.NetrcParseError):
317 pass 317 pass
318 318
319 with opener.open(r) as response: 319 with opener.open(r, timeout=30) as response:
320 pass 320 pass
321 except urllib.error.URLError as e: 321 except urllib.error.URLError as e:
322 if try_again: 322 if try_again:
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index 0714296af2..c8802c0587 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -97,6 +97,7 @@ class DataNode(AstNode):
97 def eval(self, data): 97 def eval(self, data):
98 groupd = self.groupd 98 groupd = self.groupd
99 key = groupd["var"] 99 key = groupd["var"]
100 key = key.replace(":", "_")
100 loginfo = { 101 loginfo = {
101 'variable': key, 102 'variable': key,
102 'file': self.filename, 103 'file': self.filename,
@@ -207,6 +208,7 @@ class ExportFuncsNode(AstNode):
207 def eval(self, data): 208 def eval(self, data):
208 209
209 for func in self.n: 210 for func in self.n:
211 func = func.replace(":", "_")
210 calledfunc = self.classname + "_" + func 212 calledfunc = self.classname + "_" + func
211 213
212 if data.getVar(func, False) and not data.getVarFlag(func, 'export_func', False): 214 if data.getVar(func, False) and not data.getVarFlag(func, 'export_func', False):
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py
index 215f940b60..12a78b6502 100644
--- a/bitbake/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py
@@ -22,7 +22,7 @@ from .ConfHandler import include, init
22# For compatibility 22# For compatibility
23bb.deprecate_import(__name__, "bb.parse", ["vars_from_file"]) 23bb.deprecate_import(__name__, "bb.parse", ["vars_from_file"])
24 24
25__func_start_regexp__ = re.compile(r"(((?P<py>python)|(?P<fr>fakeroot))\s*)*(?P<func>[\w\.\-\+\{\}\$]+)?\s*\(\s*\)\s*{$" ) 25__func_start_regexp__ = re.compile(r"(((?P<py>python(?=(\s|\()))|(?P<fr>fakeroot(?=\s)))\s*)*(?P<func>[\w\.\-\+\{\}\$:]+)?\s*\(\s*\)\s*{$" )
26__inherit_regexp__ = re.compile(r"inherit\s+(.+)" ) 26__inherit_regexp__ = re.compile(r"inherit\s+(.+)" )
27__export_func_regexp__ = re.compile(r"EXPORT_FUNCTIONS\s+(.+)" ) 27__export_func_regexp__ = re.compile(r"EXPORT_FUNCTIONS\s+(.+)" )
28__addtask_regexp__ = re.compile(r"addtask\s+(?P<func>\w+)\s*((before\s*(?P<before>((.*(?=after))|(.*))))|(after\s*(?P<after>((.*(?=before))|(.*)))))*") 28__addtask_regexp__ = re.compile(r"addtask\s+(?P<func>\w+)\s*((before\s*(?P<before>((.*(?=after))|(.*))))|(after\s*(?P<after>((.*(?=before))|(.*)))))*")
diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
index af64d3446e..a7e81bd6ad 100644
--- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
@@ -20,7 +20,7 @@ from bb.parse import ParseError, resolve_file, ast, logger, handle
20__config_regexp__ = re.compile( r""" 20__config_regexp__ = re.compile( r"""
21 ^ 21 ^
22 (?P<exp>export\s+)? 22 (?P<exp>export\s+)?
23 (?P<var>[a-zA-Z0-9\-_+.${}/~]+?) 23 (?P<var>[a-zA-Z0-9\-_+.${}/~:]+?)
24 (\[(?P<flag>[a-zA-Z0-9\-_+.]+)\])? 24 (\[(?P<flag>[a-zA-Z0-9\-_+.]+)\])?
25 25
26 \s* ( 26 \s* (
diff --git a/bitbake/lib/bb/providers.py b/bitbake/lib/bb/providers.py
index 81459c36d5..484e1ea4f3 100644
--- a/bitbake/lib/bb/providers.py
+++ b/bitbake/lib/bb/providers.py
@@ -151,7 +151,7 @@ def findPreferredProvider(pn, cfgData, dataCache, pkg_pn = None, item = None):
151 if item: 151 if item:
152 itemstr = " (for item %s)" % item 152 itemstr = " (for item %s)" % item
153 if preferred_file is None: 153 if preferred_file is None:
154 logger.info("preferred version %s of %s not available%s", pv_str, pn, itemstr) 154 logger.warning("preferred version %s of %s not available%s", pv_str, pn, itemstr)
155 available_vers = [] 155 available_vers = []
156 for file_set in pkg_pn: 156 for file_set in pkg_pn:
157 for f in file_set: 157 for f in file_set:
@@ -163,7 +163,7 @@ def findPreferredProvider(pn, cfgData, dataCache, pkg_pn = None, item = None):
163 available_vers.append(ver_str) 163 available_vers.append(ver_str)
164 if available_vers: 164 if available_vers:
165 available_vers.sort() 165 available_vers.sort()
166 logger.info("versions of %s available: %s", pn, ' '.join(available_vers)) 166 logger.warning("versions of %s available: %s", pn, ' '.join(available_vers))
167 else: 167 else:
168 logger.debug(1, "selecting %s as PREFERRED_VERSION %s of package %s%s", preferred_file, pv_str, pn, itemstr) 168 logger.debug(1, "selecting %s as PREFERRED_VERSION %s of package %s%s", preferred_file, pv_str, pn, itemstr)
169 169
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 28bdadb45e..aa1d6b2711 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -1942,6 +1942,10 @@ class RunQueueExecute:
1942 logger.error("Scenequeue had holdoff tasks: %s" % pprint.pformat(self.holdoff_tasks)) 1942 logger.error("Scenequeue had holdoff tasks: %s" % pprint.pformat(self.holdoff_tasks))
1943 err = True 1943 err = True
1944 1944
1945 for tid in self.scenequeue_covered.intersection(self.scenequeue_notcovered):
1946 # No task should end up in both covered and uncovered, that is a bug.
1947 logger.error("Setscene task %s in both covered and notcovered." % tid)
1948
1945 for tid in self.rqdata.runq_setscene_tids: 1949 for tid in self.rqdata.runq_setscene_tids:
1946 if tid not in self.scenequeue_covered and tid not in self.scenequeue_notcovered: 1950 if tid not in self.scenequeue_covered and tid not in self.scenequeue_notcovered:
1947 err = True 1951 err = True
@@ -2430,6 +2434,9 @@ class RunQueueExecute:
2430 2434
2431 for dep in sorted(self.sqdata.sq_deps[task]): 2435 for dep in sorted(self.sqdata.sq_deps[task]):
2432 if fail and task in self.sqdata.sq_harddeps and dep in self.sqdata.sq_harddeps[task]: 2436 if fail and task in self.sqdata.sq_harddeps and dep in self.sqdata.sq_harddeps[task]:
2437 if dep in self.scenequeue_covered or dep in self.scenequeue_notcovered:
2438 # dependency could be already processed, e.g. noexec setscene task
2439 continue
2433 logger.debug(2, "%s was unavailable and is a hard dependency of %s so skipping" % (task, dep)) 2440 logger.debug(2, "%s was unavailable and is a hard dependency of %s so skipping" % (task, dep))
2434 self.sq_task_failoutright(dep) 2441 self.sq_task_failoutright(dep)
2435 continue 2442 continue
@@ -2791,6 +2798,7 @@ def update_scenequeue_data(tids, sqdata, rqdata, rq, cooker, stampcache, sqrq, s
2791 sqdata.valid |= rq.validate_hashes(tocheck, cooker.data, len(sqdata.stamppresent), False, summary=summary) 2798 sqdata.valid |= rq.validate_hashes(tocheck, cooker.data, len(sqdata.stamppresent), False, summary=summary)
2792 2799
2793 sqdata.hashes = {} 2800 sqdata.hashes = {}
2801 sqrq.sq_deferred = {}
2794 for mc in sorted(sqdata.multiconfigs): 2802 for mc in sorted(sqdata.multiconfigs):
2795 for tid in sorted(sqdata.sq_revdeps): 2803 for tid in sorted(sqdata.sq_revdeps):
2796 if mc_from_tid(tid) != mc: 2804 if mc_from_tid(tid) != mc:
@@ -2803,6 +2811,9 @@ def update_scenequeue_data(tids, sqdata, rqdata, rq, cooker, stampcache, sqrq, s
2803 continue 2811 continue
2804 if tid in sqrq.scenequeue_notcovered: 2812 if tid in sqrq.scenequeue_notcovered:
2805 continue 2813 continue
2814 if tid in sqrq.scenequeue_covered:
2815 continue
2816
2806 sqdata.outrightfail.add(tid) 2817 sqdata.outrightfail.add(tid)
2807 2818
2808 h = pending_hash_index(tid, rqdata) 2819 h = pending_hash_index(tid, rqdata)
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index b27b4aefe0..3e99bcef8f 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -509,7 +509,7 @@ class BitBakeServer(object):
509 os.set_inheritable(self.bitbake_lock.fileno(), True) 509 os.set_inheritable(self.bitbake_lock.fileno(), True)
510 os.set_inheritable(self.readypipein, True) 510 os.set_inheritable(self.readypipein, True)
511 serverscript = os.path.realpath(os.path.dirname(__file__) + "/../../../bin/bitbake-server") 511 serverscript = os.path.realpath(os.path.dirname(__file__) + "/../../../bin/bitbake-server")
512 os.execl(sys.executable, "bitbake-server", serverscript, "decafbad", str(self.bitbake_lock.fileno()), str(self.readypipein), self.logfile, self.bitbake_lock.name, self.sockname, str(self.server_timeout), str(self.xmlrpcinterface[0]), str(self.xmlrpcinterface[1])) 512 os.execl(sys.executable, "bitbake-server", serverscript, "decafbad", str(self.bitbake_lock.fileno()), str(self.readypipein), self.logfile, self.bitbake_lock.name, self.sockname, str(self.server_timeout or 0), str(self.xmlrpcinterface[0]), str(self.xmlrpcinterface[1]))
513 513
514def execServer(lockfd, readypipeinfd, lockname, sockname, server_timeout, xmlrpcinterface): 514def execServer(lockfd, readypipeinfd, lockname, sockname, server_timeout, xmlrpcinterface):
515 515
diff --git a/bitbake/lib/bb/tests/codeparser.py b/bitbake/lib/bb/tests/codeparser.py
index 826a2d2f6d..f485204791 100644
--- a/bitbake/lib/bb/tests/codeparser.py
+++ b/bitbake/lib/bb/tests/codeparser.py
@@ -111,9 +111,9 @@ ${D}${libdir}/pkgconfig/*.pc
111 self.assertExecs(set(["sed"])) 111 self.assertExecs(set(["sed"]))
112 112
113 def test_parameter_expansion_modifiers(self): 113 def test_parameter_expansion_modifiers(self):
114 # - and + are also valid modifiers for parameter expansion, but are 114 # -,+ and : are also valid modifiers for parameter expansion, but are
115 # valid characters in bitbake variable names, so are not included here 115 # valid characters in bitbake variable names, so are not included here
116 for i in ('=', ':-', ':=', '?', ':?', ':+', '#', '%', '##', '%%'): 116 for i in ('=', '?', '#', '%', '##', '%%'):
117 name = "foo%sbar" % i 117 name = "foo%sbar" % i
118 self.parseExpression("${%s}" % name) 118 self.parseExpression("${%s}" % name)
119 self.assertNotIn(name, self.references) 119 self.assertNotIn(name, self.references)
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index da17d7f281..4671532f2b 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -939,7 +939,7 @@ class FetcherNetworkTest(FetcherTest):
939 939
940 @skipIfNoNetwork() 940 @skipIfNoNetwork()
941 def test_git_submodule_CLI11(self): 941 def test_git_submodule_CLI11(self):
942 url = "gitsm://github.com/CLIUtils/CLI11;protocol=git;rev=bd4dc911847d0cde7a6b41dfa626a85aab213baf" 942 url = "gitsm://github.com/CLIUtils/CLI11;protocol=git;rev=bd4dc911847d0cde7a6b41dfa626a85aab213baf;branch=main"
943 fetcher = bb.fetch.Fetch([url], self.d) 943 fetcher = bb.fetch.Fetch([url], self.d)
944 fetcher.download() 944 fetcher.download()
945 # Previous cwd has been deleted 945 # Previous cwd has been deleted
@@ -954,12 +954,12 @@ class FetcherNetworkTest(FetcherTest):
954 @skipIfNoNetwork() 954 @skipIfNoNetwork()
955 def test_git_submodule_update_CLI11(self): 955 def test_git_submodule_update_CLI11(self):
956 """ Prevent regression on update detection not finding missing submodule, or modules without needed commits """ 956 """ Prevent regression on update detection not finding missing submodule, or modules without needed commits """
957 url = "gitsm://github.com/CLIUtils/CLI11;protocol=git;rev=cf6a99fa69aaefe477cc52e3ef4a7d2d7fa40714" 957 url = "gitsm://github.com/CLIUtils/CLI11;protocol=git;rev=cf6a99fa69aaefe477cc52e3ef4a7d2d7fa40714;branch=main"
958 fetcher = bb.fetch.Fetch([url], self.d) 958 fetcher = bb.fetch.Fetch([url], self.d)
959 fetcher.download() 959 fetcher.download()
960 960
961 # CLI11 that pulls in a newer nlohmann-json 961 # CLI11 that pulls in a newer nlohmann-json
962 url = "gitsm://github.com/CLIUtils/CLI11;protocol=git;rev=49ac989a9527ee9bb496de9ded7b4872c2e0e5ca" 962 url = "gitsm://github.com/CLIUtils/CLI11;protocol=git;rev=49ac989a9527ee9bb496de9ded7b4872c2e0e5ca;branch=main"
963 fetcher = bb.fetch.Fetch([url], self.d) 963 fetcher = bb.fetch.Fetch([url], self.d)
964 fetcher.download() 964 fetcher.download()
965 # Previous cwd has been deleted 965 # Previous cwd has been deleted
@@ -993,7 +993,7 @@ class FetcherNetworkTest(FetcherTest):
993 """ Prevent regression on deeply nested submodules not being checked out properly, even though they were fetched. """ 993 """ Prevent regression on deeply nested submodules not being checked out properly, even though they were fetched. """
994 994
995 # This repository also has submodules where the module (name), path and url do not align 995 # This repository also has submodules where the module (name), path and url do not align
996 url = "gitsm://github.com/azure/iotedge.git;protocol=git;rev=d76e0316c6f324345d77c48a83ce836d09392699" 996 url = "gitsm://github.com/azure/iotedge.git;protocol=git;rev=d76e0316c6f324345d77c48a83ce836d09392699;branch=main"
997 fetcher = bb.fetch.Fetch([url], self.d) 997 fetcher = bb.fetch.Fetch([url], self.d)
998 fetcher.download() 998 fetcher.download()
999 # Previous cwd has been deleted 999 # Previous cwd has been deleted
@@ -1180,7 +1180,7 @@ class FetchLatestVersionTest(FetcherTest):
1180 ("presentproto", "git://git.yoctoproject.org/bbfetchtests-presentproto", "24f3a56e541b0a9e6c6ee76081f441221a120ef9", "") 1180 ("presentproto", "git://git.yoctoproject.org/bbfetchtests-presentproto", "24f3a56e541b0a9e6c6ee76081f441221a120ef9", "")
1181 : "1.0", 1181 : "1.0",
1182 # version pattern "pkg_name-vX.Y.Z" 1182 # version pattern "pkg_name-vX.Y.Z"
1183 ("dtc", "git://git.qemu.org/dtc.git", "65cc4d2748a2c2e6f27f1cf39e07a5dbabd80ebf", "") 1183 ("dtc", "git://git.yoctoproject.org/bbfetchtests-dtc.git", "65cc4d2748a2c2e6f27f1cf39e07a5dbabd80ebf", "")
1184 : "1.4.0", 1184 : "1.4.0",
1185 # combination version pattern 1185 # combination version pattern
1186 ("sysprof", "git://gitlab.gnome.org/GNOME/sysprof.git;protocol=https", "cd44ee6644c3641507fb53b8a2a69137f2971219", "") 1186 ("sysprof", "git://gitlab.gnome.org/GNOME/sysprof.git;protocol=https", "cd44ee6644c3641507fb53b8a2a69137f2971219", "")
@@ -2051,13 +2051,14 @@ class GitLfsTest(FetcherTest):
2051 cwd = self.gitdir 2051 cwd = self.gitdir
2052 return bb.process.run(cmd, cwd=cwd)[0] 2052 return bb.process.run(cmd, cwd=cwd)[0]
2053 2053
2054 def fetch(self, uri=None): 2054 def fetch(self, uri=None, download=True):
2055 uris = self.d.getVar('SRC_URI').split() 2055 uris = self.d.getVar('SRC_URI').split()
2056 uri = uris[0] 2056 uri = uris[0]
2057 d = self.d 2057 d = self.d
2058 2058
2059 fetcher = bb.fetch2.Fetch(uris, d) 2059 fetcher = bb.fetch2.Fetch(uris, d)
2060 fetcher.download() 2060 if download:
2061 fetcher.download()
2061 ud = fetcher.ud[uri] 2062 ud = fetcher.ud[uri]
2062 return fetcher, ud 2063 return fetcher, ud
2063 2064
@@ -2067,16 +2068,21 @@ class GitLfsTest(FetcherTest):
2067 uri = 'git://%s;protocol=file;subdir=${S};lfs=1' % self.srcdir 2068 uri = 'git://%s;protocol=file;subdir=${S};lfs=1' % self.srcdir
2068 self.d.setVar('SRC_URI', uri) 2069 self.d.setVar('SRC_URI', uri)
2069 2070
2070 fetcher, ud = self.fetch() 2071 # Careful: suppress initial attempt at downloading until
2072 # we know whether git-lfs is installed.
2073 fetcher, ud = self.fetch(uri=None, download=False)
2071 self.assertIsNotNone(ud.method._find_git_lfs) 2074 self.assertIsNotNone(ud.method._find_git_lfs)
2072 2075
2073 # If git-lfs can be found, the unpack should be successful 2076 # If git-lfs can be found, the unpack should be successful. Only
2074 ud.method._find_git_lfs = lambda d: True 2077 # attempt this with the real live copy of git-lfs installed.
2075 shutil.rmtree(self.gitdir, ignore_errors=True) 2078 if ud.method._find_git_lfs(self.d):
2076 fetcher.unpack(self.d.getVar('WORKDIR')) 2079 fetcher.download()
2080 shutil.rmtree(self.gitdir, ignore_errors=True)
2081 fetcher.unpack(self.d.getVar('WORKDIR'))
2077 2082
2078 # If git-lfs cannot be found, the unpack should throw an error 2083 # If git-lfs cannot be found, the unpack should throw an error
2079 with self.assertRaises(bb.fetch2.FetchError): 2084 with self.assertRaises(bb.fetch2.FetchError):
2085 fetcher.download()
2080 ud.method._find_git_lfs = lambda d: False 2086 ud.method._find_git_lfs = lambda d: False
2081 shutil.rmtree(self.gitdir, ignore_errors=True) 2087 shutil.rmtree(self.gitdir, ignore_errors=True)
2082 fetcher.unpack(self.d.getVar('WORKDIR')) 2088 fetcher.unpack(self.d.getVar('WORKDIR'))
@@ -2087,10 +2093,16 @@ class GitLfsTest(FetcherTest):
2087 uri = 'git://%s;protocol=file;subdir=${S};lfs=0' % self.srcdir 2093 uri = 'git://%s;protocol=file;subdir=${S};lfs=0' % self.srcdir
2088 self.d.setVar('SRC_URI', uri) 2094 self.d.setVar('SRC_URI', uri)
2089 2095
2096 # In contrast to test_lfs_enabled(), allow the implicit download
2097 # done by self.fetch() to occur here. The point of this test case
2098 # is to verify that the fetcher can survive even if the source
2099 # repository has Git LFS usage configured.
2090 fetcher, ud = self.fetch() 2100 fetcher, ud = self.fetch()
2091 self.assertIsNotNone(ud.method._find_git_lfs) 2101 self.assertIsNotNone(ud.method._find_git_lfs)
2092 2102
2093 # If git-lfs can be found, the unpack should be successful 2103 # If git-lfs can be found, the unpack should be successful. A
2104 # live copy of git-lfs is not required for this case, so
2105 # unconditionally forge its presence.
2094 ud.method._find_git_lfs = lambda d: True 2106 ud.method._find_git_lfs = lambda d: True
2095 shutil.rmtree(self.gitdir, ignore_errors=True) 2107 shutil.rmtree(self.gitdir, ignore_errors=True)
2096 fetcher.unpack(self.d.getVar('WORKDIR')) 2108 fetcher.unpack(self.d.getVar('WORKDIR'))
diff --git a/documentation/conf.py b/documentation/conf.py
index ed8c5c0330..fe27e3e0d2 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.2" 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
diff --git a/documentation/poky.yaml b/documentation/poky.yaml
index e184fa8299..fb567a11dc 100644
--- a/documentation/poky.yaml
+++ b/documentation/poky.yaml
@@ -1,11 +1,13 @@
1DISTRO : "3.2" 1DISTRO : "3.2.4"
2DISTRO_NAME_NO_CAP : "gatesgarth" 2DISTRO_NAME_NO_CAP : "gatesgarth"
3DISTRO_NAME : "Gatesgarth" 3DISTRO_NAME : "Gatesgarth"
4DISTRO_NAME_NO_CAP_MINUS_ONE : "dunfell" 4DISTRO_NAME_NO_CAP_MINUS_ONE : "dunfell"
5YOCTO_DOC_VERSION : "3.2" 5YOCTO_DOC_VERSION : "3.2.4"
6YOCTO_DOC_VERSION_MINUS_ONE : "3.1.3" 6YOCTO_DOC_VERSION_MINUS_ONE : "3.1.7"
7DISTRO_REL_TAG : "yocto-3.2" 7DISTRO_REL_TAG : "yocto-3.2.4"
8POKYVERSION : "24.0.0" 8DOCCONF_VERSION : "3.2.4"
9BITBAKE_SERIES : "1.48"
10POKYVERSION : "24.0.4"
9YOCTO_POKY : "poky-&DISTRO_NAME_NO_CAP;-&POKYVERSION;" 11YOCTO_POKY : "poky-&DISTRO_NAME_NO_CAP;-&POKYVERSION;"
10YOCTO_DL_URL : "https://downloads.yoctoproject.org" 12YOCTO_DL_URL : "https://downloads.yoctoproject.org"
11YOCTO_AB_URL : "https://autobuilder.yoctoproject.org" 13YOCTO_AB_URL : "https://autobuilder.yoctoproject.org"
diff --git a/documentation/releases.rst b/documentation/releases.rst
index 536c3a6d2c..3e95ab9e23 100644
--- a/documentation/releases.rst
+++ b/documentation/releases.rst
@@ -4,6 +4,16 @@
4 Current Release Manuals 4 Current Release Manuals
5========================= 5=========================
6 6
7*******************************
83.2 'gatesgarth' Release Series
9*******************************
10
11- :yocto_docs:`3.2 Documentation </3.2>`
12- :yocto_docs:`3.2.1 Documentation </3.2.1>`
13- :yocto_docs:`3.2.2 Documentation </3.2.2>`
14- :yocto_docs:`3.2.3 Documentation </3.2.3>`
15- :yocto_docs:`3.2.4 Documentation </3.2.4>`
16
7**************************** 17****************************
83.1 'dunfell' Release Series 183.1 'dunfell' Release Series
9**************************** 19****************************
@@ -11,6 +21,11 @@
11- :yocto_docs:`3.1 Documentation </3.1>` 21- :yocto_docs:`3.1 Documentation </3.1>`
12- :yocto_docs:`3.1.1 Documentation </3.1.1>` 22- :yocto_docs:`3.1.1 Documentation </3.1.1>`
13- :yocto_docs:`3.1.2 Documentation </3.1.2>` 23- :yocto_docs:`3.1.2 Documentation </3.1.2>`
24- :yocto_docs:`3.1.3 Documentation </3.1.3>`
25- :yocto_docs:`3.1.4 Documentation </3.1.4>`
26- :yocto_docs:`3.1.5 Documentation </3.1.5>`
27- :yocto_docs:`3.1.6 Documentation </3.1.6>`
28- :yocto_docs:`3.1.7 Documentation </3.1.7>`
14 29
15========================== 30==========================
16 Previous Release Manuals 31 Previous Release Manuals
@@ -24,6 +39,7 @@
24- :yocto_docs:`3.0.1 Documentation </3.0.1>` 39- :yocto_docs:`3.0.1 Documentation </3.0.1>`
25- :yocto_docs:`3.0.2 Documentation </3.0.2>` 40- :yocto_docs:`3.0.2 Documentation </3.0.2>`
26- :yocto_docs:`3.0.3 Documentation </3.0.3>` 41- :yocto_docs:`3.0.3 Documentation </3.0.3>`
42- :yocto_docs:`3.0.4 Documentation </3.0.4>`
27 43
28**************************** 44****************************
292.7 'warrior' Release Series 452.7 'warrior' Release Series
diff --git a/meta-poky/conf/distro/poky.conf b/meta-poky/conf/distro/poky.conf
index 5fbd55032d..ccfbf6dba4 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.2" 3DISTRO_VERSION = "3.2.4"
4DISTRO_CODENAME = "gatesgarth" 4DISTRO_CODENAME = "gatesgarth"
5SDK_VENDOR = "-pokysdk" 5SDK_VENDOR = "-pokysdk"
6SDK_VERSION = "${@d.getVar('DISTRO_VERSION').replace('snapshot-${DATE}', 'snapshot')}" 6SDK_VERSION = "${@d.getVar('DISTRO_VERSION').replace('snapshot-${DATE}', 'snapshot')}"
diff --git a/meta-selftest/lib/pseudo_pyc_test1.py b/meta-selftest/lib/pseudo_pyc_test1.py
new file mode 100644
index 0000000000..b59abdd536
--- /dev/null
+++ b/meta-selftest/lib/pseudo_pyc_test1.py
@@ -0,0 +1 @@
STRING = "pseudo_pyc_test1"
diff --git a/meta-selftest/lib/pseudo_pyc_test2.py b/meta-selftest/lib/pseudo_pyc_test2.py
new file mode 100644
index 0000000000..fb67a978e0
--- /dev/null
+++ b/meta-selftest/lib/pseudo_pyc_test2.py
@@ -0,0 +1 @@
STRING = "pseudo_pyc_test2"
diff --git a/meta-selftest/recipes-test/pseudo-pyc-test/pseudo-pyc-test.bb b/meta-selftest/recipes-test/pseudo-pyc-test/pseudo-pyc-test.bb
new file mode 100644
index 0000000000..12dc91a8f3
--- /dev/null
+++ b/meta-selftest/recipes-test/pseudo-pyc-test/pseudo-pyc-test.bb
@@ -0,0 +1,15 @@
1SUMMARY = "pseudo env test"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
4
5INHIBIT_DEFAULT_DEPS = "1"
6
7python do_compile() {
8 import pseudo_pyc_test1
9 print(pseudo_pyc_test1.STRING)
10}
11
12python do_install() {
13 import pseudo_pyc_test2
14 print(pseudo_pyc_test2.STRING)
15}
diff --git a/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.4.bbappend b/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.4.bbappend
index 4ee895dbdc..35147d2da8 100644
--- a/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.4.bbappend
+++ b/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.4.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 ?= "cfcdd63145c0d741e57ee3e3e58f794229c6c09c" 10SRCREV_machine_genericx86 ?= "31db2b47ac7d8508080fbb7344399b501216de66"
11SRCREV_machine_genericx86-64 ?= "cfcdd63145c0d741e57ee3e3e58f794229c6c09c" 11SRCREV_machine_genericx86-64 ?= "31db2b47ac7d8508080fbb7344399b501216de66"
12SRCREV_machine_edgerouter ?= "706efec4c1e270ec5dda92275898cd465dfdc7dd" 12SRCREV_machine_edgerouter ?= "706efec4c1e270ec5dda92275898cd465dfdc7dd"
13SRCREV_machine_beaglebone-yocto ?= "706efec4c1e270ec5dda92275898cd465dfdc7dd" 13SRCREV_machine_beaglebone-yocto ?= "706efec4c1e270ec5dda92275898cd465dfdc7dd"
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.4.69" 20LINUX_VERSION_genericx86 = "5.4.94"
21LINUX_VERSION_genericx86-64 = "5.4.69" 21LINUX_VERSION_genericx86-64 = "5.4.94"
22LINUX_VERSION_edgerouter = "5.4.58" 22LINUX_VERSION_edgerouter = "5.4.58"
23LINUX_VERSION_beaglebone-yocto = "5.4.58" 23LINUX_VERSION_beaglebone-yocto = "5.4.58"
diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index 598298ef6f..858507b343 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -590,6 +590,7 @@ addtask do_dumpdata
590addtask do_ar_recipe 590addtask do_ar_recipe
591addtask do_deploy_archives 591addtask do_deploy_archives
592do_build[recrdeptask] += "do_deploy_archives" 592do_build[recrdeptask] += "do_deploy_archives"
593do_rootfs[recrdeptask] += "do_deploy_archives"
593do_populate_sdk[recrdeptask] += "do_deploy_archives" 594do_populate_sdk[recrdeptask] += "do_deploy_archives"
594 595
595python () { 596python () {
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 5a0b0c6b3e..78ae28bb0f 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -231,6 +231,7 @@ python base_eventhandler() {
231 if isinstance(e, bb.event.ConfigParsed): 231 if isinstance(e, bb.event.ConfigParsed):
232 if not d.getVar("NATIVELSBSTRING", False): 232 if not d.getVar("NATIVELSBSTRING", False):
233 d.setVar("NATIVELSBSTRING", lsb_distro_identifier(d)) 233 d.setVar("NATIVELSBSTRING", lsb_distro_identifier(d))
234 d.setVar("ORIGNATIVELSBSTRING", d.getVar("NATIVELSBSTRING", False))
234 d.setVar('BB_VERSION', bb.__version__) 235 d.setVar('BB_VERSION', bb.__version__)
235 236
236 # There might be no bb.event.ConfigParsed event if bitbake server is 237 # There might be no bb.event.ConfigParsed event if bitbake server is
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 7d5e3eb8fd..726f17a946 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -674,13 +674,16 @@ IMAGE_POSTPROCESS_COMMAND[vardepsexclude] += "buildhistory_get_imageinfo"
674POPULATE_SDK_POST_TARGET_COMMAND_append = " buildhistory_list_installed_sdk_target;" 674POPULATE_SDK_POST_TARGET_COMMAND_append = " buildhistory_list_installed_sdk_target;"
675POPULATE_SDK_POST_TARGET_COMMAND_append = " buildhistory_get_sdk_installed_target;" 675POPULATE_SDK_POST_TARGET_COMMAND_append = " buildhistory_get_sdk_installed_target;"
676POPULATE_SDK_POST_TARGET_COMMAND[vardepvalueexclude] .= "| buildhistory_list_installed_sdk_target;| buildhistory_get_sdk_installed_target;" 676POPULATE_SDK_POST_TARGET_COMMAND[vardepvalueexclude] .= "| buildhistory_list_installed_sdk_target;| buildhistory_get_sdk_installed_target;"
677POPULATE_SDK_POST_TARGET_COMMAND[vardepsexclude] += "buildhistory_list_installed_sdk_target buildhistory_get_sdk_installed_target"
677 678
678POPULATE_SDK_POST_HOST_COMMAND_append = " buildhistory_list_installed_sdk_host;" 679POPULATE_SDK_POST_HOST_COMMAND_append = " buildhistory_list_installed_sdk_host;"
679POPULATE_SDK_POST_HOST_COMMAND_append = " buildhistory_get_sdk_installed_host;" 680POPULATE_SDK_POST_HOST_COMMAND_append = " buildhistory_get_sdk_installed_host;"
680POPULATE_SDK_POST_HOST_COMMAND[vardepvalueexclude] .= "| buildhistory_list_installed_sdk_host;| buildhistory_get_sdk_installed_host;" 681POPULATE_SDK_POST_HOST_COMMAND[vardepvalueexclude] .= "| buildhistory_list_installed_sdk_host;| buildhistory_get_sdk_installed_host;"
682POPULATE_SDK_POST_HOST_COMMAND[vardepsexclude] += "buildhistory_list_installed_sdk_host buildhistory_get_sdk_installed_host"
681 683
682SDK_POSTPROCESS_COMMAND_append = " buildhistory_get_sdkinfo ; buildhistory_get_extra_sdkinfo; " 684SDK_POSTPROCESS_COMMAND_append = " buildhistory_get_sdkinfo ; buildhistory_get_extra_sdkinfo; "
683SDK_POSTPROCESS_COMMAND[vardepvalueexclude] .= "| buildhistory_get_sdkinfo ; buildhistory_get_extra_sdkinfo; " 685SDK_POSTPROCESS_COMMAND[vardepvalueexclude] .= "| buildhistory_get_sdkinfo ; buildhistory_get_extra_sdkinfo; "
686SDK_POSTPROCESS_COMMAND[vardepsexclude] += "buildhistory_get_sdkinfo buildhistory_get_extra_sdkinfo"
684 687
685python buildhistory_write_sigs() { 688python buildhistory_write_sigs() {
686 if not "task" in (d.getVar('BUILDHISTORY_FEATURES') or "").split(): 689 if not "task" in (d.getVar('BUILDHISTORY_FEATURES') or "").split():
@@ -855,7 +858,7 @@ END
855} 858}
856 859
857python buildhistory_eventhandler() { 860python buildhistory_eventhandler() {
858 if e.data.getVar('BUILDHISTORY_FEATURES').strip(): 861 if (e.data.getVar('BUILDHISTORY_FEATURES') or "").strip():
859 reset = e.data.getVar("BUILDHISTORY_RESET") 862 reset = e.data.getVar("BUILDHISTORY_RESET")
860 olddir = e.data.getVar("BUILDHISTORY_OLD_DIR") 863 olddir = e.data.getVar("BUILDHISTORY_OLD_DIR")
861 if isinstance(e, bb.event.BuildStarted): 864 if isinstance(e, bb.event.BuildStarted):
diff --git a/meta/classes/cve-check.bbclass b/meta/classes/cve-check.bbclass
index 25cefda92e..112ee3379d 100644
--- a/meta/classes/cve-check.bbclass
+++ b/meta/classes/cve-check.bbclass
@@ -53,6 +53,16 @@ CVE_CHECK_PN_WHITELIST ?= ""
53# 53#
54CVE_CHECK_WHITELIST ?= "" 54CVE_CHECK_WHITELIST ?= ""
55 55
56# Layers to be excluded
57CVE_CHECK_LAYER_EXCLUDELIST ??= ""
58
59# Layers to be included
60CVE_CHECK_LAYER_INCLUDELIST ??= ""
61
62
63# set to "alphabetical" for version using single alphabetical character as increament release
64CVE_VERSION_SUFFIX ??= ""
65
56python cve_save_summary_handler () { 66python cve_save_summary_handler () {
57 import shutil 67 import shutil
58 import datetime 68 import datetime
@@ -206,7 +216,11 @@ def check_cves(d, patched_cves):
206 """ 216 """
207 Connect to the NVD database and find unpatched cves. 217 Connect to the NVD database and find unpatched cves.
208 """ 218 """
209 from distutils.version import LooseVersion 219 from oe.cve_check import Version
220
221 pn = d.getVar("PN")
222 real_pv = d.getVar("PV")
223 suffix = d.getVar("CVE_VERSION_SUFFIX")
210 224
211 cves_unpatched = [] 225 cves_unpatched = []
212 # CVE_PRODUCT can contain more than one product (eg. curl/libcurl) 226 # CVE_PRODUCT can contain more than one product (eg. curl/libcurl)
@@ -217,7 +231,7 @@ def check_cves(d, patched_cves):
217 pv = d.getVar("CVE_VERSION").split("+git")[0] 231 pv = d.getVar("CVE_VERSION").split("+git")[0]
218 232
219 # If the recipe has been whitlisted we return empty lists 233 # If the recipe has been whitlisted we return empty lists
220 if d.getVar("PN") in d.getVar("CVE_CHECK_PN_WHITELIST").split(): 234 if pn in d.getVar("CVE_CHECK_PN_WHITELIST").split():
221 bb.note("Recipe has been whitelisted, skipping check") 235 bb.note("Recipe has been whitelisted, skipping check")
222 return ([], [], []) 236 return ([], [], [])
223 237
@@ -260,8 +274,8 @@ def check_cves(d, patched_cves):
260 else: 274 else:
261 if operator_start: 275 if operator_start:
262 try: 276 try:
263 vulnerable_start = (operator_start == '>=' and LooseVersion(pv) >= LooseVersion(version_start)) 277 vulnerable_start = (operator_start == '>=' and Version(pv,suffix) >= Version(version_start,suffix))
264 vulnerable_start |= (operator_start == '>' and LooseVersion(pv) > LooseVersion(version_start)) 278 vulnerable_start |= (operator_start == '>' and Version(pv,suffix) > Version(version_start,suffix))
265 except: 279 except:
266 bb.warn("%s: Failed to compare %s %s %s for %s" % 280 bb.warn("%s: Failed to compare %s %s %s for %s" %
267 (product, pv, operator_start, version_start, cve)) 281 (product, pv, operator_start, version_start, cve))
@@ -271,8 +285,8 @@ def check_cves(d, patched_cves):
271 285
272 if operator_end: 286 if operator_end:
273 try: 287 try:
274 vulnerable_end = (operator_end == '<=' and LooseVersion(pv) <= LooseVersion(version_end)) 288 vulnerable_end = (operator_end == '<=' and Version(pv,suffix) <= Version(version_end,suffix) )
275 vulnerable_end |= (operator_end == '<' and LooseVersion(pv) < LooseVersion(version_end)) 289 vulnerable_end |= (operator_end == '<' and Version(pv,suffix) < Version(version_end,suffix) )
276 except: 290 except:
277 bb.warn("%s: Failed to compare %s %s %s for %s" % 291 bb.warn("%s: Failed to compare %s %s %s for %s" %
278 (product, pv, operator_end, version_end, cve)) 292 (product, pv, operator_end, version_end, cve))
@@ -286,12 +300,12 @@ def check_cves(d, patched_cves):
286 vulnerable = vulnerable_start or vulnerable_end 300 vulnerable = vulnerable_start or vulnerable_end
287 301
288 if vulnerable: 302 if vulnerable:
289 bb.note("%s-%s is vulnerable to %s" % (product, pv, cve)) 303 bb.note("%s-%s is vulnerable to %s" % (pn, real_pv, cve))
290 cves_unpatched.append(cve) 304 cves_unpatched.append(cve)
291 break 305 break
292 306
293 if not vulnerable: 307 if not vulnerable:
294 bb.note("%s-%s is not vulnerable to %s" % (product, pv, cve)) 308 bb.note("%s-%s is not vulnerable to %s" % (pn, real_pv, cve))
295 # TODO: not patched but not vulnerable 309 # TODO: not patched but not vulnerable
296 patched_cves.add(cve) 310 patched_cves.add(cve)
297 311
@@ -327,7 +341,20 @@ def cve_write_data(d, patched, unpatched, whitelisted, cve_data):
327 CVE manifest if enabled. 341 CVE manifest if enabled.
328 """ 342 """
329 343
344
330 cve_file = d.getVar("CVE_CHECK_LOG") 345 cve_file = d.getVar("CVE_CHECK_LOG")
346 fdir_name = d.getVar("FILE_DIRNAME")
347 layer = fdir_name.split("/")[-3]
348
349 include_layers = d.getVar("CVE_CHECK_LAYER_INCLUDELIST").split()
350 exclude_layers = d.getVar("CVE_CHECK_LAYER_EXCLUDELIST").split()
351
352 if exclude_layers and layer in exclude_layers:
353 return
354
355 if include_layers and layer not in include_layers:
356 return
357
331 nvd_link = "https://web.nvd.nist.gov/view/vuln/detail?vulnId=" 358 nvd_link = "https://web.nvd.nist.gov/view/vuln/detail?vulnId="
332 write_string = "" 359 write_string = ""
333 unpatched_cves = [] 360 unpatched_cves = []
@@ -337,6 +364,7 @@ def cve_write_data(d, patched, unpatched, whitelisted, cve_data):
337 is_patched = cve in patched 364 is_patched = cve in patched
338 if is_patched and (d.getVar("CVE_CHECK_REPORT_PATCHED") != "1"): 365 if is_patched and (d.getVar("CVE_CHECK_REPORT_PATCHED") != "1"):
339 continue 366 continue
367 write_string += "LAYER: %s\n" % layer
340 write_string += "PACKAGE NAME: %s\n" % d.getVar("PN") 368 write_string += "PACKAGE NAME: %s\n" % d.getVar("PN")
341 write_string += "PACKAGE VERSION: %s%s\n" % (d.getVar("EXTENDPE"), d.getVar("PV")) 369 write_string += "PACKAGE VERSION: %s%s\n" % (d.getVar("EXTENDPE"), d.getVar("PV"))
342 write_string += "CVE: %s\n" % cve 370 write_string += "CVE: %s\n" % cve
diff --git a/meta/classes/devshell.bbclass b/meta/classes/devshell.bbclass
index fdf7dc100f..76dd0b42ee 100644
--- a/meta/classes/devshell.bbclass
+++ b/meta/classes/devshell.bbclass
@@ -128,6 +128,7 @@ def devpyshell(d):
128 more = i.runsource(source, "<pyshell>") 128 more = i.runsource(source, "<pyshell>")
129 if not more: 129 if not more:
130 buf = [] 130 buf = []
131 sys.stderr.flush()
131 prompt(more) 132 prompt(more)
132 except KeyboardInterrupt: 133 except KeyboardInterrupt:
133 i.write("\nKeyboardInterrupt\n") 134 i.write("\nKeyboardInterrupt\n")
diff --git a/meta/classes/distutils-common-base.bbclass b/meta/classes/distutils-common-base.bbclass
index 94b5fd426d..43a38e5a3a 100644
--- a/meta/classes/distutils-common-base.bbclass
+++ b/meta/classes/distutils-common-base.bbclass
@@ -11,7 +11,7 @@ export LDCXXSHARED = "${CXX} -shared"
11export CCSHARED = "-fPIC -DPIC" 11export CCSHARED = "-fPIC -DPIC"
12# LINKFORSHARED are the flags passed to the $(CC) command that links 12# LINKFORSHARED are the flags passed to the $(CC) command that links
13# the python executable 13# the python executable
14export LINKFORSHARED = "{SECURITY_CFLAGS} -Xlinker -export-dynamic" 14export LINKFORSHARED = "${SECURITY_CFLAGS} -Xlinker -export-dynamic"
15 15
16FILES_${PN} += "${libdir}/* ${libdir}/${PYTHON_DIR}/*" 16FILES_${PN} += "${libdir}/* ${libdir}/${PYTHON_DIR}/*"
17 17
diff --git a/meta/classes/distutils3-base.bbclass b/meta/classes/distutils3-base.bbclass
index 7dbf07ac4b..a277d1c7bc 100644
--- a/meta/classes/distutils3-base.bbclass
+++ b/meta/classes/distutils3-base.bbclass
@@ -1,5 +1,5 @@
1DEPENDS += "${@["${PYTHON_PN}-native ${PYTHON_PN}", ""][(d.getVar('PACKAGES') == '')]}" 1DEPENDS += "${@["${PYTHON_PN}-native ${PYTHON_PN}", ""][(d.getVar('PACKAGES') == '')]}"
2RDEPENDS_${PN} += "${@['', '${PYTHON_PN}-core']['${CLASSOVERRIDE}' == 'class-target']}" 2RDEPENDS_${PN} += "${@['', '${PYTHON_PN}-core']['${CLASSOVERRIDE}' == 'class-target']}"
3 3
4inherit distutils-common-base python3native 4inherit distutils-common-base python3native python3targetconfig
5 5
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index dd09395788..3d6b80bee2 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -68,6 +68,7 @@ python () {
68 url_data = fetch.ud[url] 68 url_data = fetch.ud[url]
69 parm = url_data.parm 69 parm = url_data.parm
70 if (url_data.type == 'file' or 70 if (url_data.type == 'file' or
71 url_data.type == 'npmsw' or
71 'type' in parm and parm['type'] == 'kmeta'): 72 'type' in parm and parm['type'] == 'kmeta'):
72 local_srcuri.append(url) 73 local_srcuri.append(url)
73 74
@@ -190,6 +191,7 @@ def srctree_hash_files(d, srcdir=None):
190 import shutil 191 import shutil
191 import subprocess 192 import subprocess
192 import tempfile 193 import tempfile
194 import hashlib
193 195
194 s_dir = srcdir or d.getVar('EXTERNALSRC') 196 s_dir = srcdir or d.getVar('EXTERNALSRC')
195 git_dir = None 197 git_dir = None
@@ -197,6 +199,10 @@ def srctree_hash_files(d, srcdir=None):
197 try: 199 try:
198 git_dir = os.path.join(s_dir, 200 git_dir = os.path.join(s_dir,
199 subprocess.check_output(['git', '-C', s_dir, 'rev-parse', '--git-dir'], stderr=subprocess.DEVNULL).decode("utf-8").rstrip()) 201 subprocess.check_output(['git', '-C', s_dir, 'rev-parse', '--git-dir'], stderr=subprocess.DEVNULL).decode("utf-8").rstrip())
202 top_git_dir = os.path.join(s_dir, subprocess.check_output(['git', '-C', d.getVar("TOPDIR"), 'rev-parse', '--git-dir'],
203 stderr=subprocess.DEVNULL).decode("utf-8").rstrip())
204 if git_dir == top_git_dir:
205 git_dir = None
200 except subprocess.CalledProcessError: 206 except subprocess.CalledProcessError:
201 pass 207 pass
202 208
@@ -210,7 +216,17 @@ def srctree_hash_files(d, srcdir=None):
210 env = os.environ.copy() 216 env = os.environ.copy()
211 env['GIT_INDEX_FILE'] = tmp_index.name 217 env['GIT_INDEX_FILE'] = tmp_index.name
212 subprocess.check_output(['git', 'add', '-A', '.'], cwd=s_dir, env=env) 218 subprocess.check_output(['git', 'add', '-A', '.'], cwd=s_dir, env=env)
213 sha1 = subprocess.check_output(['git', 'write-tree'], cwd=s_dir, env=env).decode("utf-8") 219 git_sha1 = subprocess.check_output(['git', 'write-tree'], cwd=s_dir, env=env).decode("utf-8")
220 submodule_helper = subprocess.check_output(['git', 'submodule--helper', 'list'], cwd=s_dir, env=env).decode("utf-8")
221 for line in submodule_helper.splitlines():
222 module_dir = os.path.join(s_dir, line.rsplit(maxsplit=1)[1])
223 if os.path.isdir(module_dir):
224 proc = subprocess.Popen(['git', 'add', '-A', '.'], cwd=module_dir, env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
225 proc.communicate()
226 proc = subprocess.Popen(['git', 'write-tree'], cwd=module_dir, env=env, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
227 stdout, _ = proc.communicate()
228 git_sha1 += stdout.decode("utf-8")
229 sha1 = hashlib.sha1(git_sha1.encode("utf-8")).hexdigest()
214 with open(oe_hash_file, 'w') as fobj: 230 with open(oe_hash_file, 'w') as fobj:
215 fobj.write(sha1) 231 fobj.write(sha1)
216 ret = oe_hash_file + ':True' 232 ret = oe_hash_file + ':True'
diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index a9e31b50ea..5b26378a4e 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -40,6 +40,7 @@ GO_RPATH_LINK_class-native = "${@'-Wl,-rpath-link=${STAGING_LIBDIR_NATIVE}/go/pk
40GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${GO_RPATH_LINK} ${LDFLAGS}" 40GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${GO_RPATH_LINK} ${LDFLAGS}"
41GO_LINKMODE ?= "" 41GO_LINKMODE ?= ""
42GO_LINKMODE_class-nativesdk = "--linkmode=external" 42GO_LINKMODE_class-nativesdk = "--linkmode=external"
43GO_LINKMODE_class-native = "--linkmode=external"
43GO_LDFLAGS ?= '-ldflags="${GO_RPATH} ${GO_LINKMODE} -extldflags '${GO_EXTLDFLAGS}'"' 44GO_LDFLAGS ?= '-ldflags="${GO_RPATH} ${GO_LINKMODE} -extldflags '${GO_EXTLDFLAGS}'"'
44export GOBUILDFLAGS ?= "-v ${GO_LDFLAGS} -trimpath" 45export GOBUILDFLAGS ?= "-v ${GO_LDFLAGS} -trimpath"
45export GOPATH_OMIT_IN_ACTIONID ?= "1" 46export GOPATH_OMIT_IN_ACTIONID ?= "1"
diff --git a/meta/classes/image-live.bbclass b/meta/classes/image-live.bbclass
index 9ea5ddc312..47c44b4aad 100644
--- a/meta/classes/image-live.bbclass
+++ b/meta/classes/image-live.bbclass
@@ -30,7 +30,7 @@ do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \
30 virtual/kernel:do_deploy \ 30 virtual/kernel:do_deploy \
31 ${MLPREFIX}syslinux:do_populate_sysroot \ 31 ${MLPREFIX}syslinux:do_populate_sysroot \
32 syslinux-native:do_populate_sysroot \ 32 syslinux-native:do_populate_sysroot \
33 ${PN}:do_image_${@d.getVar('LIVE_ROOTFS_TYPE').replace('-', '_')} \ 33 ${@'%s:do_image_%s' % (d.getVar('PN'), d.getVar('LIVE_ROOTFS_TYPE').replace('-', '_')) if d.getVar('ROOTFS') else ''} \
34 " 34 "
35 35
36 36
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 045f4494c8..2f1d5cfb46 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -112,7 +112,7 @@ def rootfs_command_variables(d):
112 'IMAGE_PREPROCESS_COMMAND','RPM_PREPROCESS_COMMANDS','RPM_POSTPROCESS_COMMANDS','DEB_PREPROCESS_COMMANDS','DEB_POSTPROCESS_COMMANDS'] 112 'IMAGE_PREPROCESS_COMMAND','RPM_PREPROCESS_COMMANDS','RPM_POSTPROCESS_COMMANDS','DEB_PREPROCESS_COMMANDS','DEB_POSTPROCESS_COMMANDS']
113 113
114python () { 114python () {
115 variables = rootfs_command_variables(d) + sdk_command_variables(d) 115 variables = rootfs_command_variables(d)
116 for var in variables: 116 for var in variables:
117 if d.getVar(var, False): 117 if d.getVar(var, False):
118 d.setVarFlag(var, 'func', '1') 118 d.setVarFlag(var, 'func', '1')
@@ -180,6 +180,8 @@ IMAGE_LOCALES_ARCHIVE ?= '1'
180# aren't yet available. 180# aren't yet available.
181PSEUDO_PASSWD = "${IMAGE_ROOTFS}:${STAGING_DIR_NATIVE}" 181PSEUDO_PASSWD = "${IMAGE_ROOTFS}:${STAGING_DIR_NATIVE}"
182 182
183PSEUDO_IGNORE_PATHS .= ",${WORKDIR}/intercept_scripts,${WORKDIR}/oe-rootfs-repo,${WORKDIR}/sstate-build-image_complete"
184
183PACKAGE_EXCLUDE ??= "" 185PACKAGE_EXCLUDE ??= ""
184PACKAGE_EXCLUDE[type] = "list" 186PACKAGE_EXCLUDE[type] = "list"
185 187
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 66884af8e0..30951ae366 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -108,19 +108,9 @@ IMAGE_CMD_squashfs-xz = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME
108IMAGE_CMD_squashfs-lzo = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lzo ${EXTRA_IMAGECMD} -noappend -comp lzo" 108IMAGE_CMD_squashfs-lzo = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lzo ${EXTRA_IMAGECMD} -noappend -comp lzo"
109IMAGE_CMD_squashfs-lz4 = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lz4 ${EXTRA_IMAGECMD} -noappend -comp lz4" 109IMAGE_CMD_squashfs-lz4 = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lz4 ${EXTRA_IMAGECMD} -noappend -comp lz4"
110 110
111# By default, tar from the host is used, which can be quite old. If
112# you need special parameters (like --xattrs) which are only supported
113# by GNU tar upstream >= 1.27, then override that default:
114# IMAGE_CMD_TAR = "tar --xattrs --xattrs-include=*"
115# do_image_tar[depends] += "tar-replacement-native:do_populate_sysroot"
116# EXTRANATIVEPATH += "tar-native"
117#
118# The GNU documentation does not specify whether --xattrs-include is necessary.
119# In practice, it turned out to be not needed when creating archives and
120# required when extracting, but it seems prudent to use it in both cases.
121IMAGE_CMD_TAR ?= "tar" 111IMAGE_CMD_TAR ?= "tar"
122# ignore return code 1 "file changed as we read it" as other tasks(e.g. do_image_wic) may be hardlinking rootfs 112# ignore return code 1 "file changed as we read it" as other tasks(e.g. do_image_wic) may be hardlinking rootfs
123IMAGE_CMD_tar = "${IMAGE_CMD_TAR} --numeric-owner -cf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.tar -C ${IMAGE_ROOTFS} . || [ $? -eq 1 ]" 113IMAGE_CMD_tar = "${IMAGE_CMD_TAR} --sort=name --format=posix --numeric-owner -cf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.tar -C ${IMAGE_ROOTFS} . || [ $? -eq 1 ]"
124 114
125do_image_cpio[cleandirs] += "${WORKDIR}/cpio_append" 115do_image_cpio[cleandirs] += "${WORKDIR}/cpio_append"
126IMAGE_CMD_cpio () { 116IMAGE_CMD_cpio () {
diff --git a/meta/classes/image_types_wic.bbclass b/meta/classes/image_types_wic.bbclass
index 286e0f5d54..49be1da77a 100644
--- a/meta/classes/image_types_wic.bbclass
+++ b/meta/classes/image_types_wic.bbclass
@@ -3,7 +3,7 @@
3WICVARS ?= "\ 3WICVARS ?= "\
4 BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE FAKEROOTCMD IMAGE_BASENAME IMAGE_EFI_BOOT_FILES IMAGE_BOOT_FILES \ 4 BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE FAKEROOTCMD IMAGE_BASENAME IMAGE_EFI_BOOT_FILES IMAGE_BOOT_FILES \
5 IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD INITRD_LIVE ISODIR RECIPE_SYSROOT_NATIVE \ 5 IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD INITRD_LIVE ISODIR RECIPE_SYSROOT_NATIVE \
6 ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS \ 6 ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS HOSTTOOLS_DIR \
7 KERNEL_IMAGETYPE MACHINE INITRAMFS_IMAGE INITRAMFS_IMAGE_BUNDLE INITRAMFS_LINK_NAME APPEND \ 7 KERNEL_IMAGETYPE MACHINE INITRAMFS_IMAGE INITRAMFS_IMAGE_BUNDLE INITRAMFS_LINK_NAME APPEND \
8 ASSUME_PROVIDED PSEUDO_IGNORE_PATHS" 8 ASSUME_PROVIDED PSEUDO_IGNORE_PATHS"
9 9
@@ -29,11 +29,17 @@ WIC_CREATE_EXTRA_ARGS ?= ""
29IMAGE_CMD_wic () { 29IMAGE_CMD_wic () {
30 out="${IMGDEPLOYDIR}/${IMAGE_NAME}" 30 out="${IMGDEPLOYDIR}/${IMAGE_NAME}"
31 build_wic="${WORKDIR}/build-wic" 31 build_wic="${WORKDIR}/build-wic"
32 tmp_wic="${WORKDIR}/tmp-wic"
32 wks="${WKS_FULL_PATH}" 33 wks="${WKS_FULL_PATH}"
34 if [ -e "$tmp_wic" ]; then
35 # Ensure we don't have any junk leftover from a previously interrupted
36 # do_image_wic execution
37 rm -rf "$tmp_wic"
38 fi
33 if [ -z "$wks" ]; then 39 if [ -z "$wks" ]; then
34 bbfatal "No kickstart files from WKS_FILES were found: ${WKS_FILES}. Please set WKS_FILE or WKS_FILES appropriately." 40 bbfatal "No kickstart files from WKS_FILES were found: ${WKS_FILES}. Please set WKS_FILE or WKS_FILES appropriately."
35 fi 41 fi
36 BUILDDIR="${TOPDIR}" PSEUDO_UNLOAD=1 wic create "$wks" --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" -o "$build_wic/" ${WIC_CREATE_EXTRA_ARGS} 42 BUILDDIR="${TOPDIR}" PSEUDO_UNLOAD=1 wic create "$wks" --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" -o "$build_wic/" -w "$tmp_wic" ${WIC_CREATE_EXTRA_ARGS}
37 mv "$build_wic/$(basename "${wks%.wks}")"*.direct "$out${IMAGE_NAME_SUFFIX}.wic" 43 mv "$build_wic/$(basename "${wks%.wks}")"*.direct "$out${IMAGE_NAME_SUFFIX}.wic"
38} 44}
39IMAGE_CMD_wic[vardepsexclude] = "WKS_FULL_PATH WKS_FILES TOPDIR" 45IMAGE_CMD_wic[vardepsexclude] = "WKS_FULL_PATH WKS_FILES TOPDIR"
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index c6dff9659c..44dbed875b 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -175,7 +175,7 @@ def package_qa_check_useless_rpaths(file, name, d, elf, messages):
175 if rpath_eq(rpath, libdir) or rpath_eq(rpath, base_libdir): 175 if rpath_eq(rpath, libdir) or rpath_eq(rpath, base_libdir):
176 # The dynamic linker searches both these places anyway. There is no point in 176 # The dynamic linker searches both these places anyway. There is no point in
177 # looking there again. 177 # looking there again.
178 package_qa_add_message(messages, "useless-rpaths", "%s: %s contains probably-redundant RPATH %s" % (name, package_qa_clean_path(file, d), rpath)) 178 package_qa_add_message(messages, "useless-rpaths", "%s: %s contains probably-redundant RPATH %s" % (name, package_qa_clean_path(file, d, name), rpath))
179 179
180QAPATHTEST[dev-so] = "package_qa_check_dev" 180QAPATHTEST[dev-so] = "package_qa_check_dev"
181def package_qa_check_dev(path, name, d, elf, messages): 181def package_qa_check_dev(path, name, d, elf, messages):
@@ -184,8 +184,8 @@ def package_qa_check_dev(path, name, d, elf, messages):
184 """ 184 """
185 185
186 if not name.endswith("-dev") and not name.endswith("-dbg") and not name.endswith("-ptest") and not name.startswith("nativesdk-") and path.endswith(".so") and os.path.islink(path): 186 if not name.endswith("-dev") and not name.endswith("-dbg") and not name.endswith("-ptest") and not name.startswith("nativesdk-") and path.endswith(".so") and os.path.islink(path):
187 package_qa_add_message(messages, "dev-so", "non -dev/-dbg/nativesdk- package contains symlink .so: %s path '%s'" % \ 187 package_qa_add_message(messages, "dev-so", "non -dev/-dbg/nativesdk- package %s contains symlink .so '%s'" % \
188 (name, package_qa_clean_path(path,d))) 188 (name, package_qa_clean_path(path, d, name)))
189 189
190QAPATHTEST[dev-elf] = "package_qa_check_dev_elf" 190QAPATHTEST[dev-elf] = "package_qa_check_dev_elf"
191def package_qa_check_dev_elf(path, name, d, elf, messages): 191def package_qa_check_dev_elf(path, name, d, elf, messages):
@@ -195,8 +195,8 @@ def package_qa_check_dev_elf(path, name, d, elf, messages):
195 install link-time .so files that are linker scripts. 195 install link-time .so files that are linker scripts.
196 """ 196 """
197 if name.endswith("-dev") and path.endswith(".so") and not os.path.islink(path) and elf: 197 if name.endswith("-dev") and path.endswith(".so") and not os.path.islink(path) and elf:
198 package_qa_add_message(messages, "dev-elf", "-dev package contains non-symlink .so: %s path '%s'" % \ 198 package_qa_add_message(messages, "dev-elf", "-dev package %s contains non-symlink .so '%s'" % \
199 (name, package_qa_clean_path(path,d))) 199 (name, package_qa_clean_path(path, d, name)))
200 200
201QAPATHTEST[staticdev] = "package_qa_check_staticdev" 201QAPATHTEST[staticdev] = "package_qa_check_staticdev"
202def package_qa_check_staticdev(path, name, d, elf, messages): 202def package_qa_check_staticdev(path, name, d, elf, messages):
@@ -209,7 +209,7 @@ def package_qa_check_staticdev(path, name, d, elf, messages):
209 209
210 if not name.endswith("-pic") and not name.endswith("-staticdev") and not name.endswith("-ptest") and path.endswith(".a") and not path.endswith("_nonshared.a") and not '/usr/lib/debug-static/' in path and not '/.debug-static/' in path: 210 if not name.endswith("-pic") and not name.endswith("-staticdev") and not name.endswith("-ptest") and path.endswith(".a") and not path.endswith("_nonshared.a") and not '/usr/lib/debug-static/' in path and not '/.debug-static/' in path:
211 package_qa_add_message(messages, "staticdev", "non -staticdev package contains static .a library: %s path '%s'" % \ 211 package_qa_add_message(messages, "staticdev", "non -staticdev package contains static .a library: %s path '%s'" % \
212 (name, package_qa_clean_path(path,d))) 212 (name, package_qa_clean_path(path,d, name)))
213 213
214QAPATHTEST[mime] = "package_qa_check_mime" 214QAPATHTEST[mime] = "package_qa_check_mime"
215def package_qa_check_mime(path, name, d, elf, messages): 215def package_qa_check_mime(path, name, d, elf, messages):
diff --git a/meta/classes/kernel-devicetree.bbclass b/meta/classes/kernel-devicetree.bbclass
index 81dda8003f..3c5def1041 100644
--- a/meta/classes/kernel-devicetree.bbclass
+++ b/meta/classes/kernel-devicetree.bbclass
@@ -1,8 +1,11 @@
1# Support for device tree generation 1# Support for device tree generation
2PACKAGES_append = " \ 2python () {
3 ${KERNEL_PACKAGE_NAME}-devicetree \ 3 if not bb.data.inherits_class('nopackages', d):
4 ${@[d.getVar('KERNEL_PACKAGE_NAME') + '-image-zimage-bundle', ''][d.getVar('KERNEL_DEVICETREE_BUNDLE') != '1']} \ 4 d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-devicetree")
5" 5 if d.getVar('KERNEL_DEVICETREE_BUNDLE') == '1':
6 d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-image-zimage-bundle")
7}
8
6FILES_${KERNEL_PACKAGE_NAME}-devicetree = "/${KERNEL_IMAGEDEST}/*.dtb /${KERNEL_IMAGEDEST}/*.dtbo" 9FILES_${KERNEL_PACKAGE_NAME}-devicetree = "/${KERNEL_IMAGEDEST}/*.dtb /${KERNEL_IMAGEDEST}/*.dtbo"
7FILES_${KERNEL_PACKAGE_NAME}-image-zimage-bundle = "/${KERNEL_IMAGEDEST}/zImage-*.dtb.bin" 10FILES_${KERNEL_PACKAGE_NAME}-image-zimage-bundle = "/${KERNEL_IMAGEDEST}/zImage-*.dtb.bin"
8 11
diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass
index c8ede26996..baa32e0a90 100644
--- a/meta/classes/kernel-module-split.bbclass
+++ b/meta/classes/kernel-module-split.bbclass
@@ -120,7 +120,10 @@ python split_kernel_module_packages () {
120 files = d.getVar('FILES_%s' % pkg) 120 files = d.getVar('FILES_%s' % pkg)
121 files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename) 121 files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename)
122 d.setVar('FILES_%s' % pkg, files) 122 d.setVar('FILES_%s' % pkg, files)
123 d.setVar('CONFFILES_%s' % pkg, files) 123
124 conffiles = d.getVar('CONFFILES_%s' % pkg)
125 conffiles = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (conffiles, basename, basename)
126 d.setVar('CONFFILES_%s' % pkg, conffiles)
124 127
125 if "description" in vals: 128 if "description" in vals:
126 old_desc = d.getVar('DESCRIPTION_' + pkg) or "" 129 old_desc = d.getVar('DESCRIPTION_' + pkg) or ""
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 1a444efabf..b03a286ed4 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -90,6 +90,8 @@ python __anonymous () {
90 imagedest = d.getVar('KERNEL_IMAGEDEST') 90 imagedest = d.getVar('KERNEL_IMAGEDEST')
91 91
92 for type in types.split(): 92 for type in types.split():
93 if bb.data.inherits_class('nopackages', d):
94 continue
93 typelower = type.lower() 95 typelower = type.lower()
94 d.appendVar('PACKAGES', ' %s-image-%s' % (kname, typelower)) 96 d.appendVar('PACKAGES', ' %s-image-%s' % (kname, typelower))
95 d.setVar('FILES_' + kname + '-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}' + ' /' + imagedest + '/' + type) 97 d.setVar('FILES_' + kname + '-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}' + ' /' + imagedest + '/' + type)
@@ -743,7 +745,7 @@ kernel_do_deploy() {
743 fi 745 fi
744 746
745 if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then 747 if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then
746 for imageType in ${KERNEL_IMAGETYPES} ; do 748 for imageType in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do
747 if [ "$imageType" = "fitImage" ] ; then 749 if [ "$imageType" = "fitImage" ] ; then
748 continue 750 continue
749 fi 751 fi
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index f90176d6c0..dc91118340 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -31,6 +31,7 @@ python do_populate_lic() {
31 f.write("%s: %s\n" % (key, info[key])) 31 f.write("%s: %s\n" % (key, info[key]))
32} 32}
33 33
34PSEUDO_IGNORE_PATHS .= ",${@','.join(((d.getVar('COMMON_LICENSE_DIR') or '') + ' ' + (d.getVar('LICENSE_PATH') or '')).split())}"
34# it would be better to copy them in do_install_append, but find_license_filesa is python 35# it would be better to copy them in do_install_append, but find_license_filesa is python
35python perform_packagecopy_prepend () { 36python perform_packagecopy_prepend () {
36 enabled = oe.data.typed_value('LICENSE_CREATE_PACKAGE', d) 37 enabled = oe.data.typed_value('LICENSE_CREATE_PACKAGE', d)
diff --git a/meta/classes/license_image.bbclass b/meta/classes/license_image.bbclass
index 702e9f9c55..6f478ce22c 100644
--- a/meta/classes/license_image.bbclass
+++ b/meta/classes/license_image.bbclass
@@ -125,7 +125,6 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
125 125
126 licenses = os.listdir(pkg_license_dir) 126 licenses = os.listdir(pkg_license_dir)
127 for lic in licenses: 127 for lic in licenses:
128 rootfs_license = os.path.join(rootfs_license_dir, lic)
129 pkg_license = os.path.join(pkg_license_dir, lic) 128 pkg_license = os.path.join(pkg_license_dir, lic)
130 pkg_rootfs_license = os.path.join(pkg_rootfs_license_dir, lic) 129 pkg_rootfs_license = os.path.join(pkg_rootfs_license_dir, lic)
131 130
@@ -144,6 +143,8 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
144 bad_licenses) == False: 143 bad_licenses) == False:
145 continue 144 continue
146 145
146 # Make sure we use only canonical name for the license file
147 rootfs_license = os.path.join(rootfs_license_dir, "generic_%s" % generic_lic)
147 if not os.path.exists(rootfs_license): 148 if not os.path.exists(rootfs_license):
148 oe.path.copyhardlink(pkg_license, rootfs_license) 149 oe.path.copyhardlink(pkg_license, rootfs_license)
149 150
@@ -209,7 +210,8 @@ def license_deployed_manifest(d):
209 os.unlink(lic_manifest_symlink_dir) 210 os.unlink(lic_manifest_symlink_dir)
210 211
211 # create the image dir symlink 212 # create the image dir symlink
212 os.symlink(lic_manifest_dir, lic_manifest_symlink_dir) 213 if lic_manifest_dir != lic_manifest_symlink_dir:
214 os.symlink(lic_manifest_dir, lic_manifest_symlink_dir)
213 215
214def get_deployed_dependencies(d): 216def get_deployed_dependencies(d):
215 """ 217 """
diff --git a/meta/classes/linuxloader.bbclass b/meta/classes/linuxloader.bbclass
index 720e5dfad4..b161c51a50 100644
--- a/meta/classes/linuxloader.bbclass
+++ b/meta/classes/linuxloader.bbclass
@@ -1,6 +1,6 @@
1def get_musl_loader_arch(d): 1def get_musl_loader_arch(d):
2 import re 2 import re
3 ldso_arch = None 3 ldso_arch = "NotSupported"
4 4
5 targetarch = d.getVar("TARGET_ARCH") 5 targetarch = d.getVar("TARGET_ARCH")
6 if targetarch.startswith("microblaze"): 6 if targetarch.startswith("microblaze"):
@@ -32,7 +32,7 @@ def get_musl_loader(d):
32def get_glibc_loader(d): 32def get_glibc_loader(d):
33 import re 33 import re
34 34
35 dynamic_loader = None 35 dynamic_loader = "NotSupported"
36 targetarch = d.getVar("TARGET_ARCH") 36 targetarch = d.getVar("TARGET_ARCH")
37 if targetarch in ["powerpc", "microblaze"]: 37 if targetarch in ["powerpc", "microblaze"]:
38 dynamic_loader = "${base_libdir}/ld.so.1" 38 dynamic_loader = "${base_libdir}/ld.so.1"
@@ -58,7 +58,7 @@ def get_linuxloader(d):
58 overrides = d.getVar("OVERRIDES").split(":") 58 overrides = d.getVar("OVERRIDES").split(":")
59 59
60 if "libc-baremetal" in overrides: 60 if "libc-baremetal" in overrides:
61 return None 61 return "NotSupported"
62 62
63 if "libc-musl" in overrides: 63 if "libc-musl" in overrides:
64 dynamic_loader = get_musl_loader(d) 64 dynamic_loader = get_musl_loader(d)
diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass
index 068032a1e5..55a6985fb0 100644
--- a/meta/classes/npm.bbclass
+++ b/meta/classes/npm.bbclass
@@ -17,8 +17,10 @@
17# NPM_INSTALL_DEV: 17# NPM_INSTALL_DEV:
18# Set to 1 to also install devDependencies. 18# Set to 1 to also install devDependencies.
19 19
20inherit python3native
21
20DEPENDS_prepend = "nodejs-native " 22DEPENDS_prepend = "nodejs-native "
21RDEPENDS_${PN}_prepend = "nodejs " 23RDEPENDS_${PN}_append_class-target = " nodejs"
22 24
23NPM_INSTALL_DEV ?= "0" 25NPM_INSTALL_DEV ?= "0"
24 26
@@ -130,11 +132,17 @@ python npm_do_configure() {
130 cached_manifest.pop("dependencies", None) 132 cached_manifest.pop("dependencies", None)
131 cached_manifest.pop("devDependencies", None) 133 cached_manifest.pop("devDependencies", None)
132 134
133 with open(orig_shrinkwrap_file, "r") as f: 135 has_shrinkwrap_file = True
134 orig_shrinkwrap = json.load(f) 136
137 try:
138 with open(orig_shrinkwrap_file, "r") as f:
139 orig_shrinkwrap = json.load(f)
140 except IOError:
141 has_shrinkwrap_file = False
135 142
136 cached_shrinkwrap = copy.deepcopy(orig_shrinkwrap) 143 if has_shrinkwrap_file:
137 cached_shrinkwrap.pop("dependencies", None) 144 cached_shrinkwrap = copy.deepcopy(orig_shrinkwrap)
145 cached_shrinkwrap.pop("dependencies", None)
138 146
139 # Manage the dependencies 147 # Manage the dependencies
140 progress = OutOfProgressHandler(d, r"^(\d+)/(\d+)$") 148 progress = OutOfProgressHandler(d, r"^(\d+)/(\d+)$")
@@ -165,8 +173,10 @@ python npm_do_configure() {
165 progress.write("%d/%d" % (progress_done, progress_total)) 173 progress.write("%d/%d" % (progress_done, progress_total))
166 174
167 dev = bb.utils.to_boolean(d.getVar("NPM_INSTALL_DEV"), False) 175 dev = bb.utils.to_boolean(d.getVar("NPM_INSTALL_DEV"), False)
168 foreach_dependencies(orig_shrinkwrap, _count_dependency, dev) 176
169 foreach_dependencies(orig_shrinkwrap, _cache_dependency, dev) 177 if has_shrinkwrap_file:
178 foreach_dependencies(orig_shrinkwrap, _count_dependency, dev)
179 foreach_dependencies(orig_shrinkwrap, _cache_dependency, dev)
170 180
171 # Configure the main package 181 # Configure the main package
172 with tempfile.TemporaryDirectory() as tmpdir: 182 with tempfile.TemporaryDirectory() as tmpdir:
@@ -181,16 +191,19 @@ python npm_do_configure() {
181 cached_manifest[depkey] = {} 191 cached_manifest[depkey] = {}
182 cached_manifest[depkey][name] = version 192 cached_manifest[depkey][name] = version
183 193
184 _update_manifest("dependencies") 194 if has_shrinkwrap_file:
195 _update_manifest("dependencies")
185 196
186 if dev: 197 if dev:
187 _update_manifest("devDependencies") 198 if has_shrinkwrap_file:
199 _update_manifest("devDependencies")
188 200
189 with open(cached_manifest_file, "w") as f: 201 with open(cached_manifest_file, "w") as f:
190 json.dump(cached_manifest, f, indent=2) 202 json.dump(cached_manifest, f, indent=2)
191 203
192 with open(cached_shrinkwrap_file, "w") as f: 204 if has_shrinkwrap_file:
193 json.dump(cached_shrinkwrap, f, indent=2) 205 with open(cached_shrinkwrap_file, "w") as f:
206 json.dump(cached_shrinkwrap, f, indent=2)
194} 207}
195 208
196python npm_do_compile() { 209python npm_do_compile() {
@@ -237,9 +250,7 @@ python npm_do_compile() {
237 sysroot = d.getVar("RECIPE_SYSROOT_NATIVE") 250 sysroot = d.getVar("RECIPE_SYSROOT_NATIVE")
238 nodedir = os.path.join(sysroot, d.getVar("prefix_native").strip("/")) 251 nodedir = os.path.join(sysroot, d.getVar("prefix_native").strip("/"))
239 configs.append(("nodedir", nodedir)) 252 configs.append(("nodedir", nodedir))
240 bindir = os.path.join(sysroot, d.getVar("bindir_native").strip("/")) 253 configs.append(("python", d.getVar("PYTHON")))
241 pythondir = os.path.join(bindir, "python-native", "python")
242 configs.append(("python", pythondir))
243 254
244 # Add node-pre-gyp configuration 255 # Add node-pre-gyp configuration
245 args.append(("target_arch", d.getVar("NPM_ARCH"))) 256 args.append(("target_arch", d.getVar("NPM_ARCH")))
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index e6236c0bb2..5a32e5c2e3 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -2340,7 +2340,7 @@ python do_package () {
2340 # cache. This is useful if an item this class depends on changes in a 2340 # cache. This is useful if an item this class depends on changes in a
2341 # way that the output of this class changes. rpmdeps is a good example 2341 # way that the output of this class changes. rpmdeps is a good example
2342 # as any change to rpmdeps requires this to be rerun. 2342 # as any change to rpmdeps requires this to be rerun.
2343 # PACKAGE_BBCLASS_VERSION = "2" 2343 # PACKAGE_BBCLASS_VERSION = "4"
2344 2344
2345 # Init cachedpath 2345 # Init cachedpath
2346 global cpath 2346 global cpath
@@ -2446,6 +2446,7 @@ python do_packagedata () {
2446 2446
2447 bb.build.exec_func("packagedata_translate_pr_autoinc", d) 2447 bb.build.exec_func("packagedata_translate_pr_autoinc", d)
2448} 2448}
2449do_packagedata[cleandirs] += "${WORKDIR}/pkgdata-pdata-input"
2449 2450
2450# Translate the EXTENDPRAUTO and AUTOINC to the final values 2451# Translate the EXTENDPRAUTO and AUTOINC to the final values
2451packagedata_translate_pr_autoinc() { 2452packagedata_translate_pr_autoinc() {
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 53b4700cdd..89b4c6bbfc 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -687,6 +687,7 @@ python do_package_rpm () {
687 cmd = cmd + " --define '_binary_payload w6T.xzdio'" 687 cmd = cmd + " --define '_binary_payload w6T.xzdio'"
688 cmd = cmd + " --define '_source_payload w6T.xzdio'" 688 cmd = cmd + " --define '_source_payload w6T.xzdio'"
689 cmd = cmd + " --define 'clamp_mtime_to_source_date_epoch 1'" 689 cmd = cmd + " --define 'clamp_mtime_to_source_date_epoch 1'"
690 cmd = cmd + " --define 'use_source_date_epoch_as_buildtime 1'"
690 cmd = cmd + " --define '_buildhost reproducible'" 691 cmd = cmd + " --define '_buildhost reproducible'"
691 if perfiledeps: 692 if perfiledeps:
692 cmd = cmd + " --define '__find_requires " + outdepends + "'" 693 cmd = cmd + " --define '__find_requires " + outdepends + "'"
diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass
index 49b1833265..635b3a6b80 100644
--- a/meta/classes/populate_sdk_base.bbclass
+++ b/meta/classes/populate_sdk_base.bbclass
@@ -178,7 +178,7 @@ do_populate_sdk[sstate-inputdirs] = "${SDKDEPLOYDIR}"
178do_populate_sdk[sstate-outputdirs] = "${SDK_DEPLOY}" 178do_populate_sdk[sstate-outputdirs] = "${SDK_DEPLOY}"
179do_populate_sdk[stamp-extra-info] = "${MACHINE_ARCH}${SDKMACHINE}" 179do_populate_sdk[stamp-extra-info] = "${MACHINE_ARCH}${SDKMACHINE}"
180 180
181PSEUDO_IGNORE_PATHS .= ",${SDKDEPLOYDIR}" 181PSEUDO_IGNORE_PATHS .= ",${SDKDEPLOYDIR},${WORKDIR}/oe-sdk-repo,${WORKDIR}/sstate-build-populate_sdk"
182 182
183fakeroot create_sdk_files() { 183fakeroot create_sdk_files() {
184 cp ${COREBASE}/scripts/relocate_sdk.py ${SDK_OUTPUT}/${SDKPATH}/ 184 cp ${COREBASE}/scripts/relocate_sdk.py ${SDK_OUTPUT}/${SDKPATH}/
@@ -329,6 +329,13 @@ def sdk_variables(d):
329 329
330do_populate_sdk[vardeps] += "${@sdk_variables(d)}" 330do_populate_sdk[vardeps] += "${@sdk_variables(d)}"
331 331
332python () {
333 variables = sdk_command_variables(d)
334 for var in variables:
335 if d.getVar(var, False):
336 d.setVarFlag(var, 'func', '1')
337}
338
332do_populate_sdk[file-checksums] += "${TOOLCHAIN_SHAR_REL_TMPL}:True \ 339do_populate_sdk[file-checksums] += "${TOOLCHAIN_SHAR_REL_TMPL}:True \
333 ${TOOLCHAIN_SHAR_EXT_TMPL}:True" 340 ${TOOLCHAIN_SHAR_EXT_TMPL}:True"
334 341
diff --git a/meta/classes/populate_sdk_ext.bbclass b/meta/classes/populate_sdk_ext.bbclass
index 6f35b612c2..14689ec6ac 100644
--- a/meta/classes/populate_sdk_ext.bbclass
+++ b/meta/classes/populate_sdk_ext.bbclass
@@ -24,6 +24,7 @@ SDK_INCLUDE_NATIVESDK ?= "0"
24SDK_INCLUDE_BUILDTOOLS ?= '1' 24SDK_INCLUDE_BUILDTOOLS ?= '1'
25 25
26SDK_RECRDEP_TASKS ?= "" 26SDK_RECRDEP_TASKS ?= ""
27SDK_CUSTOM_TEMPLATECONF ?= "0"
27 28
28SDK_LOCAL_CONF_WHITELIST ?= "" 29SDK_LOCAL_CONF_WHITELIST ?= ""
29SDK_LOCAL_CONF_BLACKLIST ?= "CONF_VERSION \ 30SDK_LOCAL_CONF_BLACKLIST ?= "CONF_VERSION \
@@ -199,6 +200,9 @@ python copy_buildsystem () {
199 buildsystem = oe.copy_buildsystem.BuildSystem('extensible SDK', d) 200 buildsystem = oe.copy_buildsystem.BuildSystem('extensible SDK', d)
200 baseoutpath = d.getVar('SDK_OUTPUT') + '/' + d.getVar('SDKPATH') 201 baseoutpath = d.getVar('SDK_OUTPUT') + '/' + d.getVar('SDKPATH')
201 202
203 #check if custome templateconf path is set
204 use_custom_templateconf = d.getVar('SDK_CUSTOM_TEMPLATECONF')
205
202 # Determine if we're building a derivative extensible SDK (from devtool build-sdk) 206 # Determine if we're building a derivative extensible SDK (from devtool build-sdk)
203 derivative = (d.getVar('SDK_DERIVATIVE') or '') == '1' 207 derivative = (d.getVar('SDK_DERIVATIVE') or '') == '1'
204 if derivative: 208 if derivative:
@@ -247,7 +251,9 @@ python copy_buildsystem () {
247 251
248 # Create a layer for new recipes / appends 252 # Create a layer for new recipes / appends
249 bbpath = d.getVar('BBPATH') 253 bbpath = d.getVar('BBPATH')
250 bb.process.run(['devtool', '--bbpath', bbpath, '--basepath', baseoutpath, 'create-workspace', '--create-only', os.path.join(baseoutpath, 'workspace')]) 254 env = os.environ.copy()
255 env['PYTHONDONTWRITEBYTECODE'] = '1'
256 bb.process.run(['devtool', '--bbpath', bbpath, '--basepath', baseoutpath, 'create-workspace', '--create-only', os.path.join(baseoutpath, 'workspace')], env=env)
251 257
252 # Create bblayers.conf 258 # Create bblayers.conf
253 bb.utils.mkdirhier(baseoutpath + '/conf') 259 bb.utils.mkdirhier(baseoutpath + '/conf')
@@ -360,6 +366,9 @@ python copy_buildsystem () {
360 # Hide the config information from bitbake output (since it's fixed within the SDK) 366 # Hide the config information from bitbake output (since it's fixed within the SDK)
361 f.write('BUILDCFG_HEADER = ""\n\n') 367 f.write('BUILDCFG_HEADER = ""\n\n')
362 368
369 # Write METADATA_REVISION
370 f.write('METADATA_REVISION = "%s"\n\n' % d.getVar('METADATA_REVISION'))
371
363 f.write('# Provide a flag to indicate we are in the EXT_SDK Context\n') 372 f.write('# Provide a flag to indicate we are in the EXT_SDK Context\n')
364 f.write('WITHIN_EXT_SDK = "1"\n\n') 373 f.write('WITHIN_EXT_SDK = "1"\n\n')
365 374
@@ -390,7 +399,7 @@ python copy_buildsystem () {
390 shutil.copyfile(builddir + '/cache/bb_unihashes.dat', baseoutpath + '/cache/bb_unihashes.dat') 399 shutil.copyfile(builddir + '/cache/bb_unihashes.dat', baseoutpath + '/cache/bb_unihashes.dat')
391 400
392 # Use templateconf.cfg file from builddir if exists 401 # Use templateconf.cfg file from builddir if exists
393 if os.path.exists(builddir + '/conf/templateconf.cfg'): 402 if os.path.exists(builddir + '/conf/templateconf.cfg') and use_custom_templateconf == '1':
394 shutil.copyfile(builddir + '/conf/templateconf.cfg', baseoutpath + '/conf/templateconf.cfg') 403 shutil.copyfile(builddir + '/conf/templateconf.cfg', baseoutpath + '/conf/templateconf.cfg')
395 else: 404 else:
396 # Write a templateconf.cfg 405 # Write a templateconf.cfg
diff --git a/meta/classes/python3native.bbclass b/meta/classes/python3native.bbclass
index d98fb4c758..2e3a88c126 100644
--- a/meta/classes/python3native.bbclass
+++ b/meta/classes/python3native.bbclass
@@ -17,8 +17,6 @@ export STAGING_LIBDIR
17export PYTHON_LIBRARY="${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so" 17export PYTHON_LIBRARY="${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so"
18export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}" 18export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}"
19 19
20export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
21
22# suppress host user's site-packages dirs. 20# suppress host user's site-packages dirs.
23export PYTHONNOUSERSITE = "1" 21export PYTHONNOUSERSITE = "1"
24 22
diff --git a/meta/classes/python3targetconfig.bbclass b/meta/classes/python3targetconfig.bbclass
new file mode 100644
index 0000000000..fc1025c207
--- /dev/null
+++ b/meta/classes/python3targetconfig.bbclass
@@ -0,0 +1,17 @@
1inherit python3native
2
3EXTRA_PYTHON_DEPENDS ?= ""
4EXTRA_PYTHON_DEPENDS_class-target = "python3"
5DEPENDS_append = " ${EXTRA_PYTHON_DEPENDS}"
6
7do_configure_prepend_class-target() {
8 export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
9}
10
11do_compile_prepend_class-target() {
12 export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
13}
14
15do_install_prepend_class-target() {
16 export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
17}
diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass
index 1a12db1206..9cb6b0bd31 100644
--- a/meta/classes/report-error.bbclass
+++ b/meta/classes/report-error.bbclass
@@ -6,6 +6,8 @@
6# 6#
7# Licensed under the MIT license, see COPYING.MIT for details 7# Licensed under the MIT license, see COPYING.MIT for details
8 8
9inherit base
10
9ERR_REPORT_DIR ?= "${LOG_DIR}/error-report" 11ERR_REPORT_DIR ?= "${LOG_DIR}/error-report"
10 12
11def errorreport_getdata(e): 13def errorreport_getdata(e):
@@ -64,6 +66,8 @@ python errorreport_handler () {
64 data['failures'] = [] 66 data['failures'] = []
65 data['component'] = " ".join(e.getPkgs()) 67 data['component'] = " ".join(e.getPkgs())
66 data['branch_commit'] = str(base_detect_branch(e.data)) + ": " + str(base_detect_revision(e.data)) 68 data['branch_commit'] = str(base_detect_branch(e.data)) + ": " + str(base_detect_revision(e.data))
69 data['bitbake_version'] = e.data.getVar("BB_VERSION")
70 data['layer_version'] = get_layers_branch_rev(e.data)
67 data['local_conf'] = get_conf_data(e, 'local.conf') 71 data['local_conf'] = get_conf_data(e, 'local.conf')
68 data['auto_conf'] = get_conf_data(e, 'auto.conf') 72 data['auto_conf'] = get_conf_data(e, 'auto.conf')
69 lock = bb.utils.lockfile(datafile + '.lock') 73 lock = bb.utils.lockfile(datafile + '.lock')
diff --git a/meta/classes/rootfs_deb.bbclass b/meta/classes/rootfs_deb.bbclass
index ef616da229..0469ba7059 100644
--- a/meta/classes/rootfs_deb.bbclass
+++ b/meta/classes/rootfs_deb.bbclass
@@ -32,4 +32,8 @@ python () {
32 d.setVar('DEB_SDK_ARCH', 'amd64') 32 d.setVar('DEB_SDK_ARCH', 'amd64')
33 elif darch == "arm": 33 elif darch == "arm":
34 d.setVar('DEB_SDK_ARCH', 'armel') 34 d.setVar('DEB_SDK_ARCH', 'armel')
35 elif darch == "aarch64":
36 d.setVar('DEB_SDK_ARCH', 'arm64')
37 else:
38 bb.fatal("Unhandled SDK_ARCH %s" % darch)
35} 39}
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 3262d08fbf..03a9792f68 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -703,6 +703,23 @@ def check_sanity_version_change(status, d):
703 if (tmpdirmode & stat.S_ISUID): 703 if (tmpdirmode & stat.S_ISUID):
704 status.addresult("TMPDIR is setuid, please don't build in a setuid directory") 704 status.addresult("TMPDIR is setuid, please don't build in a setuid directory")
705 705
706 # Check that a user isn't building in a path in PSEUDO_IGNORE_PATHS
707 pseudoignorepaths = d.getVar('PSEUDO_IGNORE_PATHS', expand=True).split(",")
708 workdir = d.getVar('WORKDIR', expand=True)
709 for i in pseudoignorepaths:
710 if i and workdir.startswith(i):
711 status.addresult("You are building in a path included in PSEUDO_IGNORE_PATHS " + str(i) + " please locate the build outside this path.\n")
712
713 # Check if PSEUDO_IGNORE_PATHS and and paths under pseudo control overlap
714 pseudoignorepaths = d.getVar('PSEUDO_IGNORE_PATHS', expand=True).split(",")
715 pseudo_control_dir = "${D},${PKGD},${PKGDEST},${IMAGEROOTFS},${SDK_OUTPUT}"
716 pseudocontroldir = d.expand(pseudo_control_dir).split(",")
717 for i in pseudoignorepaths:
718 for j in pseudocontroldir:
719 if i and j:
720 if j.startswith(i):
721 status.addresult("A path included in PSEUDO_IGNORE_PATHS " + str(i) + " and the path " + str(j) + " overlap and this will break pseudo permission and ownership tracking. Please set the path " + str(j) + " to a different directory which does not overlap with pseudo controlled directories. \n")
722
706 # Some third-party software apparently relies on chmod etc. being suid root (!!) 723 # Some third-party software apparently relies on chmod etc. being suid root (!!)
707 import stat 724 import stat
708 suid_check_bins = "chown chmod mknod".split() 725 suid_check_bins = "chown chmod mknod".split()
@@ -787,6 +804,11 @@ def check_sanity_everybuild(status, d):
787 if "." in paths or "./" in paths or "" in paths: 804 if "." in paths or "./" in paths or "" in paths:
788 status.addresult("PATH contains '.', './' or '' (empty element), which will break the build, please remove this.\nParsed PATH is " + str(paths) + "\n") 805 status.addresult("PATH contains '.', './' or '' (empty element), which will break the build, please remove this.\nParsed PATH is " + str(paths) + "\n")
789 806
807 #Check if bitbake is present in PATH environment variable
808 bb_check = bb.utils.which(d.getVar('PATH'), 'bitbake')
809 if not bb_check:
810 bb.warn("bitbake binary is not found in PATH, did you source the script?")
811
790 # Check whether 'inherit' directive is found (used for a class to inherit) 812 # Check whether 'inherit' directive is found (used for a class to inherit)
791 # in conf file it's supposed to be uppercase INHERIT 813 # in conf file it's supposed to be uppercase INHERIT
792 inherit = d.getVar('inherit') 814 inherit = d.getVar('inherit')
@@ -860,13 +882,18 @@ def check_sanity_everybuild(status, d):
860 except: 882 except:
861 pass 883 pass
862 884
863 oeroot = d.getVar('COREBASE') 885 for checkdir in ['COREBASE', 'TMPDIR']:
864 if oeroot.find('+') != -1: 886 val = d.getVar(checkdir)
865 status.addresult("Error, you have an invalid character (+) in your COREBASE directory path. Please move the installation to a directory which doesn't include any + characters.") 887 if val.find('..') != -1:
866 if oeroot.find('@') != -1: 888 status.addresult("Error, you have '..' in your %s directory path. Please ensure the variable contains an absolute path as this can break some recipe builds in obtuse ways." % checkdir)
867 status.addresult("Error, you have an invalid character (@) in your COREBASE directory path. Please move the installation to a directory which doesn't include any @ characters.") 889 if val.find('+') != -1:
868 if oeroot.find(' ') != -1: 890 status.addresult("Error, you have an invalid character (+) in your %s directory path. Please move the installation to a directory which doesn't include any + characters." % checkdir)
869 status.addresult("Error, you have a space in your COREBASE directory path. Please move the installation to a directory which doesn't include a space since autotools doesn't support this.") 891 if val.find('@') != -1:
892 status.addresult("Error, you have an invalid character (@) in your %s directory path. Please move the installation to a directory which doesn't include any @ characters." % checkdir)
893 if val.find(' ') != -1:
894 status.addresult("Error, you have a space in your %s directory path. Please move the installation to a directory which doesn't include a space since autotools doesn't support this." % checkdir)
895 if val.find('%') != -1:
896 status.addresult("Error, you have an invalid character (%) in your %s directory path which causes problems with python string formatting. Please move the installation to a directory which doesn't include any % characters." % checkdir)
870 897
871 # Check the format of MIRRORS, PREMIRRORS and SSTATE_MIRRORS 898 # Check the format of MIRRORS, PREMIRRORS and SSTATE_MIRRORS
872 import re 899 import re
diff --git a/meta/classes/scons.bbclass b/meta/classes/scons.bbclass
index 6b171ca8df..4f3ae502ef 100644
--- a/meta/classes/scons.bbclass
+++ b/meta/classes/scons.bbclass
@@ -5,7 +5,6 @@ DEPENDS += "python3-scons-native"
5EXTRA_OESCONS ?= "" 5EXTRA_OESCONS ?= ""
6 6
7do_configure() { 7do_configure() {
8 unset _PYTHON_SYSCONFIGDATA_NAME
9 if [ -n "${CONFIGURESTAMPFILE}" ]; then 8 if [ -n "${CONFIGURESTAMPFILE}" ]; then
10 if [ -e "${CONFIGURESTAMPFILE}" -a "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" -a "${CLEANBROKEN}" != "1" ]; then 9 if [ -e "${CONFIGURESTAMPFILE}" -a "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" -a "${CLEANBROKEN}" != "1" ]; then
11 ${STAGING_BINDIR_NATIVE}/scons --clean PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS} 10 ${STAGING_BINDIR_NATIVE}/scons --clean PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS}
@@ -17,13 +16,11 @@ do_configure() {
17} 16}
18 17
19scons_do_compile() { 18scons_do_compile() {
20 unset _PYTHON_SYSCONFIGDATA_NAME
21 ${STAGING_BINDIR_NATIVE}/scons ${PARALLEL_MAKE} PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS} || \ 19 ${STAGING_BINDIR_NATIVE}/scons ${PARALLEL_MAKE} PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS} || \
22 die "scons build execution failed." 20 die "scons build execution failed."
23} 21}
24 22
25scons_do_install() { 23scons_do_install() {
26 unset _PYTHON_SYSCONFIGDATA_NAME
27 ${STAGING_BINDIR_NATIVE}/scons install_root=${D}${prefix} PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS} install || \ 24 ${STAGING_BINDIR_NATIVE}/scons install_root=${D}${prefix} PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS} install || \
28 die "scons install execution failed." 25 die "scons install execution failed."
29} 26}
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index a8ae75101d..d08d950e76 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -72,6 +72,7 @@ BB_HASHFILENAME = "False ${SSTATE_PKGSPEC} ${SSTATE_SWSPEC}"
72 72
73SSTATE_ARCHS = " \ 73SSTATE_ARCHS = " \
74 ${BUILD_ARCH} \ 74 ${BUILD_ARCH} \
75 ${BUILD_ARCH}_${ORIGNATIVELSBSTRING} \
75 ${BUILD_ARCH}_${SDK_ARCH}_${SDK_OS} \ 76 ${BUILD_ARCH}_${SDK_ARCH}_${SDK_OS} \
76 ${BUILD_ARCH}_${TARGET_ARCH} \ 77 ${BUILD_ARCH}_${TARGET_ARCH} \
77 ${SDK_ARCH}_${SDK_OS} \ 78 ${SDK_ARCH}_${SDK_OS} \
@@ -80,6 +81,7 @@ SSTATE_ARCHS = " \
80 ${PACKAGE_ARCH} \ 81 ${PACKAGE_ARCH} \
81 ${PACKAGE_EXTRA_ARCHS} \ 82 ${PACKAGE_EXTRA_ARCHS} \
82 ${MACHINE_ARCH}" 83 ${MACHINE_ARCH}"
84SSTATE_ARCHS[vardepsexclude] = "ORIGNATIVELSBSTRING"
83 85
84SSTATE_MANMACH ?= "${SSTATE_PKGARCH}" 86SSTATE_MANMACH ?= "${SSTATE_PKGARCH}"
85 87
@@ -121,6 +123,8 @@ SSTATE_HASHEQUIV_REPORT_TASKDATA[doc] = "Report additional useful data to the \
121python () { 123python () {
122 if bb.data.inherits_class('native', d): 124 if bb.data.inherits_class('native', d):
123 d.setVar('SSTATE_PKGARCH', d.getVar('BUILD_ARCH', False)) 125 d.setVar('SSTATE_PKGARCH', d.getVar('BUILD_ARCH', False))
126 if d.getVar("PN") == "pseudo-native":
127 d.appendVar('SSTATE_PKGARCH', '_${ORIGNATIVELSBSTRING}')
124 elif bb.data.inherits_class('crosssdk', d): 128 elif bb.data.inherits_class('crosssdk', d):
125 d.setVar('SSTATE_PKGARCH', d.expand("${BUILD_ARCH}_${SDK_ARCH}_${SDK_OS}")) 129 d.setVar('SSTATE_PKGARCH', d.expand("${BUILD_ARCH}_${SDK_ARCH}_${SDK_OS}"))
126 elif bb.data.inherits_class('cross', d): 130 elif bb.data.inherits_class('cross', d):
diff --git a/meta/classes/staging.bbclass b/meta/classes/staging.bbclass
index f0a619b35b..8165ab268e 100644
--- a/meta/classes/staging.bbclass
+++ b/meta/classes/staging.bbclass
@@ -27,11 +27,15 @@ SYSROOT_DIRS_BLACKLIST = " \
27 ${mandir} \ 27 ${mandir} \
28 ${docdir} \ 28 ${docdir} \
29 ${infodir} \ 29 ${infodir} \
30 ${datadir}/X11/locale \
30 ${datadir}/applications \ 31 ${datadir}/applications \
32 ${datadir}/bash-completion \
31 ${datadir}/fonts \ 33 ${datadir}/fonts \
32 ${datadir}/gtk-doc/html \ 34 ${datadir}/gtk-doc/html \
35 ${datadir}/installed-tests \
33 ${datadir}/locale \ 36 ${datadir}/locale \
34 ${datadir}/pixmaps \ 37 ${datadir}/pixmaps \
38 ${datadir}/terminfo \
35 ${libdir}/${BPN}/ptest \ 39 ${libdir}/${BPN}/ptest \
36" 40"
37 41
diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass
index 9e8a82c9f1..a4bff732b9 100644
--- a/meta/classes/systemd.bbclass
+++ b/meta/classes/systemd.bbclass
@@ -174,7 +174,8 @@ python systemd_populate_packages() {
174 if path_found != '': 174 if path_found != '':
175 systemd_add_files_and_parse(pkg_systemd, path_found, service, keys) 175 systemd_add_files_and_parse(pkg_systemd, path_found, service, keys)
176 else: 176 else:
177 bb.fatal("SYSTEMD_SERVICE_%s value %s does not exist" % (pkg_systemd, service)) 177 bb.fatal("Didn't find service unit '{0}', specified in SYSTEMD_SERVICE_{1}. {2}".format(
178 service, pkg_systemd, "Also looked for service unit '{0}'.".format(base) if base is not None else ""))
178 179
179 def systemd_create_presets(pkg, action): 180 def systemd_create_presets(pkg, action):
180 presetf = oe.path.join(d.getVar("PKGD"), d.getVar("systemd_unitdir"), "system-preset/98-%s.preset" % pkg) 181 presetf = oe.path.join(d.getVar("PKGD"), d.getVar("systemd_unitdir"), "system-preset/98-%s.preset" % pkg)
diff --git a/meta/conf/abi_version.conf b/meta/conf/abi_version.conf
index 5318a10190..251d43bb21 100644
--- a/meta/conf/abi_version.conf
+++ b/meta/conf/abi_version.conf
@@ -12,4 +12,4 @@ OELAYOUT_ABI = "14"
12# a reset of the equivalence, for example when reproducibility issues break the 12# a reset of the equivalence, for example when reproducibility issues break the
13# existing match data. Distros can also append to this value for the same effect. 13# existing match data. Distros can also append to this value for the same effect.
14# 14#
15HASHEQUIV_HASH_VERSION = "3" 15HASHEQUIV_HASH_VERSION = "4"
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 0d38eac094..eb282d1741 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -685,17 +685,21 @@ SRC_URI = ""
685PSEUDO_LOCALSTATEDIR ?= "${WORKDIR}/pseudo/" 685PSEUDO_LOCALSTATEDIR ?= "${WORKDIR}/pseudo/"
686PSEUDO_PASSWD ?= "${STAGING_DIR_TARGET}:${PSEUDO_SYSROOT}" 686PSEUDO_PASSWD ?= "${STAGING_DIR_TARGET}:${PSEUDO_SYSROOT}"
687PSEUDO_SYSROOT = "${COMPONENTS_DIR}/${BUILD_ARCH}/pseudo-native" 687PSEUDO_SYSROOT = "${COMPONENTS_DIR}/${BUILD_ARCH}/pseudo-native"
688PSEUDO_IGNORE_PATHS = "/usr/,/etc/,/lib,/dev/,${T},${WORKDIR}/recipe-sysroot,${SSTATE_DIR},${STAMPS_DIR},${WORKDIR}/pkgdata-sysroot,${TMPDIR}/sstate-control,${DEPLOY_DIR},${WORKDIR}/deploy-,${TMPDIR}/buildstats,${WORKDIR}/sstate-build-package_,${WORKDIR}/sstate-install-package_,${WORKDIR}/sstate-build-image_complete,${TMPDIR}/sysroots-components,${BUILDHISTORY_DIR},${TMPDIR}/pkgdata,${TOPDIR}/cache,${COREBASE}/scripts,${COREBASE}/meta,${CCACHE_DIR}" 688PSEUDO_IGNORE_PATHS = "/usr/,/etc/,/lib,/dev/,/run/,${T},${WORKDIR}/recipe-sysroot,${SSTATE_DIR},${STAMPS_DIR}"
689PSEUDO_IGNORE_PATHS .= ",${TMPDIR}/sstate-control,${TMPDIR}/buildstats,${TMPDIR}/sysroots-components,${TMPDIR}/pkgdata"
690PSEUDO_IGNORE_PATHS .= ",${WORKDIR}/deploy-,${WORKDIR}/sstate-build-package_,${WORKDIR}/sstate-install-package_,${WORKDIR}/pkgdata-sysroot"
691PSEUDO_IGNORE_PATHS .= ",${DEPLOY_DIR},${BUILDHISTORY_DIR},${TOPDIR}/cache,${COREBASE}/scripts,${CCACHE_DIR}"
689 692
690export PSEUDO_DISABLED = "1" 693export PSEUDO_DISABLED = "1"
691#export PSEUDO_PREFIX = "${STAGING_DIR_NATIVE}${prefix_native}" 694#export PSEUDO_PREFIX = "${STAGING_DIR_NATIVE}${prefix_native}"
692#export PSEUDO_BINDIR = "${STAGING_DIR_NATIVE}${bindir_native}" 695#export PSEUDO_BINDIR = "${STAGING_DIR_NATIVE}${bindir_native}"
693#export PSEUDO_LIBDIR = "${STAGING_DIR_NATIVE}$PSEUDOBINDIR/../lib/pseudo/lib 696#export PSEUDO_LIBDIR = "${STAGING_DIR_NATIVE}$PSEUDOBINDIR/../lib/pseudo/lib
694FAKEROOTBASEENV = "PSEUDO_BINDIR=${PSEUDO_SYSROOT}${bindir_native} PSEUDO_LIBDIR=${PSEUDO_SYSROOT}${prefix_native}/lib/pseudo/lib PSEUDO_PREFIX=${PSEUDO_SYSROOT}${prefix_native} PSEUDO_IGNORE_PATHS=${PSEUDO_IGNORE_PATHS} PSEUDO_DISABLED=1" 697FAKEROOTBASEENV = "PSEUDO_BINDIR=${PSEUDO_SYSROOT}${bindir_native} PSEUDO_LIBDIR=${PSEUDO_SYSROOT}${prefix_native}/lib/pseudo/lib PSEUDO_PREFIX=${PSEUDO_SYSROOT}${prefix_native} PSEUDO_IGNORE_PATHS=${@oe.path.canonicalize(d.getVar('PSEUDO_IGNORE_PATHS'))} PSEUDO_DISABLED=1 PYTHONDONTWRITEBYTECODE=1"
695FAKEROOTCMD = "${PSEUDO_SYSROOT}${bindir_native}/pseudo" 698FAKEROOTCMD = "${PSEUDO_SYSROOT}${bindir_native}/pseudo"
696FAKEROOTENV = "PSEUDO_PREFIX=${PSEUDO_SYSROOT}${prefix_native} PSEUDO_LOCALSTATEDIR=${PSEUDO_LOCALSTATEDIR} PSEUDO_PASSWD=${PSEUDO_PASSWD} PSEUDO_NOSYMLINKEXP=1 PSEUDO_IGNORE_PATHS=${PSEUDO_IGNORE_PATHS} PSEUDO_DISABLED=0" 699FAKEROOTENV = "PSEUDO_PREFIX=${PSEUDO_SYSROOT}${prefix_native} PSEUDO_LOCALSTATEDIR=${PSEUDO_LOCALSTATEDIR} PSEUDO_PASSWD=${PSEUDO_PASSWD} PSEUDO_NOSYMLINKEXP=1 PSEUDO_IGNORE_PATHS=${@oe.path.canonicalize(d.getVar('PSEUDO_IGNORE_PATHS'))} PSEUDO_DISABLED=0"
697FAKEROOTNOENV = "PSEUDO_UNLOAD=1" 700FAKEROOTNOENV = "PSEUDO_UNLOAD=1"
698FAKEROOTDIRS = "${PSEUDO_LOCALSTATEDIR}" 701FAKEROOTDIRS = "${PSEUDO_LOCALSTATEDIR}"
702FAKEROOTLOGS = "${WORKDIR}/pseudo/pseudo.log"
699PREFERRED_PROVIDER_virtual/fakeroot-native ?= "pseudo-native" 703PREFERRED_PROVIDER_virtual/fakeroot-native ?= "pseudo-native"
700 704
701################################################################## 705##################################################################
diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index ce13368c2e..e0a876dbdc 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -60,6 +60,7 @@ PTESTS_FAST_remove_mips64 = "qemu-ptest"
60# bash-ptest \ # Test outcomes are non-deterministic by design 60# bash-ptest \ # Test outcomes are non-deterministic by design
61# ifupdown-ptest \ # Tested separately in lib/oeqa/selftest/cases/imagefeatures.py 61# ifupdown-ptest \ # Tested separately in lib/oeqa/selftest/cases/imagefeatures.py
62# mdadm-ptest \ # Tests rely on non-deterministic sleep() amounts 62# mdadm-ptest \ # Tests rely on non-deterministic sleep() amounts
63# libinput-ptest \ # Tests need an unloaded system to be reliable
63#" 64#"
64 65
65PTESTS_SLOW = "\ 66PTESTS_SLOW = "\
@@ -72,7 +73,6 @@ PTESTS_SLOW = "\
72 glib-2.0-ptest \ 73 glib-2.0-ptest \
73 gstreamer1.0-ptest \ 74 gstreamer1.0-ptest \
74 libevent-ptest \ 75 libevent-ptest \
75 libinput-ptest \
76 lttng-tools-ptest \ 76 lttng-tools-ptest \
77 openssh-ptest \ 77 openssh-ptest \
78 openssl-ptest \ 78 openssl-ptest \
diff --git a/meta/conf/distro/include/yocto-uninative.inc b/meta/conf/distro/include/yocto-uninative.inc
index 69b6edee5f..a2a2dd18ec 100644
--- a/meta/conf/distro/include/yocto-uninative.inc
+++ b/meta/conf/distro/include/yocto-uninative.inc
@@ -6,9 +6,9 @@
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.32" 9UNINATIVE_MAXGLIBCVERSION = "2.33"
10 10
11UNINATIVE_URL ?= "http://downloads.yoctoproject.org/releases/uninative/2.9/" 11UNINATIVE_URL ?= "http://downloads.yoctoproject.org/releases/uninative/3.0/"
12UNINATIVE_CHECKSUM[aarch64] ?= "9f25a667aee225b1dd65c4aea73e01983e825b1cb9b56937932a1ee328b45f81" 12UNINATIVE_CHECKSUM[aarch64] ?= "1c668909098c5b56132067adc69a249cb771f4560428e5822de903a12d97bf33"
13UNINATIVE_CHECKSUM[i686] ?= "cae5d73245d95b07cf133b780ba3f6c8d0adca3ffc4e7e7fab999961d5e24d36" 13UNINATIVE_CHECKSUM[i686] ?= "e6cc2fc056234cffa6a2ff084cce27d544ea3f487a62b5e253351cefd4421900"
14UNINATIVE_CHECKSUM[x86_64] ?= "d07916b95c419c81541a19c8ef0ed8cbd78ae18437ff28a4c8a60ef40518e423" 14UNINATIVE_CHECKSUM[x86_64] ?= "5ec5a9276046e7eceeac749a18b175667384e1f445cd4526300a41404d985a5b"
diff --git a/meta/conf/machine/include/qemu.inc b/meta/conf/machine/include/qemu.inc
index 8dedb1a42d..7d0a6fe458 100644
--- a/meta/conf/machine/include/qemu.inc
+++ b/meta/conf/machine/include/qemu.inc
@@ -21,7 +21,7 @@ RDEPENDS_${KERNEL_PACKAGE_NAME}-base = ""
21# Use a common kernel recipe for all QEMU machines 21# Use a common kernel recipe for all QEMU machines
22PREFERRED_PROVIDER_virtual/kernel ??= "linux-yocto" 22PREFERRED_PROVIDER_virtual/kernel ??= "linux-yocto"
23 23
24EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native" 24EXTRA_IMAGEDEPENDS += "qemu-system-native qemu-helper-native"
25 25
26# Provide the nfs server kernel module for all qemu images 26# Provide the nfs server kernel module for all qemu images
27KERNEL_FEATURES_append_pn-linux-yocto = " features/nfsd/nfsd-enable.scc" 27KERNEL_FEATURES_append_pn-linux-yocto = " features/nfsd/nfsd-enable.scc"
diff --git a/meta/files/fs-perms-persistent-log.txt b/meta/files/fs-perms-persistent-log.txt
index 3a7cf3ab94..518c1be3c9 100644
--- a/meta/files/fs-perms-persistent-log.txt
+++ b/meta/files/fs-perms-persistent-log.txt
@@ -41,7 +41,7 @@ ${includedir} 0755 root root true 0644 root root
41${oldincludedir} 0755 root root true 0644 root root 41${oldincludedir} 0755 root root true 0644 root root
42 42
43# Cleanup debug src 43# Cleanup debug src
44/usr/src/debug 0755 root root true - root root 44/usr/src/debug 0755 root root true 0644 root root
45 45
46# Items from base-files 46# Items from base-files
47# Links 47# Links
diff --git a/meta/files/fs-perms.txt b/meta/files/fs-perms.txt
index c8c3ac5dbe..daa4aed840 100644
--- a/meta/files/fs-perms.txt
+++ b/meta/files/fs-perms.txt
@@ -41,7 +41,7 @@ ${includedir} 0755 root root true 0644 root root
41${oldincludedir} 0755 root root true 0644 root root 41${oldincludedir} 0755 root root true 0644 root root
42 42
43# Cleanup debug src 43# Cleanup debug src
44/usr/src/debug 0755 root root true - root root 44/usr/src/debug 0755 root root true 0644 root root
45 45
46# Items from base-files 46# Items from base-files
47# Links 47# Links
diff --git a/meta/files/toolchain-shar-extract.sh b/meta/files/toolchain-shar-extract.sh
index bea6d4189a..dd9342758b 100644
--- a/meta/files/toolchain-shar-extract.sh
+++ b/meta/files/toolchain-shar-extract.sh
@@ -95,7 +95,7 @@ while getopts ":yd:npDRSl" OPT; do
95 listcontents=1 95 listcontents=1
96 ;; 96 ;;
97 *) 97 *)
98 echo "Usage: $(basename $0) [-y] [-d <dir>]" 98 echo "Usage: $(basename "$0") [-y] [-d <dir>]"
99 echo " -y Automatic yes to all prompts" 99 echo " -y Automatic yes to all prompts"
100 echo " -d <dir> Install the SDK to <dir>" 100 echo " -d <dir> Install the SDK to <dir>"
101 echo "======== Extensible SDK only options ============" 101 echo "======== Extensible SDK only options ============"
@@ -111,17 +111,17 @@ while getopts ":yd:npDRSl" OPT; do
111 esac 111 esac
112done 112done
113 113
114payload_offset=$(($(grep -na -m1 "^MARKER:$" $0|cut -d':' -f1) + 1)) 114payload_offset=$(($(grep -na -m1 "^MARKER:$" "$0"|cut -d':' -f1) + 1))
115if [ "$listcontents" = "1" ] ; then 115if [ "$listcontents" = "1" ] ; then
116 if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then 116 if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then
117 tail -n +$payload_offset $0 > sdk.zip 117 tail -n +$payload_offset "$0" > sdk.zip
118 if unzip -l sdk.zip;then 118 if unzip -l sdk.zip;then
119 rm sdk.zip 119 rm sdk.zip
120 else 120 else
121 rm sdk.zip && exit 1 121 rm sdk.zip && exit 1
122 fi 122 fi
123 else 123 else
124 tail -n +$payload_offset $0| tar tvJ || exit 1 124 tail -n +$payload_offset "$0"| tar tvJ || exit 1
125 fi 125 fi
126 exit 126 exit
127fi 127fi
@@ -242,14 +242,14 @@ fi
242 242
243printf "Extracting SDK..." 243printf "Extracting SDK..."
244if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then 244if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then
245 tail -n +$payload_offset $0 > sdk.zip 245 tail -n +$payload_offset "$0" > sdk.zip
246 if $SUDO_EXEC unzip $EXTRA_TAR_OPTIONS sdk.zip -d $target_sdk_dir;then 246 if $SUDO_EXEC unzip $EXTRA_TAR_OPTIONS sdk.zip -d $target_sdk_dir;then
247 rm sdk.zip 247 rm sdk.zip
248 else 248 else
249 rm sdk.zip && exit 1 249 rm sdk.zip && exit 1
250 fi 250 fi
251else 251else
252 tail -n +$payload_offset $0| $SUDO_EXEC tar mxJ -C $target_sdk_dir --checkpoint=.2500 $EXTRA_TAR_OPTIONS || exit 1 252 tail -n +$payload_offset "$0"| $SUDO_EXEC tar mxJ -C $target_sdk_dir --checkpoint=.2500 $EXTRA_TAR_OPTIONS || exit 1
253fi 253fi
254echo "done" 254echo "done"
255 255
diff --git a/meta/files/toolchain-shar-relocate.sh b/meta/files/toolchain-shar-relocate.sh
index e3c10018ef..5433741296 100644
--- a/meta/files/toolchain-shar-relocate.sh
+++ b/meta/files/toolchain-shar-relocate.sh
@@ -55,8 +55,11 @@ fi
55for replace in "$target_sdk_dir -maxdepth 1" "$native_sysroot"; do 55for replace in "$target_sdk_dir -maxdepth 1" "$native_sysroot"; do
56 $SUDO_EXEC find $replace -type f 56 $SUDO_EXEC find $replace -type f
57done | xargs -n100 file | grep ":.*\(ASCII\|script\|source\).*text" | \ 57done | xargs -n100 file | grep ":.*\(ASCII\|script\|source\).*text" | \
58 awk -F':' '{printf "\"%s\"\n", $1}' | \ 58 awk -F': ' '{printf "\"%s\"\n", $1}' | \
59 grep -Ev "$target_sdk_dir/(environment-setup-*|relocate_sdk*|${0##*/})" | \ 59 grep -Fv -e "$target_sdk_dir/environment-setup-" \
60 -e "$target_sdk_dir/relocate_sdk" \
61 -e "$target_sdk_dir/post-relocate-setup" \
62 -e "$target_sdk_dir/${0##*/}" | \
60 xargs -n100 $SUDO_EXEC sed -i \ 63 xargs -n100 $SUDO_EXEC sed -i \
61 -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" \ 64 -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" \
62 -e "s:^#! */usr/bin/perl.*:#! /usr/bin/env perl:g" \ 65 -e "s:^#! */usr/bin/perl.*:#! /usr/bin/env perl:g" \
diff --git a/meta/lib/oe/copy_buildsystem.py b/meta/lib/oe/copy_buildsystem.py
index 31a84f5b06..d97bf9d1b9 100644
--- a/meta/lib/oe/copy_buildsystem.py
+++ b/meta/lib/oe/copy_buildsystem.py
@@ -20,7 +20,7 @@ def _smart_copy(src, dest):
20 mode = os.stat(src).st_mode 20 mode = os.stat(src).st_mode
21 if stat.S_ISDIR(mode): 21 if stat.S_ISDIR(mode):
22 bb.utils.mkdirhier(dest) 22 bb.utils.mkdirhier(dest)
23 cmd = "tar --exclude='.git' --xattrs --xattrs-include='*' -chf - -C %s -p . \ 23 cmd = "tar --exclude='.git' --exclude='__pycache__' --xattrs --xattrs-include='*' -chf - -C %s -p . \
24 | tar --xattrs --xattrs-include='*' -xf - -C %s" % (src, dest) 24 | tar --xattrs --xattrs-include='*' -xf - -C %s" % (src, dest)
25 subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) 25 subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
26 else: 26 else:
@@ -259,7 +259,7 @@ def create_locked_sstate_cache(lockedsigs, input_sstate_cache, output_sstate_cac
259 bb.note('Generating sstate-cache...') 259 bb.note('Generating sstate-cache...')
260 260
261 nativelsbstring = d.getVar('NATIVELSBSTRING') 261 nativelsbstring = d.getVar('NATIVELSBSTRING')
262 bb.process.run("gen-lockedsig-cache %s %s %s %s %s" % (lockedsigs, input_sstate_cache, output_sstate_cache, nativelsbstring, filterfile or '')) 262 bb.process.run("PYTHONDONTWRITEBYTECODE=1 gen-lockedsig-cache %s %s %s %s %s" % (lockedsigs, input_sstate_cache, output_sstate_cache, nativelsbstring, filterfile or ''))
263 if fixedlsbstring and nativelsbstring != fixedlsbstring: 263 if fixedlsbstring and nativelsbstring != fixedlsbstring:
264 nativedir = output_sstate_cache + '/' + nativelsbstring 264 nativedir = output_sstate_cache + '/' + nativelsbstring
265 if os.path.isdir(nativedir): 265 if os.path.isdir(nativedir):
@@ -286,7 +286,7 @@ def check_sstate_task_list(d, targets, filteroutfile, cmdprefix='', cwd=None, lo
286 logparam = '-l %s' % logfile 286 logparam = '-l %s' % logfile
287 else: 287 else:
288 logparam = '' 288 logparam = ''
289 cmd = "%sBB_SETSCENE_ENFORCE=1 PSEUDO_DISABLED=1 oe-check-sstate %s -s -o %s %s" % (cmdprefix, targets, filteroutfile, logparam) 289 cmd = "%sPYTHONDONTWRITEBYTECODE=1 BB_SETSCENE_ENFORCE=1 PSEUDO_DISABLED=1 oe-check-sstate %s -s -o %s %s" % (cmdprefix, targets, filteroutfile, logparam)
290 env = dict(d.getVar('BB_ORIGENV', False)) 290 env = dict(d.getVar('BB_ORIGENV', False))
291 env.pop('BUILDDIR', '') 291 env.pop('BUILDDIR', '')
292 env.pop('BBPATH', '') 292 env.pop('BBPATH', '')
diff --git a/meta/lib/oe/cve_check.py b/meta/lib/oe/cve_check.py
new file mode 100644
index 0000000000..a1d7c292af
--- /dev/null
+++ b/meta/lib/oe/cve_check.py
@@ -0,0 +1,65 @@
1import collections
2import re
3import itertools
4import functools
5
6_Version = collections.namedtuple(
7 "_Version", ["release", "patch_l", "pre_l", "pre_v"]
8)
9
10@functools.total_ordering
11class Version():
12
13 def __init__(self, version, suffix=None):
14
15 suffixes = ["alphabetical", "patch"]
16
17 if str(suffix) == "alphabetical":
18 version_pattern = r"""r?v?(?:(?P<release>[0-9]+(?:[-\.][0-9]+)*)(?P<patch>[-_\.]?(?P<patch_l>[a-z]))?(?P<pre>[-_\.]?(?P<pre_l>(rc|alpha|beta|pre|preview|dev))[-_\.]?(?P<pre_v>[0-9]+)?)?)(.*)?"""
19 elif str(suffix) == "patch":
20 version_pattern = r"""r?v?(?:(?P<release>[0-9]+(?:[-\.][0-9]+)*)(?P<patch>[-_\.]?(p|patch)(?P<patch_l>[0-9]+))?(?P<pre>[-_\.]?(?P<pre_l>(rc|alpha|beta|pre|preview|dev))[-_\.]?(?P<pre_v>[0-9]+)?)?)(.*)?"""
21 else:
22 version_pattern = r"""r?v?(?:(?P<release>[0-9]+(?:[-\.][0-9]+)*)(?P<pre>[-_\.]?(?P<pre_l>(rc|alpha|beta|pre|preview|dev))[-_\.]?(?P<pre_v>[0-9]+)?)?)(.*)?"""
23 regex = re.compile(r"^\s*" + version_pattern + r"\s*$", re.VERBOSE | re.IGNORECASE)
24
25 match = regex.search(version)
26 if not match:
27 raise Exception("Invalid version: '{0}'".format(version))
28
29 self._version = _Version(
30 release=tuple(int(i) for i in match.group("release").replace("-",".").split(".")),
31 patch_l=match.group("patch_l") if str(suffix) in suffixes and match.group("patch_l") else "",
32 pre_l=match.group("pre_l"),
33 pre_v=match.group("pre_v")
34 )
35
36 self._key = _cmpkey(
37 self._version.release,
38 self._version.patch_l,
39 self._version.pre_l,
40 self._version.pre_v
41 )
42
43 def __eq__(self, other):
44 if not isinstance(other, Version):
45 return NotImplemented
46 return self._key == other._key
47
48 def __gt__(self, other):
49 if not isinstance(other, Version):
50 return NotImplemented
51 return self._key > other._key
52
53def _cmpkey(release, patch_l, pre_l, pre_v):
54 # remove leading 0
55 _release = tuple(
56 reversed(list(itertools.dropwhile(lambda x: x == 0, reversed(release))))
57 )
58
59 _patch = patch_l.upper()
60
61 if pre_l is None and pre_v is None:
62 _pre = float('inf')
63 else:
64 _pre = float(pre_v) if pre_v else float('-inf')
65 return _release, _patch, _pre
diff --git a/meta/lib/oe/package_manager/__init__.py b/meta/lib/oe/package_manager/__init__.py
index 42225a3b2e..26f9f82aaa 100644
--- a/meta/lib/oe/package_manager/__init__.py
+++ b/meta/lib/oe/package_manager/__init__.py
@@ -189,7 +189,7 @@ class PackageManager(object, metaclass=ABCMeta):
189 bb.utils.remove(self.intercepts_dir, True) 189 bb.utils.remove(self.intercepts_dir, True)
190 bb.utils.mkdirhier(self.intercepts_dir) 190 bb.utils.mkdirhier(self.intercepts_dir)
191 for intercept in postinst_intercepts: 191 for intercept in postinst_intercepts:
192 bb.utils.copyfile(intercept, os.path.join(self.intercepts_dir, os.path.basename(intercept))) 192 shutil.copy(intercept, os.path.join(self.intercepts_dir, os.path.basename(intercept)))
193 193
194 @abstractmethod 194 @abstractmethod
195 def _handle_intercept_failure(self, failed_script): 195 def _handle_intercept_failure(self, failed_script):
diff --git a/meta/lib/oe/package_manager/deb/__init__.py b/meta/lib/oe/package_manager/deb/__init__.py
index 26157f591a..0f9b27f831 100644
--- a/meta/lib/oe/package_manager/deb/__init__.py
+++ b/meta/lib/oe/package_manager/deb/__init__.py
@@ -312,6 +312,12 @@ class DpkgPM(OpkgDpkgPM):
312 if not pkgs: 312 if not pkgs:
313 return 313 return
314 314
315 os.environ['D'] = self.target_rootfs
316 os.environ['OFFLINE_ROOT'] = self.target_rootfs
317 os.environ['IPKG_OFFLINE_ROOT'] = self.target_rootfs
318 os.environ['OPKG_OFFLINE_ROOT'] = self.target_rootfs
319 os.environ['INTERCEPT_DIR'] = self.intercepts_dir
320
315 if with_dependencies: 321 if with_dependencies:
316 os.environ['APT_CONFIG'] = self.apt_conf_file 322 os.environ['APT_CONFIG'] = self.apt_conf_file
317 cmd = "%s purge %s" % (self.apt_get_cmd, ' '.join(pkgs)) 323 cmd = "%s purge %s" % (self.apt_get_cmd, ' '.join(pkgs))
diff --git a/meta/lib/oe/package_manager/deb/sdk.py b/meta/lib/oe/package_manager/deb/sdk.py
index b25eb70b00..76548b06f0 100644
--- a/meta/lib/oe/package_manager/deb/sdk.py
+++ b/meta/lib/oe/package_manager/deb/sdk.py
@@ -65,6 +65,8 @@ class DpkgSdk(Sdk):
65 65
66 self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY')) 66 self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY'))
67 67
68 self.target_pm.run_pre_post_installs()
69
68 self.target_pm.run_intercepts(populate_sdk='target') 70 self.target_pm.run_intercepts(populate_sdk='target')
69 71
70 execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_TARGET_COMMAND")) 72 execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_TARGET_COMMAND"))
@@ -78,6 +80,8 @@ class DpkgSdk(Sdk):
78 self._populate_sysroot(self.host_pm, self.host_manifest) 80 self._populate_sysroot(self.host_pm, self.host_manifest)
79 self.install_locales(self.host_pm) 81 self.install_locales(self.host_pm)
80 82
83 self.host_pm.run_pre_post_installs()
84
81 self.host_pm.run_intercepts(populate_sdk='host') 85 self.host_pm.run_intercepts(populate_sdk='host')
82 86
83 execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_HOST_COMMAND")) 87 execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_HOST_COMMAND"))
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
index 40755fbb03..8ad70f53f1 100644
--- a/meta/lib/oe/patch.py
+++ b/meta/lib/oe/patch.py
@@ -38,15 +38,19 @@ def runcmd(args, dir = None):
38 args = [ pipes.quote(str(arg)) for arg in args ] 38 args = [ pipes.quote(str(arg)) for arg in args ]
39 cmd = " ".join(args) 39 cmd = " ".join(args)
40 # print("cmd: %s" % cmd) 40 # print("cmd: %s" % cmd)
41 (exitstatus, output) = subprocess.getstatusoutput(cmd) 41 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
42 stdout, stderr = proc.communicate()
43 stdout = stdout.decode('utf-8')
44 stderr = stderr.decode('utf-8')
45 exitstatus = proc.returncode
42 if exitstatus != 0: 46 if exitstatus != 0:
43 raise CmdError(cmd, exitstatus >> 8, output) 47 raise CmdError(cmd, exitstatus >> 8, "stdout: %s\nstderr: %s" % (stdout, stderr))
44 if " fuzz " in output and "Hunk " in output: 48 if " fuzz " in stdout and "Hunk " in stdout:
45 # Drop patch fuzz info with header and footer to log file so 49 # Drop patch fuzz info with header and footer to log file so
46 # insane.bbclass can handle to throw error/warning 50 # insane.bbclass can handle to throw error/warning
47 bb.note("--- Patch fuzz start ---\n%s\n--- Patch fuzz end ---" % format(output)) 51 bb.note("--- Patch fuzz start ---\n%s\n--- Patch fuzz end ---" % format(stdout))
48 52
49 return output 53 return stdout
50 54
51 finally: 55 finally:
52 if dir: 56 if dir:
diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py
index 082972457b..c8d8ad05b9 100644
--- a/meta/lib/oe/path.py
+++ b/meta/lib/oe/path.py
@@ -320,3 +320,24 @@ def which_wild(pathname, path=None, mode=os.F_OK, *, reverse=False, candidates=F
320 320
321 return files 321 return files
322 322
323def canonicalize(paths, sep=','):
324 """Given a string with paths (separated by commas by default), expand
325 each path using os.path.realpath() and return the resulting paths as a
326 string (separated using the same separator a the original string).
327 """
328 # Ignore paths containing "$" as they are assumed to be unexpanded bitbake
329 # variables. Normally they would be ignored, e.g., when passing the paths
330 # through the shell they would expand to empty strings. However, when they
331 # are passed through os.path.realpath(), it will cause them to be prefixed
332 # with the absolute path to the current directory and thus not be empty
333 # anymore.
334 #
335 # Also maintain trailing slashes, as the paths may actually be used as
336 # prefixes in sting compares later on, where the slashes then are important.
337 canonical_paths = []
338 for path in (paths or '').split(sep):
339 if '$' not in path:
340 trailing_slash = path.endswith('/') and '/' or ''
341 canonical_paths.append(os.path.realpath(path) + trailing_slash)
342
343 return sep.join(canonical_paths)
diff --git a/meta/lib/oe/prservice.py b/meta/lib/oe/prservice.py
index 2d3c9c7e50..fcdbe66c19 100644
--- a/meta/lib/oe/prservice.py
+++ b/meta/lib/oe/prservice.py
@@ -3,10 +3,6 @@
3# 3#
4 4
5def prserv_make_conn(d, check = False): 5def prserv_make_conn(d, check = False):
6 # Otherwise this fails when called from recipes which e.g. inherit python3native (which sets _PYTHON_SYSCONFIGDATA_NAME) with:
7 # No module named '_sysconfigdata'
8 if '_PYTHON_SYSCONFIGDATA_NAME' in os.environ:
9 del os.environ['_PYTHON_SYSCONFIGDATA_NAME']
10 import prserv.serv 6 import prserv.serv
11 host_params = list([_f for _f in (d.getVar("PRSERV_HOST") or '').split(':') if _f]) 7 host_params = list([_f for _f in (d.getVar("PRSERV_HOST") or '').split(':') if _f])
12 try: 8 try:
diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py
index ef69ef207f..407d168894 100644
--- a/meta/lib/oe/recipeutils.py
+++ b/meta/lib/oe/recipeutils.py
@@ -409,7 +409,7 @@ def copy_recipe_files(d, tgt_dir, whole_dir=False, download=True, all_variants=F
409 fetch.download() 409 fetch.download()
410 for pth in fetch.localpaths(): 410 for pth in fetch.localpaths():
411 if pth not in localpaths: 411 if pth not in localpaths:
412 localpaths.append(pth) 412 localpaths.append(os.path.abspath(pth))
413 uri_values.append(srcuri) 413 uri_values.append(srcuri)
414 414
415 fetch_urls(d) 415 fetch_urls(d)
diff --git a/meta/lib/oe/reproducible.py b/meta/lib/oe/reproducible.py
index 421bb12f54..0fb02ccdb0 100644
--- a/meta/lib/oe/reproducible.py
+++ b/meta/lib/oe/reproducible.py
@@ -47,7 +47,7 @@ def find_git_folder(d, sourcedir):
47 return None 47 return None
48 48
49def get_source_date_epoch_from_git(d, sourcedir): 49def get_source_date_epoch_from_git(d, sourcedir):
50 if not "git://" in d.getVar('SRC_URI'): 50 if not "git://" in d.getVar('SRC_URI') and not "gitsm://" in d.getVar('SRC_URI'):
51 return None 51 return None
52 52
53 gitpath = find_git_folder(d, sourcedir) 53 gitpath = find_git_folder(d, sourcedir)
diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
index 64fb84ec92..31a6140984 100644
--- a/meta/lib/oe/sstatesig.py
+++ b/meta/lib/oe/sstatesig.py
@@ -439,7 +439,7 @@ def find_sstate_manifest(taskdata, taskdata2, taskname, d, multilibcache):
439 d2 = multilibcache[variant] 439 d2 = multilibcache[variant]
440 440
441 if taskdata.endswith("-native"): 441 if taskdata.endswith("-native"):
442 pkgarchs = ["${BUILD_ARCH}"] 442 pkgarchs = ["${BUILD_ARCH}", "${BUILD_ARCH}_${ORIGNATIVELSBSTRING}"]
443 elif taskdata.startswith("nativesdk-"): 443 elif taskdata.startswith("nativesdk-"):
444 pkgarchs = ["${SDK_ARCH}_${SDK_OS}", "allarch"] 444 pkgarchs = ["${SDK_ARCH}_${SDK_OS}", "allarch"]
445 elif "-cross-canadian" in taskdata: 445 elif "-cross-canadian" in taskdata:
@@ -557,9 +557,11 @@ def OEOuthashBasic(path, sigfile, task, d):
557 try: 557 try:
558 update_hash(" %10s" % pwd.getpwuid(s.st_uid).pw_name) 558 update_hash(" %10s" % pwd.getpwuid(s.st_uid).pw_name)
559 update_hash(" %10s" % grp.getgrgid(s.st_gid).gr_name) 559 update_hash(" %10s" % grp.getgrgid(s.st_gid).gr_name)
560 except KeyError: 560 except KeyError as e:
561 bb.warn("KeyError in %s" % path) 561 bb.warn("KeyError in %s" % path)
562 raise 562 msg = ("KeyError: %s\nPath %s is owned by uid %d, gid %d, which doesn't match "
563 "any user/group on target. This may be due to host contamination." % (e, path, s.st_uid, s.st_gid))
564 raise Exception(msg).with_traceback(e.__traceback__)
563 565
564 if include_timestamps: 566 if include_timestamps:
565 update_hash(" %10d" % s.st_mtime) 567 update_hash(" %10d" % s.st_mtime)
diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py
index eb10a6e33e..2ac39df9e1 100644
--- a/meta/lib/oe/terminal.py
+++ b/meta/lib/oe/terminal.py
@@ -163,7 +163,12 @@ class Tmux(Terminal):
163 # devshells, if it's already there, add a new window to it. 163 # devshells, if it's already there, add a new window to it.
164 window_name = 'devshell-%i' % os.getpid() 164 window_name = 'devshell-%i' % os.getpid()
165 165
166 self.command = 'tmux new -c "{{cwd}}" -d -s {0} -n {0} "{{command}}"'.format(window_name) 166 self.command = 'tmux new -c "{{cwd}}" -d -s {0} -n {0} "{{command}}"'
167 if not check_tmux_version('1.9'):
168 # `tmux new-session -c` was added in 1.9;
169 # older versions fail with that flag
170 self.command = 'tmux new -d -s {0} -n {0} "{{command}}"'
171 self.command = self.command.format(window_name)
167 Terminal.__init__(self, sh_cmd, title, env, d) 172 Terminal.__init__(self, sh_cmd, title, env, d)
168 173
169 attach_cmd = 'tmux att -t {0}'.format(window_name) 174 attach_cmd = 'tmux att -t {0}'.format(window_name)
@@ -253,13 +258,18 @@ def spawn(name, sh_cmd, title=None, env=None, d=None):
253 except OSError: 258 except OSError:
254 return 259 return
255 260
261def check_tmux_version(desired):
262 vernum = check_terminal_version("tmux")
263 if vernum and LooseVersion(vernum) < desired:
264 return False
265 return vernum
266
256def check_tmux_pane_size(tmux): 267def check_tmux_pane_size(tmux):
257 import subprocess as sub 268 import subprocess as sub
258 # On older tmux versions (<1.9), return false. The reason 269 # On older tmux versions (<1.9), return false. The reason
259 # is that there is no easy way to get the height of the active panel 270 # is that there is no easy way to get the height of the active panel
260 # on current window without nested formats (available from version 1.9) 271 # on current window without nested formats (available from version 1.9)
261 vernum = check_terminal_version("tmux") 272 if not check_tmux_version('1.9'):
262 if vernum and LooseVersion(vernum) < '1.9':
263 return False 273 return False
264 try: 274 try:
265 p = sub.Popen('%s list-panes -F "#{?pane_active,#{pane_height},}"' % tmux, 275 p = sub.Popen('%s list-panes -F "#{?pane_active,#{pane_height},}"' % tmux,
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index 468c76f30f..9a2187e36f 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -193,7 +193,7 @@ def parallel_make(d, makeinst=False):
193 193
194 return int(v) 194 return int(v)
195 195
196 return None 196 return ''
197 197
198def parallel_make_argument(d, fmt, limit=None, makeinst=False): 198def parallel_make_argument(d, fmt, limit=None, makeinst=False):
199 """ 199 """
diff --git a/meta/lib/oeqa/manual/oe-core.json b/meta/lib/oeqa/manual/oe-core.json
index fb47c5ec36..4ad524d89b 100644
--- a/meta/lib/oeqa/manual/oe-core.json
+++ b/meta/lib/oeqa/manual/oe-core.json
@@ -80,7 +80,7 @@
80 "expected_results": "" 80 "expected_results": ""
81 }, 81 },
82 "7": { 82 "7": {
83 "action": "Run command:./configure && make ", 83 "action": "Run command:./configure ${CONFIGUREOPTS} && make ",
84 "expected_results": "Verify that \"matchbox-desktop\" binary file was created successfully under \"src/\" directory " 84 "expected_results": "Verify that \"matchbox-desktop\" binary file was created successfully under \"src/\" directory "
85 }, 85 },
86 "8": { 86 "8": {
diff --git a/meta/lib/oeqa/runtime/cases/df.py b/meta/lib/oeqa/runtime/cases/df.py
index 89fd0fb901..bb155c9cf9 100644
--- a/meta/lib/oeqa/runtime/cases/df.py
+++ b/meta/lib/oeqa/runtime/cases/df.py
@@ -4,12 +4,14 @@
4 4
5from oeqa.runtime.case import OERuntimeTestCase 5from oeqa.runtime.case import OERuntimeTestCase
6from oeqa.core.decorator.depends import OETestDepends 6from oeqa.core.decorator.depends import OETestDepends
7from oeqa.core.decorator.data import skipIfDataVar, skipIfInDataVar
7from oeqa.runtime.decorator.package import OEHasPackage 8from oeqa.runtime.decorator.package import OEHasPackage
8 9
9class DfTest(OERuntimeTestCase): 10class DfTest(OERuntimeTestCase):
10 11
11 @OETestDepends(['ssh.SSHTest.test_ssh']) 12 @OETestDepends(['ssh.SSHTest.test_ssh'])
12 @OEHasPackage(['coreutils', 'busybox']) 13 @OEHasPackage(['coreutils', 'busybox'])
14 @skipIfInDataVar('IMAGE_FEATURES', 'read-only-rootfs', 'Test case df requires a writable rootfs')
13 def test_df(self): 15 def test_df(self):
14 cmd = "df -P / | sed -n '2p' | awk '{print $4}'" 16 cmd = "df -P / | sed -n '2p' | awk '{print $4}'"
15 (status,output) = self.target.run(cmd) 17 (status,output) = self.target.run(cmd)
diff --git a/meta/lib/oeqa/runtime/cases/pam.py b/meta/lib/oeqa/runtime/cases/pam.py
index 271a1943e3..a482ded945 100644
--- a/meta/lib/oeqa/runtime/cases/pam.py
+++ b/meta/lib/oeqa/runtime/cases/pam.py
@@ -8,11 +8,14 @@
8from oeqa.runtime.case import OERuntimeTestCase 8from oeqa.runtime.case import OERuntimeTestCase
9from oeqa.core.decorator.depends import OETestDepends 9from oeqa.core.decorator.depends import OETestDepends
10from oeqa.core.decorator.data import skipIfNotFeature 10from oeqa.core.decorator.data import skipIfNotFeature
11from oeqa.runtime.decorator.package import OEHasPackage
11 12
12class PamBasicTest(OERuntimeTestCase): 13class PamBasicTest(OERuntimeTestCase):
13 14
14 @skipIfNotFeature('pam', 'Test requires pam to be in DISTRO_FEATURES') 15 @skipIfNotFeature('pam', 'Test requires pam to be in DISTRO_FEATURES')
15 @OETestDepends(['ssh.SSHTest.test_ssh']) 16 @OETestDepends(['ssh.SSHTest.test_ssh'])
17 @OEHasPackage(['shadow'])
18 @OEHasPackage(['shadow-base'])
16 def test_pam(self): 19 def test_pam(self):
17 status, output = self.target.run('login --help') 20 status, output = self.target.run('login --help')
18 msg = ('login command does not work as expected. ' 21 msg = ('login command does not work as expected. '
diff --git a/meta/lib/oeqa/selftest/cases/buildoptions.py b/meta/lib/oeqa/selftest/cases/buildoptions.py
index e91f0bd18f..b1b9ea7e55 100644
--- a/meta/lib/oeqa/selftest/cases/buildoptions.py
+++ b/meta/lib/oeqa/selftest/cases/buildoptions.py
@@ -57,15 +57,15 @@ class ImageOptionsTests(OESelftestTestCase):
57class DiskMonTest(OESelftestTestCase): 57class DiskMonTest(OESelftestTestCase):
58 58
59 def test_stoptask_behavior(self): 59 def test_stoptask_behavior(self):
60 self.write_config('BB_DISKMON_DIRS = "STOPTASKS,${TMPDIR},100000G,100K"') 60 self.write_config('BB_DISKMON_DIRS = "STOPTASKS,${TMPDIR},100000G,100K"\nBB_HEARTBEAT_EVENT = "1"')
61 res = bitbake("delay -c delay", ignore_status = True) 61 res = bitbake("delay -c delay", ignore_status = True)
62 self.assertTrue('ERROR: No new tasks can be executed since the disk space monitor action is "STOPTASKS"!' in res.output, msg = "Tasks should have stopped. Disk monitor is set to STOPTASK: %s" % res.output) 62 self.assertTrue('ERROR: No new tasks can be executed since the disk space monitor action is "STOPTASKS"!' in res.output, msg = "Tasks should have stopped. Disk monitor is set to STOPTASK: %s" % res.output)
63 self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output)) 63 self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output))
64 self.write_config('BB_DISKMON_DIRS = "ABORT,${TMPDIR},100000G,100K"') 64 self.write_config('BB_DISKMON_DIRS = "ABORT,${TMPDIR},100000G,100K"\nBB_HEARTBEAT_EVENT = "1"')
65 res = bitbake("delay -c delay", ignore_status = True) 65 res = bitbake("delay -c delay", ignore_status = True)
66 self.assertTrue('ERROR: Immediately abort since the disk space monitor action is "ABORT"!' in res.output, "Tasks should have been aborted immediatelly. Disk monitor is set to ABORT: %s" % res.output) 66 self.assertTrue('ERROR: Immediately abort since the disk space monitor action is "ABORT"!' in res.output, "Tasks should have been aborted immediatelly. Disk monitor is set to ABORT: %s" % res.output)
67 self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output)) 67 self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output))
68 self.write_config('BB_DISKMON_DIRS = "WARN,${TMPDIR},100000G,100K"') 68 self.write_config('BB_DISKMON_DIRS = "WARN,${TMPDIR},100000G,100K"\nBB_HEARTBEAT_EVENT = "1"')
69 res = bitbake("delay -c delay") 69 res = bitbake("delay -c delay")
70 self.assertTrue('WARNING: The free space' in res.output, msg = "A warning should have been displayed for disk monitor is set to WARN: %s" %res.output) 70 self.assertTrue('WARNING: The free space' in res.output, msg = "A warning should have been displayed for disk monitor is set to WARN: %s" %res.output)
71 71
diff --git a/meta/lib/oeqa/selftest/cases/cve_check.py b/meta/lib/oeqa/selftest/cases/cve_check.py
new file mode 100644
index 0000000000..d1947baffc
--- /dev/null
+++ b/meta/lib/oeqa/selftest/cases/cve_check.py
@@ -0,0 +1,44 @@
1from oe.cve_check import Version
2from oeqa.selftest.case import OESelftestTestCase
3
4class CVECheck(OESelftestTestCase):
5
6 def test_version_compare(self):
7 result = Version("100") > Version("99")
8 self.assertTrue( result, msg="Failed to compare version '100' > '99'")
9 result = Version("2.3.1") > Version("2.2.3")
10 self.assertTrue( result, msg="Failed to compare version '2.3.1' > '2.2.3'")
11 result = Version("2021-01-21") > Version("2020-12-25")
12 self.assertTrue( result, msg="Failed to compare version '2021-01-21' > '2020-12-25'")
13 result = Version("1.2-20200910") < Version("1.2-20200920")
14 self.assertTrue( result, msg="Failed to compare version '1.2-20200910' < '1.2-20200920'")
15
16 result = Version("1.0") >= Version("1.0beta")
17 self.assertTrue( result, msg="Failed to compare version '1.0' >= '1.0beta'")
18 result = Version("1.0-rc2") > Version("1.0-rc1")
19 self.assertTrue( result, msg="Failed to compare version '1.0-rc2' > '1.0-rc1'")
20 result = Version("1.0.alpha1") < Version("1.0")
21 self.assertTrue( result, msg="Failed to compare version '1.0.alpha1' < '1.0'")
22 result = Version("1.0_dev") <= Version("1.0")
23 self.assertTrue( result, msg="Failed to compare version '1.0_dev' <= '1.0'")
24
25 # ignore "p1" and "p2", so these should be equal
26 result = Version("1.0p2") == Version("1.0p1")
27 self.assertTrue( result ,msg="Failed to compare version '1.0p2' to '1.0p1'")
28 # ignore the "b" and "r"
29 result = Version("1.0b") == Version("1.0r")
30 self.assertTrue( result ,msg="Failed to compare version '1.0b' to '1.0r'")
31
32 # consider the trailing alphabet as patched level when comparing
33 result = Version("1.0b","alphabetical") < Version("1.0r","alphabetical")
34 self.assertTrue( result ,msg="Failed to compare version with suffix '1.0b' < '1.0r'")
35 result = Version("1.0b","alphabetical") > Version("1.0","alphabetical")
36 self.assertTrue( result ,msg="Failed to compare version with suffix '1.0b' > '1.0'")
37
38 # consider the trailing "p" and "patch" as patched released when comparing
39 result = Version("1.0","patch") < Version("1.0p1","patch")
40 self.assertTrue( result ,msg="Failed to compare version with suffix '1.0' < '1.0p1'")
41 result = Version("1.0p2","patch") > Version("1.0p1","patch")
42 self.assertTrue( result ,msg="Failed to compare version with suffix '1.0p2' > '1.0p1'")
43 result = Version("1.0_patch2","patch") < Version("1.0_patch3","patch")
44 self.assertTrue( result ,msg="Failed to compare version with suffix '1.0_patch2' < '1.0_patch3'")
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index d3d2e04c20..4eba23890f 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -57,7 +57,7 @@ def setUpModule():
57 if relpth.endswith('/'): 57 if relpth.endswith('/'):
58 destdir = os.path.join(corecopydir, relpth) 58 destdir = os.path.join(corecopydir, relpth)
59 # avoid race condition by not copying .pyc files YPBZ#13421,13803 59 # avoid race condition by not copying .pyc files YPBZ#13421,13803
60 shutil.copytree(pth, destdir, ignore=ignore_patterns('*.pyc', '__pycache__')) 60 shutil.copytree(pth, destdir, ignore=shutil.ignore_patterns('*.pyc', '__pycache__'))
61 else: 61 else:
62 destdir = os.path.join(corecopydir, os.path.dirname(relpth)) 62 destdir = os.path.join(corecopydir, os.path.dirname(relpth))
63 bb.utils.mkdirhier(destdir) 63 bb.utils.mkdirhier(destdir)
@@ -269,7 +269,7 @@ class DevtoolAddTests(DevtoolBase):
269 self.track_for_cleanup(tempdir) 269 self.track_for_cleanup(tempdir)
270 pn = 'pv' 270 pn = 'pv'
271 pv = '1.5.3' 271 pv = '1.5.3'
272 url = 'http://www.ivarch.com/programs/sources/pv-1.5.3.tar.bz2' 272 url = 'http://downloads.yoctoproject.org/mirror/sources/pv-1.5.3.tar.bz2'
273 result = runCmd('wget %s' % url, cwd=tempdir) 273 result = runCmd('wget %s' % url, cwd=tempdir)
274 result = runCmd('tar xfv %s' % os.path.basename(url), cwd=tempdir) 274 result = runCmd('tar xfv %s' % os.path.basename(url), cwd=tempdir)
275 srcdir = os.path.join(tempdir, '%s-%s' % (pn, pv)) 275 srcdir = os.path.join(tempdir, '%s-%s' % (pn, pv))
diff --git a/meta/lib/oeqa/selftest/cases/pseudo.py b/meta/lib/oeqa/selftest/cases/pseudo.py
new file mode 100644
index 0000000000..33593d5ce9
--- /dev/null
+++ b/meta/lib/oeqa/selftest/cases/pseudo.py
@@ -0,0 +1,27 @@
1#
2# SPDX-License-Identifier: MIT
3#
4
5import glob
6import os
7import shutil
8from oeqa.utils.commands import bitbake, get_test_layer
9from oeqa.selftest.case import OESelftestTestCase
10
11class Pseudo(OESelftestTestCase):
12
13 def test_pseudo_pyc_creation(self):
14 self.write_config("")
15
16 metaselftestpath = get_test_layer()
17 pycache_path = os.path.join(metaselftestpath, 'lib/__pycache__')
18 if os.path.exists(pycache_path):
19 shutil.rmtree(pycache_path)
20
21 bitbake('pseudo-pyc-test -c install')
22
23 test1_pyc_present = len(glob.glob(os.path.join(pycache_path, 'pseudo_pyc_test1.*.pyc')))
24 self.assertTrue(test1_pyc_present, 'test1 pyc file missing, should be created outside of pseudo context.')
25
26 test2_pyc_present = len(glob.glob(os.path.join(pycache_path, 'pseudo_pyc_test2.*.pyc')))
27 self.assertFalse(test2_pyc_present, 'test2 pyc file present, should not be created in pseudo context.')
diff --git a/meta/lib/oeqa/selftest/cases/reproducible.py b/meta/lib/oeqa/selftest/cases/reproducible.py
index a7ef336143..cd7be7d436 100644
--- a/meta/lib/oeqa/selftest/cases/reproducible.py
+++ b/meta/lib/oeqa/selftest/cases/reproducible.py
@@ -68,7 +68,7 @@ def compare_file(reference, test, diffutils_sysroot):
68 result.status = MISSING 68 result.status = MISSING
69 return result 69 return result
70 70
71 r = runCmd(['cmp', '--quiet', reference, test], native_sysroot=diffutils_sysroot, ignore_status=True) 71 r = runCmd(['cmp', '--quiet', reference, test], native_sysroot=diffutils_sysroot, ignore_status=True, sync=False)
72 72
73 if r.status: 73 if r.status:
74 result.status = DIFFERENT 74 result.status = DIFFERENT
@@ -184,9 +184,10 @@ class ReproducibleTests(OESelftestTestCase):
184 # mirror, forcing a complete build from scratch 184 # mirror, forcing a complete build from scratch
185 config += textwrap.dedent('''\ 185 config += textwrap.dedent('''\
186 SSTATE_DIR = "${TMPDIR}/sstate" 186 SSTATE_DIR = "${TMPDIR}/sstate"
187 SSTATE_MIRROR = "" 187 SSTATE_MIRRORS = ""
188 ''') 188 ''')
189 189
190 self.logger.info("Building %s (sstate%s allowed)..." % (name, '' if use_sstate else ' NOT'))
190 self.write_config(config) 191 self.write_config(config)
191 d = get_bb_vars(capture_vars) 192 d = get_bb_vars(capture_vars)
192 bitbake(' '.join(self.images)) 193 bitbake(' '.join(self.images))
@@ -213,6 +214,7 @@ class ReproducibleTests(OESelftestTestCase):
213 self.logger.info('Non-reproducible packages will be copied to %s', save_dir) 214 self.logger.info('Non-reproducible packages will be copied to %s', save_dir)
214 215
215 vars_A = self.do_test_build('reproducibleA', self.build_from_sstate) 216 vars_A = self.do_test_build('reproducibleA', self.build_from_sstate)
217
216 vars_B = self.do_test_build('reproducibleB', False) 218 vars_B = self.do_test_build('reproducibleB', False)
217 219
218 # NOTE: The temp directories from the reproducible build are purposely 220 # NOTE: The temp directories from the reproducible build are purposely
@@ -227,6 +229,7 @@ class ReproducibleTests(OESelftestTestCase):
227 deploy_A = vars_A['DEPLOY_DIR_' + c.upper()] 229 deploy_A = vars_A['DEPLOY_DIR_' + c.upper()]
228 deploy_B = vars_B['DEPLOY_DIR_' + c.upper()] 230 deploy_B = vars_B['DEPLOY_DIR_' + c.upper()]
229 231
232 self.logger.info('Checking %s packages for differences...' % c)
230 result = self.compare_packages(deploy_A, deploy_B, diffutils_sysroot) 233 result = self.compare_packages(deploy_A, deploy_B, diffutils_sysroot)
231 234
232 self.logger.info('Reproducibility summary for %s: %s' % (c, result)) 235 self.logger.info('Reproducibility summary for %s: %s' % (c, result))
diff --git a/meta/lib/oeqa/selftest/cases/tinfoil.py b/meta/lib/oeqa/selftest/cases/tinfoil.py
index 206168ed00..a51c6048d3 100644
--- a/meta/lib/oeqa/selftest/cases/tinfoil.py
+++ b/meta/lib/oeqa/selftest/cases/tinfoil.py
@@ -100,9 +100,11 @@ class TinfoilTests(OESelftestTestCase):
100 eventreceived = False 100 eventreceived = False
101 commandcomplete = False 101 commandcomplete = False
102 start = time.time() 102 start = time.time()
103 # Wait for 10s in total so we'd detect spurious heartbeat events for example 103 # Wait for maximum 60s in total so we'd detect spurious heartbeat events for example
104 # The test is IO load sensitive too 104 # The test is IO load sensitive too
105 while time.time() - start < 10: 105 while (not (eventreceived == True and commandcomplete == True)
106 and (time.time() - start < 60)):
107 # if we received both events (on let's say a good day), we are done
106 event = tinfoil.wait_event(1) 108 event = tinfoil.wait_event(1)
107 if event: 109 if event:
108 if isinstance(event, bb.command.CommandCompleted): 110 if isinstance(event, bb.command.CommandCompleted):
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index 714637ec1e..39c6828f59 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -318,6 +318,7 @@ class Wic(WicTestCase):
318 "--image-name=core-image-minimal " 318 "--image-name=core-image-minimal "
319 "-D -o %s" % self.resultdir) 319 "-D -o %s" % self.resultdir)
320 self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct"))) 320 self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct")))
321 self.assertEqual(1, len(glob(self.resultdir + "tmp.wic*")))
321 322
322 def test_debug_long(self): 323 def test_debug_long(self):
323 """Test --debug option""" 324 """Test --debug option"""
@@ -325,6 +326,7 @@ class Wic(WicTestCase):
325 "--image-name=core-image-minimal " 326 "--image-name=core-image-minimal "
326 "--debug -o %s" % self.resultdir) 327 "--debug -o %s" % self.resultdir)
327 self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct"))) 328 self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct")))
329 self.assertEqual(1, len(glob(self.resultdir + "tmp.wic*")))
328 330
329 def test_skip_build_check_short(self): 331 def test_skip_build_check_short(self):
330 """Test -s option""" 332 """Test -s option"""
@@ -588,6 +590,9 @@ part / --source rootfs --fstype=ext4 --include-path %s --include-path core-imag
588 def test_permissions(self): 590 def test_permissions(self):
589 """Test permissions are respected""" 591 """Test permissions are respected"""
590 592
593 # prepare wicenv and rootfs
594 bitbake('core-image-minimal core-image-minimal-mtdutils -c do_rootfs_wicenv')
595
591 oldpath = os.environ['PATH'] 596 oldpath = os.environ['PATH']
592 os.environ['PATH'] = get_bb_var("PATH", "wic-tools") 597 os.environ['PATH'] = get_bb_var("PATH", "wic-tools")
593 598
@@ -621,6 +626,19 @@ part /etc --source rootfs --fstype=ext4 --change-directory=etc
621 res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % (part)) 626 res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % (part))
622 self.assertEqual(True, files_own_by_root(res.output)) 627 self.assertEqual(True, files_own_by_root(res.output))
623 628
629 config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "%s"\n' % wks_file
630 self.append_config(config)
631 bitbake('core-image-minimal')
632 tmpdir = os.path.join(get_bb_var('WORKDIR', 'core-image-minimal'),'build-wic')
633
634 # check each partition for permission
635 for part in glob(os.path.join(tmpdir, 'temp-*.direct.p*')):
636 res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % (part))
637 self.assertTrue(files_own_by_root(res.output)
638 ,msg='Files permission incorrect using wks set "%s"' % test)
639
640 # clean config and result directory for next cases
641 self.remove_config(config)
624 rmtree(self.resultdir, ignore_errors=True) 642 rmtree(self.resultdir, ignore_errors=True)
625 643
626 finally: 644 finally:
@@ -961,14 +979,18 @@ class Wic2(WicTestCase):
961 @only_for_arch(['i586', 'i686', 'x86_64']) 979 @only_for_arch(['i586', 'i686', 'x86_64'])
962 def test_rawcopy_plugin_qemu(self): 980 def test_rawcopy_plugin_qemu(self):
963 """Test rawcopy plugin in qemu""" 981 """Test rawcopy plugin in qemu"""
964 # build ext4 and wic images 982 # build ext4 and then use it for a wic image
965 for fstype in ("ext4", "wic"): 983 config = 'IMAGE_FSTYPES = "ext4"\n'
966 config = 'IMAGE_FSTYPES = "%s"\nWKS_FILE = "test_rawcopy_plugin.wks.in"\n' % fstype 984 self.append_config(config)
967 self.append_config(config) 985 self.assertEqual(0, bitbake('core-image-minimal').status)
968 self.assertEqual(0, bitbake('core-image-minimal').status) 986 self.remove_config(config)
969 self.remove_config(config)
970 987
971 with runqemu('core-image-minimal', ssh=False, image_fstype='wic') as qemu: 988 config = 'IMAGE_FSTYPES = "wic"\nWKS_FILE = "test_rawcopy_plugin.wks.in"\n'
989 self.append_config(config)
990 self.assertEqual(0, bitbake('core-image-minimal-mtdutils').status)
991 self.remove_config(config)
992
993 with runqemu('core-image-minimal-mtdutils', ssh=False, image_fstype='wic') as qemu:
972 cmd = "grep sda. /proc/partitions |wc -l" 994 cmd = "grep sda. /proc/partitions |wc -l"
973 status, output = qemu.run_serial(cmd) 995 status, output = qemu.run_serial(cmd)
974 self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) 996 self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py
index dd3609c1d6..1659926975 100644
--- a/meta/lib/oeqa/selftest/context.py
+++ b/meta/lib/oeqa/selftest/context.py
@@ -34,7 +34,7 @@ class NonConcurrentTestSuite(unittest.TestSuite):
34 (builddir, newbuilddir) = self.setupfunc("-st", None, self.suite) 34 (builddir, newbuilddir) = self.setupfunc("-st", None, self.suite)
35 ret = super().run(result) 35 ret = super().run(result)
36 os.chdir(builddir) 36 os.chdir(builddir)
37 if newbuilddir and ret.wasSuccessful(): 37 if newbuilddir and ret.wasSuccessful() and self.removefunc:
38 self.removefunc(newbuilddir) 38 self.removefunc(newbuilddir)
39 39
40def removebuilddir(d): 40def removebuilddir(d):
@@ -54,7 +54,7 @@ def removebuilddir(d):
54 bb.utils.prunedir(d, ionice=True) 54 bb.utils.prunedir(d, ionice=True)
55 55
56class OESelftestTestContext(OETestContext): 56class OESelftestTestContext(OETestContext):
57 def __init__(self, td=None, logger=None, machines=None, config_paths=None, newbuilddir=None): 57 def __init__(self, td=None, logger=None, machines=None, config_paths=None, newbuilddir=None, keep_builddir=None):
58 super(OESelftestTestContext, self).__init__(td, logger) 58 super(OESelftestTestContext, self).__init__(td, logger)
59 59
60 self.machines = machines 60 self.machines = machines
@@ -62,6 +62,11 @@ class OESelftestTestContext(OETestContext):
62 self.config_paths = config_paths 62 self.config_paths = config_paths
63 self.newbuilddir = newbuilddir 63 self.newbuilddir = newbuilddir
64 64
65 if keep_builddir:
66 self.removebuilddir = None
67 else:
68 self.removebuilddir = removebuilddir
69
65 def setup_builddir(self, suffix, selftestdir, suite): 70 def setup_builddir(self, suffix, selftestdir, suite):
66 builddir = os.environ['BUILDDIR'] 71 builddir = os.environ['BUILDDIR']
67 if not selftestdir: 72 if not selftestdir:
@@ -119,9 +124,9 @@ class OESelftestTestContext(OETestContext):
119 if processes: 124 if processes:
120 from oeqa.core.utils.concurrencytest import ConcurrentTestSuite 125 from oeqa.core.utils.concurrencytest import ConcurrentTestSuite
121 126
122 return ConcurrentTestSuite(suites, processes, self.setup_builddir, removebuilddir) 127 return ConcurrentTestSuite(suites, processes, self.setup_builddir, self.removebuilddir)
123 else: 128 else:
124 return NonConcurrentTestSuite(suites, processes, self.setup_builddir, removebuilddir) 129 return NonConcurrentTestSuite(suites, processes, self.setup_builddir, self.removebuilddir)
125 130
126 def runTests(self, processes=None, machine=None, skips=[]): 131 def runTests(self, processes=None, machine=None, skips=[]):
127 if machine: 132 if machine:
@@ -179,6 +184,9 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
179 action='append', default=None, 184 action='append', default=None,
180 help='Exclude all (unhidden) tests that match any of the specified tag(s). (exclude applies before select)') 185 help='Exclude all (unhidden) tests that match any of the specified tag(s). (exclude applies before select)')
181 186
187 parser.add_argument('-K', '--keep-builddir', action='store_true',
188 help='Keep the test build directory even if all tests pass')
189
182 parser.add_argument('-B', '--newbuilddir', help='New build directory to use for tests.') 190 parser.add_argument('-B', '--newbuilddir', help='New build directory to use for tests.')
183 parser.add_argument('-v', '--verbose', action='store_true') 191 parser.add_argument('-v', '--verbose', action='store_true')
184 parser.set_defaults(func=self.run) 192 parser.set_defaults(func=self.run)
@@ -236,6 +244,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
236 self.tc_kwargs['init']['config_paths']['localconf'] = os.path.join(builddir, "conf/local.conf") 244 self.tc_kwargs['init']['config_paths']['localconf'] = os.path.join(builddir, "conf/local.conf")
237 self.tc_kwargs['init']['config_paths']['bblayers'] = os.path.join(builddir, "conf/bblayers.conf") 245 self.tc_kwargs['init']['config_paths']['bblayers'] = os.path.join(builddir, "conf/bblayers.conf")
238 self.tc_kwargs['init']['newbuilddir'] = args.newbuilddir 246 self.tc_kwargs['init']['newbuilddir'] = args.newbuilddir
247 self.tc_kwargs['init']['keep_builddir'] = args.keep_builddir
239 248
240 def tag_filter(tags): 249 def tag_filter(tags):
241 if args.exclude_tags: 250 if args.exclude_tags:
diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index 8059cbce3e..a71c16ab14 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -125,11 +125,11 @@ class Command(object):
125 125
126 def stop(self): 126 def stop(self):
127 for thread in self.threads: 127 for thread in self.threads:
128 if thread.isAlive(): 128 if thread.is_alive():
129 self.process.terminate() 129 self.process.terminate()
130 # let's give it more time to terminate gracefully before killing it 130 # let's give it more time to terminate gracefully before killing it
131 thread.join(5) 131 thread.join(5)
132 if thread.isAlive(): 132 if thread.is_alive():
133 self.process.kill() 133 self.process.kill()
134 thread.join() 134 thread.join()
135 135
@@ -188,7 +188,10 @@ def runCmd(command, ignore_status=False, timeout=None, assert_error=True, sync=T
188 # call sync around the tests to ensure the IO queue doesn't get too large, taking any IO 188 # call sync around the tests to ensure the IO queue doesn't get too large, taking any IO
189 # hit here rather than in bitbake shutdown. 189 # hit here rather than in bitbake shutdown.
190 if sync: 190 if sync:
191 p = os.environ['PATH']
192 os.environ['PATH'] = "/usr/bin:/bin:/usr/sbin:/sbin:" + p
191 os.system("sync") 193 os.system("sync")
194 os.environ['PATH'] = p
192 195
193 result.command = command 196 result.command = command
194 result.status = cmd.status 197 result.status = cmd.status
diff --git a/meta/recipes-bsp/grub/files/CVE-2020-14309-CVE-2020-14310-CVE-2020-14311-malloc-Use-overflow-checking-primitives-where-we-do-.patch b/meta/recipes-bsp/grub/files/CVE-2020-14309-CVE-2020-14310-CVE-2020-14311-malloc-Use-overflow-checking-primitives-where-we-do-.patch
index 896a2145d4..7214ead9a7 100644
--- a/meta/recipes-bsp/grub/files/CVE-2020-14309-CVE-2020-14310-CVE-2020-14311-malloc-Use-overflow-checking-primitives-where-we-do-.patch
+++ b/meta/recipes-bsp/grub/files/CVE-2020-14309-CVE-2020-14310-CVE-2020-14311-malloc-Use-overflow-checking-primitives-where-we-do-.patch
@@ -30,7 +30,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
30Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> 30Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
31 31
32Upstream-Status: Backport 32Upstream-Status: Backport
33CVE: CVE-2020-14309, CVE-2020-14310, CVE-2020-14311 33CVE: CVE-2020-14309 CVE-2020-14310 CVE-2020-14311
34 34
35Reference to upstream patch: 35Reference to upstream patch:
36https://git.savannah.gnu.org/cgit/grub.git/commit/?id=3f05d693d1274965ffbe4ba99080dc2c570944c6 36https://git.savannah.gnu.org/cgit/grub.git/commit/?id=3f05d693d1274965ffbe4ba99080dc2c570944c6
diff --git a/meta/recipes-bsp/grub/files/determinism.patch b/meta/recipes-bsp/grub/files/determinism.patch
new file mode 100644
index 0000000000..3c1f562c71
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/determinism.patch
@@ -0,0 +1,56 @@
1The output in moddep.lst generated from syminfo.lst using genmoddep.awk is
2not deterministic since the order of the dependencies on each line can vary
3depending on how awk sorts the values in the array.
4
5Be deterministic in the output by sorting the dependencies on each line.
6
7Also, the output of the SOURCES lines in grub-core/Makefile.core.am, generated
8from grub-core/Makefile.core.def with gentpl.py is not deterministic due to
9missing sorting of the list used to generate it. Add such a sort.
10
11Also ensure the generated unidata.c file is deterministic by sorting the
12keys of the dict.
13
14Upstream-Status: Pending
15Richard Purdie <richard.purdie@linuxfoundation.org>
16
17Index: grub-2.04/grub-core/genmoddep.awk
18===================================================================
19--- grub-2.04.orig/grub-core/genmoddep.awk
20+++ grub-2.04/grub-core/genmoddep.awk
21@@ -59,7 +59,9 @@ END {
22 }
23 modlist = ""
24 depcount[mod] = 0
25- for (depmod in uniqmods) {
26+ n = asorti(uniqmods, w)
27+ for (i = 1; i <= n; i++) {
28+ depmod = w[i]
29 modlist = modlist " " depmod;
30 inverse_dependencies[depmod] = inverse_dependencies[depmod] " " mod
31 depcount[mod]++
32Index: grub-2.04/gentpl.py
33===================================================================
34--- grub-2.04.orig/gentpl.py
35+++ grub-2.04/gentpl.py
36@@ -568,6 +568,7 @@ def foreach_platform_value(defn, platfor
37 for group in RMAP[platform]:
38 for value in defn.find_all(group + suffix):
39 r.append(closure(value))
40+ r.sort()
41 return ''.join(r)
42
43 def platform_conditional(platform, closure):
44Index: grub-2.04/util/import_unicode.py
45===================================================================
46--- grub-2.04.orig/util/import_unicode.py
47+++ grub-2.04/util/import_unicode.py
48@@ -174,7 +174,7 @@ infile.close ()
49
50 outfile.write ("struct grub_unicode_arabic_shape grub_unicode_arabic_shapes[] = {\n ")
51
52-for x in arabicsubst:
53+for x in sorted(arabicsubst):
54 try:
55 if arabicsubst[x]['join'] == "DUAL":
56 outfile.write ("{0x%x, 0x%x, 0x%x, 0x%x, 0x%x},\n " % (arabicsubst[x][0], arabicsubst[x][1], arabicsubst[x][2], arabicsubst[x][3], arabicsubst[x][4]))
diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc
index ff17dbe8b7..95c25d78f9 100644
--- a/meta/recipes-bsp/grub/grub2.inc
+++ b/meta/recipes-bsp/grub/grub2.inc
@@ -27,6 +27,7 @@ SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \
27 file://script-Remove-unused-fields-from-grub_script_functio.patch \ 27 file://script-Remove-unused-fields-from-grub_script_functio.patch \
28 file://CVE-2020-15706-script-Avoid-a-use-after-free-when-redefining-a-func.patch \ 28 file://CVE-2020-15706-script-Avoid-a-use-after-free-when-redefining-a-func.patch \
29 file://CVE-2020-15707-linux-Fix-integer-overflows-in-initrd-size-handling.patch \ 29 file://CVE-2020-15707-linux-Fix-integer-overflows-in-initrd-size-handling.patch \
30 file://determinism.patch \
30" 31"
31SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934" 32SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934"
32SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea" 33SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea"
diff --git a/meta/recipes-bsp/u-boot/u-boot-tools.inc b/meta/recipes-bsp/u-boot/u-boot-tools.inc
index 8ae290acc6..4ed936a70d 100644
--- a/meta/recipes-bsp/u-boot/u-boot-tools.inc
+++ b/meta/recipes-bsp/u-boot/u-boot-tools.inc
@@ -23,6 +23,21 @@ SED_CONFIG_EFI_armeb = ''
23SED_CONFIG_EFI_aarch64 = '' 23SED_CONFIG_EFI_aarch64 = ''
24 24
25do_compile () { 25do_compile () {
26 # Yes, this is crazy. If you build on a system with git < 2.14 from scratch, the tree will
27 # be marked as "dirty" and the version will include "-dirty", leading to a reproducibility problem.
28 # The issue is the inode count for Licnses/README changing due to do_populate_lic hardlinking a
29 # copy of the file. We avoid this by ensuring the index is updated with a "git diff" before the
30 # u-boot machinery tries to determine the version.
31 #
32 # build$ ../git/scripts/setlocalversion ../git
33 # ""
34 # build$ ln ../git/
35 # build$ ln ../git/README ../foo
36 # build$ ../git/scripts/setlocalversion ../git
37 # ""-dirty
38 # (i.e. creating a hardlink dirties the index)
39 cd ${S}; git diff; cd ${B}
40
26 oe_runmake -C ${S} sandbox_defconfig O=${B} 41 oe_runmake -C ${S} sandbox_defconfig O=${B}
27 42
28 # Disable CONFIG_CMD_LICENSE, license.h is not used by tools and 43 # Disable CONFIG_CMD_LICENSE, license.h is not used by tools and
diff --git a/meta/recipes-connectivity/bind/bind-9.16.7/CVE-2020-8625.patch b/meta/recipes-connectivity/bind/bind-9.16.7/CVE-2020-8625.patch
new file mode 100644
index 0000000000..98b8623139
--- /dev/null
+++ b/meta/recipes-connectivity/bind/bind-9.16.7/CVE-2020-8625.patch
@@ -0,0 +1,29 @@
1From 5b671538216af78a0a7ef7464dc52ab2241ea7db Mon Sep 17 00:00:00 2001
2From: Minjae Kim <flowergom@gmail.com>
3Date: Tue, 2 Mar 2021 14:03:49 +0000
4Subject: [PATCH] BIND Operational Notification: Zone journal (.jnl) file
5 incompatibility
6
7Upstream-Status: Backport [https://downloads.isc.org/isc/bind9/9.16.12/patches/CVE-2020-8625.patch]
8CVE: CVE-2020-8625
9Signed-off-by: Minjae Kim <flowergom@gmail.com>
10---
11 lib/dns/spnego.c | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14diff --git a/lib/dns/spnego.c b/lib/dns/spnego.c
15index 671838c..82fd49a 100644
16--- a/lib/dns/spnego.c
17+++ b/lib/dns/spnego.c
18@@ -846,7 +846,7 @@ der_get_oid(const unsigned char *p, size_t len, oid *data, size_t *size) {
19 return (ASN1_OVERRUN);
20 }
21
22- data->components = malloc(len * sizeof(*data->components));
23+ data->components = malloc((len + 1) * sizeof(*data->components));
24 if (data->components == NULL) {
25 return (ENOMEM);
26 }
27--
282.17.1
29
diff --git a/meta/recipes-connectivity/bind/bind_9.16.7.bb b/meta/recipes-connectivity/bind/bind_9.16.7.bb
index 5fc2c1d3cd..82c1bb66df 100644
--- a/meta/recipes-connectivity/bind/bind_9.16.7.bb
+++ b/meta/recipes-connectivity/bind/bind_9.16.7.bb
@@ -17,6 +17,7 @@ SRC_URI = "https://ftp.isc.org/isc/bind9/${PV}/${BPN}-${PV}.tar.xz \
17 file://bind-ensure-searching-for-json-headers-searches-sysr.patch \ 17 file://bind-ensure-searching-for-json-headers-searches-sysr.patch \
18 file://0001-named-lwresd-V-and-start-log-hide-build-options.patch \ 18 file://0001-named-lwresd-V-and-start-log-hide-build-options.patch \
19 file://0001-avoid-start-failure-with-bind-user.patch \ 19 file://0001-avoid-start-failure-with-bind-user.patch \
20 file://CVE-2020-8625.patch \
20 " 21 "
21 22
22SRC_URI[sha256sum] = "9f7d1812ebbd26a699f62b6fa8522d5dec57e4bf43af0042a0d60d39ed8314d1" 23SRC_URI[sha256sum] = "9f7d1812ebbd26a699f62b6fa8522d5dec57e4bf43af0042a0d60d39ed8314d1"
diff --git a/meta/recipes-connectivity/connman/connman_1.38.bb b/meta/recipes-connectivity/connman/connman_1.39.bb
index 027c41e9af..df42e9ffb8 100644
--- a/meta/recipes-connectivity/connman/connman_1.38.bb
+++ b/meta/recipes-connectivity/connman/connman_1.39.bb
@@ -9,8 +9,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \
9 9
10SRC_URI_append_libc-musl = " file://0002-resolve-musl-does-not-implement-res_ninit.patch" 10SRC_URI_append_libc-musl = " file://0002-resolve-musl-does-not-implement-res_ninit.patch"
11 11
12SRC_URI[md5sum] = "1ed8745354c7254bdfd4def54833ee94" 12SRC_URI[sha256sum] = "9f62a7169b7491c670a1ff2e335b0d966308fb2f62e285c781105eb90f181af3"
13SRC_URI[sha256sum] = "cb30aca97c2f79ccaed8802aa2909ac5100a3969de74c0af8a9d73b85fc4932b"
14 13
15RRECOMMENDS_${PN} = "connman-conf" 14RRECOMMENDS_${PN} = "connman-conf"
16RCONFLICTS_${PN} = "networkmanager" 15RCONFLICTS_${PN} = "networkmanager"
diff --git a/meta/recipes-connectivity/kea/files/0001-src-lib-log-logger_unittest_support.cc-do-not-write-.patch b/meta/recipes-connectivity/kea/files/0001-src-lib-log-logger_unittest_support.cc-do-not-write-.patch
new file mode 100644
index 0000000000..226bc5b311
--- /dev/null
+++ b/meta/recipes-connectivity/kea/files/0001-src-lib-log-logger_unittest_support.cc-do-not-write-.patch
@@ -0,0 +1,27 @@
1From 9985a03f13da4d7bb0a433f7305d2ffae3d82a27 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Tue, 10 Nov 2020 15:57:03 +0000
4Subject: [PATCH] src/lib/log/logger_unittest_support.cc: do not write build
5 path into binary
6
7This breaks reproducibility and is needed only in unit testing.
8
9Upstream-Status: Inappropriate [oe-core specific]
10Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
11---
12 src/lib/log/logger_unittest_support.cc | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-)
14
15diff --git a/src/lib/log/logger_unittest_support.cc b/src/lib/log/logger_unittest_support.cc
16index 58dbef8..9a2929c 100644
17--- a/src/lib/log/logger_unittest_support.cc
18+++ b/src/lib/log/logger_unittest_support.cc
19@@ -84,7 +84,7 @@ void initLogger(isc::log::Severity severity, int dbglevel) {
20 const char* localfile = getenv("KEA_LOGGER_LOCALMSG");
21
22 // Set a directory for creating lockfiles when running tests
23- setenv("KEA_LOCKFILE_DIR", TOP_BUILDDIR, 0);
24+ //setenv("KEA_LOCKFILE_DIR", TOP_BUILDDIR, 0);
25
26 // Initialize logging
27 initLogger(root, isc::log::DEBUG, isc::log::MAX_DEBUG_LEVEL, localfile);
diff --git a/meta/recipes-connectivity/kea/kea_1.7.10.bb b/meta/recipes-connectivity/kea/kea_1.7.10.bb
index c9a5819e47..dc4482adcc 100644
--- a/meta/recipes-connectivity/kea/kea_1.7.10.bb
+++ b/meta/recipes-connectivity/kea/kea_1.7.10.bb
@@ -7,18 +7,18 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=68d95543d2096459290a4e6b9ceccffa"
7 7
8DEPENDS = "boost log4cplus openssl" 8DEPENDS = "boost log4cplus openssl"
9 9
10SRC_URI = "\ 10SRC_URI = "http://ftp.isc.org/isc/kea/${PV}/${BP}.tar.gz \
11 http://ftp.isc.org/isc/kea/${PV}/${BP}.tar.gz \ 11 file://0001-keactrl.in-create-var-lib-kea-and-var-run-kea-folder.patch \
12 file://0001-keactrl.in-create-var-lib-kea-and-var-run-kea-folder.patch \ 12 file://kea-dhcp4.service \
13 file://kea-dhcp4.service \ 13 file://kea-dhcp6.service \
14 file://kea-dhcp6.service \ 14 file://kea-dhcp-ddns.service \
15 file://kea-dhcp-ddns.service \ 15 file://kea-dhcp4-server \
16 file://kea-dhcp4-server \ 16 file://kea-dhcp6-server \
17 file://kea-dhcp6-server \ 17 file://kea-dhcp-ddns-server \
18 file://kea-dhcp-ddns-server \ 18 file://fix-multilib-conflict.patch \
19 file://fix-multilib-conflict.patch \ 19 file://fix_pid_keactrl.patch \
20 file://fix_pid_keactrl.patch \ 20 file://0001-src-lib-log-logger_unittest_support.cc-do-not-write-.patch \
21" 21 "
22SRC_URI[sha256sum] = "4e121f0e58b175a827581c69cb1d60778647049fa47f142940dddc9ce58f3c82" 22SRC_URI[sha256sum] = "4e121f0e58b175a827581c69cb1d60778647049fa47f142940dddc9ce58f3c82"
23 23
24inherit autotools systemd update-rc.d 24inherit autotools systemd update-rc.d
@@ -50,6 +50,11 @@ do_configure_prepend() {
50 sed -i "s:@abs_top_srcdir@:@abs_top_srcdir_placeholder@:g" ${S}/src/bin/admin/kea-admin.in 50 sed -i "s:@abs_top_srcdir@:@abs_top_srcdir_placeholder@:g" ${S}/src/bin/admin/kea-admin.in
51} 51}
52 52
53# patch out build host paths for reproducibility
54do_compile_prepend_class-target() {
55 sed -i -e "s,${WORKDIR},,g" ${B}/config.report
56}
57
53do_install_append() { 58do_install_append() {
54 install -d ${D}${sysconfdir}/init.d 59 install -d ${D}${sysconfdir}/init.d
55 install -d ${D}${systemd_system_unitdir} 60 install -d ${D}${systemd_system_unitdir}
diff --git a/meta/recipes-connectivity/mobile-broadband-provider-info/mobile-broadband-provider-info_git.bb b/meta/recipes-connectivity/mobile-broadband-provider-info/mobile-broadband-provider-info_git.bb
index 0b0bbab168..7dccc15e03 100644
--- a/meta/recipes-connectivity/mobile-broadband-provider-info/mobile-broadband-provider-info_git.bb
+++ b/meta/recipes-connectivity/mobile-broadband-provider-info/mobile-broadband-provider-info_git.bb
@@ -3,8 +3,8 @@ HOMEPAGE = "http://live.gnome.org/NetworkManager/MobileBroadband/ServiceProvider
3SECTION = "network" 3SECTION = "network"
4LICENSE = "PD" 4LICENSE = "PD"
5LIC_FILES_CHKSUM = "file://COPYING;md5=87964579b2a8ece4bc6744d2dc9a8b04" 5LIC_FILES_CHKSUM = "file://COPYING;md5=87964579b2a8ece4bc6744d2dc9a8b04"
6SRCREV = "22b49d86fb7aded2c195a9d49e5924da696b3228" 6SRCREV = "90f3fe28aa25135b7e4a54a7816388913bfd4a2a"
7PV = "20190618" 7PV = "20201225"
8PE = "1" 8PE = "1"
9 9
10SRC_URI = "git://gitlab.gnome.org/GNOME/mobile-broadband-provider-info.git;protocol=https" 10SRC_URI = "git://gitlab.gnome.org/GNOME/mobile-broadband-provider-info.git;protocol=https"
diff --git a/meta/recipes-connectivity/openssh/openssh/0f90440ca70abab947acbd77795e9f130967956c.patch b/meta/recipes-connectivity/openssh/openssh/0f90440ca70abab947acbd77795e9f130967956c.patch
new file mode 100644
index 0000000000..b88bc18f12
--- /dev/null
+++ b/meta/recipes-connectivity/openssh/openssh/0f90440ca70abab947acbd77795e9f130967956c.patch
@@ -0,0 +1,28 @@
1From 0f90440ca70abab947acbd77795e9f130967956c Mon Sep 17 00:00:00 2001
2From: Darren Tucker <dtucker@dtucker.net>
3Date: Fri, 20 Nov 2020 13:37:54 +1100
4Subject: [PATCH] Add new pselect6_time64 syscall on ARM.
5
6This is apparently needed on armhfp/armv7hl. bz#3232, patch from
7jjelen at redhat.com.
8---
9 sandbox-seccomp-filter.c | 3 +++
10 1 file changed, 3 insertions(+)
11
12Upstream-Status: Backport
13[fixes issues on 32bit IA and probably other 32 bit platforms too with glibc 2.33]
14
15diff --git a/sandbox-seccomp-filter.c b/sandbox-seccomp-filter.c
16index e0768c063..5065ae7ef 100644
17--- a/sandbox-seccomp-filter.c
18+++ b/sandbox-seccomp-filter.c
19@@ -267,6 +267,9 @@ static const struct sock_filter preauth_insns[] = {
20 #ifdef __NR_pselect6
21 SC_ALLOW(__NR_pselect6),
22 #endif
23+#ifdef __NR_pselect6_time64
24+ SC_ALLOW(__NR_pselect6_time64),
25+#endif
26 #ifdef __NR_read
27 SC_ALLOW(__NR_read),
28 #endif
diff --git a/meta/recipes-connectivity/openssh/openssh/CVE-2020-14145.patch b/meta/recipes-connectivity/openssh/openssh/CVE-2020-14145.patch
new file mode 100644
index 0000000000..0046ee1a51
--- /dev/null
+++ b/meta/recipes-connectivity/openssh/openssh/CVE-2020-14145.patch
@@ -0,0 +1,90 @@
1From b3855ff053f5078ec3d3c653cdaedefaa5fc362d Mon Sep 17 00:00:00 2001
2From: "djm@openbsd.org" <djm@openbsd.org>
3Date: Fri, 18 Sep 2020 05:23:03 +0000
4Subject: [PATCH] upstream: tweak the client hostkey preference ordering
5 algorithm to
6
7prefer the default ordering if the user has a key that matches the
8best-preference default algorithm.
9
10feedback and ok markus@
11
12OpenBSD-Commit-ID: a92dd7d7520ddd95c0a16786a7519e6d0167d35f
13
14Upstream-Status: Backport
15[https://github.com/openssh/openssh-portable/commit/b3855ff053f5078ec3d3c653cdaedefaa5fc362d]
16CVE: CVE-2020-14145
17Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
18
19---
20 sshconnect2.c | 41 ++++++++++++++++++++++++++++++++++++++---
21 1 file changed, 37 insertions(+), 2 deletions(-)
22
23diff --git a/sshconnect2.c b/sshconnect2.c
24index 347e348c60..f64aae66af 100644
25--- a/sshconnect2.c
26+++ b/sshconnect2.c
27@@ -102,12 +102,25 @@ verify_host_key_callback(struct sshkey *hostkey, struct ssh *ssh)
28 return 0;
29 }
30
31+/* Returns the first item from a comma-separated algorithm list */
32+static char *
33+first_alg(const char *algs)
34+{
35+ char *ret, *cp;
36+
37+ ret = xstrdup(algs);
38+ if ((cp = strchr(ret, ',')) != NULL)
39+ *cp = '\0';
40+ return ret;
41+}
42+
43 static char *
44 order_hostkeyalgs(char *host, struct sockaddr *hostaddr, u_short port)
45 {
46- char *oavail, *avail, *first, *last, *alg, *hostname, *ret;
47+ char *oavail = NULL, *avail = NULL, *first = NULL, *last = NULL;
48+ char *alg = NULL, *hostname = NULL, *ret = NULL, *best = NULL;
49 size_t maxlen;
50- struct hostkeys *hostkeys;
51+ struct hostkeys *hostkeys = NULL;
52 int ktype;
53 u_int i;
54
55@@ -119,6 +132,26 @@ order_hostkeyalgs(char *host, struct sockaddr *hostaddr, u_short port)
56 for (i = 0; i < options.num_system_hostfiles; i++)
57 load_hostkeys(hostkeys, hostname, options.system_hostfiles[i]);
58
59+ /*
60+ * If a plain public key exists that matches the type of the best
61+ * preference HostkeyAlgorithms, then use the whole list as is.
62+ * Note that we ignore whether the best preference algorithm is a
63+ * certificate type, as sshconnect.c will downgrade certs to
64+ * plain keys if necessary.
65+ */
66+ best = first_alg(options.hostkeyalgorithms);
67+ if (lookup_key_in_hostkeys_by_type(hostkeys,
68+ sshkey_type_plain(sshkey_type_from_name(best)), NULL)) {
69+ debug3("%s: have matching best-preference key type %s, "
70+ "using HostkeyAlgorithms verbatim", __func__, best);
71+ ret = xstrdup(options.hostkeyalgorithms);
72+ goto out;
73+ }
74+
75+ /*
76+ * Otherwise, prefer the host key algorithms that match known keys
77+ * while keeping the ordering of HostkeyAlgorithms as much as possible.
78+ */
79 oavail = avail = xstrdup(options.hostkeyalgorithms);
80 maxlen = strlen(avail) + 1;
81 first = xmalloc(maxlen);
82@@ -159,6 +192,8 @@ order_hostkeyalgs(char *host, struct sockaddr *hostaddr, u_short port)
83 if (*first != '\0')
84 debug3("%s: prefer hostkeyalgs: %s", __func__, first);
85
86+ out:
87+ free(best);
88 free(first);
89 free(last);
90 free(hostname);
diff --git a/meta/recipes-connectivity/openssh/openssh_8.3p1.bb b/meta/recipes-connectivity/openssh/openssh_8.3p1.bb
index 2aa1df20bd..a1e34a9379 100644
--- a/meta/recipes-connectivity/openssh/openssh_8.3p1.bb
+++ b/meta/recipes-connectivity/openssh/openssh_8.3p1.bb
@@ -24,6 +24,8 @@ 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://0f90440ca70abab947acbd77795e9f130967956c.patch \
28 file://CVE-2020-14145.patch \
27 " 29 "
28SRC_URI[sha256sum] = "f2befbe0472fe7eb75d23340eb17531cb6b3aac24075e2066b41f814e12387b2" 30SRC_URI[sha256sum] = "f2befbe0472fe7eb75d23340eb17531cb6b3aac24075e2066b41f814e12387b2"
29 31
diff --git a/meta/recipes-connectivity/openssl/openssl_1.1.1g.bb b/meta/recipes-connectivity/openssl/openssl_1.1.1k.bb
index 815955837b..5f281197c9 100644
--- a/meta/recipes-connectivity/openssl/openssl_1.1.1g.bb
+++ b/meta/recipes-connectivity/openssl/openssl_1.1.1k.bb
@@ -23,7 +23,7 @@ SRC_URI_append_class-nativesdk = " \
23 file://environment.d-openssl.sh \ 23 file://environment.d-openssl.sh \
24 " 24 "
25 25
26SRC_URI[sha256sum] = "ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46" 26SRC_URI[sha256sum] = "892a0875b9872acd04a9fde79b1f943075d5ea162415de3047c327df33fbaee5"
27 27
28inherit lib_package multilib_header multilib_script ptest 28inherit lib_package multilib_header multilib_script ptest
29MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash" 29MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash"
@@ -210,6 +210,8 @@ BBCLASSEXTEND = "native nativesdk"
210 210
211CVE_PRODUCT = "openssl:openssl" 211CVE_PRODUCT = "openssl:openssl"
212 212
213CVE_VERSION_SUFFIX = "alphabetical"
214
213# Only affects OpenSSL >= 1.1.1 in combination with Apache < 2.4.37 215# Only affects OpenSSL >= 1.1.1 in combination with Apache < 2.4.37
214# Apache in meta-webserver is already recent enough 216# Apache in meta-webserver is already recent enough
215CVE_CHECK_WHITELIST += "CVE-2019-0190" 217CVE_CHECK_WHITELIST += "CVE-2019-0190"
diff --git a/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/CVE-2021-0326.patch b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/CVE-2021-0326.patch
new file mode 100644
index 0000000000..8c90fa3421
--- /dev/null
+++ b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/CVE-2021-0326.patch
@@ -0,0 +1,45 @@
1From 947272febe24a8f0ea828b5b2f35f13c3821901e Mon Sep 17 00:00:00 2001
2From: Jouni Malinen <jouni@codeaurora.org>
3Date: Mon, 9 Nov 2020 11:43:12 +0200
4Subject: [PATCH] P2P: Fix copying of secondary device types for P2P group
5 client
6
7Parsing and copying of WPS secondary device types list was verifying
8that the contents is not too long for the internal maximum in the case
9of WPS messages, but similar validation was missing from the case of P2P
10group information which encodes this information in a different
11attribute. This could result in writing beyond the memory area assigned
12for these entries and corrupting memory within an instance of struct
13p2p_device. This could result in invalid operations and unexpected
14behavior when trying to free pointers from that corrupted memory.
15
16Upstream-Status: Backport
17CVE: CVE-2021-0326
18
19Reference to upstream patch:
20[https://w1.fi/cgit/hostap/commit/?id=947272febe24a8f0ea828b5b2f35f13c3821901e]
21
22Credit to OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27269
23Fixes: e57ae6e19edf ("P2P: Keep track of secondary device types for peers")
24Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
25Signed-off-by: Stefan Ghinea <stefan.ghinea@windriver.com>
26---
27 src/p2p/p2p.c | 2 ++
28 1 file changed, 2 insertions(+)
29
30diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
31index a08ba02..079270f 100644
32--- a/src/p2p/p2p.c
33+++ b/src/p2p/p2p.c
34@@ -453,6 +453,8 @@ static void p2p_copy_client_info(struct p2p_device *dev,
35 dev->info.config_methods = cli->config_methods;
36 os_memcpy(dev->info.pri_dev_type, cli->pri_dev_type, 8);
37 dev->info.wps_sec_dev_type_list_len = 8 * cli->num_sec_dev_types;
38+ if (dev->info.wps_sec_dev_type_list_len > WPS_SEC_DEV_TYPE_MAX_LEN)
39+ dev->info.wps_sec_dev_type_list_len = WPS_SEC_DEV_TYPE_MAX_LEN;
40 os_memcpy(dev->info.wps_sec_dev_type_list, cli->sec_dev_types,
41 dev->info.wps_sec_dev_type_list_len);
42 }
43--
442.17.1
45
diff --git a/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/CVE-2021-27803.patch b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/CVE-2021-27803.patch
new file mode 100644
index 0000000000..004b1dbd19
--- /dev/null
+++ b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/CVE-2021-27803.patch
@@ -0,0 +1,58 @@
1From 8460e3230988ef2ec13ce6b69b687e941f6cdb32 Mon Sep 17 00:00:00 2001
2From: Jouni Malinen <jouni@codeaurora.org>
3Date: Tue, 8 Dec 2020 23:52:50 +0200
4Subject: [PATCH] P2P: Fix a corner case in peer addition based on PD Request
5
6p2p_add_device() may remove the oldest entry if there is no room in the
7peer table for a new peer. This would result in any pointer to that
8removed entry becoming stale. A corner case with an invalid PD Request
9frame could result in such a case ending up using (read+write) freed
10memory. This could only by triggered when the peer table has reached its
11maximum size and the PD Request frame is received from the P2P Device
12Address of the oldest remaining entry and the frame has incorrect P2P
13Device Address in the payload.
14
15Fix this by fetching the dev pointer again after having called
16p2p_add_device() so that the stale pointer cannot be used.
17
18Fixes: 17bef1e97a50 ("P2P: Add peer entry based on Provision Discovery Request")
19Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
20
21Upstream-Status: Backport
22CVE: CVE-2021-27803
23
24Reference to upstream patch:
25[https://w1.fi/cgit/hostap/commit/?id=8460e3230988ef2ec13ce6b69b687e941f6cdb32]
26
27Signed-off-by: Stefan Ghinea <stefan.ghinea@windriver.com>
28---
29 src/p2p/p2p_pd.c | 12 +++++-------
30 1 file changed, 5 insertions(+), 7 deletions(-)
31
32diff --git a/src/p2p/p2p_pd.c b/src/p2p/p2p_pd.c
33index 3994ec0..05fd593 100644
34--- a/src/p2p/p2p_pd.c
35+++ b/src/p2p/p2p_pd.c
36@@ -595,14 +595,12 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa,
37 goto out;
38 }
39
40+ dev = p2p_get_device(p2p, sa);
41 if (!dev) {
42- dev = p2p_get_device(p2p, sa);
43- if (!dev) {
44- p2p_dbg(p2p,
45- "Provision Discovery device not found "
46- MACSTR, MAC2STR(sa));
47- goto out;
48- }
49+ p2p_dbg(p2p,
50+ "Provision Discovery device not found "
51+ MACSTR, MAC2STR(sa));
52+ goto out;
53 }
54 } else if (msg.wfd_subelems) {
55 wpabuf_free(dev->info.wfd_subelems);
56--
572.17.1
58
diff --git a/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/CVE-2021-30004.patch b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/CVE-2021-30004.patch
new file mode 100644
index 0000000000..e2540fc26b
--- /dev/null
+++ b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/CVE-2021-30004.patch
@@ -0,0 +1,123 @@
1From a0541334a6394f8237a4393b7372693cd7e96f15 Mon Sep 17 00:00:00 2001
2From: Jouni Malinen <j@w1.fi>
3Date: Sat, 13 Mar 2021 18:19:31 +0200
4Subject: [PATCH] ASN.1: Validate DigestAlgorithmIdentifier parameters
5
6The supported hash algorithms do not use AlgorithmIdentifier parameters.
7However, there are implementations that include NULL parameters in
8addition to ones that omit the parameters. Previous implementation did
9not check the parameters value at all which supported both these cases,
10but did not reject any other unexpected information.
11
12Use strict validation of digest algorithm parameters and reject any
13unexpected value when validating a signature. This is needed to prevent
14potential forging attacks.
15
16Signed-off-by: Jouni Malinen <j@w1.fi>
17
18Upstream-Status: Backport
19CVE: CVE-2021-30004
20
21Reference to upstream patch:
22[https://w1.fi/cgit/hostap/commit/?id=a0541334a6394f8237a4393b7372693cd7e96f15]
23
24Signed-off-by: Stefan Ghinea <stefan.ghinea@windriver.com>
25---
26 src/tls/pkcs1.c | 21 +++++++++++++++++++++
27 src/tls/x509v3.c | 20 ++++++++++++++++++++
28 2 files changed, 41 insertions(+)
29
30diff --git a/src/tls/pkcs1.c b/src/tls/pkcs1.c
31index 141ac50..e09db07 100644
32--- a/src/tls/pkcs1.c
33+++ b/src/tls/pkcs1.c
34@@ -240,6 +240,8 @@ int pkcs1_v15_sig_ver(struct crypto_public_key *pk,
35 os_free(decrypted);
36 return -1;
37 }
38+ wpa_hexdump(MSG_MSGDUMP, "PKCS #1: DigestInfo",
39+ hdr.payload, hdr.length);
40
41 pos = hdr.payload;
42 end = pos + hdr.length;
43@@ -261,6 +263,8 @@ int pkcs1_v15_sig_ver(struct crypto_public_key *pk,
44 os_free(decrypted);
45 return -1;
46 }
47+ wpa_hexdump(MSG_MSGDUMP, "PKCS #1: DigestAlgorithmIdentifier",
48+ hdr.payload, hdr.length);
49 da_end = hdr.payload + hdr.length;
50
51 if (asn1_get_oid(hdr.payload, hdr.length, &oid, &next)) {
52@@ -269,6 +273,23 @@ int pkcs1_v15_sig_ver(struct crypto_public_key *pk,
53 os_free(decrypted);
54 return -1;
55 }
56+ wpa_hexdump(MSG_MSGDUMP, "PKCS #1: Digest algorithm parameters",
57+ next, da_end - next);
58+
59+ /*
60+ * RFC 5754: The correct encoding for the SHA2 algorithms would be to
61+ * omit the parameters, but there are implementation that encode these
62+ * as a NULL element. Allow these two cases and reject anything else.
63+ */
64+ if (da_end > next &&
65+ (asn1_get_next(next, da_end - next, &hdr) < 0 ||
66+ !asn1_is_null(&hdr) ||
67+ hdr.payload + hdr.length != da_end)) {
68+ wpa_printf(MSG_DEBUG,
69+ "PKCS #1: Unexpected digest algorithm parameters");
70+ os_free(decrypted);
71+ return -1;
72+ }
73
74 if (!asn1_oid_equal(&oid, hash_alg)) {
75 char txt[100], txt2[100];
76diff --git a/src/tls/x509v3.c b/src/tls/x509v3.c
77index 1bd5aa0..bf2289f 100644
78--- a/src/tls/x509v3.c
79+++ b/src/tls/x509v3.c
80@@ -1834,6 +1834,7 @@ int x509_check_signature(struct x509_certificate *issuer,
81 os_free(data);
82 return -1;
83 }
84+ wpa_hexdump(MSG_MSGDUMP, "X509: DigestInfo", hdr.payload, hdr.length);
85
86 pos = hdr.payload;
87 end = pos + hdr.length;
88@@ -1855,6 +1856,8 @@ int x509_check_signature(struct x509_certificate *issuer,
89 os_free(data);
90 return -1;
91 }
92+ wpa_hexdump(MSG_MSGDUMP, "X509: DigestAlgorithmIdentifier",
93+ hdr.payload, hdr.length);
94 da_end = hdr.payload + hdr.length;
95
96 if (asn1_get_oid(hdr.payload, hdr.length, &oid, &next)) {
97@@ -1862,6 +1865,23 @@ int x509_check_signature(struct x509_certificate *issuer,
98 os_free(data);
99 return -1;
100 }
101+ wpa_hexdump(MSG_MSGDUMP, "X509: Digest algorithm parameters",
102+ next, da_end - next);
103+
104+ /*
105+ * RFC 5754: The correct encoding for the SHA2 algorithms would be to
106+ * omit the parameters, but there are implementation that encode these
107+ * as a NULL element. Allow these two cases and reject anything else.
108+ */
109+ if (da_end > next &&
110+ (asn1_get_next(next, da_end - next, &hdr) < 0 ||
111+ !asn1_is_null(&hdr) ||
112+ hdr.payload + hdr.length != da_end)) {
113+ wpa_printf(MSG_DEBUG,
114+ "X509: Unexpected digest algorithm parameters");
115+ os_free(data);
116+ return -1;
117+ }
118
119 if (x509_sha1_oid(&oid)) {
120 if (signature->oid.oid[6] != 5 /* sha-1WithRSAEncryption */) {
121--
1222.17.1
123
diff --git a/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant_2.9.bb b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant_2.9.bb
index 7cc03fef7d..915b326b81 100644
--- a/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant_2.9.bb
+++ b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant_2.9.bb
@@ -29,6 +29,9 @@ SRC_URI = "http://w1.fi/releases/wpa_supplicant-${PV}.tar.gz \
29 file://0001-WPS-UPnP-Do-not-allow-event-subscriptions-with-URLs-.patch \ 29 file://0001-WPS-UPnP-Do-not-allow-event-subscriptions-with-URLs-.patch \
30 file://0002-WPS-UPnP-Fix-event-message-generation-using-a-long-U.patch \ 30 file://0002-WPS-UPnP-Fix-event-message-generation-using-a-long-U.patch \
31 file://0003-WPS-UPnP-Handle-HTTP-initiation-failures-for-events-.patch \ 31 file://0003-WPS-UPnP-Handle-HTTP-initiation-failures-for-events-.patch \
32 file://CVE-2021-0326.patch \
33 file://CVE-2021-27803.patch \
34 file://CVE-2021-30004.patch \
32 " 35 "
33SRC_URI[md5sum] = "2d2958c782576dc9901092fbfecb4190" 36SRC_URI[md5sum] = "2d2958c782576dc9901092fbfecb4190"
34SRC_URI[sha256sum] = "fcbdee7b4a64bea8177973299c8c824419c413ec2e3a95db63dd6a5dc3541f17" 37SRC_URI[sha256sum] = "fcbdee7b4a64bea8177973299c8c824419c413ec2e3a95db63dd6a5dc3541f17"
diff --git a/meta/recipes-core/busybox/busybox/0001-decompress_gunzip-Fix-DoS-if-gzip-is-corrupt.patch b/meta/recipes-core/busybox/busybox/0001-decompress_gunzip-Fix-DoS-if-gzip-is-corrupt.patch
new file mode 100644
index 0000000000..67c9f189cc
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/0001-decompress_gunzip-Fix-DoS-if-gzip-is-corrupt.patch
@@ -0,0 +1,58 @@
1From fe791386ebc270219ca00406c9fdadc5130b64ee Mon Sep 17 00:00:00 2001
2From: Samuel Sapalski <samuel.sapalski@nokia.com>
3Date: Wed, 3 Mar 2021 16:31:22 +0100
4Subject: [PATCH] decompress_gunzip: Fix DoS if gzip is corrupt
5
6On certain corrupt gzip files, huft_build will set the error bit on
7the result pointer. If afterwards abort_unzip is called huft_free
8might run into a segmentation fault or an invalid pointer to
9free(p).
10
11In order to mitigate this, we check in huft_free if the error bit
12is set and clear it before the linked list is freed.
13
14Signed-off-by: Samuel Sapalski <samuel.sapalski@nokia.com>
15Signed-off-by: Peter Kaestle <peter.kaestle@nokia.com>
16Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
17
18Upstream-Status: Backport
19CVE: CVE-2021-28831
20Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
21---
22 archival/libarchive/decompress_gunzip.c | 12 ++++++++++--
23 1 file changed, 10 insertions(+), 2 deletions(-)
24
25diff --git a/archival/libarchive/decompress_gunzip.c b/archival/libarchive/decompress_gunzip.c
26index eb3b64930..e93cd5005 100644
27--- a/archival/libarchive/decompress_gunzip.c
28+++ b/archival/libarchive/decompress_gunzip.c
29@@ -220,10 +220,20 @@ static const uint8_t border[] ALIGN1 = {
30 * each table.
31 * t: table to free
32 */
33+#define BAD_HUFT(p) ((uintptr_t)(p) & 1)
34+#define ERR_RET ((huft_t*)(uintptr_t)1)
35 static void huft_free(huft_t *p)
36 {
37 huft_t *q;
38
39+ /*
40+ * If 'p' has the error bit set we have to clear it, otherwise we might run
41+ * into a segmentation fault or an invalid pointer to free(p)
42+ */
43+ if (BAD_HUFT(p)) {
44+ p = (huft_t*)((uintptr_t)(p) ^ (uintptr_t)(ERR_RET));
45+ }
46+
47 /* Go through linked list, freeing from the malloced (t[-1]) address. */
48 while (p) {
49 q = (--p)->v.t;
50@@ -289,8 +299,6 @@ static unsigned fill_bitbuffer(STATE_PARAM unsigned bitbuffer, unsigned *current
51 * or a valid pointer to a Huffman table, ORed with 0x1 if incompete table
52 * is given: "fixed inflate" decoder feeds us such data.
53 */
54-#define BAD_HUFT(p) ((uintptr_t)(p) & 1)
55-#define ERR_RET ((huft_t*)(uintptr_t)1)
56 static huft_t* huft_build(const unsigned *b, const unsigned n,
57 const unsigned s, const struct cp_ext *cp_ext,
58 unsigned *m)
diff --git a/meta/recipes-core/busybox/busybox_1.32.0.bb b/meta/recipes-core/busybox/busybox_1.32.0.bb
index 8e23b0d4a2..b91f7cf711 100644
--- a/meta/recipes-core/busybox/busybox_1.32.0.bb
+++ b/meta/recipes-core/busybox/busybox_1.32.0.bb
@@ -46,7 +46,8 @@ SRC_URI = "https://busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
46 file://0001-hwclock-make-glibc-2.31-compatible.patch \ 46 file://0001-hwclock-make-glibc-2.31-compatible.patch \
47 file://rev.cfg \ 47 file://rev.cfg \
48 file://pgrep.cfg \ 48 file://pgrep.cfg \
49" 49 file://0001-decompress_gunzip-Fix-DoS-if-gzip-is-corrupt.patch \
50 "
50SRC_URI_append_libc-musl = " file://musl.cfg " 51SRC_URI_append_libc-musl = " file://musl.cfg "
51 52
52SRC_URI[tarball.md5sum] = "9576986f1a960da471d03b72a62f13c7" 53SRC_URI[tarball.md5sum] = "9576986f1a960da471d03b72a62f13c7"
diff --git a/meta/recipes-core/coreutils/coreutils_8.32.bb b/meta/recipes-core/coreutils/coreutils_8.32.bb
index 9d1eceef54..320f93bdc2 100644
--- a/meta/recipes-core/coreutils/coreutils_8.32.bb
+++ b/meta/recipes-core/coreutils/coreutils_8.32.bb
@@ -39,6 +39,9 @@ PACKAGECONFIG_class-target ??= "\
39# The lib/oe/path.py requires xattr 39# The lib/oe/path.py requires xattr
40PACKAGECONFIG_class-native ??= "xattr" 40PACKAGECONFIG_class-native ??= "xattr"
41 41
42# oe-core builds need xattr support
43PACKAGECONFIG_class-nativesdk ??= "xattr"
44
42# with, without, depends, rdepends 45# with, without, depends, rdepends
43# 46#
44PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl," 47PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl,"
@@ -199,3 +202,6 @@ do_install_ptest () {
199} 202}
200 203
201FILES_${PN}-ptest += "${bindir}/getlimits" 204FILES_${PN}-ptest += "${bindir}/getlimits"
205
206# These are specific to Opensuse
207CVE_WHITELIST += "CVE-2013-0221 CVE-2013-0222 CVE-2013-0223"
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/CVE-2020-35457.patch b/meta/recipes-core/glib-2.0/glib-2.0/CVE-2020-35457.patch
new file mode 100644
index 0000000000..828f9fcb96
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/CVE-2020-35457.patch
@@ -0,0 +1,41 @@
1From 63c5b62f0a984fac9a9700b12f54fe878e016a5d Mon Sep 17 00:00:00 2001
2From: Philip Withnall <withnall@endlessm.com>
3Date: Wed, 2 Sep 2020 12:38:09 +0100
4Subject: [PATCH] goption: Add a precondition to avoid GOptionEntry list
5 overflow
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10If the calling code adds more option entries than `G_MAXSIZE` then
11there’ll be an integer overflow. This seems vanishingly unlikely (given
12that all callers use static option entry lists), but add a precondition
13anyway.
14
15Signed-off-by: Philip Withnall <withnall@endlessm.com>
16
17Fixes: #2197
18
19Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/commit/63c5b62f0a984fac9a9700b12f54fe878e016a5d]
20CVE: CVE-2020-35457
21Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
22---
23 glib/goption.c | 2 ++
24 1 file changed, 2 insertions(+)
25
26diff --git a/glib/goption.c b/glib/goption.c
27index 9f5b977c4..bb9093a33 100644
28--- a/glib/goption.c
29+++ b/glib/goption.c
30@@ -2422,6 +2422,8 @@ g_option_group_add_entries (GOptionGroup *group,
31
32 for (n_entries = 0; entries[n_entries].long_name != NULL; n_entries++) ;
33
34+ g_return_if_fail (n_entries <= G_MAXSIZE - group->n_entries);
35+
36 group->entries = g_renew (GOptionEntry, group->entries, group->n_entries + n_entries);
37
38 /* group->entries could be NULL in the trivial case where we add no
39--
402.25.1
41
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/CVE-2021-27219.patch b/meta/recipes-core/glib-2.0/glib-2.0/CVE-2021-27219.patch
new file mode 100644
index 0000000000..a4ec01134a
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/CVE-2021-27219.patch
@@ -0,0 +1,1444 @@
1commit b70039028b4a39ea071f6ed368a58ad5b5b90ba3
2Author: Anatol Belski <anbelski@microsoft.com>
3Date: Sun Mar 14 17:51:53 2021 +0000
4
5 backport: 2.64.5_CVE-2021-27219
6
7CVE: CVE-2021-27219
8Upstream-Status: Backport
9[https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1926]
10
11Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
12
13diff --git a/docs/reference/glib/meson.build b/docs/reference/glib/meson.build
14index 62d95f78d..7eebb04ac 100644
15--- a/docs/reference/glib/meson.build
16+++ b/docs/reference/glib/meson.build
17@@ -22,6 +22,7 @@ if get_option('gtk_doc')
18 'gprintfint.h',
19 'gmirroringtable.h',
20 'gscripttable.h',
21+ 'gstrfuncsprivate.h',
22 'glib-mirroring-tab',
23 'gnulib',
24 'pcre',
25diff --git a/gio/gdatainputstream.c b/gio/gdatainputstream.c
26index 2e7750cb5..2cdcbda19 100644
27--- a/gio/gdatainputstream.c
28+++ b/gio/gdatainputstream.c
29@@ -27,6 +27,7 @@
30 #include "gioenumtypes.h"
31 #include "gioerror.h"
32 #include "glibintl.h"
33+#include "gstrfuncsprivate.h"
34
35 #include <string.h>
36
37@@ -856,7 +857,7 @@ static gssize
38 scan_for_chars (GDataInputStream *stream,
39 gsize *checked_out,
40 const char *stop_chars,
41- gssize stop_chars_len)
42+ gsize stop_chars_len)
43 {
44 GBufferedInputStream *bstream;
45 const char *buffer;
46@@ -952,7 +953,7 @@ typedef struct
47 gsize checked;
48
49 gchar *stop_chars;
50- gssize stop_chars_len;
51+ gsize stop_chars_len;
52 gsize length;
53 } GDataInputStreamReadData;
54
55@@ -1078,12 +1079,17 @@ g_data_input_stream_read_async (GDataInputStream *stream,
56 {
57 GDataInputStreamReadData *data;
58 GTask *task;
59+ gsize stop_chars_len_unsigned;
60
61 data = g_slice_new0 (GDataInputStreamReadData);
62- if (stop_chars_len == -1)
63- stop_chars_len = strlen (stop_chars);
64- data->stop_chars = g_memdup (stop_chars, stop_chars_len);
65- data->stop_chars_len = stop_chars_len;
66+
67+ if (stop_chars_len < 0)
68+ stop_chars_len_unsigned = strlen (stop_chars);
69+ else
70+ stop_chars_len_unsigned = (gsize) stop_chars_len;
71+
72+ data->stop_chars = g_memdup2 (stop_chars, stop_chars_len_unsigned);
73+ data->stop_chars_len = stop_chars_len_unsigned;
74 data->last_saw_cr = FALSE;
75
76 task = g_task_new (stream, cancellable, callback, user_data);
77@@ -1338,17 +1344,20 @@ g_data_input_stream_read_upto (GDataInputStream *stream,
78 gssize found_pos;
79 gssize res;
80 char *data_until;
81+ gsize stop_chars_len_unsigned;
82
83 g_return_val_if_fail (G_IS_DATA_INPUT_STREAM (stream), NULL);
84
85 if (stop_chars_len < 0)
86- stop_chars_len = strlen (stop_chars);
87+ stop_chars_len_unsigned = strlen (stop_chars);
88+ else
89+ stop_chars_len_unsigned = (gsize) stop_chars_len;
90
91 bstream = G_BUFFERED_INPUT_STREAM (stream);
92
93 checked = 0;
94
95- while ((found_pos = scan_for_chars (stream, &checked, stop_chars, stop_chars_len)) == -1)
96+ while ((found_pos = scan_for_chars (stream, &checked, stop_chars, stop_chars_len_unsigned)) == -1)
97 {
98 if (g_buffered_input_stream_get_available (bstream) ==
99 g_buffered_input_stream_get_buffer_size (bstream))
100diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
101index 1a4dae3bd..9de661bde 100644
102--- a/gio/gdbusconnection.c
103+++ b/gio/gdbusconnection.c
104@@ -110,6 +110,7 @@
105 #include "gasyncinitable.h"
106 #include "giostream.h"
107 #include "gasyncresult.h"
108+#include "gstrfuncsprivate.h"
109 #include "gtask.h"
110 #include "gmarshal-internal.h"
111
112@@ -4007,7 +4008,7 @@ _g_dbus_interface_vtable_copy (const GDBusInterfaceVTable *vtable)
113 /* Don't waste memory by copying padding - remember to update this
114 * when changing struct _GDBusInterfaceVTable in gdbusconnection.h
115 */
116- return g_memdup ((gconstpointer) vtable, 3 * sizeof (gpointer));
117+ return g_memdup2 ((gconstpointer) vtable, 3 * sizeof (gpointer));
118 }
119
120 static void
121@@ -4024,7 +4025,7 @@ _g_dbus_subtree_vtable_copy (const GDBusSubtreeVTable *vtable)
122 /* Don't waste memory by copying padding - remember to update this
123 * when changing struct _GDBusSubtreeVTable in gdbusconnection.h
124 */
125- return g_memdup ((gconstpointer) vtable, 3 * sizeof (gpointer));
126+ return g_memdup2 ((gconstpointer) vtable, 3 * sizeof (gpointer));
127 }
128
129 static void
130diff --git a/gio/gdbusinterfaceskeleton.c b/gio/gdbusinterfaceskeleton.c
131index 4a06516c1..4a4b719a5 100644
132--- a/gio/gdbusinterfaceskeleton.c
133+++ b/gio/gdbusinterfaceskeleton.c
134@@ -28,6 +28,7 @@
135 #include "gdbusmethodinvocation.h"
136 #include "gdbusconnection.h"
137 #include "gmarshal-internal.h"
138+#include "gstrfuncsprivate.h"
139 #include "gtask.h"
140 #include "gioerror.h"
141
142@@ -701,7 +702,7 @@ add_connection_locked (GDBusInterfaceSkeleton *interface_,
143 * properly before building the hooked_vtable, so we create it
144 * once at the last minute.
145 */
146- interface_->priv->hooked_vtable = g_memdup (g_dbus_interface_skeleton_get_vtable (interface_), sizeof (GDBusInterfaceVTable));
147+ interface_->priv->hooked_vtable = g_memdup2 (g_dbus_interface_skeleton_get_vtable (interface_), sizeof (GDBusInterfaceVTable));
148 interface_->priv->hooked_vtable->method_call = skeleton_intercept_handle_method_call;
149 }
150
151diff --git a/gio/gfile.c b/gio/gfile.c
152index a2ded14ea..25930435f 100644
153--- a/gio/gfile.c
154+++ b/gio/gfile.c
155@@ -60,6 +60,7 @@
156 #include "gasyncresult.h"
157 #include "gioerror.h"
158 #include "glibintl.h"
159+#include "gstrfuncsprivate.h"
160
161
162 /**
163@@ -7854,7 +7855,7 @@ measure_disk_usage_progress (gboolean reporting,
164 g_main_context_invoke_full (g_task_get_context (task),
165 g_task_get_priority (task),
166 measure_disk_usage_invoke_progress,
167- g_memdup (&progress, sizeof progress),
168+ g_memdup2 (&progress, sizeof progress),
169 g_free);
170 }
171
172@@ -7872,7 +7873,7 @@ measure_disk_usage_thread (GTask *task,
173 data->progress_callback ? measure_disk_usage_progress : NULL, task,
174 &result.disk_usage, &result.num_dirs, &result.num_files,
175 &error))
176- g_task_return_pointer (task, g_memdup (&result, sizeof result), g_free);
177+ g_task_return_pointer (task, g_memdup2 (&result, sizeof result), g_free);
178 else
179 g_task_return_error (task, error);
180 }
181@@ -7896,7 +7897,7 @@ g_file_real_measure_disk_usage_async (GFile *file,
182
183 task = g_task_new (file, cancellable, callback, user_data);
184 g_task_set_source_tag (task, g_file_real_measure_disk_usage_async);
185- g_task_set_task_data (task, g_memdup (&data, sizeof data), g_free);
186+ g_task_set_task_data (task, g_memdup2 (&data, sizeof data), g_free);
187 g_task_set_priority (task, io_priority);
188
189 g_task_run_in_thread (task, measure_disk_usage_thread);
190diff --git a/gio/giowin32-private.c b/gio/giowin32-private.c
191index 7120ae0ea..47e840805 100644
192--- a/gio/giowin32-private.c
193+++ b/gio/giowin32-private.c
194@@ -16,11 +16,12 @@
195 * along with this library; if not, see <http://www.gnu.org/licenses/>.
196 */
197
198+#include "gstrfuncsprivate.h"
199
200-static gssize
201+static gsize
202 g_utf16_len (const gunichar2 *str)
203 {
204- gssize result;
205+ gsize result;
206
207 for (result = 0; str[0] != 0; str++, result++)
208 ;
209@@ -31,17 +32,20 @@ g_utf16_len (const gunichar2 *str)
210 static gunichar2 *
211 g_wcsdup (const gunichar2 *str, gssize str_len)
212 {
213- gssize str_size;
214+ gsize str_len_unsigned;
215+ gsize str_size;
216
217 g_return_val_if_fail (str != NULL, NULL);
218
219- if (str_len == -1)
220- str_len = g_utf16_len (str);
221+ if (str_len < 0)
222+ str_len_unsigned = g_utf16_len (str);
223+ else
224+ str_len_unsigned = (gsize) str_len;
225
226- g_assert (str_len <= G_MAXSIZE / sizeof (gunichar2) - 1);
227- str_size = (str_len + 1) * sizeof (gunichar2);
228+ g_assert (str_len_unsigned <= G_MAXSIZE / sizeof (gunichar2) - 1);
229+ str_size = (str_len_unsigned + 1) * sizeof (gunichar2);
230
231- return g_memdup (str, str_size);
232+ return g_memdup2 (str, str_size);
233 }
234
235 static const gunichar2 *
236diff --git a/gio/gkeyfilesettingsbackend.c b/gio/gkeyfilesettingsbackend.c
237index cd5765afd..de216e615 100644
238--- a/gio/gkeyfilesettingsbackend.c
239+++ b/gio/gkeyfilesettingsbackend.c
240@@ -33,6 +33,7 @@
241 #include "gfilemonitor.h"
242 #include "gsimplepermission.h"
243 #include "gsettingsbackendinternal.h"
244+#include "gstrfuncsprivate.h"
245 #include "giomodule-priv.h"
246 #include "gportalsupport.h"
247
248@@ -145,8 +146,8 @@ convert_path (GKeyfileSettingsBackend *kfsb,
249 gchar **group,
250 gchar **basename)
251 {
252- gint key_len = strlen (key);
253- gint i;
254+ gsize key_len = strlen (key);
255+ const gchar *last_slash;
256
257 if (key_len < kfsb->prefix_len ||
258 memcmp (key, kfsb->prefix, kfsb->prefix_len) != 0)
259@@ -155,38 +156,48 @@ convert_path (GKeyfileSettingsBackend *kfsb,
260 key_len -= kfsb->prefix_len;
261 key += kfsb->prefix_len;
262
263- for (i = key_len; i >= 0; i--)
264- if (key[i] == '/')
265- break;
266+ last_slash = strrchr (key, '/');
267+
268+ /* Disallow empty group names or key names */
269+ if (key_len == 0 ||
270+ (last_slash != NULL &&
271+ (*(last_slash + 1) == '\0' ||
272+ last_slash == key)))
273+ return FALSE;
274
275 if (kfsb->root_group)
276 {
277 /* if a root_group was specified, make sure the user hasn't given
278 * a path that ghosts that group name
279 */
280- if (i == kfsb->root_group_len && memcmp (key, kfsb->root_group, i) == 0)
281+ if (last_slash != NULL && (last_slash - key) == kfsb->root_group_len && memcmp (key, kfsb->root_group, last_slash - key) == 0)
282 return FALSE;
283 }
284 else
285 {
286 /* if no root_group was given, ensure that the user gave a path */
287- if (i == -1)
288+ if (last_slash == NULL)
289 return FALSE;
290 }
291
292 if (group)
293 {
294- if (i >= 0)
295+ if (last_slash != NULL)
296 {
297- *group = g_memdup (key, i + 1);
298- (*group)[i] = '\0';
299+ *group = g_memdup2 (key, (last_slash - key) + 1);
300+ (*group)[(last_slash - key)] = '\0';
301 }
302 else
303 *group = g_strdup (kfsb->root_group);
304 }
305
306 if (basename)
307- *basename = g_memdup (key + i + 1, key_len - i);
308+ {
309+ if (last_slash != NULL)
310+ *basename = g_memdup2 (last_slash + 1, key_len - (last_slash - key));
311+ else
312+ *basename = g_strdup (key);
313+ }
314
315 return TRUE;
316 }
317diff --git a/gio/gsettingsschema.c b/gio/gsettingsschema.c
318index 0b94f76f6..eb5a3b846 100644
319--- a/gio/gsettingsschema.c
320+++ b/gio/gsettingsschema.c
321@@ -20,6 +20,7 @@
322
323 #include "gsettingsschema-internal.h"
324 #include "gsettings.h"
325+#include "gstrfuncsprivate.h"
326
327 #include "gvdb/gvdb-reader.h"
328 #include "strinfo.c"
329@@ -1067,9 +1068,9 @@ g_settings_schema_list_children (GSettingsSchema *schema)
330
331 if (g_str_has_suffix (key, "/"))
332 {
333- gint length = strlen (key);
334+ gsize length = strlen (key);
335
336- strv[j] = g_memdup (key, length);
337+ strv[j] = g_memdup2 (key, length);
338 strv[j][length - 1] = '\0';
339 j++;
340 }
341diff --git a/gio/gsocket.c b/gio/gsocket.c
342index 2a15bdd22..554af026b 100644
343--- a/gio/gsocket.c
344+++ b/gio/gsocket.c
345@@ -75,6 +75,7 @@
346 #include "gcredentialsprivate.h"
347 #include "glibintl.h"
348 #include "gioprivate.h"
349+#include "gstrfuncsprivate.h"
350
351 #ifdef G_OS_WIN32
352 /* For Windows XP runtime compatibility, but use the system's if_nametoindex() if available */
353@@ -174,7 +175,7 @@ static gboolean g_socket_datagram_based_condition_wait (GDatagramBased
354 GError **error);
355
356 static GSocketAddress *
357-cache_recv_address (GSocket *socket, struct sockaddr *native, int native_len);
358+cache_recv_address (GSocket *socket, struct sockaddr *native, size_t native_len);
359
360 static gssize
361 g_socket_receive_message_with_timeout (GSocket *socket,
362@@ -260,7 +261,7 @@ struct _GSocketPrivate
363 struct {
364 GSocketAddress *addr;
365 struct sockaddr *native;
366- gint native_len;
367+ gsize native_len;
368 guint64 last_used;
369 } recv_addr_cache[RECV_ADDR_CACHE_SIZE];
370 };
371@@ -5259,14 +5260,14 @@ g_socket_send_messages_with_timeout (GSocket *socket,
372 }
373
374 static GSocketAddress *
375-cache_recv_address (GSocket *socket, struct sockaddr *native, int native_len)
376+cache_recv_address (GSocket *socket, struct sockaddr *native, size_t native_len)
377 {
378 GSocketAddress *saddr;
379 gint i;
380 guint64 oldest_time = G_MAXUINT64;
381 gint oldest_index = 0;
382
383- if (native_len <= 0)
384+ if (native_len == 0)
385 return NULL;
386
387 saddr = NULL;
388@@ -5274,7 +5275,7 @@ cache_recv_address (GSocket *socket, struct sockaddr *native, int native_len)
389 {
390 GSocketAddress *tmp = socket->priv->recv_addr_cache[i].addr;
391 gpointer tmp_native = socket->priv->recv_addr_cache[i].native;
392- gint tmp_native_len = socket->priv->recv_addr_cache[i].native_len;
393+ gsize tmp_native_len = socket->priv->recv_addr_cache[i].native_len;
394
395 if (!tmp)
396 continue;
397@@ -5304,7 +5305,7 @@ cache_recv_address (GSocket *socket, struct sockaddr *native, int native_len)
398 g_free (socket->priv->recv_addr_cache[oldest_index].native);
399 }
400
401- socket->priv->recv_addr_cache[oldest_index].native = g_memdup (native, native_len);
402+ socket->priv->recv_addr_cache[oldest_index].native = g_memdup2 (native, native_len);
403 socket->priv->recv_addr_cache[oldest_index].native_len = native_len;
404 socket->priv->recv_addr_cache[oldest_index].addr = g_object_ref (saddr);
405 socket->priv->recv_addr_cache[oldest_index].last_used = g_get_monotonic_time ();
406@@ -5452,6 +5453,9 @@ g_socket_receive_message_with_timeout (GSocket *socket,
407 /* do it */
408 while (1)
409 {
410+ /* addrlen has to be of type int because that’s how WSARecvFrom() is defined */
411+ G_STATIC_ASSERT (sizeof addr <= G_MAXINT);
412+
413 addrlen = sizeof addr;
414 if (address)
415 result = WSARecvFrom (socket->priv->fd,
416diff --git a/gio/gtlspassword.c b/gio/gtlspassword.c
417index 1e437a7b6..bd86a6dfe 100644
418--- a/gio/gtlspassword.c
419+++ b/gio/gtlspassword.c
420@@ -23,6 +23,7 @@
421 #include "glibintl.h"
422
423 #include "gioenumtypes.h"
424+#include "gstrfuncsprivate.h"
425 #include "gtlspassword.h"
426
427 #include <string.h>
428@@ -287,9 +288,14 @@ g_tls_password_set_value (GTlsPassword *password,
429 g_return_if_fail (G_IS_TLS_PASSWORD (password));
430
431 if (length < 0)
432- length = strlen ((gchar *)value);
433+ {
434+ /* FIXME: g_tls_password_set_value_full() doesn’t support unsigned gsize */
435+ gsize length_unsigned = strlen ((gchar *) value);
436+ g_return_if_fail (length_unsigned <= G_MAXSSIZE);
437+ length = (gssize) length_unsigned;
438+ }
439
440- g_tls_password_set_value_full (password, g_memdup (value, length), length, g_free);
441+ g_tls_password_set_value_full (password, g_memdup2 (value, (gsize) length), length, g_free);
442 }
443
444 /**
445diff --git a/gio/gwin32registrykey.c b/gio/gwin32registrykey.c
446index aa7819294..efb9ae713 100644
447--- a/gio/gwin32registrykey.c
448+++ b/gio/gwin32registrykey.c
449@@ -28,6 +28,8 @@
450 #include <ntstatus.h>
451 #include <winternl.h>
452
453+#include "gstrfuncsprivate.h"
454+
455 #ifndef _WDMDDK_
456 typedef enum _KEY_INFORMATION_CLASS {
457 KeyBasicInformation,
458@@ -125,16 +127,34 @@ typedef enum
459 G_WIN32_REGISTRY_UPDATED_PATH = 1,
460 } GWin32RegistryKeyUpdateFlag;
461
462+static gsize
463+g_utf16_len (const gunichar2 *str)
464+{
465+ gsize result;
466+
467+ for (result = 0; str[0] != 0; str++, result++)
468+ ;
469+
470+ return result;
471+}
472+
473 static gunichar2 *
474-g_wcsdup (const gunichar2 *str,
475- gssize str_size)
476+g_wcsdup (const gunichar2 *str, gssize str_len)
477 {
478- if (str_size == -1)
479- {
480- str_size = wcslen (str) + 1;
481- str_size *= sizeof (gunichar2);
482- }
483- return g_memdup (str, str_size);
484+ gsize str_len_unsigned;
485+ gsize str_size;
486+
487+ g_return_val_if_fail (str != NULL, NULL);
488+
489+ if (str_len < 0)
490+ str_len_unsigned = g_utf16_len (str);
491+ else
492+ str_len_unsigned = (gsize) str_len;
493+
494+ g_assert (str_len_unsigned <= G_MAXSIZE / sizeof (gunichar2) - 1);
495+ str_size = (str_len_unsigned + 1) * sizeof (gunichar2);
496+
497+ return g_memdup2 (str, str_size);
498 }
499
500 /**
501@@ -247,7 +267,7 @@ g_win32_registry_value_iter_copy (const GWin32RegistryValueIter *iter)
502 new_iter->value_name_size = iter->value_name_size;
503
504 if (iter->value_data != NULL)
505- new_iter->value_data = g_memdup (iter->value_data, iter->value_data_size);
506+ new_iter->value_data = g_memdup2 (iter->value_data, iter->value_data_size);
507
508 new_iter->value_data_size = iter->value_data_size;
509
510@@ -268,8 +288,8 @@ g_win32_registry_value_iter_copy (const GWin32RegistryValueIter *iter)
511 new_iter->value_data_expanded_charsize = iter->value_data_expanded_charsize;
512
513 if (iter->value_data_expanded_u8 != NULL)
514- new_iter->value_data_expanded_u8 = g_memdup (iter->value_data_expanded_u8,
515- iter->value_data_expanded_charsize);
516+ new_iter->value_data_expanded_u8 = g_memdup2 (iter->value_data_expanded_u8,
517+ iter->value_data_expanded_charsize);
518
519 new_iter->value_data_expanded_u8_size = iter->value_data_expanded_charsize;
520
521diff --git a/gio/tests/async-close-output-stream.c b/gio/tests/async-close-output-stream.c
522index 5f6620275..d3f97a119 100644
523--- a/gio/tests/async-close-output-stream.c
524+++ b/gio/tests/async-close-output-stream.c
525@@ -24,6 +24,8 @@
526 #include <stdlib.h>
527 #include <string.h>
528
529+#include "gstrfuncsprivate.h"
530+
531 #define DATA_TO_WRITE "Hello world\n"
532
533 typedef struct
534@@ -147,9 +149,9 @@ prepare_data (SetupData *data,
535
536 data->expected_size = g_memory_output_stream_get_data_size (G_MEMORY_OUTPUT_STREAM (data->data_stream));
537
538- g_assert_cmpint (data->expected_size, >, 0);
539+ g_assert_cmpuint (data->expected_size, >, 0);
540
541- data->expected_output = g_memdup (written, (guint)data->expected_size);
542+ data->expected_output = g_memdup2 (written, data->expected_size);
543
544 /* then recreate the streams and prepare them for the asynchronous close */
545 destroy_streams (data);
546diff --git a/gio/tests/gdbus-export.c b/gio/tests/gdbus-export.c
547index fda654c44..10dd6d82f 100644
548--- a/gio/tests/gdbus-export.c
549+++ b/gio/tests/gdbus-export.c
550@@ -23,6 +23,7 @@
551 #include <string.h>
552
553 #include "gdbus-tests.h"
554+#include "gstrfuncsprivate.h"
555
556 /* all tests rely on a shared mainloop */
557 static GMainLoop *loop = NULL;
558@@ -671,7 +672,7 @@ subtree_introspect (GDBusConnection *connection,
559 g_assert_not_reached ();
560 }
561
562- return g_memdup (interfaces, 2 * sizeof (void *));
563+ return g_memdup2 (interfaces, 2 * sizeof (void *));
564 }
565
566 static const GDBusInterfaceVTable *
567@@ -727,7 +728,7 @@ dynamic_subtree_introspect (GDBusConnection *connection,
568 {
569 const GDBusInterfaceInfo *interfaces[2] = { &dyna_interface_info, NULL };
570
571- return g_memdup (interfaces, 2 * sizeof (void *));
572+ return g_memdup2 (interfaces, 2 * sizeof (void *));
573 }
574
575 static const GDBusInterfaceVTable *
576diff --git a/gio/tests/gsettings.c b/gio/tests/gsettings.c
577index baadca8f5..afe594a23 100644
578--- a/gio/tests/gsettings.c
579+++ b/gio/tests/gsettings.c
580@@ -1,3 +1,4 @@
581+#include <errno.h>
582 #include <stdlib.h>
583 #include <locale.h>
584 #include <libintl.h>
585@@ -1740,6 +1741,14 @@ key_changed_cb (GSettings *settings, const gchar *key, gpointer data)
586 (*b) = TRUE;
587 }
588
589+typedef struct
590+{
591+ const gchar *path;
592+ const gchar *root_group;
593+ const gchar *keyfile_group;
594+ const gchar *root_path;
595+} KeyfileTestData;
596+
597 /*
598 * Test that using a keyfile works
599 */
600@@ -1834,7 +1843,11 @@ test_keyfile (Fixture *fixture,
601 g_free (str);
602
603 g_settings_set (settings, "farewell", "s", "cheerio");
604-
605+
606+ /* Check that empty keys/groups are not allowed. */
607+ g_assert_false (g_settings_is_writable (settings, ""));
608+ g_assert_false (g_settings_is_writable (settings, "/"));
609+
610 /* When executing as root, changing the mode of the keyfile will have
611 * no effect on the writability of the settings.
612 */
613@@ -1866,6 +1879,149 @@ test_keyfile (Fixture *fixture,
614 g_free (keyfile_path);
615 }
616
617+/*
618+ * Test that using a keyfile works with a schema with no path set.
619+ */
620+static void
621+test_keyfile_no_path (Fixture *fixture,
622+ gconstpointer user_data)
623+{
624+ const KeyfileTestData *test_data = user_data;
625+ GSettingsBackend *kf_backend;
626+ GSettings *settings;
627+ GKeyFile *keyfile;
628+ gboolean writable;
629+ gchar *key = NULL;
630+ GError *error = NULL;
631+ gchar *keyfile_path = NULL, *store_path = NULL;
632+
633+ keyfile_path = g_build_filename (fixture->tmp_dir, "keyfile", NULL);
634+ store_path = g_build_filename (keyfile_path, "gsettings.store", NULL);
635+ kf_backend = g_keyfile_settings_backend_new (store_path, test_data->root_path, test_data->root_group);
636+ settings = g_settings_new_with_backend_and_path ("org.gtk.test.no-path", kf_backend, test_data->path);
637+ g_object_unref (kf_backend);
638+
639+ g_settings_reset (settings, "test-boolean");
640+ g_assert_true (g_settings_get_boolean (settings, "test-boolean"));
641+
642+ writable = g_settings_is_writable (settings, "test-boolean");
643+ g_assert_true (writable);
644+ g_settings_set (settings, "test-boolean", "b", FALSE);
645+
646+ g_assert_false (g_settings_get_boolean (settings, "test-boolean"));
647+
648+ g_settings_delay (settings);
649+ g_settings_set (settings, "test-boolean", "b", TRUE);
650+ g_settings_apply (settings);
651+
652+ keyfile = g_key_file_new ();
653+ g_assert_true (g_key_file_load_from_file (keyfile, store_path, 0, NULL));
654+
655+ g_assert_true (g_key_file_get_boolean (keyfile, test_data->keyfile_group, "test-boolean", NULL));
656+
657+ g_key_file_free (keyfile);
658+
659+ g_settings_reset (settings, "test-boolean");
660+ g_settings_apply (settings);
661+ keyfile = g_key_file_new ();
662+ g_assert_true (g_key_file_load_from_file (keyfile, store_path, 0, NULL));
663+
664+ g_assert_false (g_key_file_get_string (keyfile, test_data->keyfile_group, "test-boolean", &error));
665+ g_assert_error (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND);
666+ g_clear_error (&error);
667+
668+ /* Check that empty keys/groups are not allowed. */
669+ g_assert_false (g_settings_is_writable (settings, ""));
670+ g_assert_false (g_settings_is_writable (settings, "/"));
671+
672+ /* Keys which ghost the root group name are not allowed. This can only be
673+ * tested when the path is `/` as otherwise it acts as a prefix and prevents
674+ * any ghosting. */
675+ if (g_str_equal (test_data->path, "/"))
676+ {
677+ key = g_strdup_printf ("%s/%s", test_data->root_group, "");
678+ g_assert_false (g_settings_is_writable (settings, key));
679+ g_free (key);
680+
681+ key = g_strdup_printf ("%s/%s", test_data->root_group, "/");
682+ g_assert_false (g_settings_is_writable (settings, key));
683+ g_free (key);
684+
685+ key = g_strdup_printf ("%s/%s", test_data->root_group, "test-boolean");
686+ g_assert_false (g_settings_is_writable (settings, key));
687+ g_free (key);
688+ }
689+
690+ g_key_file_free (keyfile);
691+ g_object_unref (settings);
692+
693+ /* Clean up the temporary directory. */
694+ g_assert_cmpint (g_chmod (keyfile_path, 0777) == 0 ? 0 : errno, ==, 0);
695+ g_assert_cmpint (g_remove (store_path) == 0 ? 0 : errno, ==, 0);
696+ g_assert_cmpint (g_rmdir (keyfile_path) == 0 ? 0 : errno, ==, 0);
697+ g_free (store_path);
698+ g_free (keyfile_path);
699+}
700+
701+/*
702+ * Test that a keyfile rejects writes to keys outside its root path.
703+ */
704+static void
705+test_keyfile_outside_root_path (Fixture *fixture,
706+ gconstpointer user_data)
707+{
708+ GSettingsBackend *kf_backend;
709+ GSettings *settings;
710+ gchar *keyfile_path = NULL, *store_path = NULL;
711+
712+ keyfile_path = g_build_filename (fixture->tmp_dir, "keyfile", NULL);
713+ store_path = g_build_filename (keyfile_path, "gsettings.store", NULL);
714+ kf_backend = g_keyfile_settings_backend_new (store_path, "/tests/basic-types/", "root");
715+ settings = g_settings_new_with_backend_and_path ("org.gtk.test.no-path", kf_backend, "/tests/");
716+ g_object_unref (kf_backend);
717+
718+ g_assert_false (g_settings_is_writable (settings, "test-boolean"));
719+
720+ g_object_unref (settings);
721+
722+ /* Clean up the temporary directory. The keyfile probably doesn’t exist, so
723+ * don’t error on failure. */
724+ g_remove (store_path);
725+ g_assert_cmpint (g_rmdir (keyfile_path) == 0 ? 0 : errno, ==, 0);
726+ g_free (store_path);
727+ g_free (keyfile_path);
728+}
729+
730+/*
731+ * Test that a keyfile rejects writes to keys in the root if no root group is set.
732+ */
733+static void
734+test_keyfile_no_root_group (Fixture *fixture,
735+ gconstpointer user_data)
736+{
737+ GSettingsBackend *kf_backend;
738+ GSettings *settings;
739+ gchar *keyfile_path = NULL, *store_path = NULL;
740+
741+ keyfile_path = g_build_filename (fixture->tmp_dir, "keyfile", NULL);
742+ store_path = g_build_filename (keyfile_path, "gsettings.store", NULL);
743+ kf_backend = g_keyfile_settings_backend_new (store_path, "/", NULL);
744+ settings = g_settings_new_with_backend_and_path ("org.gtk.test.no-path", kf_backend, "/");
745+ g_object_unref (kf_backend);
746+
747+ g_assert_false (g_settings_is_writable (settings, "test-boolean"));
748+ g_assert_true (g_settings_is_writable (settings, "child/test-boolean"));
749+
750+ g_object_unref (settings);
751+
752+ /* Clean up the temporary directory. The keyfile probably doesn’t exist, so
753+ * don’t error on failure. */
754+ g_remove (store_path);
755+ g_assert_cmpint (g_rmdir (keyfile_path) == 0 ? 0 : errno, ==, 0);
756+ g_free (store_path);
757+ g_free (keyfile_path);
758+}
759+
760 /* Test that getting child schemas works
761 */
762 static void
763@@ -2844,6 +3000,14 @@ main (int argc, char *argv[])
764 gchar *override_text;
765 gchar *enums;
766 gint result;
767+ const KeyfileTestData keyfile_test_data_explicit_path = { "/tests/", "root", "tests", "/" };
768+ const KeyfileTestData keyfile_test_data_empty_path = { "/", "root", "root", "/" };
769+ const KeyfileTestData keyfile_test_data_long_path = {
770+ "/tests/path/is/very/long/and/this/makes/some/comparisons/take/a/different/branch/",
771+ "root",
772+ "tests/path/is/very/long/and/this/makes/some/comparisons/take/a/different/branch",
773+ "/"
774+ };
775
776 /* Meson build sets this */
777 #ifdef TEST_LOCALE_PATH
778@@ -2967,6 +3131,11 @@ main (int argc, char *argv[])
779 }
780
781 g_test_add ("/gsettings/keyfile", Fixture, NULL, setup, test_keyfile, teardown);
782+ g_test_add ("/gsettings/keyfile/explicit-path", Fixture, &keyfile_test_data_explicit_path, setup, test_keyfile_no_path, teardown);
783+ g_test_add ("/gsettings/keyfile/empty-path", Fixture, &keyfile_test_data_empty_path, setup, test_keyfile_no_path, teardown);
784+ g_test_add ("/gsettings/keyfile/long-path", Fixture, &keyfile_test_data_long_path, setup, test_keyfile_no_path, teardown);
785+ g_test_add ("/gsettings/keyfile/outside-root-path", Fixture, NULL, setup, test_keyfile_outside_root_path, teardown);
786+ g_test_add ("/gsettings/keyfile/no-root-group", Fixture, NULL, setup, test_keyfile_no_root_group, teardown);
787 g_test_add_func ("/gsettings/child-schema", test_child_schema);
788 g_test_add_func ("/gsettings/strinfo", test_strinfo);
789 g_test_add_func ("/gsettings/enums", test_enums);
790diff --git a/gio/tests/tls-interaction.c b/gio/tests/tls-interaction.c
791index 4f0737d7e..5661e8e0d 100644
792--- a/gio/tests/tls-interaction.c
793+++ b/gio/tests/tls-interaction.c
794@@ -174,6 +174,38 @@ test_interaction_ask_password_finish_failure (GTlsInteraction *interaction,
795 }
796
797
798+/* Return a copy of @str that is allocated in a silly way, to exercise
799+ * custom free-functions. The returned pointer points to a copy of @str
800+ * in a buffer of the form "BEFORE \0 str \0 AFTER". */
801+static guchar *
802+special_dup (const char *str)
803+{
804+ GString *buf = g_string_new ("BEFORE");
805+ guchar *ret;
806+
807+ g_string_append_c (buf, '\0');
808+ g_string_append (buf, str);
809+ g_string_append_c (buf, '\0');
810+ g_string_append (buf, "AFTER");
811+ ret = (guchar *) g_string_free (buf, FALSE);
812+ return ret + strlen ("BEFORE") + 1;
813+}
814+
815+
816+/* Free a copy of @str that was made with special_dup(), after asserting
817+ * that it has not been corrupted. */
818+static void
819+special_free (gpointer p)
820+{
821+ gchar *s = p;
822+ gchar *buf = s - strlen ("BEFORE") - 1;
823+
824+ g_assert_cmpstr (buf, ==, "BEFORE");
825+ g_assert_cmpstr (s + strlen (s) + 1, ==, "AFTER");
826+ g_free (buf);
827+}
828+
829+
830 static GTlsInteractionResult
831 test_interaction_ask_password_sync_success (GTlsInteraction *interaction,
832 GTlsPassword *password,
833@@ -181,6 +213,8 @@ test_interaction_ask_password_sync_success (GTlsInteraction *interaction,
834 GError **error)
835 {
836 TestInteraction *self;
837+ const guchar *value;
838+ gsize len;
839
840 g_assert (TEST_IS_INTERACTION (interaction));
841 self = TEST_INTERACTION (interaction);
842@@ -192,6 +226,27 @@ test_interaction_ask_password_sync_success (GTlsInteraction *interaction,
843 g_assert (error != NULL);
844 g_assert (*error == NULL);
845
846+ /* Exercise different ways to set the value */
847+ g_tls_password_set_value (password, (const guchar *) "foo", 4);
848+ len = 0;
849+ value = g_tls_password_get_value (password, &len);
850+ g_assert_cmpmem (value, len, "foo", 4);
851+
852+ g_tls_password_set_value (password, (const guchar *) "bar", -1);
853+ len = 0;
854+ value = g_tls_password_get_value (password, &len);
855+ g_assert_cmpmem (value, len, "bar", 3);
856+
857+ g_tls_password_set_value_full (password, special_dup ("baa"), 4, special_free);
858+ len = 0;
859+ value = g_tls_password_get_value (password, &len);
860+ g_assert_cmpmem (value, len, "baa", 4);
861+
862+ g_tls_password_set_value_full (password, special_dup ("baz"), -1, special_free);
863+ len = 0;
864+ value = g_tls_password_get_value (password, &len);
865+ g_assert_cmpmem (value, len, "baz", 3);
866+
867 /* Don't do this in real life. Include a null terminator for testing */
868 g_tls_password_set_value (password, (const guchar *)"the password", 13);
869 return G_TLS_INTERACTION_HANDLED;
870diff --git a/gio/win32/gwinhttpfile.c b/gio/win32/gwinhttpfile.c
871index cf5eed31d..246ec0578 100644
872--- a/gio/win32/gwinhttpfile.c
873+++ b/gio/win32/gwinhttpfile.c
874@@ -29,6 +29,7 @@
875 #include "gio/gfile.h"
876 #include "gio/gfileattribute.h"
877 #include "gio/gfileinfo.h"
878+#include "gstrfuncsprivate.h"
879 #include "gwinhttpfile.h"
880 #include "gwinhttpfileinputstream.h"
881 #include "gwinhttpfileoutputstream.h"
882@@ -393,10 +394,10 @@ g_winhttp_file_resolve_relative_path (GFile *file,
883 child = g_object_new (G_TYPE_WINHTTP_FILE, NULL);
884 child->vfs = winhttp_file->vfs;
885 child->url = winhttp_file->url;
886- child->url.lpszScheme = g_memdup (winhttp_file->url.lpszScheme, (winhttp_file->url.dwSchemeLength+1)*2);
887- child->url.lpszHostName = g_memdup (winhttp_file->url.lpszHostName, (winhttp_file->url.dwHostNameLength+1)*2);
888- child->url.lpszUserName = g_memdup (winhttp_file->url.lpszUserName, (winhttp_file->url.dwUserNameLength+1)*2);
889- child->url.lpszPassword = g_memdup (winhttp_file->url.lpszPassword, (winhttp_file->url.dwPasswordLength+1)*2);
890+ child->url.lpszScheme = g_memdup2 (winhttp_file->url.lpszScheme, ((gsize) winhttp_file->url.dwSchemeLength + 1) * 2);
891+ child->url.lpszHostName = g_memdup2 (winhttp_file->url.lpszHostName, ((gsize) winhttp_file->url.dwHostNameLength + 1) * 2);
892+ child->url.lpszUserName = g_memdup2 (winhttp_file->url.lpszUserName, ((gsize) winhttp_file->url.dwUserNameLength + 1) * 2);
893+ child->url.lpszPassword = g_memdup2 (winhttp_file->url.lpszPassword, ((gsize) winhttp_file->url.dwPasswordLength + 1) * 2);
894 child->url.lpszUrlPath = wnew_path;
895 child->url.dwUrlPathLength = wcslen (wnew_path);
896 child->url.lpszExtraInfo = NULL;
897diff --git a/glib/gbytes.c b/glib/gbytes.c
898index ec6923188..6f17d104c 100644
899--- a/glib/gbytes.c
900+++ b/glib/gbytes.c
901@@ -34,6 +34,8 @@
902
903 #include <string.h>
904
905+#include "gstrfuncsprivate.h"
906+
907 /**
908 * GBytes:
909 *
910@@ -95,7 +97,7 @@ g_bytes_new (gconstpointer data,
911 {
912 g_return_val_if_fail (data != NULL || size == 0, NULL);
913
914- return g_bytes_new_take (g_memdup (data, size), size);
915+ return g_bytes_new_take (g_memdup2 (data, size), size);
916 }
917
918 /**
919@@ -499,7 +501,7 @@ g_bytes_unref_to_data (GBytes *bytes,
920 * Copy: Non g_malloc (or compatible) allocator, or static memory,
921 * so we have to copy, and then unref.
922 */
923- result = g_memdup (bytes->data, bytes->size);
924+ result = g_memdup2 (bytes->data, bytes->size);
925 *size = bytes->size;
926 g_bytes_unref (bytes);
927 }
928diff --git a/glib/gdir.c b/glib/gdir.c
929index 6b85e99c8..6747a8c6f 100644
930--- a/glib/gdir.c
931+++ b/glib/gdir.c
932@@ -37,6 +37,7 @@
933 #include "gconvert.h"
934 #include "gfileutils.h"
935 #include "gstrfuncs.h"
936+#include "gstrfuncsprivate.h"
937 #include "gtestutils.h"
938 #include "glibintl.h"
939
940@@ -112,7 +113,7 @@ g_dir_open_with_errno (const gchar *path,
941 return NULL;
942 #endif
943
944- return g_memdup (&dir, sizeof dir);
945+ return g_memdup2 (&dir, sizeof dir);
946 }
947
948 /**
949diff --git a/glib/ghash.c b/glib/ghash.c
950index 0f1562a06..c1e15c957 100644
951--- a/glib/ghash.c
952+++ b/glib/ghash.c
953@@ -34,6 +34,7 @@
954 #include "gmacros.h"
955 #include "glib-private.h"
956 #include "gstrfuncs.h"
957+#include "gstrfuncsprivate.h"
958 #include "gatomic.h"
959 #include "gtestutils.h"
960 #include "gslice.h"
961@@ -962,7 +963,7 @@ g_hash_table_ensure_keyval_fits (GHashTable *hash_table, gpointer key, gpointer
962 if (hash_table->have_big_keys)
963 {
964 if (key != value)
965- hash_table->values = g_memdup (hash_table->keys, sizeof (gpointer) * hash_table->size);
966+ hash_table->values = g_memdup2 (hash_table->keys, sizeof (gpointer) * hash_table->size);
967 /* Keys and values are both big now, so no need for further checks */
968 return;
969 }
970@@ -970,7 +971,7 @@ g_hash_table_ensure_keyval_fits (GHashTable *hash_table, gpointer key, gpointer
971 {
972 if (key != value)
973 {
974- hash_table->values = g_memdup (hash_table->keys, sizeof (guint) * hash_table->size);
975+ hash_table->values = g_memdup2 (hash_table->keys, sizeof (guint) * hash_table->size);
976 is_a_set = FALSE;
977 }
978 }
979@@ -998,7 +999,7 @@ g_hash_table_ensure_keyval_fits (GHashTable *hash_table, gpointer key, gpointer
980
981 /* Just split if necessary */
982 if (is_a_set && key != value)
983- hash_table->values = g_memdup (hash_table->keys, sizeof (gpointer) * hash_table->size);
984+ hash_table->values = g_memdup2 (hash_table->keys, sizeof (gpointer) * hash_table->size);
985
986 #endif
987 }
988diff --git a/glib/giochannel.c b/glib/giochannel.c
989index d16399846..b41381d38 100644
990--- a/glib/giochannel.c
991+++ b/glib/giochannel.c
992@@ -37,6 +37,7 @@
993 #include "giochannel.h"
994
995 #include "gstrfuncs.h"
996+#include "gstrfuncsprivate.h"
997 #include "gtestutils.h"
998 #include "glibintl.h"
999
1000@@ -886,17 +887,26 @@ g_io_channel_set_line_term (GIOChannel *channel,
1001 const gchar *line_term,
1002 gint length)
1003 {
1004+ guint length_unsigned;
1005+
1006 g_return_if_fail (channel != NULL);
1007 g_return_if_fail (line_term == NULL || length != 0); /* Disallow "" */
1008
1009 if (line_term == NULL)
1010- length = 0;
1011- else if (length < 0)
1012- length = strlen (line_term);
1013+ length_unsigned = 0;
1014+ else if (length >= 0)
1015+ length_unsigned = (guint) length;
1016+ else
1017+ {
1018+ /* FIXME: We’re constrained by line_term_len being a guint here */
1019+ gsize length_size = strlen (line_term);
1020+ g_return_if_fail (length_size <= G_MAXUINT);
1021+ length_unsigned = (guint) length_size;
1022+ }
1023
1024 g_free (channel->line_term);
1025- channel->line_term = line_term ? g_memdup (line_term, length) : NULL;
1026- channel->line_term_len = length;
1027+ channel->line_term = line_term ? g_memdup2 (line_term, length_unsigned) : NULL;
1028+ channel->line_term_len = length_unsigned;
1029 }
1030
1031 /**
1032@@ -1673,10 +1683,10 @@ g_io_channel_read_line (GIOChannel *channel,
1033
1034 /* Copy the read bytes (including any embedded nuls) and nul-terminate.
1035 * `USE_BUF (channel)->str` is guaranteed to be nul-terminated as it’s a
1036- * #GString, so it’s safe to call g_memdup() with +1 length to allocate
1037+ * #GString, so it’s safe to call g_memdup2() with +1 length to allocate
1038 * a nul-terminator. */
1039 g_assert (USE_BUF (channel));
1040- line = g_memdup (USE_BUF (channel)->str, got_length + 1);
1041+ line = g_memdup2 (USE_BUF (channel)->str, got_length + 1);
1042 line[got_length] = '\0';
1043 *str_return = g_steal_pointer (&line);
1044 g_string_erase (USE_BUF (channel), 0, got_length);
1045diff --git a/glib/gslice.c b/glib/gslice.c
1046index 4c758c3be..bcdbb8853 100644
1047--- a/glib/gslice.c
1048+++ b/glib/gslice.c
1049@@ -41,6 +41,7 @@
1050 #include "gmain.h"
1051 #include "gmem.h" /* gslice.h */
1052 #include "gstrfuncs.h"
1053+#include "gstrfuncsprivate.h"
1054 #include "gutils.h"
1055 #include "gtrashstack.h"
1056 #include "gtestutils.h"
1057@@ -350,7 +351,7 @@ g_slice_get_config_state (GSliceConfig ckey,
1058 array[i++] = allocator->contention_counters[address];
1059 array[i++] = allocator_get_magazine_threshold (allocator, address);
1060 *n_values = i;
1061- return g_memdup (array, sizeof (array[0]) * *n_values);
1062+ return g_memdup2 (array, sizeof (array[0]) * *n_values);
1063 default:
1064 return NULL;
1065 }
1066diff --git a/glib/gstrfuncsprivate.h b/glib/gstrfuncsprivate.h
1067new file mode 100644
1068index 000000000..85c88328a
1069--- /dev/null
1070+++ b/glib/gstrfuncsprivate.h
1071@@ -0,0 +1,55 @@
1072+/* GLIB - Library of useful routines for C programming
1073+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
1074+ *
1075+ * This library is free software; you can redistribute it and/or
1076+ * modify it under the terms of the GNU Lesser General Public
1077+ * License as published by the Free Software Foundation; either
1078+ * version 2.1 of the License, or (at your option) any later version.
1079+ *
1080+ * This library is distributed in the hope that it will be useful,
1081+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1082+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1083+ * Lesser General Public License for more details.
1084+ *
1085+ * You should have received a copy of the GNU Lesser General Public
1086+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
1087+ */
1088+
1089+#include <glib.h>
1090+#include <string.h>
1091+
1092+/*
1093+ * g_memdup2:
1094+ * @mem: (nullable): the memory to copy.
1095+ * @byte_size: the number of bytes to copy.
1096+ *
1097+ * Allocates @byte_size bytes of memory, and copies @byte_size bytes into it
1098+ * from @mem. If @mem is %NULL it returns %NULL.
1099+ *
1100+ * This replaces g_memdup(), which was prone to integer overflows when
1101+ * converting the argument from a #gsize to a #guint.
1102+ *
1103+ * This static inline version is a backport of the new public API from
1104+ * GLib 2.68, kept internal to GLib for backport to older stable releases.
1105+ * See https://gitlab.gnome.org/GNOME/glib/-/issues/2319.
1106+ *
1107+ * Returns: (nullable): a pointer to the newly-allocated copy of the memory,
1108+ * or %NULL if @mem is %NULL.
1109+ * Since: 2.68
1110+ */
1111+static inline gpointer
1112+g_memdup2 (gconstpointer mem,
1113+ gsize byte_size)
1114+{
1115+ gpointer new_mem;
1116+
1117+ if (mem && byte_size != 0)
1118+ {
1119+ new_mem = g_malloc (byte_size);
1120+ memcpy (new_mem, mem, byte_size);
1121+ }
1122+ else
1123+ new_mem = NULL;
1124+
1125+ return new_mem;
1126+}
1127diff --git a/glib/gtestutils.c b/glib/gtestutils.c
1128index 18b117285..26d46ad75 100644
1129--- a/glib/gtestutils.c
1130+++ b/glib/gtestutils.c
1131@@ -49,6 +49,7 @@
1132 #include "gpattern.h"
1133 #include "grand.h"
1134 #include "gstrfuncs.h"
1135+#include "gstrfuncsprivate.h"
1136 #include "gtimer.h"
1137 #include "gslice.h"
1138 #include "gspawn.h"
1139@@ -3803,7 +3804,7 @@ g_test_log_extract (GTestLogBuffer *tbuffer)
1140 if (p <= tbuffer->data->str + mlength)
1141 {
1142 g_string_erase (tbuffer->data, 0, mlength);
1143- tbuffer->msgs = g_slist_prepend (tbuffer->msgs, g_memdup (&msg, sizeof (msg)));
1144+ tbuffer->msgs = g_slist_prepend (tbuffer->msgs, g_memdup2 (&msg, sizeof (msg)));
1145 return TRUE;
1146 }
1147
1148diff --git a/glib/gvariant.c b/glib/gvariant.c
1149index 77d7e746b..ef4257f6d 100644
1150--- a/glib/gvariant.c
1151+++ b/glib/gvariant.c
1152@@ -33,6 +33,7 @@
1153
1154 #include <string.h>
1155
1156+#include "gstrfuncsprivate.h"
1157
1158 /**
1159 * SECTION:gvariant
1160@@ -725,7 +726,7 @@ g_variant_new_variant (GVariant *value)
1161 g_variant_ref_sink (value);
1162
1163 return g_variant_new_from_children (G_VARIANT_TYPE_VARIANT,
1164- g_memdup (&value, sizeof value),
1165+ g_memdup2 (&value, sizeof value),
1166 1, g_variant_is_trusted (value));
1167 }
1168
1169@@ -1229,7 +1230,7 @@ g_variant_new_fixed_array (const GVariantType *element_type,
1170 return NULL;
1171 }
1172
1173- data = g_memdup (elements, n_elements * element_size);
1174+ data = g_memdup2 (elements, n_elements * element_size);
1175 value = g_variant_new_from_data (array_type, data,
1176 n_elements * element_size,
1177 FALSE, g_free, data);
1178@@ -1908,7 +1909,7 @@ g_variant_dup_bytestring (GVariant *value,
1179 if (length)
1180 *length = size;
1181
1182- return g_memdup (original, size + 1);
1183+ return g_memdup2 (original, size + 1);
1184 }
1185
1186 /**
1187diff --git a/glib/gvarianttype.c b/glib/gvarianttype.c
1188index c46f1a2c6..585e29ab2 100644
1189--- a/glib/gvarianttype.c
1190+++ b/glib/gvarianttype.c
1191@@ -28,6 +28,7 @@
1192
1193 #include <string.h>
1194
1195+#include "gstrfuncsprivate.h"
1196
1197 /**
1198 * SECTION:gvarianttype
1199@@ -1181,7 +1182,7 @@ g_variant_type_new_tuple (const GVariantType * const *items,
1200 g_assert (offset < sizeof buffer);
1201 buffer[offset++] = ')';
1202
1203- return (GVariantType *) g_memdup (buffer, offset);
1204+ return (GVariantType *) g_memdup2 (buffer, offset);
1205 }
1206
1207 /**
1208diff --git a/glib/meson.build b/glib/meson.build
1209index 456e0c2a1..2e5cd77bb 100644
1210--- a/glib/meson.build
1211+++ b/glib/meson.build
1212@@ -268,6 +268,7 @@ glib_sources = files(
1213 'gslist.c',
1214 'gstdio.c',
1215 'gstrfuncs.c',
1216+ 'gstrfuncsprivate.h',
1217 'gstring.c',
1218 'gstringchunk.c',
1219 'gtestutils.c',
1220diff --git a/glib/tests/array-test.c b/glib/tests/array-test.c
1221index 1da514a3e..88f22de80 100644
1222--- a/glib/tests/array-test.c
1223+++ b/glib/tests/array-test.c
1224@@ -29,6 +29,8 @@
1225 #include <string.h>
1226 #include "glib.h"
1227
1228+#include "gstrfuncsprivate.h"
1229+
1230 /* Test data to be passed to any function which calls g_array_new(), providing
1231 * the parameters for that call. Most #GArray tests should be repeated for all
1232 * possible values of #ArrayTestData. */
1233@@ -1917,7 +1919,7 @@ byte_array_new_take (void)
1234 GByteArray *gbarray;
1235 guint8 *data;
1236
1237- data = g_memdup ("woooweeewow", 11);
1238+ data = g_memdup2 ("woooweeewow", 11);
1239 gbarray = g_byte_array_new_take (data, 11);
1240 g_assert (gbarray->data == data);
1241 g_assert_cmpuint (gbarray->len, ==, 11);
1242diff --git a/glib/tests/io-channel.c b/glib/tests/io-channel.c
1243index ff53fcef7..4a1b10876 100644
1244--- a/glib/tests/io-channel.c
1245+++ b/glib/tests/io-channel.c
1246@@ -49,8 +49,10 @@ test_read_line_embedded_nuls (void)
1247 channel = g_io_channel_new_file (filename, "r", &local_error);
1248 g_assert_no_error (local_error);
1249
1250- /* Only break on newline characters, not nuls. */
1251- g_io_channel_set_line_term (channel, "\n", 1);
1252+ /* Only break on newline characters, not nuls.
1253+ * Use length -1 here to exercise glib#2323; the case where length > 0
1254+ * is covered in glib/tests/protocol.c. */
1255+ g_io_channel_set_line_term (channel, "\n", -1);
1256 g_io_channel_set_encoding (channel, NULL, &local_error);
1257 g_assert_no_error (local_error);
1258
1259diff --git a/glib/tests/option-context.c b/glib/tests/option-context.c
1260index 149d22353..88d2b80d1 100644
1261--- a/glib/tests/option-context.c
1262+++ b/glib/tests/option-context.c
1263@@ -27,6 +27,8 @@
1264 #include <string.h>
1265 #include <locale.h>
1266
1267+#include "gstrfuncsprivate.h"
1268+
1269 static GOptionEntry main_entries[] = {
1270 { "main-switch", 0, 0,
1271 G_OPTION_ARG_NONE, NULL,
1272@@ -256,7 +258,7 @@ join_stringv (int argc, char **argv)
1273 static char **
1274 copy_stringv (char **argv, int argc)
1275 {
1276- return g_memdup (argv, sizeof (char *) * (argc + 1));
1277+ return g_memdup2 (argv, sizeof (char *) * (argc + 1));
1278 }
1279
1280 static void
1281@@ -2323,7 +2325,7 @@ test_group_parse (void)
1282 g_option_context_add_group (context, group);
1283
1284 argv = split_string ("program --test arg1 -f arg2 --group-test arg3 --frob arg4 -z arg5", &argc);
1285- orig_argv = g_memdup (argv, (argc + 1) * sizeof (char *));
1286+ orig_argv = g_memdup2 (argv, (argc + 1) * sizeof (char *));
1287
1288 retval = g_option_context_parse (context, &argc, &argv, &error);
1289
1290diff --git a/glib/tests/strfuncs.c b/glib/tests/strfuncs.c
1291index e1f9619c7..d968afff9 100644
1292--- a/glib/tests/strfuncs.c
1293+++ b/glib/tests/strfuncs.c
1294@@ -32,6 +32,8 @@
1295 #include <string.h>
1296 #include "glib.h"
1297
1298+#include "gstrfuncsprivate.h"
1299+
1300 #if defined (_MSC_VER) && (_MSC_VER <= 1800)
1301 #define isnan(x) _isnan(x)
1302
1303@@ -219,6 +221,26 @@ test_memdup (void)
1304 g_free (str_dup);
1305 }
1306
1307+/* Testing g_memdup2() function with various positive and negative cases */
1308+static void
1309+test_memdup2 (void)
1310+{
1311+ gchar *str_dup = NULL;
1312+ const gchar *str = "The quick brown fox jumps over the lazy dog";
1313+
1314+ /* Testing negative cases */
1315+ g_assert_null (g_memdup2 (NULL, 1024));
1316+ g_assert_null (g_memdup2 (str, 0));
1317+ g_assert_null (g_memdup2 (NULL, 0));
1318+
1319+ /* Testing normal usage cases */
1320+ str_dup = g_memdup2 (str, strlen (str) + 1);
1321+ g_assert_nonnull (str_dup);
1322+ g_assert_cmpstr (str, ==, str_dup);
1323+
1324+ g_free (str_dup);
1325+}
1326+
1327 /* Testing g_strpcpy() function with various positive and negative cases */
1328 static void
1329 test_stpcpy (void)
1330@@ -2523,6 +2545,7 @@ main (int argc,
1331 g_test_add_func ("/strfuncs/has-prefix", test_has_prefix);
1332 g_test_add_func ("/strfuncs/has-suffix", test_has_suffix);
1333 g_test_add_func ("/strfuncs/memdup", test_memdup);
1334+ g_test_add_func ("/strfuncs/memdup2", test_memdup2);
1335 g_test_add_func ("/strfuncs/stpcpy", test_stpcpy);
1336 g_test_add_func ("/strfuncs/str_match_string", test_str_match_string);
1337 g_test_add_func ("/strfuncs/str_tokenize_and_fold", test_str_tokenize_and_fold);
1338diff --git a/gobject/gsignal.c b/gobject/gsignal.c
1339index 45effa92d..effbfec62 100644
1340--- a/gobject/gsignal.c
1341+++ b/gobject/gsignal.c
1342@@ -28,6 +28,7 @@
1343 #include <signal.h>
1344
1345 #include "gsignal.h"
1346+#include "gstrfuncsprivate.h"
1347 #include "gtype-private.h"
1348 #include "gbsearcharray.h"
1349 #include "gvaluecollector.h"
1350@@ -1809,7 +1810,7 @@ g_signal_newv (const gchar *signal_name,
1351 node->single_va_closure_is_valid = FALSE;
1352 node->flags = signal_flags & G_SIGNAL_FLAGS_MASK;
1353 node->n_params = n_params;
1354- node->param_types = g_memdup (param_types, sizeof (GType) * n_params);
1355+ node->param_types = g_memdup2 (param_types, sizeof (GType) * n_params);
1356 node->return_type = return_type;
1357 node->class_closure_bsa = NULL;
1358 if (accumulator)
1359diff --git a/gobject/gtype.c b/gobject/gtype.c
1360index b5ef2d11e..8d152dccc 100644
1361--- a/gobject/gtype.c
1362+++ b/gobject/gtype.c
1363@@ -33,6 +33,7 @@
1364
1365 #include "glib-private.h"
1366 #include "gconstructor.h"
1367+#include "gstrfuncsprivate.h"
1368
1369 #ifdef G_OS_WIN32
1370 #include <windows.h>
1371@@ -1470,7 +1471,7 @@ type_add_interface_Wm (TypeNode *node,
1372 iholder->next = iface_node_get_holders_L (iface);
1373 iface_node_set_holders_W (iface, iholder);
1374 iholder->instance_type = NODE_TYPE (node);
1375- iholder->info = info ? g_memdup (info, sizeof (*info)) : NULL;
1376+ iholder->info = info ? g_memdup2 (info, sizeof (*info)) : NULL;
1377 iholder->plugin = plugin;
1378
1379 /* create an iface entry for this type */
1380@@ -1731,7 +1732,7 @@ type_iface_retrieve_holder_info_Wm (TypeNode *iface,
1381 INVALID_RECURSION ("g_type_plugin_*", iholder->plugin, NODE_NAME (iface));
1382
1383 check_interface_info_I (iface, instance_type, &tmp_info);
1384- iholder->info = g_memdup (&tmp_info, sizeof (tmp_info));
1385+ iholder->info = g_memdup2 (&tmp_info, sizeof (tmp_info));
1386 }
1387
1388 return iholder; /* we don't modify write lock upon returning NULL */
1389@@ -2016,10 +2017,10 @@ type_iface_vtable_base_init_Wm (TypeNode *iface,
1390 IFaceEntry *pentry = type_lookup_iface_entry_L (pnode, iface);
1391
1392 if (pentry)
1393- vtable = g_memdup (pentry->vtable, iface->data->iface.vtable_size);
1394+ vtable = g_memdup2 (pentry->vtable, iface->data->iface.vtable_size);
1395 }
1396 if (!vtable)
1397- vtable = g_memdup (iface->data->iface.dflt_vtable, iface->data->iface.vtable_size);
1398+ vtable = g_memdup2 (iface->data->iface.dflt_vtable, iface->data->iface.vtable_size);
1399 entry->vtable = vtable;
1400 vtable->g_type = NODE_TYPE (iface);
1401 vtable->g_instance_type = NODE_TYPE (node);
1402diff --git a/gobject/gtypemodule.c b/gobject/gtypemodule.c
1403index 4ecaf8c88..20911fafd 100644
1404--- a/gobject/gtypemodule.c
1405+++ b/gobject/gtypemodule.c
1406@@ -19,6 +19,7 @@
1407
1408 #include <stdlib.h>
1409
1410+#include "gstrfuncsprivate.h"
1411 #include "gtypeplugin.h"
1412 #include "gtypemodule.h"
1413
1414@@ -436,7 +437,7 @@ g_type_module_register_type (GTypeModule *module,
1415 module_type_info->loaded = TRUE;
1416 module_type_info->info = *type_info;
1417 if (type_info->value_table)
1418- module_type_info->info.value_table = g_memdup (type_info->value_table,
1419+ module_type_info->info.value_table = g_memdup2 (type_info->value_table,
1420 sizeof (GTypeValueTable));
1421
1422 return module_type_info->type;
1423diff --git a/gobject/tests/param.c b/gobject/tests/param.c
1424index 93c3f4b94..0a77e51b7 100644
1425--- a/gobject/tests/param.c
1426+++ b/gobject/tests/param.c
1427@@ -2,6 +2,8 @@
1428 #include <glib-object.h>
1429 #include <stdlib.h>
1430
1431+#include "gstrfuncsprivate.h"
1432+
1433 static void
1434 test_param_value (void)
1435 {
1436@@ -874,7 +876,7 @@ main (int argc, char *argv[])
1437 test_path = g_strdup_printf ("/param/implement/subprocess/%d-%d-%d-%d",
1438 data.change_this_flag, data.change_this_type,
1439 data.use_this_flag, data.use_this_type);
1440- test_data = g_memdup (&data, sizeof (TestParamImplementData));
1441+ test_data = g_memdup2 (&data, sizeof (TestParamImplementData));
1442 g_test_add_data_func_full (test_path, test_data, test_param_implement_child, g_free);
1443 g_free (test_path);
1444 }
diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.64.5.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.64.5.bb
index a30c5215be..ed7b649dc6 100644
--- a/meta/recipes-core/glib-2.0/glib-2.0_2.64.5.bb
+++ b/meta/recipes-core/glib-2.0/glib-2.0_2.64.5.bb
@@ -17,6 +17,8 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
17 file://0001-meson-Run-atomics-test-on-clang-as-well.patch \ 17 file://0001-meson-Run-atomics-test-on-clang-as-well.patch \
18 file://0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch \ 18 file://0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch \
19 file://tzdata-update.patch \ 19 file://tzdata-update.patch \
20 file://CVE-2020-35457.patch \
21 file://CVE-2021-27219.patch \
20 " 22 "
21 23
22SRC_URI_append_class-native = " file://relocate-modules.patch" 24SRC_URI_append_class-native = " file://relocate-modules.patch"
diff --git a/meta/recipes-core/glib-2.0/glib.inc b/meta/recipes-core/glib-2.0/glib.inc
index a0055d81b0..71777bc459 100644
--- a/meta/recipes-core/glib-2.0/glib.inc
+++ b/meta/recipes-core/glib-2.0/glib.inc
@@ -34,10 +34,6 @@ DEPENDS_append_class-target = "${@' gtk-doc' if d.getVar('GTKDOC_ENABLED') == 'T
34 34
35GTKDOC_MESON_OPTION = "gtk_doc" 35GTKDOC_MESON_OPTION = "gtk_doc"
36 36
37# This avoids the need to depend on target python3, which in case of mingw is not even possible.
38# meson's python configuration pokes into python3 configuration, so this provides the native config to it.
39unset _PYTHON_SYSCONFIGDATA_NAME
40
41S = "${WORKDIR}/glib-${PV}" 37S = "${WORKDIR}/glib-${PV}"
42 38
43PACKAGECONFIG ??= "system-pcre libmount \ 39PACKAGECONFIG ??= "system-pcre libmount \
@@ -170,7 +166,7 @@ RDEPENDS_${PN}-ptest += "\
170 ${PN}-locale-th \ 166 ${PN}-locale-th \
171 python3-core \ 167 python3-core \
172 python3-modules \ 168 python3-modules \
173 python3-dbusmock \ 169 ${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'python3-dbusmock', '', d)} \
174 ${PN}-codegen \ 170 ${PN}-codegen \
175 " 171 "
176 172
diff --git a/meta/recipes-core/glibc/glibc-version.inc b/meta/recipes-core/glibc/glibc-version.inc
index 1566056297..84d199bb1d 100644
--- a/meta/recipes-core/glibc/glibc-version.inc
+++ b/meta/recipes-core/glibc/glibc-version.inc
@@ -1,6 +1,6 @@
1SRCBRANCH ?= "release/2.32/master" 1SRCBRANCH ?= "release/2.32/master"
2PV = "2.32" 2PV = "2.32"
3SRCREV_glibc ?= "3de512be7ea6053255afed6154db9ee31d4e557a" 3SRCREV_glibc ?= "44b395932961a29825da4ad025124a6760858d9c"
4SRCREV_localedef ?= "bd644c9e6f3e20c5504da1488448173c69c56c28" 4SRCREV_localedef ?= "bd644c9e6f3e20c5504da1488448173c69c56c28"
5 5
6GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git" 6GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
diff --git a/meta/recipes-core/glibc/glibc/0031-linux-Allow-adjtime-with-NULL-argument-BZ-26833.patch b/meta/recipes-core/glibc/glibc/0031-linux-Allow-adjtime-with-NULL-argument-BZ-26833.patch
new file mode 100644
index 0000000000..a458a2a223
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0031-linux-Allow-adjtime-with-NULL-argument-BZ-26833.patch
@@ -0,0 +1,110 @@
1From 75a193b7611bade31a150dfcc528b973e3d46231 Mon Sep 17 00:00:00 2001
2From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3Date: Mon, 2 Nov 2020 16:18:29 -0300
4Subject: [PATCH] linux: Allow adjtime with NULL argument [BZ #26833]
5
6The adjtime interface allows return the amount of time remaining
7from any previous adjustment that has not yet been completed by
8passing a NULL as first argument. This was introduced with y2038
9support 0308077e3a.
10
11Checked on i686-linux-gnu.
12
13Reviewed-by: Lukasz Majewski <lukma@denx.de>
14Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=75a193b7611bade31a150dfcc528b973e3d46231]
15Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
16---
17 sysdeps/unix/sysv/linux/adjtime.c | 11 +++++---
18 time/Makefile | 3 ++-
19 time/tst-adjtime.c | 44 +++++++++++++++++++++++++++++++
20 3 files changed, 54 insertions(+), 4 deletions(-)
21 create mode 100644 time/tst-adjtime.c
22
23diff --git a/sysdeps/unix/sysv/linux/adjtime.c b/sysdeps/unix/sysv/linux/adjtime.c
24index 3f9a4ea2eb..6d1d1b6af2 100644
25--- a/sysdeps/unix/sysv/linux/adjtime.c
26+++ b/sysdeps/unix/sysv/linux/adjtime.c
27@@ -68,11 +68,16 @@ libc_hidden_def (__adjtime64)
28 int
29 __adjtime (const struct timeval *itv, struct timeval *otv)
30 {
31- struct __timeval64 itv64, otv64;
32+ struct __timeval64 itv64, *pitv64 = NULL;
33+ struct __timeval64 otv64;
34 int retval;
35
36- itv64 = valid_timeval_to_timeval64 (*itv);
37- retval = __adjtime64 (&itv64, otv != NULL ? &otv64 : NULL);
38+ if (itv != NULL)
39+ {
40+ itv64 = valid_timeval_to_timeval64 (*itv);
41+ pitv64 = &itv64;
42+ }
43+ retval = __adjtime64 (pitv64, otv != NULL ? &otv64 : NULL);
44 if (otv != NULL)
45 *otv = valid_timeval64_to_timeval (otv64);
46
47diff --git a/time/Makefile b/time/Makefile
48index 26aa835166..f27a75a115 100644
49--- a/time/Makefile
50+++ b/time/Makefile
51@@ -47,7 +47,8 @@ tests := test_time clocktest tst-posixtz tst-strptime tst_wcsftime \
52 tst-mktime3 tst-strptime2 bug-asctime bug-asctime_r bug-mktime1 \
53 tst-strptime3 bug-getdate1 tst-strptime-whitespace tst-ftime \
54 tst-tzname tst-y2039 bug-mktime4 tst-strftime2 tst-strftime3 \
55- tst-clock tst-clock2 tst-clock_nanosleep tst-cpuclock1
56+ tst-clock tst-clock2 tst-clock_nanosleep tst-cpuclock1 \
57+ tst-adjtime
58
59 include ../Rules
60
61diff --git a/time/tst-adjtime.c b/time/tst-adjtime.c
62new file mode 100644
63index 0000000000..ae2b37cdab
64--- /dev/null
65+++ b/time/tst-adjtime.c
66@@ -0,0 +1,44 @@
67+/* Basic tests for adjtime.
68+ Copyright (C) 2020 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 <sys/time.h>
86+#include <stdlib.h>
87+
88+#include <errno.h>
89+#include <support/check.h>
90+
91+
92+static int
93+do_test (void)
94+{
95+ /* Check if the interface allows getting the amount of time remaining
96+ from any previous adjustment that has not yet been completed. This
97+ is a non-privileged function of adjtime. */
98+ struct timeval tv;
99+ int r = adjtime (NULL, &tv);
100+ if (r == -1)
101+ {
102+ if (errno == ENOSYS)
103+ FAIL_UNSUPPORTED ("adjtime unsupported");
104+ FAIL_EXIT1 ("adjtime (NULL, ...) failed: %m");
105+ }
106+
107+ return 0;
108+}
109+
110+#include <support/test-driver.c>
diff --git a/meta/recipes-core/glibc/glibc/CVE-2020-29562.patch b/meta/recipes-core/glibc/glibc/CVE-2020-29562.patch
new file mode 100644
index 0000000000..134b4e3613
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/CVE-2020-29562.patch
@@ -0,0 +1,155 @@
1From 228edd356f03bf62dcf2b1335f25d43c602ee68d Mon Sep 17 00:00:00 2001
2From: Michael Colavita <mcolavita@fb.com>
3Date: Thu, 19 Nov 2020 11:44:40 -0500
4Subject: [PATCH] iconv: Fix incorrect UCS4 inner loop bounds (BZ#26923)
5
6Previously, in UCS4 conversion routines we limit the number of
7characters we examine to the minimum of the number of characters in the
8input and the number of characters in the output. This is not the
9correct behavior when __GCONV_IGNORE_ERRORS is set, as we do not consume
10an output character when we skip a code unit. Instead, track the input
11and output pointers and terminate the loop when either reaches its
12limit.
13
14This resolves assertion failures when resetting the input buffer in a step of
15iconv, which assumes that the input will be fully consumed given sufficient
16output space.
17
18Upstream-Status: Backport [git://sourceware.org/git/glibc.git]
19CVE: CVE-2020-29562
20Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
21---
22 iconv/Makefile | 2 +-
23 iconv/gconv_simple.c | 16 ++++----------
24 iconv/tst-iconv8.c | 50 ++++++++++++++++++++++++++++++++++++++++++++
25 3 files changed, 55 insertions(+), 13 deletions(-)
26 create mode 100644 iconv/tst-iconv8.c
27
28diff --git a/iconv/Makefile b/iconv/Makefile
29index 30bf996d3a..f9b51e23ec 100644
30--- a/iconv/Makefile
31+++ b/iconv/Makefile
32@@ -44,7 +44,7 @@ CFLAGS-linereader.c += -DNO_TRANSLITERATION
33 CFLAGS-simple-hash.c += -I../locale
34
35 tests = tst-iconv1 tst-iconv2 tst-iconv3 tst-iconv4 tst-iconv5 tst-iconv6 \
36- tst-iconv7 tst-iconv-mt tst-iconv-opt
37+ tst-iconv7 tst-iconv8 tst-iconv-mt tst-iconv-opt
38
39 others = iconv_prog iconvconfig
40 install-others-programs = $(inst_bindir)/iconv
41diff --git a/iconv/gconv_simple.c b/iconv/gconv_simple.c
42index d4797fba17..963b29f246 100644
43--- a/iconv/gconv_simple.c
44+++ b/iconv/gconv_simple.c
45@@ -239,11 +239,9 @@ ucs4_internal_loop (struct __gconv_step *step,
46 int flags = step_data->__flags;
47 const unsigned char *inptr = *inptrp;
48 unsigned char *outptr = *outptrp;
49- size_t n_convert = MIN (inend - inptr, outend - outptr) / 4;
50 int result;
51- size_t cnt;
52
53- for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4)
54+ for (; inptr + 4 <= inend && outptr + 4 <= outend; inptr += 4)
55 {
56 uint32_t inval;
57
58@@ -307,11 +305,9 @@ ucs4_internal_loop_unaligned (struct __gconv_step *step,
59 int flags = step_data->__flags;
60 const unsigned char *inptr = *inptrp;
61 unsigned char *outptr = *outptrp;
62- size_t n_convert = MIN (inend - inptr, outend - outptr) / 4;
63 int result;
64- size_t cnt;
65
66- for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4)
67+ for (; inptr + 4 <= inend && outptr + 4 <= outend; inptr += 4)
68 {
69 if (__glibc_unlikely (inptr[0] > 0x80))
70 {
71@@ -613,11 +609,9 @@ ucs4le_internal_loop (struct __gconv_step *step,
72 int flags = step_data->__flags;
73 const unsigned char *inptr = *inptrp;
74 unsigned char *outptr = *outptrp;
75- size_t n_convert = MIN (inend - inptr, outend - outptr) / 4;
76 int result;
77- size_t cnt;
78
79- for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4)
80+ for (; inptr + 4 <= inend && outptr + 4 <= outend; inptr += 4)
81 {
82 uint32_t inval;
83
84@@ -684,11 +678,9 @@ ucs4le_internal_loop_unaligned (struct __gconv_step *step,
85 int flags = step_data->__flags;
86 const unsigned char *inptr = *inptrp;
87 unsigned char *outptr = *outptrp;
88- size_t n_convert = MIN (inend - inptr, outend - outptr) / 4;
89 int result;
90- size_t cnt;
91
92- for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4)
93+ for (; inptr + 4 <= inend && outptr + 4 <= outend; inptr += 4)
94 {
95 if (__glibc_unlikely (inptr[3] > 0x80))
96 {
97diff --git a/iconv/tst-iconv8.c b/iconv/tst-iconv8.c
98new file mode 100644
99index 0000000000..0b92b19f66
100--- /dev/null
101+++ b/iconv/tst-iconv8.c
102@@ -0,0 +1,50 @@
103+/* Test iconv behavior on UCS4 conversions with //IGNORE.
104+ Copyright (C) 2020 Free Software Foundation, Inc.
105+ This file is part of the GNU C Library.
106+
107+ The GNU C Library is free software; you can redistribute it and/or
108+ modify it under the terms of the GNU Lesser General Public
109+ License as published by the Free Software Foundation; either
110+ version 2.1 of the License, or (at your option) any later version.
111+
112+ The GNU C Library is distributed in the hope that it will be useful,
113+ but WITHOUT ANY WARRANTY; without even the implied warranty of
114+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
115+ Lesser General Public License for more details.
116+
117+ You should have received a copy of the GNU Lesser General Public
118+ License along with the GNU C Library; if not, see
119+ <http://www.gnu.org/licenses/>. */
120+
121+/* Derived from BZ #26923 */
122+#include <errno.h>
123+#include <iconv.h>
124+#include <stdio.h>
125+#include <support/check.h>
126+
127+static int
128+do_test (void)
129+{
130+ iconv_t cd = iconv_open ("UTF-8//IGNORE", "ISO-10646/UCS4/");
131+ TEST_VERIFY_EXIT (cd != (iconv_t) -1);
132+
133+ /*
134+ * Convert sequence beginning with an irreversible character into buffer that
135+ * is too small.
136+ */
137+ char input[12] = "\xe1\x80\xa1" "AAAAAAAAA";
138+ char *inptr = input;
139+ size_t insize = sizeof (input);
140+ char output[6];
141+ char *outptr = output;
142+ size_t outsize = sizeof (output);
143+
144+ TEST_VERIFY (iconv (cd, &inptr, &insize, &outptr, &outsize) == -1);
145+ TEST_VERIFY (errno == E2BIG);
146+
147+ TEST_VERIFY_EXIT (iconv_close (cd) != -1);
148+
149+ return 0;
150+}
151+
152+#include <support/test-driver.c>
153--
1542.17.0
155
diff --git a/meta/recipes-core/glibc/glibc/CVE-2020-29573.patch b/meta/recipes-core/glibc/glibc/CVE-2020-29573.patch
new file mode 100644
index 0000000000..0f54d72cad
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/CVE-2020-29573.patch
@@ -0,0 +1,56 @@
1From 681900d29683722b1cb0a8e565a0585846ec5a61 Mon Sep 17 00:00:00 2001
2From: Florian Weimer <fweimer@redhat.com>
3Date: Tue, 22 Sep 2020 19:07:48 +0200
4Subject: [PATCH] x86: Harden printf against non-normal long double values (bug
5 26649)
6
7The behavior of isnan/__builtin_isnan on bit patterns that do not
8correspond to something that the CPU would produce from valid inputs
9is currently under-defined in the toolchain. (The GCC built-in and
10glibc disagree.)
11
12The isnan check in PRINTF_FP_FETCH in stdio-common/printf_fp.c
13assumes the GCC behavior that returns true for non-normal numbers
14which are not specified as NaN. (The glibc implementation returns
15false for such numbers.)
16
17At present, passing non-normal numbers to __mpn_extract_long_double
18causes this function to produce irregularly shaped multi-precision
19integers, triggering undefined behavior in __printf_fp_l.
20
21With GCC 10 and glibc 2.32, this behavior is not visible because
22__builtin_isnan is used, which avoids calling
23__mpn_extract_long_double in this case. This commit updates the
24implementation of __mpn_extract_long_double so that regularly shaped
25multi-precision integers are produced in this case, avoiding
26undefined behavior in __printf_fp_l.
27
28Upstream-Status: Backport [git://sourceware.org/git/glibc.git]
29CVE: CVE-2020-29573
30Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
31---
32 sysdeps/i386/ldbl2mpn.c | 8 ++++
33 1 files changed, 8 insertions(+)
34
35diff --git a/sysdeps/i386/ldbl2mpn.c b/sysdeps/i386/ldbl2mpn.c
36index ec8464eef7..23afedfb67 100644
37--- a/sysdeps/i386/ldbl2mpn.c
38+++ b/sysdeps/i386/ldbl2mpn.c
39@@ -115,6 +115,14 @@ __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size,
40 && res_ptr[N - 1] == 0)
41 /* Pseudo zero. */
42 *expt = 0;
43+ else
44+ /* Unlike other floating point formats, the most significant bit
45+ is explicit and expected to be set for normal numbers. Set it
46+ in case it is cleared in the input. Otherwise, callers will
47+ not be able to produce the expected multi-precision integer
48+ layout by shifting. */
49+ res_ptr[N - 1] |= (mp_limb_t) 1 << (LDBL_MANT_DIG - 1
50+ - ((N - 1) * BITS_PER_MP_LIMB));
51
52 return N;
53 }
54--
552.17.0
56
diff --git a/meta/recipes-core/glibc/glibc_2.32.bb b/meta/recipes-core/glibc/glibc_2.32.bb
index 2a0e464385..03aea52508 100644
--- a/meta/recipes-core/glibc/glibc_2.32.bb
+++ b/meta/recipes-core/glibc/glibc_2.32.bb
@@ -1,7 +1,8 @@
1require glibc.inc 1require glibc.inc
2require glibc-version.inc 2require glibc-version.inc
3 3
4CVE_CHECK_WHITELIST += "CVE-2020-10029" 4# whitelist CVE's with fixes in latest release/2.32/master branch
5CVE_CHECK_WHITELIST += "CVE-2019-25013 CVE-2020-10029 CVE-2020-27618 CVE-2021-27645 CVE-2021-3326"
5 6
6DEPENDS += "gperf-native bison-native make-native" 7DEPENDS += "gperf-native bison-native make-native"
7 8
@@ -43,6 +44,9 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
43 file://0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \ 44 file://0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \
44 file://0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch \ 45 file://0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch \
45 file://0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch \ 46 file://0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch \
47 file://0031-linux-Allow-adjtime-with-NULL-argument-BZ-26833.patch \
48 file://CVE-2020-29562.patch \
49 file://CVE-2020-29573.patch \
46 " 50 "
47S = "${WORKDIR}/git" 51S = "${WORKDIR}/git"
48B = "${WORKDIR}/build-${TARGET_SYS}" 52B = "${WORKDIR}/build-${TARGET_SYS}"
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 8390b8389d..9e944a2534 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
@@ -22,10 +22,10 @@ APPEND += "rootfstype=ext4 quiet"
22DEPENDS = "zip-native python3-pip-native" 22DEPENDS = "zip-native python3-pip-native"
23IMAGE_FSTYPES = "wic.vmdk" 23IMAGE_FSTYPES = "wic.vmdk"
24 24
25inherit core-image module-base setuptools3 25inherit core-image setuptools3
26 26
27SRCREV ?= "1dfd37d30953208fd998cef79483f371330a754e" 27SRCREV ?= "79c4792da2b400431c09d9a2f53efd4443812281"
28SRC_URI = "git://git.yoctoproject.org/poky \ 28SRC_URI = "git://git.yoctoproject.org/poky;branch=gatesgarth \
29 file://Yocto_Build_Appliance.vmx \ 29 file://Yocto_Build_Appliance.vmx \
30 file://Yocto_Build_Appliance.vmxf \ 30 file://Yocto_Build_Appliance.vmxf \
31 file://README_VirtualBox_Guest_Additions.txt \ 31 file://README_VirtualBox_Guest_Additions.txt \
@@ -61,12 +61,6 @@ fakeroot do_populate_poky_src () {
61 # Place the README_VirtualBox_Toaster file in builders home folder. 61 # Place the README_VirtualBox_Toaster file in builders home folder.
62 cp ${WORKDIR}/README_VirtualBox_Toaster.txt ${IMAGE_ROOTFS}/home/builder/ 62 cp ${WORKDIR}/README_VirtualBox_Toaster.txt ${IMAGE_ROOTFS}/home/builder/
63 63
64 # Create a symlink, needed for out-of-tree kernel modules build
65 if [ ! -e ${IMAGE_ROOTFS}/lib/modules/${KERNEL_VERSION}/build ]; then
66 rm -f ${IMAGE_ROOTFS}/lib/modules/${KERNEL_VERSION}/build
67 lnr ${IMAGE_ROOTFS}${KERNEL_SRC_PATH} ${IMAGE_ROOTFS}/lib/modules/${KERNEL_VERSION}/build
68 fi
69
70 echo "INHERIT += \"rm_work\"" >> ${IMAGE_ROOTFS}/home/builder/poky/build/conf/auto.conf 64 echo "INHERIT += \"rm_work\"" >> ${IMAGE_ROOTFS}/home/builder/poky/build/conf/auto.conf
71 echo "export LC_ALL=en_US.utf8" >> ${IMAGE_ROOTFS}/home/builder/.bashrc 65 echo "export LC_ALL=en_US.utf8" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
72 66
diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
index b6855b5aac..f667518b89 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -279,6 +279,11 @@ fi
279 279
280umount /tgt_root 280umount /tgt_root
281 281
282# copy any extra files needed for ESP
283if [ -d /run/media/$1/esp ]; then
284 cp -r /run/media/$1/esp/* /boot
285fi
286
282# Copy kernel artifacts. To add more artifacts just add to types 287# Copy kernel artifacts. To add more artifacts just add to types
283# For now just support kernel types already being used by something in OE-core 288# For now just support kernel types already being used by something in OE-core
284for types in bzImage zImage vmlinux vmlinuz fitImage; do 289for types in bzImage zImage vmlinux vmlinuz fitImage; do
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
index 02f0351fcb..a63e71b780 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
@@ -74,7 +74,7 @@ test "$VERBOSE" != no && echo "Activating swap"
74# 74#
75# Check the root filesystem. 75# Check the root filesystem.
76# 76#
77if test -f /fastboot || test $rootcheck = no 77if test -f /fastboot || test "$rootcheck" = "no"
78then 78then
79 test $rootcheck = yes && echo "Fast boot, no filesystem check" 79 test $rootcheck = yes && echo "Fast boot, no filesystem check"
80else 80else
diff --git a/meta/recipes-core/meta/buildtools-extended-tarball.bb b/meta/recipes-core/meta/buildtools-extended-tarball.bb
index c32d0107c3..83e3fddccc 100644
--- a/meta/recipes-core/meta/buildtools-extended-tarball.bb
+++ b/meta/recipes-core/meta/buildtools-extended-tarball.bb
@@ -28,8 +28,21 @@ TOOLCHAIN_HOST_TASK += "\
28 nativesdk-libtool \ 28 nativesdk-libtool \
29 nativesdk-pkgconfig \ 29 nativesdk-pkgconfig \
30 nativesdk-glibc-utils \ 30 nativesdk-glibc-utils \
31 nativesdk-glibc-gconv-ibm850 \
32 nativesdk-glibc-gconv-iso8859-1 \
33 nativesdk-glibc-gconv-utf-16 \
34 nativesdk-glibc-gconv-cp1250 \
35 nativesdk-glibc-gconv-cp1251 \
36 nativesdk-glibc-gconv-cp1252 \
37 nativesdk-glibc-gconv-euc-jp \
38 nativesdk-glibc-gconv-libjis \
31 nativesdk-libxcrypt-dev \ 39 nativesdk-libxcrypt-dev \
40 nativesdk-parted \
41 nativesdk-dosfstools \
42 nativesdk-gptfdisk \
32 " 43 "
44# gconv-cp1250, cp1251 and euc-jp needed for iconv to work in vim builds
45# also copied list from uninative
33 46
34TOOLCHAIN_OUTPUTNAME = "${SDK_ARCH}-buildtools-extended-nativesdk-standalone-${DISTRO_VERSION}" 47TOOLCHAIN_OUTPUTNAME = "${SDK_ARCH}-buildtools-extended-nativesdk-standalone-${DISTRO_VERSION}"
35 48
diff --git a/meta/recipes-core/meta/cve-update-db-native.bb b/meta/recipes-core/meta/cve-update-db-native.bb
index cf2b251e21..b073936298 100644
--- a/meta/recipes-core/meta/cve-update-db-native.bb
+++ b/meta/recipes-core/meta/cve-update-db-native.bb
@@ -138,14 +138,24 @@ def parse_node_and_insert(c, node, cveId):
138 for cpe in node.get('cpe_match', ()): 138 for cpe in node.get('cpe_match', ()):
139 if not cpe['vulnerable']: 139 if not cpe['vulnerable']:
140 return 140 return
141 cpe23 = cpe['cpe23Uri'].split(':') 141 cpe23 = cpe.get('cpe23Uri')
142 if not cpe23:
143 return
144 cpe23 = cpe23.split(':')
145 if len(cpe23) < 6:
146 return
142 vendor = cpe23[3] 147 vendor = cpe23[3]
143 product = cpe23[4] 148 product = cpe23[4]
144 version = cpe23[5] 149 version = cpe23[5]
145 150
151 if cpe23[6] == '*' or cpe23[6] == '-':
152 version_suffix = ""
153 else:
154 version_suffix = "_" + cpe23[6]
155
146 if version != '*' and version != '-': 156 if version != '*' and version != '-':
147 # Version is defined, this is a '=' match 157 # Version is defined, this is a '=' match
148 yield [cveId, vendor, product, version, '=', '', ''] 158 yield [cveId, vendor, product, version + version_suffix, '=', '', '']
149 elif version == '-': 159 elif version == '-':
150 # no version information is available 160 # no version information is available
151 yield [cveId, vendor, product, version, '', '', ''] 161 yield [cveId, vendor, product, version, '', '', '']
@@ -172,7 +182,12 @@ def parse_node_and_insert(c, node, cveId):
172 op_end = '<' 182 op_end = '<'
173 v_end = cpe['versionEndExcluding'] 183 v_end = cpe['versionEndExcluding']
174 184
175 yield [cveId, vendor, product, v_start, op_start, v_end, op_end] 185 if op_start or op_end or v_start or v_end:
186 yield [cveId, vendor, product, v_start, op_start, v_end, op_end]
187 else:
188 # This is no version information, expressed differently.
189 # Save processing by representing as -.
190 yield [cveId, vendor, product, '-', '', '', '']
176 191
177 c.executemany("insert into PRODUCTS values (?, ?, ?, ?, ?, ?, ?)", cpe_generator()) 192 c.executemany("insert into PRODUCTS values (?, ?, ?, ?, ?, ?, ?)", cpe_generator())
178 193
diff --git a/meta/recipes-core/ncurses/ncurses.inc b/meta/recipes-core/ncurses/ncurses.inc
index 4b61889668..ef59bc3b0a 100644
--- a/meta/recipes-core/ncurses/ncurses.inc
+++ b/meta/recipes-core/ncurses/ncurses.inc
@@ -312,7 +312,7 @@ FILES_${PN}-tools = "\
312" 312"
313 313
314# 'reset' is a symlink to 'tset' which is in the 'ncurses' package 314# 'reset' is a symlink to 'tset' which is in the 'ncurses' package
315RDEPENDS_${PN}-tools = "${PN}" 315RDEPENDS_${PN}-tools = "${PN} ${PN}-terminfo-base"
316 316
317FILES_${PN}-terminfo = "\ 317FILES_${PN}-terminfo = "\
318 ${datadir}/terminfo \ 318 ${datadir}/terminfo \
@@ -324,3 +324,8 @@ FILES_${PN}-terminfo-base = "\
324 324
325RSUGGESTS_${PN}-libtinfo = "${PN}-terminfo" 325RSUGGESTS_${PN}-libtinfo = "${PN}-terminfo"
326RRECOMMENDS_${PN}-libtinfo = "${PN}-terminfo-base" 326RRECOMMENDS_${PN}-libtinfo = "${PN}-terminfo-base"
327
328# Putting terminfo into the sysroot adds around 2800 files to
329# each recipe specific sysroot. We can live without this, particularly
330# as many recipes may have native and target copies.
331SYSROOT_DIRS_remove = "${datadir}"
diff --git a/meta/recipes-core/ovmf/ovmf-shell-image.bb b/meta/recipes-core/ovmf/ovmf-shell-image.bb
index 0d2b8bf52f..fd4fb5b732 100644
--- a/meta/recipes-core/ovmf/ovmf-shell-image.bb
+++ b/meta/recipes-core/ovmf/ovmf-shell-image.bb
@@ -1,4 +1,5 @@
1DESCRIPTION = "boot image with UEFI shell and tools" 1DESCRIPTION = "boot image with UEFI shell and tools"
2COMPATIBLE_HOST_class-target='(i.86|x86_64).*'
2 3
3# For this image recipe, only the wic format with a 4# For this image recipe, only the wic format with a
4# single vfat partition makes sense. Because we have no 5# single vfat partition makes sense. Because we have no
diff --git a/meta/recipes-core/systemd/systemd-boot_246.2.bb b/meta/recipes-core/systemd/systemd-boot_246.9.bb
index f92c639810..f92c639810 100644
--- a/meta/recipes-core/systemd/systemd-boot_246.2.bb
+++ b/meta/recipes-core/systemd/systemd-boot_246.9.bb
diff --git a/meta/recipes-core/systemd/systemd-conf/wired.network b/meta/recipes-core/systemd/systemd-conf/wired.network
index dcf3534596..06d00ea1ba 100644
--- a/meta/recipes-core/systemd/systemd-conf/wired.network
+++ b/meta/recipes-core/systemd/systemd-conf/wired.network
@@ -1,6 +1,7 @@
1[Match] 1[Match]
2Name=en* eth* 2Name=en* eth*
3KernelCommandLine=!nfsroot 3KernelCommandLine=!nfsroot
4KernelCommandLine=!ip
4 5
5[Network] 6[Network]
6DHCP=yes 7DHCP=yes
diff --git a/meta/recipes-core/systemd/systemd-conf_246.1.bb b/meta/recipes-core/systemd/systemd-conf_246.9.bb
index d9ec023bfd..9b797a91f4 100644
--- a/meta/recipes-core/systemd/systemd-conf_246.1.bb
+++ b/meta/recipes-core/systemd/systemd-conf_246.9.bb
@@ -23,9 +23,6 @@ do_install() {
23# Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52 23# Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52
24do_install_append_qemuall() { 24do_install_append_qemuall() {
25 install -D -m0644 ${WORKDIR}/system.conf-qemuall ${D}${systemd_unitdir}/system.conf.d/01-${PN}.conf 25 install -D -m0644 ${WORKDIR}/system.conf-qemuall ${D}${systemd_unitdir}/system.conf.d/01-${PN}.conf
26
27 # Do not install wired.network for qemu bsps
28 rm -rf ${D}${systemd_unitdir}/network
29} 26}
30 27
31PACKAGE_ARCH = "${MACHINE_ARCH}" 28PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/meta/recipes-core/systemd/systemd.inc b/meta/recipes-core/systemd/systemd.inc
index 1733565fc0..b0f8a72bbe 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 = "2ee1c57c4ff4fd3349cf03c2e89fbd18ca0b3a4a" 17SRCREV = "90f7f6c5777e9e2a4990f299474f730459054bf4"
18SRCBRANCH = "v246-stable" 18SRCBRANCH = "v246-stable"
19SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=git;branch=${SRCBRANCH}" 19SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=git;branch=${SRCBRANCH}"
20 20
diff --git a/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch
index 2676c144f2..643b9547b7 100644
--- a/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch
+++ b/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch
@@ -1,4 +1,4 @@
1From 564830719be2017c4953589d50f21a9e856a4ecc Mon Sep 17 00:00:00 2001 1From ad5b89a366785d8a19ba970f5b0c97b4de848fa3 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Thu, 21 Feb 2019 16:23:24 +0800 3Date: Thu, 21 Feb 2019 16:23:24 +0800
4Subject: [PATCH] binfmt: Don't install dependency links at install time for 4Subject: [PATCH] binfmt: Don't install dependency links at install time for
@@ -18,17 +18,16 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
18Signed-off-by: Chen Qi <Qi.Chen@windriver.com> 18Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
19[rebased for systemd 243] 19[rebased for systemd 243]
20Signed-off-by: Scott Murray <scott.murray@konsulko.com> 20Signed-off-by: Scott Murray <scott.murray@konsulko.com>
21
22--- 21---
23 units/meson.build | 6 ++---- 22 units/meson.build | 6 ++----
24 units/proc-sys-fs-binfmt_misc.automount | 3 +++ 23 units/proc-sys-fs-binfmt_misc.automount | 3 +++
25 units/systemd-binfmt.service.in | 4 ++++ 24 units/systemd-binfmt.service.in | 4 ++++
26 3 files changed, 9 insertions(+), 4 deletions(-) 25 3 files changed, 9 insertions(+), 4 deletions(-)
27 26
28Index: systemd-stable/units/meson.build 27diff --git a/units/meson.build b/units/meson.build
29=================================================================== 28index 031237c..0d43bdb 100644
30--- systemd-stable.orig/units/meson.build 29--- a/units/meson.build
31+++ systemd-stable/units/meson.build 30+++ b/units/meson.build
32@@ -54,8 +54,7 @@ units = [ 31@@ -54,8 +54,7 @@ units = [
33 ['poweroff.target', '', 32 ['poweroff.target', '',
34 (with_runlevels ? 'runlevel0.target' : '')], 33 (with_runlevels ? 'runlevel0.target' : '')],
@@ -38,8 +37,8 @@ Index: systemd-stable/units/meson.build
38+ ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT'], 37+ ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT'],
39 ['proc-sys-fs-binfmt_misc.mount', 'ENABLE_BINFMT'], 38 ['proc-sys-fs-binfmt_misc.mount', 'ENABLE_BINFMT'],
40 ['reboot.target', '', 39 ['reboot.target', '',
41 (with_runlevels ? 'runlevel6.target ctrl-alt-del.target' : 'ctrl-alt-del.target')], 40 'ctrl-alt-del.target' + (with_runlevels ? ' runlevel6.target' : '')],
42@@ -162,8 +161,7 @@ in_units = [ 41@@ -164,8 +163,7 @@ in_units = [
43 ['rc-local.service', 'HAVE_SYSV_COMPAT'], 42 ['rc-local.service', 'HAVE_SYSV_COMPAT'],
44 ['rescue.service', ''], 43 ['rescue.service', ''],
45 ['systemd-backlight@.service', 'ENABLE_BACKLIGHT'], 44 ['systemd-backlight@.service', 'ENABLE_BACKLIGHT'],
@@ -49,10 +48,10 @@ Index: systemd-stable/units/meson.build
49 ['systemd-bless-boot.service', 'ENABLE_EFI HAVE_BLKID'], 48 ['systemd-bless-boot.service', 'ENABLE_EFI HAVE_BLKID'],
50 ['systemd-boot-check-no-failures.service', ''], 49 ['systemd-boot-check-no-failures.service', ''],
51 ['systemd-coredump@.service', 'ENABLE_COREDUMP'], 50 ['systemd-coredump@.service', 'ENABLE_COREDUMP'],
52Index: systemd-stable/units/proc-sys-fs-binfmt_misc.automount 51diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
53=================================================================== 52index 30a6bc9..4231f3b 100644
54--- systemd-stable.orig/units/proc-sys-fs-binfmt_misc.automount 53--- a/units/proc-sys-fs-binfmt_misc.automount
55+++ systemd-stable/units/proc-sys-fs-binfmt_misc.automount 54+++ b/units/proc-sys-fs-binfmt_misc.automount
56@@ -18,3 +18,6 @@ ConditionPathIsReadWrite=/proc/sys/ 55@@ -18,3 +18,6 @@ ConditionPathIsReadWrite=/proc/sys/
57 56
58 [Automount] 57 [Automount]
@@ -60,11 +59,11 @@ Index: systemd-stable/units/proc-sys-fs-binfmt_misc.automount
60+ 59+
61+[Install] 60+[Install]
62+WantedBy=sysinit.target 61+WantedBy=sysinit.target
63Index: systemd-stable/units/systemd-binfmt.service.in 62diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in
64=================================================================== 63index e54e95e..372a598 100644
65--- systemd-stable.orig/units/systemd-binfmt.service.in 64--- a/units/systemd-binfmt.service.in
66+++ systemd-stable/units/systemd-binfmt.service.in 65+++ b/units/systemd-binfmt.service.in
67@@ -14,6 +14,7 @@ Documentation=https://www.kernel.org/doc 66@@ -14,6 +14,7 @@ Documentation=https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.htm
68 Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems 67 Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
69 DefaultDependencies=no 68 DefaultDependencies=no
70 Conflicts=shutdown.target 69 Conflicts=shutdown.target
@@ -79,3 +78,6 @@ Index: systemd-stable/units/systemd-binfmt.service.in
79+ 78+
80+[Install] 79+[Install]
81+WantedBy=sysinit.target 80+WantedBy=sysinit.target
81--
822.7.4
83
diff --git a/meta/recipes-core/systemd/systemd/0001-logind-Restore-chvt-as-non-root-user-without-polkit.patch b/meta/recipes-core/systemd/systemd/0001-logind-Restore-chvt-as-non-root-user-without-polkit.patch
new file mode 100644
index 0000000000..89ef39bc3e
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-logind-Restore-chvt-as-non-root-user-without-polkit.patch
@@ -0,0 +1,227 @@
1From 150d9cade6d475570395cb418b824524dead9577 Mon Sep 17 00:00:00 2001
2From: Joshua Watt <JPEWhacker@gmail.com>
3Date: Fri, 30 Oct 2020 08:15:43 -0500
4Subject: [PATCH] logind: Restore chvt as non-root user without polkit
5
64acf0cfd2f ("logind: check PolicyKit before allowing VT switch") broke
7the ability to write user sessions that run graphical sessions (e.g.
8weston/X11). This was partially amended in 19bb87fbfa ("login: allow
9non-console sessions to change vt") by changing the default PolicyKit
10policy so that non-root users are again allowed to switch the VT. This
11makes the policy when PolKit is not enabled (as on many embedded
12systems) match the default PolKit policy and allows launching graphical
13sessions as a non-root user.
14
15Closes #17473
16---
17 src/login/logind-dbus.c | 11 ++-------
18 src/login/logind-polkit.c | 26 +++++++++++++++++++++
19 src/login/logind-polkit.h | 10 ++++++++
20 src/login/logind-seat-dbus.c | 41 ++++-----------------------------
21 src/login/logind-session-dbus.c | 11 ++-------
22 src/login/meson.build | 1 +
23 6 files changed, 46 insertions(+), 54 deletions(-)
24 create mode 100644 src/login/logind-polkit.c
25 create mode 100644 src/login/logind-polkit.h
26
27diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
28index 0f83ed99bc..a3765d88ba 100644
29--- a/src/login/logind-dbus.c
30+++ b/src/login/logind-dbus.c
31@@ -30,6 +30,7 @@
32 #include "format-util.h"
33 #include "fs-util.h"
34 #include "logind-dbus.h"
35+#include "logind-polkit.h"
36 #include "logind-seat-dbus.h"
37 #include "logind-session-dbus.h"
38 #include "logind-user-dbus.h"
39@@ -1047,15 +1048,7 @@ static int method_activate_session_on_seat(sd_bus_message *message, void *userda
40 return sd_bus_error_setf(error, BUS_ERROR_SESSION_NOT_ON_SEAT,
41 "Session %s not on seat %s", session_name, seat_name);
42
43- r = bus_verify_polkit_async(
44- message,
45- CAP_SYS_ADMIN,
46- "org.freedesktop.login1.chvt",
47- NULL,
48- false,
49- UID_INVALID,
50- &m->polkit_registry,
51- error);
52+ r = check_polkit_chvt(message, m, error);
53 if (r < 0)
54 return r;
55 if (r == 0)
56diff --git a/src/login/logind-polkit.c b/src/login/logind-polkit.c
57new file mode 100644
58index 0000000000..9072570cc6
59--- /dev/null
60+++ b/src/login/logind-polkit.c
61@@ -0,0 +1,26 @@
62+/* SPDX-License-Identifier: LGPL-2.1+ */
63+
64+#include "bus-polkit.h"
65+#include "logind-polkit.h"
66+#include "missing_capability.h"
67+#include "user-util.h"
68+
69+int check_polkit_chvt(sd_bus_message *message, Manager *manager, sd_bus_error *error) {
70+#if ENABLE_POLKIT
71+ return bus_verify_polkit_async(
72+ message,
73+ CAP_SYS_ADMIN,
74+ "org.freedesktop.login1.chvt",
75+ NULL,
76+ false,
77+ UID_INVALID,
78+ &manager->polkit_registry,
79+ error);
80+#else
81+ /* Allow chvt when polkit is not present. This allows a service to start a graphical session as a
82+ * non-root user when polkit is not compiled in, matching the default polkit policy */
83+ return 1;
84+#endif
85+}
86+
87+
88diff --git a/src/login/logind-polkit.h b/src/login/logind-polkit.h
89new file mode 100644
90index 0000000000..476c077a8a
91--- /dev/null
92+++ b/src/login/logind-polkit.h
93@@ -0,0 +1,10 @@
94+/* SPDX-License-Identifier: LGPL-2.1+ */
95+#pragma once
96+
97+#include "sd-bus.h"
98+
99+#include "bus-object.h"
100+#include "logind.h"
101+
102+int check_polkit_chvt(sd_bus_message *message, Manager *manager, sd_bus_error *error);
103+
104diff --git a/src/login/logind-seat-dbus.c b/src/login/logind-seat-dbus.c
105index a945132284..f22e9e2734 100644
106--- a/src/login/logind-seat-dbus.c
107+++ b/src/login/logind-seat-dbus.c
108@@ -9,6 +9,7 @@
109 #include "bus-polkit.h"
110 #include "bus-util.h"
111 #include "logind-dbus.h"
112+#include "logind-polkit.h"
113 #include "logind-seat-dbus.h"
114 #include "logind-seat.h"
115 #include "logind-session-dbus.h"
116@@ -179,15 +180,7 @@ static int method_activate_session(sd_bus_message *message, void *userdata, sd_b
117 if (session->seat != s)
118 return sd_bus_error_setf(error, BUS_ERROR_SESSION_NOT_ON_SEAT, "Session %s not on seat %s", name, s->id);
119
120- r = bus_verify_polkit_async(
121- message,
122- CAP_SYS_ADMIN,
123- "org.freedesktop.login1.chvt",
124- NULL,
125- false,
126- UID_INVALID,
127- &s->manager->polkit_registry,
128- error);
129+ r = check_polkit_chvt(message, s->manager, error);
130 if (r < 0)
131 return r;
132 if (r == 0)
133@@ -215,15 +208,7 @@ static int method_switch_to(sd_bus_message *message, void *userdata, sd_bus_erro
134 if (to <= 0)
135 return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid virtual terminal");
136
137- r = bus_verify_polkit_async(
138- message,
139- CAP_SYS_ADMIN,
140- "org.freedesktop.login1.chvt",
141- NULL,
142- false,
143- UID_INVALID,
144- &s->manager->polkit_registry,
145- error);
146+ r = check_polkit_chvt(message, s->manager, error);
147 if (r < 0)
148 return r;
149 if (r == 0)
150@@ -243,15 +228,7 @@ static int method_switch_to_next(sd_bus_message *message, void *userdata, sd_bus
151 assert(message);
152 assert(s);
153
154- r = bus_verify_polkit_async(
155- message,
156- CAP_SYS_ADMIN,
157- "org.freedesktop.login1.chvt",
158- NULL,
159- false,
160- UID_INVALID,
161- &s->manager->polkit_registry,
162- error);
163+ r = check_polkit_chvt(message, s->manager, error);
164 if (r < 0)
165 return r;
166 if (r == 0)
167@@ -271,15 +248,7 @@ static int method_switch_to_previous(sd_bus_message *message, void *userdata, sd
168 assert(message);
169 assert(s);
170
171- r = bus_verify_polkit_async(
172- message,
173- CAP_SYS_ADMIN,
174- "org.freedesktop.login1.chvt",
175- NULL,
176- false,
177- UID_INVALID,
178- &s->manager->polkit_registry,
179- error);
180+ r = check_polkit_chvt(message, s->manager, error);
181 if (r < 0)
182 return r;
183 if (r == 0)
184diff --git a/src/login/logind-session-dbus.c b/src/login/logind-session-dbus.c
185index ccc5ac8df2..57c8a4e900 100644
186--- a/src/login/logind-session-dbus.c
187+++ b/src/login/logind-session-dbus.c
188@@ -11,6 +11,7 @@
189 #include "fd-util.h"
190 #include "logind-brightness.h"
191 #include "logind-dbus.h"
192+#include "logind-polkit.h"
193 #include "logind-seat-dbus.h"
194 #include "logind-session-dbus.h"
195 #include "logind-session-device.h"
196@@ -192,15 +193,7 @@ int bus_session_method_activate(sd_bus_message *message, void *userdata, sd_bus_
197 assert(message);
198 assert(s);
199
200- r = bus_verify_polkit_async(
201- message,
202- CAP_SYS_ADMIN,
203- "org.freedesktop.login1.chvt",
204- NULL,
205- false,
206- UID_INVALID,
207- &s->manager->polkit_registry,
208- error);
209+ r = check_polkit_chvt(message, s->manager, error);
210 if (r < 0)
211 return r;
212 if (r == 0)
213diff --git a/src/login/meson.build b/src/login/meson.build
214index 0a7d3d5440..7e46be2add 100644
215--- a/src/login/meson.build
216+++ b/src/login/meson.build
217@@ -26,6 +26,7 @@ liblogind_core_sources = files('''
218 logind-device.h
219 logind-inhibit.c
220 logind-inhibit.h
221+ logind-polkit.c
222 logind-seat-dbus.c
223 logind-seat-dbus.h
224 logind-seat.c
225--
2262.28.0
227
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 30fe9a14df..3be5095f07 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 3eb12a6ba0bce149717eaabeb1505d379b3d705a Mon Sep 17 00:00:00 2001 1From 263e4100a849f28f62fcfcc1456e9e6de8ee836b 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
@@ -12,16 +12,16 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
12Signed-off-by: Andrej Valek <andrej.valek@siemens.com> 12Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
13 13
14--- 14---
15 src/basic/sort-util.h | 14 ------------ 15 src/basic/sort-util.h | 14 --------------
16 src/libsystemd/sd-hwdb/hwdb-util.c | 19 +++++++++++----- 16 src/libsystemd/sd-hwdb/hwdb-util.c | 19 ++++++++++++++-----
17 src/shared/format-table.c | 36 ++++++++++++++++++++---------- 17 src/shared/format-table.c | 36 ++++++++++++++++++++++++------------
18 3 files changed, 38 insertions(+), 31 deletions(-) 18 3 files changed, 38 insertions(+), 31 deletions(-)
19 19
20Index: systemd-stable/src/basic/sort-util.h 20diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
21=================================================================== 21index a8dc3bb..9541061 100644
22--- systemd-stable.orig/src/basic/sort-util.h 22--- a/src/basic/sort-util.h
23+++ systemd-stable/src/basic/sort-util.h 23+++ b/src/basic/sort-util.h
24@@ -54,17 +54,3 @@ static inline void _qsort_safe(void *bas 24@@ -54,17 +54,3 @@ static inline void _qsort_safe(void *base, size_t nmemb, size_t size, __compar_f
25 int (*_func_)(const typeof(p[0])*, const typeof(p[0])*) = func; \ 25 int (*_func_)(const typeof(p[0])*, const typeof(p[0])*) = func; \
26 _qsort_safe((p), (n), sizeof((p)[0]), (__compar_fn_t) _func_); \ 26 _qsort_safe((p), (n), sizeof((p)[0]), (__compar_fn_t) _func_); \
27 }) 27 })
@@ -39,11 +39,11 @@ Index: systemd-stable/src/basic/sort-util.h
39- int (*_func_)(const typeof(p[0])*, const typeof(p[0])*, typeof(userdata)) = func; \ 39- int (*_func_)(const typeof(p[0])*, const typeof(p[0])*, typeof(userdata)) = func; \
40- qsort_r_safe((p), (n), sizeof((p)[0]), (__compar_d_fn_t) _func_, userdata); \ 40- qsort_r_safe((p), (n), sizeof((p)[0]), (__compar_d_fn_t) _func_, userdata); \
41- }) 41- })
42Index: systemd-stable/src/libsystemd/sd-hwdb/hwdb-util.c 42diff --git a/src/libsystemd/sd-hwdb/hwdb-util.c b/src/libsystemd/sd-hwdb/hwdb-util.c
43=================================================================== 43index 5c75216..3986fc8 100644
44--- systemd-stable.orig/src/libsystemd/sd-hwdb/hwdb-util.c 44--- a/src/libsystemd/sd-hwdb/hwdb-util.c
45+++ systemd-stable/src/libsystemd/sd-hwdb/hwdb-util.c 45+++ b/src/libsystemd/sd-hwdb/hwdb-util.c
46@@ -128,9 +128,13 @@ static void trie_free(struct trie *trie) 46@@ -128,9 +128,13 @@ static void trie_free(struct trie *trie) {
47 47
48 DEFINE_TRIVIAL_CLEANUP_FUNC(struct trie*, trie_free); 48 DEFINE_TRIVIAL_CLEANUP_FUNC(struct trie*, trie_free);
49 49
@@ -60,7 +60,7 @@ Index: systemd-stable/src/libsystemd/sd-hwdb/hwdb-util.c
60 } 60 }
61 61
62 static int trie_node_add_value(struct trie *trie, struct trie_node *node, 62 static int trie_node_add_value(struct trie *trie, struct trie_node *node,
63@@ -158,7 +162,10 @@ static int trie_node_add_value(struct tr 63@@ -158,7 +162,10 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node,
64 .value_off = v, 64 .value_off = v,
65 }; 65 };
66 66
@@ -72,7 +72,7 @@ Index: systemd-stable/src/libsystemd/sd-hwdb/hwdb-util.c
72 if (val) { 72 if (val) {
73 /* At this point we have 2 identical properties on the same match-string. 73 /* At this point we have 2 identical properties on the same match-string.
74 * Since we process files in order, we just replace the previous value. */ 74 * Since we process files in order, we just replace the previous value. */
75@@ -184,7 +191,9 @@ static int trie_node_add_value(struct tr 75@@ -184,7 +191,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node,
76 .line_number = line_number, 76 .line_number = line_number,
77 }; 77 };
78 node->values_count++; 78 node->values_count++;
@@ -83,11 +83,11 @@ Index: systemd-stable/src/libsystemd/sd-hwdb/hwdb-util.c
83 return 0; 83 return 0;
84 } 84 }
85 85
86Index: systemd-stable/src/shared/format-table.c 86diff --git a/src/shared/format-table.c b/src/shared/format-table.c
87=================================================================== 87index 612402c..04638b2 100644
88--- systemd-stable.orig/src/shared/format-table.c 88--- a/src/shared/format-table.c
89+++ systemd-stable/src/shared/format-table.c 89+++ b/src/shared/format-table.c
90@@ -1246,31 +1246,33 @@ static int cell_data_compare(TableData * 90@@ -1243,30 +1243,32 @@ static int cell_data_compare(TableData *a, size_t index_a, TableData *b, size_t
91 return CMP(index_a, index_b); 91 return CMP(index_a, index_b);
92 } 92 }
93 93
@@ -95,7 +95,6 @@ Index: systemd-stable/src/shared/format-table.c
95+static Table *user_table; 95+static Table *user_table;
96+static int table_data_compare(const void *x, const void *y) { 96+static int table_data_compare(const void *x, const void *y) {
97+ const size_t *a = x, *b=y; 97+ const size_t *a = x, *b=y;
98 size_t i;
99 int r; 98 int r;
100 99
101- assert(t); 100- assert(t);
@@ -115,8 +114,8 @@ Index: systemd-stable/src/shared/format-table.c
115 return 1; 114 return 1;
116 115
117 /* Order other lines by the sorting map */ 116 /* Order other lines by the sorting map */
118- for (i = 0; i < t->n_sort_map; i++) { 117- for (size_t i = 0; i < t->n_sort_map; i++) {
119+ for (i = 0; i < user_table->n_sort_map; i++) { 118+ for (size_t i = 0; i < user_table->n_sort_map; i++) {
120 TableData *d, *dd; 119 TableData *d, *dd;
121 120
122- d = t->data[*a + t->sort_map[i]]; 121- d = t->data[*a + t->sort_map[i]];
@@ -131,8 +130,8 @@ Index: systemd-stable/src/shared/format-table.c
131 } 130 }
132 131
133 /* Order identical lines by the order there were originally added in */ 132 /* Order identical lines by the order there were originally added in */
134@@ -1798,7 +1800,12 @@ int table_print(Table *t, FILE *f) { 133@@ -1844,7 +1846,12 @@ int table_print(Table *t, FILE *f) {
135 for (i = 0; i < n_rows; i++) 134 for (size_t i = 0; i < n_rows; i++)
136 sorted[i] = i * t->n_columns; 135 sorted[i] = i * t->n_columns;
137 136
138- typesafe_qsort_r(sorted, n_rows, table_data_compare, t); 137- typesafe_qsort_r(sorted, n_rows, table_data_compare, t);
@@ -145,8 +144,8 @@ Index: systemd-stable/src/shared/format-table.c
145 } 144 }
146 145
147 if (t->display_map) 146 if (t->display_map)
148@@ -2375,7 +2382,12 @@ int table_to_json(Table *t, JsonVariant 147@@ -2440,7 +2447,12 @@ int table_to_json(Table *t, JsonVariant **ret) {
149 for (i = 0; i < n_rows; i++) 148 for (size_t i = 0; i < n_rows; i++)
150 sorted[i] = i * t->n_columns; 149 sorted[i] = i * t->n_columns;
151 150
152- typesafe_qsort_r(sorted, n_rows, table_data_compare, t); 151- typesafe_qsort_r(sorted, n_rows, table_data_compare, t);
diff --git a/meta/recipes-core/systemd/systemd_246.6.bb b/meta/recipes-core/systemd/systemd_246.9.bb
index 9215adf8dc..6524b8216a 100644
--- a/meta/recipes-core/systemd/systemd_246.6.bb
+++ b/meta/recipes-core/systemd/systemd_246.9.bb
@@ -21,6 +21,7 @@ SRC_URI += "file://touchscreen.rules \
21 file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \ 21 file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
22 file://0003-implment-systemd-sysv-install-for-OE.patch \ 22 file://0003-implment-systemd-sysv-install-for-OE.patch \
23 file://0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch \ 23 file://0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch \
24 file://0001-logind-Restore-chvt-as-non-root-user-without-polkit.patch \
24 " 25 "
25 26
26# patches needed by musl 27# patches needed by musl
@@ -134,7 +135,7 @@ PACKAGECONFIG[hibernate] = "-Dhibernate=true,-Dhibernate=false"
134PACKAGECONFIG[hostnamed] = "-Dhostnamed=true,-Dhostnamed=false" 135PACKAGECONFIG[hostnamed] = "-Dhostnamed=true,-Dhostnamed=false"
135PACKAGECONFIG[idn] = "-Didn=true,-Didn=false" 136PACKAGECONFIG[idn] = "-Didn=true,-Didn=false"
136PACKAGECONFIG[ima] = "-Dima=true,-Dima=false" 137PACKAGECONFIG[ima] = "-Dima=true,-Dima=false"
137# importd requires curl/xz/zlib/bzip2/gcrypt 138# importd requires journal-upload/xz/zlib/bzip2/gcrypt
138PACKAGECONFIG[importd] = "-Dimportd=true,-Dimportd=false" 139PACKAGECONFIG[importd] = "-Dimportd=true,-Dimportd=false"
139# Update NAT firewall rules 140# Update NAT firewall rules
140PACKAGECONFIG[iptc] = "-Dlibiptc=true,-Dlibiptc=false,iptables" 141PACKAGECONFIG[iptc] = "-Dlibiptc=true,-Dlibiptc=false,iptables"
@@ -357,15 +358,15 @@ USERADD_PACKAGES = "${PN} ${PN}-extra-utils \
357 ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \ 358 ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
358" 359"
359GROUPADD_PARAM_${PN} = "-r systemd-journal" 360GROUPADD_PARAM_${PN} = "-r systemd-journal"
360USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /bin/nologin systemd-coredump;', '', d)}" 361USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /sbin/nologin systemd-coredump;', '', d)}"
361USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /bin/nologin systemd-network;', '', d)}" 362USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /sbin/nologin systemd-network;', '', d)}"
362USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit', '--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd;', '', d)}" 363USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit', '--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd;', '', d)}"
363USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /bin/nologin systemd-resolve;', '', d)}" 364USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /sbin/nologin systemd-resolve;', '', d)}"
364USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /bin/nologin systemd-timesync;', '', d)}" 365USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /sbin/nologin systemd-timesync;', '', d)}"
365USERADD_PARAM_${PN}-extra-utils = "--system -d / -M --shell /bin/nologin systemd-bus-proxy" 366USERADD_PARAM_${PN}-extra-utils = "--system -d / -M --shell /sbin/nologin systemd-bus-proxy"
366USERADD_PARAM_${PN}-journal-gateway = "--system -d / -M --shell /bin/nologin systemd-journal-gateway" 367USERADD_PARAM_${PN}-journal-gateway = "--system -d / -M --shell /sbin/nologin systemd-journal-gateway"
367USERADD_PARAM_${PN}-journal-remote = "--system -d / -M --shell /bin/nologin systemd-journal-remote" 368USERADD_PARAM_${PN}-journal-remote = "--system -d / -M --shell /sbin/nologin systemd-journal-remote"
368USERADD_PARAM_${PN}-journal-upload = "--system -d / -M --shell /bin/nologin systemd-journal-upload" 369USERADD_PARAM_${PN}-journal-upload = "--system -d / -M --shell /sbin/nologin systemd-journal-upload"
369 370
370FILES_${PN}-analyze = "${bindir}/systemd-analyze" 371FILES_${PN}-analyze = "${bindir}/systemd-analyze"
371 372
diff --git a/meta/recipes-core/sysvinit/sysvinit/rc b/meta/recipes-core/sysvinit/sysvinit/rc
index fd1fdd26ba..d0d3149821 100755
--- a/meta/recipes-core/sysvinit/sysvinit/rc
+++ b/meta/recipes-core/sysvinit/sysvinit/rc
@@ -63,7 +63,7 @@ startup() {
63 stty onlcr 0>&1 63 stty onlcr 0>&1
64 64
65 # Limit stack size for startup scripts 65 # Limit stack size for startup scripts
66 [ "$STACK_SIZE" == "" ] || ulimit -S -s $STACK_SIZE 66 [ "$STACK_SIZE" = "" ] || ulimit -S -s $STACK_SIZE
67 67
68 # Now find out what the current and what the previous runlevel are. 68 # Now find out what the current and what the previous runlevel are.
69 69
diff --git a/meta/recipes-core/udev/eudev/init b/meta/recipes-core/udev/eudev/init
index 0455ade258..c60dbbf6d5 100644
--- a/meta/recipes-core/udev/eudev/init
+++ b/meta/recipes-core/udev/eudev/init
@@ -52,7 +52,7 @@ case "$1" in
52 kill_udevd > "/dev/null" 2>&1 52 kill_udevd > "/dev/null" 2>&1
53 53
54 # trigger the sorted events 54 # trigger the sorted events
55 [ -e /proc/sys/kernel/hotplug ] && echo -e '\000' >/proc/sys/kernel/hotplug 55 [ -e /proc/sys/kernel/hotplug ] && printf '\0\n' >/proc/sys/kernel/hotplug
56 @UDEVD@ -d 56 @UDEVD@ -d
57 57
58 udevadm control --env=STARTUP=1 58 udevadm control --env=STARTUP=1
diff --git a/meta/recipes-devtools/binutils/binutils-2.35.inc b/meta/recipes-devtools/binutils/binutils-2.35.1.inc
index bc9107b084..6290d5b191 100644
--- a/meta/recipes-devtools/binutils/binutils-2.35.inc
+++ b/meta/recipes-devtools/binutils/binutils-2.35.1.inc
@@ -16,15 +16,15 @@ def binutils_branch_version(d):
16 16
17# When upgrading to 2.35, please make sure there is no trailing .0, so 17# When upgrading to 2.35, please make sure there is no trailing .0, so
18# that upstream version check can work correctly. 18# that upstream version check can work correctly.
19PV = "2.35" 19PV = "2.35.1"
20CVE_VERSION = "2.35" 20CVE_VERSION = "2.35.1"
21BINUPV = "${@binutils_branch_version(d)}" 21BINUPV = "${@binutils_branch_version(d)}"
22#BRANCH = "binutils-${BINUPV}-branch" 22#BRANCH = "binutils-${BINUPV}-branch"
23BRANCH ?= "binutils-2_35-branch" 23BRANCH ?= "binutils-2_35-branch"
24 24
25UPSTREAM_CHECK_GITTAGREGEX = "binutils-(?P<pver>\d+_(\d_?)*)" 25UPSTREAM_CHECK_GITTAGREGEX = "binutils-(?P<pver>\d+_(\d_?)*)"
26 26
27SRCREV ?= "89a9065674a14a8bd94bb326b27d19a2f3583efb" 27SRCREV ?= "7e46a74aa3713c563940960e361e08defda019c2"
28BINUTILS_GIT_URI ?= "git://sourceware.org/git/binutils-gdb.git;branch=${BRANCH};protocol=git" 28BINUTILS_GIT_URI ?= "git://sourceware.org/git/binutils-gdb.git;branch=${BRANCH};protocol=git"
29SRC_URI = "\ 29SRC_URI = "\
30 ${BINUTILS_GIT_URI} \ 30 ${BINUTILS_GIT_URI} \
@@ -42,5 +42,8 @@ SRC_URI = "\
42 file://0015-sync-with-OE-libtool-changes.patch \ 42 file://0015-sync-with-OE-libtool-changes.patch \
43 file://0016-Check-for-clang-before-checking-gcc-version.patch \ 43 file://0016-Check-for-clang-before-checking-gcc-version.patch \
44 file://0017-gas-improve-reproducibility-for-stabs-debugging-data.patch \ 44 file://0017-gas-improve-reproducibility-for-stabs-debugging-data.patch \
45 file://0001-aarch64-Return-an-error-on-conditional-branch-to-an-.patch \
46 file://CVE-2020-35448.patch \
47 file://0001-gold-ensure-file_counts_lock-is-initialized-before-u.patch \
45" 48"
46S = "${WORKDIR}/git" 49S = "${WORKDIR}/git"
diff --git a/meta/recipes-devtools/binutils/binutils-cross-canadian_2.35.bb b/meta/recipes-devtools/binutils/binutils-cross-canadian_2.35.1.bb
index 5dbaa03017..5dbaa03017 100644
--- a/meta/recipes-devtools/binutils/binutils-cross-canadian_2.35.bb
+++ b/meta/recipes-devtools/binutils/binutils-cross-canadian_2.35.1.bb
diff --git a/meta/recipes-devtools/binutils/binutils-cross-testsuite_2.35.bb b/meta/recipes-devtools/binutils/binutils-cross-testsuite_2.35.1.bb
index 07a8e7c417..07a8e7c417 100644
--- a/meta/recipes-devtools/binutils/binutils-cross-testsuite_2.35.bb
+++ b/meta/recipes-devtools/binutils/binutils-cross-testsuite_2.35.1.bb
diff --git a/meta/recipes-devtools/binutils/binutils-cross_2.35.bb b/meta/recipes-devtools/binutils/binutils-cross_2.35.1.bb
index fbd1f7d25a..fbd1f7d25a 100644
--- a/meta/recipes-devtools/binutils/binutils-cross_2.35.bb
+++ b/meta/recipes-devtools/binutils/binutils-cross_2.35.1.bb
diff --git a/meta/recipes-devtools/binutils/binutils-crosssdk_2.35.bb b/meta/recipes-devtools/binutils/binutils-crosssdk_2.35.1.bb
index 37f4d6d2e9..37f4d6d2e9 100644
--- a/meta/recipes-devtools/binutils/binutils-crosssdk_2.35.bb
+++ b/meta/recipes-devtools/binutils/binutils-crosssdk_2.35.1.bb
diff --git a/meta/recipes-devtools/binutils/binutils/0001-aarch64-Return-an-error-on-conditional-branch-to-an-.patch b/meta/recipes-devtools/binutils/binutils/0001-aarch64-Return-an-error-on-conditional-branch-to-an-.patch
new file mode 100644
index 0000000000..f46ddab415
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/0001-aarch64-Return-an-error-on-conditional-branch-to-an-.patch
@@ -0,0 +1,135 @@
1From c7cd291722779c9d4703ed0010388fe394c644c8 Mon Sep 17 00:00:00 2001
2From: Siddhesh Poyarekar <siddesh.poyarekar@arm.com>
3Date: Tue, 1 Sep 2020 14:25:52 +0530
4Subject: [PATCH] aarch64: Return an error on conditional branch to an undefined symbol
5
6The fix in 7e05773767820b441b23a16628b55c98cb1aef46 introduced a PLT
7for conditional jumps when the target symbol is undefined. This is
8incorrect because conditional branch relocations are not allowed to
9clobber IP0/IP1 and hence, should not result in a dynamic relocation.
10
11Revert that change and in its place, issue an error when the target
12symbol is undefined.
13
14bfd/
15
16 2020-09-10 Siddhesh Poyarekar <siddesh.poyarekar@arm.com>
17
18 * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Revert
19 changes in 7e05773767820b441b23a16628b55c98cb1aef46. Set
20 error for undefined symbol in BFD_RELOC_AARCH64_BRANCH19 and
21 BFD_RELOC_AARCH64_TSTBR14 relocations.
22
23ld/
24
25 2020-09-10 Siddhesh Poyarekar <siddesh.poyarekar@arm.com>
26
27 * testsuite/ld-aarch64/emit-relocs-560.d: Expect error instead
28 of valid output.
29---
30Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=c7cd291722779c9d4703ed0010388fe394c644c8]
31Signed-off-by: Khem Raj <raj.khem@gmail.com>
32
33 bfd/ChangeLog | 7 +++++
34 bfd/elfnn-aarch64.c | 37 ++++++++++++-----------
35 ld/ChangeLog | 5 +++
36 ld/testsuite/ld-aarch64/emit-relocs-560.d | 7 +----
37 4 files changed, 32 insertions(+), 24 deletions(-)
38
39diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
40index 5b4c189b593..a9924e7ec56 100644
41--- a/bfd/elfnn-aarch64.c
42+++ b/bfd/elfnn-aarch64.c
43@@ -5447,7 +5447,6 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
44 bfd_vma orig_value = value;
45 bfd_boolean resolved_to_zero;
46 bfd_boolean abs_symbol_p;
47- bfd_boolean via_plt_p;
48
49 globals = elf_aarch64_hash_table (info);
50
51@@ -5469,8 +5468,6 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
52 : bfd_is_und_section (sym_sec));
53 abs_symbol_p = h != NULL && bfd_is_abs_symbol (&h->root);
54
55- via_plt_p = (globals->root.splt != NULL && h != NULL
56- && h->plt.offset != (bfd_vma) - 1);
57
58 /* Since STT_GNU_IFUNC symbol must go through PLT, we handle
59 it here if it is defined in a non-shared object. */
60@@ -5806,23 +5803,12 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
61 value += signed_addend;
62 break;
63
64- case BFD_RELOC_AARCH64_BRANCH19:
65- case BFD_RELOC_AARCH64_TSTBR14:
66- /* A conditional branch to an undefined weak symbol is converted to a
67- branch to itself. */
68- if (weak_undef_p && !via_plt_p)
69- {
70- value = _bfd_aarch64_elf_resolve_relocation (input_bfd, bfd_r_type,
71- place, value,
72- signed_addend,
73- weak_undef_p);
74- break;
75- }
76- /* Fall through. */
77 case BFD_RELOC_AARCH64_CALL26:
78 case BFD_RELOC_AARCH64_JUMP26:
79 {
80 asection *splt = globals->root.splt;
81+ bfd_boolean via_plt_p =
82+ splt != NULL && h != NULL && h->plt.offset != (bfd_vma) - 1;
83
84 /* A call to an undefined weak symbol is converted to a jump to
85 the next instruction unless a PLT entry will be created.
86@@ -5903,6 +5889,23 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
87 bfd_set_error (bfd_error_bad_value);
88 return bfd_reloc_notsupported;
89 }
90+ value = _bfd_aarch64_elf_resolve_relocation (input_bfd, bfd_r_type,
91+ place, value,
92+ signed_addend,
93+ weak_undef_p);
94+ break;
95+
96+ case BFD_RELOC_AARCH64_BRANCH19:
97+ case BFD_RELOC_AARCH64_TSTBR14:
98+ if (h && h->root.type == bfd_link_hash_undefined)
99+ {
100+ _bfd_error_handler
101+ /* xgettext:c-format */
102+ (_("%pB: conditional branch to undefined symbol `%s' "
103+ "not allowed"), input_bfd, h->root.root.string);
104+ bfd_set_error (bfd_error_bad_value);
105+ return bfd_reloc_notsupported;
106+ }
107 /* Fall through. */
108
109 case BFD_RELOC_AARCH64_16:
110@@ -7968,8 +7971,6 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info,
111 break;
112 }
113
114- case BFD_RELOC_AARCH64_BRANCH19:
115- case BFD_RELOC_AARCH64_TSTBR14:
116 case BFD_RELOC_AARCH64_CALL26:
117 case BFD_RELOC_AARCH64_JUMP26:
118 /* If this is a local symbol then we resolve it
119diff --git a/ld/testsuite/ld-aarch64/emit-relocs-560.d b/ld/testsuite/ld-aarch64/emit-relocs-560.d
120index 153532457b4..8751b743bd4 100644
121--- a/ld/testsuite/ld-aarch64/emit-relocs-560.d
122+++ b/ld/testsuite/ld-aarch64/emit-relocs-560.d
123@@ -1,8 +1,3 @@
124 #source: emit-relocs-560.s
125 #ld: -shared
126-#readelf: -r
127-
128-Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 2 entries:
129- Offset Info Type Sym. Value Sym. Name \+ Addend
130-[0-9a-f]+ 000100000402 R_AARCH64_JUMP_SL 0000000000000000 baz \+ 0
131-[0-9a-f]+ 000200000402 R_AARCH64_JUMP_SL 0000000000000000 bar \+ 0
132+#error: .*: conditional branch to undefined symbol `bar' not allowed
133--
1342.29.2
135
diff --git a/meta/recipes-devtools/binutils/binutils/0001-gold-ensure-file_counts_lock-is-initialized-before-u.patch b/meta/recipes-devtools/binutils/binutils/0001-gold-ensure-file_counts_lock-is-initialized-before-u.patch
new file mode 100644
index 0000000000..f46415f440
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/0001-gold-ensure-file_counts_lock-is-initialized-before-u.patch
@@ -0,0 +1,41 @@
1From de24fc96bf24fca470a9ca13176ad9ad9cc4d5a9 Mon Sep 17 00:00:00 2001
2From: Nick Gasson <nick.gasson@arm.com>
3Date: Mon, 2 Nov 2020 12:02:05 +0800
4Subject: [PATCH] gold: ensure file_counts_lock is initialized before using
5
6Since upgrading to binutils 2.35 I've been experiencing random memory
7corruption related crashes with ld.gold --threads. It's caused by
8multiple threads concurrently pushing elements onto the shared
9std::vector in File_read::record_file_read(). This vector is supposed to
10be protected by file_counts_lock, but that is initialized lazily and
11might be NULL when File_read::open() is called, in which case
12Hold_optional_lock silently skips locking it.
13
14Fix by calling the initialize() method before attempting to acquire the
15lock, the same as other places that use file_counts_lock.
16
17 PR 26827
18 * fileread.cc (File_read::open): Ensure file_counts_lock is
19 initialized.
20 * testsuite/Makefile.am (check_PROGRAMS): Add a test that passes
21 -Wl,--threads.
22 * testsuite/Makefile.in: Regenerate.
23
24Upstream-Status: Backport [af61e84fd2d from 2.36.0]
25Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
26---
27 gold/fileread.cc | 1 +
28 1 file changed, 1 insertion(+)
29
30diff --git a/gold/fileread.cc b/gold/fileread.cc
31index f5ca719360d..0b5228e2afd 100644
32--- a/gold/fileread.cc
33+++ b/gold/fileread.cc
34@@ -212,6 +212,7 @@ File_read::open(const Task* task, const std::string& name)
35 gold_debug(DEBUG_FILES, "Attempt to open %s succeeded",
36 this->name_.c_str());
37 this->token_.add_writer(task);
38+ file_counts_initialize_lock.initialize();
39 Hold_optional_lock hl(file_counts_lock);
40 record_file_read(this->name_);
41 }
diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2020-35448.patch b/meta/recipes-devtools/binutils/binutils/CVE-2020-35448.patch
new file mode 100644
index 0000000000..3bc64776e5
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/CVE-2020-35448.patch
@@ -0,0 +1,85 @@
1From 6caa41daeb7aa17c400b7300fb78d207cf064d70 Mon Sep 17 00:00:00 2001
2From: Alan Modra <amodra@gmail.com>
3Date: Fri, 4 Sep 2020 19:19:18 +0930
4Subject: [PATCH] PR26574, heap buffer overflow in
5 _bfd_elf_slurp_secondary_reloc_section
6
7A horribly fuzzed object with section headers inside the ELF header.
8Disallow that, and crazy reloc sizes.
9
10 PR 26574
11 * elfcode.h (elf_object_p): Sanity check section header offset.
12 * elf.c (_bfd_elf_slurp_secondary_reloc_section): Sanity check
13 sh_entsize.
14
15Upstream-Status: Backport
16CVE: CVE-2020-35448
17
18Reference to upstream patch:
19https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;
20 h=8642dafaef21aa6747cec01df1977e9c52eb4679
21
22Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com>
23---
24 bfd/elf.c | 4 +++-
25 bfd/elfcode.h | 8 ++++----
26 2 files changed, 7 insertions(+), 5 deletions(-)
27
28diff --git a/bfd/elf.c b/bfd/elf.c
29index fe375e7346..9f29166399 100644
30--- a/bfd/elf.c
31+++ b/bfd/elf.c
32@@ -12527,7 +12527,9 @@ _bfd_elf_slurp_secondary_reloc_section (bfd * abfd,
33 Elf_Internal_Shdr * hdr = & elf_section_data (relsec)->this_hdr;
34
35 if (hdr->sh_type == SHT_SECONDARY_RELOC
36- && hdr->sh_info == (unsigned) elf_section_data (sec)->this_idx)
37+ && hdr->sh_info == (unsigned) elf_section_data (sec)->this_idx
38+ && (hdr->sh_entsize == ebd->s->sizeof_rel
39+ || hdr->sh_entsize == ebd->s->sizeof_rela))
40 {
41 bfd_byte * native_relocs;
42 bfd_byte * native_reloc;
43diff --git a/bfd/elfcode.h b/bfd/elfcode.h
44index f4a7829f27..54ef890637 100644
45--- a/bfd/elfcode.h
46+++ b/bfd/elfcode.h
47@@ -568,7 +568,7 @@ elf_object_p (bfd *abfd)
48
49 /* If this is a relocatable file and there is no section header
50 table, then we're hosed. */
51- if (i_ehdrp->e_shoff == 0 && i_ehdrp->e_type == ET_REL)
52+ if (i_ehdrp->e_shoff < sizeof (x_ehdr) && i_ehdrp->e_type == ET_REL)
53 goto got_wrong_format_error;
54
55 /* As a simple sanity check, verify that what BFD thinks is the
56@@ -578,7 +578,7 @@ elf_object_p (bfd *abfd)
57 goto got_wrong_format_error;
58
59 /* Further sanity check. */
60- if (i_ehdrp->e_shoff == 0 && i_ehdrp->e_shnum != 0)
61+ if (i_ehdrp->e_shoff < sizeof (x_ehdr) && i_ehdrp->e_shnum != 0)
62 goto got_wrong_format_error;
63
64 ebd = get_elf_backend_data (abfd);
65@@ -615,7 +615,7 @@ elf_object_p (bfd *abfd)
66 && ebd->elf_osabi != ELFOSABI_NONE)
67 goto got_wrong_format_error;
68
69- if (i_ehdrp->e_shoff != 0)
70+ if (i_ehdrp->e_shoff >= sizeof (x_ehdr))
71 {
72 file_ptr where = (file_ptr) i_ehdrp->e_shoff;
73
74@@ -807,7 +807,7 @@ elf_object_p (bfd *abfd)
75 }
76 }
77
78- if (i_ehdrp->e_shstrndx != 0 && i_ehdrp->e_shoff != 0)
79+ if (i_ehdrp->e_shstrndx != 0 && i_ehdrp->e_shoff >= sizeof (x_ehdr))
80 {
81 unsigned int num_sec;
82
83--
842.29.2
85
diff --git a/meta/recipes-devtools/binutils/binutils_2.35.bb b/meta/recipes-devtools/binutils/binutils_2.35.1.bb
index 2e645e1ed8..2e645e1ed8 100644
--- a/meta/recipes-devtools/binutils/binutils_2.35.bb
+++ b/meta/recipes-devtools/binutils/binutils_2.35.1.bb
diff --git a/meta/recipes-devtools/bison/bison/0001-Use-mapped-file-name-for-symbols.patch b/meta/recipes-devtools/bison/bison/0001-Use-mapped-file-name-for-symbols.patch
new file mode 100644
index 0000000000..568ee4df19
--- /dev/null
+++ b/meta/recipes-devtools/bison/bison/0001-Use-mapped-file-name-for-symbols.patch
@@ -0,0 +1,62 @@
1From 2a3db4e3b8d33bad5577c2fcfe124ee7a202ef4f Mon Sep 17 00:00:00 2001
2From: Joshua Watt <JPEWhacker@gmail.com>
3Date: Mon, 15 Feb 2021 20:39:57 -0600
4Subject: [PATCH] Use mapped file name for symbols
5
6Applies the file name mapping before exporting it as a symbol. This
7allows the symbols to correctly respect the --file-prefix-map command
8line option.
9
10Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
11Upstream-Status: Submitted [https://lists.gnu.org/archive/html/bison-patches/2021-02/msg00014.html]
12---
13 src/muscle-tab.c | 4 +++-
14 src/output.c | 8 ++++++--
15 2 files changed, 9 insertions(+), 3 deletions(-)
16
17diff --git a/src/muscle-tab.c b/src/muscle-tab.c
18index b610d0b8..3e7657ca 100644
19--- a/src/muscle-tab.c
20+++ b/src/muscle-tab.c
21@@ -204,8 +204,10 @@ static void
22 muscle_syncline_grow (char const *key, location loc)
23 {
24 obstack_printf (&muscle_obstack, "]b4_syncline(%d, ", loc.start.line);
25+ char *f = map_file_name (loc.start.file);
26 obstack_quote (&muscle_obstack,
27- quotearg_style (c_quoting_style, loc.start.file));
28+ quotearg_style (c_quoting_style, f));
29+ free (f);
30 obstack_sgrow (&muscle_obstack, ")dnl\n[");
31 char const *extension = obstack_finish0 (&muscle_obstack);
32 muscle_grow (key, extension, "", "");
33diff --git a/src/output.c b/src/output.c
34index 391d8e65..34dbc671 100644
35--- a/src/output.c
36+++ b/src/output.c
37@@ -531,7 +531,9 @@ user_actions_output (FILE *out)
38 {
39 fprintf (out, "b4_syncline(%d, ",
40 rules[r].action_loc.start.line);
41- string_output (out, rules[r].action_loc.start.file);
42+ char *f = map_file_name (rules[r].action_loc.start.file);
43+ string_output (out, f);
44+ free(f);
45 fprintf (out, ")dnl\n");
46 }
47 fprintf (out, "[%*s%s]],\n[[",
48@@ -629,8 +631,10 @@ prepare_symbol_definitions (void)
49
50 if (p->code)
51 {
52+ char *f = map_file_name (p->location.start.file);
53 SET_KEY2 (pname, "file");
54- MUSCLE_INSERT_C_STRING (key, p->location.start.file);
55+ MUSCLE_INSERT_C_STRING (key, f);
56+ free (f);
57
58 SET_KEY2 (pname, "line");
59 MUSCLE_INSERT_INT (key, p->location.start.line);
60--
612.30.0
62
diff --git a/meta/recipes-devtools/bison/bison_3.7.2.bb b/meta/recipes-devtools/bison/bison_3.7.2.bb
index ace4ea5c3f..6fd9d288e0 100644
--- a/meta/recipes-devtools/bison/bison_3.7.2.bb
+++ b/meta/recipes-devtools/bison/bison_3.7.2.bb
@@ -11,6 +11,7 @@ DEPENDS = "bison-native flex-native"
11 11
12SRC_URI = "${GNU_MIRROR}/bison/bison-${PV}.tar.xz \ 12SRC_URI = "${GNU_MIRROR}/bison/bison-${PV}.tar.xz \
13 file://add-with-bisonlocaledir.patch \ 13 file://add-with-bisonlocaledir.patch \
14 file://0001-Use-mapped-file-name-for-symbols.patch \
14 " 15 "
15SRC_URI[sha256sum] = "7948d193104d979c0fb0294a1854c73c89d72ae41acfc081826142578a78a91b" 16SRC_URI[sha256sum] = "7948d193104d979c0fb0294a1854c73c89d72ae41acfc081826142578a78a91b"
16 17
diff --git a/meta/recipes-devtools/diffstat/diffstat_1.63.bb b/meta/recipes-devtools/diffstat/diffstat_1.63.bb
index 61b2ea5dc2..863f924b22 100644
--- a/meta/recipes-devtools/diffstat/diffstat_1.63.bb
+++ b/meta/recipes-devtools/diffstat/diffstat_1.63.bb
@@ -5,7 +5,7 @@ reviewing large, complex patch files."
5HOMEPAGE = "http://invisible-island.net/diffstat/" 5HOMEPAGE = "http://invisible-island.net/diffstat/"
6SECTION = "devel" 6SECTION = "devel"
7LICENSE = "MIT" 7LICENSE = "MIT"
8LIC_FILES_CHKSUM = "file://install-sh;endline=42;md5=b3549726c1022bee09c174c72a0ca4a5" 8LIC_FILES_CHKSUM = "file://COPYING;md5=a3d0bb117493e804b0c1a868ddf23321"
9 9
10SRC_URI = "http://invisible-mirror.net/archives/${BPN}/${BP}.tgz \ 10SRC_URI = "http://invisible-mirror.net/archives/${BPN}/${BP}.tgz \
11 file://run-ptest \ 11 file://run-ptest \
@@ -16,8 +16,6 @@ SRC_URI = "http://invisible-mirror.net/archives/${BPN}/${BP}.tgz \
16SRC_URI[md5sum] = "b9272ec8af6257103261ec3622692991" 16SRC_URI[md5sum] = "b9272ec8af6257103261ec3622692991"
17SRC_URI[sha256sum] = "7eddd53401b99b90bac3f7ebf23dd583d7d99c6106e67a4f1161b7a20110dc6f" 17SRC_URI[sha256sum] = "7eddd53401b99b90bac3f7ebf23dd583d7d99c6106e67a4f1161b7a20110dc6f"
18 18
19S = "${WORKDIR}/diffstat-${PV}"
20
21inherit autotools gettext ptest 19inherit autotools gettext ptest
22 20
23EXTRA_AUTORECONF += "--exclude=aclocal" 21EXTRA_AUTORECONF += "--exclude=aclocal"
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.45.6.bb b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.45.6.bb
index 15054768dd..e6a4bd1f8c 100644
--- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.45.6.bb
+++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.45.6.bb
@@ -125,6 +125,8 @@ do_compile_ptest() {
125} 125}
126 126
127do_install_ptest() { 127do_install_ptest() {
128 # This file's permissions depends on the host umask so be deterministic
129 chmod 0644 ${B}/tests/test_data.tmp
128 cp -R --no-dereference --preserve=mode,links -v ${B}/tests ${D}${PTEST_PATH}/test 130 cp -R --no-dereference --preserve=mode,links -v ${B}/tests ${D}${PTEST_PATH}/test
129 cp -R --no-dereference --preserve=mode,links -v ${S}/tests/* ${D}${PTEST_PATH}/test 131 cp -R --no-dereference --preserve=mode,links -v ${S}/tests/* ${D}${PTEST_PATH}/test
130 sed -e 's!../e2fsck/e2fsck!e2fsck!g' \ 132 sed -e 's!../e2fsck/e2fsck!e2fsck!g' \
diff --git a/meta/recipes-devtools/flex/flex/0001-Emit-no-line-directives-if-gen_line_dirs-is-false.patch b/meta/recipes-devtools/flex/flex/0001-Emit-no-line-directives-if-gen_line_dirs-is-false.patch
new file mode 100644
index 0000000000..c8202b6bd5
--- /dev/null
+++ b/meta/recipes-devtools/flex/flex/0001-Emit-no-line-directives-if-gen_line_dirs-is-false.patch
@@ -0,0 +1,32 @@
1From 440f3f55739468cd26e22f31871eca8cbbd53294 Mon Sep 17 00:00:00 2001
2From: Oleksiy Obitotskyy <oobitots@cisco.com>
3Date: Wed, 6 Jan 2021 06:12:14 -0800
4Subject: [PATCH] Emit no #line directives if gen_line_dirs is false
5
6If we set --noline we should not print line directives.
7But setting --noline means gen_line_dirs is false.
8
9Upstream-Status: Submitted
10Signed-off-by: Oleksiy Obitotskyy <oobitots@cisco.com>
11---
12 src/buf.c | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-)
14
15diff --git a/src/buf.c b/src/buf.c
16index 185083c..4439e28 100644
17--- a/src/buf.c
18+++ b/src/buf.c
19@@ -95,8 +95,8 @@ struct Buf *buf_linedir (struct Buf *buf, const char* filename, int lineno)
20 const char *src;
21 size_t tsz;
22
23- if (gen_line_dirs)
24- return buf;
25+ if (!gen_line_dirs)
26+ return buf;
27
28 tsz = strlen("#line \"\"\n") + /* constant parts */
29 2 * strlen (filename) + /* filename with possibly all backslashes escaped */
30--
312.26.2.Cisco
32
diff --git a/meta/recipes-devtools/flex/flex_2.6.4.bb b/meta/recipes-devtools/flex/flex_2.6.4.bb
index 3d57572865..1d43d2228a 100644
--- a/meta/recipes-devtools/flex/flex_2.6.4.bb
+++ b/meta/recipes-devtools/flex/flex_2.6.4.bb
@@ -16,6 +16,7 @@ SRC_URI = "https://github.com/westes/flex/releases/download/v${PV}/flex-${PV}.ta
16 ${@bb.utils.contains('PTEST_ENABLED', '1', '', 'file://disable-tests.patch', d)} \ 16 ${@bb.utils.contains('PTEST_ENABLED', '1', '', 'file://disable-tests.patch', d)} \
17 file://0001-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch \ 17 file://0001-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch \
18 file://check-funcs.patch \ 18 file://check-funcs.patch \
19 file://0001-Emit-no-line-directives-if-gen_line_dirs-is-false.patch \
19 " 20 "
20 21
21SRC_URI[md5sum] = "2882e3179748cc9f9c23ec593d6adc8d" 22SRC_URI[md5sum] = "2882e3179748cc9f9c23ec593d6adc8d"
diff --git a/meta/recipes-devtools/gcc/gcc-10.2.inc b/meta/recipes-devtools/gcc/gcc-10.2.inc
index 7625af5110..82f180db77 100644
--- a/meta/recipes-devtools/gcc/gcc-10.2.inc
+++ b/meta/recipes-devtools/gcc/gcc-10.2.inc
@@ -69,6 +69,7 @@ SRC_URI = "\
69 file://0002-aarch64-Introduce-SLS-mitigation-for-RET-and-BR-inst.patch \ 69 file://0002-aarch64-Introduce-SLS-mitigation-for-RET-and-BR-inst.patch \
70 file://0003-aarch64-Mitigate-SLS-for-BLR-instruction.patch \ 70 file://0003-aarch64-Mitigate-SLS-for-BLR-instruction.patch \
71 file://0001-aarch64-Fix-up-__aarch64_cas16_acq_rel-fallback.patch \ 71 file://0001-aarch64-Fix-up-__aarch64_cas16_acq_rel-fallback.patch \
72 file://0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch \
72" 73"
73SRC_URI[sha256sum] = "b8dd4368bb9c7f0b98188317ee0254dd8cc99d1e3a18d0ff146c855fe16c1d8c" 74SRC_URI[sha256sum] = "b8dd4368bb9c7f0b98188317ee0254dd8cc99d1e3a18d0ff146c855fe16c1d8c"
74 75
diff --git a/meta/recipes-devtools/gcc/gcc-sanitizers.inc b/meta/recipes-devtools/gcc/gcc-sanitizers.inc
index 668e14a59f..9e643ee277 100644
--- a/meta/recipes-devtools/gcc/gcc-sanitizers.inc
+++ b/meta/recipes-devtools/gcc/gcc-sanitizers.inc
@@ -35,6 +35,11 @@ do_compile () {
35do_install () { 35do_install () {
36 cd ${B}/${TARGET_SYS}/libsanitizer/ 36 cd ${B}/${TARGET_SYS}/libsanitizer/
37 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/ install 37 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/ install
38 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include ]; then
39 install -d ${D}${libdir}/${TARGET_SYS}/${BINV}/include
40 mv ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/* ${D}${libdir}/${TARGET_SYS}/${BINV}/include
41 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include
42 fi
38 if [ -d ${D}${infodir} ]; then 43 if [ -d ${D}${infodir} ]; then
39 rmdir --ignore-fail-on-non-empty -p ${D}${infodir} 44 rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
40 fi 45 fi
@@ -109,4 +114,4 @@ FILES_libtsan-dev += "\
109" 114"
110FILES_libtsan-staticdev += "${libdir}/libtsan.a" 115FILES_libtsan-staticdev += "${libdir}/libtsan.a"
111 116
112FILES_${PN} = "${libdir}/*.spec ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/sanitizer/*.h" 117FILES_${PN} = "${libdir}/*.spec ${libdir}/${TARGET_SYS}/${BINV}/include/sanitizer/*.h"
diff --git a/meta/recipes-devtools/gcc/gcc/0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch b/meta/recipes-devtools/gcc/gcc/0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch
new file mode 100644
index 0000000000..addecb4bd8
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc/0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch
@@ -0,0 +1,208 @@
1From 2824d2418605e092899117e77bc8ebf332321807 Mon Sep 17 00:00:00 2001
2From: Jakub Jelinek <jakub@redhat.com>
3Date: Fri, 15 Jan 2021 13:12:59 +0100
4Subject: [PATCH] libatomic, libgomp, libitc: Fix bootstrap [PR70454]
5
6The recent changes to error on mixing -march=i386 and -fcf-protection broke
7bootstrap. This patch changes lib{atomic,gomp,itm} configury, so that it
8only adds -march=i486 to flags if really needed (i.e. when 486 or later isn't
9on by default already). Similarly, it will not use ifuncs if -mcx16
10(or -march=i686 for 32-bit) is on by default.
11
122021-01-15 Jakub Jelinek <jakub@redhat.com>
13
14 PR target/70454
15libatomic/
16 * configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to
17 be added through preprocessor check on
18 __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4. Determine if try_ifunc is needed
19 based on preprocessor check on __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
20 or __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8.
21libgomp/
22 * configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to
23 be added through preprocessor check on
24 __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4.
25libitm/
26 * configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to
27 be added through preprocessor check on
28 __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4.
29
30Upstream-Status: Backport [master post 10.x release]
31---
32 libatomic/configure.tgt | 56 +++++++++++++++++++++++------------------
33 libgomp/configure.tgt | 35 +++++++++++---------------
34 libitm/configure.tgt | 37 +++++++++++++--------------
35 3 files changed, 64 insertions(+), 64 deletions(-)
36
37diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
38index 5dd0926d20..6ea082a29b 100644
39--- a/libatomic/configure.tgt
40+++ b/libatomic/configure.tgt
41@@ -81,32 +81,40 @@ case "${target_cpu}" in
42 ARCH=sparc
43 ;;
44
45- i[3456]86)
46- case " ${CC} ${CFLAGS} " in
47- *" -m64 "*|*" -mx32 "*)
48- ;;
49- *)
50- if test -z "$with_arch"; then
51- XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
52- XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
53- fi
54- esac
55- ARCH=x86
56- # ??? Detect when -march=i686 is already enabled.
57- try_ifunc=yes
58- ;;
59- x86_64)
60- case " ${CC} ${CFLAGS} " in
61- *" -m32 "*)
62+ i[3456]86 | x86_64)
63+ cat > conftestx.c <<EOF
64+#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
65+#error need -march=i486
66+#endif
67+EOF
68+ if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then
69+ :
70+ else
71+ if test "${target_cpu}" = x86_64; then
72 XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
73- XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
74- ;;
75- *)
76- ;;
77- esac
78+ else
79+ XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
80+ fi
81+ XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
82+ fi
83+ cat > conftestx.c <<EOF
84+#ifdef __x86_64__
85+#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
86+#error need -mcx16
87+#endif
88+#else
89+#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
90+#error need -march=i686
91+#endif
92+#endif
93+EOF
94+ if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then
95+ try_ifunc=no
96+ else
97+ try_ifunc=yes
98+ fi
99+ rm -f conftestx.c
100 ARCH=x86
101- # ??? Detect when -mcx16 is already enabled.
102- try_ifunc=yes
103 ;;
104
105 *) ARCH="${target_cpu}" ;;
106diff --git a/libgomp/configure.tgt b/libgomp/configure.tgt
107index 4790a31e39..761ef2a7db 100644
108--- a/libgomp/configure.tgt
109+++ b/libgomp/configure.tgt
110@@ -70,28 +70,23 @@ if test x$enable_linux_futex = xyes; then
111 ;;
112
113 # Note that bare i386 is not included here. We need cmpxchg.
114- i[456]86-*-linux*)
115+ i[456]86-*-linux* | x86_64-*-linux*)
116 config_path="linux/x86 linux posix"
117- case " ${CC} ${CFLAGS} " in
118- *" -m64 "*|*" -mx32 "*)
119- ;;
120- *)
121- if test -z "$with_arch"; then
122- XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
123- fi
124- esac
125- ;;
126-
127- # Similar jiggery-pokery for x86_64 multilibs, except here we
128- # can't rely on the --with-arch configure option, since that
129- # applies to the 64-bit side.
130- x86_64-*-linux*)
131- config_path="linux/x86 linux posix"
132- case " ${CC} ${CFLAGS} " in
133- *" -m32 "*)
134+ cat > conftestx.c <<EOF
135+#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
136+#error need -march=i486
137+#endif
138+EOF
139+ if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then
140+ :
141+ else
142+ if test "${target_cpu}" = x86_64; then
143 XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
144- ;;
145- esac
146+ else
147+ XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
148+ fi
149+ fi
150+ rm -f conftestx.c
151 ;;
152
153 # Note that sparcv7 and sparcv8 is not included here. We need cas.
154diff --git a/libitm/configure.tgt b/libitm/configure.tgt
155index 04109160e9..ca62bac627 100644
156--- a/libitm/configure.tgt
157+++ b/libitm/configure.tgt
158@@ -58,16 +58,23 @@ case "${target_cpu}" in
159
160 arm*) ARCH=arm ;;
161
162- i[3456]86)
163- case " ${CC} ${CFLAGS} " in
164- *" -m64 "*|*" -mx32 "*)
165- ;;
166- *)
167- if test -z "$with_arch"; then
168- XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
169- XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
170- fi
171- esac
172+ i[3456]86 | x86_64)
173+ cat > conftestx.c <<EOF
174+#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
175+#error need -march=i486
176+#endif
177+EOF
178+ if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then
179+ :
180+ else
181+ if test "${target_cpu}" = x86_64; then
182+ XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
183+ else
184+ XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
185+ fi
186+ XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
187+ fi
188+ rm -f conftestx.c
189 XCFLAGS="${XCFLAGS} -mrtm"
190 ARCH=x86
191 ;;
192@@ -102,16 +109,6 @@ case "${target_cpu}" in
193 ARCH=sparc
194 ;;
195
196- x86_64)
197- case " ${CC} ${CFLAGS} " in
198- *" -m32 "*)
199- XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
200- XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
201- ;;
202- esac
203- XCFLAGS="${XCFLAGS} -mrtm"
204- ARCH=x86
205- ;;
206 s390|s390x)
207 XCFLAGS="${XCFLAGS} -mzarch -mhtm"
208 ARCH=s390
diff --git a/meta/recipes-devtools/git/git.inc b/meta/recipes-devtools/git/git.inc
index 544e23c844..3e78254eec 100644
--- a/meta/recipes-devtools/git/git.inc
+++ b/meta/recipes-devtools/git/git.inc
@@ -7,7 +7,10 @@ DEPENDS = "openssl curl zlib expat"
7PROVIDES_append_class-native = " git-replacement-native" 7PROVIDES_append_class-native = " git-replacement-native"
8 8
9SRC_URI = "${KERNELORG_MIRROR}/software/scm/git/git-${PV}.tar.gz;name=tarball \ 9SRC_URI = "${KERNELORG_MIRROR}/software/scm/git/git-${PV}.tar.gz;name=tarball \
10 ${KERNELORG_MIRROR}/software/scm/git/git-manpages-${PV}.tar.gz;name=manpages" 10 ${KERNELORG_MIRROR}/software/scm/git/git-manpages-${PV}.tar.gz;name=manpages \
11 file://fixsort.patch \
12 file://CVE-2021-21300.patch \
13"
11 14
12S = "${WORKDIR}/git-${PV}" 15S = "${WORKDIR}/git-${PV}"
13 16
diff --git a/meta/recipes-devtools/git/git/CVE-2021-21300.patch b/meta/recipes-devtools/git/git/CVE-2021-21300.patch
new file mode 100644
index 0000000000..390570fe78
--- /dev/null
+++ b/meta/recipes-devtools/git/git/CVE-2021-21300.patch
@@ -0,0 +1,304 @@
1From ba07d31bd2140190c4d8c197c9b8a503544b4c29 Mon Sep 17 00:00:00 2001
2From: Minjae Kim <flowrgom@gmail.com>
3Date: Sat, 27 Mar 2021 14:05:56 +0900
4Subject: [PATCH] checkout: fix bug that makes checkout follow symlinks in
5 leading path
6
7Before checking out a file, we have to confirm that all of its leading
8components are real existing directories. And to reduce the number of
9lstat() calls in this process, we cache the last leading path known to
10contain only directories. However, when a path collision occurs (e.g.
11when checking out case-sensitive files in case-insensitive file
12systems), a cached path might have its file type changed on disk,
13leaving the cache on an invalid state. Normally, this doesn't bring
14any bad consequences as we usually check out files in index order, and
15therefore, by the time the cached path becomes outdated, we no longer
16need it anyway (because all files in that directory would have already
17been written).
18
19But, there are some users of the checkout machinery that do not always
20follow the index order. In particular: checkout-index writes the paths
21in the same order that they appear on the CLI (or stdin); and the
22delayed checkout feature -- used when a long-running filter process
23replies with "status=delayed" -- postpones the checkout of some entries,
24thus modifying the checkout order.
25
26When we have to check out an out-of-order entry and the lstat() cache is
27invalid (due to a previous path collision), checkout_entry() may end up
28using the invalid data and thrusting that the leading components are
29real directories when, in reality, they are not. In the best case
30scenario, where the directory was replaced by a regular file, the user
31will get an error: "fatal: unable to create file 'foo/bar': Not a
32directory". But if the directory was replaced by a symlink, checkout
33could actually end up following the symlink and writing the file at a
34wrong place, even outside the repository. Since delayed checkout is
35affected by this bug, it could be used by an attacker to write
36arbitrary files during the clone of a maliciously crafted repository.
37
38Some candidate solutions considered were to disable the lstat() cache
39during unordered checkouts or sort the entries before passing them to
40the checkout machinery. But both ideas include some performance penalty
41and they don't future-proof the code against new unordered use cases.
42
43Instead, we now manually reset the lstat cache whenever we successfully
44remove a directory. Note: We are not even checking whether the directory
45was the same as the lstat cache points to because we might face a
46scenario where the paths refer to the same location but differ due to
47case folding, precomposed UTF-8 issues, or the presence of `..`
48components in the path. Two regression tests, with case-collisions and
49utf8-collisions, are also added for both checkout-index and delayed
50checkout.
51
52Note: to make the previously mentioned clone attack unfeasible, it would
53be sufficient to reset the lstat cache only after the remove_subtree()
54call inside checkout_entry(). This is the place where we would remove a
55directory whose path collides with the path of another entry that we are
56currently trying to check out (possibly a symlink). However, in the
57interest of a thorough fix that does not leave Git open to
58similar-but-not-identical attack vectors, we decided to intercept
59all `rmdir()` calls in one fell swoop.
60
61This addresses CVE-2021-21300.
62
63Co-authored-by: Johannes Schindelin <johannes.schindelin@gmx.de>
64Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
65
66Upstream-Status: Acepted [https://github.com/git/git/commit/684dd4c2b414bcf648505e74498a608f28de4592]
67CVE: CVE-2021-21300
68Signed-off-by: Minjae Kim <flowergom@gmail.com>
69---
70 cache.h | 1 +
71 compat/mingw.c | 2 ++
72 git-compat-util.h | 5 +++++
73 symlinks.c | 24 ++++++++++++++++++++
74 t/t0021-conversion.sh | 39 ++++++++++++++++++++++++++++++++
75 t/t0021/rot13-filter.pl | 21 ++++++++++++++---
76 t/t2006-checkout-index-basic.sh | 40 +++++++++++++++++++++++++++++++++
77 7 files changed, 129 insertions(+), 3 deletions(-)
78
79diff --git a/cache.h b/cache.h
80index 6544264..64226c3 100644
81--- a/cache.h
82+++ b/cache.h
83@@ -1733,6 +1733,7 @@ int has_symlink_leading_path(const char *name, int len);
84 int threaded_has_symlink_leading_path(struct cache_def *, const char *, int);
85 int check_leading_path(const char *name, int len);
86 int has_dirs_only_path(const char *name, int len, int prefix_len);
87+extern void invalidate_lstat_cache(void);
88 void schedule_dir_for_removal(const char *name, int len);
89 void remove_scheduled_dirs(void);
90
91diff --git a/compat/mingw.c b/compat/mingw.c
92index 8ee0b64..be2b88e 100644
93--- a/compat/mingw.c
94+++ b/compat/mingw.c
95@@ -364,6 +364,8 @@ int mingw_rmdir(const char *pathname)
96 ask_yes_no_if_possible("Deletion of directory '%s' failed. "
97 "Should I try again?", pathname))
98 ret = _wrmdir(wpathname);
99+ if (!ret)
100+ invalidate_lstat_cache();
101 return ret;
102 }
103
104diff --git a/git-compat-util.h b/git-compat-util.h
105index 5637114..d983853 100644
106--- a/git-compat-util.h
107+++ b/git-compat-util.h
108@@ -345,6 +345,11 @@ static inline int noop_core_config(const char *var, const char *value, void *cb)
109 #define platform_core_config noop_core_config
110 #endif
111
112+int lstat_cache_aware_rmdir(const char *path);
113+#if !defined(__MINGW32__) && !defined(_MSC_VER)
114+#define rmdir lstat_cache_aware_rmdir
115+#endif
116+
117 #ifndef has_dos_drive_prefix
118 static inline int git_has_dos_drive_prefix(const char *path)
119 {
120diff --git a/symlinks.c b/symlinks.c
121index 69d458a..7dbb6b2 100644
122--- a/symlinks.c
123+++ b/symlinks.c
124@@ -267,6 +267,13 @@ int has_dirs_only_path(const char *name, int len, int prefix_len)
125 */
126 static int threaded_has_dirs_only_path(struct cache_def *cache, const char *name, int len, int prefix_len)
127 {
128+ /*
129+ * Note: this function is used by the checkout machinery, which also
130+ * takes care to properly reset the cache when it performs an operation
131+ * that would leave the cache outdated. If this function starts caching
132+ * anything else besides FL_DIR, remember to also invalidate the cache
133+ * when creating or deleting paths that might be in the cache.
134+ */
135 return lstat_cache(cache, name, len,
136 FL_DIR|FL_FULLPATH, prefix_len) &
137 FL_DIR;
138@@ -321,3 +328,20 @@ void remove_scheduled_dirs(void)
139 {
140 do_remove_scheduled_dirs(0);
141 }
142+
143+void invalidate_lstat_cache(void)
144+{
145+ reset_lstat_cache(&default_cache);
146+}
147+
148+#undef rmdir
149+int lstat_cache_aware_rmdir(const char *path)
150+{
151+ /* Any change in this function must be made also in `mingw_rmdir()` */
152+ int ret = rmdir(path);
153+
154+ if (!ret)
155+ invalidate_lstat_cache();
156+
157+ return ret;
158+}
159diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
160index 4bfffa9..c42f51e 100755
161--- a/t/t0021-conversion.sh
162+++ b/t/t0021-conversion.sh
163@@ -957,4 +957,43 @@ test_expect_success PERL 'invalid file in delayed checkout' '
164 grep "error: external filter .* signaled that .unfiltered. is now available although it has not been delayed earlier" git-stderr.log
165 '
166
167+for mode in 'case' 'utf-8'
168+do
169+ case "$mode" in
170+ case) dir='A' symlink='a' mode_prereq='CASE_INSENSITIVE_FS' ;;
171+ utf-8)
172+ dir=$(printf "\141\314\210") symlink=$(printf "\303\244")
173+ mode_prereq='UTF8_NFD_TO_NFC' ;;
174+ esac
175+
176+ test_expect_success PERL,SYMLINKS,$mode_prereq \
177+ "delayed checkout with $mode-collision don't write to the wrong place" '
178+ test_config_global filter.delay.process \
179+ "\"$TEST_ROOT/rot13-filter.pl\" --always-delay delayed.log clean smudge delay" &&
180+ test_config_global filter.delay.required true &&
181+ git init $mode-collision &&
182+ (
183+ cd $mode-collision &&
184+ mkdir target-dir &&
185+ empty_oid=$(printf "" | git hash-object -w --stdin) &&
186+ symlink_oid=$(printf "%s" "$PWD/target-dir" | git hash-object -w --stdin) &&
187+ attr_oid=$(echo "$dir/z filter=delay" | git hash-object -w --stdin) &&
188+ cat >objs <<-EOF &&
189+ 100644 blob $empty_oid $dir/x
190+ 100644 blob $empty_oid $dir/y
191+ 100644 blob $empty_oid $dir/z
192+ 120000 blob $symlink_oid $symlink
193+ 100644 blob $attr_oid .gitattributes
194+ EOF
195+ git update-index --index-info <objs &&
196+ git commit -m "test commit"
197+ ) &&
198+ git clone $mode-collision $mode-collision-cloned &&
199+ # Make sure z was really delayed
200+ grep "IN: smudge $dir/z .* \\[DELAYED\\]" $mode-collision-cloned/delayed.log &&
201+ # Should not create $dir/z at $symlink/z
202+ test_path_is_missing $mode-collision/target-dir/z
203+ '
204+done
205+
206 test_done
207diff --git a/t/t0021/rot13-filter.pl b/t/t0021/rot13-filter.pl
208index cd32a82..7bb9376 100644
209--- a/t/t0021/rot13-filter.pl
210+++ b/t/t0021/rot13-filter.pl
211@@ -2,9 +2,15 @@
212 # Example implementation for the Git filter protocol version 2
213 # See Documentation/gitattributes.txt, section "Filter Protocol"
214 #
215-# The first argument defines a debug log file that the script write to.
216-# All remaining arguments define a list of supported protocol
217-# capabilities ("clean", "smudge", etc).
218+# Usage: rot13-filter.pl [--always-delay] <log path> <capabilities>
219+#
220+# Log path defines a debug log file that the script writes to. The
221+# subsequent arguments define a list of supported protocol capabilities
222+# ("clean", "smudge", etc).
223+#
224+# When --always-delay is given all pathnames with the "can-delay" flag
225+# that don't appear on the list bellow are delayed with a count of 1
226+# (see more below).
227 #
228 # This implementation supports special test cases:
229 # (1) If data with the pathname "clean-write-fail.r" is processed with
230@@ -53,6 +59,13 @@ sub gitperllib {
231 use Git::Packet;
232
233 my $MAX_PACKET_CONTENT_SIZE = 65516;
234+
235+my $always_delay = 0;
236+if ( $ARGV[0] eq '--always-delay' ) {
237+ $always_delay = 1;
238+ shift @ARGV;
239+}
240+
241 my $log_file = shift @ARGV;
242 my @capabilities = @ARGV;
243
244@@ -134,6 +147,8 @@ sub rot13 {
245 if ( $buffer eq "can-delay=1" ) {
246 if ( exists $DELAY{$pathname} and $DELAY{$pathname}{"requested"} == 0 ) {
247 $DELAY{$pathname}{"requested"} = 1;
248+ } elsif ( !exists $DELAY{$pathname} and $always_delay ) {
249+ $DELAY{$pathname} = { "requested" => 1, "count" => 1 };
250 }
251 } elsif ($buffer =~ /^(ref|treeish|blob)=/) {
252 print $debug " $buffer";
253diff --git a/t/t2006-checkout-index-basic.sh b/t/t2006-checkout-index-basic.sh
254index 57cbdfe..f223a02 100755
255--- a/t/t2006-checkout-index-basic.sh
256+++ b/t/t2006-checkout-index-basic.sh
257@@ -21,4 +21,44 @@ test_expect_success 'checkout-index -h in broken repository' '
258 test_i18ngrep "[Uu]sage" broken/usage
259 '
260
261+for mode in 'case' 'utf-8'
262+do
263+ case "$mode" in
264+ case) dir='A' symlink='a' mode_prereq='CASE_INSENSITIVE_FS' ;;
265+ utf-8)
266+ dir=$(printf "\141\314\210") symlink=$(printf "\303\244")
267+ mode_prereq='UTF8_NFD_TO_NFC' ;;
268+ esac
269+
270+ test_expect_success SYMLINKS,$mode_prereq \
271+ "checkout-index with $mode-collision don't write to the wrong place" '
272+ git init $mode-collision &&
273+ (
274+ cd $mode-collision &&
275+ mkdir target-dir &&
276+ empty_obj_hex=$(git hash-object -w --stdin </dev/null) &&
277+ symlink_hex=$(printf "%s" "$PWD/target-dir" | git hash-object -w --stdin) &&
278+ cat >objs <<-EOF &&
279+ 100644 blob ${empty_obj_hex} ${dir}/x
280+ 100644 blob ${empty_obj_hex} ${dir}/y
281+ 100644 blob ${empty_obj_hex} ${dir}/z
282+ 120000 blob ${symlink_hex} ${symlink}
283+ EOF
284+ git update-index --index-info <objs &&
285+ # Note: the order is important here to exercise the
286+ # case where the file at ${dir} has its type changed by
287+ # the time Git tries to check out ${dir}/z.
288+ #
289+ # Also, we use core.precomposeUnicode=false because we
290+ # want Git to treat the UTF-8 paths transparently on
291+ # Mac OS, matching what is in the index.
292+ #
293+ git -c core.precomposeUnicode=false checkout-index -f \
294+ ${dir}/x ${dir}/y ${symlink} ${dir}/z &&
295+ # Should not create ${dir}/z at ${symlink}/z
296+ test_path_is_missing target-dir/z
297+ )
298+ '
299+done
300+
301 test_done
302--
3032.17.1
304
diff --git a/meta/recipes-devtools/git/git/fixsort.patch b/meta/recipes-devtools/git/git/fixsort.patch
new file mode 100644
index 0000000000..07a487e8ca
--- /dev/null
+++ b/meta/recipes-devtools/git/git/fixsort.patch
@@ -0,0 +1,31 @@
1[PATCH] generate-configlist.sh: Fix determinism issue
2
3Currently git binaries are not entirely reproducible, at least partly
4due to config-list.h differing in order depending on the system's
5locale settings. Under different locales, the entries:
6
7"sendemail.identity",
8"sendemail.<identity>.*",
9
10would differ in order for example and this leads to differences in
11the debug symbols for the binaries.
12
13This can be fixed by specifying the C locale for the sort in the
14shell script generating the header.
15
16Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
17Upstream-Status: Submitted [https://public-inbox.org/git/f029a942dd3d50d85e60bd37d8e454524987842f.camel@linuxfoundation.org/T/#u]
18
19Index: git-2.30.0/generate-configlist.sh
20===================================================================
21--- git-2.30.0.orig/generate-configlist.sh
22+++ git-2.30.0/generate-configlist.sh
23@@ -9,7 +9,7 @@ static const char *config_name_list[] =
24 EOF
25 grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt |
26 sed '/deprecated/d; s/::$//; s/, */\n/g' |
27- sort |
28+ LC_ALL=C sort |
29 sed 's/^.*$/ "&",/'
30 cat <<EOF
31 NULL,
diff --git a/meta/recipes-devtools/go/go-1.15.inc b/meta/recipes-devtools/go/go-1.15.inc
index 97d748b922..7c8190f68c 100644
--- a/meta/recipes-devtools/go/go-1.15.inc
+++ b/meta/recipes-devtools/go/go-1.15.inc
@@ -1,8 +1,7 @@
1require go-common.inc 1require go-common.inc
2 2
3GO_BASEVERSION = "1.15" 3GO_BASEVERSION = "1.15"
4GO_MINOR = ".2" 4PV = "1.15.8"
5PV .= "${GO_MINOR}"
6FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:" 5FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:"
7 6
8LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707" 7LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
@@ -17,4 +16,4 @@ SRC_URI += "\
17 file://0007-cmd-go-make-GOROOT-precious-by-default.patch \ 16 file://0007-cmd-go-make-GOROOT-precious-by-default.patch \
18 file://0008-use-GOBUILDMODE-to-set-buildmode.patch \ 17 file://0008-use-GOBUILDMODE-to-set-buildmode.patch \
19" 18"
20SRC_URI[main.sha256sum] = "28bf9d0bcde251011caae230a4a05d917b172ea203f2a62f2c2f9533589d4b4d" 19SRC_URI[main.sha256sum] = "540c0ab7781084d124991321ed1458e479982de94454a98afab6acadf38497c2"
diff --git a/meta/recipes-devtools/go/go-binary-native_1.15.2.bb b/meta/recipes-devtools/go/go-binary-native_1.15.8.bb
index ccd2d5ebad..df697e2781 100644
--- a/meta/recipes-devtools/go/go-binary-native_1.15.2.bb
+++ b/meta/recipes-devtools/go/go-binary-native_1.15.8.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] = "b49fda1ca29a1946d6bb2a5a6982cf07ccd2aba849289508ee0f9918f6bb4552" 11SRC_URI[go_linux_amd64.sha256sum] = "d3379c32a90fdf9382166f8f48034c459a8cc433730bc9476d39d9082c94583b"
12SRC_URI[go_linux_arm64.sha256sum] = "c8ec460cc82d61604b048f9439c06bd591722efce5cd48f49e19b5f6226bd36d" 12SRC_URI[go_linux_arm64.sha256sum] = "0e31ea4bf53496b0f0809730520dee98c0ae5c530f3701a19df0ba0a327bf3d2"
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-runtime_1.15.bb b/meta/recipes-devtools/go/go-runtime_1.15.bb
index 4eeee65e0c..d6ddb31ed4 100644
--- a/meta/recipes-devtools/go/go-runtime_1.15.bb
+++ b/meta/recipes-devtools/go/go-runtime_1.15.bb
@@ -1,3 +1,4 @@
1export CGO_ENABLED_riscv64 = "" 1export CGO_ENABLED_riscv64 = ""
2require go-${PV}.inc 2require go-${PV}.inc
3require go-runtime.inc 3require go-runtime.inc
4
diff --git a/meta/recipes-devtools/go/go_1.15.bb b/meta/recipes-devtools/go/go_1.15.bb
index 4bf9dd50b2..d4812c0f0a 100644
--- a/meta/recipes-devtools/go/go_1.15.bb
+++ b/meta/recipes-devtools/go/go_1.15.bb
@@ -6,6 +6,8 @@ inherit linuxloader
6export GOBUILDMODE="" 6export GOBUILDMODE=""
7export CGO_ENABLED_riscv64 = "" 7export CGO_ENABLED_riscv64 = ""
8export GO_LDSO = "${@get_linuxloader(d)}" 8export GO_LDSO = "${@get_linuxloader(d)}"
9export CC_FOR_TARGET = "gcc"
10export CXX_FOR_TARGET = "g++"
9 11
10# mips/rv64 doesn't support -buildmode=pie, so skip the QA checking for mips/riscv and its 12# mips/rv64 doesn't support -buildmode=pie, so skip the QA checking for mips/riscv and its
11# variants. 13# variants.
@@ -13,3 +15,4 @@ python() {
13 if 'mips' in d.getVar('TARGET_ARCH',True) or 'riscv' in d.getVar('TARGET_ARCH',True): 15 if 'mips' in d.getVar('TARGET_ARCH',True) or 'riscv' in d.getVar('TARGET_ARCH',True):
14 d.appendVar('INSANE_SKIP_%s' % d.getVar('PN',True), " textrel") 16 d.appendVar('INSANE_SKIP_%s' % d.getVar('PN',True), " textrel")
15} 17}
18
diff --git a/meta/recipes-devtools/libtool/libtool-2.4.6.inc b/meta/recipes-devtools/libtool/libtool-2.4.6.inc
index 8e17b56d46..19a03d4733 100644
--- a/meta/recipes-devtools/libtool/libtool-2.4.6.inc
+++ b/meta/recipes-devtools/libtool/libtool-2.4.6.inc
@@ -21,6 +21,7 @@ SRC_URI = "${GNU_MIRROR}/libtool/libtool-${PV}.tar.gz \
21 file://unwind-opt-parsing.patch \ 21 file://unwind-opt-parsing.patch \
22 file://0001-libtool-Fix-support-for-NIOS2-processor.patch \ 22 file://0001-libtool-Fix-support-for-NIOS2-processor.patch \
23 file://0001-libtool-Check-for-static-libs-for-internal-compiler-.patch \ 23 file://0001-libtool-Check-for-static-libs-for-internal-compiler-.patch \
24 file://0001-Makefile.am-make-sure-autoheader-run-before-autoconf.patch \
24 " 25 "
25 26
26SRC_URI[md5sum] = "addf44b646ddb4e3919805aa88fa7c5e" 27SRC_URI[md5sum] = "addf44b646ddb4e3919805aa88fa7c5e"
diff --git a/meta/recipes-devtools/libtool/libtool/0001-Makefile.am-make-sure-autoheader-run-before-autoconf.patch b/meta/recipes-devtools/libtool/libtool/0001-Makefile.am-make-sure-autoheader-run-before-autoconf.patch
new file mode 100644
index 0000000000..2e9908725e
--- /dev/null
+++ b/meta/recipes-devtools/libtool/libtool/0001-Makefile.am-make-sure-autoheader-run-before-autoconf.patch
@@ -0,0 +1,35 @@
1From dfbbbd359e43e0a55fbea06f2647279ad8761cb9 Mon Sep 17 00:00:00 2001
2From: Mingli Yu <mingli.yu@windriver.com>
3Date: Wed, 24 Mar 2021 03:04:13 +0000
4Subject: [PATCH] Makefile.am: make sure autoheader run before autoconf
5
6autoheader will update ../libtool-2.4.6/libltdl/config-h.in which
7autoconf needs, so there comes a race sometimes as below:
8 | configure.ac:45: error: required file 'config-h.in' not found
9 | touch '../libtool-2.4.6/libltdl/config-h.in'
10
11So make sure autoheader run before autoconf to avoid this race.
12
13Upstream-Status: Submitted [libtool-patches@gnu.org maillist]
14
15Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
16---
17 Makefile.am | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
20diff --git a/Makefile.am b/Makefile.am
21index 4142c90..fe1a9fc 100644
22--- a/Makefile.am
23+++ b/Makefile.am
24@@ -365,7 +365,7 @@ lt_configure_deps = $(lt_aclocal_m4) $(lt_aclocal_m4_deps)
25 $(lt_aclocal_m4): $(lt_aclocal_m4_deps)
26 $(AM_V_GEN)cd '$(srcdir)/$(ltdl_dir)' && $(ACLOCAL) -I ../m4
27
28-$(lt_configure): $(lt_configure_deps)
29+$(lt_configure): $(lt_configure_deps) $(lt_config_h_in)
30 $(AM_V_GEN)cd '$(srcdir)/$(ltdl_dir)' && $(AUTOCONF)
31
32 $(lt_config_h_in): $(lt_configure_deps)
33--
342.29.2
35
diff --git a/meta/recipes-devtools/llvm/llvm_git.bb b/meta/recipes-devtools/llvm/llvm_git.bb
index 4c2d490315..b146d0e6e3 100644
--- a/meta/recipes-devtools/llvm/llvm_git.bb
+++ b/meta/recipes-devtools/llvm/llvm_git.bb
@@ -99,6 +99,11 @@ do_configure_prepend() {
99 sed -ri "s#lib/${LLVM_DIR}#${baselib}/${LLVM_DIR}#g" ${S}/tools/llvm-config/llvm-config.cpp 99 sed -ri "s#lib/${LLVM_DIR}#${baselib}/${LLVM_DIR}#g" ${S}/tools/llvm-config/llvm-config.cpp
100} 100}
101 101
102# patch out build host paths for reproducibility
103do_compile_prepend_class-target() {
104 sed -i -e "s,${WORKDIR},,g" ${B}/tools/llvm-config/BuildVariables.inc
105}
106
102do_compile() { 107do_compile() {
103 ninja -v ${PARALLEL_MAKE} 108 ninja -v ${PARALLEL_MAKE}
104} 109}
diff --git a/meta/recipes-devtools/mtd/mtd-utils_git.bb b/meta/recipes-devtools/mtd/mtd-utils_git.bb
index 8d6bbfca3f..ff42219513 100644
--- a/meta/recipes-devtools/mtd/mtd-utils_git.bb
+++ b/meta/recipes-devtools/mtd/mtd-utils_git.bb
@@ -42,11 +42,9 @@ ALTERNATIVE_PRIORITY = "100"
42ALTERNATIVE_${PN} = "flashcp flash_eraseall flash_lock flash_unlock nanddump nandwrite" 42ALTERNATIVE_${PN} = "flashcp flash_eraseall flash_lock flash_unlock nanddump nandwrite"
43ALTERNATIVE_${PN}-ubifs = "ubiattach ubidetach ubimkvol ubirename ubirmvol ubirsvol ubiupdatevol" 43ALTERNATIVE_${PN}-ubifs = "ubiattach ubidetach ubimkvol ubirename ubirmvol ubirsvol ubiupdatevol"
44 44
45ALTERNATIVE_LINK_NAME[flash_eraseall] = "${sbindir}/flash_eraseall"
46ALTERNATIVE_LINK_NAME[nandwrite] = "${sbindir}/nandwrite" 45ALTERNATIVE_LINK_NAME[nandwrite] = "${sbindir}/nandwrite"
47ALTERNATIVE_LINK_NAME[nanddump] = "${sbindir}/nanddump" 46ALTERNATIVE_LINK_NAME[nanddump] = "${sbindir}/nanddump"
48ALTERNATIVE_LINK_NAME[ubiattach] = "${sbindir}/ubiattach" 47ALTERNATIVE_LINK_NAME[ubiattach] = "${sbindir}/ubiattach"
49ALTERNATIVE_LINK_NAME[ubiattach] = "${sbindir}/ubiattach"
50ALTERNATIVE_LINK_NAME[ubidetach] = "${sbindir}/ubidetach" 48ALTERNATIVE_LINK_NAME[ubidetach] = "${sbindir}/ubidetach"
51ALTERNATIVE_LINK_NAME[ubimkvol] = "${sbindir}/ubimkvol" 49ALTERNATIVE_LINK_NAME[ubimkvol] = "${sbindir}/ubimkvol"
52ALTERNATIVE_LINK_NAME[ubirename] = "${sbindir}/ubirename" 50ALTERNATIVE_LINK_NAME[ubirename] = "${sbindir}/ubirename"
diff --git a/meta/recipes-devtools/opkg/opkg/sourcedateepoch.patch b/meta/recipes-devtools/opkg/opkg/sourcedateepoch.patch
new file mode 100644
index 0000000000..4578fa33be
--- /dev/null
+++ b/meta/recipes-devtools/opkg/opkg/sourcedateepoch.patch
@@ -0,0 +1,24 @@
1Having CLEAN_DATE come from the current date doesn't allow for build
2reproducibility. Add the option of using SOURCE_DATE_EPOCH if set
3which for OE, it will be.
4
5Upstream-Status: Pending
6RP 2021/2/2
7
8Index: opkg-0.4.4/configure.ac
9===================================================================
10--- opkg-0.4.4.orig/configure.ac
11+++ opkg-0.4.4/configure.ac
12@@ -281,7 +281,11 @@ AC_FUNC_UTIME_NULL
13 AC_FUNC_VPRINTF
14 AC_CHECK_FUNCS([memmove memset mkdir regcomp strchr strcspn strdup strerror strndup strrchr strstr strtol strtoul sysinfo utime])
15
16-CLEAN_DATE=`date +"%B %Y" | tr -d '\n'`
17+if ! test -z "$SOURCE_DATE_EPOCH" ; then
18+ CLEAN_DATE=`LC_ALL=C date -d @$SOURCE_DATE_EPOCH +"%B %Y" | tr -d '\n'`
19+else
20+ CLEAN_DATE=`date +"%B %Y" | tr -d '\n'`
21+fi
22
23 AC_SUBST([CLEAN_DATE])
24
diff --git a/meta/recipes-devtools/opkg/opkg_0.4.3.bb b/meta/recipes-devtools/opkg/opkg_0.4.3.bb
index 46b7aa2523..ea01d473fc 100644
--- a/meta/recipes-devtools/opkg/opkg_0.4.3.bb
+++ b/meta/recipes-devtools/opkg/opkg_0.4.3.bb
@@ -14,6 +14,7 @@ PE = "1"
14SRC_URI = "http://downloads.yoctoproject.org/releases/${BPN}/${BPN}-${PV}.tar.gz \ 14SRC_URI = "http://downloads.yoctoproject.org/releases/${BPN}/${BPN}-${PV}.tar.gz \
15 file://opkg.conf \ 15 file://opkg.conf \
16 file://0001-opkg_conf-create-opkg.lock-in-run-instead-of-var-run.patch \ 16 file://0001-opkg_conf-create-opkg.lock-in-run-instead-of-var-run.patch \
17 file://sourcedateepoch.patch \
17 file://run-ptest \ 18 file://run-ptest \
18" 19"
19 20
diff --git a/meta/recipes-devtools/patch/patch/CVE-2019-20633.patch b/meta/recipes-devtools/patch/patch/CVE-2019-20633.patch
new file mode 100644
index 0000000000..03988a179c
--- /dev/null
+++ b/meta/recipes-devtools/patch/patch/CVE-2019-20633.patch
@@ -0,0 +1,31 @@
1From 15b158db3ae11cb835f2eb8d2eb48e09d1a4af48 Mon Sep 17 00:00:00 2001
2From: Andreas Gruenbacher <agruen@gnu.org>
3Date: Mon, 15 Jul 2019 19:10:02 +0200
4Subject: Avoid invalid memory access in context format diffs
5
6* src/pch.c (another_hunk): Avoid invalid memory access in context format
7diffs.
8
9CVE: CVE-2019-20633
10Upstream-Status: Backport[https://git.savannah.gnu.org/cgit/patch.git/patch/?id=15b158db3ae11cb835f2eb8d2eb48e09d1a4af48]
11Signed-off-by: Scott Murray <scott.murray@konsulko.com>
12
13---
14 src/pch.c | 1 +
15 1 file changed, 1 insertion(+)
16
17diff --git a/src/pch.c b/src/pch.c
18index a500ad9..cb54e03 100644
19--- a/src/pch.c
20+++ b/src/pch.c
21@@ -1328,6 +1328,7 @@ another_hunk (enum diff difftype, bool rev)
22 ptrn_prefix_context = context;
23 ptrn_suffix_context = context;
24 if (repl_beginning
25+ || p_end <= 0
26 || (p_end
27 != p_ptrn_lines + 1 + (p_Char[p_end - 1] == '\n')))
28 {
29--
30cgit v1.2.1
31
diff --git a/meta/recipes-devtools/patch/patch_2.7.6.bb b/meta/recipes-devtools/patch/patch_2.7.6.bb
index b5897b357a..1997af0c25 100644
--- a/meta/recipes-devtools/patch/patch_2.7.6.bb
+++ b/meta/recipes-devtools/patch/patch_2.7.6.bb
@@ -10,6 +10,7 @@ SRC_URI += "file://0001-Unset-need_charset_alias-when-building-for-musl.patch \
10 file://0001-Invoke-ed-directly-instead-of-using-the-shell.patch \ 10 file://0001-Invoke-ed-directly-instead-of-using-the-shell.patch \
11 file://0001-Don-t-leak-temporary-file-on-failed-ed-style-patch.patch \ 11 file://0001-Don-t-leak-temporary-file-on-failed-ed-style-patch.patch \
12 file://0001-Don-t-leak-temporary-file-on-failed-multi-file-ed.patch \ 12 file://0001-Don-t-leak-temporary-file-on-failed-multi-file-ed.patch \
13 file://CVE-2019-20633.patch \
13" 14"
14 15
15SRC_URI[md5sum] = "4c68cee989d83c87b00a3860bcd05600" 16SRC_URI[md5sum] = "4c68cee989d83c87b00a3860bcd05600"
diff --git a/meta/recipes-devtools/perl/perl_5.32.0.bb b/meta/recipes-devtools/perl/perl_5.32.0.bb
index bba8263b90..3815dd44b1 100644
--- a/meta/recipes-devtools/perl/perl_5.32.0.bb
+++ b/meta/recipes-devtools/perl/perl_5.32.0.bb
@@ -137,8 +137,9 @@ do_install() {
137 install lib/ExtUtils/typemap ${D}${libdir}/perl5/${PV}/ExtUtils/ 137 install lib/ExtUtils/typemap ${D}${libdir}/perl5/${PV}/ExtUtils/
138 138
139 # Fix up shared library 139 # Fix up shared library
140 rm ${D}/${libdir}/perl5/${PV}/*/CORE/libperl.so 140 dir=$(echo ${D}/${libdir}/perl5/${PV}/*/CORE)
141 ln -sf ../../../../libperl.so.${PERL_LIB_VER} $(echo ${D}/${libdir}/perl5/${PV}/*/CORE)/libperl.so 141 rm $dir/libperl.so
142 ln -sf ../../../../libperl.so.${PERL_LIB_VER} $dir/libperl.so
142 143
143 # Try to catch Bug #13946 144 # Try to catch Bug #13946
144 if [ -e ${D}/${libdir}/perl5/${PV}/Storable.pm ]; then 145 if [ -e ${D}/${libdir}/perl5/${PV}/Storable.pm ]; then
diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
index 2e13fec540..4eab133128 100644
--- a/meta/recipes-devtools/pseudo/pseudo_git.bb
+++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
@@ -6,7 +6,7 @@ SRC_URI = "git://git.yoctoproject.org/pseudo;branch=oe-core \
6 file://fallback-group \ 6 file://fallback-group \
7 " 7 "
8 8
9SRCREV = "cca0d7f15b7197095cd587420d31b187620c3093" 9SRCREV = "ee24ebec9e5a11dd5208c9be2870f35eab3b9e20"
10S = "${WORKDIR}/git" 10S = "${WORKDIR}/git"
11PV = "1.9.0+git${SRCPV}" 11PV = "1.9.0+git${SRCPV}"
12 12
diff --git a/meta/recipes-devtools/python/python3-jinja2_2.11.2.bb b/meta/recipes-devtools/python/python3-jinja2_2.11.2.bb
index 89538d2f27..9d0666a5c1 100644
--- a/meta/recipes-devtools/python/python3-jinja2_2.11.2.bb
+++ b/meta/recipes-devtools/python/python3-jinja2_2.11.2.bb
@@ -7,6 +7,8 @@ SRC_URI[sha256sum] = "89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c65
7 7
8PYPI_PACKAGE = "Jinja2" 8PYPI_PACKAGE = "Jinja2"
9 9
10CVE_PRODUCT = "jinja2 jinja"
11
10CLEANBROKEN = "1" 12CLEANBROKEN = "1"
11 13
12inherit pypi setuptools3 14inherit pypi setuptools3
diff --git a/meta/recipes-devtools/python/python3-pycairo_1.19.1.bb b/meta/recipes-devtools/python/python3-pycairo_1.19.1.bb
index 34c8543bce..1734610d12 100644
--- a/meta/recipes-devtools/python/python3-pycairo_1.19.1.bb
+++ b/meta/recipes-devtools/python/python3-pycairo_1.19.1.bb
@@ -18,7 +18,7 @@ SRC_URI[sha256sum] = "2c143183280feb67f5beb4e543fd49990c28e7df427301ede04fc550d3
18 18
19S = "${WORKDIR}/pycairo-${PV}" 19S = "${WORKDIR}/pycairo-${PV}"
20 20
21inherit meson pkgconfig 21inherit meson pkgconfig python3targetconfig
22 22
23CFLAGS += "-fPIC" 23CFLAGS += "-fPIC"
24 24
diff --git a/meta/recipes-devtools/python/python3/CVE-2021-23336.patch b/meta/recipes-devtools/python/python3/CVE-2021-23336.patch
new file mode 100644
index 0000000000..27893f69fb
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/CVE-2021-23336.patch
@@ -0,0 +1,548 @@
1From e3110c3cfbb7daa690d54d0eff6c264c870a71bf Mon Sep 17 00:00:00 2001
2From: Senthil Kumaran <senthil@uthcode.com>
3Date: Mon, 15 Feb 2021 10:15:02 -0800
4Subject: [PATCH] [3.8] bpo-42967: only use '&' as a query string separator
5 (GH-24297) (#24529)
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10* bpo-42967: only use '&' as a query string separator (#24297)
11
12bpo-42967: [security] Address a web cache-poisoning issue reported in
13urllib.parse.parse_qsl().
14
15urllib.parse will only us "&" as query string separator by default
16instead of both ";" and "&" as allowed in earlier versions. An optional
17argument seperator with default value "&" is added to specify the
18separator.
19
20Co-authored-by: Éric Araujo <merwok@netwok.org>
21Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
22Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
23Co-authored-by: Éric Araujo <merwok@netwok.org>
24(cherry picked from commit fcbe0cb04d35189401c0c880ebfb4311e952d776)
25
26* [3.8] bpo-42967: only use '&' as a query string separator (GH-24297)
27
28bpo-42967: [security] Address a web cache-poisoning issue reported in urllib.parse.parse_qsl().
29
30urllib.parse will only us "&" as query string separator by default instead of both ";" and "&" as allowed in earlier versions. An optional argument seperator with default value "&" is added to specify the separator.
31
32Co-authored-by: Éric Araujo <merwok@netwok.org>
33Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
34Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
35Co-authored-by: Éric Araujo <merwok@netwok.org>.
36(cherry picked from commit fcbe0cb04d35189401c0c880ebfb4311e952d776)
37
38Co-authored-by: Adam Goldschmidt <adamgold7@gmail.com>
39
40* Update correct version information.
41
42* fix docs and make logic clearer
43
44Co-authored-by: Adam Goldschmidt <adamgold7@gmail.com>
45Co-authored-by: Fidget-Spinner <28750310+Fidget-Spinner@users.noreply.github.com>
46
47Upstream-Status: Backport [https://github.com/python/cpython/commit/e3110c3cfbb7daa690d54d0eff6c264c870a71bf]
48CVE: CVE-2020-23336
49Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
50
51---
52 Doc/library/cgi.rst | 11 ++-
53 Doc/library/urllib.parse.rst | 22 +++++-
54 Doc/whatsnew/3.6.rst | 13 ++++
55 Doc/whatsnew/3.7.rst | 13 ++++
56 Doc/whatsnew/3.8.rst | 13 ++++
57 Lib/cgi.py | 23 ++++---
58 Lib/test/test_cgi.py | 29 ++++++--
59 Lib/test/test_urlparse.py | 68 +++++++++++++------
60 Lib/urllib/parse.py | 19 ++++--
61 .../2021-02-14-15-59-16.bpo-42967.YApqDS.rst | 1 +
62 10 files changed, 166 insertions(+), 46 deletions(-)
63 create mode 100644 Misc/NEWS.d/next/Security/2021-02-14-15-59-16.bpo-42967.YApqDS.rst
64
65diff --git a/Doc/library/cgi.rst b/Doc/library/cgi.rst
66index 4048592e7361f..880074bed6026 100644
67--- a/Doc/library/cgi.rst
68+++ b/Doc/library/cgi.rst
69@@ -277,14 +277,16 @@ These are useful if you want more control, or if you want to employ some of the
70 algorithms implemented in this module in other circumstances.
71
72
73-.. function:: parse(fp=None, environ=os.environ, keep_blank_values=False, strict_parsing=False)
74+.. function:: parse(fp=None, environ=os.environ, keep_blank_values=False, strict_parsing=False, separator="&")
75
76 Parse a query in the environment or from a file (the file defaults to
77- ``sys.stdin``). The *keep_blank_values* and *strict_parsing* parameters are
78+ ``sys.stdin``). The *keep_blank_values*, *strict_parsing* and *separator* parameters are
79 passed to :func:`urllib.parse.parse_qs` unchanged.
80
81+ .. versionchanged:: 3.8.8
82+ Added the *separator* parameter.
83
84-.. function:: parse_multipart(fp, pdict, encoding="utf-8", errors="replace")
85+.. function:: parse_multipart(fp, pdict, encoding="utf-8", errors="replace", separator="&")
86
87 Parse input of type :mimetype:`multipart/form-data` (for file uploads).
88 Arguments are *fp* for the input file, *pdict* for a dictionary containing
89@@ -303,6 +305,9 @@ algorithms implemented in this module in other circumstances.
90 Added the *encoding* and *errors* parameters. For non-file fields, the
91 value is now a list of strings, not bytes.
92
93+ .. versionchanged:: 3.8.8
94+ Added the *separator* parameter.
95+
96
97 .. function:: parse_header(string)
98
99diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst
100index 25e5cc1a6ce0b..fcad7076e6c77 100644
101--- a/Doc/library/urllib.parse.rst
102+++ b/Doc/library/urllib.parse.rst
103@@ -165,7 +165,7 @@ or on combining URL components into a URL string.
104 now raise :exc:`ValueError`.
105
106
107-.. function:: parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None)
108+.. function:: parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None, separator='&')
109
110 Parse a query string given as a string argument (data of type
111 :mimetype:`application/x-www-form-urlencoded`). Data are returned as a
112@@ -190,6 +190,9 @@ or on combining URL components into a URL string.
113 read. If set, then throws a :exc:`ValueError` if there are more than
114 *max_num_fields* fields read.
115
116+ The optional argument *separator* is the symbol to use for separating the
117+ query arguments. It defaults to ``&``.
118+
119 Use the :func:`urllib.parse.urlencode` function (with the ``doseq``
120 parameter set to ``True``) to convert such dictionaries into query
121 strings.
122@@ -201,8 +204,14 @@ or on combining URL components into a URL string.
123 .. versionchanged:: 3.8
124 Added *max_num_fields* parameter.
125
126+ .. versionchanged:: 3.8.8
127+ Added *separator* parameter with the default value of ``&``. Python
128+ versions earlier than Python 3.8.8 allowed using both ``;`` and ``&`` as
129+ query parameter separator. This has been changed to allow only a single
130+ separator key, with ``&`` as the default separator.
131+
132
133-.. function:: parse_qsl(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None)
134+.. function:: parse_qsl(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None, separator='&')
135
136 Parse a query string given as a string argument (data of type
137 :mimetype:`application/x-www-form-urlencoded`). Data are returned as a list of
138@@ -226,6 +235,9 @@ or on combining URL components into a URL string.
139 read. If set, then throws a :exc:`ValueError` if there are more than
140 *max_num_fields* fields read.
141
142+ The optional argument *separator* is the symbol to use for separating the
143+ query arguments. It defaults to ``&``.
144+
145 Use the :func:`urllib.parse.urlencode` function to convert such lists of pairs into
146 query strings.
147
148@@ -235,6 +247,12 @@ or on combining URL components into a URL string.
149 .. versionchanged:: 3.8
150 Added *max_num_fields* parameter.
151
152+ .. versionchanged:: 3.8.8
153+ Added *separator* parameter with the default value of ``&``. Python
154+ versions earlier than Python 3.8.8 allowed using both ``;`` and ``&`` as
155+ query parameter separator. This has been changed to allow only a single
156+ separator key, with ``&`` as the default separator.
157+
158
159 .. function:: urlunparse(parts)
160
161diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst
162index 85a6657fdfbda..03a877a3d9178 100644
163--- a/Doc/whatsnew/3.6.rst
164+++ b/Doc/whatsnew/3.6.rst
165@@ -2443,3 +2443,16 @@ because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For more
166 details, see the documentation for ``loop.create_datagram_endpoint()``.
167 (Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in
168 :issue:`37228`.)
169+
170+Notable changes in Python 3.6.13
171+================================
172+
173+Earlier Python versions allowed using both ``;`` and ``&`` as
174+query parameter separators in :func:`urllib.parse.parse_qs` and
175+:func:`urllib.parse.parse_qsl`. Due to security concerns, and to conform with
176+newer W3C recommendations, this has been changed to allow only a single
177+separator key, with ``&`` as the default. This change also affects
178+:func:`cgi.parse` and :func:`cgi.parse_multipart` as they use the affected
179+functions internally. For more details, please see their respective
180+documentation.
181+(Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)
182diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst
183index 4933cba3990b1..824dc13e0c6fd 100644
184--- a/Doc/whatsnew/3.7.rst
185+++ b/Doc/whatsnew/3.7.rst
186@@ -2556,3 +2556,16 @@ because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For more
187 details, see the documentation for ``loop.create_datagram_endpoint()``.
188 (Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in
189 :issue:`37228`.)
190+
191+Notable changes in Python 3.7.10
192+================================
193+
194+Earlier Python versions allowed using both ``;`` and ``&`` as
195+query parameter separators in :func:`urllib.parse.parse_qs` and
196+:func:`urllib.parse.parse_qsl`. Due to security concerns, and to conform with
197+newer W3C recommendations, this has been changed to allow only a single
198+separator key, with ``&`` as the default. This change also affects
199+:func:`cgi.parse` and :func:`cgi.parse_multipart` as they use the affected
200+functions internally. For more details, please see their respective
201+documentation.
202+(Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)
203diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
204index 1a192800b2f02..632ccc1f2c40a 100644
205--- a/Doc/whatsnew/3.8.rst
206+++ b/Doc/whatsnew/3.8.rst
207@@ -2251,3 +2251,16 @@ The constant values of future flags in the :mod:`__future__` module
208 are updated in order to prevent collision with compiler flags. Previously
209 ``PyCF_ALLOW_TOP_LEVEL_AWAIT`` was clashing with ``CO_FUTURE_DIVISION``.
210 (Contributed by Batuhan Taskaya in :issue:`39562`)
211+
212+Notable changes in Python 3.8.8
213+===============================
214+
215+Earlier Python versions allowed using both ``;`` and ``&`` as
216+query parameter separators in :func:`urllib.parse.parse_qs` and
217+:func:`urllib.parse.parse_qsl`. Due to security concerns, and to conform with
218+newer W3C recommendations, this has been changed to allow only a single
219+separator key, with ``&`` as the default. This change also affects
220+:func:`cgi.parse` and :func:`cgi.parse_multipart` as they use the affected
221+functions internally. For more details, please see their respective
222+documentation.
223+(Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)
224diff --git a/Lib/cgi.py b/Lib/cgi.py
225index 77ab703cc0360..1e880e51848af 100755
226--- a/Lib/cgi.py
227+++ b/Lib/cgi.py
228@@ -115,7 +115,8 @@ def closelog():
229 # 0 ==> unlimited input
230 maxlen = 0
231
232-def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0):
233+def parse(fp=None, environ=os.environ, keep_blank_values=0,
234+ strict_parsing=0, separator='&'):
235 """Parse a query in the environment or from a file (default stdin)
236
237 Arguments, all optional:
238@@ -134,6 +135,9 @@ def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0):
239 strict_parsing: flag indicating what to do with parsing errors.
240 If false (the default), errors are silently ignored.
241 If true, errors raise a ValueError exception.
242+
243+ separator: str. The symbol to use for separating the query arguments.
244+ Defaults to &.
245 """
246 if fp is None:
247 fp = sys.stdin
248@@ -154,7 +158,7 @@ def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0):
249 if environ['REQUEST_METHOD'] == 'POST':
250 ctype, pdict = parse_header(environ['CONTENT_TYPE'])
251 if ctype == 'multipart/form-data':
252- return parse_multipart(fp, pdict)
253+ return parse_multipart(fp, pdict, separator=separator)
254 elif ctype == 'application/x-www-form-urlencoded':
255 clength = int(environ['CONTENT_LENGTH'])
256 if maxlen and clength > maxlen:
257@@ -178,10 +182,10 @@ def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0):
258 qs = ""
259 environ['QUERY_STRING'] = qs # XXX Shouldn't, really
260 return urllib.parse.parse_qs(qs, keep_blank_values, strict_parsing,
261- encoding=encoding)
262+ encoding=encoding, separator=separator)
263
264
265-def parse_multipart(fp, pdict, encoding="utf-8", errors="replace"):
266+def parse_multipart(fp, pdict, encoding="utf-8", errors="replace", separator='&'):
267 """Parse multipart input.
268
269 Arguments:
270@@ -205,7 +209,7 @@ def parse_multipart(fp, pdict, encoding="utf-8", errors="replace"):
271 except KeyError:
272 pass
273 fs = FieldStorage(fp, headers=headers, encoding=encoding, errors=errors,
274- environ={'REQUEST_METHOD': 'POST'})
275+ environ={'REQUEST_METHOD': 'POST'}, separator=separator)
276 return {k: fs.getlist(k) for k in fs}
277
278 def _parseparam(s):
279@@ -315,7 +319,7 @@ class FieldStorage:
280 def __init__(self, fp=None, headers=None, outerboundary=b'',
281 environ=os.environ, keep_blank_values=0, strict_parsing=0,
282 limit=None, encoding='utf-8', errors='replace',
283- max_num_fields=None):
284+ max_num_fields=None, separator='&'):
285 """Constructor. Read multipart/* until last part.
286
287 Arguments, all optional:
288@@ -363,6 +367,7 @@ def __init__(self, fp=None, headers=None, outerboundary=b'',
289 self.keep_blank_values = keep_blank_values
290 self.strict_parsing = strict_parsing
291 self.max_num_fields = max_num_fields
292+ self.separator = separator
293 if 'REQUEST_METHOD' in environ:
294 method = environ['REQUEST_METHOD'].upper()
295 self.qs_on_post = None
296@@ -589,7 +594,7 @@ def read_urlencoded(self):
297 query = urllib.parse.parse_qsl(
298 qs, self.keep_blank_values, self.strict_parsing,
299 encoding=self.encoding, errors=self.errors,
300- max_num_fields=self.max_num_fields)
301+ max_num_fields=self.max_num_fields, separator=self.separator)
302 self.list = [MiniFieldStorage(key, value) for key, value in query]
303 self.skip_lines()
304
305@@ -605,7 +610,7 @@ def read_multi(self, environ, keep_blank_values, strict_parsing):
306 query = urllib.parse.parse_qsl(
307 self.qs_on_post, self.keep_blank_values, self.strict_parsing,
308 encoding=self.encoding, errors=self.errors,
309- max_num_fields=self.max_num_fields)
310+ max_num_fields=self.max_num_fields, separator=self.separator)
311 self.list.extend(MiniFieldStorage(key, value) for key, value in query)
312
313 klass = self.FieldStorageClass or self.__class__
314@@ -649,7 +654,7 @@ def read_multi(self, environ, keep_blank_values, strict_parsing):
315 else self.limit - self.bytes_read
316 part = klass(self.fp, headers, ib, environ, keep_blank_values,
317 strict_parsing, limit,
318- self.encoding, self.errors, max_num_fields)
319+ self.encoding, self.errors, max_num_fields, self.separator)
320
321 if max_num_fields is not None:
322 max_num_fields -= 1
323diff --git a/Lib/test/test_cgi.py b/Lib/test/test_cgi.py
324index 101942de947fb..4e1506a6468b9 100644
325--- a/Lib/test/test_cgi.py
326+++ b/Lib/test/test_cgi.py
327@@ -53,12 +53,9 @@ def do_test(buf, method):
328 ("", ValueError("bad query field: ''")),
329 ("&", ValueError("bad query field: ''")),
330 ("&&", ValueError("bad query field: ''")),
331- (";", ValueError("bad query field: ''")),
332- (";&;", ValueError("bad query field: ''")),
333 # Should the next few really be valid?
334 ("=", {}),
335 ("=&=", {}),
336- ("=;=", {}),
337 # This rest seem to make sense
338 ("=a", {'': ['a']}),
339 ("&=a", ValueError("bad query field: ''")),
340@@ -73,8 +70,6 @@ def do_test(buf, method):
341 ("a=a+b&b=b+c", {'a': ['a b'], 'b': ['b c']}),
342 ("a=a+b&a=b+a", {'a': ['a b', 'b a']}),
343 ("x=1&y=2.0&z=2-3.%2b0", {'x': ['1'], 'y': ['2.0'], 'z': ['2-3.+0']}),
344- ("x=1;y=2.0&z=2-3.%2b0", {'x': ['1'], 'y': ['2.0'], 'z': ['2-3.+0']}),
345- ("x=1;y=2.0;z=2-3.%2b0", {'x': ['1'], 'y': ['2.0'], 'z': ['2-3.+0']}),
346 ("Hbc5161168c542333633315dee1182227:key_store_seqid=400006&cuyer=r&view=bustomer&order_id=0bb2e248638833d48cb7fed300000f1b&expire=964546263&lobale=en-US&kid=130003.300038&ss=env",
347 {'Hbc5161168c542333633315dee1182227:key_store_seqid': ['400006'],
348 'cuyer': ['r'],
349@@ -201,6 +196,30 @@ def test_strict(self):
350 else:
351 self.assertEqual(fs.getvalue(key), expect_val[0])
352
353+ def test_separator(self):
354+ parse_semicolon = [
355+ ("x=1;y=2.0", {'x': ['1'], 'y': ['2.0']}),
356+ ("x=1;y=2.0;z=2-3.%2b0", {'x': ['1'], 'y': ['2.0'], 'z': ['2-3.+0']}),
357+ (";", ValueError("bad query field: ''")),
358+ (";;", ValueError("bad query field: ''")),
359+ ("=;a", ValueError("bad query field: 'a'")),
360+ (";b=a", ValueError("bad query field: ''")),
361+ ("b;=a", ValueError("bad query field: 'b'")),
362+ ("a=a+b;b=b+c", {'a': ['a b'], 'b': ['b c']}),
363+ ("a=a+b;a=b+a", {'a': ['a b', 'b a']}),
364+ ]
365+ for orig, expect in parse_semicolon:
366+ env = {'QUERY_STRING': orig}
367+ fs = cgi.FieldStorage(separator=';', environ=env)
368+ if isinstance(expect, dict):
369+ for key in expect.keys():
370+ expect_val = expect[key]
371+ self.assertIn(key, fs)
372+ if len(expect_val) > 1:
373+ self.assertEqual(fs.getvalue(key), expect_val)
374+ else:
375+ self.assertEqual(fs.getvalue(key), expect_val[0])
376+
377 def test_log(self):
378 cgi.log("Testing")
379
380diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py
381index 4ae6ed33858ce..90c8d6922629e 100644
382--- a/Lib/test/test_urlparse.py
383+++ b/Lib/test/test_urlparse.py
384@@ -32,16 +32,10 @@
385 (b"&a=b", [(b'a', b'b')]),
386 (b"a=a+b&b=b+c", [(b'a', b'a b'), (b'b', b'b c')]),
387 (b"a=1&a=2", [(b'a', b'1'), (b'a', b'2')]),
388- (";", []),
389- (";;", []),
390- (";a=b", [('a', 'b')]),
391- ("a=a+b;b=b+c", [('a', 'a b'), ('b', 'b c')]),
392- ("a=1;a=2", [('a', '1'), ('a', '2')]),
393- (b";", []),
394- (b";;", []),
395- (b";a=b", [(b'a', b'b')]),
396- (b"a=a+b;b=b+c", [(b'a', b'a b'), (b'b', b'b c')]),
397- (b"a=1;a=2", [(b'a', b'1'), (b'a', b'2')]),
398+ (";a=b", [(';a', 'b')]),
399+ ("a=a+b;b=b+c", [('a', 'a b;b=b c')]),
400+ (b";a=b", [(b';a', b'b')]),
401+ (b"a=a+b;b=b+c", [(b'a', b'a b;b=b c')]),
402 ]
403
404 # Each parse_qs testcase is a two-tuple that contains
405@@ -68,16 +62,10 @@
406 (b"&a=b", {b'a': [b'b']}),
407 (b"a=a+b&b=b+c", {b'a': [b'a b'], b'b': [b'b c']}),
408 (b"a=1&a=2", {b'a': [b'1', b'2']}),
409- (";", {}),
410- (";;", {}),
411- (";a=b", {'a': ['b']}),
412- ("a=a+b;b=b+c", {'a': ['a b'], 'b': ['b c']}),
413- ("a=1;a=2", {'a': ['1', '2']}),
414- (b";", {}),
415- (b";;", {}),
416- (b";a=b", {b'a': [b'b']}),
417- (b"a=a+b;b=b+c", {b'a': [b'a b'], b'b': [b'b c']}),
418- (b"a=1;a=2", {b'a': [b'1', b'2']}),
419+ (";a=b", {';a': ['b']}),
420+ ("a=a+b;b=b+c", {'a': ['a b;b=b c']}),
421+ (b";a=b", {b';a': [b'b']}),
422+ (b"a=a+b;b=b+c", {b'a':[ b'a b;b=b c']}),
423 ]
424
425 class UrlParseTestCase(unittest.TestCase):
426@@ -884,10 +872,46 @@ def test_parse_qsl_encoding(self):
427 def test_parse_qsl_max_num_fields(self):
428 with self.assertRaises(ValueError):
429 urllib.parse.parse_qs('&'.join(['a=a']*11), max_num_fields=10)
430- with self.assertRaises(ValueError):
431- urllib.parse.parse_qs(';'.join(['a=a']*11), max_num_fields=10)
432 urllib.parse.parse_qs('&'.join(['a=a']*10), max_num_fields=10)
433
434+ def test_parse_qs_separator(self):
435+ parse_qs_semicolon_cases = [
436+ (";", {}),
437+ (";;", {}),
438+ (";a=b", {'a': ['b']}),
439+ ("a=a+b;b=b+c", {'a': ['a b'], 'b': ['b c']}),
440+ ("a=1;a=2", {'a': ['1', '2']}),
441+ (b";", {}),
442+ (b";;", {}),
443+ (b";a=b", {b'a': [b'b']}),
444+ (b"a=a+b;b=b+c", {b'a': [b'a b'], b'b': [b'b c']}),
445+ (b"a=1;a=2", {b'a': [b'1', b'2']}),
446+ ]
447+ for orig, expect in parse_qs_semicolon_cases:
448+ with self.subTest(f"Original: {orig!r}, Expected: {expect!r}"):
449+ result = urllib.parse.parse_qs(orig, separator=';')
450+ self.assertEqual(result, expect, "Error parsing %r" % orig)
451+
452+
453+ def test_parse_qsl_separator(self):
454+ parse_qsl_semicolon_cases = [
455+ (";", []),
456+ (";;", []),
457+ (";a=b", [('a', 'b')]),
458+ ("a=a+b;b=b+c", [('a', 'a b'), ('b', 'b c')]),
459+ ("a=1;a=2", [('a', '1'), ('a', '2')]),
460+ (b";", []),
461+ (b";;", []),
462+ (b";a=b", [(b'a', b'b')]),
463+ (b"a=a+b;b=b+c", [(b'a', b'a b'), (b'b', b'b c')]),
464+ (b"a=1;a=2", [(b'a', b'1'), (b'a', b'2')]),
465+ ]
466+ for orig, expect in parse_qsl_semicolon_cases:
467+ with self.subTest(f"Original: {orig!r}, Expected: {expect!r}"):
468+ result = urllib.parse.parse_qsl(orig, separator=';')
469+ self.assertEqual(result, expect, "Error parsing %r" % orig)
470+
471+
472 def test_urlencode_sequences(self):
473 # Other tests incidentally urlencode things; test non-covered cases:
474 # Sequence and object values.
475diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py
476index 95be7181133b4..0c1c94f5fc986 100644
477--- a/Lib/urllib/parse.py
478+++ b/Lib/urllib/parse.py
479@@ -650,7 +650,7 @@ def unquote(string, encoding='utf-8', errors='replace'):
480
481
482 def parse_qs(qs, keep_blank_values=False, strict_parsing=False,
483- encoding='utf-8', errors='replace', max_num_fields=None):
484+ encoding='utf-8', errors='replace', max_num_fields=None, separator='&'):
485 """Parse a query given as a string argument.
486
487 Arguments:
488@@ -674,12 +674,15 @@ def parse_qs(qs, keep_blank_values=False, strict_parsing=False,
489 max_num_fields: int. If set, then throws a ValueError if there
490 are more than n fields read by parse_qsl().
491
492+ separator: str. The symbol to use for separating the query arguments.
493+ Defaults to &.
494+
495 Returns a dictionary.
496 """
497 parsed_result = {}
498 pairs = parse_qsl(qs, keep_blank_values, strict_parsing,
499 encoding=encoding, errors=errors,
500- max_num_fields=max_num_fields)
501+ max_num_fields=max_num_fields, separator=separator)
502 for name, value in pairs:
503 if name in parsed_result:
504 parsed_result[name].append(value)
505@@ -689,7 +692,7 @@ def parse_qs(qs, keep_blank_values=False, strict_parsing=False,
506
507
508 def parse_qsl(qs, keep_blank_values=False, strict_parsing=False,
509- encoding='utf-8', errors='replace', max_num_fields=None):
510+ encoding='utf-8', errors='replace', max_num_fields=None, separator='&'):
511 """Parse a query given as a string argument.
512
513 Arguments:
514@@ -712,19 +715,25 @@ def parse_qsl(qs, keep_blank_values=False, strict_parsing=False,
515 max_num_fields: int. If set, then throws a ValueError
516 if there are more than n fields read by parse_qsl().
517
518+ separator: str. The symbol to use for separating the query arguments.
519+ Defaults to &.
520+
521 Returns a list, as G-d intended.
522 """
523 qs, _coerce_result = _coerce_args(qs)
524
525+ if not separator or (not isinstance(separator, (str, bytes))):
526+ raise ValueError("Separator must be of type string or bytes.")
527+
528 # If max_num_fields is defined then check that the number of fields
529 # is less than max_num_fields. This prevents a memory exhaustion DOS
530 # attack via post bodies with many fields.
531 if max_num_fields is not None:
532- num_fields = 1 + qs.count('&') + qs.count(';')
533+ num_fields = 1 + qs.count(separator)
534 if max_num_fields < num_fields:
535 raise ValueError('Max number of fields exceeded')
536
537- pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')]
538+ pairs = [s1 for s1 in qs.split(separator)]
539 r = []
540 for name_value in pairs:
541 if not name_value and not strict_parsing:
542diff --git a/Misc/NEWS.d/next/Security/2021-02-14-15-59-16.bpo-42967.YApqDS.rst b/Misc/NEWS.d/next/Security/2021-02-14-15-59-16.bpo-42967.YApqDS.rst
543new file mode 100644
544index 0000000000000..f08489b41494e
545--- /dev/null
546+++ b/Misc/NEWS.d/next/Security/2021-02-14-15-59-16.bpo-42967.YApqDS.rst
547@@ -0,0 +1 @@
548+Fix web cache poisoning vulnerability by defaulting the query args separator to ``&``, and allowing the user to choose a custom separator.
diff --git a/meta/recipes-devtools/python/python3/CVE-2021-3177.patch b/meta/recipes-devtools/python/python3/CVE-2021-3177.patch
new file mode 100644
index 0000000000..43d678db46
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/CVE-2021-3177.patch
@@ -0,0 +1,191 @@
1From ece5dfd403dac211f8d3c72701fe7ba7b7aa5b5f Mon Sep 17 00:00:00 2001
2From: "Miss Islington (bot)"
3 <31488909+miss-islington@users.noreply.github.com>
4Date: Mon, 18 Jan 2021 13:28:52 -0800
5Subject: [PATCH] closes bpo-42938: Replace snprintf with Python unicode
6 formatting in ctypes param reprs. (GH-24248)
7
8(cherry picked from commit 916610ef90a0d0761f08747f7b0905541f0977c7)
9
10Co-authored-by: Benjamin Peterson <benjamin@python.org>
11
12Co-authored-by: Benjamin Peterson <benjamin@python.org>
13
14CVE: CVE-2021-3177
15Upstream-Status: Backport [https://github.com/python/cpython/commit/ece5dfd403dac211f8d3c72701fe7ba7b7aa5b5f]
16Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
17---
18 Lib/ctypes/test/test_parameters.py | 43 ++++++++++++++++
19 .../2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst | 2 +
20 Modules/_ctypes/callproc.c | 51 +++++++------------
21 3 files changed, 64 insertions(+), 32 deletions(-)
22 create mode 100644 Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst
23
24diff --git a/Lib/ctypes/test/test_parameters.py b/Lib/ctypes/test/test_parameters.py
25index e4c25fd880cef..531894fdec838 100644
26--- a/Lib/ctypes/test/test_parameters.py
27+++ b/Lib/ctypes/test/test_parameters.py
28@@ -201,6 +201,49 @@ def __dict__(self):
29 with self.assertRaises(ZeroDivisionError):
30 WorseStruct().__setstate__({}, b'foo')
31
32+ def test_parameter_repr(self):
33+ from ctypes import (
34+ c_bool,
35+ c_char,
36+ c_wchar,
37+ c_byte,
38+ c_ubyte,
39+ c_short,
40+ c_ushort,
41+ c_int,
42+ c_uint,
43+ c_long,
44+ c_ulong,
45+ c_longlong,
46+ c_ulonglong,
47+ c_float,
48+ c_double,
49+ c_longdouble,
50+ c_char_p,
51+ c_wchar_p,
52+ c_void_p,
53+ )
54+ self.assertRegex(repr(c_bool.from_param(True)), r"^<cparam '\?' at 0x[A-Fa-f0-9]+>$")
55+ self.assertEqual(repr(c_char.from_param(97)), "<cparam 'c' ('a')>")
56+ self.assertRegex(repr(c_wchar.from_param('a')), r"^<cparam 'u' at 0x[A-Fa-f0-9]+>$")
57+ self.assertEqual(repr(c_byte.from_param(98)), "<cparam 'b' (98)>")
58+ self.assertEqual(repr(c_ubyte.from_param(98)), "<cparam 'B' (98)>")
59+ self.assertEqual(repr(c_short.from_param(511)), "<cparam 'h' (511)>")
60+ self.assertEqual(repr(c_ushort.from_param(511)), "<cparam 'H' (511)>")
61+ self.assertRegex(repr(c_int.from_param(20000)), r"^<cparam '[li]' \(20000\)>$")
62+ self.assertRegex(repr(c_uint.from_param(20000)), r"^<cparam '[LI]' \(20000\)>$")
63+ self.assertRegex(repr(c_long.from_param(20000)), r"^<cparam '[li]' \(20000\)>$")
64+ self.assertRegex(repr(c_ulong.from_param(20000)), r"^<cparam '[LI]' \(20000\)>$")
65+ self.assertRegex(repr(c_longlong.from_param(20000)), r"^<cparam '[liq]' \(20000\)>$")
66+ self.assertRegex(repr(c_ulonglong.from_param(20000)), r"^<cparam '[LIQ]' \(20000\)>$")
67+ self.assertEqual(repr(c_float.from_param(1.5)), "<cparam 'f' (1.5)>")
68+ self.assertEqual(repr(c_double.from_param(1.5)), "<cparam 'd' (1.5)>")
69+ self.assertEqual(repr(c_double.from_param(1e300)), "<cparam 'd' (1e+300)>")
70+ self.assertRegex(repr(c_longdouble.from_param(1.5)), r"^<cparam ('d' \(1.5\)|'g' at 0x[A-Fa-f0-9]+)>$")
71+ self.assertRegex(repr(c_char_p.from_param(b'hihi')), "^<cparam 'z' \(0x[A-Fa-f0-9]+\)>$")
72+ self.assertRegex(repr(c_wchar_p.from_param('hihi')), "^<cparam 'Z' \(0x[A-Fa-f0-9]+\)>$")
73+ self.assertRegex(repr(c_void_p.from_param(0x12)), r"^<cparam 'P' \(0x0*12\)>$")
74+
75 ################################################################
76
77 if __name__ == '__main__':
78diff --git a/Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst b/Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst
79new file mode 100644
80index 0000000000000..7df65a156feab
81--- /dev/null
82+++ b/Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst
83@@ -0,0 +1,2 @@
84+Avoid static buffers when computing the repr of :class:`ctypes.c_double` and
85+:class:`ctypes.c_longdouble` values.
86diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
87index a9b8675cd951b..de75918d49f37 100644
88--- a/Modules/_ctypes/callproc.c
89+++ b/Modules/_ctypes/callproc.c
90@@ -484,58 +484,47 @@ is_literal_char(unsigned char c)
91 static PyObject *
92 PyCArg_repr(PyCArgObject *self)
93 {
94- char buffer[256];
95 switch(self->tag) {
96 case 'b':
97 case 'B':
98- sprintf(buffer, "<cparam '%c' (%d)>",
99+ return PyUnicode_FromFormat("<cparam '%c' (%d)>",
100 self->tag, self->value.b);
101- break;
102 case 'h':
103 case 'H':
104- sprintf(buffer, "<cparam '%c' (%d)>",
105+ return PyUnicode_FromFormat("<cparam '%c' (%d)>",
106 self->tag, self->value.h);
107- break;
108 case 'i':
109 case 'I':
110- sprintf(buffer, "<cparam '%c' (%d)>",
111+ return PyUnicode_FromFormat("<cparam '%c' (%d)>",
112 self->tag, self->value.i);
113- break;
114 case 'l':
115 case 'L':
116- sprintf(buffer, "<cparam '%c' (%ld)>",
117+ return PyUnicode_FromFormat("<cparam '%c' (%ld)>",
118 self->tag, self->value.l);
119- break;
120
121 case 'q':
122 case 'Q':
123- sprintf(buffer,
124-#ifdef MS_WIN32
125- "<cparam '%c' (%I64d)>",
126-#else
127- "<cparam '%c' (%lld)>",
128-#endif
129+ return PyUnicode_FromFormat("<cparam '%c' (%lld)>",
130 self->tag, self->value.q);
131- break;
132 case 'd':
133- sprintf(buffer, "<cparam '%c' (%f)>",
134- self->tag, self->value.d);
135- break;
136- case 'f':
137- sprintf(buffer, "<cparam '%c' (%f)>",
138- self->tag, self->value.f);
139- break;
140-
141+ case 'f': {
142+ PyObject *f = PyFloat_FromDouble((self->tag == 'f') ? self->value.f : self->value.d);
143+ if (f == NULL) {
144+ return NULL;
145+ }
146+ PyObject *result = PyUnicode_FromFormat("<cparam '%c' (%R)>", self->tag, f);
147+ Py_DECREF(f);
148+ return result;
149+ }
150 case 'c':
151 if (is_literal_char((unsigned char)self->value.c)) {
152- sprintf(buffer, "<cparam '%c' ('%c')>",
153+ return PyUnicode_FromFormat("<cparam '%c' ('%c')>",
154 self->tag, self->value.c);
155 }
156 else {
157- sprintf(buffer, "<cparam '%c' ('\\x%02x')>",
158+ return PyUnicode_FromFormat("<cparam '%c' ('\\x%02x')>",
159 self->tag, (unsigned char)self->value.c);
160 }
161- break;
162
163 /* Hm, are these 'z' and 'Z' codes useful at all?
164 Shouldn't they be replaced by the functionality of c_string
165@@ -544,22 +533,20 @@ PyCArg_repr(PyCArgObject *self)
166 case 'z':
167 case 'Z':
168 case 'P':
169- sprintf(buffer, "<cparam '%c' (%p)>",
170+ return PyUnicode_FromFormat("<cparam '%c' (%p)>",
171 self->tag, self->value.p);
172 break;
173
174 default:
175 if (is_literal_char((unsigned char)self->tag)) {
176- sprintf(buffer, "<cparam '%c' at %p>",
177+ return PyUnicode_FromFormat("<cparam '%c' at %p>",
178 (unsigned char)self->tag, (void *)self);
179 }
180 else {
181- sprintf(buffer, "<cparam 0x%02x at %p>",
182+ return PyUnicode_FromFormat("<cparam 0x%02x at %p>",
183 (unsigned char)self->tag, (void *)self);
184 }
185- break;
186 }
187- return PyUnicode_FromString(buffer);
188 }
189
190 static PyMemberDef PyCArgType_members[] = {
191
diff --git a/meta/recipes-devtools/python/python3_3.8.5.bb b/meta/recipes-devtools/python/python3_3.8.5.bb
index 3720b364bb..418d35acfe 100644
--- a/meta/recipes-devtools/python/python3_3.8.5.bb
+++ b/meta/recipes-devtools/python/python3_3.8.5.bb
@@ -33,6 +33,8 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
33 file://0001-python3-Do-not-hardcode-lib-for-distutils.patch \ 33 file://0001-python3-Do-not-hardcode-lib-for-distutils.patch \
34 file://0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch \ 34 file://0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch \
35 file://CVE-2020-27619.patch \ 35 file://CVE-2020-27619.patch \
36 file://CVE-2021-3177.patch \
37 file://CVE-2021-23336.patch \
36 " 38 "
37 39
38SRC_URI_append_class-native = " \ 40SRC_URI_append_class-native = " \
@@ -50,6 +52,8 @@ UPSTREAM_CHECK_URI = "https://www.python.org/downloads/source/"
50 52
51CVE_PRODUCT = "python" 53CVE_PRODUCT = "python"
52 54
55# Upstream consider this expected behaviour
56CVE_CHECK_WHITELIST += "CVE-2007-4559"
53# This is not exploitable when glibc has CVE-2016-10739 fixed. 57# This is not exploitable when glibc has CVE-2016-10739 fixed.
54CVE_CHECK_WHITELIST += "CVE-2019-18348" 58CVE_CHECK_WHITELIST += "CVE-2019-18348"
55 59
@@ -166,6 +170,10 @@ do_install_append() {
166} 170}
167 171
168do_install_append_class-nativesdk () { 172do_install_append_class-nativesdk () {
173 # Make sure we use /usr/bin/env python
174 for PYTHSCRIPT in `grep -rIl ${bindir}/python ${D}${bindir}`; do
175 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT
176 done
169 create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1' 177 create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1'
170} 178}
171 179
@@ -304,11 +312,8 @@ do_create_manifest() {
304} 312}
305 313
306# bitbake python -c create_manifest 314# bitbake python -c create_manifest
307addtask do_create_manifest
308
309# Make sure we have native python ready when we create a new manifest 315# Make sure we have native python ready when we create a new manifest
310do_create_manifest[depends] += "${PN}:do_prepare_recipe_sysroot" 316addtask do_create_manifest after do_patch do_prepare_recipe_sysroot
311do_create_manifest[depends] += "${PN}:do_patch"
312 317
313# manual dependency additions 318# manual dependency additions
314RRECOMMENDS_${PN}-core_append_class-nativesdk = " nativesdk-python3-modules" 319RRECOMMENDS_${PN}-core_append_class-nativesdk = " nativesdk-python3-modules"
@@ -361,3 +366,9 @@ RDEPENDS_${PN}-dev = ""
361 366
362RDEPENDS_${PN}-tests_append_class-target = " ${MLPREFIX}bash" 367RDEPENDS_${PN}-tests_append_class-target = " ${MLPREFIX}bash"
363RDEPENDS_${PN}-tests_append_class-nativesdk = " ${MLPREFIX}bash" 368RDEPENDS_${PN}-tests_append_class-nativesdk = " ${MLPREFIX}bash"
369
370# Python's tests contain large numbers of files we don't need in the recipe sysroots
371SYSROOT_PREPROCESS_FUNCS += " py3_sysroot_cleanup"
372py3_sysroot_cleanup () {
373 rm -rf ${SYSROOT_DESTDIR}${libdir}/python${PYTHON_MAJMIN}/test
374}
diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc
index 84f600cec0..482ca3d6e5 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -32,6 +32,14 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
32 file://find_datadir.patch \ 32 file://find_datadir.patch \
33 file://usb-fix-setup_len-init.patch \ 33 file://usb-fix-setup_len-init.patch \
34 file://0001-target-mips-Increase-number-of-TLB-entries-on-the-34.patch \ 34 file://0001-target-mips-Increase-number-of-TLB-entries-on-the-34.patch \
35 file://CVE-2020-24352.patch \
36 file://CVE-2020-29129-CVE-2020-29130.patch \
37 file://CVE-2020-25624.patch \
38 file://CVE-2020-25723.patch \
39 file://CVE-2020-28916.patch \
40 file://CVE-2020-35517.patch \
41 file://CVE-2020-29443.patch \
42 file://CVE-2021-20203.patch \
35 " 43 "
36UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" 44UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
37 45
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-24352.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-24352.patch
new file mode 100644
index 0000000000..861ff6c3b0
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-24352.patch
@@ -0,0 +1,52 @@
1From ca1f9cbfdce4d63b10d57de80fef89a89d92a540 Mon Sep 17 00:00:00 2001
2From: Prasad J Pandit <pjp@fedoraproject.org>
3Date: Wed, 21 Oct 2020 16:08:18 +0530
4Subject: [PATCH 1/1] ati: check x y display parameter values
5
6The source and destination x,y display parameters in ati_2d_blt()
7may run off the vga limits if either of s->regs.[src|dst]_[xy] is
8zero. Check the parameter values to avoid potential crash.
9
10Reported-by: Gaoning Pan <pgn@zju.edu.cn>
11Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
12Message-id: 20201021103818.1704030-1-ppandit@redhat.com
13Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
14
15Upstream-Status: Backport [ https://git.qemu.org/?p=qemu.git;a=commitdiff;h=ca1f9cbfdce4d63b10d57de80fef89a89d92a540;hp=2ddafce7f797082ad216657c830afd4546f16e37 ]
16CVE: CVE-2020-24352
17Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
18---
19 hw/display/ati_2d.c | 10 ++++++----
20 1 file changed, 6 insertions(+), 4 deletions(-)
21
22diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c
23index 23a8ae0..4dc10ea 100644
24--- a/hw/display/ati_2d.c
25+++ b/hw/display/ati_2d.c
26@@ -75,8 +75,9 @@ void ati_2d_blt(ATIVGAState *s)
27 dst_stride *= bpp;
28 }
29 uint8_t *end = s->vga.vram_ptr + s->vga.vram_size;
30- if (dst_bits >= end || dst_bits + dst_x + (dst_y + s->regs.dst_height) *
31- dst_stride >= end) {
32+ if (dst_x > 0x3fff || dst_y > 0x3fff || dst_bits >= end
33+ || dst_bits + dst_x
34+ + (dst_y + s->regs.dst_height) * dst_stride >= end) {
35 qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n");
36 return;
37 }
38@@ -107,8 +108,9 @@ void ati_2d_blt(ATIVGAState *s)
39 src_bits += s->regs.crtc_offset & 0x07ffffff;
40 src_stride *= bpp;
41 }
42- if (src_bits >= end || src_bits + src_x +
43- (src_y + s->regs.dst_height) * src_stride >= end) {
44+ if (src_x > 0x3fff || src_y > 0x3fff || src_bits >= end
45+ || src_bits + src_x
46+ + (src_y + s->regs.dst_height) * src_stride >= end) {
47 qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n");
48 return;
49 }
50--
511.8.3.1
52
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-25624.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-25624.patch
new file mode 100644
index 0000000000..7631bab39f
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-25624.patch
@@ -0,0 +1,101 @@
1From 1328fe0c32d5474604105b8105310e944976b058 Mon Sep 17 00:00:00 2001
2From: Prasad J Pandit <pjp@fedoraproject.org>
3Date: Tue, 15 Sep 2020 23:52:58 +0530
4Subject: [PATCH] hw: usb: hcd-ohci: check len and frame_number variables
5
6While servicing the OHCI transfer descriptors(TD), OHCI host
7controller derives variables 'start_addr', 'end_addr', 'len'
8etc. from values supplied by the host controller driver.
9Host controller driver may supply values such that using
10above variables leads to out-of-bounds access issues.
11Add checks to avoid them.
12
13AddressSanitizer: stack-buffer-overflow on address 0x7ffd53af76a0
14 READ of size 2 at 0x7ffd53af76a0 thread T0
15 #0 ohci_service_iso_td ../hw/usb/hcd-ohci.c:734
16 #1 ohci_service_ed_list ../hw/usb/hcd-ohci.c:1180
17 #2 ohci_process_lists ../hw/usb/hcd-ohci.c:1214
18 #3 ohci_frame_boundary ../hw/usb/hcd-ohci.c:1257
19 #4 timerlist_run_timers ../util/qemu-timer.c:572
20 #5 qemu_clock_run_timers ../util/qemu-timer.c:586
21 #6 qemu_clock_run_all_timers ../util/qemu-timer.c:672
22 #7 main_loop_wait ../util/main-loop.c:527
23 #8 qemu_main_loop ../softmmu/vl.c:1676
24 #9 main ../softmmu/main.c:50
25
26Reported-by: Gaoning Pan <pgn@zju.edu.cn>
27Reported-by: Yongkang Jia <j_kangel@163.com>
28Reported-by: Yi Ren <yunye.ry@alibaba-inc.com>
29Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
30Message-id: 20200915182259.68522-2-ppandit@redhat.com
31Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
32
33Upstream-Status: Backport
34CVE: CVE-2020-25624
35[https://git.qemu.org/?p=qemu.git;a=commit;h=1328fe0c32d5474604105b8105310e944976b058]
36Signed-off-by: Li Wang <li.wang@windriver.com>
37---
38 hw/usb/hcd-ohci.c | 24 ++++++++++++++++++++++--
39 1 file changed, 22 insertions(+), 2 deletions(-)
40
41diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
42index 1e6e85e..9dc5910 100644
43--- a/hw/usb/hcd-ohci.c
44+++ b/hw/usb/hcd-ohci.c
45@@ -731,7 +731,11 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed,
46 }
47
48 start_offset = iso_td.offset[relative_frame_number];
49- next_offset = iso_td.offset[relative_frame_number + 1];
50+ if (relative_frame_number < frame_count) {
51+ next_offset = iso_td.offset[relative_frame_number + 1];
52+ } else {
53+ next_offset = iso_td.be;
54+ }
55
56 if (!(OHCI_BM(start_offset, TD_PSW_CC) & 0xe) ||
57 ((relative_frame_number < frame_count) &&
58@@ -764,7 +768,12 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed,
59 }
60 } else {
61 /* Last packet in the ISO TD */
62- end_addr = iso_td.be;
63+ end_addr = next_offset;
64+ }
65+
66+ if (start_addr > end_addr) {
67+ trace_usb_ohci_iso_td_bad_cc_overrun(start_addr, end_addr);
68+ return 1;
69 }
70
71 if ((start_addr & OHCI_PAGE_MASK) != (end_addr & OHCI_PAGE_MASK)) {
72@@ -773,6 +782,9 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed,
73 } else {
74 len = end_addr - start_addr + 1;
75 }
76+ if (len > sizeof(ohci->usb_buf)) {
77+ len = sizeof(ohci->usb_buf);
78+ }
79
80 if (len && dir != OHCI_TD_DIR_IN) {
81 if (ohci_copy_iso_td(ohci, start_addr, end_addr, ohci->usb_buf, len,
82@@ -975,8 +987,16 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed)
83 if ((td.cbp & 0xfffff000) != (td.be & 0xfffff000)) {
84 len = (td.be & 0xfff) + 0x1001 - (td.cbp & 0xfff);
85 } else {
86+ if (td.cbp > td.be) {
87+ trace_usb_ohci_iso_td_bad_cc_overrun(td.cbp, td.be);
88+ ohci_die(ohci);
89+ return 1;
90+ }
91 len = (td.be - td.cbp) + 1;
92 }
93+ if (len > sizeof(ohci->usb_buf)) {
94+ len = sizeof(ohci->usb_buf);
95+ }
96
97 pktlen = len;
98 if (len && dir != OHCI_TD_DIR_IN) {
99--
1002.17.1
101
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-25723.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-25723.patch
new file mode 100644
index 0000000000..90b3a2f41c
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-25723.patch
@@ -0,0 +1,51 @@
1From 2fdb42d840400d58f2e706ecca82c142b97bcbd6 Mon Sep 17 00:00:00 2001
2From: Li Qiang <liq3ea@163.com>
3Date: Wed, 12 Aug 2020 09:17:27 -0700
4Subject: [PATCH] hw: ehci: check return value of 'usb_packet_map'
5
6If 'usb_packet_map' fails, we should stop to process the usb
7request.
8
9Signed-off-by: Li Qiang <liq3ea@163.com>
10Message-Id: <20200812161727.29412-1-liq3ea@163.com>
11Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12
13Upstream-Status: Backport
14CVE: CVE-2020-25723
15[https://git.qemu.org/?p=qemu.git;a=commit;h=2fdb42d840400d58f2e706ecca82c142b97bcbd6]
16Signed-off-by: Li Wang <li.wang@windriver.com>
17---
18 hw/usb/hcd-ehci.c | 10 ++++++++--
19 1 file changed, 8 insertions(+), 2 deletions(-)
20
21diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
22index 1495e8f..1fbb02a 100644
23--- a/hw/usb/hcd-ehci.c
24+++ b/hw/usb/hcd-ehci.c
25@@ -1373,7 +1373,10 @@ static int ehci_execute(EHCIPacket *p, const char *action)
26 spd = (p->pid == USB_TOKEN_IN && NLPTR_TBIT(p->qtd.altnext) == 0);
27 usb_packet_setup(&p->packet, p->pid, ep, 0, p->qtdaddr, spd,
28 (p->qtd.token & QTD_TOKEN_IOC) != 0);
29- usb_packet_map(&p->packet, &p->sgl);
30+ if (usb_packet_map(&p->packet, &p->sgl)) {
31+ qemu_sglist_destroy(&p->sgl);
32+ return -1;
33+ }
34 p->async = EHCI_ASYNC_INITIALIZED;
35 }
36
37@@ -1452,7 +1455,10 @@ static int ehci_process_itd(EHCIState *ehci,
38 if (ep && ep->type == USB_ENDPOINT_XFER_ISOC) {
39 usb_packet_setup(&ehci->ipacket, pid, ep, 0, addr, false,
40 (itd->transact[i] & ITD_XACT_IOC) != 0);
41- usb_packet_map(&ehci->ipacket, &ehci->isgl);
42+ if (usb_packet_map(&ehci->ipacket, &ehci->isgl)) {
43+ qemu_sglist_destroy(&ehci->isgl);
44+ return -1;
45+ }
46 usb_handle_packet(dev, &ehci->ipacket);
47 usb_packet_unmap(&ehci->ipacket, &ehci->isgl);
48 } else {
49--
502.17.1
51
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-28916.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-28916.patch
new file mode 100644
index 0000000000..5212196837
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-28916.patch
@@ -0,0 +1,49 @@
1From c2cb511634012344e3d0fe49a037a33b12d8a98a Mon Sep 17 00:00:00 2001
2From: Prasad J Pandit <pjp@fedoraproject.org>
3Date: Wed, 11 Nov 2020 18:36:36 +0530
4Subject: [PATCH] hw/net/e1000e: advance desc_offset in case of null
5descriptor
6
7While receiving packets via e1000e_write_packet_to_guest() routine,
8'desc_offset' is advanced only when RX descriptor is processed. And
9RX descriptor is not processed if it has NULL buffer address.
10This may lead to an infinite loop condition. Increament 'desc_offset'
11to process next descriptor in the ring to avoid infinite loop.
12
13Reported-by: Cheol-woo Myung <330cjfdn@gmail.com>
14Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
15Signed-off-by: Jason Wang <jasowang@redhat.com>
16
17Upstream-Status: Backport
18CVE: CVE-2020-28916
19[https://git.qemu.org/?p=qemu.git;a=commit;h=c2cb511634012344e3d0fe49a037a33b12d8a98a]
20Signed-off-by: Li Wang <li.wang@windriver.com>
21---
22 hw/net/e1000e_core.c | 8 ++++----
23 1 file changed, 4 insertions(+), 4 deletions(-)
24
25diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
26index bcd186c..d3e3cdc 100644
27--- a/hw/net/e1000e_core.c
28+++ b/hw/net/e1000e_core.c
29@@ -1596,13 +1596,13 @@ e1000e_write_packet_to_guest(E1000ECore *core, struct NetRxPkt *pkt,
30 (const char *) &fcs_pad, e1000x_fcs_len(core->mac));
31 }
32 }
33- desc_offset += desc_size;
34- if (desc_offset >= total_size) {
35- is_last = true;
36- }
37 } else { /* as per intel docs; skip descriptors with null buf addr */
38 trace_e1000e_rx_null_descriptor();
39 }
40+ desc_offset += desc_size;
41+ if (desc_offset >= total_size) {
42+ is_last = true;
43+ }
44
45 e1000e_write_rx_descr(core, desc, is_last ? core->rx_pkt : NULL,
46 rss_info, do_ps ? ps_hdr_len : 0, &bastate.written);
47--
482.17.1
49
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-29129-CVE-2020-29130.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-29129-CVE-2020-29130.patch
new file mode 100644
index 0000000000..e5829f6dad
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-29129-CVE-2020-29130.patch
@@ -0,0 +1,64 @@
1From 2e1dcbc0c2af64fcb17009eaf2ceedd81be2b27f Mon Sep 17 00:00:00 2001
2From: Prasad J Pandit <pjp@fedoraproject.org>
3Date: Thu, 26 Nov 2020 19:27:06 +0530
4Subject: [PATCH] slirp: check pkt_len before reading protocol header
5MIME-Version: 1.0
6Content-Type: text/plain; charset=utf8
7Content-Transfer-Encoding: 8bit
8
9While processing ARP/NCSI packets in 'arp_input' or 'ncsi_input'
10routines, ensure that pkt_len is large enough to accommodate the
11respective protocol headers, lest it should do an OOB access.
12Add check to avoid it.
13
14CVE-2020-29129 CVE-2020-29130
15 QEMU: slirp: out-of-bounds access while processing ARP/NCSI packets
16 -> https://www.openwall.com/lists/oss-security/2020/11/27/1
17
18Reported-by: Qiuhao Li <Qiuhao.Li@outlook.com>
19Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
20Message-Id: <20201126135706.273950-1-ppandit@redhat.com>
21Reviewed-by: Marc-Andrà Lureau <marcandre.lureau@redhat.com>
22
23Upstream-Status: Backport
24CVE: CVE-2020-29129 CVE-2020-29130
25[https://git.qemu.org/?p=libslirp.git;a=commit;h=2e1dcbc0c2af64fcb17009eaf2ceedd81be2b27f]
26Signed-off-by: Li Wang <li.wang@windriver.com>
27---
28 slirp/src/ncsi.c | 4 ++++
29 slirp/src/slirp.c | 4 ++++
30 2 files changed, 8 insertions(+)
31
32diff --git a/slirp/src/ncsi.c b/slirp/src/ncsi.c
33index 3c1dfef..75dcc08 100644
34--- a/slirp/src/ncsi.c
35+++ b/slirp/src/ncsi.c
36@@ -148,6 +148,10 @@ void ncsi_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
37 uint32_t checksum;
38 uint32_t *pchecksum;
39
40+ if (pkt_len < ETH_HLEN + sizeof(struct ncsi_pkt_hdr)) {
41+ return; /* packet too short */
42+ }
43+
44 memset(ncsi_reply, 0, sizeof(ncsi_reply));
45
46 memset(reh->h_dest, 0xff, ETH_ALEN);
47diff --git a/slirp/src/slirp.c b/slirp/src/slirp.c
48index dba7c98..9be58e2 100644
49--- a/slirp/src/slirp.c
50+++ b/slirp/src/slirp.c
51@@ -756,6 +756,10 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
52 return;
53 }
54
55+ if (pkt_len < ETH_HLEN + sizeof(struct slirp_arphdr)) {
56+ return; /* packet too short */
57+ }
58+
59 ar_op = ntohs(ah->ar_op);
60 switch (ar_op) {
61 case ARPOP_REQUEST:
62--
632.17.1
64
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-29443.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-29443.patch
new file mode 100644
index 0000000000..5a3b99bb23
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-29443.patch
@@ -0,0 +1,46 @@
1
2m 813212288970c39b1800f63e83ac6e96588095c6 Mon Sep 17 00:00:00 2001
3From: Paolo Bonzini <pbonzini@redhat.com>
4Date: Tue, 1 Dec 2020 13:09:26 +0100
5Subject: [PATCH] ide: atapi: assert that the buffer pointer is in range
6
7A case was reported where s->io_buffer_index can be out of range.
8The report skimped on the details but it seems to be triggered
9by s->lba == -1 on the READ/READ CD paths (e.g. by sending an
10ATAPI command with LBA = 0xFFFFFFFF). For now paper over it
11with assertions. The first one ensures that there is no overflow
12when incrementing s->io_buffer_index, the second checks for the
13buffer overrun.
14
15Note that the buffer overrun is only a read, so I am not sure
16if the assertion failure is actually less harmful than the overrun.
17
18Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
19Message-id: 20201201120926.56559-1-pbonzini@redhat.com
20Reviewed-by: Kevin Wolf <kwolf@redhat.com>
21Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
23Upstream-Status: Backport [https://git.qemu.org/?p=qemu.git;a=patch;h=813212288970c39b1800f63e83ac6e96588095c6]
24CVE: CVE-2020-29443
25Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
26
27---
28 hw/ide/atapi.c | 2 ++
29 1 file changed, 2 insertions(+)
30
31diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
32index 14a2b0b..e791578 100644
33--- a/hw/ide/atapi.c
34+++ b/hw/ide/atapi.c
35@@ -276,6 +276,8 @@ void ide_atapi_cmd_reply_end(IDEState *s)
36 s->packet_transfer_size -= size;
37 s->elementary_transfer_size -= size;
38 s->io_buffer_index += size;
39+ assert(size <= s->io_buffer_total_len);
40+ assert(s->io_buffer_index <= s->io_buffer_total_len);
41
42 /* Some adapters process PIO data right away. In that case, we need
43 * to avoid mutual recursion between ide_transfer_start
44--
451.8.3.1
46
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-35517.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-35517.patch
new file mode 100644
index 0000000000..f818eb3bf5
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-35517.patch
@@ -0,0 +1,126 @@
1From ebf101955ce8f8d72fba103b5151115a4335de2c Mon Sep 17 00:00:00 2001
2From: Stefan Hajnoczi <stefanha@redhat.com>
3Date: Tue, 6 Oct 2020 10:58:26 +0100
4Subject: [PATCH] virtiofsd: avoid /proc/self/fd tempdir
5
6In order to prevent /proc/self/fd escapes a temporary directory is
7created where /proc/self/fd is bind-mounted. This doesn't work on
8read-only file systems.
9
10Avoid the temporary directory by bind-mounting /proc/self/fd over /proc.
11This does not affect other processes since we remounted / with MS_REC |
12MS_SLAVE. /proc must exist and virtiofsd does not use it so it's safe to
13do this.
14
15Path traversal can be tested with the following function:
16
17 static void test_proc_fd_escape(struct lo_data *lo)
18 {
19 int fd;
20 int level = 0;
21 ino_t last_ino = 0;
22
23 fd = lo->proc_self_fd;
24 for (;;) {
25 struct stat st;
26
27 if (fstat(fd, &st) != 0) {
28 perror("fstat");
29 return;
30 }
31 if (last_ino && st.st_ino == last_ino) {
32 fprintf(stderr, "inode number unchanged, stopping\n");
33 return;
34 }
35 last_ino = st.st_ino;
36
37 fprintf(stderr, "Level %d dev %lu ino %lu\n", level,
38 (unsigned long)st.st_dev,
39 (unsigned long)last_ino);
40 fd = openat(fd, "..", O_PATH | O_DIRECTORY | O_NOFOLLOW);
41 level++;
42 }
43 }
44
45Before and after this patch only Level 0 is displayed. Without
46/proc/self/fd bind-mount protection it is possible to traverse parent
47directories.
48
49Fixes: 397ae982f4df4 ("virtiofsd: jail lo->proc_self_fd")
50Cc: Miklos Szeredi <mszeredi@redhat.com>
51Cc: Jens Freimann <jfreimann@redhat.com>
52Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
53Message-Id: <20201006095826.59813-1-stefanha@redhat.com>
54Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
55Tested-by: Jens Freimann <jfreimann@redhat.com>
56Reviewed-by: Jens Freimann <jfreimann@redhat.com>
57Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
58
59
60Upstream-Status: Backport
61[https://github.com/qemu/qemu/commit/ebf101955ce8f8d72fba103b5151115a4335de2c]
62CVE: CVE-2020-35517
63Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
64
65---
66 tools/virtiofsd/passthrough_ll.c | 34 +++++++++++---------------------
67 1 file changed, 11 insertions(+), 23 deletions(-)
68
69diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
70index 477e6ee0b53..ff53df44510 100644
71--- a/tools/virtiofsd/passthrough_ll.c
72+++ b/tools/virtiofsd/passthrough_ll.c
73@@ -2393,8 +2393,6 @@ static void setup_wait_parent_capabilities(void)
74 static void setup_namespaces(struct lo_data *lo, struct fuse_session *se)
75 {
76 pid_t child;
77- char template[] = "virtiofsd-XXXXXX";
78- char *tmpdir;
79
80 /*
81 * Create a new pid namespace for *child* processes. We'll have to
82@@ -2458,33 +2456,23 @@ static void setup_namespaces(struct lo_data *lo, struct fuse_session *se)
83 exit(1);
84 }
85
86- tmpdir = mkdtemp(template);
87- if (!tmpdir) {
88- fuse_log(FUSE_LOG_ERR, "tmpdir(%s): %m\n", template);
89- exit(1);
90- }
91-
92- if (mount("/proc/self/fd", tmpdir, NULL, MS_BIND, NULL) < 0) {
93- fuse_log(FUSE_LOG_ERR, "mount(/proc/self/fd, %s, MS_BIND): %m\n",
94- tmpdir);
95+ /*
96+ * We only need /proc/self/fd. Prevent ".." from accessing parent
97+ * directories of /proc/self/fd by bind-mounting it over /proc. Since / was
98+ * previously remounted with MS_REC | MS_SLAVE this mount change only
99+ * affects our process.
100+ */
101+ if (mount("/proc/self/fd", "/proc", NULL, MS_BIND, NULL) < 0) {
102+ fuse_log(FUSE_LOG_ERR, "mount(/proc/self/fd, MS_BIND): %m\n");
103 exit(1);
104 }
105
106- /* Now we can get our /proc/self/fd directory file descriptor */
107- lo->proc_self_fd = open(tmpdir, O_PATH);
108+ /* Get the /proc (actually /proc/self/fd, see above) file descriptor */
109+ lo->proc_self_fd = open("/proc", O_PATH);
110 if (lo->proc_self_fd == -1) {
111- fuse_log(FUSE_LOG_ERR, "open(%s, O_PATH): %m\n", tmpdir);
112+ fuse_log(FUSE_LOG_ERR, "open(/proc, O_PATH): %m\n");
113 exit(1);
114 }
115-
116- if (umount2(tmpdir, MNT_DETACH) < 0) {
117- fuse_log(FUSE_LOG_ERR, "umount2(%s, MNT_DETACH): %m\n", tmpdir);
118- exit(1);
119- }
120-
121- if (rmdir(tmpdir) < 0) {
122- fuse_log(FUSE_LOG_ERR, "rmdir(%s): %m\n", tmpdir);
123- }
124 }
125
126 /*
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2021-20203.patch b/meta/recipes-devtools/qemu/qemu/CVE-2021-20203.patch
new file mode 100644
index 0000000000..31440af0bd
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2021-20203.patch
@@ -0,0 +1,74 @@
1From: Prasad J Pandit <pjp@fedoraproject.org>
2
3While activating device in vmxnet3_acticate_device(), it does not
4validate guest supplied configuration values against predefined
5minimum - maximum limits. This may lead to integer overflow or
6OOB access issues. Add checks to avoid it.
7
8Fixes: CVE-2021-20203
9Buglink: https://bugs.launchpad.net/qemu/+bug/1913873
10Reported-by: Gaoning Pan <pgn@zju.edu.cn>
11Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
12
13Upstream-Status: Acepted [https://lists.gnu.org/archive/html/qemu-devel/2021-01/msg07935.html]
14CVE: CVE-2021-20203
15Signed-off-by: Minjae Kim <flowergom@gmail.com>
16---
17 hw/net/vmxnet3.c | 13 +++++++++++++
18 1 file changed, 13 insertions(+)
19
20diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
21index eff299f629..4a910ca971 100644
22--- a/hw/net/vmxnet3.c
23+++ b/hw/net/vmxnet3.c
24@@ -1420,6 +1420,7 @@ static void vmxnet3_activate_device(VMXNET3State *s)
25 vmxnet3_setup_rx_filtering(s);
26 /* Cache fields from shared memory */
27 s->mtu = VMXNET3_READ_DRV_SHARED32(d, s->drv_shmem, devRead.misc.mtu);
28+ assert(VMXNET3_MIN_MTU <= s->mtu && s->mtu < VMXNET3_MAX_MTU);
29 VMW_CFPRN("MTU is %u", s->mtu);
30
31 s->max_rx_frags =
32@@ -1473,6 +1474,9 @@ static void vmxnet3_activate_device(VMXNET3State *s)
33 /* Read rings memory locations for TX queues */
34 pa = VMXNET3_READ_TX_QUEUE_DESCR64(d, qdescr_pa, conf.txRingBasePA);
35 size = VMXNET3_READ_TX_QUEUE_DESCR32(d, qdescr_pa, conf.txRingSize);
36+ if (size > VMXNET3_TX_RING_MAX_SIZE) {
37+ size = VMXNET3_TX_RING_MAX_SIZE;
38+ }
39
40 vmxnet3_ring_init(d, &s->txq_descr[i].tx_ring, pa, size,
41 sizeof(struct Vmxnet3_TxDesc), false);
42@@ -1483,6 +1487,9 @@ static void vmxnet3_activate_device(VMXNET3State *s)
43 /* TXC ring */
44 pa = VMXNET3_READ_TX_QUEUE_DESCR64(d, qdescr_pa, conf.compRingBasePA);
45 size = VMXNET3_READ_TX_QUEUE_DESCR32(d, qdescr_pa, conf.compRingSize);
46+ if (size > VMXNET3_TC_RING_MAX_SIZE) {
47+ size = VMXNET3_TC_RING_MAX_SIZE;
48+ }
49 vmxnet3_ring_init(d, &s->txq_descr[i].comp_ring, pa, size,
50 sizeof(struct Vmxnet3_TxCompDesc), true);
51 VMXNET3_RING_DUMP(VMW_CFPRN, "TXC", i, &s->txq_descr[i].comp_ring);
52@@ -1524,6 +1531,9 @@ static void vmxnet3_activate_device(VMXNET3State *s)
53 /* RX rings */
54 pa = VMXNET3_READ_RX_QUEUE_DESCR64(d, qd_pa, conf.rxRingBasePA[j]);
55 size = VMXNET3_READ_RX_QUEUE_DESCR32(d, qd_pa, conf.rxRingSize[j]);
56+ if (size > VMXNET3_RX_RING_MAX_SIZE) {
57+ size = VMXNET3_RX_RING_MAX_SIZE;
58+ }
59 vmxnet3_ring_init(d, &s->rxq_descr[i].rx_ring[j], pa, size,
60 sizeof(struct Vmxnet3_RxDesc), false);
61 VMW_CFPRN("RX queue %d:%d: Base: %" PRIx64 ", Size: %d",
62@@ -1533,6 +1543,9 @@ static void vmxnet3_activate_device(VMXNET3State *s)
63 /* RXC ring */
64 pa = VMXNET3_READ_RX_QUEUE_DESCR64(d, qd_pa, conf.compRingBasePA);
65 size = VMXNET3_READ_RX_QUEUE_DESCR32(d, qd_pa, conf.compRingSize);
66+ if (size > VMXNET3_RC_RING_MAX_SIZE) {
67+ size = VMXNET3_RC_RING_MAX_SIZE;
68+ }
69 vmxnet3_ring_init(d, &s->rxq_descr[i].comp_ring, pa, size,
70 sizeof(struct Vmxnet3_RxCompDesc), true);
71 VMW_CFPRN("RXC queue %d: Base: %" PRIx64 ", Size: %d", i, pa, size);
72--
732.29.2
74
diff --git a/meta/recipes-devtools/quilt/quilt.inc b/meta/recipes-devtools/quilt/quilt.inc
index d6d06c049c..d7ecda7aaa 100644
--- a/meta/recipes-devtools/quilt/quilt.inc
+++ b/meta/recipes-devtools/quilt/quilt.inc
@@ -30,7 +30,7 @@ EXTRA_OECONF = "--with-perl='${USRBINPATH}/env perl' --with-patch=patch"
30EXTRA_OECONF_append_class-native = " --disable-nls" 30EXTRA_OECONF_append_class-native = " --disable-nls"
31EXTRA_AUTORECONF += "--exclude=aclocal" 31EXTRA_AUTORECONF += "--exclude=aclocal"
32 32
33CACHED_CONFIGUREVARS += "ac_cv_path_BASH=/bin/bash" 33CACHED_CONFIGUREVARS += "ac_cv_path_BASH=/bin/bash ac_cv_path_COLUMN=column"
34 34
35# Make sure we don't have "-w" in shebang lines: it breaks using 35# Make sure we don't have "-w" in shebang lines: it breaks using
36# "/usr/bin/env perl" as parser 36# "/usr/bin/env perl" as parser
diff --git a/meta/recipes-devtools/rsync/files/0001-rsync-ssl-Verify-the-hostname-in-the-certificate-whe.patch b/meta/recipes-devtools/rsync/files/0001-rsync-ssl-Verify-the-hostname-in-the-certificate-whe.patch
new file mode 100644
index 0000000000..2d51ddf965
--- /dev/null
+++ b/meta/recipes-devtools/rsync/files/0001-rsync-ssl-Verify-the-hostname-in-the-certificate-whe.patch
@@ -0,0 +1,31 @@
1From fbe85634d88e82fbb439ae2a5d1aca8b8c309bea Mon Sep 17 00:00:00 2001
2From: Matt McCutchen <matt@mattmccutchen.net>
3Date: Wed, 26 Aug 2020 12:16:08 -0400
4Subject: [PATCH] rsync-ssl: Verify the hostname in the certificate when using
5 openssl.
6
7CVE: CVE-2020-14387
8
9Upstream-Status: Backport [https://git.samba.org/?p=rsync.git;a=commit;h=c3f7414]
10
11Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
12---
13 rsync-ssl | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-)
15
16diff --git a/rsync-ssl b/rsync-ssl
17index 8101975..46701af 100755
18--- a/rsync-ssl
19+++ b/rsync-ssl
20@@ -129,7 +129,7 @@ function rsync_ssl_helper {
21 fi
22
23 if [[ $RSYNC_SSL_TYPE == openssl ]]; then
24- exec $RSYNC_SSL_OPENSSL s_client $caopt $certopt -quiet -verify_quiet -servername $hostname -connect $hostname:$port
25+ exec $RSYNC_SSL_OPENSSL s_client $caopt $certopt -quiet -verify_quiet -servername $hostname -verify_hostname $hostname -connect $hostname:$port
26 elif [[ $RSYNC_SSL_TYPE == gnutls ]]; then
27 exec $RSYNC_SSL_GNUTLS --logfile=/dev/null $gnutls_cert_opt $gnutls_opts $hostname:$port
28 else
29--
302.17.1
31
diff --git a/meta/recipes-devtools/rsync/files/determism.patch b/meta/recipes-devtools/rsync/files/determism.patch
new file mode 100644
index 0000000000..53a4ca7505
--- /dev/null
+++ b/meta/recipes-devtools/rsync/files/determism.patch
@@ -0,0 +1,28 @@
1The Makefile calls awk on a "*.c" glob. The results of this glob are sorted
2but the order depends on the locale settings, particularly whether
3"util.c" and "util2.c" sort before or after each other. In en_US.UTF-8
4they sort one way, in C, they sort the other. The sorting order changes
5the output binaries. The behaviour also changes dependning on whether
6SHELL (/bin/sh) is dash or bash.
7
8Specify a C locale setting to be deterministic.
9
10Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
11Upstream-Status: Pending
12
13Index: rsync-3.2.3/Makefile.in
14===================================================================
15--- rsync-3.2.3.orig/Makefile.in
16+++ rsync-3.2.3/Makefile.in
17@@ -26,6 +26,11 @@ MKDIR_P=@MKDIR_P@
18 VPATH=$(srcdir)
19 SHELL=/bin/sh
20
21+# We use globbing in commands, need to be deterministic
22+unexport LC_ALL
23+LC_COLLATE=C
24+export LC_COLLATE
25+
26 .SUFFIXES:
27 .SUFFIXES: .c .o
28
diff --git a/meta/recipes-devtools/rsync/rsync_3.2.3.bb b/meta/recipes-devtools/rsync/rsync_3.2.3.bb
index 375efa0dea..df4fbbd0d2 100644
--- a/meta/recipes-devtools/rsync/rsync_3.2.3.bb
+++ b/meta/recipes-devtools/rsync/rsync_3.2.3.bb
@@ -12,6 +12,8 @@ DEPENDS = "popt"
12SRC_URI = "https://download.samba.org/pub/${BPN}/src/${BP}.tar.gz \ 12SRC_URI = "https://download.samba.org/pub/${BPN}/src/${BP}.tar.gz \
13 file://rsyncd.conf \ 13 file://rsyncd.conf \
14 file://makefile-no-rebuild.patch \ 14 file://makefile-no-rebuild.patch \
15 file://determism.patch \
16 file://0001-rsync-ssl-Verify-the-hostname-in-the-certificate-whe.patch \
15 " 17 "
16 18
17SRC_URI[sha256sum] = "becc3c504ceea499f4167a260040ccf4d9f2ef9499ad5683c179a697146ce50e" 19SRC_URI[sha256sum] = "becc3c504ceea499f4167a260040ccf4d9f2ef9499ad5683c179a697146ce50e"
@@ -38,7 +40,7 @@ PACKAGECONFIG[zstd] = "--enable-zstd,--disable-zstd,zstd"
38CACHED_CONFIGUREVARS += "rsync_cv_can_hardlink_special=yes rsync_cv_can_hardlink_symlink=yes" 40CACHED_CONFIGUREVARS += "rsync_cv_can_hardlink_special=yes rsync_cv_can_hardlink_symlink=yes"
39 41
40EXTRA_OEMAKE = 'STRIP=""' 42EXTRA_OEMAKE = 'STRIP=""'
41EXTRA_OECONF = "--disable-simd --disable-md2man --disable-asm" 43EXTRA_OECONF = "--disable-simd --disable-md2man --disable-asm --with-nobody-group=nogroup"
42 44
43# rsync 3.0 uses configure.sh instead of configure, and 45# rsync 3.0 uses configure.sh instead of configure, and
44# makefile checks the existence of configure.sh 46# makefile checks the existence of configure.sh
diff --git a/meta/recipes-devtools/ruby/ruby/0001-template-Makefile.in-do-not-write-host-cross-cc-item.patch b/meta/recipes-devtools/ruby/ruby/0001-template-Makefile.in-do-not-write-host-cross-cc-item.patch
new file mode 100644
index 0000000000..826daf2cda
--- /dev/null
+++ b/meta/recipes-devtools/ruby/ruby/0001-template-Makefile.in-do-not-write-host-cross-cc-item.patch
@@ -0,0 +1,32 @@
1From 2368d07660a93a2c41d63f3ab6054ca4daeef820 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Tue, 17 Nov 2020 18:31:40 +0000
4Subject: [PATCH] template/Makefile.in: do not write host cross-cc items into
5 target config
6
7This helps reproducibility.
8
9Upstream-Status: Inapproppriate [oe-core specific]
10Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
11---
12 template/Makefile.in | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-)
14
15diff --git a/template/Makefile.in b/template/Makefile.in
16index 10dc826..940ee07 100644
17--- a/template/Makefile.in
18+++ b/template/Makefile.in
19@@ -657,11 +657,11 @@ mjit_config.h:
20 echo '#endif'; \
21 quote MJIT_MIN_HEADER_NAME "$(MJIT_MIN_HEADER_NAME)"; \
22 sep=,; \
23- quote "MJIT_CC_COMMON " $(MJIT_CC); \
24+ quote "MJIT_CC_COMMON " ; \
25 quote "MJIT_CFLAGS MJIT_ARCHFLAG" $(MJIT_CFLAGS); \
26 quote "MJIT_OPTFLAGS " $(MJIT_OPTFLAGS); \
27 quote "MJIT_DEBUGFLAGS " $(MJIT_DEBUGFLAGS); \
28- quote "MJIT_LDSHARED " $(MJIT_LDSHARED); \
29+ quote "MJIT_LDSHARED " ; \
30 quote "MJIT_DLDFLAGS MJIT_ARCHFLAG" $(MJIT_DLDFLAGS); \
31 quote "MJIT_LIBS " $(LIBRUBYARG_SHARED); \
32 quote 'PRELOADENV "@PRELOADENV@"'; \
diff --git a/meta/recipes-devtools/ruby/ruby_2.7.1.bb b/meta/recipes-devtools/ruby/ruby_2.7.1.bb
index f87686f6f7..a6c65e887b 100644
--- a/meta/recipes-devtools/ruby/ruby_2.7.1.bb
+++ b/meta/recipes-devtools/ruby/ruby_2.7.1.bb
@@ -7,6 +7,7 @@ SRC_URI += " \
7 file://run-ptest \ 7 file://run-ptest \
8 file://0001-Modify-shebang-of-libexec-y2racc-and-libexec-racc2y.patch \ 8 file://0001-Modify-shebang-of-libexec-y2racc-and-libexec-racc2y.patch \
9 file://CVE-2020-25613.patch \ 9 file://CVE-2020-25613.patch \
10 file://0001-template-Makefile.in-do-not-write-host-cross-cc-item.patch \
10 " 11 "
11 12
12SRC_URI[md5sum] = "debb9c325bf65021214451660f46e909" 13SRC_URI[md5sum] = "debb9c325bf65021214451660f46e909"
diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
index f84a7e18c8..95dccb9cae 100755
--- a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
+++ b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
@@ -72,12 +72,12 @@ exec_postinst_scriptlets() {
72 else 72 else
73 echo "ERROR: postinst $i failed." 73 echo "ERROR: postinst $i failed."
74 [ "$POSTINST_LOGGING" = "1" ] && eval echo "ERROR: postinst $i failed." $append_log 74 [ "$POSTINST_LOGGING" = "1" ] && eval echo "ERROR: postinst $i failed." $append_log
75 remove_pi_dir=0 75 remove_rcsd_link=0
76 fi 76 fi
77 done 77 done
78} 78}
79 79
80remove_pi_dir=1 80remove_rcsd_link=1
81if $pm_installed; then 81if $pm_installed; then
82 case $pm in 82 case $pm in
83 "ipk") 83 "ipk")
@@ -92,9 +92,7 @@ else
92 exec_postinst_scriptlets 92 exec_postinst_scriptlets
93fi 93fi
94 94
95# since all postinstalls executed successfully, remove the postinstalls directory 95# since all postinstalls executed successfully, remove the rcS.d link
96# and the rcS.d link 96if [ $remove_rcsd_link = 1 ]; then
97if [ $remove_pi_dir = 1 ]; then
98 rm -rf $pi_dir
99 remove_rcsd_link 97 remove_rcsd_link
100fi 98fi
diff --git a/meta/recipes-devtools/strace/strace/run-ptest b/meta/recipes-devtools/strace/strace/run-ptest
index 4660207220..3a51fb0be9 100755
--- a/meta/recipes-devtools/strace/strace/run-ptest
+++ b/meta/recipes-devtools/strace/strace/run-ptest
@@ -1,5 +1,5 @@
1#!/bin/sh 1#!/bin/sh
2export TIMEOUT_DURATION=120 2export TIMEOUT_DURATION=240
3chown nobody tests 3chown nobody tests
4chown nobody tests/* 4chown nobody tests/*
5chown nobody ../ptest 5chown nobody ../ptest
diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
index ed14fe66b1..c1b05691b8 100644
--- a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
+++ b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
@@ -48,6 +48,7 @@ CFLAGS_append_libc-musl = " ${LCL_STOP_SERVICES}"
48CFLAGS_append_powerpc64 = " ${LCL_STOP_SERVICES}" 48CFLAGS_append_powerpc64 = " ${LCL_STOP_SERVICES}"
49CFLAGS_append_powerpc64le = " ${LCL_STOP_SERVICES}" 49CFLAGS_append_powerpc64le = " ${LCL_STOP_SERVICES}"
50CFLAGS_append_riscv64 = " ${LCL_STOP_SERVICES}" 50CFLAGS_append_riscv64 = " ${LCL_STOP_SERVICES}"
51CFLAGS_append_riscv32 = " ${LCL_STOP_SERVICES}"
51 52
52do_install() { 53do_install() {
53 oe_runmake install INSTALLROOT=${D} 54 oe_runmake install INSTALLROOT=${D}
diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-gdbserver_tests-Disable-nlcontrolc.vgtest-for-x86-64.patch b/meta/recipes-devtools/valgrind/valgrind/0001-gdbserver_tests-Disable-nlcontrolc.vgtest-for-x86-64.patch
new file mode 100644
index 0000000000..0bd8273cd8
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind/0001-gdbserver_tests-Disable-nlcontrolc.vgtest-for-x86-64.patch
@@ -0,0 +1,36 @@
1From d8c19e0bb9ca2fd48f223e1fdeffcafeb0aa1745 Mon Sep 17 00:00:00 2001
2From: Yi Fan Yu <yifan.yu@windriver.com>
3Date: Wed, 17 Feb 2021 14:53:44 -0500
4Subject: [PATCH] gdbserver_tests: Disable nlcontrolc.vgtest for x86-64
5
6Test hangs after glibc 2.33 uprev
7
8Using gdb to modify the timeout argument no longer
9affects how long `select` wait.
10
11https://bugs.kde.org/show_bug.cgi?id=432870
12Upstream-Status: Pending
13Waiting for upstream to take action.
14
15Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com>
16---
17 gdbserver_tests/nlcontrolc.vgtest | 3 ++-
18 1 file changed, 2 insertions(+), 1 deletion(-)
19
20diff --git a/gdbserver_tests/nlcontrolc.vgtest b/gdbserver_tests/nlcontrolc.vgtest
21index bb5308403..96d2b52bb 100644
22--- a/gdbserver_tests/nlcontrolc.vgtest
23+++ b/gdbserver_tests/nlcontrolc.vgtest
24@@ -13,7 +13,8 @@ args: 1000000000 1000000000 1000000000 BSBSBSBS 1
25 vgopts: --tool=none --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-nlcontrolc
26 stderr_filter: filter_stderr
27 # Bug 338633 nlcontrol hangs on arm64 currently.
28-prereq: test -e gdb -a -f vgdb.invoker && ! ../tests/arch_test arm64 && ! ../tests/os_test solaris
29+# Bug 432870 nlcontrolc hangs on x86-64 starting with glibc 2.33
30+prereq: test -e gdb -a -f vgdb.invoker && ! ../tests/arch_test arm64 && ! ../tests/os_test solaris && ! ../tests/arch_test amd64
31 progB: gdb
32 argsB: --quiet -l 60 --nx ./sleepers
33 stdinB: nlcontrolc.stdinB.gdb
34--
352.29.2
36
diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-helgrind-Intercept-libc-functions.patch b/meta/recipes-devtools/valgrind/valgrind/0001-helgrind-Intercept-libc-functions.patch
new file mode 100644
index 0000000000..f66df3d2d2
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind/0001-helgrind-Intercept-libc-functions.patch
@@ -0,0 +1,54 @@
1From cdec010444df5a4328e90d07a2024fdeefcc74b5 Mon Sep 17 00:00:00 2001
2From: Paul Floyd <paulf@free.fr>
3Date: Wed, 18 Nov 2020 12:49:20 -0400
4Subject: [PATCH] helgrind: Intercept libc functions
5
6PTH_FUNC definition needs to be modified in order to
7intercept posix thread functions in both libc and
8libpthread. In order to handle this in helgrind, weak alias
9the pthread functions in glibc.
10
11Upstream-Status: Submitted
12
13Signed-off-by: Paul Floyd <paulf@free.fr>
14Signed-off-by: Stacy Gaikovaia <stacy.gaikovaia@windriver.com>
15---
16 helgrind/hg_intercepts.c | 12 ++++++++++++
17 1 file changed, 12 insertions(+)
18
19diff --git a/helgrind/hg_intercepts.c b/helgrind/hg_intercepts.c
20index a10c3a4a3..316140ca6 100644
21--- a/helgrind/hg_intercepts.c
22+++ b/helgrind/hg_intercepts.c
23@@ -77,6 +77,11 @@
24 /*--- ---*/
25 /*----------------------------------------------------------------*/
26
27+#define hg_expand(tok) #tok
28+#define hg_str(tok) hg_expand(tok)
29+# define hg_weak_alias(name, aliasname) \
30+ extern __typeof (name) aliasname __attribute__ ((weak, alias(hg_str(name))))
31+
32 #if defined(VGO_solaris)
33 /* On Solaris, libpthread is just a filter library on top of libc.
34 * Threading and synchronization functions in runtime linker are not
35@@ -91,9 +96,16 @@
36 #define CREQ_PTHREAD_T Word
37 #define SEM_ERROR ret
38 #else
39+#ifdef MUSL_LIBC
40+#define PTH_FUNC(ret_ty, f, args...) \
41+ ret_ty I_WRAP_SONAME_FNNAME_ZZ(VG_Z_LIBPTHREAD_SONAME,f)(args); \
42+ ret_ty I_WRAP_SONAME_FNNAME_ZZ(VG_Z_LIBPTHREAD_SONAME,f)(args)
43+#else
44 #define PTH_FUNC(ret_ty, f, args...) \
45 ret_ty I_WRAP_SONAME_FNNAME_ZZ(VG_Z_LIBPTHREAD_SONAME,f)(args); \
46+ hg_weak_alias(I_WRAP_SONAME_FNNAME_ZZ(VG_Z_LIBPTHREAD_SONAME,f), I_WRAP_SONAME_FNNAME_ZZ(VG_Z_LIBC_SONAME,f)); \
47 ret_ty I_WRAP_SONAME_FNNAME_ZZ(VG_Z_LIBPTHREAD_SONAME,f)(args)
48+#endif
49 #define CREQ_PTHREAD_T pthread_t
50 #define SEM_ERROR errno
51 #endif /* VGO_solaris */
52--
532.17.1
54
diff --git a/meta/recipes-devtools/valgrind/valgrind/0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch b/meta/recipes-devtools/valgrind/valgrind/0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch
index 7985308e41..0c399ef52c 100644
--- a/meta/recipes-devtools/valgrind/valgrind/0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch
+++ b/meta/recipes-devtools/valgrind/valgrind/0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch
@@ -19,6 +19,11 @@ Upstream-Status: Pending
19Signed-off-by: Dave Lerner <dave.lerner@windriver.com> 19Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
20Signed-off-by: Tudor Florea <tudor.florea@enea.com> 20Signed-off-by: Tudor Florea <tudor.florea@enea.com>
21Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> 21Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
22
23Increase time limit to 90 s.
24(double of the expected time of drd/tests/std_list on qemuarm64)
25
26Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com>
22--- 27---
23 tests/vg_regtest.in | 75 +++++++++++++++++++++++++++++++++++++++-------------- 28 tests/vg_regtest.in | 75 +++++++++++++++++++++++++++++++++++++++--------------
24 1 file changed, 55 insertions(+), 20 deletions(-) 29 1 file changed, 55 insertions(+), 20 deletions(-)
@@ -66,7 +71,7 @@ index a441f42..cb05b52 100755
66 # Since most of the program time is spent in system() calls, need this to 71 # Since most of the program time is spent in system() calls, need this to
67 # propagate a Ctrl-C enabling us to quit. 72 # propagate a Ctrl-C enabling us to quit.
68-sub mysystem($) 73-sub mysystem($)
69+# Enforce 30 seconds limit for the test. 74+# Enforce 90 seconds limit for the test.
70+# This resume execution of the remaining tests if valgrind hangs. 75+# This resume execution of the remaining tests if valgrind hangs.
71+sub mysystem($) 76+sub mysystem($)
72 { 77 {
@@ -76,7 +81,7 @@ index a441f42..cb05b52 100755
76+ my $exit_code=0; 81+ my $exit_code=0;
77+ eval { 82+ eval {
78+ local $SIG{'ALRM'} = sub { die "timed out\n" }; 83+ local $SIG{'ALRM'} = sub { die "timed out\n" };
79+ alarm(30); 84+ alarm(90);
80+ $exit_code = system($_[0]); 85+ $exit_code = system($_[0]);
81+ alarm (0); 86+ alarm (0);
82+ ($exit_code == 2) and die "SIGINT\n"; # 2 is SIGINT 87+ ($exit_code == 2) and die "SIGINT\n"; # 2 is SIGINT
diff --git a/meta/recipes-devtools/valgrind/valgrind/remove-for-aarch64 b/meta/recipes-devtools/valgrind/valgrind/remove-for-aarch64
index a3a0c6e50f..93bfd45a4e 100644
--- a/meta/recipes-devtools/valgrind/valgrind/remove-for-aarch64
+++ b/meta/recipes-devtools/valgrind/valgrind/remove-for-aarch64
@@ -31,8 +31,6 @@ drd/tests/annotate_static
31drd/tests/annotate_trace_memory 31drd/tests/annotate_trace_memory
32drd/tests/annotate_trace_memory_xml 32drd/tests/annotate_trace_memory_xml
33drd/tests/atomic_var 33drd/tests/atomic_var
34drd/tests/bar_bad
35drd/tests/bar_bad_xml
36drd/tests/bar_trivial 34drd/tests/bar_trivial
37drd/tests/bug-235681 35drd/tests/bug-235681
38drd/tests/bug322621 36drd/tests/bug322621
diff --git a/meta/recipes-devtools/valgrind/valgrind/remove-for-all b/meta/recipes-devtools/valgrind/valgrind/remove-for-all
new file mode 100644
index 0000000000..d6a85c4735
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind/remove-for-all
@@ -0,0 +1,2 @@
1drd/tests/bar_bad
2drd/tests/bar_bad_xml
diff --git a/meta/recipes-devtools/valgrind/valgrind/run-ptest b/meta/recipes-devtools/valgrind/valgrind/run-ptest
index 97b0a85dbf..7217dfca5d 100755
--- a/meta/recipes-devtools/valgrind/valgrind/run-ptest
+++ b/meta/recipes-devtools/valgrind/valgrind/run-ptest
@@ -17,6 +17,12 @@ EXP_TOOLS="exp-bbv exp-dhat exp-sgcheck"
17GDB_BIN=@bindir@/gdb 17GDB_BIN=@bindir@/gdb
18cd ${VALGRIND_LIB}/ptest && ./gdbserver_tests/make_local_links ${GDB_BIN} 18cd ${VALGRIND_LIB}/ptest && ./gdbserver_tests/make_local_links ${GDB_BIN}
19 19
20echo "Hide valgrind tests that are non-deterministic"
21echo "Reported at https://bugs.kde.org/show_bug.cgi?id=430321"
22for i in `cat remove-for-all`; do
23 mv $i.vgtest $i.IGNORE;
24done
25
20arch=`arch` 26arch=`arch`
21if [ "$arch" = "aarch64" ]; then 27if [ "$arch" = "aarch64" ]; then
22 echo "Aarch64: Hide valgrind tests that result in defunct process and then out of memory" 28 echo "Aarch64: Hide valgrind tests that result in defunct process and then out of memory"
@@ -44,6 +50,10 @@ if [ "$arch" = "aarch64" ]; then
44 done 50 done
45fi 51fi
46 52
53echo "Restore valgrind tests that are non-deterministc"
54for i in `cat remove-for-all`; do
55 mv $i.IGNORE $i.vgtest;
56done
47 57
48passed=`grep PASS: ${LOG}|wc -l` 58passed=`grep PASS: ${LOG}|wc -l`
49failed=`grep FAIL: ${LOG}|wc -l` 59failed=`grep FAIL: ${LOG}|wc -l`
diff --git a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
index bcba55f327..fc070dec78 100644
--- a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
+++ b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
@@ -16,6 +16,7 @@ SRC_URI = "https://sourceware.org/pub/valgrind/valgrind-${PV}.tar.bz2 \
16 file://Added-support-for-PPC-instructions-mfatbu-mfatbl.patch \ 16 file://Added-support-for-PPC-instructions-mfatbu-mfatbl.patch \
17 file://run-ptest \ 17 file://run-ptest \
18 file://remove-for-aarch64 \ 18 file://remove-for-aarch64 \
19 file://remove-for-all \
19 file://0004-Fix-out-of-tree-builds.patch \ 20 file://0004-Fix-out-of-tree-builds.patch \
20 file://0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch \ 21 file://0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch \
21 file://0001-Remove-tests-that-fail-to-build-on-some-PPC32-config.patch \ 22 file://0001-Remove-tests-that-fail-to-build-on-some-PPC32-config.patch \
@@ -42,6 +43,8 @@ SRC_URI = "https://sourceware.org/pub/valgrind/valgrind-${PV}.tar.bz2 \
42 file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \ 43 file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \
43 file://0001-drd-Port-to-Fedora-33.patch \ 44 file://0001-drd-Port-to-Fedora-33.patch \
44 file://0001-drd-musl-fix.patch \ 45 file://0001-drd-musl-fix.patch \
46 file://0001-helgrind-Intercept-libc-functions.patch \
47 file://0001-gdbserver_tests-Disable-nlcontrolc.vgtest-for-x86-64.patch \
45 " 48 "
46SRC_URI[md5sum] = "d1b153f1ab17cf1f311705e7a83ef589" 49SRC_URI[md5sum] = "d1b153f1ab17cf1f311705e7a83ef589"
47SRC_URI[sha256sum] = "c91f3a2f7b02db0f3bc99479861656154d241d2fdb265614ba918cc6720a33ca" 50SRC_URI[sha256sum] = "c91f3a2f7b02db0f3bc99479861656154d241d2fdb265614ba918cc6720a33ca"
@@ -185,6 +188,7 @@ do_install_ptest() {
185 # The scripts reference config.h so add it to the top ptest dir. 188 # The scripts reference config.h so add it to the top ptest dir.
186 cp ${B}/config.h ${D}${PTEST_PATH} 189 cp ${B}/config.h ${D}${PTEST_PATH}
187 install -D ${WORKDIR}/remove-for-aarch64 ${D}${PTEST_PATH} 190 install -D ${WORKDIR}/remove-for-aarch64 ${D}${PTEST_PATH}
191 install -D ${WORKDIR}/remove-for-all ${D}${PTEST_PATH}
188 192
189 # Add an executable need by none/tests/bigcode 193 # Add an executable need by none/tests/bigcode
190 mkdir ${D}${PTEST_PATH}/perf 194 mkdir ${D}${PTEST_PATH}/perf
diff --git a/meta/recipes-devtools/xmlto/xmlto_0.0.28.bb b/meta/recipes-devtools/xmlto/xmlto_0.0.28.bb
index 7d27c43c83..5ed2709e31 100644
--- a/meta/recipes-devtools/xmlto/xmlto_0.0.28.bb
+++ b/meta/recipes-devtools/xmlto/xmlto_0.0.28.bb
@@ -29,7 +29,7 @@ RDEPENDS_${PN}_append_class-target = " \
29 libxslt-bin \ 29 libxslt-bin \
30 coreutils \ 30 coreutils \
31" 31"
32CACHED_CONFIGUREVARS += "ac_cv_path_TAIL=tail" 32CACHED_CONFIGUREVARS += "ac_cv_path_TAIL=tail ac_cv_path_GREP=grep"
33 33
34BBCLASSEXTEND = "native" 34BBCLASSEXTEND = "native"
35 35
diff --git a/meta/recipes-extended/acpica/acpica_20200717.bb b/meta/recipes-extended/acpica/acpica_20200717.bb
index d1d06c0c24..e3c8c2bdfb 100644
--- a/meta/recipes-extended/acpica/acpica_20200717.bb
+++ b/meta/recipes-extended/acpica/acpica_20200717.bb
@@ -34,6 +34,8 @@ EXTRA_OEMAKE = "CC='${CC}' \
34 PREFIX=${prefix} \ 34 PREFIX=${prefix} \
35 INSTALLDIR=${bindir} \ 35 INSTALLDIR=${bindir} \
36 INSTALLFLAGS= \ 36 INSTALLFLAGS= \
37 YACC=bison \
38 YFLAGS='-y --file-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}' \
37 " 39 "
38 40
39do_install() { 41do_install() {
diff --git a/meta/recipes-extended/asciidoc/asciidoc_9.0.2.bb b/meta/recipes-extended/asciidoc/asciidoc_9.0.2.bb
index 711bfbfb9b..5fd3832ef9 100644
--- a/meta/recipes-extended/asciidoc/asciidoc_9.0.2.bb
+++ b/meta/recipes-extended/asciidoc/asciidoc_9.0.2.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 \ 11SRC_URI = "git://github.com/asciidoc/asciidoc-py3;protocol=https;branch=main \
12 file://auto-catalogs.patch" 12 file://auto-catalogs.patch"
13SRCREV = "9a407dc9a497364c91421fd961954eddb565baf1" 13SRCREV = "9a407dc9a497364c91421fd961954eddb565baf1"
14 14
diff --git a/meta/recipes-extended/cups/cups.inc b/meta/recipes-extended/cups/cups.inc
index 87870e4aba..244c87001f 100644
--- a/meta/recipes-extended/cups/cups.inc
+++ b/meta/recipes-extended/cups/cups.inc
@@ -15,11 +15,19 @@ SRC_URI = "https://github.com/apple/cups/releases/download/v${PV}/${BP}-source.t
15 file://0004-cups-fix-multilib-install-file-conflicts.patch \ 15 file://0004-cups-fix-multilib-install-file-conflicts.patch \
16 file://volatiles.99_cups \ 16 file://volatiles.99_cups \
17 file://cups-volatiles.conf \ 17 file://cups-volatiles.conf \
18 file://CVE-2020-10001.patch \
18 " 19 "
19 20
20UPSTREAM_CHECK_URI = "https://github.com/apple/cups/releases" 21UPSTREAM_CHECK_URI = "https://github.com/apple/cups/releases"
21UPSTREAM_CHECK_REGEX = "cups-(?P<pver>\d+\.\d+(\.\d+)?)-source.tar" 22UPSTREAM_CHECK_REGEX = "cups-(?P<pver>\d+\.\d+(\.\d+)?)-source.tar"
22 23
24# Issue only applies to MacOS
25CVE_CHECK_WHITELIST += "CVE-2008-1033"
26# Issue affects pdfdistiller plugin used with but not part of cups
27CVE_CHECK_WHITELIST += "CVE-2009-0032"
28# This is an Ubuntu only issue.
29CVE_CHECK_WHITELIST += "CVE-2018-6553"
30
23LEAD_SONAME = "libcupsdriver.so" 31LEAD_SONAME = "libcupsdriver.so"
24 32
25CLEANBROKEN = "1" 33CLEANBROKEN = "1"
@@ -47,6 +55,8 @@ EXTRA_OECONF = " \
47 --enable-debug \ 55 --enable-debug \
48 --disable-relro \ 56 --disable-relro \
49 --enable-libusb \ 57 --enable-libusb \
58 --with-system-groups=lpadmin \
59 --with-cups-group=lp \
50 --with-domainsocket=/run/cups/cups.sock \ 60 --with-domainsocket=/run/cups/cups.sock \
51 DSOFLAGS='${LDFLAGS}' \ 61 DSOFLAGS='${LDFLAGS}' \
52 " 62 "
diff --git a/meta/recipes-extended/cups/cups/CVE-2020-10001.patch b/meta/recipes-extended/cups/cups/CVE-2020-10001.patch
new file mode 100644
index 0000000000..09a0a5765d
--- /dev/null
+++ b/meta/recipes-extended/cups/cups/CVE-2020-10001.patch
@@ -0,0 +1,74 @@
1From efbea1742bd30f842fbbfb87a473e5c84f4162f9 Mon Sep 17 00:00:00 2001
2From: Michael R Sweet <msweet@msweet.org>
3Date: Mon, 1 Feb 2021 15:02:32 -0500
4Subject: [PATCH] Fix a buffer (read) overflow in ippReadIO (CVE-2020-10001)
5
6Upstream-Status: Backport
7CVE: CVE-2020-10001
8
9Reference to upstream patch:
10[https://github.com/OpenPrinting/cups/commit/efbea1742bd30f842fbbfb87a473e5c84f4162f9]
11
12[SG: Addapted for version 2.3.3]
13Signed-off-by: Stefan Ghinea <stefan.ghinea@windriver.com>
14---
15 CHANGES.md | 2 ++
16 cups/ipp.c | 8 +++++---
17 2 files changed, 7 insertions(+), 3 deletions(-)
18
19diff --git a/CHANGES.md b/CHANGES.md
20index df72892..5ca12da 100644
21--- a/CHANGES.md
22+++ b/CHANGES.md
23@@ -4,6 +4,8 @@ CHANGES - 2.3.3 - 2020-04-24
24 Changes in CUPS v2.3.3
25 ----------------------
26
27+- Security: Fixed a buffer (read) overflow in the `ippReadIO` function
28+ (CVE-2020-10001)
29 - CVE-2020-3898: The `ppdOpen` function did not handle invalid UI
30 constraint. `ppdcSource::get_resolution` function did not handle
31 invalid resolution strings.
32diff --git a/cups/ipp.c b/cups/ipp.c
33index 3d52934..adbb26f 100644
34--- a/cups/ipp.c
35+++ b/cups/ipp.c
36@@ -2866,7 +2866,8 @@ ippReadIO(void *src, /* I - Data source */
37 unsigned char *buffer, /* Data buffer */
38 string[IPP_MAX_TEXT],
39 /* Small string buffer */
40- *bufptr; /* Pointer into buffer */
41+ *bufptr, /* Pointer into buffer */
42+ *bufend; /* End of buffer */
43 ipp_attribute_t *attr; /* Current attribute */
44 ipp_tag_t tag; /* Current tag */
45 ipp_tag_t value_tag; /* Current value tag */
46@@ -3441,6 +3442,7 @@ ippReadIO(void *src, /* I - Data source */
47 }
48
49 bufptr = buffer;
50+ bufend = buffer + n;
51
52 /*
53 * text-with-language and name-with-language are composite
54@@ -3454,7 +3456,7 @@ ippReadIO(void *src, /* I - Data source */
55
56 n = (bufptr[0] << 8) | bufptr[1];
57
58- if ((bufptr + 2 + n) >= (buffer + IPP_BUF_SIZE) || n >= (int)sizeof(string))
59+ if ((bufptr + 2 + n + 2) > bufend || n >= (int)sizeof(string))
60 {
61 _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
62 _("IPP language length overflows value."), 1);
63@@ -3481,7 +3483,7 @@ ippReadIO(void *src, /* I - Data source */
64 bufptr += 2 + n;
65 n = (bufptr[0] << 8) | bufptr[1];
66
67- if ((bufptr + 2 + n) >= (buffer + IPP_BUF_SIZE))
68+ if ((bufptr + 2 + n) > bufend)
69 {
70 _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
71 _("IPP string length overflows value."), 1);
72--
732.17.1
74
diff --git a/meta/recipes-extended/cwautomacros/cwautomacros_20110201.bb b/meta/recipes-extended/cwautomacros/cwautomacros_20110201.bb
index 65a99fc28d..02b016fdf1 100644
--- a/meta/recipes-extended/cwautomacros/cwautomacros_20110201.bb
+++ b/meta/recipes-extended/cwautomacros/cwautomacros_20110201.bb
@@ -13,7 +13,7 @@ do_configure() {
13} 13}
14 14
15do_install() { 15do_install() {
16 oe_runmake CWAUTOMACROSPREFIX=${D}${prefix} install 16 oe_runmake LABEL=`date -d @${SOURCE_DATE_EPOCH} +%Y%m%d` CWAUTOMACROSPREFIX=${D}${prefix} install
17 17
18 # cleanup buildpaths in autogen.sh 18 # cleanup buildpaths in autogen.sh
19 sed -i -e 's,${D},,g' ${D}${prefix}/share/cwautomacros/scripts/autogen.sh 19 sed -i -e 's,${D},,g' ${D}${prefix}/share/cwautomacros/scripts/autogen.sh
diff --git a/meta/recipes-extended/groff/files/0001-Include-config.h.patch b/meta/recipes-extended/groff/files/0001-Include-config.h.patch
index 348a61d9df..46065bc513 100644
--- a/meta/recipes-extended/groff/files/0001-Include-config.h.patch
+++ b/meta/recipes-extended/groff/files/0001-Include-config.h.patch
@@ -17,6 +17,9 @@ In file included from TOPDIR/build/tmp/work/aarch64-yoe-linux-musl/groff/1.22.4-
17 ^ 17 ^
18./lib/math.h:40:1: error: unknown type name '_GL_INLINE_HEADER_BEGIN' 18./lib/math.h:40:1: error: unknown type name '_GL_INLINE_HEADER_BEGIN'
19 19
20We delete eqn.cpp and qen.hpp in do_configure
21to ensure they're regenerated and deterministic.
22
20Upstream-Status: Pending 23Upstream-Status: Pending
21Signed-off-by: Khem Raj <raj.khem@gmail.com> 24Signed-off-by: Khem Raj <raj.khem@gmail.com>
22--- 25---
@@ -140,1029 +143,6 @@ index f95c05e..d875045 100644
140 #include <string.h> 143 #include <string.h>
141 #include <stdlib.h> 144 #include <stdlib.h>
142 145
143diff --git a/src/preproc/eqn/eqn.cpp b/src/preproc/eqn/eqn.cpp
144index 4ede465..fdd9484 100644
145--- a/src/preproc/eqn/eqn.cpp
146+++ b/src/preproc/eqn/eqn.cpp
147@@ -1,8 +1,9 @@
148-/* A Bison parser, made by GNU Bison 3.2. */
149+/* A Bison parser, made by GNU Bison 3.4.1. */
150
151 /* Bison implementation for Yacc-like parsers in C
152
153- Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
154+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
155+ Inc.
156
157 This program is free software: you can redistribute it and/or modify
158 it under the terms of the GNU General Public License as published by
159@@ -47,7 +48,7 @@
160 #define YYBISON 1
161
162 /* Bison version. */
163-#define YYBISON_VERSION "3.2"
164+#define YYBISON_VERSION "3.4.1"
165
166 /* Skeleton name. */
167 #define YYSKELETON_NAME "yacc.c"
168@@ -65,7 +66,11 @@
169
170
171 /* First part of user prologue. */
172-#line 18 "../src/preproc/eqn/eqn.ypp" /* yacc.c:338 */
173+#line 18 "src/preproc/eqn/eqn.ypp"
174+
175+#if HAVE_CONFIG_H
176+# include <config.h>
177+#endif
178
179 #include <stdio.h>
180 #include <string.h>
181@@ -77,7 +82,8 @@ extern int non_empty_flag;
182 int yylex();
183 void yyerror(const char *);
184
185-#line 81 "src/preproc/eqn/eqn.cpp" /* yacc.c:338 */
186+#line 86 "src/preproc/eqn/eqn.cpp"
187+
188 # ifndef YY_NULLPTR
189 # if defined __cplusplus
190 # if 201103L <= __cplusplus
191@@ -98,8 +104,8 @@ void yyerror(const char *);
192 # define YYERROR_VERBOSE 0
193 #endif
194
195-/* In a future release of Bison, this section will be replaced
196- by #include "y.tab.h". */
197+/* Use api.header.include to #include this header
198+ instead of duplicating it here. */
199 #ifndef YY_YY_SRC_PREPROC_EQN_EQN_HPP_INCLUDED
200 # define YY_YY_SRC_PREPROC_EQN_EQN_HPP_INCLUDED
201 /* Debug traces. */
202@@ -237,10 +243,9 @@ extern int yydebug;
203
204 /* Value type. */
205 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
206-
207 union YYSTYPE
208 {
209-#line 30 "../src/preproc/eqn/eqn.ypp" /* yacc.c:353 */
210+#line 34 "src/preproc/eqn/eqn.ypp"
211
212 char *str;
213 box *b;
214@@ -249,9 +254,9 @@ union YYSTYPE
215 int n;
216 column *col;
217
218-#line 253 "src/preproc/eqn/eqn.cpp" /* yacc.c:353 */
219-};
220+#line 258 "src/preproc/eqn/eqn.cpp"
221
222+};
223 typedef union YYSTYPE YYSTYPE;
224 # define YYSTYPE_IS_TRIVIAL 1
225 # define YYSTYPE_IS_DECLARED 1
226@@ -366,6 +371,8 @@ typedef short yytype_int16;
227 #endif
228
229
230+#define YY_ASSERT(E) ((void) (0 && (E)))
231+
232 #if ! defined yyoverflow || YYERROR_VERBOSE
233
234 /* The parser invokes alloca or malloc; define the necessary symbols. */
235@@ -508,16 +515,16 @@ union yyalloc
236 /* YYNSTATES -- Number of states. */
237 #define YYNSTATES 142
238
239-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
240- by yylex, with out-of-bounds checking. */
241 #define YYUNDEFTOK 2
242 #define YYMAXUTOK 315
243
244+/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
245+ as returned by yylex, with out-of-bounds checking. */
246 #define YYTRANSLATE(YYX) \
247 ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
248
249 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
250- as returned by yylex, without out-of-bounds checking. */
251+ as returned by yylex. */
252 static const yytype_uint8 yytranslate[] =
253 {
254 0, 2, 2, 2, 2, 2, 2, 2, 2, 63,
255@@ -558,14 +565,14 @@ static const yytype_uint8 yytranslate[] =
256 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
257 static const yytype_uint16 yyrline[] =
258 {
259- 0, 121, 121, 123, 128, 130, 141, 143, 145, 150,
260- 152, 154, 156, 158, 163, 165, 167, 169, 174, 176,
261- 181, 183, 185, 190, 192, 194, 196, 198, 200, 202,
262- 204, 206, 208, 210, 212, 214, 216, 218, 220, 222,
263- 224, 226, 228, 230, 232, 234, 236, 238, 240, 242,
264- 244, 246, 248, 250, 252, 254, 259, 269, 271, 276,
265- 278, 283, 285, 290, 292, 297, 299, 304, 306, 308,
266- 310, 314, 316, 321, 323, 325
267+ 0, 125, 125, 127, 132, 134, 145, 147, 149, 154,
268+ 156, 158, 160, 162, 167, 169, 171, 173, 178, 180,
269+ 185, 187, 189, 194, 196, 198, 200, 202, 204, 206,
270+ 208, 210, 212, 214, 216, 218, 220, 222, 224, 226,
271+ 228, 230, 232, 234, 236, 238, 240, 242, 244, 246,
272+ 248, 250, 252, 254, 256, 258, 263, 273, 275, 280,
273+ 282, 287, 289, 294, 296, 301, 303, 308, 310, 312,
274+ 314, 318, 320, 325, 327, 329
275 };
276 #endif
277
278@@ -818,22 +825,22 @@ static const yytype_uint8 yyr2[] =
279
280 #define YYRECOVERING() (!!yyerrstatus)
281
282-#define YYBACKUP(Token, Value) \
283-do \
284- if (yychar == YYEMPTY) \
285- { \
286- yychar = (Token); \
287- yylval = (Value); \
288- YYPOPSTACK (yylen); \
289- yystate = *yyssp; \
290- goto yybackup; \
291- } \
292- else \
293- { \
294- yyerror (YY_("syntax error: cannot back up")); \
295- YYERROR; \
296- } \
297-while (0)
298+#define YYBACKUP(Token, Value) \
299+ do \
300+ if (yychar == YYEMPTY) \
301+ { \
302+ yychar = (Token); \
303+ yylval = (Value); \
304+ YYPOPSTACK (yylen); \
305+ yystate = *yyssp; \
306+ goto yybackup; \
307+ } \
308+ else \
309+ { \
310+ yyerror (YY_("syntax error: cannot back up")); \
311+ YYERROR; \
312+ } \
313+ while (0)
314
315 /* Error token number */
316 #define YYTERROR 1
317@@ -948,7 +955,7 @@ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
318 YYFPRINTF (stderr, " $%d = ", yyi + 1);
319 yy_symbol_print (stderr,
320 yystos[yyssp[yyi + 1 - yynrhs]],
321- &(yyvsp[(yyi + 1) - (yynrhs)])
322+ &yyvsp[(yyi + 1) - (yynrhs)]
323 );
324 YYFPRINTF (stderr, "\n");
325 }
326@@ -1052,7 +1059,10 @@ yytnamerr (char *yyres, const char *yystr)
327 case '\\':
328 if (*++yyp != '\\')
329 goto do_not_strip_quotes;
330- /* Fall through. */
331+ else
332+ goto append;
333+
334+ append:
335 default:
336 if (yyres)
337 yyres[yyn] = *yyp;
338@@ -1148,10 +1158,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
339 yyarg[yycount++] = yytname[yyx];
340 {
341 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
342- if (! (yysize <= yysize1
343- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
344+ if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
345+ yysize = yysize1;
346+ else
347 return 2;
348- yysize = yysize1;
349 }
350 }
351 }
352@@ -1175,9 +1185,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
353
354 {
355 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
356- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
357+ if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
358+ yysize = yysize1;
359+ else
360 return 2;
361- yysize = yysize1;
362 }
363
364 if (*yymsg_alloc < yysize)
365@@ -1303,23 +1314,33 @@ yyparse (void)
366 yychar = YYEMPTY; /* Cause a token to be read. */
367 goto yysetstate;
368
369+
370 /*------------------------------------------------------------.
371-| yynewstate -- Push a new state, which is found in yystate. |
372+| yynewstate -- push a new state, which is found in yystate. |
373 `------------------------------------------------------------*/
374- yynewstate:
375+yynewstate:
376 /* In all cases, when you get here, the value and location stacks
377 have just been pushed. So pushing a state here evens the stacks. */
378 yyssp++;
379
380- yysetstate:
381+
382+/*--------------------------------------------------------------------.
383+| yynewstate -- set current state (the top of the stack) to yystate. |
384+`--------------------------------------------------------------------*/
385+yysetstate:
386+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
387+ YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
388 *yyssp = (yytype_int16) yystate;
389
390 if (yyss + yystacksize - 1 <= yyssp)
391+#if !defined yyoverflow && !defined YYSTACK_RELOCATE
392+ goto yyexhaustedlab;
393+#else
394 {
395 /* Get the current used size of the three stacks, in elements. */
396 YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
397
398-#ifdef yyoverflow
399+# if defined yyoverflow
400 {
401 /* Give user a chance to reallocate the stack. Use copies of
402 these so that the &'s don't force the real ones into
403@@ -1338,10 +1359,7 @@ yyparse (void)
404 yyss = yyss1;
405 yyvs = yyvs1;
406 }
407-#else /* no yyoverflow */
408-# ifndef YYSTACK_RELOCATE
409- goto yyexhaustedlab;
410-# else
411+# else /* defined YYSTACK_RELOCATE */
412 /* Extend the stack our own way. */
413 if (YYMAXDEPTH <= yystacksize)
414 goto yyexhaustedlab;
415@@ -1357,12 +1375,11 @@ yyparse (void)
416 goto yyexhaustedlab;
417 YYSTACK_RELOCATE (yyss_alloc, yyss);
418 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
419-# undef YYSTACK_RELOCATE
420+# undef YYSTACK_RELOCATE
421 if (yyss1 != yyssa)
422 YYSTACK_FREE (yyss1);
423 }
424 # endif
425-#endif /* no yyoverflow */
426
427 yyssp = yyss + yysize - 1;
428 yyvsp = yyvs + yysize - 1;
429@@ -1373,19 +1390,18 @@ yyparse (void)
430 if (yyss + yystacksize - 1 <= yyssp)
431 YYABORT;
432 }
433-
434- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
435+#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
436
437 if (yystate == YYFINAL)
438 YYACCEPT;
439
440 goto yybackup;
441
442+
443 /*-----------.
444 | yybackup. |
445 `-----------*/
446 yybackup:
447-
448 /* Do appropriate processing given the current state. Read a
449 lookahead token if we need one and don't already have one. */
450
451@@ -1443,7 +1459,6 @@ yybackup:
452 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
453 *++yyvsp = yylval;
454 YY_IGNORE_MAYBE_UNINITIALIZED_END
455-
456 goto yynewstate;
457
458
459@@ -1458,7 +1473,7 @@ yydefault:
460
461
462 /*-----------------------------.
463-| yyreduce -- Do a reduction. |
464+| yyreduce -- do a reduction. |
465 `-----------------------------*/
466 yyreduce:
467 /* yyn is the number of a rule to reduce with. */
468@@ -1478,20 +1493,20 @@ yyreduce:
469 YY_REDUCE_PRINT (yyn);
470 switch (yyn)
471 {
472- case 3:
473-#line 124 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
474+ case 3:
475+#line 128 "src/preproc/eqn/eqn.ypp"
476 { (yyvsp[0].b)->top_level(); non_empty_flag = 1; }
477-#line 1485 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
478+#line 1500 "src/preproc/eqn/eqn.cpp"
479 break;
480
481 case 4:
482-#line 129 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
483+#line 133 "src/preproc/eqn/eqn.ypp"
484 { (yyval.b) = (yyvsp[0].b); }
485-#line 1491 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
486+#line 1506 "src/preproc/eqn/eqn.cpp"
487 break;
488
489 case 5:
490-#line 131 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
491+#line 135 "src/preproc/eqn/eqn.ypp"
492 {
493 list_box *lb = (yyvsp[-1].b)->to_list_box();
494 if (!lb)
495@@ -1499,436 +1514,437 @@ yyreduce:
496 lb->append((yyvsp[0].b));
497 (yyval.b) = lb;
498 }
499-#line 1503 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
500+#line 1518 "src/preproc/eqn/eqn.cpp"
501 break;
502
503 case 6:
504-#line 142 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
505+#line 146 "src/preproc/eqn/eqn.ypp"
506 { (yyval.b) = (yyvsp[0].b); }
507-#line 1509 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
508+#line 1524 "src/preproc/eqn/eqn.cpp"
509 break;
510
511 case 7:
512-#line 144 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
513+#line 148 "src/preproc/eqn/eqn.ypp"
514 { (yyval.b) = make_mark_box((yyvsp[0].b)); }
515-#line 1515 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
516+#line 1530 "src/preproc/eqn/eqn.cpp"
517 break;
518
519 case 8:
520-#line 146 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
521+#line 150 "src/preproc/eqn/eqn.ypp"
522 { (yyval.b) = make_lineup_box((yyvsp[0].b)); }
523-#line 1521 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
524+#line 1536 "src/preproc/eqn/eqn.cpp"
525 break;
526
527 case 9:
528-#line 151 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
529+#line 155 "src/preproc/eqn/eqn.ypp"
530 { (yyval.b) = (yyvsp[0].b); }
531-#line 1527 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
532+#line 1542 "src/preproc/eqn/eqn.cpp"
533 break;
534
535 case 10:
536-#line 153 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
537+#line 157 "src/preproc/eqn/eqn.ypp"
538 { (yyval.b) = make_limit_box((yyvsp[-2].b), 0, (yyvsp[0].b)); }
539-#line 1533 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
540+#line 1548 "src/preproc/eqn/eqn.cpp"
541 break;
542
543 case 11:
544-#line 155 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
545+#line 159 "src/preproc/eqn/eqn.ypp"
546 { (yyval.b) = make_limit_box((yyvsp[-2].b), (yyvsp[0].b), 0); }
547-#line 1539 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
548+#line 1554 "src/preproc/eqn/eqn.cpp"
549 break;
550
551 case 12:
552-#line 157 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
553+#line 161 "src/preproc/eqn/eqn.ypp"
554 { (yyval.b) = make_limit_box((yyvsp[-4].b), (yyvsp[-2].b), (yyvsp[0].b)); }
555-#line 1545 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
556+#line 1560 "src/preproc/eqn/eqn.cpp"
557 break;
558
559 case 13:
560-#line 159 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
561+#line 163 "src/preproc/eqn/eqn.ypp"
562 { (yyval.b) = make_limit_box((yyvsp[-4].b), make_limit_box((yyvsp[-2].b), (yyvsp[0].b), 0), 0); }
563-#line 1551 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
564+#line 1566 "src/preproc/eqn/eqn.cpp"
565 break;
566
567 case 14:
568-#line 164 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
569+#line 168 "src/preproc/eqn/eqn.ypp"
570 { (yyval.b) = (yyvsp[0].b); }
571-#line 1557 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
572+#line 1572 "src/preproc/eqn/eqn.cpp"
573 break;
574
575 case 15:
576-#line 166 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
577+#line 170 "src/preproc/eqn/eqn.ypp"
578 { (yyval.b) = make_sqrt_box((yyvsp[0].b)); }
579-#line 1563 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
580+#line 1578 "src/preproc/eqn/eqn.cpp"
581 break;
582
583 case 16:
584-#line 168 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
585+#line 172 "src/preproc/eqn/eqn.ypp"
586 { (yyval.b) = make_over_box((yyvsp[-2].b), (yyvsp[0].b)); }
587-#line 1569 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
588+#line 1584 "src/preproc/eqn/eqn.cpp"
589 break;
590
591 case 17:
592-#line 170 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
593+#line 174 "src/preproc/eqn/eqn.ypp"
594 { (yyval.b) = make_small_over_box((yyvsp[-2].b), (yyvsp[0].b)); }
595-#line 1575 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
596+#line 1590 "src/preproc/eqn/eqn.cpp"
597 break;
598
599 case 18:
600-#line 175 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
601+#line 179 "src/preproc/eqn/eqn.ypp"
602 { (yyval.b) = (yyvsp[0].b); }
603-#line 1581 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
604+#line 1596 "src/preproc/eqn/eqn.cpp"
605 break;
606
607 case 19:
608-#line 177 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
609+#line 181 "src/preproc/eqn/eqn.ypp"
610 { (yyval.b) = make_script_box((yyvsp[-2].b), 0, (yyvsp[0].b)); }
611-#line 1587 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
612+#line 1602 "src/preproc/eqn/eqn.cpp"
613 break;
614
615 case 20:
616-#line 182 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
617+#line 186 "src/preproc/eqn/eqn.ypp"
618 { (yyval.b) = (yyvsp[0].b); }
619-#line 1593 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
620+#line 1608 "src/preproc/eqn/eqn.cpp"
621 break;
622
623 case 21:
624-#line 184 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
625+#line 188 "src/preproc/eqn/eqn.ypp"
626 { (yyval.b) = make_script_box((yyvsp[-2].b), (yyvsp[0].b), 0); }
627-#line 1599 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
628+#line 1614 "src/preproc/eqn/eqn.cpp"
629 break;
630
631 case 22:
632-#line 186 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
633+#line 190 "src/preproc/eqn/eqn.ypp"
634 { (yyval.b) = make_script_box((yyvsp[-4].b), (yyvsp[-2].b), (yyvsp[0].b)); }
635-#line 1605 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
636+#line 1620 "src/preproc/eqn/eqn.cpp"
637 break;
638
639 case 23:
640-#line 191 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
641+#line 195 "src/preproc/eqn/eqn.ypp"
642 { (yyval.b) = split_text((yyvsp[0].str)); }
643-#line 1611 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
644+#line 1626 "src/preproc/eqn/eqn.cpp"
645 break;
646
647 case 24:
648-#line 193 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
649+#line 197 "src/preproc/eqn/eqn.ypp"
650 { (yyval.b) = new quoted_text_box((yyvsp[0].str)); }
651-#line 1617 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
652+#line 1632 "src/preproc/eqn/eqn.cpp"
653 break;
654
655 case 25:
656-#line 195 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
657+#line 199 "src/preproc/eqn/eqn.ypp"
658 { (yyval.b) = split_text((yyvsp[0].str)); }
659-#line 1623 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
660+#line 1638 "src/preproc/eqn/eqn.cpp"
661 break;
662
663 case 26:
664-#line 197 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
665+#line 201 "src/preproc/eqn/eqn.ypp"
666 { (yyval.b) = new quoted_text_box((yyvsp[0].str)); }
667-#line 1629 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
668+#line 1644 "src/preproc/eqn/eqn.cpp"
669 break;
670
671 case 27:
672-#line 199 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
673+#line 203 "src/preproc/eqn/eqn.ypp"
674 { (yyval.b) = new half_space_box; }
675-#line 1635 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
676+#line 1650 "src/preproc/eqn/eqn.cpp"
677 break;
678
679 case 28:
680-#line 201 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
681+#line 205 "src/preproc/eqn/eqn.ypp"
682 { (yyval.b) = new space_box; }
683-#line 1641 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
684+#line 1656 "src/preproc/eqn/eqn.cpp"
685 break;
686
687 case 29:
688-#line 203 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
689+#line 207 "src/preproc/eqn/eqn.ypp"
690 { (yyval.b) = new tab_box; }
691-#line 1647 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
692+#line 1662 "src/preproc/eqn/eqn.cpp"
693 break;
694
695 case 30:
696-#line 205 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
697+#line 209 "src/preproc/eqn/eqn.ypp"
698 { (yyval.b) = (yyvsp[-1].b); }
699-#line 1653 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
700+#line 1668 "src/preproc/eqn/eqn.cpp"
701 break;
702
703 case 31:
704-#line 207 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
705+#line 211 "src/preproc/eqn/eqn.ypp"
706 { (yyvsp[0].pb)->set_alignment(CENTER_ALIGN); (yyval.b) = (yyvsp[0].pb); }
707-#line 1659 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
708+#line 1674 "src/preproc/eqn/eqn.cpp"
709 break;
710
711 case 32:
712-#line 209 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
713+#line 213 "src/preproc/eqn/eqn.ypp"
714 { (yyvsp[0].pb)->set_alignment(LEFT_ALIGN); (yyval.b) = (yyvsp[0].pb); }
715-#line 1665 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
716+#line 1680 "src/preproc/eqn/eqn.cpp"
717 break;
718
719 case 33:
720-#line 211 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
721+#line 215 "src/preproc/eqn/eqn.ypp"
722 { (yyvsp[0].pb)->set_alignment(RIGHT_ALIGN); (yyval.b) = (yyvsp[0].pb); }
723-#line 1671 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
724+#line 1686 "src/preproc/eqn/eqn.cpp"
725 break;
726
727 case 34:
728-#line 213 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
729+#line 217 "src/preproc/eqn/eqn.ypp"
730 { (yyvsp[0].pb)->set_alignment(CENTER_ALIGN); (yyval.b) = (yyvsp[0].pb); }
731-#line 1677 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
732+#line 1692 "src/preproc/eqn/eqn.cpp"
733 break;
734
735 case 35:
736-#line 215 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
737+#line 219 "src/preproc/eqn/eqn.ypp"
738 { (yyval.b) = (yyvsp[-1].mb); }
739-#line 1683 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
740+#line 1698 "src/preproc/eqn/eqn.cpp"
741 break;
742
743 case 36:
744-#line 217 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
745+#line 221 "src/preproc/eqn/eqn.ypp"
746 { (yyval.b) = make_delim_box((yyvsp[-3].str), (yyvsp[-2].b), (yyvsp[0].str)); }
747-#line 1689 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
748+#line 1704 "src/preproc/eqn/eqn.cpp"
749 break;
750
751 case 37:
752-#line 219 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
753+#line 223 "src/preproc/eqn/eqn.ypp"
754 { (yyval.b) = make_delim_box((yyvsp[-1].str), (yyvsp[0].b), 0); }
755-#line 1695 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
756+#line 1710 "src/preproc/eqn/eqn.cpp"
757 break;
758
759 case 38:
760-#line 221 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
761+#line 225 "src/preproc/eqn/eqn.ypp"
762 { (yyval.b) = make_overline_box((yyvsp[-1].b)); }
763-#line 1701 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
764+#line 1716 "src/preproc/eqn/eqn.cpp"
765 break;
766
767 case 39:
768-#line 223 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
769+#line 227 "src/preproc/eqn/eqn.ypp"
770 { (yyval.b) = make_underline_box((yyvsp[-1].b)); }
771-#line 1707 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
772+#line 1722 "src/preproc/eqn/eqn.cpp"
773 break;
774
775 case 40:
776-#line 225 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
777+#line 229 "src/preproc/eqn/eqn.ypp"
778 { (yyval.b) = make_prime_box((yyvsp[-1].b)); }
779-#line 1713 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
780+#line 1728 "src/preproc/eqn/eqn.cpp"
781 break;
782
783 case 41:
784-#line 227 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
785+#line 231 "src/preproc/eqn/eqn.ypp"
786 { (yyval.b) = make_accent_box((yyvsp[-2].b), (yyvsp[0].b)); }
787-#line 1719 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
788+#line 1734 "src/preproc/eqn/eqn.cpp"
789 break;
790
791 case 42:
792-#line 229 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
793+#line 233 "src/preproc/eqn/eqn.ypp"
794 { (yyval.b) = make_uaccent_box((yyvsp[-2].b), (yyvsp[0].b)); }
795-#line 1725 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
796+#line 1740 "src/preproc/eqn/eqn.cpp"
797 break;
798
799 case 43:
800-#line 231 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
801+#line 235 "src/preproc/eqn/eqn.ypp"
802 { (yyval.b) = new font_box(strsave(get_grfont()), (yyvsp[0].b)); }
803-#line 1731 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
804+#line 1746 "src/preproc/eqn/eqn.cpp"
805 break;
806
807 case 44:
808-#line 233 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
809+#line 237 "src/preproc/eqn/eqn.ypp"
810 { (yyval.b) = new font_box(strsave(get_gbfont()), (yyvsp[0].b)); }
811-#line 1737 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
812+#line 1752 "src/preproc/eqn/eqn.cpp"
813 break;
814
815 case 45:
816-#line 235 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
817+#line 239 "src/preproc/eqn/eqn.ypp"
818 { (yyval.b) = new font_box(strsave(get_gfont()), (yyvsp[0].b)); }
819-#line 1743 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
820+#line 1758 "src/preproc/eqn/eqn.cpp"
821 break;
822
823 case 46:
824-#line 237 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
825+#line 241 "src/preproc/eqn/eqn.ypp"
826 { (yyval.b) = new fat_box((yyvsp[0].b)); }
827-#line 1749 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
828+#line 1764 "src/preproc/eqn/eqn.cpp"
829 break;
830
831 case 47:
832-#line 239 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
833+#line 243 "src/preproc/eqn/eqn.ypp"
834 { (yyval.b) = new font_box((yyvsp[-1].str), (yyvsp[0].b)); }
835-#line 1755 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
836+#line 1770 "src/preproc/eqn/eqn.cpp"
837 break;
838
839 case 48:
840-#line 241 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
841+#line 245 "src/preproc/eqn/eqn.ypp"
842 { (yyval.b) = new size_box((yyvsp[-1].str), (yyvsp[0].b)); }
843-#line 1761 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
844+#line 1776 "src/preproc/eqn/eqn.cpp"
845 break;
846
847 case 49:
848-#line 243 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
849+#line 247 "src/preproc/eqn/eqn.ypp"
850 { (yyval.b) = new hmotion_box((yyvsp[-1].n), (yyvsp[0].b)); }
851-#line 1767 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
852+#line 1782 "src/preproc/eqn/eqn.cpp"
853 break;
854
855 case 50:
856-#line 245 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
857+#line 249 "src/preproc/eqn/eqn.ypp"
858 { (yyval.b) = new hmotion_box(-(yyvsp[-1].n), (yyvsp[0].b)); }
859-#line 1773 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
860+#line 1788 "src/preproc/eqn/eqn.cpp"
861 break;
862
863 case 51:
864-#line 247 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
865+#line 251 "src/preproc/eqn/eqn.ypp"
866 { (yyval.b) = new vmotion_box((yyvsp[-1].n), (yyvsp[0].b)); }
867-#line 1779 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
868+#line 1794 "src/preproc/eqn/eqn.cpp"
869 break;
870
871 case 52:
872-#line 249 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
873+#line 253 "src/preproc/eqn/eqn.ypp"
874 { (yyval.b) = new vmotion_box(-(yyvsp[-1].n), (yyvsp[0].b)); }
875-#line 1785 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
876+#line 1800 "src/preproc/eqn/eqn.cpp"
877 break;
878
879 case 53:
880-#line 251 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
881+#line 255 "src/preproc/eqn/eqn.ypp"
882 { (yyvsp[0].b)->set_spacing_type((yyvsp[-1].str)); (yyval.b) = (yyvsp[0].b); }
883-#line 1791 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
884+#line 1806 "src/preproc/eqn/eqn.cpp"
885 break;
886
887 case 54:
888-#line 253 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
889+#line 257 "src/preproc/eqn/eqn.ypp"
890 { (yyval.b) = new vcenter_box((yyvsp[0].b)); }
891-#line 1797 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
892+#line 1812 "src/preproc/eqn/eqn.cpp"
893 break;
894
895 case 55:
896-#line 255 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
897+#line 259 "src/preproc/eqn/eqn.ypp"
898 { (yyval.b) = make_special_box((yyvsp[-1].str), (yyvsp[0].b)); }
899-#line 1803 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
900+#line 1818 "src/preproc/eqn/eqn.cpp"
901 break;
902
903 case 56:
904-#line 260 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
905+#line 264 "src/preproc/eqn/eqn.ypp"
906 {
907 int n;
908 if (sscanf((yyvsp[0].str), "%d", &n) == 1)
909 (yyval.n) = n;
910 a_delete (yyvsp[0].str);
911 }
912-#line 1814 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
913+#line 1829 "src/preproc/eqn/eqn.cpp"
914 break;
915
916 case 57:
917-#line 270 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
918+#line 274 "src/preproc/eqn/eqn.ypp"
919 { (yyval.pb) = new pile_box((yyvsp[0].b)); }
920-#line 1820 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
921+#line 1835 "src/preproc/eqn/eqn.cpp"
922 break;
923
924 case 58:
925-#line 272 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
926+#line 276 "src/preproc/eqn/eqn.ypp"
927 { (yyvsp[-2].pb)->append((yyvsp[0].b)); (yyval.pb) = (yyvsp[-2].pb); }
928-#line 1826 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
929+#line 1841 "src/preproc/eqn/eqn.cpp"
930 break;
931
932 case 59:
933-#line 277 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
934+#line 281 "src/preproc/eqn/eqn.ypp"
935 { (yyval.pb) = (yyvsp[-1].pb); }
936-#line 1832 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
937+#line 1847 "src/preproc/eqn/eqn.cpp"
938 break;
939
940 case 60:
941-#line 279 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
942+#line 283 "src/preproc/eqn/eqn.ypp"
943 { (yyvsp[-1].pb)->set_space((yyvsp[-3].n)); (yyval.pb) = (yyvsp[-1].pb); }
944-#line 1838 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
945+#line 1853 "src/preproc/eqn/eqn.cpp"
946 break;
947
948 case 61:
949-#line 284 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
950+#line 288 "src/preproc/eqn/eqn.ypp"
951 { (yyval.mb) = new matrix_box((yyvsp[0].col)); }
952-#line 1844 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
953+#line 1859 "src/preproc/eqn/eqn.cpp"
954 break;
955
956 case 62:
957-#line 286 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
958+#line 290 "src/preproc/eqn/eqn.ypp"
959 { (yyvsp[-1].mb)->append((yyvsp[0].col)); (yyval.mb) = (yyvsp[-1].mb); }
960-#line 1850 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
961+#line 1865 "src/preproc/eqn/eqn.cpp"
962 break;
963
964 case 63:
965-#line 291 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
966+#line 295 "src/preproc/eqn/eqn.ypp"
967 { (yyval.col) = new column((yyvsp[0].b)); }
968-#line 1856 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
969+#line 1871 "src/preproc/eqn/eqn.cpp"
970 break;
971
972 case 64:
973-#line 293 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
974+#line 297 "src/preproc/eqn/eqn.ypp"
975 { (yyvsp[-2].col)->append((yyvsp[0].b)); (yyval.col) = (yyvsp[-2].col); }
976-#line 1862 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
977+#line 1877 "src/preproc/eqn/eqn.cpp"
978 break;
979
980 case 65:
981-#line 298 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
982+#line 302 "src/preproc/eqn/eqn.ypp"
983 { (yyval.col) = (yyvsp[-1].col); }
984-#line 1868 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
985+#line 1883 "src/preproc/eqn/eqn.cpp"
986 break;
987
988 case 66:
989-#line 300 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
990+#line 304 "src/preproc/eqn/eqn.ypp"
991 { (yyvsp[-1].col)->set_space((yyvsp[-3].n)); (yyval.col) = (yyvsp[-1].col); }
992-#line 1874 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
993+#line 1889 "src/preproc/eqn/eqn.cpp"
994 break;
995
996 case 67:
997-#line 305 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
998+#line 309 "src/preproc/eqn/eqn.ypp"
999 { (yyvsp[0].col)->set_alignment(CENTER_ALIGN); (yyval.col) = (yyvsp[0].col); }
1000-#line 1880 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
1001+#line 1895 "src/preproc/eqn/eqn.cpp"
1002 break;
1003
1004 case 68:
1005-#line 307 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
1006+#line 311 "src/preproc/eqn/eqn.ypp"
1007 { (yyvsp[0].col)->set_alignment(LEFT_ALIGN); (yyval.col) = (yyvsp[0].col); }
1008-#line 1886 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
1009+#line 1901 "src/preproc/eqn/eqn.cpp"
1010 break;
1011
1012 case 69:
1013-#line 309 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
1014+#line 313 "src/preproc/eqn/eqn.ypp"
1015 { (yyvsp[0].col)->set_alignment(RIGHT_ALIGN); (yyval.col) = (yyvsp[0].col); }
1016-#line 1892 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
1017+#line 1907 "src/preproc/eqn/eqn.cpp"
1018 break;
1019
1020 case 70:
1021-#line 311 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
1022+#line 315 "src/preproc/eqn/eqn.ypp"
1023 { (yyvsp[0].col)->set_alignment(CENTER_ALIGN); (yyval.col) = (yyvsp[0].col); }
1024-#line 1898 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
1025+#line 1913 "src/preproc/eqn/eqn.cpp"
1026 break;
1027
1028 case 71:
1029-#line 315 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
1030+#line 319 "src/preproc/eqn/eqn.ypp"
1031 { (yyval.str) = (yyvsp[0].str); }
1032-#line 1904 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
1033+#line 1919 "src/preproc/eqn/eqn.cpp"
1034 break;
1035
1036 case 72:
1037-#line 317 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
1038+#line 321 "src/preproc/eqn/eqn.ypp"
1039 { (yyval.str) = (yyvsp[0].str); }
1040-#line 1910 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
1041+#line 1925 "src/preproc/eqn/eqn.cpp"
1042 break;
1043
1044 case 73:
1045-#line 322 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
1046+#line 326 "src/preproc/eqn/eqn.ypp"
1047 { (yyval.str) = (yyvsp[0].str); }
1048-#line 1916 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
1049+#line 1931 "src/preproc/eqn/eqn.cpp"
1050 break;
1051
1052 case 74:
1053-#line 324 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
1054+#line 328 "src/preproc/eqn/eqn.ypp"
1055 { (yyval.str) = strsave("{"); }
1056-#line 1922 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
1057+#line 1937 "src/preproc/eqn/eqn.cpp"
1058 break;
1059
1060 case 75:
1061-#line 326 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1645 */
1062+#line 330 "src/preproc/eqn/eqn.ypp"
1063 { (yyval.str) = strsave("}"); }
1064-#line 1928 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
1065+#line 1943 "src/preproc/eqn/eqn.cpp"
1066 break;
1067
1068
1069-#line 1932 "src/preproc/eqn/eqn.cpp" /* yacc.c:1645 */
1070+#line 1947 "src/preproc/eqn/eqn.cpp"
1071+
1072 default: break;
1073 }
1074 /* User semantic actions sometimes alter yychar, and that requires
1075@@ -2042,12 +2058,10 @@ yyerrlab:
1076 | yyerrorlab -- error raised explicitly by YYERROR. |
1077 `---------------------------------------------------*/
1078 yyerrorlab:
1079-
1080- /* Pacify compilers like GCC when the user code never invokes
1081- YYERROR and the label yyerrorlab therefore never appears in user
1082- code. */
1083- if (/*CONSTCOND*/ 0)
1084- goto yyerrorlab;
1085+ /* Pacify compilers when the user code never invokes YYERROR and the
1086+ label yyerrorlab therefore never appears in user code. */
1087+ if (0)
1088+ YYERROR;
1089
1090 /* Do not reclaim the symbols of the rule whose action triggered
1091 this YYERROR. */
1092@@ -2109,6 +2123,7 @@ yyacceptlab:
1093 yyresult = 0;
1094 goto yyreturn;
1095
1096+
1097 /*-----------------------------------.
1098 | yyabortlab -- YYABORT comes here. |
1099 `-----------------------------------*/
1100@@ -2116,6 +2131,7 @@ yyabortlab:
1101 yyresult = 1;
1102 goto yyreturn;
1103
1104+
1105 #if !defined yyoverflow || YYERROR_VERBOSE
1106 /*-------------------------------------------------.
1107 | yyexhaustedlab -- memory exhaustion comes here. |
1108@@ -2126,6 +2142,10 @@ yyexhaustedlab:
1109 /* Fall through. */
1110 #endif
1111
1112+
1113+/*-----------------------------------------------------.
1114+| yyreturn -- parsing is finished, return the result. |
1115+`-----------------------------------------------------*/
1116 yyreturn:
1117 if (yychar != YYEMPTY)
1118 {
1119@@ -2155,5 +2175,5 @@ yyreturn:
1120 #endif
1121 return yyresult;
1122 }
1123-#line 329 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1903 */
1124+#line 333 "src/preproc/eqn/eqn.ypp"
1125
1126diff --git a/src/preproc/eqn/eqn.hpp b/src/preproc/eqn/eqn.hpp
1127index 32a32a5..9a092c1 100644
1128--- a/src/preproc/eqn/eqn.hpp
1129+++ b/src/preproc/eqn/eqn.hpp
1130@@ -1,8 +1,9 @@
1131-/* A Bison parser, made by GNU Bison 3.2. */
1132+/* A Bison parser, made by GNU Bison 3.4.1. */
1133
1134 /* Bison interface for Yacc-like parsers in C
1135
1136- Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
1137+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
1138+ Inc.
1139
1140 This program is free software: you can redistribute it and/or modify
1141 it under the terms of the GNU General Public License as published by
1142@@ -170,10 +171,9 @@ extern int yydebug;
1143
1144 /* Value type. */
1145 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1146-
1147 union YYSTYPE
1148 {
1149-#line 30 "../src/preproc/eqn/eqn.ypp" /* yacc.c:1906 */
1150+#line 34 "src/preproc/eqn/eqn.ypp"
1151
1152 char *str;
1153 box *b;
1154@@ -182,9 +182,9 @@ union YYSTYPE
1155 int n;
1156 column *col;
1157
1158-#line 186 "src/preproc/eqn/eqn.hpp" /* yacc.c:1906 */
1159-};
1160+#line 186 "src/preproc/eqn/eqn.hpp"
1161
1162+};
1163 typedef union YYSTYPE YYSTYPE;
1164 # define YYSTYPE_IS_TRIVIAL 1
1165 # define YYSTYPE_IS_DECLARED 1
1166diff --git a/src/preproc/eqn/eqn.ypp b/src/preproc/eqn/eqn.ypp 146diff --git a/src/preproc/eqn/eqn.ypp b/src/preproc/eqn/eqn.ypp
1167index fb318c3..b7b647e 100644 147index fb318c3..b7b647e 100644
1168--- a/src/preproc/eqn/eqn.ypp 148--- a/src/preproc/eqn/eqn.ypp
diff --git a/meta/recipes-extended/groff/groff_1.22.4.bb b/meta/recipes-extended/groff/groff_1.22.4.bb
index e398478349..7bb393e09c 100644
--- a/meta/recipes-extended/groff/groff_1.22.4.bb
+++ b/meta/recipes-extended/groff/groff_1.22.4.bb
@@ -18,6 +18,10 @@ SRC_URI = "${GNU_MIRROR}/groff/groff-${PV}.tar.gz \
18SRC_URI[md5sum] = "08fb04335e2f5e73f23ea4c3adbf0c5f" 18SRC_URI[md5sum] = "08fb04335e2f5e73f23ea4c3adbf0c5f"
19SRC_URI[sha256sum] = "e78e7b4cb7dec310849004fa88847c44701e8d133b5d4c13057d876c1bad0293" 19SRC_URI[sha256sum] = "e78e7b4cb7dec310849004fa88847c44701e8d133b5d4c13057d876c1bad0293"
20 20
21# Remove at the next upgrade
22PR = "r1"
23HASHEQUIV_HASH_VERSION .= ".1"
24
21DEPENDS = "bison-native" 25DEPENDS = "bison-native"
22RDEPENDS_${PN} += "perl sed" 26RDEPENDS_${PN} += "perl sed"
23 27
@@ -28,7 +32,14 @@ MULTILIB_SCRIPTS = "${PN}:${bindir}/gpinyin ${PN}:${bindir}/groffer ${PN}:${bind
28EXTRA_OECONF = "--without-x --without-doc" 32EXTRA_OECONF = "--without-x --without-doc"
29PARALLEL_MAKE = "" 33PARALLEL_MAKE = ""
30 34
31CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl' ac_cv_path_BASH_PROG='no'" 35CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl' ac_cv_path_BASH_PROG='no' PAGE=A4"
36
37# Delete these generated files since we depend on bison-native
38# and regenerate them. Do it deterministically (always).
39do_configure_prepend() {
40 rm -f ${S}/src/preproc/eqn/eqn.cpp
41 rm -f ${S}/src/preproc/eqn/eqn.hpp
42}
32 43
33do_install_append() { 44do_install_append() {
34 # Some distros have both /bin/perl and /usr/bin/perl, but we set perl location 45 # Some distros have both /bin/perl and /usr/bin/perl, but we set perl location
diff --git a/meta/recipes-extended/man-db/man-db_2.9.3.bb b/meta/recipes-extended/man-db/man-db_2.9.3.bb
index 0e6016a73c..e8da92bd19 100644
--- a/meta/recipes-extended/man-db/man-db_2.9.3.bb
+++ b/meta/recipes-extended/man-db/man-db_2.9.3.bb
@@ -11,6 +11,7 @@ SRC_URI[sha256sum] = "fa5aa11ab0692daf737e76947f45669225db310b2801a5911bceb7551c
11 11
12DEPENDS = "libpipeline gdbm groff-native base-passwd" 12DEPENDS = "libpipeline gdbm groff-native base-passwd"
13RDEPENDS_${PN} += "base-passwd" 13RDEPENDS_${PN} += "base-passwd"
14PACKAGE_WRITE_DEPS += "base-passwd"
14 15
15# | /usr/src/debug/man-db/2.8.0-r0/man-db-2.8.0/src/whatis.c:939: undefined reference to `_nl_msg_cat_cntr' 16# | /usr/src/debug/man-db/2.8.0-r0/man-db-2.8.0/src/whatis.c:939: undefined reference to `_nl_msg_cat_cntr'
16USE_NLS_libc-musl = "no" 17USE_NLS_libc-musl = "no"
@@ -20,6 +21,11 @@ inherit gettext pkgconfig autotools systemd
20EXTRA_OECONF = "--with-pager=less --with-systemdsystemunitdir=${systemd_unitdir}/system" 21EXTRA_OECONF = "--with-pager=less --with-systemdsystemunitdir=${systemd_unitdir}/system"
21EXTRA_AUTORECONF += "-I ${S}/gl/m4" 22EXTRA_AUTORECONF += "-I ${S}/gl/m4"
22 23
24# Can be dropped when the output next changes, avoids failures after
25# reproducibility issues
26PR = "r1"
27HASHEQUIV_HASH_VERSION .= ".1"
28
23do_install() { 29do_install() {
24 autotools_do_install 30 autotools_do_install
25 31
diff --git a/meta/recipes-extended/minicom/minicom_2.7.1.bb b/meta/recipes-extended/minicom/minicom_2.7.1.bb
index 03034864c8..6d61684e69 100644
--- a/meta/recipes-extended/minicom/minicom_2.7.1.bb
+++ b/meta/recipes-extended/minicom/minicom_2.7.1.bb
@@ -29,3 +29,5 @@ do_install() {
29} 29}
30 30
31RRECOMMENDS_${PN} += "lrzsz" 31RRECOMMENDS_${PN} += "lrzsz"
32
33RDEPENDS_${PN} += "ncurses-terminfo-base"
diff --git a/meta/recipes-extended/parted/parted_3.3.bb b/meta/recipes-extended/parted/parted_3.3.bb
index a1fd3ef07b..915ab05b65 100644
--- a/meta/recipes-extended/parted/parted_3.3.bb
+++ b/meta/recipes-extended/parted/parted_3.3.bb
@@ -3,7 +3,7 @@ HOMEPAGE = "http://www.gnu.org/software/parted/parted.html"
3LICENSE = "GPLv3+" 3LICENSE = "GPLv3+"
4LIC_FILES_CHKSUM = "file://COPYING;md5=2f31b266d3440dd7ee50f92cf67d8e6c" 4LIC_FILES_CHKSUM = "file://COPYING;md5=2f31b266d3440dd7ee50f92cf67d8e6c"
5SECTION = "console/tools" 5SECTION = "console/tools"
6DEPENDS = "ncurses readline util-linux virtual/libiconv" 6DEPENDS = "ncurses util-linux virtual/libiconv"
7 7
8SRC_URI = "${GNU_MIRROR}/parted/parted-${PV}.tar.xz \ 8SRC_URI = "${GNU_MIRROR}/parted/parted-${PV}.tar.xz \
9 file://no_check.patch \ 9 file://no_check.patch \
@@ -22,6 +22,9 @@ EXTRA_OECONF = "--disable-device-mapper"
22 22
23inherit autotools pkgconfig gettext texinfo ptest 23inherit autotools pkgconfig gettext texinfo ptest
24 24
25PACKAGECONFIG ?= "readline"
26PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline"
27
25BBCLASSEXTEND = "native nativesdk" 28BBCLASSEXTEND = "native nativesdk"
26 29
27do_compile_ptest() { 30do_compile_ptest() {
@@ -39,6 +42,7 @@ do_install_ptest() {
39 sed -i "s|^abs_srcdir =.*|abs_srcdir = \.|g" $t/tests/Makefile 42 sed -i "s|^abs_srcdir =.*|abs_srcdir = \.|g" $t/tests/Makefile
40 sed -i "s|^abs_top_srcdir =.*|abs_top_srcdir = \.\.|g" $t/tests/Makefile 43 sed -i "s|^abs_top_srcdir =.*|abs_top_srcdir = \.\.|g" $t/tests/Makefile
41 sed -i "s|^Makefile:.*|Makefile:|g" $t/tests/Makefile 44 sed -i "s|^Makefile:.*|Makefile:|g" $t/tests/Makefile
45 sed -i "/^BUILDINFO.*$/d" $t/tests/Makefile
42 for i in print-align print-max print-flags dup-clobber duplicate fs-resize; \ 46 for i in print-align print-max print-flags dup-clobber duplicate fs-resize; \
43 do cp ${B}/tests/.libs/$i $t/tests/; \ 47 do cp ${B}/tests/.libs/$i $t/tests/; \
44 done 48 done
diff --git a/meta/recipes-extended/screen/screen/CVE-2021-26937.patch b/meta/recipes-extended/screen/screen/CVE-2021-26937.patch
new file mode 100644
index 0000000000..983b35c1b0
--- /dev/null
+++ b/meta/recipes-extended/screen/screen/CVE-2021-26937.patch
@@ -0,0 +1,68 @@
1Description: [CVE-2021-26937] Fix out of bounds array access
2Author: Michael Schröder <mls@suse.de>
3Bug-Debian: https://bugs.debian.org/982435
4Bug: https://savannah.gnu.org/bugs/?60030
5Bug: https://lists.gnu.org/archive/html/screen-devel/2021-02/msg00000.html
6Bug-OSS-Security: https://www.openwall.com/lists/oss-security/2021/02/09/3
7Origin: https://lists.gnu.org/archive/html/screen-devel/2021-02/msg00010.html
8
9CVE: CVE-2021-26937
10Upstream-Status: Pending
11Signed-off-by: Scott Murray <scott.murray@konsulko.com>
12
13--- a/encoding.c
14+++ b/encoding.c
15@@ -43,7 +43,7 @@
16 # ifdef UTF8
17 static int recode_char __P((int, int, int));
18 static int recode_char_to_encoding __P((int, int));
19-static void comb_tofront __P((int, int));
20+static void comb_tofront __P((int));
21 # ifdef DW_CHARS
22 static int recode_char_dw __P((int, int *, int, int));
23 static int recode_char_dw_to_encoding __P((int, int *, int));
24@@ -1263,6 +1263,8 @@
25 {0x30000, 0x3FFFD},
26 };
27
28+ if (c >= 0xdf00 && c <= 0xdfff)
29+ return 1; /* dw combining sequence */
30 return ((bisearch(c, wide, sizeof(wide) / sizeof(struct interval) - 1)) ||
31 (cjkwidth &&
32 bisearch(c, ambiguous,
33@@ -1330,11 +1332,12 @@
34 }
35
36 static void
37-comb_tofront(root, i)
38-int root, i;
39+comb_tofront(i)
40+int i;
41 {
42 for (;;)
43 {
44+ int root = i >= 0x700 ? 0x801 : 0x800;
45 debug1("bring to front: %x\n", i);
46 combchars[combchars[i]->prev]->next = combchars[i]->next;
47 combchars[combchars[i]->next]->prev = combchars[i]->prev;
48@@ -1396,9 +1399,9 @@
49 {
50 /* full, recycle old entry */
51 if (c1 >= 0xd800 && c1 < 0xe000)
52- comb_tofront(root, c1 - 0xd800);
53+ comb_tofront(c1 - 0xd800);
54 i = combchars[root]->prev;
55- if (c1 == i + 0xd800)
56+ if (i == 0x800 || i == 0x801 || c1 == i + 0xd800)
57 {
58 /* completely full, can't recycle */
59 debug("utf8_handle_comp: completely full!\n");
60@@ -1422,7 +1425,7 @@
61 mc->font = (i >> 8) + 0xd8;
62 mc->fontx = 0;
63 debug3("combinig char %x %x -> %x\n", c1, c, i + 0xd800);
64- comb_tofront(root, i);
65+ comb_tofront(i);
66 }
67
68 #else /* !UTF8 */
diff --git a/meta/recipes-extended/screen/screen_4.8.0.bb b/meta/recipes-extended/screen/screen_4.8.0.bb
index 4772eb6c7a..fe640c262b 100644
--- a/meta/recipes-extended/screen/screen_4.8.0.bb
+++ b/meta/recipes-extended/screen/screen_4.8.0.bb
@@ -21,6 +21,7 @@ SRC_URI = "${GNU_MIRROR}/screen/screen-${PV}.tar.gz \
21 file://0002-comm.h-now-depends-on-term.h.patch \ 21 file://0002-comm.h-now-depends-on-term.h.patch \
22 file://0001-fix-for-multijob-build.patch \ 22 file://0001-fix-for-multijob-build.patch \
23 file://0001-Remove-more-compatibility-stuff.patch \ 23 file://0001-Remove-more-compatibility-stuff.patch \
24 file://CVE-2021-26937.patch \
24 " 25 "
25 26
26SRC_URI[md5sum] = "d276213d3acd10339cd37848b8c4ab1e" 27SRC_URI[md5sum] = "d276213d3acd10339cd37848b8c4ab1e"
diff --git a/meta/recipes-extended/shadow/shadow_4.8.1.bb b/meta/recipes-extended/shadow/shadow_4.8.1.bb
index c975395ff8..ff4aad926f 100644
--- a/meta/recipes-extended/shadow/shadow_4.8.1.bb
+++ b/meta/recipes-extended/shadow/shadow_4.8.1.bb
@@ -6,5 +6,6 @@ BUILD_LDFLAGS_append_class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'p
6 6
7BBCLASSEXTEND = "native nativesdk" 7BBCLASSEXTEND = "native nativesdk"
8 8
9 9# Severity is low and marked as closed and won't fix.
10 10# https://bugzilla.redhat.com/show_bug.cgi?id=884658
11CVE_CHECK_WHITELIST += "CVE-2013-4235"
diff --git a/meta/recipes-extended/sudo/files/0001-sudo.conf.in-fix-conflict-with-multilib.patch b/meta/recipes-extended/sudo/files/0001-sudo.conf.in-fix-conflict-with-multilib.patch
new file mode 100644
index 0000000000..f7ccfdd623
--- /dev/null
+++ b/meta/recipes-extended/sudo/files/0001-sudo.conf.in-fix-conflict-with-multilib.patch
@@ -0,0 +1,52 @@
1sudo.conf.in: fix conflict with multilib
2
3When pass ${libdir} to --libexecdir of sudo, it fails to install sudo
4and lib32-sudo at same time:
5
6| Error: Transaction test error:
7| file /etc/sudo.conf conflicts between attempted installs of
8 sudo-1.9.3p1-r0.core2_64 and lib32-sudo-1.9.3p1-r0.core2_32
9
10Update the comments in sudo.conf.in to avoid the conflict.
11
12Signed-off-by: Kai Kang <kai.kang@windriver.com>
13
14Upstream-Status: Inappropriate [OE configuration specific]
15---
16 examples/sudo.conf.in | 6 +++---
17 1 file changed, 3 insertions(+), 3 deletions(-)
18
19diff --git a/examples/sudo.conf.in b/examples/sudo.conf.in
20index 19e33ff..af78235 100644
21--- a/examples/sudo.conf.in
22+++ b/examples/sudo.conf.in
23@@ -4,7 +4,7 @@
24 # Sudo plugins:
25 # Plugin plugin_name plugin_path plugin_options ...
26 #
27-# The plugin_path is relative to @plugindir@ unless
28+# The plugin_path is relative to $plugindir such as /usr/lib/sudo unless
29 # fully qualified.
30 # The plugin_name corresponds to a global symbol in the plugin
31 # that contains the plugin interface structure.
32@@ -50,7 +50,7 @@ Plugin sudoers_audit sudoers.so
33 # The compiled-in value is usually sufficient and should only be changed
34 # if you rename or move the sudo_noexec.so file.
35 #
36-#Path noexec @plugindir@/sudo_noexec.so
37+#Path noexec $plugindir/sudo_noexec.so
38
39 #
40 # Sudo plugin directory:
41@@ -59,7 +59,7 @@ Plugin sudoers_audit sudoers.so
42 # The default directory to use when searching for plugins that are
43 # specified without a fully qualified path name.
44 #
45-#Path plugin_dir @plugindir@
46+#Path plugin_dir $plugindir
47
48 #
49 # Sudo developer mode:
50--
512.17.1
52
diff --git a/meta/recipes-extended/sudo/files/CVE-2021-23239.patch b/meta/recipes-extended/sudo/files/CVE-2021-23239.patch
new file mode 100644
index 0000000000..e16baecd5a
--- /dev/null
+++ b/meta/recipes-extended/sudo/files/CVE-2021-23239.patch
@@ -0,0 +1,62 @@
1
2# HG changeset patch
3# User Todd C. Miller <Todd.Miller@sudo.ws>
4# Date 1609953360 25200
5# Node ID ea19d0073c02951bbbf35342dd63304da83edce8
6# Parent f1ca39a0d87089d005b78a2556e2b1a2dc17f672
7Fix potential directory existing info leak in sudoedit.
8When creating a new file, sudoedit checks to make sure the parent
9directory exists so it can provide the user with a sensible error
10message. However, this could be used to test for the existence of
11directories not normally accessible to the user by pointing to them
12with a symbolic link when the parent directory is controlled by the
13user. Problem reported by Matthias Gerstner of SUSE.
14
15Upstream-Status: Backport [https://www.sudo.ws/repos/sudo/rev/ea19d0073c02]
16CVE: CVE-2021-23239
17Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
18
19diff -r f1ca39a0d870 -r ea19d0073c02 src/sudo_edit.c
20--- a/src/sudo_edit.c Wed Jan 06 10:16:00 2021 -0700
21+++ b/src/sudo_edit.c Wed Jan 06 10:16:00 2021 -0700
22@@ -541,14 +541,33 @@
23 S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH, command_details);
24 if (ofd != -1 || errno == ENOENT) {
25 if (ofd == -1) {
26- /* New file, verify parent dir exists unless in cwd. */
27+ /*
28+ * New file, verify parent dir exists unless in cwd.
29+ * This fails early so the user knows ahead of time if the
30+ * edit won't succeed. Additional checks are performed
31+ * when copying the temporary file back to the origin.
32+ */
33 char *slash = strrchr(files[i], '/');
34 if (slash != NULL && slash != files[i]) {
35- int serrno = errno;
36+ const int sflags = command_details->flags;
37+ const int serrno = errno;
38+ int dfd;
39+
40+ /*
41+ * The parent directory is allowed to be a symbolic
42+ * link as long as *its* parent is not writable.
43+ */
44 *slash = '\0';
45- if (stat(files[i], &sb) == 0 && S_ISDIR(sb.st_mode)) {
46- memset(&sb, 0, sizeof(sb));
47- rc = 0;
48+ SET(command_details->flags, CD_SUDOEDIT_FOLLOW);
49+ dfd = sudo_edit_open(files[i], DIR_OPEN_FLAGS,
50+ S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH, command_details);
51+ command_details->flags = sflags;
52+ if (dfd != -1) {
53+ if (fstat(dfd, &sb) == 0 && S_ISDIR(sb.st_mode)) {
54+ memset(&sb, 0, sizeof(sb));
55+ rc = 0;
56+ }
57+ close(dfd);
58 }
59 *slash = '/';
60 errno = serrno;
61
62
diff --git a/meta/recipes-extended/sudo/files/CVE-2021-23240.patch b/meta/recipes-extended/sudo/files/CVE-2021-23240.patch
new file mode 100644
index 0000000000..740a13cd90
--- /dev/null
+++ b/meta/recipes-extended/sudo/files/CVE-2021-23240.patch
@@ -0,0 +1,419 @@
1Upstream-Status: Backport [https://www.sudo.ws/repos/sudo/rev/8fcb36ef422a]
2Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
3CVE: CVE-2021-23240
4
5# HG changeset patch
6# User Todd C. Miller <Todd.Miller@sudo.ws>
7# Date 1609953360 25200
8# Node ID 8fcb36ef422a251fe33738a347551439944a4a37
9# Parent ea19d0073c02951bbbf35342dd63304da83edce8
10Add security checks before using temp files for SELinux RBAC sudoedit.
11Otherwise, it may be possible for the user running sudoedit to
12replace the newly-created temporary files with a symbolic link and
13have sudoedit set the owner of an arbitrary file.
14Problem reported by Matthias Gerstner of SUSE.
15
16diff -r ea19d0073c02 -r 8fcb36ef422a src/copy_file.c
17--- a/src/copy_file.c Wed Jan 06 10:16:00 2021 -0700
18+++ b/src/copy_file.c Wed Jan 06 10:16:00 2021 -0700
19@@ -1,7 +1,7 @@
20 /*
21 * SPDX-License-Identifier: ISC
22 *
23- * Copyright (c) 2020 Todd C. Miller <Todd.Miller@sudo.ws>
24+ * Copyright (c) 2020-2021 Todd C. Miller <Todd.Miller@sudo.ws>
25 *
26 * Permission to use, copy, modify, and distribute this software for any
27 * purpose with or without fee is hereby granted, provided that the above
28@@ -23,6 +23,8 @@
29
30 #include <config.h>
31
32+#include <sys/stat.h>
33+
34 #include <stdlib.h>
35 #include <unistd.h>
36 #include <errno.h>
37@@ -134,3 +136,34 @@
38 sudo_warn(U_("unable to write to %s"), dst);
39 debug_return_int(-1);
40 }
41+
42+#ifdef HAVE_SELINUX
43+bool
44+sudo_check_temp_file(int tfd, const char *tfile, uid_t uid, struct stat *sb)
45+{
46+ struct stat sbuf;
47+ debug_decl(sudo_check_temp_file, SUDO_DEBUG_UTIL);
48+
49+ if (sb == NULL)
50+ sb = &sbuf;
51+
52+ if (fstat(tfd, sb) == -1) {
53+ sudo_warn(U_("unable to stat %s"), tfile);
54+ debug_return_bool(false);
55+ }
56+ if (!S_ISREG(sb->st_mode)) {
57+ sudo_warnx(U_("%s: not a regular file"), tfile);
58+ debug_return_bool(false);
59+ }
60+ if ((sb->st_mode & ALLPERMS) != (S_IRUSR|S_IWUSR)) {
61+ sudo_warnx(U_("%s: bad file mode: 0%o"), tfile, sb->st_mode & ALLPERMS);
62+ debug_return_bool(false);
63+ }
64+ if (sb->st_uid != uid) {
65+ sudo_warnx(U_("%s is owned by uid %u, should be %u"),
66+ tfile, (unsigned int)sb->st_uid, (unsigned int)uid);
67+ debug_return_bool(false);
68+ }
69+ debug_return_bool(true);
70+}
71+#endif /* SELINUX */
72diff -r ea19d0073c02 -r 8fcb36ef422a src/sesh.c
73--- a/src/sesh.c Wed Jan 06 10:16:00 2021 -0700
74+++ b/src/sesh.c Wed Jan 06 10:16:00 2021 -0700
75@@ -1,7 +1,7 @@
76 /*
77 * SPDX-License-Identifier: ISC
78 *
79- * Copyright (c) 2008, 2010-2018, 2020 Todd C. Miller <Todd.Miller@sudo.ws>
80+ * Copyright (c) 2008, 2010-2018, 2020-2021 Todd C. Miller <Todd.Miller@sudo.ws>
81 *
82 * Permission to use, copy, modify, and distribute this software for any
83 * purpose with or without fee is hereby granted, provided that the above
84@@ -132,7 +132,7 @@
85 static int
86 sesh_sudoedit(int argc, char *argv[])
87 {
88- int i, oflags_dst, post, ret = SESH_ERR_FAILURE;
89+ int i, oflags_src, oflags_dst, post, ret = SESH_ERR_FAILURE;
90 int fd_src = -1, fd_dst = -1, follow = 0;
91 struct stat sb;
92 struct timespec times[2];
93@@ -174,10 +174,12 @@
94 debug_return_int(SESH_ERR_BAD_PATHS);
95
96 /*
97- * Use O_EXCL if we are not in the post editing stage
98- * so that it's ensured that the temporary files are
99- * created by us and that we are not opening any symlinks.
100+ * In the pre-editing stage, use O_EXCL to ensure that the temporary
101+ * files are created by us and that we are not opening any symlinks.
102+ * In the post-editing stage, use O_NOFOLLOW so we don't follow symlinks
103+ * when opening the temporary files.
104 */
105+ oflags_src = O_RDONLY|(post ? O_NONBLOCK|O_NOFOLLOW : follow);
106 oflags_dst = O_WRONLY|O_CREAT|(post ? follow : O_EXCL);
107 for (i = 0; i < argc - 1; i += 2) {
108 const char *path_src = argv[i];
109@@ -187,7 +189,7 @@
110 * doesn't exist, that's OK, we'll create an empty
111 * destination file.
112 */
113- if ((fd_src = open(path_src, O_RDONLY|follow, S_IRUSR|S_IWUSR)) < 0) {
114+ if ((fd_src = open(path_src, oflags_src, S_IRUSR|S_IWUSR)) < 0) {
115 if (errno != ENOENT) {
116 sudo_warn("%s", path_src);
117 if (post) {
118@@ -197,6 +199,14 @@
119 goto cleanup_0;
120 }
121 }
122+ if (post) {
123+ /* Make sure the temporary file is safe and has the proper owner. */
124+ if (!sudo_check_temp_file(fd_src, path_src, geteuid(), &sb)) {
125+ ret = SESH_ERR_SOME_FILES;
126+ goto nocleanup;
127+ }
128+ fcntl(fd_src, F_SETFL, fcntl(fd_src, F_GETFL, 0) & ~O_NONBLOCK);
129+ }
130
131 if ((fd_dst = open(path_dst, oflags_dst, post ?
132 (S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) : (S_IRUSR|S_IWUSR))) < 0) {
133@@ -214,10 +224,7 @@
134 off_t len_dst = -1;
135
136 if (post) {
137- if (fstat(fd_src, &sb) != 0) {
138- ret = SESH_ERR_SOME_FILES;
139- goto nocleanup;
140- }
141+ /* sudo_check_temp_file() filled in sb for us. */
142 len_src = sb.st_size;
143 if (fstat(fd_dst, &sb) != 0) {
144 ret = SESH_ERR_SOME_FILES;
145diff -r ea19d0073c02 -r 8fcb36ef422a src/sudo_edit.c
146--- a/src/sudo_edit.c Wed Jan 06 10:16:00 2021 -0700
147+++ b/src/sudo_edit.c Wed Jan 06 10:16:00 2021 -0700
148@@ -1,7 +1,7 @@
149 /*
150 * SPDX-License-Identifier: ISC
151 *
152- * Copyright (c) 2004-2008, 2010-2020 Todd C. Miller <Todd.Miller@sudo.ws>
153+ * Copyright (c) 2004-2008, 2010-2021 Todd C. Miller <Todd.Miller@sudo.ws>
154 *
155 * Permission to use, copy, modify, and distribute this software for any
156 * purpose with or without fee is hereby granted, provided that the above
157@@ -259,8 +259,10 @@
158 } else {
159 len = asprintf(tfile, "%s/%s.XXXXXXXX", edit_tmpdir, cp);
160 }
161- if (len == -1)
162- sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
163+ if (len == -1) {
164+ sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
165+ debug_return_int(-1);
166+ }
167 tfd = mkstemps(*tfile, suff ? strlen(suff) : 0);
168 sudo_debug_printf(SUDO_DEBUG_INFO|SUDO_DEBUG_LINENO,
169 "%s -> %s, fd %d", ofile, *tfile, tfd);
170@@ -735,7 +737,8 @@
171
172 #ifdef HAVE_SELINUX
173 static int
174-selinux_run_helper(char *argv[], char *envp[])
175+selinux_run_helper(uid_t uid, gid_t gid, int ngroups, GETGROUPS_T *groups,
176+ char *const argv[], char *const envp[])
177 {
178 int status, ret = SESH_ERR_FAILURE;
179 const char *sesh;
180@@ -755,8 +758,10 @@
181 break;
182 case 0:
183 /* child runs sesh in new context */
184- if (selinux_setcon() == 0)
185+ if (selinux_setcon() == 0) {
186+ switch_user(uid, gid, ngroups, groups);
187 execve(sesh, argv, envp);
188+ }
189 _exit(SESH_ERR_FAILURE);
190 default:
191 /* parent waits */
192@@ -775,7 +780,7 @@
193 struct tempfile *tf, char *files[], int nfiles)
194 {
195 char **sesh_args, **sesh_ap;
196- int i, rc, sesh_nargs;
197+ int i, error, sesh_nargs, ret = -1;
198 struct stat sb;
199 debug_decl(selinux_edit_create_tfiles, SUDO_DEBUG_EDIT);
200
201@@ -787,7 +792,7 @@
202 sesh_args = sesh_ap = reallocarray(NULL, sesh_nargs, sizeof(char *));
203 if (sesh_args == NULL) {
204 sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
205- debug_return_int(-1);
206+ goto done;
207 }
208 *sesh_ap++ = "sesh";
209 *sesh_ap++ = "-e";
210@@ -795,7 +800,6 @@
211 *sesh_ap++ = "-h";
212 *sesh_ap++ = "0";
213
214- /* XXX - temp files should be created with user's context */
215 for (i = 0; i < nfiles; i++) {
216 char *tfile, *ofile = files[i];
217 int tfd;
218@@ -813,8 +817,7 @@
219 if (tfd == -1) {
220 sudo_warn("mkstemps");
221 free(tfile);
222- free(sesh_args);
223- debug_return_int(-1);
224+ goto done;
225 }
226 /* Helper will re-create temp file with proper security context. */
227 close(tfd);
228@@ -825,8 +828,10 @@
229 *sesh_ap = NULL;
230
231 /* Run sesh -e [-h] 0 <o1> <t1> ... <on> <tn> */
232- rc = selinux_run_helper(sesh_args, command_details->envp);
233- switch (rc) {
234+ error = selinux_run_helper(command_details->uid, command_details->gid,
235+ command_details->ngroups, command_details->groups, sesh_args,
236+ command_details->envp);
237+ switch (error) {
238 case SESH_SUCCESS:
239 break;
240 case SESH_ERR_BAD_PATHS:
241@@ -836,21 +841,35 @@
242 case SESH_ERR_KILLED:
243 sudo_fatalx("%s", U_("sesh: killed by a signal"));
244 default:
245- sudo_fatalx(U_("sesh: unknown error %d"), rc);
246+ sudo_warnx(U_("sesh: unknown error %d"), error);
247+ goto done;
248 }
249
250- /* Chown to user's UID so they can edit the temporary files. */
251 for (i = 0; i < nfiles; i++) {
252- if (chown(tf[i].tfile, user_details.uid, user_details.gid) != 0) {
253+ int tfd = open(tf[i].tfile, O_RDONLY|O_NONBLOCK|O_NOFOLLOW);
254+ if (tfd == -1) {
255+ sudo_warn(U_("unable to open %s"), tf[i].tfile);
256+ goto done;
257+ }
258+ if (!sudo_check_temp_file(tfd, tf[i].tfile, command_details->uid, NULL)) {
259+ close(tfd);
260+ goto done;
261+ }
262+ if (fchown(tfd, user_details.uid, user_details.gid) != 0) {
263 sudo_warn("unable to chown(%s) to %d:%d for editing",
264 tf[i].tfile, user_details.uid, user_details.gid);
265+ close(tfd);
266+ goto done;
267 }
268+ close(tfd);
269 }
270+ ret = nfiles;
271
272+done:
273 /* Contents of tf will be freed by caller. */
274 free(sesh_args);
275
276- return (nfiles);
277+ debug_return_int(ret);
278 }
279
280 static int
281@@ -858,7 +877,8 @@
282 struct tempfile *tf, int nfiles, struct timespec *times)
283 {
284 char **sesh_args, **sesh_ap;
285- int i, rc, sesh_nargs, ret = 1;
286+ int i, error, sesh_nargs, ret = 1;
287+ int tfd = -1;
288 struct timespec ts;
289 struct stat sb;
290 debug_decl(selinux_edit_copy_tfiles, SUDO_DEBUG_EDIT);
291@@ -879,33 +899,43 @@
292
293 /* Construct args for sesh -e 1 */
294 for (i = 0; i < nfiles; i++) {
295- if (stat(tf[i].tfile, &sb) == 0) {
296- mtim_get(&sb, ts);
297- if (tf[i].osize == sb.st_size && sudo_timespeccmp(&tf[i].omtim, &ts, ==)) {
298- /*
299- * If mtime and size match but the user spent no measurable
300- * time in the editor we can't tell if the file was changed.
301- */
302- if (sudo_timespeccmp(&times[0], &times[1], !=)) {
303- sudo_warnx(U_("%s unchanged"), tf[i].ofile);
304- unlink(tf[i].tfile);
305- continue;
306- }
307+ if (tfd != -1)
308+ close(tfd);
309+ if ((tfd = open(tf[i].tfile, O_RDONLY|O_NONBLOCK|O_NOFOLLOW)) == -1) {
310+ sudo_warn(U_("unable to open %s"), tf[i].tfile);
311+ continue;
312+ }
313+ if (!sudo_check_temp_file(tfd, tf[i].tfile, user_details.uid, &sb))
314+ continue;
315+ mtim_get(&sb, ts);
316+ if (tf[i].osize == sb.st_size && sudo_timespeccmp(&tf[i].omtim, &ts, ==)) {
317+ /*
318+ * If mtime and size match but the user spent no measurable
319+ * time in the editor we can't tell if the file was changed.
320+ */
321+ if (sudo_timespeccmp(&times[0], &times[1], !=)) {
322+ sudo_warnx(U_("%s unchanged"), tf[i].ofile);
323+ unlink(tf[i].tfile);
324+ continue;
325 }
326 }
327 *sesh_ap++ = tf[i].tfile;
328 *sesh_ap++ = tf[i].ofile;
329- if (chown(tf[i].tfile, command_details->uid, command_details->gid) != 0) {
330+ if (fchown(tfd, command_details->uid, command_details->gid) != 0) {
331 sudo_warn("unable to chown(%s) back to %d:%d", tf[i].tfile,
332 command_details->uid, command_details->gid);
333 }
334 }
335 *sesh_ap = NULL;
336+ if (tfd != -1)
337+ close(tfd);
338
339 if (sesh_ap - sesh_args > 3) {
340 /* Run sesh -e 1 <t1> <o1> ... <tn> <on> */
341- rc = selinux_run_helper(sesh_args, command_details->envp);
342- switch (rc) {
343+ error = selinux_run_helper(command_details->uid, command_details->gid,
344+ command_details->ngroups, command_details->groups, sesh_args,
345+ command_details->envp);
346+ switch (error) {
347 case SESH_SUCCESS:
348 ret = 0;
349 break;
350@@ -921,7 +951,7 @@
351 sudo_warnx("%s", U_("sesh: killed by a signal"));
352 break;
353 default:
354- sudo_warnx(U_("sesh: unknown error %d"), rc);
355+ sudo_warnx(U_("sesh: unknown error %d"), error);
356 break;
357 }
358 if (ret != 0)
359@@ -943,7 +973,7 @@
360 {
361 struct command_details saved_command_details;
362 char **nargv = NULL, **ap, **files = NULL;
363- int errors, i, ac, nargc, rc;
364+ int errors, i, ac, nargc, ret;
365 int editor_argc = 0, nfiles = 0;
366 struct timespec times[2];
367 struct tempfile *tf = NULL;
368@@ -1038,7 +1068,7 @@
369 command_details->ngroups = user_details.ngroups;
370 command_details->groups = user_details.groups;
371 command_details->argv = nargv;
372- rc = run_command(command_details);
373+ ret = run_command(command_details);
374 if (sudo_gettime_real(&times[1]) == -1) {
375 sudo_warn("%s", U_("unable to read the clock"));
376 goto cleanup;
377@@ -1062,14 +1092,14 @@
378 errors = sudo_edit_copy_tfiles(command_details, tf, nfiles, times);
379 if (errors) {
380 /* Preserve the edited temporary files. */
381- rc = W_EXITCODE(1, 0);
382+ ret = W_EXITCODE(1, 0);
383 }
384
385 for (i = 0; i < nfiles; i++)
386 free(tf[i].tfile);
387 free(tf);
388 free(nargv);
389- debug_return_int(rc);
390+ debug_return_int(ret);
391
392 cleanup:
393 /* Clean up temp files and return. */
394diff -r ea19d0073c02 -r 8fcb36ef422a src/sudo_exec.h
395--- a/src/sudo_exec.h Wed Jan 06 10:16:00 2021 -0700
396+++ b/src/sudo_exec.h Wed Jan 06 10:16:00 2021 -0700
397@@ -1,7 +1,7 @@
398 /*
399 * SPDX-License-Identifier: ISC
400 *
401- * Copyright (c) 2010-2016 Todd C. Miller <Todd.Miller@sudo.ws>
402+ * Copyright (c) 2010-2017, 2020-2021 Todd C. Miller <Todd.Miller@sudo.ws>
403 *
404 * Permission to use, copy, modify, and distribute this software for any
405 * purpose with or without fee is hereby granted, provided that the above
406@@ -84,9 +84,11 @@
407 */
408 struct command_details;
409 struct command_status;
410+struct stat;
411
412 /* copy_file.c */
413 int sudo_copy_file(const char *src, int src_fd, off_t src_len, const char *dst, int dst_fd, off_t dst_len);
414+bool sudo_check_temp_file(int tfd, const char *tname, uid_t uid, struct stat *sb);
415
416 /* exec.c */
417 void exec_cmnd(struct command_details *details, int errfd);
418
419
diff --git a/meta/recipes-extended/sudo/files/CVE-2021-3156-1.patch b/meta/recipes-extended/sudo/files/CVE-2021-3156-1.patch
new file mode 100644
index 0000000000..83c277575e
--- /dev/null
+++ b/meta/recipes-extended/sudo/files/CVE-2021-3156-1.patch
@@ -0,0 +1,100 @@
1Upstream-Status: Backport[https://www.sudo.ws/repos/sudo/rev/9b97f1787804]
2Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
3CVE: CVE-2021-3156
4
5# HG changeset patch
6# User Todd C. Miller <Todd.Miller@sudo.ws>
7# Date 1611416639 25200
8# Node ID 9b97f1787804aedccaec63c379053b1a91a0e409
9# Parent 90aba6ba6e03f3bc33b4eabf16358396ed83642d
10Reset valid_flags to MODE_NONINTERACTIVE for sudoedit.
11This is consistent with how the -e option is handled.
12Also reject -H and -P flags for sudoedit as was done in sudo 1.7.
13Found by Qualys, this is part of the fix for CVE-2021-3156.
14
15diff -r 90aba6ba6e03 -r 9b97f1787804 src/parse_args.c
16--- a/src/parse_args.c Mon Jan 18 12:30:52 2021 +0100
17+++ b/src/parse_args.c Sat Jan 23 08:43:59 2021 -0700
18@@ -117,7 +117,10 @@
19 /*
20 * Default flags allowed when running a command.
21 */
22-#define DEFAULT_VALID_FLAGS (MODE_BACKGROUND|MODE_PRESERVE_ENV|MODE_RESET_HOME|MODE_LOGIN_SHELL|MODE_NONINTERACTIVE|MODE_SHELL)
23+#define DEFAULT_VALID_FLAGS (MODE_BACKGROUND|MODE_PRESERVE_ENV|MODE_RESET_HOME|MODE_LOGIN_SHELL|MODE_NONINTERACTIVE|MODE_PRESERVE_GROUPS|MODE_SHELL)
24+#define EDIT_VALID_FLAGS MODE_NONINTERACTIVE
25+#define LIST_VALID_FLAGS (MODE_NONINTERACTIVE|MODE_LONG_LIST)
26+#define VALIDATE_VALID_FLAGS MODE_NONINTERACTIVE
27
28 /* Option number for the --host long option due to ambiguity of the -h flag. */
29 #define OPT_HOSTNAME 256
30@@ -262,6 +265,7 @@
31 progname = "sudoedit";
32 mode = MODE_EDIT;
33 sudo_settings[ARG_SUDOEDIT].value = "true";
34+ valid_flags = EDIT_VALID_FLAGS;
35 }
36
37 /* Load local IP addresses and masks. */
38@@ -365,7 +369,7 @@
39 usage_excl();
40 mode = MODE_EDIT;
41 sudo_settings[ARG_SUDOEDIT].value = "true";
42- valid_flags = MODE_NONINTERACTIVE;
43+ valid_flags = EDIT_VALID_FLAGS;
44 break;
45 case 'g':
46 assert(optarg != NULL);
47@@ -377,6 +381,7 @@
48 break;
49 case 'H':
50 sudo_settings[ARG_SET_HOME].value = "true";
51+ SET(flags, MODE_RESET_HOME);
52 break;
53 case 'h':
54 if (optarg == NULL) {
55@@ -431,7 +436,7 @@
56 usage_excl();
57 }
58 mode = MODE_LIST;
59- valid_flags = MODE_NONINTERACTIVE|MODE_LONG_LIST;
60+ valid_flags = LIST_VALID_FLAGS;
61 break;
62 case 'n':
63 SET(flags, MODE_NONINTERACTIVE);
64@@ -439,6 +444,7 @@
65 break;
66 case 'P':
67 sudo_settings[ARG_PRESERVE_GROUPS].value = "true";
68+ SET(flags, MODE_PRESERVE_GROUPS);
69 break;
70 case 'p':
71 /* An empty prompt is allowed. */
72@@ -505,7 +511,7 @@
73 if (mode && mode != MODE_VALIDATE)
74 usage_excl();
75 mode = MODE_VALIDATE;
76- valid_flags = MODE_NONINTERACTIVE;
77+ valid_flags = VALIDATE_VALID_FLAGS;
78 break;
79 case 'V':
80 if (mode && mode != MODE_VERSION)
81@@ -533,7 +539,7 @@
82 if (!mode) {
83 /* Defer -k mode setting until we know whether it is a flag or not */
84 if (sudo_settings[ARG_IGNORE_TICKET].value != NULL) {
85- if (argc == 0 && !(flags & (MODE_SHELL|MODE_LOGIN_SHELL))) {
86+ if (argc == 0 && !ISSET(flags, MODE_SHELL|MODE_LOGIN_SHELL)) {
87 mode = MODE_INVALIDATE; /* -k by itself */
88 sudo_settings[ARG_IGNORE_TICKET].value = NULL;
89 valid_flags = 0;
90@@ -601,7 +607,7 @@
91 /*
92 * For shell mode we need to rewrite argv
93 */
94- if (ISSET(mode, MODE_RUN) && ISSET(flags, MODE_SHELL)) {
95+ if (ISSET(flags, MODE_SHELL|MODE_LOGIN_SHELL) && ISSET(mode, MODE_RUN)) {
96 char **av, *cmnd = NULL;
97 int ac = 1;
98
99
100
diff --git a/meta/recipes-extended/sudo/files/CVE-2021-3156-2.patch b/meta/recipes-extended/sudo/files/CVE-2021-3156-2.patch
new file mode 100644
index 0000000000..6d051252cb
--- /dev/null
+++ b/meta/recipes-extended/sudo/files/CVE-2021-3156-2.patch
@@ -0,0 +1,53 @@
1From 03d04069468d6633be0d6ef6c4adff07620488da Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com>
3Date: Sat, 6 Feb 2021 15:57:55 +0800
4Subject: [PATCH] sudo: fix CVE-2021-3156
5
6Upstream-Status: Backport [https://www.sudo.ws/repos/sudo/rev/a97dc92eae6b]
7Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
8CVE: CVE-2021-3156
9
10# HG changeset patch
11# User Todd C. Miller <Todd.Miller@sudo.ws>
12# Date 1611416639 25200
13# Node ID a97dc92eae6b60ae285055441341d493c17262ff
14# Parent 9b97f1787804aedccaec63c379053b1a91a0e409
15Add sudoedit flag checks in plugin that are consistent with front-end.
16Don't assume the sudo front-end is sending reasonable mode flags.
17These checks need to be kept consistent between the sudo front-end
18and the sudoers plugin.
19
20---
21 plugins/sudoers/policy.c | 9 ++++++++-
22 1 file changed, 8 insertions(+), 1 deletion(-)
23
24diff --git a/plugins/sudoers/policy.c b/plugins/sudoers/policy.c
25index c4749a6..2f18fe1 100644
26--- a/plugins/sudoers/policy.c
27+++ b/plugins/sudoers/policy.c
28@@ -88,10 +88,11 @@ parse_bool(const char *line, int varlen, int *flags, int fval)
29 int
30 sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group)
31 {
32+ const int edit_mask = MODE_EDIT|MODE_IGNORE_TICKET|MODE_NONINTERACTIVE;
33 struct sudoers_open_info *info = v;
34- char * const *cur;
35 const char *p, *errstr, *groups = NULL;
36 const char *remhost = NULL;
37+ char * const *cur;
38 int flags = 0;
39 debug_decl(sudoers_policy_deserialize_info, SUDOERS_DEBUG_PLUGIN);
40
41@@ -343,6 +344,12 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group)
42 #endif
43 }
44
45+ /* Sudo front-end should restrict mode flags for sudoedit. */
46+ if (ISSET(flags, MODE_EDIT) && (flags & edit_mask) != flags) {
47+ sudo_warnx(U_("invalid mode flags from sudo front end: 0x%x"), flags);
48+ goto bad;
49+ }
50+
51 user_gid = (gid_t)-1;
52 user_sid = (pid_t)-1;
53 user_uid = (gid_t)-1;
diff --git a/meta/recipes-extended/sudo/files/CVE-2021-3156-3.patch b/meta/recipes-extended/sudo/files/CVE-2021-3156-3.patch
new file mode 100644
index 0000000000..30a574d05c
--- /dev/null
+++ b/meta/recipes-extended/sudo/files/CVE-2021-3156-3.patch
@@ -0,0 +1,73 @@
1Upstream-Status: Backport[https://www.sudo.ws/repos/sudo/rev/049ad90590be]
2Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
3CVE: CVE-2021-3156
4
5# HG changeset patch
6# User Todd C. Miller <Todd.Miller@sudo.ws>
7# Date 1611416639 25200
8# Node ID 049ad90590be1e5dfb7df2675d2eb3e37c96ab86
9# Parent a97dc92eae6b60ae285055441341d493c17262ff
10Fix potential buffer overflow when unescaping backslashes in user_args.
11Also, do not try to unescaping backslashes unless in run mode *and*
12we are running the command via a shell.
13Found by Qualys, this fixes CVE-2021-3156.
14
15diff -r a97dc92eae6b -r 049ad90590be plugins/sudoers/sudoers.c
16--- a/plugins/sudoers/sudoers.c Sat Jan 23 08:43:59 2021 -0700
17+++ b/plugins/sudoers/sudoers.c Sat Jan 23 08:43:59 2021 -0700
18@@ -547,7 +547,7 @@
19
20 /* If run as root with SUDO_USER set, set sudo_user.pw to that user. */
21 /* XXX - causes confusion when root is not listed in sudoers */
22- if (sudo_mode & (MODE_RUN | MODE_EDIT) && prev_user != NULL) {
23+ if (ISSET(sudo_mode, MODE_RUN|MODE_EDIT) && prev_user != NULL) {
24 if (user_uid == 0 && strcmp(prev_user, "root") != 0) {
25 struct passwd *pw;
26
27@@ -932,8 +932,8 @@
28 if (user_cmnd == NULL)
29 user_cmnd = NewArgv[0];
30
31- if (sudo_mode & (MODE_RUN | MODE_EDIT | MODE_CHECK)) {
32- if (ISSET(sudo_mode, MODE_RUN | MODE_CHECK)) {
33+ if (ISSET(sudo_mode, MODE_RUN|MODE_EDIT|MODE_CHECK)) {
34+ if (!ISSET(sudo_mode, MODE_EDIT)) {
35 const char *runchroot = user_runchroot;
36 if (runchroot == NULL && def_runchroot != NULL &&
37 strcmp(def_runchroot, "*") != 0)
38@@ -961,7 +961,8 @@
39 sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
40 debug_return_int(NOT_FOUND_ERROR);
41 }
42- if (ISSET(sudo_mode, MODE_SHELL|MODE_LOGIN_SHELL)) {
43+ if (ISSET(sudo_mode, MODE_SHELL|MODE_LOGIN_SHELL) &&
44+ ISSET(sudo_mode, MODE_RUN)) {
45 /*
46 * When running a command via a shell, the sudo front-end
47 * escapes potential meta chars. We unescape non-spaces
48@@ -969,10 +970,22 @@
49 */
50 for (to = user_args, av = NewArgv + 1; (from = *av); av++) {
51 while (*from) {
52- if (from[0] == '\\' && !isspace((unsigned char)from[1]))
53+ if (from[0] == '\\' && from[1] != '\0' &&
54+ !isspace((unsigned char)from[1])) {
55 from++;
56+ }
57+ if (size - (to - user_args) < 1) {
58+ sudo_warnx(U_("internal error, %s overflow"),
59+ __func__);
60+ debug_return_int(NOT_FOUND_ERROR);
61+ }
62 *to++ = *from++;
63 }
64+ if (size - (to - user_args) < 1) {
65+ sudo_warnx(U_("internal error, %s overflow"),
66+ __func__);
67+ debug_return_int(NOT_FOUND_ERROR);
68+ }
69 *to++ = ' ';
70 }
71 *--to = '\0';
72
73
diff --git a/meta/recipes-extended/sudo/files/CVE-2021-3156-4.patch b/meta/recipes-extended/sudo/files/CVE-2021-3156-4.patch
new file mode 100644
index 0000000000..c1b00c740e
--- /dev/null
+++ b/meta/recipes-extended/sudo/files/CVE-2021-3156-4.patch
@@ -0,0 +1,29 @@
1Upstream-Status: Backport [https://www.sudo.ws/repos/sudo/rev/09f98816fc89]
2Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
3CVE: CVE-2021-3156
4
5# HG changeset patch
6# User Todd C. Miller <Todd.Miller@sudo.ws>
7# Date 1611416640 25200
8# Node ID 09f98816fc8978f1d8623a857073d2d5746f0379
9# Parent 049ad90590be1e5dfb7df2675d2eb3e37c96ab86
10Fix the memset offset when converting a v1 timestamp to TS_LOCKEXCL.
11We want to zero the struct starting at flags, not type (which was just set).
12Found by Qualys.
13
14diff -r 049ad90590be -r 09f98816fc89 plugins/sudoers/timestamp.c
15--- a/plugins/sudoers/timestamp.c Sat Jan 23 08:43:59 2021 -0700
16+++ b/plugins/sudoers/timestamp.c Sat Jan 23 08:44:00 2021 -0700
17@@ -643,8 +643,8 @@
18 if (entry.size == sizeof(struct timestamp_entry_v1)) {
19 /* Old sudo record, convert it to TS_LOCKEXCL. */
20 entry.type = TS_LOCKEXCL;
21- memset((char *)&entry + offsetof(struct timestamp_entry, type), 0,
22- nread - offsetof(struct timestamp_entry, type));
23+ memset((char *)&entry + offsetof(struct timestamp_entry, flags), 0,
24+ nread - offsetof(struct timestamp_entry, flags));
25 if (ts_write(cookie->fd, cookie->fname, &entry, 0) == -1)
26 debug_return_bool(false);
27 } else {
28
29
diff --git a/meta/recipes-extended/sudo/files/CVE-2021-3156-5.patch b/meta/recipes-extended/sudo/files/CVE-2021-3156-5.patch
new file mode 100644
index 0000000000..c04b8e72a6
--- /dev/null
+++ b/meta/recipes-extended/sudo/files/CVE-2021-3156-5.patch
@@ -0,0 +1,41 @@
1Upstream-Status: Backport [https://www.sudo.ws/repos/sudo/rev/c125fbe68783]
2Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
3CVE: CVE-2021-3156
4
5# HG changeset patch
6# User Todd C. Miller <Todd.Miller@sudo.ws>
7# Date 1611416640 25200
8# Node ID c125fbe6878395d10f01d891d3c09b1229ada404
9# Parent 09f98816fc8978f1d8623a857073d2d5746f0379
10Don't assume that argv is allocated as a single flat buffer.
11While this is how the kernel behaves it is not a portable assumption.
12The assumption may also be violated if getopt_long(3) permutes arguments.
13Found by Qualys.
14
15diff -r 09f98816fc89 -r c125fbe68783 src/parse_args.c
16--- a/src/parse_args.c Sat Jan 23 08:44:00 2021 -0700
17+++ b/src/parse_args.c Sat Jan 23 08:44:00 2021 -0700
18@@ -614,16 +614,16 @@
19 if (argc != 0) {
20 /* shell -c "command" */
21 char *src, *dst;
22- size_t cmnd_size = (size_t) (argv[argc - 1] - argv[0]) +
23- strlen(argv[argc - 1]) + 1;
24+ size_t size = 0;
25
26- cmnd = dst = reallocarray(NULL, cmnd_size, 2);
27- if (cmnd == NULL)
28+ for (av = argv; *av != NULL; av++)
29+ size += strlen(*av) + 1;
30+ if (size == 0 || (cmnd = reallocarray(NULL, size, 2)) == NULL)
31 sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
32 if (!gc_add(GC_PTR, cmnd))
33 exit(EXIT_FAILURE);
34
35- for (av = argv; *av != NULL; av++) {
36+ for (dst = cmnd, av = argv; *av != NULL; av++) {
37 for (src = *av; *src != '\0'; src++) {
38 /* quote potential meta characters */
39 if (!isalnum((unsigned char)*src) && *src != '_' && *src != '-' && *src != '$')
40
41
diff --git a/meta/recipes-extended/sudo/sudo.inc b/meta/recipes-extended/sudo/sudo.inc
index 86a18be7e2..8b50f5eee5 100644
--- a/meta/recipes-extended/sudo/sudo.inc
+++ b/meta/recipes-extended/sudo/sudo.inc
@@ -49,3 +49,5 @@ do_compile_prepend () {
49do_install_prepend (){ 49do_install_prepend (){
50 mkdir -p ${D}/${localstatedir}/lib 50 mkdir -p ${D}/${localstatedir}/lib
51} 51}
52
53CVE_VERSION_SUFFIX = "patch"
diff --git a/meta/recipes-extended/sudo/sudo_1.9.3.bb b/meta/recipes-extended/sudo/sudo_1.9.3.bb
index 270625ebe8..37fd6386dd 100644
--- a/meta/recipes-extended/sudo/sudo_1.9.3.bb
+++ b/meta/recipes-extended/sudo/sudo_1.9.3.bb
@@ -2,6 +2,14 @@ require sudo.inc
2 2
3SRC_URI = "https://www.sudo.ws/dist/sudo-${PV}.tar.gz \ 3SRC_URI = "https://www.sudo.ws/dist/sudo-${PV}.tar.gz \
4 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \ 4 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
5 file://0001-sudo.conf.in-fix-conflict-with-multilib.patch \
6 file://CVE-2021-23239.patch \
7 file://CVE-2021-23240.patch \
8 file://CVE-2021-3156-1.patch \
9 file://CVE-2021-3156-2.patch \
10 file://CVE-2021-3156-3.patch \
11 file://CVE-2021-3156-4.patch \
12 file://CVE-2021-3156-5.patch \
5 " 13 "
6 14
7PAM_SRC_URI = "file://sudo.pam" 15PAM_SRC_URI = "file://sudo.pam"
@@ -24,6 +32,7 @@ EXTRA_OECONF += " \
24 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '--enable-tmpfiles.d=${nonarch_libdir}/tmpfiles.d', '--disable-tmpfiles.d', d)} \ 32 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '--enable-tmpfiles.d=${nonarch_libdir}/tmpfiles.d', '--disable-tmpfiles.d', d)} \
25 --with-rundir=/run/sudo \ 33 --with-rundir=/run/sudo \
26 --with-vardir=/var/lib/sudo \ 34 --with-vardir=/var/lib/sudo \
35 --libexecdir=${libdir} \
27 " 36 "
28 37
29do_install_append () { 38do_install_append () {
@@ -43,5 +52,5 @@ do_install_append () {
43} 52}
44 53
45FILES_${PN} += "${nonarch_libdir}/tmpfiles.d" 54FILES_${PN} += "${nonarch_libdir}/tmpfiles.d"
46FILES_${PN}-dev += "${libexecdir}/${BPN}/lib*${SOLIBSDEV} ${libexecdir}/${BPN}/*.la \ 55FILES_${PN}-dev += "${libdir}/${BPN}/lib*${SOLIBSDEV} ${libdir}/${BPN}/*.la \
47 ${libexecdir}/lib*${SOLIBSDEV} ${libexecdir}/*.la" 56 ${libdir}/lib*${SOLIBSDEV} ${libdir}/*.la"
diff --git a/meta/recipes-extended/tar/tar/CVE-2021-20193.patch b/meta/recipes-extended/tar/tar/CVE-2021-20193.patch
new file mode 100644
index 0000000000..89e8e20844
--- /dev/null
+++ b/meta/recipes-extended/tar/tar/CVE-2021-20193.patch
@@ -0,0 +1,133 @@
1From d9d4435692150fa8ff68e1b1a473d187cc3fd777 Mon Sep 17 00:00:00 2001
2From: Sergey Poznyakoff <gray@gnu.org>
3Date: Sun, 17 Jan 2021 20:41:11 +0200
4Subject: Fix memory leak in read_header
5
6Bug reported in https://savannah.gnu.org/bugs/?59897
7
8* src/list.c (read_header): Don't return directly from the loop.
9Instead set the status and break. Return the status. Free
10next_long_name and next_long_link before returning.
11
12CVE: CVE-2021-20193
13Upstream-Status: Backport
14[https://git.savannah.gnu.org/cgit/tar.git/patch/?id=d9d4435692150fa8ff68e1b1a473d187cc3fd777]
15Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
16
17---
18 src/list.c | 40 ++++++++++++++++++++++++++++------------
19 1 file changed, 28 insertions(+), 12 deletions(-)
20
21diff --git a/src/list.c b/src/list.c
22index e40a5c8..d7ef441 100644
23--- a/src/list.c
24+++ b/src/list.c
25@@ -408,26 +408,27 @@ read_header (union block **return_block, struct tar_stat_info *info,
26 enum read_header_mode mode)
27 {
28 union block *header;
29- union block *header_copy;
30 char *bp;
31 union block *data_block;
32 size_t size, written;
33- union block *next_long_name = 0;
34- union block *next_long_link = 0;
35+ union block *next_long_name = NULL;
36+ union block *next_long_link = NULL;
37 size_t next_long_name_blocks = 0;
38 size_t next_long_link_blocks = 0;
39-
40+ enum read_header status = HEADER_SUCCESS;
41+
42 while (1)
43 {
44- enum read_header status;
45-
46 header = find_next_block ();
47 *return_block = header;
48 if (!header)
49- return HEADER_END_OF_FILE;
50+ {
51+ status = HEADER_END_OF_FILE;
52+ break;
53+ }
54
55 if ((status = tar_checksum (header, false)) != HEADER_SUCCESS)
56- return status;
57+ break;
58
59 /* Good block. Decode file size and return. */
60
61@@ -437,7 +438,10 @@ read_header (union block **return_block, struct tar_stat_info *info,
62 {
63 info->stat.st_size = OFF_FROM_HEADER (header->header.size);
64 if (info->stat.st_size < 0)
65- return HEADER_FAILURE;
66+ {
67+ status = HEADER_FAILURE;
68+ break;
69+ }
70 }
71
72 if (header->header.typeflag == GNUTYPE_LONGNAME
73@@ -447,10 +451,14 @@ read_header (union block **return_block, struct tar_stat_info *info,
74 || header->header.typeflag == SOLARIS_XHDTYPE)
75 {
76 if (mode == read_header_x_raw)
77- return HEADER_SUCCESS_EXTENDED;
78+ {
79+ status = HEADER_SUCCESS_EXTENDED;
80+ break;
81+ }
82 else if (header->header.typeflag == GNUTYPE_LONGNAME
83 || header->header.typeflag == GNUTYPE_LONGLINK)
84 {
85+ union block *header_copy;
86 size_t name_size = info->stat.st_size;
87 size_t n = name_size % BLOCKSIZE;
88 size = name_size + BLOCKSIZE;
89@@ -517,7 +525,10 @@ read_header (union block **return_block, struct tar_stat_info *info,
90 xheader_decode_global (&xhdr);
91 xheader_destroy (&xhdr);
92 if (mode == read_header_x_global)
93- return HEADER_SUCCESS_EXTENDED;
94+ {
95+ status = HEADER_SUCCESS_EXTENDED;
96+ break;
97+ }
98 }
99
100 /* Loop! */
101@@ -536,6 +547,7 @@ read_header (union block **return_block, struct tar_stat_info *info,
102 name = next_long_name->buffer + BLOCKSIZE;
103 recent_long_name = next_long_name;
104 recent_long_name_blocks = next_long_name_blocks;
105+ next_long_name = NULL;
106 }
107 else
108 {
109@@ -567,6 +579,7 @@ read_header (union block **return_block, struct tar_stat_info *info,
110 name = next_long_link->buffer + BLOCKSIZE;
111 recent_long_link = next_long_link;
112 recent_long_link_blocks = next_long_link_blocks;
113+ next_long_link = NULL;
114 }
115 else
116 {
117@@ -578,9 +591,12 @@ read_header (union block **return_block, struct tar_stat_info *info,
118 }
119 assign_string (&info->link_name, name);
120
121- return HEADER_SUCCESS;
122+ break;
123 }
124 }
125+ free (next_long_name);
126+ free (next_long_link);
127+ return status;
128 }
129
130 #define ISOCTAL(c) ((c)>='0'&&(c)<='7')
131--
132cgit v1.2.1
133
diff --git a/meta/recipes-extended/tar/tar_1.32.bb b/meta/recipes-extended/tar/tar_1.32.bb
index ebe6cb0dbd..3ae6d674a5 100644
--- a/meta/recipes-extended/tar/tar_1.32.bb
+++ b/meta/recipes-extended/tar/tar_1.32.bb
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
8 8
9SRC_URI = "${GNU_MIRROR}/tar/tar-${PV}.tar.bz2 \ 9SRC_URI = "${GNU_MIRROR}/tar/tar-${PV}.tar.bz2 \
10 file://musl_dirent.patch \ 10 file://musl_dirent.patch \
11 file://CVE-2021-20193.patch \
11" 12"
12 13
13SRC_URI[md5sum] = "17917356fff5cb4bd3cd5a6c3e727b05" 14SRC_URI[md5sum] = "17917356fff5cb4bd3cd5a6c3e727b05"
diff --git a/meta/recipes-extended/timezone/timezone.inc b/meta/recipes-extended/timezone/timezone.inc
index 8eb17c5eaf..a89560b424 100644
--- a/meta/recipes-extended/timezone/timezone.inc
+++ b/meta/recipes-extended/timezone/timezone.inc
@@ -6,7 +6,7 @@ SECTION = "base"
6LICENSE = "PD & BSD & BSD-3-Clause" 6LICENSE = "PD & BSD & BSD-3-Clause"
7LIC_FILES_CHKSUM = "file://LICENSE;md5=c679c9d6b02bc2757b3eaf8f53c43fba" 7LIC_FILES_CHKSUM = "file://LICENSE;md5=c679c9d6b02bc2757b3eaf8f53c43fba"
8 8
9PV = "2020b" 9PV = "2021a"
10 10
11SRC_URI =" http://www.iana.org/time-zones/repository/releases/tzcode${PV}.tar.gz;name=tzcode \ 11SRC_URI =" http://www.iana.org/time-zones/repository/releases/tzcode${PV}.tar.gz;name=tzcode \
12 http://www.iana.org/time-zones/repository/releases/tzdata${PV}.tar.gz;name=tzdata \ 12 http://www.iana.org/time-zones/repository/releases/tzdata${PV}.tar.gz;name=tzdata \
@@ -14,5 +14,5 @@ SRC_URI =" http://www.iana.org/time-zones/repository/releases/tzcode${PV}.tar.gz
14 14
15UPSTREAM_CHECK_URI = "http://www.iana.org/time-zones" 15UPSTREAM_CHECK_URI = "http://www.iana.org/time-zones"
16 16
17SRC_URI[tzcode.sha256sum] = "47eff8944de4a64f7629b851e4a32338ab12c9b73edd62063795167ff1fe43da" 17SRC_URI[tzcode.sha256sum] = "eb46bfa124b5b6bd13d61a609bfde8351bd192894708d33aa06e5c1e255802d0"
18SRC_URI[tzdata.sha256sum] = "9b053f951d245ce89d850b96ee4711d82d833559b1fc96ba19f90bc4d745e809" 18SRC_URI[tzdata.sha256sum] = "39e7d2ba08c68cbaefc8de3227aab0dec2521be8042cf56855f7dc3a9fb14e08"
diff --git a/meta/recipes-extended/watchdog/watchdog_5.16.bb b/meta/recipes-extended/watchdog/watchdog_5.16.bb
index 1988952603..a44a459c20 100644
--- a/meta/recipes-extended/watchdog/watchdog_5.16.bb
+++ b/meta/recipes-extended/watchdog/watchdog_5.16.bb
@@ -18,6 +18,11 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/watchdog/watchdog-${PV}.tar.gz \
18SRC_URI[md5sum] = "1b4f51cabc64d1bee2fce7cdd626831f" 18SRC_URI[md5sum] = "1b4f51cabc64d1bee2fce7cdd626831f"
19SRC_URI[sha256sum] = "b8e7c070e1b72aee2663bdc13b5cc39f76c9232669cfbb1ac0adc7275a3b019d" 19SRC_URI[sha256sum] = "b8e7c070e1b72aee2663bdc13b5cc39f76c9232669cfbb1ac0adc7275a3b019d"
20 20
21# Can be dropped when the output next changes, avoids failures after
22# reproducibility issues
23PR = "r1"
24HASHEQUIV_HASH_VERSION .= ".1"
25
21UPSTREAM_CHECK_URI = "http://sourceforge.net/projects/watchdog/files/watchdog/" 26UPSTREAM_CHECK_URI = "http://sourceforge.net/projects/watchdog/files/watchdog/"
22UPSTREAM_CHECK_REGEX = "/watchdog/(?P<pver>(\d+[\.\-_]*)+)/" 27UPSTREAM_CHECK_REGEX = "/watchdog/(?P<pver>(\d+[\.\-_]*)+)/"
23 28
@@ -28,6 +33,7 @@ CFLAGS += "-I${STAGING_INCDIR}/tirpc"
28LDFLAGS += "-ltirpc" 33LDFLAGS += "-ltirpc"
29 34
30EXTRA_OECONF += " --disable-nfs " 35EXTRA_OECONF += " --disable-nfs "
36CACHED_CONFIGUREVARS += "ac_cv_path_PATH_SENDMAIL=${sbindir}/sendmail"
31 37
32INITSCRIPT_PACKAGES = "${PN} ${PN}-keepalive" 38INITSCRIPT_PACKAGES = "${PN} ${PN}-keepalive"
33 39
diff --git a/meta/recipes-extended/zip/zip_3.0.bb b/meta/recipes-extended/zip/zip_3.0.bb
index c00a932763..97e5e57533 100644
--- a/meta/recipes-extended/zip/zip_3.0.bb
+++ b/meta/recipes-extended/zip/zip_3.0.bb
@@ -19,6 +19,12 @@ UPSTREAM_VERSION_UNKNOWN = "1"
19SRC_URI[md5sum] = "7b74551e63f8ee6aab6fbc86676c0d37" 19SRC_URI[md5sum] = "7b74551e63f8ee6aab6fbc86676c0d37"
20SRC_URI[sha256sum] = "f0e8bb1f9b7eb0b01285495a2699df3a4b766784c1765a8f1aeedf63c0806369" 20SRC_URI[sha256sum] = "f0e8bb1f9b7eb0b01285495a2699df3a4b766784c1765a8f1aeedf63c0806369"
21 21
22# Disputed and also Debian doesn't consider a vulnerability
23CVE_CHECK_WHITELIST += "CVE-2018-13410"
24
25# Not for zip but for smart contract implementation for it
26CVE_CHECK_WHITELIST += "CVE-2018-13684"
27
22# zip.inc sets CFLAGS, but what Makefile actually uses is 28# zip.inc sets CFLAGS, but what Makefile actually uses is
23# CFLAGS_NOOPT. It will also force -O3 optimization, overriding 29# CFLAGS_NOOPT. It will also force -O3 optimization, overriding
24# whatever we set. 30# whatever we set.
diff --git a/meta/recipes-gnome/epiphany/epiphany_3.36.4.bb b/meta/recipes-gnome/epiphany/epiphany_3.36.4.bb
index 4c3b18331a..0c22a67bde 100644
--- a/meta/recipes-gnome/epiphany/epiphany_3.36.4.bb
+++ b/meta/recipes-gnome/epiphany/epiphany_3.36.4.bb
@@ -13,6 +13,8 @@ REQUIRED_DISTRO_FEATURES = "x11 opengl"
13 13
14SRC_URI = "${GNOME_MIRROR}/${GNOMEBN}/${@gnome_verdir("${PV}")}/${GNOMEBN}-${PV}.tar.${GNOME_COMPRESS_TYPE};name=archive \ 14SRC_URI = "${GNOME_MIRROR}/${GNOMEBN}/${@gnome_verdir("${PV}")}/${GNOMEBN}-${PV}.tar.${GNOME_COMPRESS_TYPE};name=archive \
15 file://0002-help-meson.build-disable-the-use-of-yelp.patch \ 15 file://0002-help-meson.build-disable-the-use-of-yelp.patch \
16 file://migrator.patch \
17 file://distributor.patch \
16 " 18 "
17SRC_URI[archive.sha256sum] = "588a75b1588f5a509c33cf0be6a38a0f4fc1748eeb499a51d991ddef485242bf" 19SRC_URI[archive.sha256sum] = "588a75b1588f5a509c33cf0be6a38a0f4fc1748eeb499a51d991ddef485242bf"
18 20
diff --git a/meta/recipes-gnome/epiphany/files/distributor.patch b/meta/recipes-gnome/epiphany/files/distributor.patch
new file mode 100644
index 0000000000..b09c9b38d2
--- /dev/null
+++ b/meta/recipes-gnome/epiphany/files/distributor.patch
@@ -0,0 +1,17 @@
1Don't encode the distro from /etc/os-release into the binaries.
2
3Upstream-Status: Pending
4RP 2021/2/26
5
6Index: epiphany-3.38.2/meson.build
7===================================================================
8--- epiphany-3.38.2.orig/meson.build
9+++ epiphany-3.38.2/meson.build
10@@ -15,6 +15,7 @@ if r.returncode() == 0
11 else
12 distributor_name = 'GNOME Web'
13 endif
14+distributor_name = 'OpenEmbedded'
15
16 prefix = get_option('prefix')
17 datadir = join_paths(prefix, get_option('datadir'))
diff --git a/meta/recipes-gnome/epiphany/files/migrator.patch b/meta/recipes-gnome/epiphany/files/migrator.patch
new file mode 100644
index 0000000000..a9a650a64a
--- /dev/null
+++ b/meta/recipes-gnome/epiphany/files/migrator.patch
@@ -0,0 +1,24 @@
1We don't want to encide BUILD_ROOT into target packages. This is used
2for build time tests but in our case those would be on target anyway
3do use the target paths.
4
5Upstream-Status: Pending
6RP 2021/2/25
7
8Index: epiphany-3.38.2/lib/ephy-profile-utils.c
9===================================================================
10--- epiphany-3.38.2.orig/lib/ephy-profile-utils.c
11+++ epiphany-3.38.2/lib/ephy-profile-utils.c
12@@ -130,10 +130,10 @@ ephy_profile_utils_do_migration (const c
13 argv[i++] = NULL;
14
15 #if DEVELOPER_MODE
16- argv[0] = BUILD_ROOT "/src/" EPHY_PROFILE_MIGRATOR;
17+ argv[0] = PKGLIBEXECDIR "/" EPHY_PROFILE_MIGRATOR;
18 #else
19 if (debug)
20- argv[0] = BUILD_ROOT "/src/" EPHY_PROFILE_MIGRATOR;
21+ argv[0] = PKGLIBEXECDIR "/" EPHY_PROFILE_MIGRATOR;
22 #endif
23
24 g_spawn_sync (NULL, (char **)argv, envp, G_SPAWN_SEARCH_PATH,
diff --git a/meta/recipes-gnome/gcr/gcr_3.36.0.bb b/meta/recipes-gnome/gcr/gcr_3.36.0.bb
index ff455a68ec..567ca8b774 100644
--- a/meta/recipes-gnome/gcr/gcr_3.36.0.bb
+++ b/meta/recipes-gnome/gcr/gcr_3.36.0.bb
@@ -11,6 +11,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=55ca817ccb7d5b5b66355690e9abc605"
11DEPENDS = "gtk+3 p11-kit glib-2.0 libgcrypt gnupg-native \ 11DEPENDS = "gtk+3 p11-kit glib-2.0 libgcrypt gnupg-native \
12 ${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'libxslt-native', '', d)}" 12 ${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'libxslt-native', '', d)}"
13 13
14CACHED_CONFIGUREVARS += "ac_cv_path_GPG='gpg2'"
15
14GNOMEBASEBUILDCLASS = "meson" 16GNOMEBASEBUILDCLASS = "meson"
15GTKDOC_MESON_OPTION = "gtk_doc" 17GTKDOC_MESON_OPTION = "gtk_doc"
16inherit gnomebase gtk-icon-cache gtk-doc features_check upstream-version-is-even vala gobject-introspection gettext mime mime-xdg 18inherit gnomebase gtk-icon-cache gtk-doc features_check upstream-version-is-even vala gobject-introspection gettext mime mime-xdg
@@ -32,3 +34,11 @@ FILES_${PN} += " \
32ARM_INSTRUCTION_SET_armv4 = "arm" 34ARM_INSTRUCTION_SET_armv4 = "arm"
33ARM_INSTRUCTION_SET_armv5 = "arm" 35ARM_INSTRUCTION_SET_armv5 = "arm"
34ARM_INSTRUCTION_SET_armv6 = "arm" 36ARM_INSTRUCTION_SET_armv6 = "arm"
37
38EXTRA_OEMESON += "--cross-file ${WORKDIR}/meson-${PN}.cross"
39do_write_config_append() {
40 cat >${WORKDIR}/meson-${PN}.cross <<EOF
41[binaries]
42gpg2 = '${bindir}/gpg2'
43EOF
44}
diff --git a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/CVE-2020-29385.patch b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/CVE-2020-29385.patch
new file mode 100644
index 0000000000..3fef2bc1eb
--- /dev/null
+++ b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/CVE-2020-29385.patch
@@ -0,0 +1,55 @@
1From bdd3acbd48a575d418ba6bf1b32d7bda2fae1c81 Mon Sep 17 00:00:00 2001
2From: Robert Ancell <robert.ancell@canonical.com>
3Date: Mon, 30 Nov 2020 12:26:12 +1300
4Subject: [PATCH 02/13] gif: Fix LZW decoder accepting invalid LZW code.
5
6The code value after a reset wasn't being validated, which means we would
7accept invalid codes. This could cause an infinite loop in the decoder.
8
9Fixes CVE-2020-29385
10
11Fixes https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/issues/164
12
13Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/commit/bdd3acbd48a575d418ba6bf1b32d7bda2fae1c81]
14CVE: CVE-2020-29385
15Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
16
17---
18 gdk-pixbuf/lzw.c | 13 +++++++------
19 1 files changed, 7 insertions(+), 6 deletions(-)
20 create mode 100644 tests/test-images/fail/hang_114.gif
21
22diff --git a/gdk-pixbuf/lzw.c b/gdk-pixbuf/lzw.c
23index 9e052a6f7..105daf2b1 100644
24--- a/gdk-pixbuf/lzw.c
25+++ b/gdk-pixbuf/lzw.c
26@@ -195,19 +195,20 @@ lzw_decoder_feed (LZWDecoder *self,
27 if (self->last_code != self->clear_code && self->code_table_size < MAX_CODES) {
28 if (self->code < self->code_table_size)
29 add_code (self, self->code);
30- else if (self->code == self->code_table_size)
31+ else
32 add_code (self, self->last_code);
33- else {
34- /* Invalid code received - just stop here */
35- self->last_code = self->eoi_code;
36- return output_length;
37- }
38
39 /* When table is full increase code size */
40 if (self->code_table_size == (1 << self->code_size) && self->code_size < LZW_CODE_MAX)
41 self->code_size++;
42 }
43
44+ /* Invalid code received - just stop here */
45+ if (self->code >= self->code_table_size) {
46+ self->last_code = self->eoi_code;
47+ return output_length;
48+ }
49+
50 /* Convert codeword into indexes */
51 n_written += write_indexes (self, output + n_written, output_length - n_written);
52 }
53--
542.25.1
55
diff --git a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/CVE-2021-20240.patch b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/CVE-2021-20240.patch
new file mode 100644
index 0000000000..fe594b24bb
--- /dev/null
+++ b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/CVE-2021-20240.patch
@@ -0,0 +1,40 @@
1From 086e8adf4cc352cd11572f96066b001b545f354e Mon Sep 17 00:00:00 2001
2From: Emmanuele Bassi <ebassi@gnome.org>
3Date: Wed, 1 Apr 2020 18:11:55 +0100
4Subject: [PATCH] Check the memset length argument
5
6Avoid overflows by using the checked multiplication macro for gsize.
7
8Fixes: #132
9
10Upstream-Status: Backported [https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/commit/086e8adf4cc352cd11572f96066b001b545f354e]
11CVE: CVE-2021-20240
12
13Signed-off-by: Changqing Li <changqing.li@windriver.com>
14---
15 gdk-pixbuf/io-gif-animation.c | 6 +++++-
16 1 file changed, 5 insertions(+), 1 deletion(-)
17
18diff --git a/gdk-pixbuf/io-gif-animation.c b/gdk-pixbuf/io-gif-animation.c
19index c9db3c66e..49674fd2e 100644
20--- a/gdk-pixbuf/io-gif-animation.c
21+++ b/gdk-pixbuf/io-gif-animation.c
22@@ -412,11 +412,15 @@ gdk_pixbuf_gif_anim_iter_get_pixbuf (GdkPixbufAnimationIter *anim_iter)
23
24 /* If no rendered frame, render the first frame */
25 if (anim->last_frame == NULL) {
26+ gsize len = 0;
27 if (anim->last_frame_data == NULL)
28 anim->last_frame_data = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, anim->width, anim->height);
29 if (anim->last_frame_data == NULL)
30 return NULL;
31- memset (gdk_pixbuf_get_pixels (anim->last_frame_data), 0, gdk_pixbuf_get_rowstride (anim->last_frame_data) * anim->height);
32+ if (g_size_checked_mul (&len, gdk_pixbuf_get_rowstride (anim->last_frame_data), anim->height))
33+ memset (gdk_pixbuf_get_pixels (anim->last_frame_data), 0, len);
34+ else
35+ return NULL;
36 composite_frame (anim, g_list_nth_data (anim->frames, 0));
37 }
38
39--
40GitLab
diff --git a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.40.0.bb b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.40.0.bb
index 3dec5ed052..32af2de1e8 100644
--- a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.40.0.bb
+++ b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.40.0.bb
@@ -24,6 +24,8 @@ SRC_URI = "${GNOME_MIRROR}/${BPN}/${MAJ_VER}/${BPN}-${PV}.tar.xz \
24 file://0004-Do-not-run-tests-when-building.patch \ 24 file://0004-Do-not-run-tests-when-building.patch \
25 file://0006-Build-thumbnailer-and-tests-also-in-cross-builds.patch \ 25 file://0006-Build-thumbnailer-and-tests-also-in-cross-builds.patch \
26 file://missing-test-data.patch \ 26 file://missing-test-data.patch \
27 file://CVE-2020-29385.patch \
28 file://CVE-2021-20240.patch \
27 " 29 "
28 30
29SRC_URI_append_class-target = " \ 31SRC_URI_append_class-target = " \
diff --git a/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.64.1.bb b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.64.1.bb
index 4d80f00e10..0f0f7a82c4 100644
--- a/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.64.1.bb
+++ b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.64.1.bb
@@ -29,14 +29,14 @@ GTKDOC_MESON_OPTION = "gtk_doc"
29 29
30MULTILIB_SCRIPTS = "${PN}:${bindir}/g-ir-annotation-tool ${PN}:${bindir}/g-ir-scanner" 30MULTILIB_SCRIPTS = "${PN}:${bindir}/g-ir-annotation-tool ${PN}:${bindir}/g-ir-scanner"
31 31
32DEPENDS_append = " libffi zlib glib-2.0 python3 flex-native bison-native autoconf-archive" 32DEPENDS += " libffi zlib glib-2.0 python3 flex-native bison-native autoconf-archive"
33 33
34# target build needs qemu to run temporary introspection binaries created 34# target build needs qemu to run temporary introspection binaries created
35# on the fly by g-ir-scanner and a native version of itself to run 35# on the fly by g-ir-scanner and a native version of itself to run
36# native versions of its own tools during build. 36# native versions of its own tools during build.
37# Also prelink-rtld is used to find out library dependencies of introspection binaries 37# Also prelink-rtld is used to find out library dependencies of introspection binaries
38# (standard ldd doesn't work when cross-compiling). 38# (standard ldd doesn't work when cross-compiling).
39DEPENDS_class-target_append = " gobject-introspection-native qemu-native prelink-native" 39DEPENDS_append_class-target = " gobject-introspection-native qemu-native prelink-native"
40 40
41# needed for writing out the qemu wrapper script 41# needed for writing out the qemu wrapper script
42export STAGING_DIR_HOST 42export STAGING_DIR_HOST
diff --git a/meta/recipes-gnome/libsecret/libsecret/determinism.patch b/meta/recipes-gnome/libsecret/libsecret/determinism.patch
new file mode 100644
index 0000000000..ad96e8f59b
--- /dev/null
+++ b/meta/recipes-gnome/libsecret/libsecret/determinism.patch
@@ -0,0 +1,37 @@
1secret-enum-types.c/h.template: Fix reproducibility issue
2
3When full filenames are used in generated sources it makes the resulting
4debug packages non-reproducible. Best practise is to use basename in
5comments instead.
6
7Signed-off-by: Richard Purdie richard.purdie@linuxfoundation.org
8Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/libsecret/-/merge_requests/68]
9
10Index: libsecret-0.20.4/libsecret/secret-enum-types.c.template
11===================================================================
12--- libsecret-0.20.4.orig/libsecret/secret-enum-types.c.template
13+++ libsecret-0.20.4/libsecret/secret-enum-types.c.template
14@@ -23,8 +23,8 @@
15 /*** END file-header ***/
16
17 /*** BEGIN file-production ***/
18-#include "@filename@"
19-/* enumerations from "@filename@" */
20+#include "@basename@"
21+/* enumerations from "@basename@" */
22 /*** END file-production ***/
23
24 /*** BEGIN value-header ***/
25Index: libsecret-0.20.4/libsecret/secret-enum-types.h.template
26===================================================================
27--- libsecret-0.20.4.orig/libsecret/secret-enum-types.h.template
28+++ libsecret-0.20.4/libsecret/secret-enum-types.h.template
29@@ -27,7 +27,7 @@ G_BEGIN_DECLS
30
31 /*** BEGIN file-production ***/
32
33-/* enumerations from "@filename@" */
34+/* enumerations from "@basename@" */
35 /*** END file-production ***/
36
37 /*** BEGIN value-header ***/
diff --git a/meta/recipes-gnome/libsecret/libsecret_0.20.3.bb b/meta/recipes-gnome/libsecret/libsecret_0.20.3.bb
index 533015a1e4..b72206535f 100644
--- a/meta/recipes-gnome/libsecret/libsecret_0.20.3.bb
+++ b/meta/recipes-gnome/libsecret/libsecret_0.20.3.bb
@@ -13,7 +13,8 @@ inherit gnomebase gtk-doc vala gobject-introspection manpages
13 13
14DEPENDS += "glib-2.0 libgcrypt gettext-native" 14DEPENDS += "glib-2.0 libgcrypt gettext-native"
15 15
16SRC_URI += "file://0001-meson-add-option-introspection.patch" 16SRC_URI += "file://0001-meson-add-option-introspection.patch \
17 file://determinism.patch"
17 18
18SRC_URI[archive.md5sum] = "47c3fdfeb111a87b509ad271e4a6f496" 19SRC_URI[archive.md5sum] = "47c3fdfeb111a87b509ad271e4a6f496"
19SRC_URI[archive.sha256sum] = "4fcb3c56f8ac4ab9c75b66901fb0104ec7f22aa9a012315a14c0d6dffa5290e4" 20SRC_URI[archive.sha256sum] = "4fcb3c56f8ac4ab9c75b66901fb0104ec7f22aa9a012315a14c0d6dffa5290e4"
diff --git a/meta/recipes-graphics/cairo/cairo/CVE-2020-35492.patch b/meta/recipes-graphics/cairo/cairo/CVE-2020-35492.patch
new file mode 100644
index 0000000000..f8e69beb0b
--- /dev/null
+++ b/meta/recipes-graphics/cairo/cairo/CVE-2020-35492.patch
@@ -0,0 +1,121 @@
1From 03a820b173ed1fdef6ff14b4468f5dbc02ff59be Mon Sep 17 00:00:00 2001
2From: Heiko Lewin <heiko.lewin@worldiety.de>
3Date: Tue, 15 Dec 2020 16:48:19 +0100
4Subject: [PATCH] Fix mask usage in image-compositor
5
6CVE: CVE-2020-35492
7
8Upstream-Status: Backport [https://gitlab.freedesktop.org/cairo/cairo/-/commit/03a820b173ed1fdef6ff14b4468f5dbc02ff59be?merge_request_iid=85]
9
10original patch from upstream has a binary file, it will cause
11do_patch failed with "git binary diffs are not supported".
12
13so add do_patch_append in recipe to add this binary source. when removing
14this patch, please also remove do_patch_append for this patch
15
16Signed-off-by: Changqing Li <changqing.li@windriver.com>
17---
18 src/cairo-image-compositor.c | 8 ++--
19 test/Makefile.sources | 1 +
20 test/bug-image-compositor.c | 39 ++++++++++++++++++++
21 3 files changed, 44 insertions(+), 4 deletions(-)
22 create mode 100644 test/bug-image-compositor.c
23
24diff --git a/src/cairo-image-compositor.c b/src/cairo-image-compositor.c
25index 79ad69f68..4f8aaed99 100644
26--- a/src/cairo-image-compositor.c
27+++ b/src/cairo-image-compositor.c
28@@ -2610,14 +2610,14 @@ _inplace_src_spans (void *abstract_renderer, int y, int h,
29 unsigned num_spans)
30 {
31 cairo_image_span_renderer_t *r = abstract_renderer;
32- uint8_t *m;
33+ uint8_t *m, *base = (uint8_t*)pixman_image_get_data(r->mask);
34 int x0;
35
36 if (num_spans == 0)
37 return CAIRO_STATUS_SUCCESS;
38
39 x0 = spans[0].x;
40- m = r->_buf;
41+ m = base;
42 do {
43 int len = spans[1].x - spans[0].x;
44 if (len >= r->u.composite.run_length && spans[0].coverage == 0xff) {
45@@ -2655,7 +2655,7 @@ _inplace_src_spans (void *abstract_renderer, int y, int h,
46 spans[0].x, y,
47 spans[1].x - spans[0].x, h);
48
49- m = r->_buf;
50+ m = base;
51 x0 = spans[1].x;
52 } else if (spans[0].coverage == 0x0) {
53 if (spans[0].x != x0) {
54@@ -2684,7 +2684,7 @@ _inplace_src_spans (void *abstract_renderer, int y, int h,
55 #endif
56 }
57
58- m = r->_buf;
59+ m = base;
60 x0 = spans[1].x;
61 } else {
62 *m++ = spans[0].coverage;
63diff --git a/test/Makefile.sources b/test/Makefile.sources
64index 7eb73647f..86494348d 100644
65--- a/test/Makefile.sources
66+++ b/test/Makefile.sources
67@@ -34,6 +34,7 @@ test_sources = \
68 bug-source-cu.c \
69 bug-extents.c \
70 bug-seams.c \
71+ bug-image-compositor.c \
72 caps.c \
73 checkerboard.c \
74 caps-joins.c \
75diff --git a/test/bug-image-compositor.c b/test/bug-image-compositor.c
76new file mode 100644
77index 000000000..fc4fd370b
78--- /dev/null
79+++ b/test/bug-image-compositor.c
80@@ -0,0 +1,39 @@
81+#include "cairo-test.h"
82+
83+static cairo_test_status_t
84+draw (cairo_t *cr, int width, int height)
85+{
86+ cairo_set_source_rgb (cr, 0., 0., 0.);
87+ cairo_paint (cr);
88+
89+ cairo_set_source_rgb (cr, 1., 1., 1.);
90+ cairo_set_line_width (cr, 1.);
91+
92+ cairo_pattern_t *p = cairo_pattern_create_linear (0, 0, width, height);
93+ cairo_pattern_add_color_stop_rgb (p, 0, 0.99, 1, 1);
94+ cairo_pattern_add_color_stop_rgb (p, 1, 1, 1, 1);
95+ cairo_set_source (cr, p);
96+
97+ cairo_move_to (cr, 0.5, -1);
98+ for (int i = 0; i < width; i+=3) {
99+ cairo_rel_line_to (cr, 2, 2);
100+ cairo_rel_line_to (cr, 1, -2);
101+ }
102+
103+ cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
104+ cairo_stroke (cr);
105+
106+ cairo_pattern_destroy(p);
107+
108+ return CAIRO_TEST_SUCCESS;
109+}
110+
111+
112+CAIRO_TEST (bug_image_compositor,
113+ "Crash in image-compositor",
114+ "stroke, stress", /* keywords */
115+ NULL, /* requirements */
116+ 10000, 1,
117+ NULL, draw)
118+
119+
120--
121GitLab
diff --git a/meta/recipes-graphics/cairo/cairo/bug-image-compositor.ref.png b/meta/recipes-graphics/cairo/cairo/bug-image-compositor.ref.png
new file mode 100644
index 0000000000..939f659d2c
--- /dev/null
+++ b/meta/recipes-graphics/cairo/cairo/bug-image-compositor.ref.png
Binary files differ
diff --git a/meta/recipes-graphics/cairo/cairo_1.16.0.bb b/meta/recipes-graphics/cairo/cairo_1.16.0.bb
index 68f993d7ca..d48da1a4c7 100644
--- a/meta/recipes-graphics/cairo/cairo_1.16.0.bb
+++ b/meta/recipes-graphics/cairo/cairo_1.16.0.bb
@@ -27,6 +27,8 @@ SRC_URI = "http://cairographics.org/releases/cairo-${PV}.tar.xz \
27 file://CVE-2018-19876.patch \ 27 file://CVE-2018-19876.patch \
28 file://CVE-2019-6461.patch \ 28 file://CVE-2019-6461.patch \
29 file://CVE-2019-6462.patch \ 29 file://CVE-2019-6462.patch \
30 file://CVE-2020-35492.patch \
31 file://bug-image-compositor.ref.png \
30 " 32 "
31 33
32SRC_URI[md5sum] = "f19e0353828269c22bd72e271243a552" 34SRC_URI[md5sum] = "f19e0353828269c22bd72e271243a552"
@@ -64,6 +66,15 @@ export ac_cv_lib_bfd_bfd_openr="no"
64# Ensure we don't depend on LZO 66# Ensure we don't depend on LZO
65export ac_cv_lib_lzo2_lzo2a_decompress="no" 67export ac_cv_lib_lzo2_lzo2a_decompress="no"
66 68
69#for CVE-2020-35492.patch
70do_patch_append() {
71 bb.build.exec_func('do_cp_binary_source', d)
72}
73
74do_cp_binary_source () {
75 cp ${WORKDIR}/bug-image-compositor.ref.png ${S}/test/reference/
76}
77
67do_install_append () { 78do_install_append () {
68 rm -rf ${D}${bindir}/cairo-sphinx 79 rm -rf ${D}${bindir}/cairo-sphinx
69 rm -rf ${D}${libdir}/cairo/cairo-fdr* 80 rm -rf ${D}${libdir}/cairo/cairo-fdr*
diff --git a/meta/recipes-graphics/igt-gpu-tools/igt-gpu-tools/reproducibility.patch b/meta/recipes-graphics/igt-gpu-tools/igt-gpu-tools/reproducibility.patch
new file mode 100644
index 0000000000..39e36d8737
--- /dev/null
+++ b/meta/recipes-graphics/igt-gpu-tools/igt-gpu-tools/reproducibility.patch
@@ -0,0 +1,38 @@
1meson: Allow source location to be configurable
2
3Hardcoding a build source path into a binary when cross compiling isn't
4appropriate and breaks build reproducibility. Allow the srcdir to be
5specified by an optional configuration option to meson.
6
7Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
8Upstream-Status: Submitted [https://lists.freedesktop.org/archives/igt-dev/2021-February/029443.html]
9
10Index: git/lib/meson.build
11===================================================================
12--- git.orig/lib/meson.build
13+++ git/lib/meson.build
14@@ -122,7 +122,11 @@ if chamelium.found()
15 lib_sources += 'igt_chamelium_stream.c'
16 endif
17
18-srcdir = join_paths(meson.source_root(), 'tests')
19+if get_option('srcdir') != ''
20+ srcdir = join_paths(get_option('srcdir'), 'tests')
21+else
22+ srcdir = join_paths(meson.source_root(), 'tests')
23+endif
24
25 lib_version = vcs_tag(input : 'version.h.in', output : 'version.h',
26 fallback : 'NO-GIT',
27Index: git/meson_options.txt
28===================================================================
29--- git.orig/meson_options.txt
30+++ git/meson_options.txt
31@@ -50,3 +50,7 @@ option('use_rpath',
32 type : 'boolean',
33 value : false,
34 description : 'Set runpath on installed executables for libigt.so')
35+
36+option('srcdir',
37+ type : 'string',
38+ description : 'Path to source code to be compiled into binaries (optional)')
diff --git a/meta/recipes-graphics/igt-gpu-tools/igt-gpu-tools_git.bb b/meta/recipes-graphics/igt-gpu-tools/igt-gpu-tools_git.bb
index 89480d79d2..f25cbc0603 100644
--- a/meta/recipes-graphics/igt-gpu-tools/igt-gpu-tools_git.bb
+++ b/meta/recipes-graphics/igt-gpu-tools/igt-gpu-tools_git.bb
@@ -10,7 +10,8 @@ inherit meson
10SRCREV = "d16ad07e7f2a028e14d61f570931c87fa5ce404c" 10SRCREV = "d16ad07e7f2a028e14d61f570931c87fa5ce404c"
11PV = "1.25+git${SRCPV}" 11PV = "1.25+git${SRCPV}"
12 12
13SRC_URI = "git://gitlab.freedesktop.org/drm/igt-gpu-tools.git;protocol=https" 13SRC_URI = "git://gitlab.freedesktop.org/drm/igt-gpu-tools.git;protocol=https \
14 file://reproducibility.patch"
14 15
15S = "${WORKDIR}/git" 16S = "${WORKDIR}/git"
16 17
@@ -22,7 +23,7 @@ PACKAGE_BEFORE_PN = "${PN}-benchmarks ${PN}-tests"
22 23
23PACKAGECONFIG[chamelium] = "-Dchamelium=enabled,-Dchamelium=disabled,gsl xmlrpc-c" 24PACKAGECONFIG[chamelium] = "-Dchamelium=enabled,-Dchamelium=disabled,gsl xmlrpc-c"
24 25
25EXTRA_OEMESON = "-Ddocs=disabled -Drunner=enabled" 26EXTRA_OEMESON = "-Ddocs=disabled -Drunner=enabled -Dsrcdir=/usr/src/debug/${PN}/${PV}-${PR}/git/"
26COMPATIBLE_HOST = "(x86_64.*|i.86.*|arm.*|aarch64).*-linux" 27COMPATIBLE_HOST = "(x86_64.*|i.86.*|arm.*|aarch64).*-linux"
27COMPATIBLE_HOST_libc-musl_class-target = "null" 28COMPATIBLE_HOST_libc-musl_class-target = "null"
28SECURITY_LDFLAGS = "${SECURITY_X_LDFLAGS}" 29SECURITY_LDFLAGS = "${SECURITY_X_LDFLAGS}"
diff --git a/meta/recipes-graphics/libsdl2/libsdl2/CVE-2020-14409-14410.patch b/meta/recipes-graphics/libsdl2/libsdl2/CVE-2020-14409-14410.patch
new file mode 100644
index 0000000000..d8fa24bc65
--- /dev/null
+++ b/meta/recipes-graphics/libsdl2/libsdl2/CVE-2020-14409-14410.patch
@@ -0,0 +1,79 @@
1From a7ff6e96155f550a5597621ebeddd03c98aa9294 Mon Sep 17 00:00:00 2001
2From: Sam Lantinga <slouken@libsdl.org>
3Date: Wed, 17 Jun 2020 08:44:45 -0700
4Subject: [PATCH] Fixed overflow in surface pitch calculation
5
6
7Upstream-Status: Backport
8[https://github.com/libsdl-org/SDL/commit/a7ff6e96155f550a5597621ebeddd03c98aa9294]
9CVE: CVE-2020-14409 CVE-2020-14410
10Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
11
12---
13 src/video/SDL_surface.c | 23 +++++++++++++++--------
14 1 file changed, 15 insertions(+), 8 deletions(-)
15
16diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c
17index 085d9ff1e..bff826f7c 100644
18--- a/src/video/SDL_surface.c
19+++ b/src/video/SDL_surface.c
20@@ -28,24 +28,23 @@
21 #include "SDL_yuv_c.h"
22
23
24-/* Check to make sure we can safely check multiplication of surface w and pitch and it won't overflow size_t */
25-SDL_COMPILE_TIME_ASSERT(surface_size_assumptions,
26- sizeof(int) == sizeof(Sint32) && sizeof(size_t) >= sizeof(Sint32));
27+/* Check to make sure we can safely check multiplication of surface w and pitch and it won't overflow Sint64 */
28+SDL_COMPILE_TIME_ASSERT(surface_size_assumptions, sizeof(int) == sizeof(Sint32));
29
30 /* Public routines */
31
32 /*
33 * Calculate the pad-aligned scanline width of a surface
34 */
35-static int
36+static Sint64
37 SDL_CalculatePitch(Uint32 format, int width)
38 {
39- int pitch;
40+ Sint64 pitch;
41
42 if (SDL_ISPIXELFORMAT_FOURCC(format) || SDL_BITSPERPIXEL(format) >= 8) {
43- pitch = (width * SDL_BYTESPERPIXEL(format));
44+ pitch = ((Sint64)width * SDL_BYTESPERPIXEL(format));
45 } else {
46- pitch = ((width * SDL_BITSPERPIXEL(format)) + 7) / 8;
47+ pitch = (((Sint64)width * SDL_BITSPERPIXEL(format)) + 7) / 8;
48 }
49 pitch = (pitch + 3) & ~3; /* 4-byte aligning for speed */
50 return pitch;
51@@ -59,11 +58,19 @@ SDL_Surface *
52 SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth,
53 Uint32 format)
54 {
55+ Sint64 pitch;
56 SDL_Surface *surface;
57
58 /* The flags are no longer used, make the compiler happy */
59 (void)flags;
60
61+ pitch = SDL_CalculatePitch(format, width);
62+ if (pitch < 0 || pitch > SDL_MAX_SINT32) {
63+ /* Overflow... */
64+ SDL_OutOfMemory();
65+ return NULL;
66+ }
67+
68 /* Allocate the surface */
69 surface = (SDL_Surface *) SDL_calloc(1, sizeof(*surface));
70 if (surface == NULL) {
71@@ -78,7 +85,7 @@ SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth,
72 }
73 surface->w = width;
74 surface->h = height;
75- surface->pitch = SDL_CalculatePitch(format, width);
76+ surface->pitch = (int)pitch;
77 SDL_SetClipRect(surface, NULL);
78
79 if (SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) {
diff --git a/meta/recipes-graphics/libsdl2/libsdl2_2.0.12.bb b/meta/recipes-graphics/libsdl2/libsdl2_2.0.12.bb
index 0b75eb0c1d..639a465567 100644
--- a/meta/recipes-graphics/libsdl2/libsdl2_2.0.12.bb
+++ b/meta/recipes-graphics/libsdl2/libsdl2_2.0.12.bb
@@ -20,6 +20,7 @@ SRC_URI = "http://www.libsdl.org/release/SDL2-${PV}.tar.gz \
20 file://more-gen-depends.patch \ 20 file://more-gen-depends.patch \
21 file://directfb-spurious-curly-brace-missing-e.patch \ 21 file://directfb-spurious-curly-brace-missing-e.patch \
22 file://directfb-renderfillrect-fix.patch \ 22 file://directfb-renderfillrect-fix.patch \
23 file://CVE-2020-14409-14410.patch \
23" 24"
24 25
25S = "${WORKDIR}/SDL2-${PV}" 26S = "${WORKDIR}/SDL2-${PV}"
@@ -57,7 +58,7 @@ PACKAGECONFIG ??= " \
57" 58"
58PACKAGECONFIG[alsa] = "--enable-alsa --disable-alsatest,--disable-alsa,alsa-lib," 59PACKAGECONFIG[alsa] = "--enable-alsa --disable-alsatest,--disable-alsa,alsa-lib,"
59PACKAGECONFIG[arm-neon] = "--enable-arm-neon,--disable-arm-neon" 60PACKAGECONFIG[arm-neon] = "--enable-arm-neon,--disable-arm-neon"
60PACKAGECONFIG[directfb] = "--enable-video-directfb,--disable-video-directfb,directfb" 61PACKAGECONFIG[directfb] = "--enable-video-directfb,--disable-video-directfb,directfb,directfb"
61PACKAGECONFIG[gles2] = "--enable-video-opengles,--disable-video-opengles,virtual/libgles2" 62PACKAGECONFIG[gles2] = "--enable-video-opengles,--disable-video-opengles,virtual/libgles2"
62PACKAGECONFIG[jack] = "--enable-jack,--disable-jack,jack" 63PACKAGECONFIG[jack] = "--enable-jack,--disable-jack,jack"
63PACKAGECONFIG[kmsdrm] = "--enable-video-kmsdrm,--disable-video-kmsdrm,libdrm virtual/libgbm" 64PACKAGECONFIG[kmsdrm] = "--enable-video-kmsdrm,--disable-video-kmsdrm,libdrm virtual/libgbm"
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 9fc62e95e1..a4c7007157 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -48,11 +48,6 @@ PROVIDES = " \
48 48
49inherit meson pkgconfig python3native gettext features_check 49inherit meson pkgconfig python3native gettext features_check
50 50
51# Unset these to stop python trying to report the target Python setup
52_PYTHON_SYSCONFIGDATA_NAME[unexport] = "1"
53STAGING_INCDIR[unexport] = "1"
54STAGING_LIBDIR[unexport] = "1"
55
56BBCLASSEXTEND = "native nativesdk" 51BBCLASSEXTEND = "native nativesdk"
57 52
58ANY_OF_DISTRO_FEATURES_class-target = "opengl vulkan" 53ANY_OF_DISTRO_FEATURES_class-target = "opengl vulkan"
diff --git a/meta/recipes-graphics/wayland/libinput/run-ptest b/meta/recipes-graphics/wayland/libinput/run-ptest
index 5a84c568b9..d11e6eb25b 100644
--- a/meta/recipes-graphics/wayland/libinput/run-ptest
+++ b/meta/recipes-graphics/wayland/libinput/run-ptest
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2 2
3/usr/libexec/libinput/libinput-test-suite 3/usr/libexec/libinput/libinput-test-suite -j1
4if [ $? -eq 0 ]; then 4if [ $? -eq 0 ]; then
5 echo 'PASS: libinput-test-suite' 5 echo 'PASS: libinput-test-suite'
6else 6else
diff --git a/meta/recipes-graphics/wayland/weston-init/weston.ini b/meta/recipes-graphics/wayland/weston-init/weston.ini
index b48726d59c..6bd5aef55a 100644
--- a/meta/recipes-graphics/wayland/weston-init/weston.ini
+++ b/meta/recipes-graphics/wayland/weston-init/weston.ini
@@ -42,7 +42,7 @@ require-input=false
42#path=/build/weston-0lEgCh/weston-1.11.0/weston-flower 42#path=/build/weston-0lEgCh/weston-1.11.0/weston-flower
43 43
44#[input-method] 44#[input-method]
45#path=/usr/lib/weston/weston-keyboard 45#path=/usr/libexec/weston-keyboard
46 46
47#[output] 47#[output]
48#name=LVDS1 48#name=LVDS1
diff --git a/meta/recipes-graphics/wayland/weston_9.0.0.bb b/meta/recipes-graphics/wayland/weston_9.0.0.bb
index 75f9fb05fd..d60b5e1a35 100644
--- a/meta/recipes-graphics/wayland/weston_9.0.0.bb
+++ b/meta/recipes-graphics/wayland/weston_9.0.0.bb
@@ -73,7 +73,7 @@ PACKAGECONFIG[colord] = "-Dcolor-management-colord=true,-Dcolor-management-color
73# Clients support 73# Clients support
74PACKAGECONFIG[clients] = "-Dsimple-clients=all -Ddemo-clients=true,-Dsimple-clients= -Ddemo-clients=false" 74PACKAGECONFIG[clients] = "-Dsimple-clients=all -Ddemo-clients=true,-Dsimple-clients= -Ddemo-clients=false"
75# Virtual remote output with GStreamer on DRM backend 75# Virtual remote output with GStreamer on DRM backend
76PACKAGECONFIG[remoting] = "-Dremoting=true,-Dremoting=false,gstreamer1.0" 76PACKAGECONFIG[remoting] = "-Dremoting=true,-Dremoting=false,gstreamer1.0 gstreamer1.0-plugins-base"
77# Weston with PAM support 77# Weston with PAM support
78PACKAGECONFIG[pam] = "-Dpam=true,-Dpam=false,libpam" 78PACKAGECONFIG[pam] = "-Dpam=true,-Dpam=false,libpam"
79# Weston with screen-share support 79# Weston with screen-share support
diff --git a/meta/recipes-graphics/xorg-font/xorg-minimal-fonts.bb b/meta/recipes-graphics/xorg-font/xorg-minimal-fonts.bb
index 1ea08a6c99..bf8385fe6d 100644
--- a/meta/recipes-graphics/xorg-font/xorg-minimal-fonts.bb
+++ b/meta/recipes-graphics/xorg-font/xorg-minimal-fonts.bb
@@ -10,8 +10,12 @@ LIC_FILES_CHKSUM = "file://../misc/fonts.dir;md5=82a143d94d6a974aafe97132d2d519a
10 10
11SRC_URI = "file://misc" 11SRC_URI = "file://misc"
12 12
13SOURCE_DATE_EPOCH = "1613559011"
14
13PE = "1" 15PE = "1"
14PR = "r2" 16PR = "r3"
17HASHEQUIV_HASH_VERSION .= ".1"
18
15 19
16inherit allarch features_check 20inherit allarch features_check
17 21
@@ -27,6 +31,8 @@ RDEPENDS_${PN} += "font-alias"
27do_install() { 31do_install() {
28 install -d ${D}/${datadir}/fonts/X11/misc 32 install -d ${D}/${datadir}/fonts/X11/misc
29 install -m 0644 ${S}/* ${D}/${datadir}/fonts/X11/misc/ 33 install -m 0644 ${S}/* ${D}/${datadir}/fonts/X11/misc/
34 # Pick a date/time as otherwise it would be the git checkout/modify time
35 touch -d @1613559011 ${D}/${datadir}/fonts/X11/misc/*
30 install -d ${D}/${libdir}/X11 36 install -d ${D}/${libdir}/X11
31 ln -sf ${datadir}/fonts/X11/ ${D}/${libdir}/X11/fonts -s 37 ln -sf ${datadir}/fonts/X11/ ${D}/${libdir}/X11/fonts -s
32} 38}
diff --git a/meta/recipes-graphics/xorg-proto/xcb-proto_1.14.bb b/meta/recipes-graphics/xorg-proto/xcb-proto_1.14.1.bb
index 6de30098d6..52e474a2e9 100644
--- a/meta/recipes-graphics/xorg-proto/xcb-proto_1.14.bb
+++ b/meta/recipes-graphics/xorg-proto/xcb-proto_1.14.1.bb
@@ -11,8 +11,8 @@ LICENSE = "MIT"
11LIC_FILES_CHKSUM = "file://COPYING;md5=d763b081cb10c223435b01e00dc0aba7 \ 11LIC_FILES_CHKSUM = "file://COPYING;md5=d763b081cb10c223435b01e00dc0aba7 \
12 file://src/dri2.xml;beginline=2;endline=28;md5=f8763b13ff432e8597e0d610cf598e65" 12 file://src/dri2.xml;beginline=2;endline=28;md5=f8763b13ff432e8597e0d610cf598e65"
13 13
14SRC_URI = "http://xcb.freedesktop.org/dist/${BP}.tar.xz" 14SRC_URI = "https://xorg.freedesktop.org/archive/individual/proto/${BP}.tar.xz"
15SRC_URI[sha256sum] = "186a3ceb26f9b4a015f5a44dcc814c93033a5fc39684f36f1ecc79834416a605" 15SRC_URI[sha256sum] = "f04add9a972ac334ea11d9d7eb4fc7f8883835da3e4859c9afa971efdf57fcc3"
16 16
17inherit autotools pkgconfig python3native 17inherit autotools pkgconfig python3native
18 18
diff --git a/meta/recipes-kernel/dtc/dtc.inc b/meta/recipes-kernel/dtc/dtc.inc
index 0650e3c82e..5da6c24fbf 100644
--- a/meta/recipes-kernel/dtc/dtc.inc
+++ b/meta/recipes-kernel/dtc/dtc.inc
@@ -7,7 +7,9 @@ DEPENDS = "flex-native bison-native"
7 7
8SRC_URI = "git://git.kernel.org/pub/scm/utils/dtc/dtc.git \ 8SRC_URI = "git://git.kernel.org/pub/scm/utils/dtc/dtc.git \
9 file://make_install.patch \ 9 file://make_install.patch \
10 file://0001-dtc-Fix-Makefile-to-add-CFLAGS-not-override.patch \
10 " 11 "
12
11UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)" 13UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)"
12 14
13EXTRA_OEMAKE='NO_PYTHON=1 PREFIX="${prefix}" LIBDIR="${libdir}" DESTDIR="${D}"' 15EXTRA_OEMAKE='NO_PYTHON=1 PREFIX="${prefix}" LIBDIR="${libdir}" DESTDIR="${D}"'
diff --git a/meta/recipes-kernel/dtc/dtc/0001-dtc-Fix-Makefile-to-add-CFLAGS-not-override.patch b/meta/recipes-kernel/dtc/dtc/0001-dtc-Fix-Makefile-to-add-CFLAGS-not-override.patch
new file mode 100644
index 0000000000..a2deb12d4b
--- /dev/null
+++ b/meta/recipes-kernel/dtc/dtc/0001-dtc-Fix-Makefile-to-add-CFLAGS-not-override.patch
@@ -0,0 +1,36 @@
1From f0119060ef1b9bd80e2cae487df1e4aedffb0e9b Mon Sep 17 00:00:00 2001
2From: Oleksiy Obitotskyy <oobitots@cisco.com>
3Date: Fri, 22 Jan 2021 09:12:48 +0200
4Subject: [PATCH] dtc: Fix Makefile to add CFLAGS not override
5
6Makefile override CFLAGS not extend them, so some of them
7missing. Sources builds out of kernel tree and probably not all
8options could be used (?). We need at least -fmacro-prefix-map/
9debug-prefix-map to eliminate absolute path in binaries.
10
11Upstream-Status: Pending
12Signed-off-by: Oleksiy Obitotskyy <oobitots@cisco.com>
13---
14 Makefile | 4 ++--
15 1 file changed, 2 insertions(+), 2 deletions(-)
16
17diff --git a/Makefile b/Makefile
18index 35d936f..b5b13cf 100644
19--- a/Makefile
20+++ b/Makefile
21@@ -20,10 +20,10 @@ CONFIG_LOCALVERSION =
22 # See libfdt_internal.h for details
23 ASSUME_MASK ?= 0
24
25-CPPFLAGS = -I libfdt -I . -DFDT_ASSUME_MASK=$(ASSUME_MASK)
26+CPPFLAGS += -I libfdt -I . -DFDT_ASSUME_MASK=$(ASSUME_MASK)
27 WARNINGS = -Wall -Wpointer-arith -Wcast-qual -Wnested-externs \
28 -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wshadow
29-CFLAGS = -g -Os $(SHAREDLIB_CFLAGS) -Werror $(WARNINGS) $(EXTRA_CFLAGS)
30+CFLAGS += -g -Os $(SHAREDLIB_CFLAGS) -Werror $(WARNINGS) $(EXTRA_CFLAGS)
31
32 BISON = bison
33 LEX = flex
34--
352.25.1
36
diff --git a/meta/recipes-kernel/kmod/kmod.inc b/meta/recipes-kernel/kmod/kmod.inc
index 646dff9a97..10a319ac9f 100644
--- a/meta/recipes-kernel/kmod/kmod.inc
+++ b/meta/recipes-kernel/kmod/kmod.inc
@@ -26,7 +26,6 @@ SRC_URI = "git://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git \
26 26
27S = "${WORKDIR}/git" 27S = "${WORKDIR}/git"
28 28
29EXTRA_AUTORECONF += "--install --symlink"
30EXTRA_OECONF +=" --enable-tools --with-zlib" 29EXTRA_OECONF +=" --enable-tools --with-zlib"
31 30
32PACKAGECONFIG[debug] = "--enable-debug,--disable-debug" 31PACKAGECONFIG[debug] = "--enable-debug,--disable-debug"
diff --git a/meta/recipes-kernel/linux-firmware/linux-firmware_20200817.bb b/meta/recipes-kernel/linux-firmware/linux-firmware_20210208.bb
index 49417e9932..1a9374d0b4 100644
--- a/meta/recipes-kernel/linux-firmware/linux-firmware_20200817.bb
+++ b/meta/recipes-kernel/linux-firmware/linux-firmware_20210208.bb
@@ -31,6 +31,7 @@ LICENSE = "\
31 & Firmware-iwlwifi_firmware \ 31 & Firmware-iwlwifi_firmware \
32 & Firmware-IntcSST2 \ 32 & Firmware-IntcSST2 \
33 & Firmware-kaweth \ 33 & Firmware-kaweth \
34 & Firmware-Lontium \
34 & Firmware-Marvell \ 35 & Firmware-Marvell \
35 & Firmware-moxa \ 36 & Firmware-moxa \
36 & Firmware-myri10ge_firmware \ 37 & Firmware-myri10ge_firmware \
@@ -94,6 +95,7 @@ LIC_FILES_CHKSUM = "file://LICENCE.Abilis;md5=b5ee3f410780e56711ad48eadc22b8bc \
94 file://LICENCE.it913x;md5=1fbf727bfb6a949810c4dbfa7e6ce4f8 \ 95 file://LICENCE.it913x;md5=1fbf727bfb6a949810c4dbfa7e6ce4f8 \
95 file://LICENCE.iwlwifi_firmware;md5=3fd842911ea93c29cd32679aa23e1c88 \ 96 file://LICENCE.iwlwifi_firmware;md5=3fd842911ea93c29cd32679aa23e1c88 \
96 file://LICENCE.kaweth;md5=b1d876e562f4b3b8d391ad8395dfe03f \ 97 file://LICENCE.kaweth;md5=b1d876e562f4b3b8d391ad8395dfe03f \
98 file://LICENSE.Lontium;md5=4ec8dc582ff7295f39e2ca6a7b0be2b6 \
97 file://LICENCE.Marvell;md5=28b6ed8bd04ba105af6e4dcd6e997772 \ 99 file://LICENCE.Marvell;md5=28b6ed8bd04ba105af6e4dcd6e997772 \
98 file://LICENCE.mediatek;md5=7c1976b63217d76ce47d0a11d8a79cf2 \ 100 file://LICENCE.mediatek;md5=7c1976b63217d76ce47d0a11d8a79cf2 \
99 file://LICENCE.moxa;md5=1086614767d8ccf744a923289d3d4261 \ 101 file://LICENCE.moxa;md5=1086614767d8ccf744a923289d3d4261 \
@@ -126,7 +128,7 @@ LIC_FILES_CHKSUM = "file://LICENCE.Abilis;md5=b5ee3f410780e56711ad48eadc22b8bc \
126 file://LICENCE.xc4000;md5=0ff51d2dc49fce04814c9155081092f0 \ 128 file://LICENCE.xc4000;md5=0ff51d2dc49fce04814c9155081092f0 \
127 file://LICENCE.xc5000;md5=1e170c13175323c32c7f4d0998d53f66 \ 129 file://LICENCE.xc5000;md5=1e170c13175323c32c7f4d0998d53f66 \
128 file://LICENCE.xc5000c;md5=12b02efa3049db65d524aeb418dd87ca \ 130 file://LICENCE.xc5000c;md5=12b02efa3049db65d524aeb418dd87ca \
129 file://WHENCE;md5=4d229f79f8770b5b2c4aac655b9fabef \ 131 file://WHENCE;md5=ef0565762eac313c409567b59dff00b2 \
130 " 132 "
131 133
132# These are not common licenses, set NO_GENERIC_LICENSE for them 134# These are not common licenses, set NO_GENERIC_LICENSE for them
@@ -161,6 +163,7 @@ NO_GENERIC_LICENSE[Firmware-IntcSST2] = "LICENCE.IntcSST2"
161NO_GENERIC_LICENSE[Firmware-it913x] = "LICENCE.it913x" 163NO_GENERIC_LICENSE[Firmware-it913x] = "LICENCE.it913x"
162NO_GENERIC_LICENSE[Firmware-iwlwifi_firmware] = "LICENCE.iwlwifi_firmware" 164NO_GENERIC_LICENSE[Firmware-iwlwifi_firmware] = "LICENCE.iwlwifi_firmware"
163NO_GENERIC_LICENSE[Firmware-kaweth] = "LICENCE.kaweth" 165NO_GENERIC_LICENSE[Firmware-kaweth] = "LICENCE.kaweth"
166NO_GENERIC_LICENSE[Firmware-Lontium] = "LICENSE.Lontium"
164NO_GENERIC_LICENSE[Firmware-Marvell] = "LICENCE.Marvell" 167NO_GENERIC_LICENSE[Firmware-Marvell] = "LICENCE.Marvell"
165NO_GENERIC_LICENSE[Firmware-mediatek] = "LICENCE.mediatek" 168NO_GENERIC_LICENSE[Firmware-mediatek] = "LICENCE.mediatek"
166NO_GENERIC_LICENSE[Firmware-moxa] = "LICENCE.moxa" 169NO_GENERIC_LICENSE[Firmware-moxa] = "LICENCE.moxa"
@@ -198,7 +201,7 @@ PE = "1"
198 201
199SRC_URI = "${KERNELORG_MIRROR}/linux/kernel/firmware/${BPN}-${PV}.tar.xz" 202SRC_URI = "${KERNELORG_MIRROR}/linux/kernel/firmware/${BPN}-${PV}.tar.xz"
200 203
201SRC_URI[sha256sum] = "76d05d5f1eff268d3b80675245fa596f557bd55ee2e16ddd54d18ffeae943887" 204SRC_URI[sha256sum] = "1bcb1a3944c361507754a7d26ccff40ffc28d1fb93bce711d67da26b33e785b7"
202 205
203inherit allarch 206inherit allarch
204 207
@@ -222,6 +225,7 @@ PACKAGES =+ "${PN}-ralink-license ${PN}-ralink \
222 ${PN}-sd8887 ${PN}-sd8897 ${PN}-sd8997 ${PN}-usb8997 \ 225 ${PN}-sd8887 ${PN}-sd8897 ${PN}-sd8997 ${PN}-usb8997 \
223 ${PN}-ti-connectivity-license ${PN}-wlcommon ${PN}-wl12xx ${PN}-wl18xx \ 226 ${PN}-ti-connectivity-license ${PN}-wlcommon ${PN}-wl12xx ${PN}-wl18xx \
224 ${PN}-vt6656-license ${PN}-vt6656 \ 227 ${PN}-vt6656-license ${PN}-vt6656 \
228 ${PN}-rs9113 ${PN}-rs9116 \
225 ${PN}-rtl-license ${PN}-rtl8188 ${PN}-rtl8192cu ${PN}-rtl8192ce ${PN}-rtl8192su ${PN}-rtl8723 ${PN}-rtl8821 \ 229 ${PN}-rtl-license ${PN}-rtl8188 ${PN}-rtl8192cu ${PN}-rtl8192ce ${PN}-rtl8192su ${PN}-rtl8723 ${PN}-rtl8821 \
226 ${PN}-rtl8168 \ 230 ${PN}-rtl8168 \
227 ${PN}-cypress-license \ 231 ${PN}-cypress-license \
@@ -261,7 +265,7 @@ PACKAGES =+ "${PN}-ralink-license ${PN}-ralink \
261 ${PN}-bcm43xx-hdr \ 265 ${PN}-bcm43xx-hdr \
262 ${PN}-atheros-license ${PN}-ar9170 ${PN}-ath6k ${PN}-ath9k \ 266 ${PN}-atheros-license ${PN}-ar9170 ${PN}-ath6k ${PN}-ath9k \
263 ${PN}-gplv2-license ${PN}-carl9170 \ 267 ${PN}-gplv2-license ${PN}-carl9170 \
264 ${PN}-ar3k-license ${PN}-ar3k ${PN}-ath10k-license ${PN}-ath10k ${PN}-qca \ 268 ${PN}-ar3k-license ${PN}-ar3k ${PN}-ath10k-license ${PN}-ath10k ${PN}-ath11k ${PN}-qca \
265 \ 269 \
266 ${PN}-imx-sdma-license ${PN}-imx-sdma-imx6q ${PN}-imx-sdma-imx7d \ 270 ${PN}-imx-sdma-license ${PN}-imx-sdma-imx6q ${PN}-imx-sdma-imx7d \
267 \ 271 \
@@ -298,6 +302,7 @@ PACKAGES =+ "${PN}-ralink-license ${PN}-ralink \
298 ${PN}-qcom-adreno-a3xx ${PN}-qcom-adreno-a530 ${PN}-qcom-adreno-a630 \ 302 ${PN}-qcom-adreno-a3xx ${PN}-qcom-adreno-a530 ${PN}-qcom-adreno-a630 \
299 ${PN}-qcom-sdm845-audio ${PN}-qcom-sdm845-compute ${PN}-qcom-sdm845-modem \ 303 ${PN}-qcom-sdm845-audio ${PN}-qcom-sdm845-compute ${PN}-qcom-sdm845-modem \
300 ${PN}-amlogic-vdec-license ${PN}-amlogic-vdec \ 304 ${PN}-amlogic-vdec-license ${PN}-amlogic-vdec \
305 ${PN}-lt9611uxc ${PN}-lontium-license \
301 ${PN}-whence-license \ 306 ${PN}-whence-license \
302 ${PN}-license \ 307 ${PN}-license \
303 " 308 "
@@ -356,12 +361,17 @@ FILES_${PN}-ath10k = " \
356 ${nonarch_base_libdir}/firmware/ath10k \ 361 ${nonarch_base_libdir}/firmware/ath10k \
357" 362"
358 363
364FILES_${PN}-ath11k = " \
365 ${nonarch_base_libdir}/firmware/ath11k \
366"
367
359FILES_${PN}-qca = " \ 368FILES_${PN}-qca = " \
360 ${nonarch_base_libdir}/firmware/qca \ 369 ${nonarch_base_libdir}/firmware/qca \
361" 370"
362 371
363RDEPENDS_${PN}-ar3k += "${PN}-ar3k-license" 372RDEPENDS_${PN}-ar3k += "${PN}-ar3k-license"
364RDEPENDS_${PN}-ath10k += "${PN}-ath10k-license" 373RDEPENDS_${PN}-ath10k += "${PN}-ath10k-license"
374RDEPENDS_${PN}-ath11k += "${PN}-ath10k-license"
365RDEPENDS_${PN}-qca += "${PN}-ath10k-license" 375RDEPENDS_${PN}-qca += "${PN}-ath10k-license"
366 376
367# For ralink 377# For ralink
@@ -397,6 +407,12 @@ FILES_${PN}-radeon = " \
397 407
398RDEPENDS_${PN}-radeon += "${PN}-radeon-license" 408RDEPENDS_${PN}-radeon += "${PN}-radeon-license"
399 409
410# For lontium
411LICENSE_${PN}-lt9611uxc = "Firmware-Lontium"
412
413FILES_${PN}-lontium-license = "${nonarch_base_libdir}/firmware/LICENSE.Lontium"
414FILES_${PN}-lt9611uxc = "${nonarch_base_libdir}/firmware/lt9611uxc_fw.bin"
415
400# For marvell 416# For marvell
401LICENSE_${PN}-pcie8897 = "Firmware-Marvell" 417LICENSE_${PN}-pcie8897 = "Firmware-Marvell"
402LICENSE_${PN}-pcie8997 = "Firmware-Marvell" 418LICENSE_${PN}-pcie8997 = "Firmware-Marvell"
@@ -477,6 +493,13 @@ FILES_${PN}-netronome = " \
477 ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0096*.nffw \ 493 ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0096*.nffw \
478 ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0097*.nffw \ 494 ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0097*.nffw \
479 ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0099*.nffw \ 495 ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0099*.nffw \
496 ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0058-0011_2x40.nffw \
497 ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0058-0012_2x40.nffw \
498 ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0078-0011_1x100.nffw \
499 ${nonarch_base_libdir}/firmware/netronome/bpf \
500 ${nonarch_base_libdir}/firmware/netronome/flower \
501 ${nonarch_base_libdir}/firmware/netronome/nic \
502 ${nonarch_base_libdir}/firmware/netronome/nic-sriov \
480" 503"
481 504
482RDEPENDS_${PN}-netronome += "${PN}-netronome-license" 505RDEPENDS_${PN}-netronome += "${PN}-netronome-license"
@@ -503,6 +526,16 @@ RDEPENDS_${PN}-nvidia-gpu += "${PN}-nvidia-license"
503RDEPENDS_${PN}-nvidia-tegra += "${PN}-nvidia-license" 526RDEPENDS_${PN}-nvidia-tegra += "${PN}-nvidia-license"
504RDEPENDS_${PN}-nvidia-tegra-k1 += "${PN}-nvidia-license" 527RDEPENDS_${PN}-nvidia-tegra-k1 += "${PN}-nvidia-license"
505 528
529# For RSI RS911x WiFi
530LICENSE_${PN}-rs9113 = "WHENCE"
531LICENSE_${PN}-rs9116 = "WHENCE"
532
533FILES_${PN}-rs9113 = " ${nonarch_base_libdir}/firmware/rsi/rs9113*.rps "
534FILES_${PN}-rs9116 = " ${nonarch_base_libdir}/firmware/rsi/rs9116*.rps "
535
536RDEPENDS_${PN}-rs9113 += "${PN}-whence-license"
537RDEPENDS_${PN}-rs9116 += "${PN}-whence-license"
538
506# For rtl 539# For rtl
507LICENSE_${PN}-rtl8188 = "Firmware-rtlwifi_firmware" 540LICENSE_${PN}-rtl8188 = "Firmware-rtlwifi_firmware"
508LICENSE_${PN}-rtl8192cu = "Firmware-rtlwifi_firmware" 541LICENSE_${PN}-rtl8192cu = "Firmware-rtlwifi_firmware"
@@ -603,7 +636,9 @@ FILES_${PN}-bcm4329 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4329-sdio.bi
603FILES_${PN}-bcm4330 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4330-sdio.*" 636FILES_${PN}-bcm4330 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4330-sdio.*"
604FILES_${PN}-bcm4334 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4334-sdio.bin" 637FILES_${PN}-bcm4334 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4334-sdio.bin"
605FILES_${PN}-bcm4335 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4335-sdio.bin" 638FILES_${PN}-bcm4335 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4335-sdio.bin"
606FILES_${PN}-bcm4339 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4339-sdio.bin" 639FILES_${PN}-bcm4339 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4339-sdio.bin \
640 ${nonarch_base_libdir}/firmware/cypress/cyfmac4339-sdio.bin \
641"
607FILES_${PN}-bcm43241b0 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43241b0-sdio.bin" 642FILES_${PN}-bcm43241b0 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43241b0-sdio.bin"
608FILES_${PN}-bcm43241b4 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43241b4-sdio.bin" 643FILES_${PN}-bcm43241b4 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43241b4-sdio.bin"
609FILES_${PN}-bcm43241b5 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43241b5-sdio.bin" 644FILES_${PN}-bcm43241b5 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43241b5-sdio.bin"
@@ -612,12 +647,18 @@ FILES_${PN}-bcm43143 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43143.bin \
612 ${nonarch_base_libdir}/firmware/brcm/brcmfmac43143-sdio.bin \ 647 ${nonarch_base_libdir}/firmware/brcm/brcmfmac43143-sdio.bin \
613" 648"
614FILES_${PN}-bcm43430a0 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43430a0-sdio.*" 649FILES_${PN}-bcm43430a0 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43430a0-sdio.*"
615FILES_${PN}-bcm43455 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43455-sdio.*" 650FILES_${PN}-bcm43455 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43455-sdio.* \
651 ${nonarch_base_libdir}/firmware/cypress/cyfmac43455-sdio.* \
652"
616FILES_${PN}-bcm4350c2 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4350c2-pcie.bin" 653FILES_${PN}-bcm4350c2 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4350c2-pcie.bin"
617FILES_${PN}-bcm4350 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4350-pcie.bin" 654FILES_${PN}-bcm4350 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4350-pcie.bin"
618FILES_${PN}-bcm4356 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4356-sdio.bin" 655FILES_${PN}-bcm4356 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4356-sdio.bin \
656 ${nonarch_base_libdir}/firmware/cypress/cyfmac4356-sdio.bin \
657"
619FILES_${PN}-bcm43569 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43569.bin" 658FILES_${PN}-bcm43569 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43569.bin"
620FILES_${PN}-bcm43570 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43570-pcie.bin" 659FILES_${PN}-bcm43570 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43570-pcie.bin \
660 ${nonarch_base_libdir}/firmware/cypress/cyfmac43570-pcie.bin \
661"
621FILES_${PN}-bcm4358 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4358-pcie.bin" 662FILES_${PN}-bcm4358 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4358-pcie.bin"
622FILES_${PN}-bcm43602 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43602-pcie.bin \ 663FILES_${PN}-bcm43602 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43602-pcie.bin \
623 ${nonarch_base_libdir}/firmware/brcm/brcmfmac43602-pcie.ap.bin \ 664 ${nonarch_base_libdir}/firmware/brcm/brcmfmac43602-pcie.ap.bin \
@@ -688,13 +729,21 @@ LICENSE_${PN}-cypress-license = "Firmware-cypress"
688FILES_${PN}-cypress-license = "${nonarch_base_libdir}/firmware/LICENCE.cypress" 729FILES_${PN}-cypress-license = "${nonarch_base_libdir}/firmware/LICENCE.cypress"
689 730
690FILES_${PN}-bcm-0bb4-0306 = "${nonarch_base_libdir}/firmware/brcm/BCM-0bb4-0306.hcd" 731FILES_${PN}-bcm-0bb4-0306 = "${nonarch_base_libdir}/firmware/brcm/BCM-0bb4-0306.hcd"
691FILES_${PN}-bcm43340 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43340-sdio.*" 732FILES_${PN}-bcm43340 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43340-sdio.* \
692FILES_${PN}-bcm43362 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43362-sdio.*" 733 ${nonarch_base_libdir}/firmware/cypress/cyfmac43340-sdio.*"
693FILES_${PN}-bcm43430 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43430-sdio.*" 734FILES_${PN}-bcm43362 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43362-sdio.* \
694FILES_${PN}-bcm4354 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4354-sdio.bin" 735 ${nonarch_base_libdir}/firmware/cypress/cyfmac43362-sdio.*"
695FILES_${PN}-bcm4356-pcie = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4356-pcie.*" 736FILES_${PN}-bcm43430 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43430-sdio.* \
737 ${nonarch_base_libdir}/firmware/cypress/cyfmac43430-sdio.*"
738FILES_${PN}-bcm4354 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4354-sdio.bin \
739 ${nonarch_base_libdir}/firmware/cypress/cyfmac4354-sdio.bin \
740"
741FILES_${PN}-bcm4356-pcie = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4356-pcie.* \
742 ${nonarch_base_libdir}/firmware/cypress/cyfmac4356-pcie.* \
743"
696FILES_${PN}-bcm4373 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4373-sdio.bin \ 744FILES_${PN}-bcm4373 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4373-sdio.bin \
697 ${nonarch_base_libdir}/firmware/brcm/brcmfmac4373.bin \ 745 ${nonarch_base_libdir}/firmware/brcm/brcmfmac4373.bin \
746 ${nonarch_base_libdir}/firmware/cypress/cyfmac4373-sdio.bin \
698" 747"
699 748
700LICENSE_${PN}-bcm-0bb4-0306 = "Firmware-cypress" 749LICENSE_${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 8373c97a31..8a900ed182 100644
--- a/meta/recipes-kernel/linux/kernel-devsrc.bb
+++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
@@ -119,6 +119,10 @@ do_install() {
119 # but without this file, we get a forced syncconfig run in v5.8+, which prompts and 119 # but without this file, we get a forced syncconfig run in v5.8+, which prompts and
120 # breaks workflows. 120 # breaks workflows.
121 cp -a --parents include/generated/autoconf.h $kerneldir/build 2>/dev/null || : 121 cp -a --parents include/generated/autoconf.h $kerneldir/build 2>/dev/null || :
122
123 if [ -e $kerneldir/include/generated/.vdso-offsets.h.cmd ]; then
124 rm $kerneldir/include/generated/.vdso-offsets.h.cmd
125 fi
122 ) 126 )
123 127
124 # now grab the chunks from the source tree that we need 128 # now grab the chunks from the source tree that we need
diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_5.4.bb b/meta/recipes-kernel/linux/linux-yocto-rt_5.4.bb
index 183acce226..da1d5b72da 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_5.4.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_5.4.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 ?= "e500e89811e268ab5c420744c41b10d12c9844a0" 14SRCREV_machine ?= "324e77d816cf6434507ab29140beb24044009efa"
15SRCREV_meta ?= "8d0ed83a864cc91eef4d2abbc90f13d4ecd1c213" 15SRCREV_meta ?= "d7fd0213b75ce9b6206f63dbdd435ab326598642"
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.4;destsuffix=${KMETA}" 18 git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.4;destsuffix=${KMETA}"
19 19
20LINUX_VERSION ?= "5.4.75" 20LINUX_VERSION ?= "5.4.112"
21 21
22LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814" 22LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
23 23
diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_5.8.bb b/meta/recipes-kernel/linux/linux-yocto-rt_5.8.bb
index 203ddf6684..d20b8b10ab 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_5.8.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_5.8.bb
@@ -11,8 +11,8 @@ 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 ?= "64fd51cbe98ae4a0e05e59ed9abd9135f1b4cf64" 14SRCREV_machine ?= "3c5d210805d61bea8f8a8081e0e3a89ea8a61f3f"
15SRCREV_meta ?= "7883b60d324029d26020c0b3f826b35c52fd9674" 15SRCREV_meta ?= "b976de4f41df1a50dc84839b64fb0ce2c6f9fb21"
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.8;destsuffix=${KMETA}" 18 git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.8;destsuffix=${KMETA}"
diff --git a/meta/recipes-kernel/linux/linux-yocto-tiny_5.4.bb b/meta/recipes-kernel/linux/linux-yocto-tiny_5.4.bb
index f6190be8da..1edc632de7 100644
--- a/meta/recipes-kernel/linux/linux-yocto-tiny_5.4.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-tiny_5.4.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.4.75" 9LINUX_VERSION ?= "5.4.112"
10LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814" 10LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
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 ?= "2c7da912c6b5bd36d84f75e0aff4afd0814f1bd3" 18SRCREV_machine_qemuarm ?= "8463db325b93f0669446f68c19334cfe11ffb9c2"
19SRCREV_machine ?= "d0096198f08dd2aa4222ef5480d2fcdaf520b65b" 19SRCREV_machine ?= "5f54b437b6502d3febee553100b2cb2a9e0c5f8a"
20SRCREV_meta ?= "8d0ed83a864cc91eef4d2abbc90f13d4ecd1c213" 20SRCREV_meta ?= "d7fd0213b75ce9b6206f63dbdd435ab326598642"
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.8.bb b/meta/recipes-kernel/linux/linux-yocto-tiny_5.8.bb
index f37f525cc3..a5135155d5 100644
--- a/meta/recipes-kernel/linux/linux-yocto-tiny_5.8.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-tiny_5.8.bb
@@ -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 ?= "aa614dcf182db126013b255968ab125afd96eb88" 18SRCREV_machine_qemuarm ?= "9509db6e3ed6a23b1f7495b53248d1cbfe22710b"
19SRCREV_machine ?= "64fd51cbe98ae4a0e05e59ed9abd9135f1b4cf64" 19SRCREV_machine ?= "3c5d210805d61bea8f8a8081e0e3a89ea8a61f3f"
20SRCREV_meta ?= "7883b60d324029d26020c0b3f826b35c52fd9674" 20SRCREV_meta ?= "b976de4f41df1a50dc84839b64fb0ce2c6f9fb21"
21 21
22PV = "${LINUX_VERSION}+git${SRCPV}" 22PV = "${LINUX_VERSION}+git${SRCPV}"
23 23
diff --git a/meta/recipes-kernel/linux/linux-yocto_5.4.bb b/meta/recipes-kernel/linux/linux-yocto_5.4.bb
index 23fc5ea819..53cfabb3a7 100644
--- a/meta/recipes-kernel/linux/linux-yocto_5.4.bb
+++ b/meta/recipes-kernel/linux/linux-yocto_5.4.bb
@@ -12,16 +12,16 @@ KBRANCH_qemux86 ?= "v5.4/standard/base"
12KBRANCH_qemux86-64 ?= "v5.4/standard/base" 12KBRANCH_qemux86-64 ?= "v5.4/standard/base"
13KBRANCH_qemumips64 ?= "v5.4/standard/mti-malta64" 13KBRANCH_qemumips64 ?= "v5.4/standard/mti-malta64"
14 14
15SRCREV_machine_qemuarm ?= "dbac8d2939bca0a92226cfd55543331715dd642d" 15SRCREV_machine_qemuarm ?= "133328e5d558f6060a5633d71506a6b716bb4fc6"
16SRCREV_machine_qemuarm64 ?= "d0096198f08dd2aa4222ef5480d2fcdaf520b65b" 16SRCREV_machine_qemuarm64 ?= "5f54b437b6502d3febee553100b2cb2a9e0c5f8a"
17SRCREV_machine_qemumips ?= "819cf265755f21768f6bb98312cb568c6db8b1e8" 17SRCREV_machine_qemumips ?= "eef7365804592f95bceefa143cdb3cc19e8c6b66"
18SRCREV_machine_qemuppc ?= "d0096198f08dd2aa4222ef5480d2fcdaf520b65b" 18SRCREV_machine_qemuppc ?= "5f54b437b6502d3febee553100b2cb2a9e0c5f8a"
19SRCREV_machine_qemuriscv64 ?= "d0096198f08dd2aa4222ef5480d2fcdaf520b65b" 19SRCREV_machine_qemuriscv64 ?= "5f54b437b6502d3febee553100b2cb2a9e0c5f8a"
20SRCREV_machine_qemux86 ?= "d0096198f08dd2aa4222ef5480d2fcdaf520b65b" 20SRCREV_machine_qemux86 ?= "5f54b437b6502d3febee553100b2cb2a9e0c5f8a"
21SRCREV_machine_qemux86-64 ?= "d0096198f08dd2aa4222ef5480d2fcdaf520b65b" 21SRCREV_machine_qemux86-64 ?= "5f54b437b6502d3febee553100b2cb2a9e0c5f8a"
22SRCREV_machine_qemumips64 ?= "bb9110d96ce8a2c56466e5b4314b93175af3d80d" 22SRCREV_machine_qemumips64 ?= "996fe040c8d8d01a9af6be42dae3844d127471bf"
23SRCREV_machine ?= "d0096198f08dd2aa4222ef5480d2fcdaf520b65b" 23SRCREV_machine ?= "5f54b437b6502d3febee553100b2cb2a9e0c5f8a"
24SRCREV_meta ?= "8d0ed83a864cc91eef4d2abbc90f13d4ecd1c213" 24SRCREV_meta ?= "d7fd0213b75ce9b6206f63dbdd435ab326598642"
25 25
26# remap qemuarm to qemuarma15 for the 5.4 kernel 26# remap qemuarm to qemuarma15 for the 5.4 kernel
27# KMACHINE_qemuarm ?= "qemuarma15" 27# KMACHINE_qemuarm ?= "qemuarma15"
@@ -30,7 +30,7 @@ SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRA
30 git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.4;destsuffix=${KMETA}" 30 git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.4;destsuffix=${KMETA}"
31 31
32LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814" 32LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
33LINUX_VERSION ?= "5.4.75" 33LINUX_VERSION ?= "5.4.112"
34 34
35DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}" 35DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
36DEPENDS += "openssl-native util-linux-native" 36DEPENDS += "openssl-native util-linux-native"
diff --git a/meta/recipes-kernel/linux/linux-yocto_5.8.bb b/meta/recipes-kernel/linux/linux-yocto_5.8.bb
index c0cdffce73..f6ebefbf1b 100644
--- a/meta/recipes-kernel/linux/linux-yocto_5.8.bb
+++ b/meta/recipes-kernel/linux/linux-yocto_5.8.bb
@@ -12,16 +12,16 @@ KBRANCH_qemux86 ?= "v5.8/standard/base"
12KBRANCH_qemux86-64 ?= "v5.8/standard/base" 12KBRANCH_qemux86-64 ?= "v5.8/standard/base"
13KBRANCH_qemumips64 ?= "v5.8/standard/mti-malta64" 13KBRANCH_qemumips64 ?= "v5.8/standard/mti-malta64"
14 14
15SRCREV_machine_qemuarm ?= "cd6c8c74317d2f9504c25e28e37f4140deec2d19" 15SRCREV_machine_qemuarm ?= "14b463d0e5c1e2ff354244420f9bbc7f0ab80533"
16SRCREV_machine_qemuarm64 ?= "64fd51cbe98ae4a0e05e59ed9abd9135f1b4cf64" 16SRCREV_machine_qemuarm64 ?= "3c5d210805d61bea8f8a8081e0e3a89ea8a61f3f"
17SRCREV_machine_qemumips ?= "c610a204d0821f5abc253e72894fd32b41b92db3" 17SRCREV_machine_qemumips ?= "8d8d9afb396f154f366f32948fdff3cf4e269841"
18SRCREV_machine_qemuppc ?= "64fd51cbe98ae4a0e05e59ed9abd9135f1b4cf64" 18SRCREV_machine_qemuppc ?= "3c5d210805d61bea8f8a8081e0e3a89ea8a61f3f"
19SRCREV_machine_qemuriscv64 ?= "64fd51cbe98ae4a0e05e59ed9abd9135f1b4cf64" 19SRCREV_machine_qemuriscv64 ?= "3c5d210805d61bea8f8a8081e0e3a89ea8a61f3f"
20SRCREV_machine_qemux86 ?= "64fd51cbe98ae4a0e05e59ed9abd9135f1b4cf64" 20SRCREV_machine_qemux86 ?= "3c5d210805d61bea8f8a8081e0e3a89ea8a61f3f"
21SRCREV_machine_qemux86-64 ?= "64fd51cbe98ae4a0e05e59ed9abd9135f1b4cf64" 21SRCREV_machine_qemux86-64 ?= "3c5d210805d61bea8f8a8081e0e3a89ea8a61f3f"
22SRCREV_machine_qemumips64 ?= "86cc0d9a3f6751ada12fa4630b3e3c23221d6da7" 22SRCREV_machine_qemumips64 ?= "01a02b058f9a8941032b298b8d25c673526152f4"
23SRCREV_machine ?= "64fd51cbe98ae4a0e05e59ed9abd9135f1b4cf64" 23SRCREV_machine ?= "3c5d210805d61bea8f8a8081e0e3a89ea8a61f3f"
24SRCREV_meta ?= "7883b60d324029d26020c0b3f826b35c52fd9674" 24SRCREV_meta ?= "b976de4f41df1a50dc84839b64fb0ce2c6f9fb21"
25 25
26# remap qemuarm to qemuarma15 for the 5.8 kernel 26# remap qemuarm to qemuarma15 for the 5.8 kernel
27# KMACHINE_qemuarm ?= "qemuarma15" 27# KMACHINE_qemuarm ?= "qemuarma15"
diff --git a/meta/recipes-kernel/lttng/babeltrace2_2.0.3.bb b/meta/recipes-kernel/lttng/babeltrace2_2.0.3.bb
index c65882581d..32ba75bf36 100644
--- a/meta/recipes-kernel/lttng/babeltrace2_2.0.3.bb
+++ b/meta/recipes-kernel/lttng/babeltrace2_2.0.3.bb
@@ -17,7 +17,7 @@ UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>2(\.\d+)+)$"
17 17
18S = "${WORKDIR}/git" 18S = "${WORKDIR}/git"
19 19
20inherit autotools pkgconfig ptest 20inherit autotools pkgconfig ptest python3targetconfig
21 21
22EXTRA_OECONF = "--disable-debug-info" 22EXTRA_OECONF = "--disable-debug-info"
23 23
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
deleted file mode 100644
index ae8bec45de..0000000000
--- a/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
+++ /dev/null
@@ -1,54 +0,0 @@
1From ff4d1d7e85be94ef43709cd698f0ec9a12f247d1 Mon Sep 17 00:00:00 2001
2From: Beniamin Sandu <beniaminsandu@gmail.com>
3Date: Thu, 13 Aug 2020 16:24:39 +0300
4Subject: [PATCH 01/10] Kconfig: fix dependency issue when building in-tree
5 without CONFIG_FTRACE
6
7When building in-tree, one could disable CONFIG_FTRACE from kernel
8config which will leave CONFIG_TRACEPOINTS selected by LTTNG modules,
9but generate a lot of linker errors like below because it leaves out
10other stuff, e.g.:
11
12trace.c:(.text+0xd86b): undefined reference to `trace_event_buffer_reserve'
13ld: trace.c:(.text+0xd8de): undefined reference to `trace_event_buffer_commit'
14ld: trace.c:(.text+0xd926): undefined reference to `event_triggers_call'
15ld: trace.c:(.text+0xd942): undefined reference to `trace_event_ignore_this_pid'
16ld: net/mac80211/trace.o: in function `trace_event_raw_event_drv_tdls_cancel_channel_switch':
17
18It appears to be caused by the fact that TRACE_EVENT macros in the Linux
19kernel depend on the Ftrace ring buffer as soon as CONFIG_TRACEPOINTS is
20enabled.
21
22Steps to reproduce:
23
24- Get a clone of an upstream stable kernel and use scripts/built-in.sh on it
25
26- Configure a standard x86-64 build, enable built-in LTTNG but disable
27 CONFIG_FTRACE from Kernel Hacking-->Tracers using menuconfig
28
29- Build will fail at linking stage
30
31Upstream-Status: Backport
32
33Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
34Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
35---
36 Kconfig | 2 +-
37 1 file changed, 1 insertion(+), 1 deletion(-)
38
39diff --git a/Kconfig b/Kconfig
40index acdab73..10eccff 100644
41--- a/Kconfig
42+++ b/Kconfig
43@@ -2,7 +2,7 @@
44
45 config LTTNG
46 tristate "LTTng support"
47- select TRACEPOINTS
48+ select TRACING
49 help
50 LTTng is an open source tracing framework for Linux.
51
52--
532.19.1
54
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-fix-btrfs-tracepoints-output-proper-root-owner-for-t.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-fix-btrfs-tracepoints-output-proper-root-owner-for-t.patch
new file mode 100644
index 0000000000..956f53d7b7
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0001-fix-btrfs-tracepoints-output-proper-root-owner-for-t.patch
@@ -0,0 +1,318 @@
1From e13a7d262928984154fcf89feb14098e0cd1ad31 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Tue, 27 Oct 2020 11:42:23 -0400
4Subject: [PATCH 04/11] fix: btrfs: tracepoints: output proper root owner for
5 trace_find_free_extent() (v5.10)
6
7See upstream commit :
8
9 commit 437490fed3b0c9ae21af8f70e0f338d34560842b
10 Author: Qu Wenruo <wqu@suse.com>
11 Date: Tue Jul 28 09:42:49 2020 +0800
12
13 btrfs: tracepoints: output proper root owner for trace_find_free_extent()
14
15 The current trace event always output result like this:
16
17 find_free_extent: root=2(EXTENT_TREE) len=16384 empty_size=0 flags=4(METADATA)
18 find_free_extent: root=2(EXTENT_TREE) len=16384 empty_size=0 flags=4(METADATA)
19 find_free_extent: root=2(EXTENT_TREE) len=8192 empty_size=0 flags=1(DATA)
20 find_free_extent: root=2(EXTENT_TREE) len=8192 empty_size=0 flags=1(DATA)
21 find_free_extent: root=2(EXTENT_TREE) len=4096 empty_size=0 flags=1(DATA)
22 find_free_extent: root=2(EXTENT_TREE) len=4096 empty_size=0 flags=1(DATA)
23
24 T's saying we're allocating data extent for EXTENT tree, which is not
25 even possible.
26
27 It's because we always use EXTENT tree as the owner for
28 trace_find_free_extent() without using the @root from
29 btrfs_reserve_extent().
30
31 This patch will change the parameter to use proper @root for
32 trace_find_free_extent():
33
34 Now it looks much better:
35
36 find_free_extent: root=5(FS_TREE) len=16384 empty_size=0 flags=36(METADATA|DUP)
37 find_free_extent: root=5(FS_TREE) len=8192 empty_size=0 flags=1(DATA)
38 find_free_extent: root=5(FS_TREE) len=16384 empty_size=0 flags=1(DATA)
39 find_free_extent: root=5(FS_TREE) len=4096 empty_size=0 flags=1(DATA)
40 find_free_extent: root=5(FS_TREE) len=8192 empty_size=0 flags=1(DATA)
41 find_free_extent: root=5(FS_TREE) len=16384 empty_size=0 flags=36(METADATA|DUP)
42 find_free_extent: root=7(CSUM_TREE) len=16384 empty_size=0 flags=36(METADATA|DUP)
43 find_free_extent: root=2(EXTENT_TREE) len=16384 empty_size=0 flags=36(METADATA|DUP)
44 find_free_extent: root=1(ROOT_TREE) len=16384 empty_size=0 flags=36(METADATA|DUP)
45
46Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
47Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
48Change-Id: I1d674064d29b31417e2acffdeb735f5052a87032
49
50Upstream-Status: Backport
51
52Signed-off-by: He Zhe <zhe.he@windriver.com>
53---
54 instrumentation/events/lttng-module/btrfs.h | 206 ++++++++++++--------
55 1 file changed, 122 insertions(+), 84 deletions(-)
56
57diff --git a/instrumentation/events/lttng-module/btrfs.h b/instrumentation/events/lttng-module/btrfs.h
58index 7b29008..52fcfd0 100644
59--- a/instrumentation/events/lttng-module/btrfs.h
60+++ b/instrumentation/events/lttng-module/btrfs.h
61@@ -1856,7 +1856,29 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserved_extent, btrfs_reserved_extent_f
62
63 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
64
65-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
66+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0) || \
67+ LTTNG_KERNEL_RANGE(5,9,6, 5,10,0) || \
68+ LTTNG_KERNEL_RANGE(5,4,78, 5,5,0))
69+LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
70+
71+ btrfs_find_free_extent,
72+
73+ TP_PROTO(const struct btrfs_root *root, u64 num_bytes, u64 empty_size,
74+ u64 data),
75+
76+ TP_ARGS(root, num_bytes, empty_size, data),
77+
78+ TP_FIELDS(
79+ ctf_array(u8, fsid, root->lttng_fs_info_fsid, BTRFS_UUID_SIZE)
80+ ctf_integer(u64, root_objectid, root->root_key.objectid)
81+ ctf_integer(u64, num_bytes, num_bytes)
82+ ctf_integer(u64, empty_size, empty_size)
83+ ctf_integer(u64, data, data)
84+ )
85+)
86+
87+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
88+
89 LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
90
91 btrfs_find_free_extent,
92@@ -1874,6 +1896,105 @@ LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
93 )
94 )
95
96+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0))
97+
98+LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
99+
100+ btrfs_find_free_extent,
101+
102+ TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
103+ u64 data),
104+
105+ TP_ARGS(fs_info, num_bytes, empty_size, data),
106+
107+ TP_FIELDS(
108+ ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
109+ ctf_integer(u64, num_bytes, num_bytes)
110+ ctf_integer(u64, empty_size, empty_size)
111+ ctf_integer(u64, data, data)
112+ )
113+)
114+
115+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
116+
117+LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
118+
119+ btrfs_find_free_extent,
120+
121+ TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
122+ u64 data),
123+
124+ TP_ARGS(fs_info, num_bytes, empty_size, data),
125+
126+ TP_FIELDS(
127+ ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
128+ ctf_integer(u64, num_bytes, num_bytes)
129+ ctf_integer(u64, empty_size, empty_size)
130+ ctf_integer(u64, data, data)
131+ )
132+)
133+
134+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
135+
136+LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
137+
138+ btrfs_find_free_extent,
139+
140+ TP_PROTO(struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
141+ u64 data),
142+
143+ TP_ARGS(fs_info, num_bytes, empty_size, data),
144+
145+ TP_FIELDS(
146+ ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
147+ ctf_integer(u64, num_bytes, num_bytes)
148+ ctf_integer(u64, empty_size, empty_size)
149+ ctf_integer(u64, data, data)
150+ )
151+)
152+
153+#elif (LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
154+ LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
155+ LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
156+ LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
157+
158+LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
159+
160+ btrfs_find_free_extent,
161+
162+ TP_PROTO(const struct btrfs_root *root, u64 num_bytes, u64 empty_size,
163+ u64 data),
164+
165+ TP_ARGS(root, num_bytes, empty_size, data),
166+
167+ TP_FIELDS(
168+ ctf_integer(u64, root_objectid, root->root_key.objectid)
169+ ctf_integer(u64, num_bytes, num_bytes)
170+ ctf_integer(u64, empty_size, empty_size)
171+ ctf_integer(u64, data, data)
172+ )
173+)
174+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
175+
176+LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
177+
178+ btrfs_find_free_extent,
179+
180+ TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size,
181+ u64 data),
182+
183+ TP_ARGS(root, num_bytes, empty_size, data),
184+
185+ TP_FIELDS(
186+ ctf_integer(u64, root_objectid, root->root_key.objectid)
187+ ctf_integer(u64, num_bytes, num_bytes)
188+ ctf_integer(u64, empty_size, empty_size)
189+ ctf_integer(u64, data, data)
190+ )
191+)
192+#endif
193+
194+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
195 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
196
197 TP_PROTO(const struct btrfs_block_group *block_group, u64 start,
198@@ -1907,22 +2028,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus
199 )
200
201 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0))
202-LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
203-
204- btrfs_find_free_extent,
205-
206- TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
207- u64 data),
208-
209- TP_ARGS(fs_info, num_bytes, empty_size, data),
210-
211- TP_FIELDS(
212- ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
213- ctf_integer(u64, num_bytes, num_bytes)
214- ctf_integer(u64, empty_size, empty_size)
215- ctf_integer(u64, data, data)
216- )
217-)
218
219 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
220
221@@ -1957,22 +2062,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus
222 )
223
224 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
225-LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
226-
227- btrfs_find_free_extent,
228-
229- TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
230- u64 data),
231-
232- TP_ARGS(fs_info, num_bytes, empty_size, data),
233-
234- TP_FIELDS(
235- ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
236- ctf_integer(u64, num_bytes, num_bytes)
237- ctf_integer(u64, empty_size, empty_size)
238- ctf_integer(u64, data, data)
239- )
240-)
241
242 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
243
244@@ -2011,23 +2100,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus
245
246 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
247
248-LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
249-
250- btrfs_find_free_extent,
251-
252- TP_PROTO(struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
253- u64 data),
254-
255- TP_ARGS(fs_info, num_bytes, empty_size, data),
256-
257- TP_FIELDS(
258- ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
259- ctf_integer(u64, num_bytes, num_bytes)
260- ctf_integer(u64, empty_size, empty_size)
261- ctf_integer(u64, data, data)
262- )
263-)
264-
265 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
266
267 TP_PROTO(struct btrfs_fs_info *fs_info,
268@@ -2066,23 +2138,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus
269 LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
270 LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
271
272-LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
273-
274- btrfs_find_free_extent,
275-
276- TP_PROTO(const struct btrfs_root *root, u64 num_bytes, u64 empty_size,
277- u64 data),
278-
279- TP_ARGS(root, num_bytes, empty_size, data),
280-
281- TP_FIELDS(
282- ctf_integer(u64, root_objectid, root->root_key.objectid)
283- ctf_integer(u64, num_bytes, num_bytes)
284- ctf_integer(u64, empty_size, empty_size)
285- ctf_integer(u64, data, data)
286- )
287-)
288-
289 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
290
291 TP_PROTO(const struct btrfs_root *root,
292@@ -2120,23 +2175,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus
293
294 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
295
296-LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
297-
298- btrfs_find_free_extent,
299-
300- TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size,
301- u64 data),
302-
303- TP_ARGS(root, num_bytes, empty_size, data),
304-
305- TP_FIELDS(
306- ctf_integer(u64, root_objectid, root->root_key.objectid)
307- ctf_integer(u64, num_bytes, num_bytes)
308- ctf_integer(u64, empty_size, empty_size)
309- ctf_integer(u64, data, data)
310- )
311-)
312-
313 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
314
315 TP_PROTO(struct btrfs_root *root,
316--
3172.17.1
318
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
deleted file mode 100644
index fab673b854..0000000000
--- a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
+++ /dev/null
@@ -1,41 +0,0 @@
1From e10ab43dd0e425df5bc0ac763447664ed075ba05 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 10 Aug 2020 11:22:05 -0400
4Subject: [PATCH 02/10] fix: Move mmutrace.h into the mmu/ sub-directory (v5.9)
5
6 commit 33e3042dac6bcc33b80835f7d7b502b1d74c457c
7 Author: Sean Christopherson <sean.j.christopherson@intel.com>
8 Date: Mon Jun 22 13:20:29 2020 -0700
9
10 KVM: x86/mmu: Move mmu_audit.c and mmutrace.h into the mmu/ sub-directory
11
12 Move mmu_audit.c and mmutrace.h under mmu/ where they belong.
13
14Upstream-Status: Backport
15
16Change-Id: I582525ccca34e1e3bd62870364108a7d3e9df2e4
17Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
18Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
19---
20 probes/lttng-probe-kvm-x86-mmu.c | 4 ++++
21 1 file changed, 4 insertions(+)
22
23diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
24index 37384a2..5a7ef1e 100644
25--- a/probes/lttng-probe-kvm-x86-mmu.c
26+++ b/probes/lttng-probe-kvm-x86-mmu.c
27@@ -24,7 +24,11 @@
28 */
29 #include <wrapper/tracepoint.h>
30
31+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
32+#include <../../arch/x86/kvm/mmu/mmutrace.h>
33+#else
34 #include <../../arch/x86/kvm/mmutrace.h>
35+#endif
36
37 #undef TRACE_INCLUDE_PATH
38 #undef TRACE_INCLUDE_FILE
39--
402.19.1
41
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
deleted file mode 100644
index 524631cc72..0000000000
--- a/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1From f16315cc45c4c6b880de541bb092ca18a13952b7 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 10 Aug 2020 11:36:03 -0400
4Subject: [PATCH 03/10] fix: KVM: x86/mmu: Make kvm_mmu_page definition and
5 accessor internal-only (v5.9)
6
7 commit 985ab2780164698ec6e7d73fad523d50449261dd
8 Author: Sean Christopherson <sean.j.christopherson@intel.com>
9 Date: Mon Jun 22 13:20:32 2020 -0700
10
11 KVM: x86/mmu: Make kvm_mmu_page definition and accessor internal-only
12
13 Make 'struct kvm_mmu_page' MMU-only, nothing outside of the MMU should
14 be poking into the gory details of shadow pages.
15
16Upstream-Status: Backport
17
18Change-Id: Ia5c1b9c49c2b00dad1d5b17c50c3dc730dafda20
19Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
20Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
21---
22 probes/lttng-probe-kvm-x86-mmu.c | 1 +
23 1 file changed, 1 insertion(+)
24
25diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
26index 5a7ef1e..8f98186 100644
27--- a/probes/lttng-probe-kvm-x86-mmu.c
28+++ b/probes/lttng-probe-kvm-x86-mmu.c
29@@ -25,6 +25,7 @@
30 #include <wrapper/tracepoint.h>
31
32 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
33+#include <../../arch/x86/kvm/mmu/mmu_internal.h>
34 #include <../../arch/x86/kvm/mmu/mmutrace.h>
35 #else
36 #include <../../arch/x86/kvm/mmutrace.h>
37--
382.19.1
39
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
deleted file mode 100644
index e29c07252c..0000000000
--- a/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
+++ /dev/null
@@ -1,84 +0,0 @@
1From 8fe742807e65af29dac3fea568ff93cbc5dd9a56 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 24 Aug 2020 15:26:04 -0400
4Subject: [PATCH 04/10] fix: ext4: limit the length of per-inode prealloc list
5 (v5.9)
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10See upstream commit:
11
12 commit 27bc446e2def38db3244a6eb4bb1d6312936610a
13 Author: brookxu <brookxu.cn@gmail.com>
14 Date: Mon Aug 17 15:36:15 2020 +0800
15
16 ext4: limit the length of per-inode prealloc list
17
18 In the scenario of writing sparse files, the per-inode prealloc list may
19 be very long, resulting in high overhead for ext4_mb_use_preallocated().
20 To circumvent this problem, we limit the maximum length of per-inode
21 prealloc list to 512 and allow users to modify it.
22
23 After patching, we observed that the sys ratio of cpu has dropped, and
24 the system throughput has increased significantly. We created a process
25 to write the sparse file, and the running time of the process on the
26 fixed kernel was significantly reduced, as follows:
27
28 Running time on unfixed kernel:
29 [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
30 real 0m2.051s
31 user 0m0.008s
32 sys 0m2.026s
33
34 Running time on fixed kernel:
35 [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
36 real 0m0.471s
37 user 0m0.004s
38 sys 0m0.395s
39
40Upstream-Status: Backport
41
42Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
43Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
44Change-Id: I5169cb24853d4da32e2862a6626f1f058689b053
45---
46 instrumentation/events/lttng-module/ext4.h | 15 +++++++++++++++
47 1 file changed, 15 insertions(+)
48
49diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
50index 5f7ab28..72ad4c9 100644
51--- a/instrumentation/events/lttng-module/ext4.h
52+++ b/instrumentation/events/lttng-module/ext4.h
53@@ -460,6 +460,20 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
54 )
55 #endif
56
57+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
58+LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
59+ TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
60+
61+ TP_ARGS(inode, len, needed),
62+
63+ TP_FIELDS(
64+ ctf_integer(dev_t, dev, inode->i_sb->s_dev)
65+ ctf_integer(ino_t, ino, inode->i_ino)
66+ ctf_integer(unsigned int, len, len)
67+ ctf_integer(unsigned int, needed, needed)
68+ )
69+)
70+#else
71 LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
72 TP_PROTO(struct inode *inode),
73
74@@ -470,6 +484,7 @@ LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
75 ctf_integer(ino_t, ino, inode->i_ino)
76 )
77 )
78+#endif
79
80 LTTNG_TRACEPOINT_EVENT(ext4_mb_discard_preallocations,
81 TP_PROTO(struct super_block *sb, int needed),
82--
832.19.1
84
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
deleted file mode 100644
index f76e9698c8..0000000000
--- a/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
+++ /dev/null
@@ -1,63 +0,0 @@
1From 52563d02a9234215b62c5f519aa1b5d8589ccd0a Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 24 Aug 2020 15:37:50 -0400
4Subject: [PATCH 05/10] =?UTF-8?q?fix:=20ext4:=20indicate=20via=20a=20block?=
5 =?UTF-8?q?=20bitmap=20read=20is=20prefetched=E2=80=A6=20(v5.9)?=
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10See upstream commit:
11
12 commit ab74c7b23f3770935016e3eb3ecdf1e42b73efaa
13 Author: Theodore Ts'o <tytso@mit.edu>
14 Date: Wed Jul 15 11:48:55 2020 -0400
15
16 ext4: indicate via a block bitmap read is prefetched via a tracepoint
17
18 Modify the ext4_read_block_bitmap_load tracepoint so that it tells us
19 whether a block bitmap is being prefetched.
20
21Upstream-Status: Backport
22
23Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
24Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
25Change-Id: I0e5e2c5b8004223d0928235c092449ee16a940e1
26---
27 instrumentation/events/lttng-module/ext4.h | 14 ++++++++++++++
28 1 file changed, 14 insertions(+)
29
30diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
31index 72ad4c9..4476abb 100644
32--- a/instrumentation/events/lttng-module/ext4.h
33+++ b/instrumentation/events/lttng-module/ext4.h
34@@ -893,12 +893,26 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
35 TP_ARGS(sb, group)
36 )
37
38+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
39+LTTNG_TRACEPOINT_EVENT(ext4_read_block_bitmap_load,
40+ TP_PROTO(struct super_block *sb, unsigned long group, bool prefetch),
41+
42+ TP_ARGS(sb, group, prefetch),
43+
44+ TP_FIELDS(
45+ ctf_integer(dev_t, dev, sb->s_dev)
46+ ctf_integer(__u32, group, group)
47+ ctf_integer(bool, prefetch, prefetch)
48+ )
49+)
50+#else
51 LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_read_block_bitmap_load,
52
53 TP_PROTO(struct super_block *sb, unsigned long group),
54
55 TP_ARGS(sb, group)
56 )
57+#endif
58
59 LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_load_inode_bitmap,
60
61--
622.19.1
63
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
deleted file mode 100644
index 0970dd30aa..0000000000
--- a/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
+++ /dev/null
@@ -1,391 +0,0 @@
1From 57ccbfa6a8a79c7b84394c2097efaf7935607aa5 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Tue, 25 Aug 2020 10:56:29 -0400
4Subject: [PATCH 06/10] fix: removal of [smp_]read_barrier_depends (v5.9)
5
6See upstream commits:
7
8 commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
9 Author: Will Deacon <will@kernel.org>
10 Date: Tue Oct 24 11:22:47 2017 +0100
11
12 locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
13
14 In preparation for the removal of lockless_dereference(), which is the
15 same as READ_ONCE() on all architectures other than Alpha, add an
16 implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
17 used to head dependency chains on all architectures.
18
19 commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
20 Author: Will Deacon <will.deacon@arm.com>
21 Date: Tue Oct 24 11:22:47 2017 +0100
22
23 locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
24
25 In preparation for the removal of lockless_dereference(), which is the
26 same as READ_ONCE() on all architectures other than Alpha, add an
27 implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
28 used to head dependency chains on all architectures.
29
30Upstream-Status: Backport
31
32Change-Id: Ife8880bd9378dca2972da8838f40fc35ccdfaaac
33Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
34Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
35---
36 instrumentation/events/lttng-module/i2c.h | 4 ++--
37 lib/ringbuffer/backend.h | 2 +-
38 lib/ringbuffer/backend_internal.h | 2 +-
39 lib/ringbuffer/frontend.h | 4 ++--
40 lib/ringbuffer/ring_buffer_frontend.c | 4 ++--
41 lib/ringbuffer/ring_buffer_iterator.c | 2 +-
42 lttng-events.c | 8 ++++----
43 probes/lttng-kprobes.c | 6 +++---
44 probes/lttng-kretprobes.c | 6 +++---
45 probes/lttng-tracepoint-event-impl.h | 12 ++++++------
46 probes/lttng-uprobes.c | 6 +++---
47 wrapper/compiler.h | 18 ++++++++++++++++++
48 wrapper/trace-clock.h | 15 +++++----------
49 13 files changed, 51 insertions(+), 38 deletions(-)
50
51diff --git a/instrumentation/events/lttng-module/i2c.h b/instrumentation/events/lttng-module/i2c.h
52index dcbabf6..131d134 100644
53--- a/instrumentation/events/lttng-module/i2c.h
54+++ b/instrumentation/events/lttng-module/i2c.h
55@@ -23,7 +23,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_write,
56
57 TP_code_pre(
58 tp_locvar->extract_sensitive_payload =
59- READ_ONCE(extract_sensitive_payload);
60+ LTTNG_READ_ONCE(extract_sensitive_payload);
61 ),
62
63 TP_FIELDS(
64@@ -78,7 +78,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_reply,
65
66 TP_code_pre(
67 tp_locvar->extract_sensitive_payload =
68- READ_ONCE(extract_sensitive_payload);
69+ LTTNG_READ_ONCE(extract_sensitive_payload);
70 ),
71
72 TP_FIELDS(
73diff --git a/lib/ringbuffer/backend.h b/lib/ringbuffer/backend.h
74index da937f2..43e1d47 100644
75--- a/lib/ringbuffer/backend.h
76+++ b/lib/ringbuffer/backend.h
77@@ -156,7 +156,7 @@ size_t lib_ring_buffer_do_strcpy(const struct lib_ring_buffer_config *config,
78 * Only read source character once, in case it is
79 * modified concurrently.
80 */
81- c = READ_ONCE(src[count]);
82+ c = LTTNG_READ_ONCE(src[count]);
83 if (!c)
84 break;
85 lib_ring_buffer_do_copy(config, &dest[count], &c, 1);
86diff --git a/lib/ringbuffer/backend_internal.h b/lib/ringbuffer/backend_internal.h
87index 2d6a345..1226fd8 100644
88--- a/lib/ringbuffer/backend_internal.h
89+++ b/lib/ringbuffer/backend_internal.h
90@@ -367,7 +367,7 @@ void lib_ring_buffer_clear_noref(const struct lib_ring_buffer_config *config,
91 * Performing a volatile access to read the sb_pages, because we want to
92 * read a coherent version of the pointer and the associated noref flag.
93 */
94- id = READ_ONCE(bufb->buf_wsb[idx].id);
95+ id = LTTNG_READ_ONCE(bufb->buf_wsb[idx].id);
96 for (;;) {
97 /* This check is called on the fast path for each record. */
98 if (likely(!subbuffer_id_is_noref(config, id))) {
99diff --git a/lib/ringbuffer/frontend.h b/lib/ringbuffer/frontend.h
100index 6f516d9..41382fe 100644
101--- a/lib/ringbuffer/frontend.h
102+++ b/lib/ringbuffer/frontend.h
103@@ -79,7 +79,7 @@ void *channel_destroy(struct channel *chan);
104 #define for_each_channel_cpu(cpu, chan) \
105 for ((cpu) = -1; \
106 ({ (cpu) = cpumask_next(cpu, (chan)->backend.cpumask); \
107- smp_read_barrier_depends(); (cpu) < nr_cpu_ids; });)
108+ smp_rmb(); (cpu) < nr_cpu_ids; });)
109
110 extern struct lib_ring_buffer *channel_get_ring_buffer(
111 const struct lib_ring_buffer_config *config,
112@@ -155,7 +155,7 @@ static inline
113 int lib_ring_buffer_is_finalized(const struct lib_ring_buffer_config *config,
114 struct lib_ring_buffer *buf)
115 {
116- int finalized = READ_ONCE(buf->finalized);
117+ int finalized = LTTNG_READ_ONCE(buf->finalized);
118 /*
119 * Read finalized before counters.
120 */
121diff --git a/lib/ringbuffer/ring_buffer_frontend.c b/lib/ringbuffer/ring_buffer_frontend.c
122index 3cab365..4980d20 100644
123--- a/lib/ringbuffer/ring_buffer_frontend.c
124+++ b/lib/ringbuffer/ring_buffer_frontend.c
125@@ -1074,7 +1074,7 @@ int lib_ring_buffer_snapshot(struct lib_ring_buffer *buf,
126 int finalized;
127
128 retry:
129- finalized = READ_ONCE(buf->finalized);
130+ finalized = LTTNG_READ_ONCE(buf->finalized);
131 /*
132 * Read finalized before counters.
133 */
134@@ -1245,7 +1245,7 @@ int lib_ring_buffer_get_subbuf(struct lib_ring_buffer *buf,
135 return -EBUSY;
136 }
137 retry:
138- finalized = READ_ONCE(buf->finalized);
139+ finalized = LTTNG_READ_ONCE(buf->finalized);
140 /*
141 * Read finalized before counters.
142 */
143diff --git a/lib/ringbuffer/ring_buffer_iterator.c b/lib/ringbuffer/ring_buffer_iterator.c
144index d25db72..7b4f20a 100644
145--- a/lib/ringbuffer/ring_buffer_iterator.c
146+++ b/lib/ringbuffer/ring_buffer_iterator.c
147@@ -46,7 +46,7 @@ restart:
148 switch (iter->state) {
149 case ITER_GET_SUBBUF:
150 ret = lib_ring_buffer_get_next_subbuf(buf);
151- if (ret && !READ_ONCE(buf->finalized)
152+ if (ret && !LTTNG_READ_ONCE(buf->finalized)
153 && config->alloc == RING_BUFFER_ALLOC_GLOBAL) {
154 /*
155 * Use "pull" scheme for global buffers. The reader
156diff --git a/lttng-events.c b/lttng-events.c
157index be7e389..d719294 100644
158--- a/lttng-events.c
159+++ b/lttng-events.c
160@@ -1719,7 +1719,7 @@ int lttng_metadata_printf(struct lttng_session *session,
161 size_t len;
162 va_list ap;
163
164- WARN_ON_ONCE(!READ_ONCE(session->active));
165+ WARN_ON_ONCE(!LTTNG_READ_ONCE(session->active));
166
167 va_start(ap, fmt);
168 str = kvasprintf(GFP_KERNEL, fmt, ap);
169@@ -2305,7 +2305,7 @@ int _lttng_event_metadata_statedump(struct lttng_session *session,
170 {
171 int ret = 0;
172
173- if (event->metadata_dumped || !READ_ONCE(session->active))
174+ if (event->metadata_dumped || !LTTNG_READ_ONCE(session->active))
175 return 0;
176 if (chan->channel_type == METADATA_CHANNEL)
177 return 0;
178@@ -2377,7 +2377,7 @@ int _lttng_channel_metadata_statedump(struct lttng_session *session,
179 {
180 int ret = 0;
181
182- if (chan->metadata_dumped || !READ_ONCE(session->active))
183+ if (chan->metadata_dumped || !LTTNG_READ_ONCE(session->active))
184 return 0;
185
186 if (chan->channel_type == METADATA_CHANNEL)
187@@ -2604,7 +2604,7 @@ int _lttng_session_metadata_statedump(struct lttng_session *session)
188 struct lttng_event *event;
189 int ret = 0;
190
191- if (!READ_ONCE(session->active))
192+ if (!LTTNG_READ_ONCE(session->active))
193 return 0;
194
195 lttng_metadata_begin(session);
196diff --git a/probes/lttng-kprobes.c b/probes/lttng-kprobes.c
197index a44eaa1..38fb72e 100644
198--- a/probes/lttng-kprobes.c
199+++ b/probes/lttng-kprobes.c
200@@ -31,11 +31,11 @@ int lttng_kprobes_handler_pre(struct kprobe *p, struct pt_regs *regs)
201 int ret;
202 unsigned long data = (unsigned long) p->addr;
203
204- if (unlikely(!READ_ONCE(chan->session->active)))
205+ if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
206 return 0;
207- if (unlikely(!READ_ONCE(chan->enabled)))
208+ if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
209 return 0;
210- if (unlikely(!READ_ONCE(event->enabled)))
211+ if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
212 return 0;
213
214 lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx, sizeof(data),
215diff --git a/probes/lttng-kretprobes.c b/probes/lttng-kretprobes.c
216index ab98ff2..a6bcd21 100644
217--- a/probes/lttng-kretprobes.c
218+++ b/probes/lttng-kretprobes.c
219@@ -51,11 +51,11 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
220 unsigned long parent_ip;
221 } payload;
222
223- if (unlikely(!READ_ONCE(chan->session->active)))
224+ if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
225 return 0;
226- if (unlikely(!READ_ONCE(chan->enabled)))
227+ if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
228 return 0;
229- if (unlikely(!READ_ONCE(event->enabled)))
230+ if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
231 return 0;
232
233 payload.ip = (unsigned long) krpi->rp->kp.addr;
234diff --git a/probes/lttng-tracepoint-event-impl.h b/probes/lttng-tracepoint-event-impl.h
235index 77b8638..72a669e 100644
236--- a/probes/lttng-tracepoint-event-impl.h
237+++ b/probes/lttng-tracepoint-event-impl.h
238@@ -1132,11 +1132,11 @@ static void __event_probe__##_name(void *__data, _proto) \
239 \
240 if (!_TP_SESSION_CHECK(session, __session)) \
241 return; \
242- if (unlikely(!READ_ONCE(__session->active))) \
243+ if (unlikely(!LTTNG_READ_ONCE(__session->active))) \
244 return; \
245- if (unlikely(!READ_ONCE(__chan->enabled))) \
246+ if (unlikely(!LTTNG_READ_ONCE(__chan->enabled))) \
247 return; \
248- if (unlikely(!READ_ONCE(__event->enabled))) \
249+ if (unlikely(!LTTNG_READ_ONCE(__event->enabled))) \
250 return; \
251 __lf = lttng_rcu_dereference(__session->pid_tracker.p); \
252 if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid))) \
253@@ -1225,11 +1225,11 @@ static void __event_probe__##_name(void *__data) \
254 \
255 if (!_TP_SESSION_CHECK(session, __session)) \
256 return; \
257- if (unlikely(!READ_ONCE(__session->active))) \
258+ if (unlikely(!LTTNG_READ_ONCE(__session->active))) \
259 return; \
260- if (unlikely(!READ_ONCE(__chan->enabled))) \
261+ if (unlikely(!LTTNG_READ_ONCE(__chan->enabled))) \
262 return; \
263- if (unlikely(!READ_ONCE(__event->enabled))) \
264+ if (unlikely(!LTTNG_READ_ONCE(__event->enabled))) \
265 return; \
266 __lf = lttng_rcu_dereference(__session->pid_tracker.p); \
267 if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid))) \
268diff --git a/probes/lttng-uprobes.c b/probes/lttng-uprobes.c
269index bc10128..bda1d9b 100644
270--- a/probes/lttng-uprobes.c
271+++ b/probes/lttng-uprobes.c
272@@ -40,11 +40,11 @@ int lttng_uprobes_handler_pre(struct uprobe_consumer *uc, struct pt_regs *regs)
273 unsigned long ip;
274 } payload;
275
276- if (unlikely(!READ_ONCE(chan->session->active)))
277+ if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
278 return 0;
279- if (unlikely(!READ_ONCE(chan->enabled)))
280+ if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
281 return 0;
282- if (unlikely(!READ_ONCE(event->enabled)))
283+ if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
284 return 0;
285
286 lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx,
287diff --git a/wrapper/compiler.h b/wrapper/compiler.h
288index 1496f33..b9f8c51 100644
289--- a/wrapper/compiler.h
290+++ b/wrapper/compiler.h
291@@ -9,6 +9,7 @@
292 #define _LTTNG_WRAPPER_COMPILER_H
293
294 #include <linux/compiler.h>
295+#include <linux/version.h>
296
297 /*
298 * Don't allow compiling with buggy compiler.
299@@ -39,4 +40,21 @@
300 # define WRITE_ONCE(x, val) ({ ACCESS_ONCE(x) = val; })
301 #endif
302
303+/*
304+ * In v4.15 a smp read barrier was added to READ_ONCE to replace
305+ * lockless_dereference(), replicate this behavior on prior kernels
306+ * and remove calls to smp_read_barrier_depends which was dropped
307+ * in v5.9.
308+ */
309+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
310+#define LTTNG_READ_ONCE(x) READ_ONCE(x)
311+#else
312+#define LTTNG_READ_ONCE(x) \
313+({ \
314+ typeof(x) __val = READ_ONCE(x); \
315+ smp_read_barrier_depends(); \
316+ __val; \
317+})
318+#endif
319+
320 #endif /* _LTTNG_WRAPPER_COMPILER_H */
321diff --git a/wrapper/trace-clock.h b/wrapper/trace-clock.h
322index 9f4e366..187fc82 100644
323--- a/wrapper/trace-clock.h
324+++ b/wrapper/trace-clock.h
325@@ -160,33 +160,30 @@ static inline void put_trace_clock(void)
326
327 static inline u64 trace_clock_read64(void)
328 {
329- struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
330+ struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
331
332 if (likely(!ltc)) {
333 return trace_clock_read64_monotonic();
334 } else {
335- read_barrier_depends(); /* load ltc before content */
336 return ltc->read64();
337 }
338 }
339
340 static inline u64 trace_clock_freq(void)
341 {
342- struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
343+ struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
344
345 if (!ltc) {
346 return trace_clock_freq_monotonic();
347 } else {
348- read_barrier_depends(); /* load ltc before content */
349 return ltc->freq();
350 }
351 }
352
353 static inline int trace_clock_uuid(char *uuid)
354 {
355- struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
356+ struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
357
358- read_barrier_depends(); /* load ltc before content */
359 /* Use default UUID cb when NULL */
360 if (!ltc || !ltc->uuid) {
361 return trace_clock_uuid_monotonic(uuid);
362@@ -197,24 +194,22 @@ static inline int trace_clock_uuid(char *uuid)
363
364 static inline const char *trace_clock_name(void)
365 {
366- struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
367+ struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
368
369 if (!ltc) {
370 return trace_clock_name_monotonic();
371 } else {
372- read_barrier_depends(); /* load ltc before content */
373 return ltc->name();
374 }
375 }
376
377 static inline const char *trace_clock_description(void)
378 {
379- struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
380+ struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
381
382 if (!ltc) {
383 return trace_clock_description_monotonic();
384 } else {
385- read_barrier_depends(); /* load ltc before content */
386 return ltc->description();
387 }
388 }
389--
3902.19.1
391
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0007-fix-objtool-Rename-frame.h-objtool.h-v5.10.patch b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-objtool-Rename-frame.h-objtool.h-v5.10.patch
new file mode 100644
index 0000000000..fde9398394
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-objtool-Rename-frame.h-objtool.h-v5.10.patch
@@ -0,0 +1,88 @@
1From 37b9cb0e6cb92181b7a25583849a9d161a558982 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 26 Oct 2020 13:41:02 -0400
4Subject: [PATCH 07/19] fix: objtool: Rename frame.h -> objtool.h (v5.10)
5
6See upstream commit :
7
8 commit 00089c048eb4a8250325efb32a2724fd0da68cce
9 Author: Julien Thierry <jthierry@redhat.com>
10 Date: Fri Sep 4 16:30:25 2020 +0100
11
12 objtool: Rename frame.h -> objtool.h
13
14 Header frame.h is getting more code annotations to help objtool analyze
15 object files.
16
17 Rename the file to objtool.h.
18
19Upstream-Status: Backport
20
21Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
22Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
23Change-Id: Ic2283161bebcbf1e33b72805eb4d2628f4ae3e89
24---
25 lttng-filter-interpreter.c | 2 +-
26 wrapper/{frame.h => objtool.h} | 19 ++++++++++++-------
27 2 files changed, 13 insertions(+), 8 deletions(-)
28 rename wrapper/{frame.h => objtool.h} (50%)
29
30diff --git a/lttng-filter-interpreter.c b/lttng-filter-interpreter.c
31index 21169f01..5d572437 100644
32--- a/lttng-filter-interpreter.c
33+++ b/lttng-filter-interpreter.c
34@@ -8,7 +8,7 @@
35 */
36
37 #include <wrapper/uaccess.h>
38-#include <wrapper/frame.h>
39+#include <wrapper/objtool.h>
40 #include <wrapper/types.h>
41 #include <linux/swab.h>
42
43diff --git a/wrapper/frame.h b/wrapper/objtool.h
44similarity index 50%
45rename from wrapper/frame.h
46rename to wrapper/objtool.h
47index 6e6dc811..3b997cae 100644
48--- a/wrapper/frame.h
49+++ b/wrapper/objtool.h
50@@ -1,18 +1,23 @@
51-/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
52+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
53 *
54- * wrapper/frame.h
55+ * wrapper/objtool.h
56 *
57 * Copyright (C) 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
58 */
59
60-#ifndef _LTTNG_WRAPPER_FRAME_H
61-#define _LTTNG_WRAPPER_FRAME_H
62+#ifndef _LTTNG_WRAPPER_OBJTOOL_H
63+#define _LTTNG_WRAPPER_OBJTOOL_H
64
65 #include <linux/version.h>
66
67-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0))
68-
69+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
70+#include <linux/objtool.h>
71+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0))
72 #include <linux/frame.h>
73+#endif
74+
75+
76+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0))
77
78 #define LTTNG_STACK_FRAME_NON_STANDARD(func) \
79 STACK_FRAME_NON_STANDARD(func)
80@@ -23,4 +28,4 @@
81
82 #endif
83
84-#endif /* _LTTNG_WRAPPER_FRAME_H */
85+#endif /* _LTTNG_WRAPPER_OBJTOOL_H */
86--
872.19.1
88
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
deleted file mode 100644
index 2843c9cb62..0000000000
--- a/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
+++ /dev/null
@@ -1,59 +0,0 @@
1From eae02feb58064eee5ce15a9f6bdffd107c47da05 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 31 Aug 2020 11:41:38 -0400
4Subject: [PATCH 07/10] fix: writeback: Drop I_DIRTY_TIME_EXPIRE (v5.9)
5
6See upstream commit:
7
8 commit 5fcd57505c002efc5823a7355e21f48dd02d5a51
9 Author: Jan Kara <jack@suse.cz>
10 Date: Fri May 29 16:24:43 2020 +0200
11
12 writeback: Drop I_DIRTY_TIME_EXPIRE
13
14 The only use of I_DIRTY_TIME_EXPIRE is to detect in
15 __writeback_single_inode() that inode got there because flush worker
16 decided it's time to writeback the dirty inode time stamps (either
17 because we are syncing or because of age). However we can detect this
18 directly in __writeback_single_inode() and there's no need for the
19 strange propagation with I_DIRTY_TIME_EXPIRE flag.
20
21Upstream-Status: Backport
22
23Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
24Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
25Change-Id: I92e37c2ff3ec36d431e8f9de5c8e37c5a2da55ea
26---
27 instrumentation/events/lttng-module/writeback.h | 16 +++++++++++++++-
28 1 file changed, 15 insertions(+), 1 deletion(-)
29
30diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
31index affb4eb..ece67ad 100644
32--- a/instrumentation/events/lttng-module/writeback.h
33+++ b/instrumentation/events/lttng-module/writeback.h
34@@ -46,7 +46,21 @@ static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
35
36 #endif
37
38-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
39+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
40+#define show_inode_state(state) \
41+ __print_flags(state, "|", \
42+ {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \
43+ {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \
44+ {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \
45+ {I_NEW, "I_NEW"}, \
46+ {I_WILL_FREE, "I_WILL_FREE"}, \
47+ {I_FREEING, "I_FREEING"}, \
48+ {I_CLEAR, "I_CLEAR"}, \
49+ {I_SYNC, "I_SYNC"}, \
50+ {I_DIRTY_TIME, "I_DIRTY_TIME"}, \
51+ {I_REFERENCED, "I_REFERENCED"} \
52+ )
53+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
54 #define show_inode_state(state) \
55 __print_flags(state, "|", \
56 {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \
57--
582.19.1
59
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
deleted file mode 100644
index 7a0d9a38b8..0000000000
--- a/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
+++ /dev/null
@@ -1,117 +0,0 @@
1From 87b2affc3eb06f3fb2d0923f18af37713eb6814b Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 31 Aug 2020 14:16:01 -0400
4Subject: [PATCH 08/10] fix: writeback: Fix sync livelock due to b_dirty_time
5 processing (v5.9)
6
7See upstream commit:
8
9 commit f9cae926f35e8230330f28c7b743ad088611a8de
10 Author: Jan Kara <jack@suse.cz>
11 Date: Fri May 29 16:08:58 2020 +0200
12
13 writeback: Fix sync livelock due to b_dirty_time processing
14
15 When we are processing writeback for sync(2), move_expired_inodes()
16 didn't set any inode expiry value (older_than_this). This can result in
17 writeback never completing if there's steady stream of inodes added to
18 b_dirty_time list as writeback rechecks dirty lists after each writeback
19 round whether there's more work to be done. Fix the problem by using
20 sync(2) start time is inode expiry value when processing b_dirty_time
21 list similarly as for ordinarily dirtied inodes. This requires some
22 refactoring of older_than_this handling which simplifies the code
23 noticeably as a bonus.
24
25Upstream-Status: Backport
26
27Change-Id: I8b894b13ccc14d9b8983ee4c2810a927c319560b
28Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
29Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
30---
31 .../events/lttng-module/writeback.h | 39 ++++++++++++-------
32 1 file changed, 26 insertions(+), 13 deletions(-)
33
34diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
35index ece67ad..e9018dd 100644
36--- a/instrumentation/events/lttng-module/writeback.h
37+++ b/instrumentation/events/lttng-module/writeback.h
38@@ -384,34 +384,48 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
39 #endif
40 LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
41
42-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
43+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
44+LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
45+ TP_PROTO(struct bdi_writeback *wb,
46+ struct wb_writeback_work *work,
47+ unsigned long dirtied_before,
48+ int moved),
49+ TP_ARGS(wb, work, dirtied_before, moved),
50+ TP_FIELDS(
51+ ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
52+ ctf_integer(unsigned long, older, dirtied_before)
53+ ctf_integer(int, moved, moved)
54+ )
55+)
56+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
57 LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
58 TP_PROTO(struct bdi_writeback *wb,
59-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
60 struct wb_writeback_work *work,
61-#else
62- unsigned long *older_than_this,
63-#endif
64 int moved),
65-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
66 TP_ARGS(wb, work, moved),
67-#else
68+ TP_FIELDS(
69+ ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
70+ ctf_integer(int, moved, moved)
71+ )
72+)
73+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
74+LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
75+ TP_PROTO(struct bdi_writeback *wb,
76+ unsigned long *older_than_this,
77+ int moved),
78 TP_ARGS(wb, older_than_this, moved),
79-#endif
80 TP_FIELDS(
81 ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
82-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
83-#else
84 ctf_integer(unsigned long, older,
85 older_than_this ? *older_than_this : 0)
86 ctf_integer(long, age,
87 older_than_this ?
88 (jiffies - *older_than_this) * 1000 / HZ
89 : -1)
90-#endif
91 ctf_integer(int, moved, moved)
92 )
93 )
94+#endif
95
96 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
97 LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
98@@ -460,7 +474,7 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
99 ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
100 )
101 )
102-#else
103+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
104 LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
105
106 writeback_global_dirty_state,
107@@ -485,7 +499,6 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
108 )
109 )
110 #endif
111-#endif
112
113 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
114
115--
1162.19.1
117
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0009-fix-btrfs-make-ordered-extent-tracepoint-take-btrfs_.patch b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-btrfs-make-ordered-extent-tracepoint-take-btrfs_.patch
new file mode 100644
index 0000000000..bc87c7174e
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-btrfs-make-ordered-extent-tracepoint-take-btrfs_.patch
@@ -0,0 +1,179 @@
1From ddad4e82bc2cc48c0eb56d2daf69409026e8b31a Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Tue, 27 Oct 2020 12:10:05 -0400
4Subject: [PATCH 09/19] fix: btrfs: make ordered extent tracepoint take
5 btrfs_inode (v5.10)
6
7See upstream commit :
8
9 commit acbf1dd0fcbd10c67826a19958f55a053b32f532
10 Author: Nikolay Borisov <nborisov@suse.com>
11 Date: Mon Aug 31 14:42:40 2020 +0300
12
13 btrfs: make ordered extent tracepoint take btrfs_inode
14
15Upstream-Status: Backport
16
17Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
18Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
19Change-Id: I096d0801ffe0ad826cfe414cdd1c0857cbd2b624
20---
21 instrumentation/events/lttng-module/btrfs.h | 120 +++++++++++++++-----
22 1 file changed, 90 insertions(+), 30 deletions(-)
23
24diff --git a/instrumentation/events/lttng-module/btrfs.h b/instrumentation/events/lttng-module/btrfs.h
25index 52fcfd0d..d47f3280 100644
26--- a/instrumentation/events/lttng-module/btrfs.h
27+++ b/instrumentation/events/lttng-module/btrfs.h
28@@ -346,7 +346,29 @@ LTTNG_TRACEPOINT_EVENT(btrfs_handle_em_exist,
29 )
30 #endif
31
32-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0))
33+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
34+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__ordered_extent,
35+
36+ TP_PROTO(const struct btrfs_inode *inode,
37+ const struct btrfs_ordered_extent *ordered),
38+
39+ TP_ARGS(inode, ordered),
40+
41+ TP_FIELDS(
42+ ctf_array(u8, fsid, inode->root->lttng_fs_info_fsid, BTRFS_UUID_SIZE)
43+ ctf_integer(ino_t, ino, btrfs_ino(inode))
44+ ctf_integer(u64, file_offset, ordered->file_offset)
45+ ctf_integer(u64, start, ordered->disk_bytenr)
46+ ctf_integer(u64, len, ordered->num_bytes)
47+ ctf_integer(u64, disk_len, ordered->disk_num_bytes)
48+ ctf_integer(u64, bytes_left, ordered->bytes_left)
49+ ctf_integer(unsigned long, flags, ordered->flags)
50+ ctf_integer(int, compress_type, ordered->compress_type)
51+ ctf_integer(int, refs, refcount_read(&ordered->refs))
52+ ctf_integer(u64, root_objectid, inode->root->root_key.objectid)
53+ )
54+)
55+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0))
56 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__ordered_extent,
57
58 TP_PROTO(const struct inode *inode,
59@@ -458,7 +480,39 @@ LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__ordered_extent,
60 )
61 #endif
62
63-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
64+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
65+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_add,
66+
67+ TP_PROTO(const struct btrfs_inode *inode,
68+ const struct btrfs_ordered_extent *ordered),
69+
70+ TP_ARGS(inode, ordered)
71+)
72+
73+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_remove,
74+
75+ TP_PROTO(const struct btrfs_inode *inode,
76+ const struct btrfs_ordered_extent *ordered),
77+
78+ TP_ARGS(inode, ordered)
79+)
80+
81+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_start,
82+
83+ TP_PROTO(const struct btrfs_inode *inode,
84+ const struct btrfs_ordered_extent *ordered),
85+
86+ TP_ARGS(inode, ordered)
87+)
88+
89+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_put,
90+
91+ TP_PROTO(const struct btrfs_inode *inode,
92+ const struct btrfs_ordered_extent *ordered),
93+
94+ TP_ARGS(inode, ordered)
95+)
96+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
97 LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
98 LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
99 LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
100@@ -494,7 +548,41 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_put,
101
102 TP_ARGS(inode, ordered)
103 )
104+#else
105+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_add,
106+
107+ TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
108+
109+ TP_ARGS(inode, ordered)
110+)
111+
112+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_remove,
113+
114+ TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
115+
116+ TP_ARGS(inode, ordered)
117+)
118+
119+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_start,
120+
121+ TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
122+
123+ TP_ARGS(inode, ordered)
124+)
125
126+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_put,
127+
128+ TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
129+
130+ TP_ARGS(inode, ordered)
131+)
132+#endif
133+
134+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
135+ LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
136+ LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
137+ LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
138+ LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
139 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__writepage,
140
141 TP_PROTO(const struct page *page, const struct inode *inode,
142@@ -563,34 +651,6 @@ LTTNG_TRACEPOINT_EVENT(btrfs_sync_file,
143 )
144 )
145 #else
146-LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_add,
147-
148- TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
149-
150- TP_ARGS(inode, ordered)
151-)
152-
153-LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_remove,
154-
155- TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
156-
157- TP_ARGS(inode, ordered)
158-)
159-
160-LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_start,
161-
162- TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
163-
164- TP_ARGS(inode, ordered)
165-)
166-
167-LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_put,
168-
169- TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
170-
171- TP_ARGS(inode, ordered)
172-)
173-
174 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__writepage,
175
176 TP_PROTO(struct page *page, struct inode *inode,
177--
1782.19.1
179
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
deleted file mode 100644
index 346e1d63ad..0000000000
--- a/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
+++ /dev/null
@@ -1,52 +0,0 @@
1From b74b25f349e92d7b5bdc8684e406d6a889f13773 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Fri, 4 Sep 2020 11:52:51 -0400
4Subject: [PATCH 09/10] fix: version ranges for ext4_discard_preallocations and
5 writeback_queue_io
6
7Upstream-Status: Backport
8
9Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
10Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11Change-Id: Id4fa53cb2e713cbda651e1a75deed91013115592
12---
13 instrumentation/events/lttng-module/ext4.h | 3 ++-
14 instrumentation/events/lttng-module/writeback.h | 8 +++++++-
15 2 files changed, 9 insertions(+), 2 deletions(-)
16
17diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
18index 4476abb..b172c8d 100644
19--- a/instrumentation/events/lttng-module/ext4.h
20+++ b/instrumentation/events/lttng-module/ext4.h
21@@ -460,7 +460,8 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
22 )
23 #endif
24
25-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
26+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
27+ LTTNG_KERNEL_RANGE(5,8,6, 5,9,0))
28 LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
29 TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
30
31diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
32index e9018dd..09637d7 100644
33--- a/instrumentation/events/lttng-module/writeback.h
34+++ b/instrumentation/events/lttng-module/writeback.h
35@@ -384,7 +384,13 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
36 #endif
37 LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
38
39-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
40+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
41+ LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \
42+ LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \
43+ LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \
44+ LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \
45+ LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \
46+ LTTNG_KERNEL_RANGE(4,4,235, 4,5,0))
47 LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
48 TP_PROTO(struct bdi_writeback *wb,
49 struct wb_writeback_work *work,
50--
512.19.1
52
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
deleted file mode 100644
index a16750ddb3..0000000000
--- a/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
+++ /dev/null
@@ -1,918 +0,0 @@
1From ad594e3a953db1b0c3c059fde45b5a5494f6be78 Mon Sep 17 00:00:00 2001
2From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3Date: Tue, 28 Jan 2020 16:02:44 -0500
4Subject: [PATCH 10/10] Fix: system call filter table
5
6The system call filter table has effectively been unused for a long
7time due to system call name prefix mismatch. This means the overhead of
8selective system call tracing was larger than it should have been because
9the event payload preparation would be done for all system calls as soon
10as a single system call is traced.
11
12However, fixing this underlying issue unearths several issues that crept
13unnoticed when the "enabler" concept was introduced (after the original
14implementation of the system call filter table).
15
16Here is a list of the issues which are resolved here:
17
18- Split lttng_syscalls_unregister into an unregister and destroy
19 function, thus awaiting for a grace period (and therefore quiescence
20 of the users) after unregistering the system call tracepoints before
21 freeing the system call filter data structures. This effectively fixes
22 a use-after-free.
23
24- The state for enabling "all" system calls vs enabling specific system
25 calls (and sequences of enable-disable) was incorrect with respect to
26 the "enablers" semantic. This is solved by always tracking the
27 bitmap of enabled system calls, and keeping this bitmap even when
28 enabling all system calls. The sc_filter is now always allocated
29 before system call tracing is registered to tracepoints, which means
30 it does not need to be RCU dereferenced anymore.
31
32Padding fields in the ABI are reserved to select whether to:
33
34- Trace either native or compat system call (or both, which is the
35 behavior currently implemented),
36- Trace either system call entry or exit (or both, which is the
37 behavior currently implemented),
38- Select the system call to trace by name (behavior currently
39 implemented) or by system call number,
40
41Upstream-Status: Backport
42
43Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
44---
45 lttng-abi.c | 43 ++++++
46 lttng-abi.h | 26 ++++
47 lttng-events.c | 112 +++++++++++++--
48 lttng-events.h | 31 ++++-
49 lttng-syscalls.c | 348 +++++++++++++++++++++++++----------------------
50 5 files changed, 380 insertions(+), 180 deletions(-)
51
52diff --git a/lttng-abi.c b/lttng-abi.c
53index 64ea99d..b33879d 100644
54--- a/lttng-abi.c
55+++ b/lttng-abi.c
56@@ -1264,6 +1264,46 @@ nomem:
57 return ret;
58 }
59
60+static
61+int lttng_abi_validate_event_param(struct lttng_kernel_event *event_param)
62+{
63+ /* Limit ABI to implemented features. */
64+ switch (event_param->instrumentation) {
65+ case LTTNG_KERNEL_SYSCALL:
66+ switch (event_param->u.syscall.entryexit) {
67+ case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
68+ break;
69+ default:
70+ return -EINVAL;
71+ }
72+ switch (event_param->u.syscall.abi) {
73+ case LTTNG_KERNEL_SYSCALL_ABI_ALL:
74+ break;
75+ default:
76+ return -EINVAL;
77+ }
78+ switch (event_param->u.syscall.match) {
79+ case LTTNG_SYSCALL_MATCH_NAME:
80+ break;
81+ default:
82+ return -EINVAL;
83+ }
84+ break;
85+
86+ case LTTNG_KERNEL_TRACEPOINT: /* Fallthrough */
87+ case LTTNG_KERNEL_KPROBE: /* Fallthrough */
88+ case LTTNG_KERNEL_KRETPROBE: /* Fallthrough */
89+ case LTTNG_KERNEL_NOOP: /* Fallthrough */
90+ case LTTNG_KERNEL_UPROBE:
91+ break;
92+
93+ case LTTNG_KERNEL_FUNCTION: /* Fallthrough */
94+ default:
95+ return -EINVAL;
96+ }
97+ return 0;
98+}
99+
100 static
101 int lttng_abi_create_event(struct file *channel_file,
102 struct lttng_kernel_event *event_param)
103@@ -1305,6 +1345,9 @@ int lttng_abi_create_event(struct file *channel_file,
104 ret = -EOVERFLOW;
105 goto refcount_error;
106 }
107+ ret = lttng_abi_validate_event_param(event_param);
108+ if (ret)
109+ goto event_error;
110 if (event_param->instrumentation == LTTNG_KERNEL_TRACEPOINT
111 || event_param->instrumentation == LTTNG_KERNEL_SYSCALL) {
112 struct lttng_enabler *enabler;
113diff --git a/lttng-abi.h b/lttng-abi.h
114index 1d356ab..51d60e5 100644
115--- a/lttng-abi.h
116+++ b/lttng-abi.h
117@@ -90,6 +90,31 @@ struct lttng_kernel_event_callsite {
118 } u;
119 } __attribute__((packed));
120
121+enum lttng_kernel_syscall_entryexit {
122+ LTTNG_KERNEL_SYSCALL_ENTRYEXIT = 0,
123+ LTTNG_KERNEL_SYSCALL_ENTRY = 1, /* Not implemented. */
124+ LTTNG_KERNEL_SYSCALL_EXIT = 2, /* Not implemented. */
125+};
126+
127+enum lttng_kernel_syscall_abi {
128+ LTTNG_KERNEL_SYSCALL_ABI_ALL = 0,
129+ LTTNG_KERNEL_SYSCALL_ABI_NATIVE = 1, /* Not implemented. */
130+ LTTNG_KERNEL_SYSCALL_ABI_COMPAT = 2, /* Not implemented. */
131+};
132+
133+enum lttng_kernel_syscall_match {
134+ LTTNG_SYSCALL_MATCH_NAME = 0,
135+ LTTNG_SYSCALL_MATCH_NR = 1, /* Not implemented. */
136+};
137+
138+struct lttng_kernel_syscall {
139+ uint8_t entryexit; /* enum lttng_kernel_syscall_entryexit */
140+ uint8_t abi; /* enum lttng_kernel_syscall_abi */
141+ uint8_t match; /* enum lttng_kernel_syscall_match */
142+ uint8_t padding;
143+ uint32_t nr; /* For LTTNG_SYSCALL_MATCH_NR */
144+} __attribute__((packed));
145+
146 /*
147 * For syscall tracing, name = "*" means "enable all".
148 */
149@@ -106,6 +131,7 @@ struct lttng_kernel_event {
150 struct lttng_kernel_kprobe kprobe;
151 struct lttng_kernel_function_tracer ftrace;
152 struct lttng_kernel_uprobe uprobe;
153+ struct lttng_kernel_syscall syscall;
154 char padding[LTTNG_KERNEL_EVENT_PADDING2];
155 } u;
156 } __attribute__((packed));
157diff --git a/lttng-events.c b/lttng-events.c
158index d719294..4c0b04a 100644
159--- a/lttng-events.c
160+++ b/lttng-events.c
161@@ -201,6 +201,10 @@ void lttng_session_destroy(struct lttng_session *session)
162 WARN_ON(ret);
163 }
164 synchronize_trace(); /* Wait for in-flight events to complete */
165+ list_for_each_entry(chan, &session->chan, list) {
166+ ret = lttng_syscalls_destroy(chan);
167+ WARN_ON(ret);
168+ }
169 list_for_each_entry_safe(enabler, tmpenabler,
170 &session->enablers_head, node)
171 lttng_enabler_destroy(enabler);
172@@ -740,6 +744,28 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
173 event->enabled = 0;
174 event->registered = 0;
175 event->desc = event_desc;
176+ switch (event_param->u.syscall.entryexit) {
177+ case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
178+ ret = -EINVAL;
179+ goto register_error;
180+ case LTTNG_KERNEL_SYSCALL_ENTRY:
181+ event->u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
182+ break;
183+ case LTTNG_KERNEL_SYSCALL_EXIT:
184+ event->u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
185+ break;
186+ }
187+ switch (event_param->u.syscall.abi) {
188+ case LTTNG_KERNEL_SYSCALL_ABI_ALL:
189+ ret = -EINVAL;
190+ goto register_error;
191+ case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
192+ event->u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
193+ break;
194+ case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
195+ event->u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
196+ break;
197+ }
198 if (!event->desc) {
199 ret = -EINVAL;
200 goto register_error;
201@@ -826,8 +852,7 @@ void register_event(struct lttng_event *event)
202 event);
203 break;
204 case LTTNG_KERNEL_SYSCALL:
205- ret = lttng_syscall_filter_enable(event->chan,
206- desc->name);
207+ ret = lttng_syscall_filter_enable(event->chan, event);
208 break;
209 case LTTNG_KERNEL_KPROBE:
210 case LTTNG_KERNEL_UPROBE:
211@@ -870,8 +895,7 @@ int _lttng_event_unregister(struct lttng_event *event)
212 ret = 0;
213 break;
214 case LTTNG_KERNEL_SYSCALL:
215- ret = lttng_syscall_filter_disable(event->chan,
216- desc->name);
217+ ret = lttng_syscall_filter_disable(event->chan, event);
218 break;
219 case LTTNG_KERNEL_NOOP:
220 ret = 0;
221@@ -1203,39 +1227,87 @@ int lttng_desc_match_enabler(const struct lttng_event_desc *desc,
222 struct lttng_enabler *enabler)
223 {
224 const char *desc_name, *enabler_name;
225+ bool compat = false, entry = false;
226
227 enabler_name = enabler->event_param.name;
228 switch (enabler->event_param.instrumentation) {
229 case LTTNG_KERNEL_TRACEPOINT:
230 desc_name = desc->name;
231+ switch (enabler->type) {
232+ case LTTNG_ENABLER_STAR_GLOB:
233+ return lttng_match_enabler_star_glob(desc_name, enabler_name);
234+ case LTTNG_ENABLER_NAME:
235+ return lttng_match_enabler_name(desc_name, enabler_name);
236+ default:
237+ return -EINVAL;
238+ }
239 break;
240 case LTTNG_KERNEL_SYSCALL:
241 desc_name = desc->name;
242- if (!strncmp(desc_name, "compat_", strlen("compat_")))
243+ if (!strncmp(desc_name, "compat_", strlen("compat_"))) {
244 desc_name += strlen("compat_");
245+ compat = true;
246+ }
247 if (!strncmp(desc_name, "syscall_exit_",
248 strlen("syscall_exit_"))) {
249 desc_name += strlen("syscall_exit_");
250 } else if (!strncmp(desc_name, "syscall_entry_",
251 strlen("syscall_entry_"))) {
252 desc_name += strlen("syscall_entry_");
253+ entry = true;
254 } else {
255 WARN_ON_ONCE(1);
256 return -EINVAL;
257 }
258+ switch (enabler->event_param.u.syscall.entryexit) {
259+ case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
260+ break;
261+ case LTTNG_KERNEL_SYSCALL_ENTRY:
262+ if (!entry)
263+ return 0;
264+ break;
265+ case LTTNG_KERNEL_SYSCALL_EXIT:
266+ if (entry)
267+ return 0;
268+ break;
269+ default:
270+ return -EINVAL;
271+ }
272+ switch (enabler->event_param.u.syscall.abi) {
273+ case LTTNG_KERNEL_SYSCALL_ABI_ALL:
274+ break;
275+ case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
276+ if (compat)
277+ return 0;
278+ break;
279+ case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
280+ if (!compat)
281+ return 0;
282+ break;
283+ default:
284+ return -EINVAL;
285+ }
286+ switch (enabler->event_param.u.syscall.match) {
287+ case LTTNG_SYSCALL_MATCH_NAME:
288+ switch (enabler->type) {
289+ case LTTNG_ENABLER_STAR_GLOB:
290+ return lttng_match_enabler_star_glob(desc_name, enabler_name);
291+ case LTTNG_ENABLER_NAME:
292+ return lttng_match_enabler_name(desc_name, enabler_name);
293+ default:
294+ return -EINVAL;
295+ }
296+ break;
297+ case LTTNG_SYSCALL_MATCH_NR:
298+ return -EINVAL; /* Not implemented. */
299+ default:
300+ return -EINVAL;
301+ }
302 break;
303 default:
304 WARN_ON_ONCE(1);
305 return -EINVAL;
306 }
307- switch (enabler->type) {
308- case LTTNG_ENABLER_STAR_GLOB:
309- return lttng_match_enabler_star_glob(desc_name, enabler_name);
310- case LTTNG_ENABLER_NAME:
311- return lttng_match_enabler_name(desc_name, enabler_name);
312- default:
313- return -EINVAL;
314- }
315 }
316
317 static
318@@ -1361,9 +1433,21 @@ void lttng_create_event_if_missing(struct lttng_enabler *enabler)
319 static
320 int lttng_enabler_ref_events(struct lttng_enabler *enabler)
321 {
322- struct lttng_session *session = enabler->chan->session;
323+ struct lttng_channel *chan = enabler->chan;
324+ struct lttng_session *session = chan->session;
325 struct lttng_event *event;
326
327+ if (enabler->event_param.instrumentation == LTTNG_KERNEL_SYSCALL &&
328+ enabler->event_param.u.syscall.entryexit == LTTNG_KERNEL_SYSCALL_ENTRYEXIT &&
329+ enabler->event_param.u.syscall.abi == LTTNG_KERNEL_SYSCALL_ABI_ALL &&
330+ enabler->event_param.u.syscall.match == LTTNG_SYSCALL_MATCH_NAME &&
331+ !strcmp(enabler->event_param.name, "*")) {
332+ if (enabler->enabled)
333+ WRITE_ONCE(chan->syscall_all, 1);
334+ else
335+ WRITE_ONCE(chan->syscall_all, 0);
336+ }
337+
338 /* First ensure that probe events are created for this enabler. */
339 lttng_create_event_if_missing(enabler);
340
341diff --git a/lttng-events.h b/lttng-events.h
342index a36a312..d4d9976 100644
343--- a/lttng-events.h
344+++ b/lttng-events.h
345@@ -292,6 +292,16 @@ struct lttng_uprobe_handler {
346 struct list_head node;
347 };
348
349+enum lttng_syscall_entryexit {
350+ LTTNG_SYSCALL_ENTRY,
351+ LTTNG_SYSCALL_EXIT,
352+};
353+
354+enum lttng_syscall_abi {
355+ LTTNG_SYSCALL_ABI_NATIVE,
356+ LTTNG_SYSCALL_ABI_COMPAT,
357+};
358+
359 /*
360 * lttng_event structure is referred to by the tracing fast path. It must be
361 * kept small.
362@@ -318,6 +328,11 @@ struct lttng_event {
363 struct inode *inode;
364 struct list_head head;
365 } uprobe;
366+ struct {
367+ char *syscall_name;
368+ enum lttng_syscall_entryexit entryexit;
369+ enum lttng_syscall_abi abi;
370+ } syscall;
371 } u;
372 struct list_head list; /* Event list in session */
373 unsigned int metadata_dumped:1;
374@@ -457,10 +472,10 @@ struct lttng_channel {
375 struct lttng_syscall_filter *sc_filter;
376 int header_type; /* 0: unset, 1: compact, 2: large */
377 enum channel_type channel_type;
378+ int syscall_all;
379 unsigned int metadata_dumped:1,
380 sys_enter_registered:1,
381 sys_exit_registered:1,
382- syscall_all:1,
383 tstate:1; /* Transient enable state */
384 };
385
386@@ -653,10 +668,11 @@ void lttng_clock_unref(void);
387 #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
388 int lttng_syscalls_register(struct lttng_channel *chan, void *filter);
389 int lttng_syscalls_unregister(struct lttng_channel *chan);
390+int lttng_syscalls_destroy(struct lttng_channel *chan);
391 int lttng_syscall_filter_enable(struct lttng_channel *chan,
392- const char *name);
393+ struct lttng_event *event);
394 int lttng_syscall_filter_disable(struct lttng_channel *chan,
395- const char *name);
396+ struct lttng_event *event);
397 long lttng_channel_syscall_mask(struct lttng_channel *channel,
398 struct lttng_kernel_syscall_mask __user *usyscall_mask);
399 #else
400@@ -670,14 +686,19 @@ static inline int lttng_syscalls_unregister(struct lttng_channel *chan)
401 return 0;
402 }
403
404+static inline int lttng_syscalls_destroy(struct lttng_channel *chan)
405+{
406+ return 0;
407+}
408+
409 static inline int lttng_syscall_filter_enable(struct lttng_channel *chan,
410- const char *name)
411+ struct lttng_event *event);
412 {
413 return -ENOSYS;
414 }
415
416 static inline int lttng_syscall_filter_disable(struct lttng_channel *chan,
417- const char *name)
418+ struct lttng_event *event);
419 {
420 return -ENOSYS;
421 }
422diff --git a/lttng-syscalls.c b/lttng-syscalls.c
423index 97f1ba9..26cead6 100644
424--- a/lttng-syscalls.c
425+++ b/lttng-syscalls.c
426@@ -367,8 +367,10 @@ const struct trace_syscall_entry compat_sc_exit_table[] = {
427 #undef CREATE_SYSCALL_TABLE
428
429 struct lttng_syscall_filter {
430- DECLARE_BITMAP(sc, NR_syscalls);
431- DECLARE_BITMAP(sc_compat, NR_compat_syscalls);
432+ DECLARE_BITMAP(sc_entry, NR_syscalls);
433+ DECLARE_BITMAP(sc_exit, NR_syscalls);
434+ DECLARE_BITMAP(sc_compat_entry, NR_compat_syscalls);
435+ DECLARE_BITMAP(sc_compat_exit, NR_compat_syscalls);
436 };
437
438 static void syscall_entry_unknown(struct lttng_event *event,
439@@ -391,29 +393,23 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
440 size_t table_len;
441
442 if (unlikely(in_compat_syscall())) {
443- struct lttng_syscall_filter *filter;
444-
445- filter = lttng_rcu_dereference(chan->sc_filter);
446- if (filter) {
447- if (id < 0 || id >= NR_compat_syscalls
448- || !test_bit(id, filter->sc_compat)) {
449- /* System call filtered out. */
450- return;
451- }
452+ struct lttng_syscall_filter *filter = chan->sc_filter;
453+
454+ if (id < 0 || id >= NR_compat_syscalls
455+ || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_entry))) {
456+ /* System call filtered out. */
457+ return;
458 }
459 table = compat_sc_table;
460 table_len = ARRAY_SIZE(compat_sc_table);
461 unknown_event = chan->sc_compat_unknown;
462 } else {
463- struct lttng_syscall_filter *filter;
464-
465- filter = lttng_rcu_dereference(chan->sc_filter);
466- if (filter) {
467- if (id < 0 || id >= NR_syscalls
468- || !test_bit(id, filter->sc)) {
469- /* System call filtered out. */
470- return;
471- }
472+ struct lttng_syscall_filter *filter = chan->sc_filter;
473+
474+ if (id < 0 || id >= NR_syscalls
475+ || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_entry))) {
476+ /* System call filtered out. */
477+ return;
478 }
479 table = sc_table;
480 table_len = ARRAY_SIZE(sc_table);
481@@ -545,29 +541,23 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
482
483 id = syscall_get_nr(current, regs);
484 if (unlikely(in_compat_syscall())) {
485- struct lttng_syscall_filter *filter;
486-
487- filter = lttng_rcu_dereference(chan->sc_filter);
488- if (filter) {
489- if (id < 0 || id >= NR_compat_syscalls
490- || !test_bit(id, filter->sc_compat)) {
491- /* System call filtered out. */
492- return;
493- }
494+ struct lttng_syscall_filter *filter = chan->sc_filter;
495+
496+ if (id < 0 || id >= NR_compat_syscalls
497+ || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_exit))) {
498+ /* System call filtered out. */
499+ return;
500 }
501 table = compat_sc_exit_table;
502 table_len = ARRAY_SIZE(compat_sc_exit_table);
503 unknown_event = chan->compat_sc_exit_unknown;
504 } else {
505- struct lttng_syscall_filter *filter;
506-
507- filter = lttng_rcu_dereference(chan->sc_filter);
508- if (filter) {
509- if (id < 0 || id >= NR_syscalls
510- || !test_bit(id, filter->sc)) {
511- /* System call filtered out. */
512- return;
513- }
514+ struct lttng_syscall_filter *filter = chan->sc_filter;
515+
516+ if (id < 0 || id >= NR_syscalls
517+ || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_exit))) {
518+ /* System call filtered out. */
519+ return;
520 }
521 table = sc_exit_table;
522 table_len = ARRAY_SIZE(sc_exit_table);
523@@ -713,27 +703,23 @@ int fill_table(const struct trace_syscall_entry *table, size_t table_len,
524 memset(&ev, 0, sizeof(ev));
525 switch (type) {
526 case SC_TYPE_ENTRY:
527- strncpy(ev.name, SYSCALL_ENTRY_STR,
528- LTTNG_KERNEL_SYM_NAME_LEN);
529+ ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
530+ ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
531 break;
532 case SC_TYPE_EXIT:
533- strncpy(ev.name, SYSCALL_EXIT_STR,
534- LTTNG_KERNEL_SYM_NAME_LEN);
535+ ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
536+ ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
537 break;
538 case SC_TYPE_COMPAT_ENTRY:
539- strncpy(ev.name, COMPAT_SYSCALL_ENTRY_STR,
540- LTTNG_KERNEL_SYM_NAME_LEN);
541+ ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
542+ ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
543 break;
544 case SC_TYPE_COMPAT_EXIT:
545- strncpy(ev.name, COMPAT_SYSCALL_EXIT_STR,
546- LTTNG_KERNEL_SYM_NAME_LEN);
547- break;
548- default:
549- BUG_ON(1);
550+ ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
551+ ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
552 break;
553 }
554- strncat(ev.name, desc->name,
555- LTTNG_KERNEL_SYM_NAME_LEN - strlen(ev.name) - 1);
556+ strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
557 ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
558 ev.instrumentation = LTTNG_KERNEL_SYSCALL;
559 chan_table[i] = _lttng_event_create(chan, &ev, filter,
560@@ -803,6 +789,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
561 strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
562 ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
563 ev.instrumentation = LTTNG_KERNEL_SYSCALL;
564+ ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
565+ ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
566 chan->sc_unknown = _lttng_event_create(chan, &ev, filter,
567 desc,
568 ev.instrumentation);
569@@ -820,6 +808,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
570 strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
571 ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
572 ev.instrumentation = LTTNG_KERNEL_SYSCALL;
573+ ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
574+ ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
575 chan->sc_compat_unknown = _lttng_event_create(chan, &ev, filter,
576 desc,
577 ev.instrumentation);
578@@ -837,6 +827,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
579 strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
580 ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
581 ev.instrumentation = LTTNG_KERNEL_SYSCALL;
582+ ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
583+ ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
584 chan->compat_sc_exit_unknown = _lttng_event_create(chan, &ev,
585 filter, desc,
586 ev.instrumentation);
587@@ -854,6 +846,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
588 strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
589 ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
590 ev.instrumentation = LTTNG_KERNEL_SYSCALL;
591+ ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
592+ ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
593 chan->sc_exit_unknown = _lttng_event_create(chan, &ev, filter,
594 desc, ev.instrumentation);
595 WARN_ON_ONCE(!chan->sc_exit_unknown);
596@@ -883,6 +877,14 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
597 if (ret)
598 return ret;
599 #endif
600+
601+ if (!chan->sc_filter) {
602+ chan->sc_filter = kzalloc(sizeof(struct lttng_syscall_filter),
603+ GFP_KERNEL);
604+ if (!chan->sc_filter)
605+ return -ENOMEM;
606+ }
607+
608 if (!chan->sys_enter_registered) {
609 ret = lttng_wrapper_tracepoint_probe_register("sys_enter",
610 (void *) syscall_entry_probe, chan);
611@@ -930,7 +932,11 @@ int lttng_syscalls_unregister(struct lttng_channel *chan)
612 return ret;
613 chan->sys_exit_registered = 0;
614 }
615- /* lttng_event destroy will be performed by lttng_session_destroy() */
616+ return 0;
617+}
618+
619+int lttng_syscalls_destroy(struct lttng_channel *chan)
620+{
621 kfree(chan->sc_table);
622 kfree(chan->sc_exit_table);
623 #ifdef CONFIG_COMPAT
624@@ -993,136 +999,150 @@ uint32_t get_sc_tables_len(void)
625 return ARRAY_SIZE(sc_table) + ARRAY_SIZE(compat_sc_table);
626 }
627
628-int lttng_syscall_filter_enable(struct lttng_channel *chan,
629- const char *name)
630+static
631+const char *get_syscall_name(struct lttng_event *event)
632 {
633- int syscall_nr, compat_syscall_nr, ret;
634- struct lttng_syscall_filter *filter;
635+ size_t prefix_len = 0;
636
637- WARN_ON_ONCE(!chan->sc_table);
638+ WARN_ON_ONCE(event->instrumentation != LTTNG_KERNEL_SYSCALL);
639
640- if (!name) {
641- /* Enable all system calls by removing filter */
642- if (chan->sc_filter) {
643- filter = chan->sc_filter;
644- rcu_assign_pointer(chan->sc_filter, NULL);
645- synchronize_trace();
646- kfree(filter);
647+ switch (event->u.syscall.entryexit) {
648+ case LTTNG_SYSCALL_ENTRY:
649+ switch (event->u.syscall.abi) {
650+ case LTTNG_SYSCALL_ABI_NATIVE:
651+ prefix_len = strlen(SYSCALL_ENTRY_STR);
652+ break;
653+ case LTTNG_SYSCALL_ABI_COMPAT:
654+ prefix_len = strlen(COMPAT_SYSCALL_ENTRY_STR);
655+ break;
656 }
657- chan->syscall_all = 1;
658- return 0;
659- }
660-
661- if (!chan->sc_filter) {
662- if (chan->syscall_all) {
663- /*
664- * All syscalls are already enabled.
665- */
666- return -EEXIST;
667+ break;
668+ case LTTNG_SYSCALL_EXIT:
669+ switch (event->u.syscall.abi) {
670+ case LTTNG_SYSCALL_ABI_NATIVE:
671+ prefix_len = strlen(SYSCALL_EXIT_STR);
672+ break;
673+ case LTTNG_SYSCALL_ABI_COMPAT:
674+ prefix_len = strlen(COMPAT_SYSCALL_EXIT_STR);
675+ break;
676 }
677- filter = kzalloc(sizeof(struct lttng_syscall_filter),
678- GFP_KERNEL);
679- if (!filter)
680- return -ENOMEM;
681- } else {
682- filter = chan->sc_filter;
683+ break;
684 }
685- syscall_nr = get_syscall_nr(name);
686- compat_syscall_nr = get_compat_syscall_nr(name);
687- if (syscall_nr < 0 && compat_syscall_nr < 0) {
688- ret = -ENOENT;
689- goto error;
690+ WARN_ON_ONCE(prefix_len == 0);
691+ return event->desc->name + prefix_len;
692+}
693+
694+int lttng_syscall_filter_enable(struct lttng_channel *chan,
695+ struct lttng_event *event)
696+{
697+ struct lttng_syscall_filter *filter = chan->sc_filter;
698+ const char *syscall_name;
699+ unsigned long *bitmap;
700+ int syscall_nr;
701+
702+ WARN_ON_ONCE(!chan->sc_table);
703+
704+ syscall_name = get_syscall_name(event);
705+
706+ switch (event->u.syscall.abi) {
707+ case LTTNG_SYSCALL_ABI_NATIVE:
708+ syscall_nr = get_syscall_nr(syscall_name);
709+ break;
710+ case LTTNG_SYSCALL_ABI_COMPAT:
711+ syscall_nr = get_compat_syscall_nr(syscall_name);
712+ break;
713+ default:
714+ return -EINVAL;
715 }
716- if (syscall_nr >= 0) {
717- if (test_bit(syscall_nr, filter->sc)) {
718- ret = -EEXIST;
719- goto error;
720+ if (syscall_nr < 0)
721+ return -ENOENT;
722+
723+
724+ switch (event->u.syscall.entryexit) {
725+ case LTTNG_SYSCALL_ENTRY:
726+ switch (event->u.syscall.abi) {
727+ case LTTNG_SYSCALL_ABI_NATIVE:
728+ bitmap = filter->sc_entry;
729+ break;
730+ case LTTNG_SYSCALL_ABI_COMPAT:
731+ bitmap = filter->sc_compat_entry;
732+ break;
733 }
734- bitmap_set(filter->sc, syscall_nr, 1);
735- }
736- if (compat_syscall_nr >= 0) {
737- if (test_bit(compat_syscall_nr, filter->sc_compat)) {
738- ret = -EEXIST;
739- goto error;
740+ break;
741+ case LTTNG_SYSCALL_EXIT:
742+ switch (event->u.syscall.abi) {
743+ case LTTNG_SYSCALL_ABI_NATIVE:
744+ bitmap = filter->sc_exit;
745+ break;
746+ case LTTNG_SYSCALL_ABI_COMPAT:
747+ bitmap = filter->sc_compat_exit;
748+ break;
749 }
750- bitmap_set(filter->sc_compat, compat_syscall_nr, 1);
751+ break;
752+ default:
753+ return -EINVAL;
754 }
755- if (!chan->sc_filter)
756- rcu_assign_pointer(chan->sc_filter, filter);
757+ if (test_bit(syscall_nr, bitmap))
758+ return -EEXIST;
759+ bitmap_set(bitmap, syscall_nr, 1);
760 return 0;
761-
762-error:
763- if (!chan->sc_filter)
764- kfree(filter);
765- return ret;
766 }
767
768 int lttng_syscall_filter_disable(struct lttng_channel *chan,
769- const char *name)
770+ struct lttng_event *event)
771 {
772- int syscall_nr, compat_syscall_nr, ret;
773- struct lttng_syscall_filter *filter;
774+ struct lttng_syscall_filter *filter = chan->sc_filter;
775+ const char *syscall_name;
776+ unsigned long *bitmap;
777+ int syscall_nr;
778
779 WARN_ON_ONCE(!chan->sc_table);
780
781- if (!chan->sc_filter) {
782- if (!chan->syscall_all)
783- return -EEXIST;
784- filter = kzalloc(sizeof(struct lttng_syscall_filter),
785- GFP_KERNEL);
786- if (!filter)
787- return -ENOMEM;
788- /* Trace all system calls, then apply disable. */
789- bitmap_set(filter->sc, 0, NR_syscalls);
790- bitmap_set(filter->sc_compat, 0, NR_compat_syscalls);
791- } else {
792- filter = chan->sc_filter;
793+ syscall_name = get_syscall_name(event);
794+
795+ switch (event->u.syscall.abi) {
796+ case LTTNG_SYSCALL_ABI_NATIVE:
797+ syscall_nr = get_syscall_nr(syscall_name);
798+ break;
799+ case LTTNG_SYSCALL_ABI_COMPAT:
800+ syscall_nr = get_compat_syscall_nr(syscall_name);
801+ break;
802+ default:
803+ return -EINVAL;
804 }
805+ if (syscall_nr < 0)
806+ return -ENOENT;
807
808- if (!name) {
809- /* Fail if all syscalls are already disabled. */
810- if (bitmap_empty(filter->sc, NR_syscalls)
811- && bitmap_empty(filter->sc_compat,
812- NR_compat_syscalls)) {
813- ret = -EEXIST;
814- goto error;
815- }
816
817- /* Disable all system calls */
818- bitmap_clear(filter->sc, 0, NR_syscalls);
819- bitmap_clear(filter->sc_compat, 0, NR_compat_syscalls);
820- goto apply_filter;
821- }
822- syscall_nr = get_syscall_nr(name);
823- compat_syscall_nr = get_compat_syscall_nr(name);
824- if (syscall_nr < 0 && compat_syscall_nr < 0) {
825- ret = -ENOENT;
826- goto error;
827- }
828- if (syscall_nr >= 0) {
829- if (!test_bit(syscall_nr, filter->sc)) {
830- ret = -EEXIST;
831- goto error;
832+ switch (event->u.syscall.entryexit) {
833+ case LTTNG_SYSCALL_ENTRY:
834+ switch (event->u.syscall.abi) {
835+ case LTTNG_SYSCALL_ABI_NATIVE:
836+ bitmap = filter->sc_entry;
837+ break;
838+ case LTTNG_SYSCALL_ABI_COMPAT:
839+ bitmap = filter->sc_compat_entry;
840+ break;
841 }
842- bitmap_clear(filter->sc, syscall_nr, 1);
843- }
844- if (compat_syscall_nr >= 0) {
845- if (!test_bit(compat_syscall_nr, filter->sc_compat)) {
846- ret = -EEXIST;
847- goto error;
848+ break;
849+ case LTTNG_SYSCALL_EXIT:
850+ switch (event->u.syscall.abi) {
851+ case LTTNG_SYSCALL_ABI_NATIVE:
852+ bitmap = filter->sc_exit;
853+ break;
854+ case LTTNG_SYSCALL_ABI_COMPAT:
855+ bitmap = filter->sc_compat_exit;
856+ break;
857 }
858- bitmap_clear(filter->sc_compat, compat_syscall_nr, 1);
859+ break;
860+ default:
861+ return -EINVAL;
862 }
863-apply_filter:
864- if (!chan->sc_filter)
865- rcu_assign_pointer(chan->sc_filter, filter);
866- chan->syscall_all = 0;
867- return 0;
868+ if (!test_bit(syscall_nr, bitmap))
869+ return -EEXIST;
870+ bitmap_clear(bitmap, syscall_nr, 1);
871
872-error:
873- if (!chan->sc_filter)
874- kfree(filter);
875- return ret;
876+ return 0;
877 }
878
879 static
880@@ -1236,6 +1256,9 @@ const struct file_operations lttng_syscall_list_fops = {
881 .release = seq_release,
882 };
883
884+/*
885+ * A syscall is enabled if it is traced for either entry or exit.
886+ */
887 long lttng_channel_syscall_mask(struct lttng_channel *channel,
888 struct lttng_kernel_syscall_mask __user *usyscall_mask)
889 {
890@@ -1262,8 +1285,9 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
891 char state;
892
893 if (channel->sc_table) {
894- if (filter)
895- state = test_bit(bit, filter->sc);
896+ if (!READ_ONCE(channel->syscall_all) && filter)
897+ state = test_bit(bit, filter->sc_entry)
898+ || test_bit(bit, filter->sc_exit);
899 else
900 state = 1;
901 } else {
902@@ -1275,9 +1299,11 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
903 char state;
904
905 if (channel->compat_sc_table) {
906- if (filter)
907+ if (!READ_ONCE(channel->syscall_all) && filter)
908 state = test_bit(bit - ARRAY_SIZE(sc_table),
909- filter->sc_compat);
910+ filter->sc_compat_entry)
911+ || test_bit(bit - ARRAY_SIZE(sc_table),
912+ filter->sc_compat_exit);
913 else
914 state = 1;
915 } else {
916--
9172.19.1
918
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0010-fix-ext4-fast-commit-recovery-path-v5.10.patch b/meta/recipes-kernel/lttng/lttng-modules/0010-fix-ext4-fast-commit-recovery-path-v5.10.patch
new file mode 100644
index 0000000000..fb00a44b31
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0010-fix-ext4-fast-commit-recovery-path-v5.10.patch
@@ -0,0 +1,99 @@
1From a28235f8ffa3c961640a835686dddb5ca600dfaf Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 26 Oct 2020 17:03:23 -0400
4Subject: [PATCH 10/19] fix: ext4: fast commit recovery path (v5.10)
5
6See upstream commit :
7
8 commit 8016e29f4362e285f0f7e38fadc61a5b7bdfdfa2
9 Author: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
10 Date: Thu Oct 15 13:37:59 2020 -0700
11
12 ext4: fast commit recovery path
13
14 This patch adds fast commit recovery path support for Ext4 file
15 system. We add several helper functions that are similar in spirit to
16 e2fsprogs journal recovery path handlers. Example of such functions
17 include - a simple block allocator, idempotent block bitmap update
18 function etc. Using these routines and the fast commit log in the fast
19 commit area, the recovery path (ext4_fc_replay()) performs fast commit
20 log recovery.
21
22Upstream-Status: Backport
23
24Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
25Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
26Change-Id: Ia65cf44e108f2df0b458f0d335f33a8f18f50baa
27---
28 instrumentation/events/lttng-module/ext4.h | 41 ++++++++++++++++++++++
29 1 file changed, 41 insertions(+)
30
31diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
32index b172c8d9..6e74abad 100644
33--- a/instrumentation/events/lttng-module/ext4.h
34+++ b/instrumentation/events/lttng-module/ext4.h
35@@ -1274,6 +1274,18 @@ LTTNG_TRACEPOINT_EVENT(ext4_ext_load_extent,
36 )
37 )
38
39+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
40+LTTNG_TRACEPOINT_EVENT(ext4_load_inode,
41+ TP_PROTO(struct super_block *sb, unsigned long ino),
42+
43+ TP_ARGS(sb, ino),
44+
45+ TP_FIELDS(
46+ ctf_integer(dev_t, dev, sb->s_dev)
47+ ctf_integer(ino_t, ino, ino)
48+ )
49+)
50+#else
51 LTTNG_TRACEPOINT_EVENT(ext4_load_inode,
52 TP_PROTO(struct inode *inode),
53
54@@ -1284,6 +1296,7 @@ LTTNG_TRACEPOINT_EVENT(ext4_load_inode,
55 ctf_integer(ino_t, ino, inode->i_ino)
56 )
57 )
58+#endif
59
60 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
61
62@@ -1895,6 +1908,34 @@ LTTNG_TRACEPOINT_EVENT(ext4_es_shrink_exit,
63
64 #endif
65
66+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
67+LTTNG_TRACEPOINT_EVENT(ext4_fc_replay_scan,
68+ TP_PROTO(struct super_block *sb, int error, int off),
69+
70+ TP_ARGS(sb, error, off),
71+
72+ TP_FIELDS(
73+ ctf_integer(dev_t, dev, sb->s_dev)
74+ ctf_integer(int, error, error)
75+ ctf_integer(int, off, off)
76+ )
77+)
78+
79+LTTNG_TRACEPOINT_EVENT(ext4_fc_replay,
80+ TP_PROTO(struct super_block *sb, int tag, int ino, int priv1, int priv2),
81+
82+ TP_ARGS(sb, tag, ino, priv1, priv2),
83+
84+ TP_FIELDS(
85+ ctf_integer(dev_t, dev, sb->s_dev)
86+ ctf_integer(int, tag, tag)
87+ ctf_integer(int, ino, ino)
88+ ctf_integer(int, priv1, priv1)
89+ ctf_integer(int, priv2, priv2)
90+ )
91+)
92+#endif
93+
94 #endif /* LTTNG_TRACE_EXT4_H */
95
96 /* This part must be outside protection */
97--
982.19.1
99
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0012-fix-kvm-x86-mmu-Add-TDP-MMU-PF-handler-v5.10.patch b/meta/recipes-kernel/lttng/lttng-modules/0012-fix-kvm-x86-mmu-Add-TDP-MMU-PF-handler-v5.10.patch
new file mode 100644
index 0000000000..8651bded99
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0012-fix-kvm-x86-mmu-Add-TDP-MMU-PF-handler-v5.10.patch
@@ -0,0 +1,82 @@
1From e30866f96b3ab02639f429e4bd34e59b3a336579 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 26 Oct 2020 14:28:35 -0400
4Subject: [PATCH 12/19] fix: kvm: x86/mmu: Add TDP MMU PF handler (v5.10)
5
6See upstream commit :
7
8 commit bb18842e21111a979e2e0e1c5d85c09646f18d51
9 Author: Ben Gardon <bgardon@google.com>
10 Date: Wed Oct 14 11:26:50 2020 -0700
11
12 kvm: x86/mmu: Add TDP MMU PF handler
13
14 Add functions to handle page faults in the TDP MMU. These page faults
15 are currently handled in much the same way as the x86 shadow paging
16 based MMU, however the ordering of some operations is slightly
17 different. Future patches will add eager NX splitting, a fast page fault
18 handler, and parallel page faults.
19
20 Tested by running kvm-unit-tests and KVM selftests on an Intel Haswell
21 machine. This series introduced no new failures.
22
23Upstream-Status: Backport
24
25Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
26Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
27Change-Id: Ie56959cb6c77913d2f1188b0ca15da9114623a4e
28---
29 .../lttng-module/arch/x86/kvm/mmutrace.h | 20 ++++++++++++++++++-
30 probes/lttng-probe-kvm-x86-mmu.c | 5 +++++
31 2 files changed, 24 insertions(+), 1 deletion(-)
32
33diff --git a/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h b/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h
34index e5470400..86717835 100644
35--- a/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h
36+++ b/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h
37@@ -163,7 +163,25 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_mmu_page_class, kvm_mmu_prepare_zap_page,
38 TP_ARGS(sp)
39 )
40
41-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
42+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
43+
44+LTTNG_TRACEPOINT_EVENT_MAP(
45+ mark_mmio_spte,
46+
47+ kvm_mmu_mark_mmio_spte,
48+
49+ TP_PROTO(u64 *sptep, gfn_t gfn, u64 spte),
50+ TP_ARGS(sptep, gfn, spte),
51+
52+ TP_FIELDS(
53+ ctf_integer_hex(void *, sptep, sptep)
54+ ctf_integer(gfn_t, gfn, gfn)
55+ ctf_integer(unsigned, access, spte & ACC_ALL)
56+ ctf_integer(unsigned int, gen, get_mmio_spte_generation(spte))
57+ )
58+)
59+
60+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
61
62 LTTNG_TRACEPOINT_EVENT_MAP(
63 mark_mmio_spte,
64diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
65index 8f981865..5043c776 100644
66--- a/probes/lttng-probe-kvm-x86-mmu.c
67+++ b/probes/lttng-probe-kvm-x86-mmu.c
68@@ -31,6 +31,11 @@
69 #include <../../arch/x86/kvm/mmutrace.h>
70 #endif
71
72+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
73+#include <../arch/x86/kvm/mmu.h>
74+#include <../arch/x86/kvm/mmu/spte.h>
75+#endif
76+
77 #undef TRACE_INCLUDE_PATH
78 #undef TRACE_INCLUDE_FILE
79
80--
812.19.1
82
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0014-fix-tracepoint-Optimize-using-static_call-v5.10.patch b/meta/recipes-kernel/lttng/lttng-modules/0014-fix-tracepoint-Optimize-using-static_call-v5.10.patch
new file mode 100644
index 0000000000..5892a408b3
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0014-fix-tracepoint-Optimize-using-static_call-v5.10.patch
@@ -0,0 +1,196 @@
1From bb346792c2cb6995ffc08d2084121935c6384865 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 26 Oct 2020 17:09:05 -0400
4Subject: [PATCH 14/19] fix: tracepoint: Optimize using static_call() (v5.10)
5
6See upstream commit :
7
8 commit d25e37d89dd2f41d7acae0429039d2f0ae8b4a07
9 Author: Steven Rostedt (VMware) <rostedt@goodmis.org>
10 Date: Tue Aug 18 15:57:52 2020 +0200
11
12 tracepoint: Optimize using static_call()
13
14 Currently the tracepoint site will iterate a vector and issue indirect
15 calls to however many handlers are registered (ie. the vector is
16 long).
17
18 Using static_call() it is possible to optimize this for the common
19 case of only having a single handler registered. In this case the
20 static_call() can directly call this handler. Otherwise, if the vector
21 is longer than 1, call a function that iterates the whole vector like
22 the current code.
23
24Upstream-Status: Backport
25
26Change-Id: I739dd84d62cc1a821b8bd8acff74fa29aa25d22f
27Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
28Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
29---
30 lttng-statedump-impl.c | 80 +++++++++++++++++++++++++++++++--------
31 probes/lttng.c | 7 +++-
32 tests/probes/lttng-test.c | 7 +++-
33 wrapper/tracepoint.h | 8 ++++
34 4 files changed, 84 insertions(+), 18 deletions(-)
35
36diff --git a/lttng-statedump-impl.c b/lttng-statedump-impl.c
37index a6fa71a5..67ecd33c 100644
38--- a/lttng-statedump-impl.c
39+++ b/lttng-statedump-impl.c
40@@ -55,26 +55,76 @@
41 #define LTTNG_INSTRUMENTATION
42 #include <instrumentation/events/lttng-module/lttng-statedump.h>
43
44-DEFINE_TRACE(lttng_statedump_block_device);
45-DEFINE_TRACE(lttng_statedump_end);
46-DEFINE_TRACE(lttng_statedump_interrupt);
47-DEFINE_TRACE(lttng_statedump_file_descriptor);
48-DEFINE_TRACE(lttng_statedump_start);
49-DEFINE_TRACE(lttng_statedump_process_state);
50-DEFINE_TRACE(lttng_statedump_process_pid_ns);
51+LTTNG_DEFINE_TRACE(lttng_statedump_block_device,
52+ TP_PROTO(struct lttng_session *session,
53+ dev_t dev, const char *diskname),
54+ TP_ARGS(session, dev, diskname));
55+
56+LTTNG_DEFINE_TRACE(lttng_statedump_end,
57+ TP_PROTO(struct lttng_session *session),
58+ TP_ARGS(session));
59+
60+LTTNG_DEFINE_TRACE(lttng_statedump_interrupt,
61+ TP_PROTO(struct lttng_session *session,
62+ unsigned int irq, const char *chip_name,
63+ struct irqaction *action),
64+ TP_ARGS(session, irq, chip_name, action));
65+
66+LTTNG_DEFINE_TRACE(lttng_statedump_file_descriptor,
67+ TP_PROTO(struct lttng_session *session,
68+ struct files_struct *files,
69+ int fd, const char *filename,
70+ unsigned int flags, fmode_t fmode),
71+ TP_ARGS(session, files, fd, filename, flags, fmode));
72+
73+LTTNG_DEFINE_TRACE(lttng_statedump_start,
74+ TP_PROTO(struct lttng_session *session),
75+ TP_ARGS(session));
76+
77+LTTNG_DEFINE_TRACE(lttng_statedump_process_state,
78+ TP_PROTO(struct lttng_session *session,
79+ struct task_struct *p,
80+ int type, int mode, int submode, int status,
81+ struct files_struct *files),
82+ TP_ARGS(session, p, type, mode, submode, status, files));
83+
84+LTTNG_DEFINE_TRACE(lttng_statedump_process_pid_ns,
85+ TP_PROTO(struct lttng_session *session,
86+ struct task_struct *p,
87+ struct pid_namespace *pid_ns),
88+ TP_ARGS(session, p, pid_ns));
89+
90 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0))
91-DEFINE_TRACE(lttng_statedump_process_cgroup_ns);
92+LTTNG_DEFINE_TRACE(lttng_statedump_process_cgroup_ns,
93+ TP_PROTO(struct lttng_session *session,
94+ struct task_struct *p,
95+ struct cgroup_namespace *cgroup_ns),
96+ TP_ARGS(session, p, cgroup_ns));
97 #endif
98-DEFINE_TRACE(lttng_statedump_process_ipc_ns);
99+
100+LTTNG_DEFINE_TRACE(lttng_statedump_process_ipc_ns,
101+ TP_PROTO(struct lttng_session *session,
102+ struct task_struct *p,
103+ struct ipc_namespace *ipc_ns),
104+ TP_ARGS(session, p, ipc_ns));
105+
106 #ifndef LTTNG_MNT_NS_MISSING_HEADER
107-DEFINE_TRACE(lttng_statedump_process_mnt_ns);
108+LTTNG_DEFINE_TRACE(lttng_statedump_process_mnt_ns,
109+ TP_PROTO(struct lttng_session *session,
110+ struct task_struct *p,
111+ struct mnt_namespace *mnt_ns),
112+ TP_ARGS(session, p, mnt_ns));
113 #endif
114-DEFINE_TRACE(lttng_statedump_process_net_ns);
115-DEFINE_TRACE(lttng_statedump_process_user_ns);
116-DEFINE_TRACE(lttng_statedump_process_uts_ns);
117-DEFINE_TRACE(lttng_statedump_network_interface);
118+
119+LTTNG_DEFINE_TRACE(lttng_statedump_network_interface,
120+ TP_PROTO(struct lttng_session *session,
121+ struct net_device *dev, struct in_ifaddr *ifa),
122+ TP_ARGS(session, dev, ifa));
123+
124 #ifdef LTTNG_HAVE_STATEDUMP_CPU_TOPOLOGY
125-DEFINE_TRACE(lttng_statedump_cpu_topology);
126+LTTNG_DEFINE_TRACE(lttng_statedump_cpu_topology,
127+ TP_PROTO(struct lttng_session *session, struct cpuinfo_x86 *c),
128+ TP_ARGS(session, c));
129 #endif
130
131 struct lttng_fd_ctx {
132diff --git a/probes/lttng.c b/probes/lttng.c
133index 05bc1388..7ddaa69f 100644
134--- a/probes/lttng.c
135+++ b/probes/lttng.c
136@@ -8,7 +8,7 @@
137 */
138
139 #include <linux/module.h>
140-#include <linux/tracepoint.h>
141+#include <wrapper/tracepoint.h>
142 #include <linux/uaccess.h>
143 #include <linux/gfp.h>
144 #include <linux/fs.h>
145@@ -32,7 +32,10 @@
146 #define LTTNG_LOGGER_COUNT_MAX 1024
147 #define LTTNG_LOGGER_FILE "lttng-logger"
148
149-DEFINE_TRACE(lttng_logger);
150+LTTNG_DEFINE_TRACE(lttng_logger,
151+ PARAMS(const char __user *text, size_t len),
152+ PARAMS(text, len)
153+);
154
155 static struct proc_dir_entry *lttng_logger_dentry;
156
157diff --git a/tests/probes/lttng-test.c b/tests/probes/lttng-test.c
158index b450e7d7..a4fa0645 100644
159--- a/tests/probes/lttng-test.c
160+++ b/tests/probes/lttng-test.c
161@@ -25,7 +25,12 @@
162 #define LTTNG_INSTRUMENTATION
163 #include <instrumentation/events/lttng-module/lttng-test.h>
164
165-DEFINE_TRACE(lttng_test_filter_event);
166+LTTNG_DEFINE_TRACE(lttng_test_filter_event,
167+ PARAMS(int anint, int netint, long *values,
168+ char *text, size_t textlen,
169+ char *etext, uint32_t * net_values),
170+ PARAMS(anint, netint, values, text, textlen, etext, net_values)
171+);
172
173 #define LTTNG_TEST_FILTER_EVENT_FILE "lttng-test-filter-event"
174
175diff --git a/wrapper/tracepoint.h b/wrapper/tracepoint.h
176index c4ba0123..bc19d8c1 100644
177--- a/wrapper/tracepoint.h
178+++ b/wrapper/tracepoint.h
179@@ -14,6 +14,14 @@
180 #include <linux/tracepoint.h>
181 #include <linux/module.h>
182
183+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
184+#define LTTNG_DEFINE_TRACE(name, proto, args) \
185+ DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
186+#else
187+#define LTTNG_DEFINE_TRACE(name, proto, args) \
188+ DEFINE_TRACE(name)
189+#endif
190+
191 #ifndef HAVE_KABI_2635_TRACEPOINT
192
193 #define kabi_2635_tracepoint_probe_register tracepoint_probe_register
194--
1952.19.1
196
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0016-fix-statedump-undefined-symbols-caused-by-incorrect-.patch b/meta/recipes-kernel/lttng/lttng-modules/0016-fix-statedump-undefined-symbols-caused-by-incorrect-.patch
new file mode 100644
index 0000000000..e848e16f59
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0016-fix-statedump-undefined-symbols-caused-by-incorrect-.patch
@@ -0,0 +1,55 @@
1From 31f8bf794172102e9758928b481856c4a8800a7f Mon Sep 17 00:00:00 2001
2From: He Zhe <zhe.he@windriver.com>
3Date: Mon, 23 Nov 2020 18:14:25 +0800
4Subject: [PATCH 16/19] fix: statedump: undefined symbols caused by incorrect
5 patch backport
6
7bb346792c2cb ("fix: tracepoint: Optimize using static_call() (v5.10)")
8misses three definitions and causes the following build failures.
9
10ERROR: "__tracepoint_lttng_statedump_process_net_ns" [lttng-statedump.ko] undefined!
11ERROR: "__tracepoint_lttng_statedump_process_user_ns" [lttng-statedump.ko] undefined!
12ERROR: "__tracepoint_lttng_statedump_process_uts_ns" [lttng-statedump.ko] undefined!
13
14Fixes: #1290
15
16Upstream-Status: Backport
17
18Signed-off-by: He Zhe <zhe.he@windriver.com>
19Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
20---
21 lttng-statedump-impl.c | 18 ++++++++++++++++++
22 1 file changed, 18 insertions(+)
23
24diff --git a/lttng-statedump-impl.c b/lttng-statedump-impl.c
25index 67ecd33c..cf803a73 100644
26--- a/lttng-statedump-impl.c
27+++ b/lttng-statedump-impl.c
28@@ -116,6 +116,24 @@ LTTNG_DEFINE_TRACE(lttng_statedump_process_mnt_ns,
29 TP_ARGS(session, p, mnt_ns));
30 #endif
31
32+LTTNG_DEFINE_TRACE(lttng_statedump_process_net_ns,
33+ TP_PROTO(struct lttng_session *session,
34+ struct task_struct *p,
35+ struct net *net_ns),
36+ TP_ARGS(session, p, net_ns));
37+
38+LTTNG_DEFINE_TRACE(lttng_statedump_process_user_ns,
39+ TP_PROTO(struct lttng_session *session,
40+ struct task_struct *p,
41+ struct user_namespace *user_ns),
42+ TP_ARGS(session, p, user_ns));
43+
44+LTTNG_DEFINE_TRACE(lttng_statedump_process_uts_ns,
45+ TP_PROTO(struct lttng_session *session,
46+ struct task_struct *p,
47+ struct uts_namespace *uts_ns),
48+ TP_ARGS(session, p, uts_ns));
49+
50 LTTNG_DEFINE_TRACE(lttng_statedump_network_interface,
51 TP_PROTO(struct lttng_session *session,
52 struct net_device *dev, struct in_ifaddr *ifa),
53--
542.19.1
55
diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb b/meta/recipes-kernel/lttng/lttng-modules_2.12.3.bb
index e36b327a08..3515e4f51e 100644
--- a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
+++ b/meta/recipes-kernel/lttng/lttng-modules_2.12.3.bb
@@ -11,19 +11,16 @@ include lttng-platforms.inc
11SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \ 11SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
12 file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \ 12 file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
13 file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \ 13 file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
14 file://0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch \ 14 file://0001-fix-btrfs-tracepoints-output-proper-root-owner-for-t.patch \
15 file://0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch \ 15 file://0007-fix-objtool-Rename-frame.h-objtool.h-v5.10.patch \
16 file://0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch \ 16 file://0009-fix-btrfs-make-ordered-extent-tracepoint-take-btrfs_.patch \
17 file://0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch \ 17 file://0010-fix-ext4-fast-commit-recovery-path-v5.10.patch \
18 file://0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch \ 18 file://0012-fix-kvm-x86-mmu-Add-TDP-MMU-PF-handler-v5.10.patch \
19 file://0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch \ 19 file://0014-fix-tracepoint-Optimize-using-static_call-v5.10.patch \
20 file://0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch \ 20 file://0016-fix-statedump-undefined-symbols-caused-by-incorrect-.patch \
21 file://0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch \
22 file://0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch \
23 file://0010-Fix-system-call-filter-table.patch \
24 " 21 "
25 22
26SRC_URI[sha256sum] = "df50bc3bd58679705714f17721acf619a8b0cedc694f8a97052aa5099626feca" 23SRC_URI[sha256sum] = "673ef85c9f03e9b8fed10795e09d4e68add39404b70068d08b10f7b85754d7f0"
27 24
28export INSTALL_MOD_DIR="kernel/lttng-modules" 25export INSTALL_MOD_DIR="kernel/lttng-modules"
29 26
@@ -46,7 +43,7 @@ SRC_URI_class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.1
46 file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \ 43 file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
47 file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \ 44 file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
48 " 45 "
49SRCREV_class-devupstream = "ad594e3a953db1b0c3c059fde45b5a5494f6be78" 46SRCREV_class-devupstream = "be71b60a327d7ad2588abc5cad2861177119972b"
50PV_class-devupstream = "2.12.2+git${SRCPV}" 47PV_class-devupstream = "2.12.3+git${SRCPV}"
51S_class-devupstream = "${WORKDIR}/git" 48S_class-devupstream = "${WORKDIR}/git"
52SRCREV_FORMAT ?= "lttng_git" 49SRCREV_FORMAT ?= "lttng_git"
diff --git a/meta/recipes-kernel/wireless-regdb/wireless-regdb_2020.04.29.bb b/meta/recipes-kernel/wireless-regdb/wireless-regdb_2020.11.20.bb
index a5827b9ef0..05ab95ed7f 100644
--- a/meta/recipes-kernel/wireless-regdb/wireless-regdb_2020.04.29.bb
+++ b/meta/recipes-kernel/wireless-regdb/wireless-regdb_2020.11.20.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] = "89fd031aed5977c219a71501e144375a10e7c90d1005d5d086ea7972886a2c7a" 8SRC_URI[sha256sum] = "b4164490d82ff7b0086e812ac42ab27baf57be24324d4c0ee1c5dd6ba27f2a52"
9 9
10inherit bin_package allarch 10inherit bin_package allarch
11 11
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-libavutil-include-assembly-with-full-path-from-sourc.patch b/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-libavutil-include-assembly-with-full-path-from-sourc.patch
new file mode 100644
index 0000000000..3b503c49c9
--- /dev/null
+++ b/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-libavutil-include-assembly-with-full-path-from-sourc.patch
@@ -0,0 +1,97 @@
1From 24a58d70cbb3997e471366bd5afe54be9007bfb1 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Tue, 10 Nov 2020 15:32:14 +0000
4Subject: [PATCH] libavutil: include assembly with full path from source root
5
6Otherwise nasm writes the full host-specific paths into .o
7output, which breaks binary reproducibility.
8
9Upstream-Status: Pending
10Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
11---
12 libavutil/x86/cpuid.asm | 2 +-
13 libavutil/x86/emms.asm | 2 +-
14 libavutil/x86/fixed_dsp.asm | 2 +-
15 libavutil/x86/float_dsp.asm | 2 +-
16 libavutil/x86/lls.asm | 2 +-
17 libavutil/x86/pixelutils.asm | 2 +-
18 6 files changed, 6 insertions(+), 6 deletions(-)
19
20diff --git a/libavutil/x86/cpuid.asm b/libavutil/x86/cpuid.asm
21index c3f7866..766f77f 100644
22--- a/libavutil/x86/cpuid.asm
23+++ b/libavutil/x86/cpuid.asm
24@@ -21,7 +21,7 @@
25 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 ;******************************************************************************
27
28-%include "x86util.asm"
29+%include "libavutil/x86/x86util.asm"
30
31 SECTION .text
32
33diff --git a/libavutil/x86/emms.asm b/libavutil/x86/emms.asm
34index 8611762..df84f22 100644
35--- a/libavutil/x86/emms.asm
36+++ b/libavutil/x86/emms.asm
37@@ -18,7 +18,7 @@
38 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
39 ;******************************************************************************
40
41-%include "x86util.asm"
42+%include "libavutil/x86/x86util.asm"
43
44 SECTION .text
45
46diff --git a/libavutil/x86/fixed_dsp.asm b/libavutil/x86/fixed_dsp.asm
47index 979dd5c..2f41185 100644
48--- a/libavutil/x86/fixed_dsp.asm
49+++ b/libavutil/x86/fixed_dsp.asm
50@@ -20,7 +20,7 @@
51 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
52 ;******************************************************************************
53
54-%include "x86util.asm"
55+%include "libavutil/x86/x86util.asm"
56
57 SECTION .text
58
59diff --git a/libavutil/x86/float_dsp.asm b/libavutil/x86/float_dsp.asm
60index 517fd63..b773e61 100644
61--- a/libavutil/x86/float_dsp.asm
62+++ b/libavutil/x86/float_dsp.asm
63@@ -20,7 +20,7 @@
64 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
65 ;******************************************************************************
66
67-%include "x86util.asm"
68+%include "libavutil/x86/x86util.asm"
69
70 SECTION_RODATA 32
71 pd_reverse: dd 7, 6, 5, 4, 3, 2, 1, 0
72diff --git a/libavutil/x86/lls.asm b/libavutil/x86/lls.asm
73index 317fba6..d2526d1 100644
74--- a/libavutil/x86/lls.asm
75+++ b/libavutil/x86/lls.asm
76@@ -20,7 +20,7 @@
77 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
78 ;******************************************************************************
79
80-%include "x86util.asm"
81+%include "libavutil/x86/x86util.asm"
82
83 SECTION .text
84
85diff --git a/libavutil/x86/pixelutils.asm b/libavutil/x86/pixelutils.asm
86index 36c57c5..8b45ead 100644
87--- a/libavutil/x86/pixelutils.asm
88+++ b/libavutil/x86/pixelutils.asm
89@@ -21,7 +21,7 @@
90 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
91 ;******************************************************************************
92
93-%include "x86util.asm"
94+%include "libavutil/x86/x86util.asm"
95
96 SECTION .text
97
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35964.patch b/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35964.patch
new file mode 100644
index 0000000000..6b96bd674f
--- /dev/null
+++ b/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35964.patch
@@ -0,0 +1,75 @@
1From 27a99e2c7d450fef15594671eef4465c8a166bd7 Mon Sep 17 00:00:00 2001
2From: Michael Niedermayer <michael@niedermayer.cc>
3Date: Wed, 28 Oct 2020 20:11:54 +0100
4Subject: [PATCH] avformat/vividas: improve extradata packing checks in
5 track_header()
6
7Fixes: out of array accesses
8Fixes: 26622/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-6581200338288640
9
10Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
11Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
12
13Upstream-Status: Backport [https://github.com/FFmpeg/FFmpeg/commit/27a99e2c7d450fef15594671eef4465c8a166bd7]
14
15CVE: CVE-2020-35964
16
17Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
18Signed-off-by: Khairul Rohaizzat Jamaluddin <khairul.rohaizzat.jamaluddin@intel.com>
19---
20 libavformat/vividas.c | 12 ++++++------
21 1 file changed, 6 insertions(+), 6 deletions(-)
22
23diff --git a/libavformat/vividas.c b/libavformat/vividas.c
24index 83d0ed116787..46c66bf9a0ae 100644
25--- a/libavformat/vividas.c
26+++ b/libavformat/vividas.c
27@@ -28,6 +28,7 @@
28 * @sa http://wiki.multimedia.cx/index.php?title=Vividas_VIV
29 */
30
31+#include "libavutil/avassert.h"
32 #include "libavutil/intreadwrite.h"
33 #include "avio_internal.h"
34 #include "avformat.h"
35@@ -379,7 +380,7 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *
36
37 if (avio_tell(pb) < off) {
38 int num_data;
39- int xd_size = 0;
40+ int xd_size = 1;
41 int data_len[256];
42 int offset = 1;
43 uint8_t *p;
44@@ -393,10 +394,10 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *
45 return AVERROR_INVALIDDATA;
46 }
47 data_len[j] = len;
48- xd_size += len;
49+ xd_size += len + 1 + len/255;
50 }
51
52- ret = ff_alloc_extradata(st->codecpar, 64 + xd_size + xd_size / 255);
53+ ret = ff_alloc_extradata(st->codecpar, xd_size);
54 if (ret < 0)
55 return ret;
56
57@@ -405,9 +406,7 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *
58
59 for (j = 0; j < num_data - 1; j++) {
60 unsigned delta = av_xiphlacing(&p[offset], data_len[j]);
61- if (delta > data_len[j]) {
62- return AVERROR_INVALIDDATA;
63- }
64+ av_assert0(delta <= xd_size - offset);
65 offset += delta;
66 }
67
68@@ -418,6 +417,7 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *
69 av_freep(&st->codecpar->extradata);
70 break;
71 }
72+ av_assert0(data_len[j] <= xd_size - offset);
73 offset += data_len[j];
74 }
75
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35965.patch b/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35965.patch
new file mode 100644
index 0000000000..ddab8e9aca
--- /dev/null
+++ b/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2020-35965.patch
@@ -0,0 +1,35 @@
1From 3e5959b3457f7f1856d997261e6ac672bba49e8b Mon Sep 17 00:00:00 2001
2From: Michael Niedermayer <michael@niedermayer.cc>
3Date: Sat, 24 Oct 2020 22:21:48 +0200
4Subject: [PATCH] avcodec/exr: Check ymin vs. h
5
6Fixes: out of array access
7Fixes: 26532/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5613925708857344
8Fixes: 27443/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5631239813595136
9
10Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
11Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
12
13Upstream-Status: Backport [https://github.com/FFmpeg/FFmpeg/commit/3e5959b3457f7f1856d997261e6ac672bba49e8b]
14
15CVE: CVE-2020-35965
16
17Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
18Signed-off-by: Khairul Rohaizzat Jamaluddin <khairul.rohaizzat.jamaluddin@intel.com>
19---
20 libavcodec/exr.c | 2 +-
21 1 file changed, 1 insertion(+), 1 deletion(-)
22
23diff --git a/libavcodec/exr.c b/libavcodec/exr.c
24index e907c5c46401..8b701d1cd298 100644
25--- a/libavcodec/exr.c
26+++ b/libavcodec/exr.c
27@@ -1830,7 +1830,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
28 // Zero out the start if ymin is not 0
29 for (i = 0; i < planes; i++) {
30 ptr = picture->data[i];
31- for (y = 0; y < s->ymin; y++) {
32+ for (y = 0; y < FFMIN(s->ymin, s->h); y++) {
33 memset(ptr, 0, out_line_size);
34 ptr += picture->linesize[i];
35 }
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb b/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb
index 517dac7f05..f902b08811 100644
--- a/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb
+++ b/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb
@@ -25,6 +25,9 @@ LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
25 25
26SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \ 26SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \
27 file://mips64_cpu_detection.patch \ 27 file://mips64_cpu_detection.patch \
28 file://0001-libavutil-include-assembly-with-full-path-from-sourc.patch \
29 file://CVE-2020-35964.patch \
30 file://CVE-2020-35965.patch \
28 " 31 "
29SRC_URI[sha256sum] = "ad009240d46e307b4e03a213a0f49c11b650e445b1f8be0dda2a9212b34d2ffb" 32SRC_URI[sha256sum] = "ad009240d46e307b4e03a213a0f49c11b650e445b1f8be0dda2a9212b34d2ffb"
30 33
@@ -128,6 +131,11 @@ do_configure() {
128 ${S}/configure ${EXTRA_OECONF} 131 ${S}/configure ${EXTRA_OECONF}
129} 132}
130 133
134# patch out build host paths for reproducibility
135do_compile_prepend_class-target() {
136 sed -i -e "s,${WORKDIR},,g" ${B}/config.h
137}
138
131PACKAGES =+ "libavcodec \ 139PACKAGES =+ "libavcodec \
132 libavdevice \ 140 libavdevice \
133 libavfilter \ 141 libavfilter \
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.16.3.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.16.3.bb
index a4f4772c1c..9daaf7587e 100644
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.16.3.bb
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.16.3.bb
@@ -97,3 +97,5 @@ def get_opengl_cmdline_list(switch_name, options, d):
97 return '-D' + switch_name + '=' + ','.join(selected_options) 97 return '-D' + switch_name + '=' + ','.join(selected_options)
98 else: 98 else:
99 return '' 99 return ''
100
101CVE_PRODUCT += "gst-plugins-base"
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.16.3.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.16.3.bb
index 14b34a2808..3eeb69d72c 100644
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.16.3.bb
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.16.3.bb
@@ -16,6 +16,8 @@ PNREAL = "gst-python"
16 16
17S = "${WORKDIR}/${PNREAL}-${PV}" 17S = "${WORKDIR}/${PNREAL}-${PV}"
18 18
19EXTRA_OEMESON += "-Dlibpython-dir=${libdir}"
20
19# gobject-introspection is mandatory and cannot be configured 21# gobject-introspection is mandatory and cannot be configured
20REQUIRED_DISTRO_FEATURES = "gobject-introspection-data" 22REQUIRED_DISTRO_FEATURES = "gobject-introspection-data"
21UNKNOWN_CONFIGURE_WHITELIST_append = " introspection" 23UNKNOWN_CONFIGURE_WHITELIST_append = " introspection"
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.16.3.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.16.3.bb
index 5f1b1d44fa..ed51a5693e 100644
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.16.3.bb
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.16.3.bb
@@ -29,3 +29,5 @@ GIR_MESON_DISABLE_FLAG = "disabled"
29 29
30# Starting with 1.8.0 gst-rtsp-server includes dependency-less plugins as well 30# Starting with 1.8.0 gst-rtsp-server includes dependency-less plugins as well
31require gstreamer1.0-plugins-packaging.inc 31require gstreamer1.0-plugins-packaging.inc
32
33CVE_PRODUCT += "gst-rtsp-server"
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0/0001-tests-seek-Don-t-use-too-strict-timeout-for-validati.patch b/meta/recipes-multimedia/gstreamer/gstreamer1.0/0001-tests-seek-Don-t-use-too-strict-timeout-for-validati.patch
new file mode 100644
index 0000000000..e0e64e2c7a
--- /dev/null
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0/0001-tests-seek-Don-t-use-too-strict-timeout-for-validati.patch
@@ -0,0 +1,32 @@
1From 1db36347d05d88835519368442e9aa89c64091ad Mon Sep 17 00:00:00 2001
2From: Seungha Yang <seungha@centricular.com>
3Date: Tue, 15 Sep 2020 00:54:58 +0900
4Subject: [PATCH] tests: seek: Don't use too strict timeout for validation
5
6Expected segment-done message might not be seen within expected
7time if system is not powerful enough.
8
9Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/625>
10
11Upstream-Status: Backport [https://cgit.freedesktop.org/gstreamer/gstreamer/commit?id=f44312ae5d831438fcf8041162079c65321c588c]
12Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
13---
14 tests/check/pipelines/seek.c | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/tests/check/pipelines/seek.c b/tests/check/pipelines/seek.c
18index 28bb8846d..5f7447bc5 100644
19--- a/tests/check/pipelines/seek.c
20+++ b/tests/check/pipelines/seek.c
21@@ -521,7 +521,7 @@ GST_START_TEST (test_loopback_2)
22
23 GST_INFO ("wait for segment done message");
24
25- msg = gst_bus_timed_pop_filtered (bus, (GstClockTime) 2 * GST_SECOND,
26+ msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE,
27 GST_MESSAGE_SEGMENT_DONE | GST_MESSAGE_ERROR);
28 fail_unless (msg, "no message within the timed window");
29 fail_unless_equals_string (GST_MESSAGE_TYPE_NAME (msg), "segment-done");
30--
312.29.2
32
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.16.3.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.16.3.bb
index 7afe56cd7b..632ef8819c 100644
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.16.3.bb
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.16.3.bb
@@ -22,6 +22,7 @@ SRC_URI = " \
22 file://0003-meson-Add-valgrind-feature.patch \ 22 file://0003-meson-Add-valgrind-feature.patch \
23 file://0004-meson-Add-option-for-installed-tests.patch \ 23 file://0004-meson-Add-option-for-installed-tests.patch \
24 file://0005-bufferpool-only-resize-in-reset-when-maxsize-is-larger.patch \ 24 file://0005-bufferpool-only-resize-in-reset-when-maxsize-is-larger.patch \
25 file://0001-tests-seek-Don-t-use-too-strict-timeout-for-validati.patch \
25" 26"
26SRC_URI[md5sum] = "beecf6965a17fb17fa3b262fd36df70a" 27SRC_URI[md5sum] = "beecf6965a17fb17fa3b262fd36df70a"
27SRC_URI[sha256sum] = "692f037968e454e508b0f71d9674e2e26c78475021407fcf8193b1c7e59543c7" 28SRC_URI[sha256sum] = "692f037968e454e508b0f71d9674e2e26c78475021407fcf8193b1c7e59543c7"
diff --git a/meta/recipes-multimedia/libomxil/libomxil_0.9.3.bb b/meta/recipes-multimedia/libomxil/libomxil_0.9.3.bb
index 2061c280e4..82cdaf54c7 100644
--- a/meta/recipes-multimedia/libomxil/libomxil_0.9.3.bb
+++ b/meta/recipes-multimedia/libomxil/libomxil_0.9.3.bb
@@ -4,7 +4,7 @@ DESCRIPTION = "Bellagio is an opensource implementation of the Khronos OpenMAX \
4HOMEPAGE = "http://omxil.sourceforge.net/" 4HOMEPAGE = "http://omxil.sourceforge.net/"
5 5
6LICENSE = "LGPLv2.1+" 6LICENSE = "LGPLv2.1+"
7LICENSE_FLAGS = "commercial" 7LICENSE_FLAGS = "${@bb.utils.contains('PACKAGECONFIG', 'amr', 'commercial', '', d)}"
8LIC_FILES_CHKSUM = "file://COPYING;md5=ae6f0f4dbc7ac193b50f323a6ae191cb \ 8LIC_FILES_CHKSUM = "file://COPYING;md5=ae6f0f4dbc7ac193b50f323a6ae191cb \
9 file://src/omxcore.h;beginline=1;endline=27;md5=806b1e5566c06486fe8e42b461e03a90" 9 file://src/omxcore.h;beginline=1;endline=27;md5=806b1e5566c06486fe8e42b461e03a90"
10 10
@@ -28,6 +28,10 @@ PROVIDES += "virtual/libomxil"
28 28
29CFLAGS += "-fcommon" 29CFLAGS += "-fcommon"
30 30
31PACKAGECONFIG ??= ""
32
33PACKAGECONFIG[amr] = "--enable-amr,,"
34
31# 35#
32# The .so files under ${libdir}/bellagio are not intended to be versioned and symlinked. 36# The .so files under ${libdir}/bellagio are not intended to be versioned and symlinked.
33# Make sure they get packaged in the main package. 37# Make sure they get packaged in the main package.
diff --git a/meta/recipes-sato/images/core-image-sato-ptest-fast.bb b/meta/recipes-sato/images/core-image-sato-ptest-fast.bb
index 3641217306..4f08d6eb64 100644
--- a/meta/recipes-sato/images/core-image-sato-ptest-fast.bb
+++ b/meta/recipes-sato/images/core-image-sato-ptest-fast.bb
@@ -1,3 +1,6 @@
1inherit features_check
2REQUIRED_DISTRO_FEATURES = "ptest"
3
1require core-image-sato-sdk.bb 4require core-image-sato-sdk.bb
2require conf/distro/include/ptest-packagelists.inc 5require conf/distro/include/ptest-packagelists.inc
3 6
diff --git a/meta/recipes-sato/images/core-image-sato-sdk-ptest.bb b/meta/recipes-sato/images/core-image-sato-sdk-ptest.bb
index bf749acd79..4d59c9536b 100644
--- a/meta/recipes-sato/images/core-image-sato-sdk-ptest.bb
+++ b/meta/recipes-sato/images/core-image-sato-sdk-ptest.bb
@@ -1,3 +1,6 @@
1inherit features_check
2REQUIRED_DISTRO_FEATURES = "ptest"
3
1require core-image-sato-sdk.bb 4require core-image-sato-sdk.bb
2require conf/distro/include/ptest-packagelists.inc 5require conf/distro/include/ptest-packagelists.inc
3 6
diff --git a/meta/recipes-sato/webkit/webkitgtk_2.28.4.bb b/meta/recipes-sato/webkit/webkitgtk_2.28.4.bb
index 34b14f86ea..45b3ee2bce 100644
--- a/meta/recipes-sato/webkit/webkitgtk_2.28.4.bb
+++ b/meta/recipes-sato/webkit/webkitgtk_2.28.4.bb
@@ -134,3 +134,15 @@ GI_DATA_ENABLED_libc-musl_armv7ve = "False"
134 134
135# Can't be built with ccache 135# Can't be built with ccache
136CCACHE_DISABLE = "1" 136CCACHE_DISABLE = "1"
137
138PACKAGE_PREPROCESS_FUNCS += "src_package_preprocess"
139src_package_preprocess () {
140 # Trim build paths from comments in generated sources to ensure reproducibility
141 sed -i -e "s,${WORKDIR},,g" \
142 ${B}/DerivedSources/webkit2gtk/webkit2/*.cpp \
143 ${B}/DerivedSources/ForwardingHeaders/JavaScriptCore/*.h \
144 ${B}/DerivedSources/JavaScriptCore/*.h \
145 ${B}/DerivedSources/JavaScriptCore/yarr/*.h \
146 ${B}/DerivedSources/MiniBrowser/*.c
147}
148
diff --git a/meta/recipes-sato/webkit/wpebackend-fdo_1.7.1.bb b/meta/recipes-sato/webkit/wpebackend-fdo_1.7.1.bb
index 519762d125..15f4f4276c 100644
--- a/meta/recipes-sato/webkit/wpebackend-fdo_1.7.1.bb
+++ b/meta/recipes-sato/webkit/wpebackend-fdo_1.7.1.bb
@@ -15,3 +15,6 @@ REQUIRED_DISTRO_FEATURES = "opengl"
15SRC_URI = "https://wpewebkit.org/releases/${BPN}-${PV}.tar.xz" 15SRC_URI = "https://wpewebkit.org/releases/${BPN}-${PV}.tar.xz"
16SRC_URI[sha256sum] = "9b980a73ea4e3762266c48f81ded56d9dcad4acf32bad9bd05d0dffdd454c6f5" 16SRC_URI[sha256sum] = "9b980a73ea4e3762266c48f81ded56d9dcad4acf32bad9bd05d0dffdd454c6f5"
17 17
18FILES_${PN} += "${libdir}/libWPEBackend-fdo-1.0.so"
19FILES_SOLIBSDEV = ""
20INSANE_SKIP_${PN} += "dev-so"
diff --git a/meta/recipes-support/apr/apr-util_1.6.1.bb b/meta/recipes-support/apr/apr-util_1.6.1.bb
index 0dd8f025e8..4e183ca374 100644
--- a/meta/recipes-support/apr/apr-util_1.6.1.bb
+++ b/meta/recipes-support/apr/apr-util_1.6.1.bb
@@ -19,10 +19,9 @@ SRC_URI = "${APACHE_MIRROR}/apr/${BPN}-${PV}.tar.gz \
19SRC_URI[md5sum] = "bd502b9a8670a8012c4d90c31a84955f" 19SRC_URI[md5sum] = "bd502b9a8670a8012c4d90c31a84955f"
20SRC_URI[sha256sum] = "b65e40713da57d004123b6319828be7f1273fbc6490e145874ee1177e112c459" 20SRC_URI[sha256sum] = "b65e40713da57d004123b6319828be7f1273fbc6490e145874ee1177e112c459"
21 21
22EXTRA_OECONF = "--with-apr=${STAGING_BINDIR_CROSS}/apr-1-config \ 22EXTRA_OECONF = "--with-apr=${STAGING_BINDIR_CROSS}/apr-1-config \
23 --without-odbc \ 23 --without-odbc \
24 --without-pgsql \ 24 --without-pgsql \
25 --with-dbm=gdbm \
26 --without-sqlite2 \ 25 --without-sqlite2 \
27 --with-expat=${STAGING_DIR_HOST}${prefix}" 26 --with-expat=${STAGING_DIR_HOST}${prefix}"
28 27
@@ -36,6 +35,7 @@ OE_BINCONFIG_EXTRA_MANGLE = " -e 's:location=source:location=installed:'"
36do_configure_append() { 35do_configure_append() {
37 if [ "${CLASSOVERRIDE}" = "class-target" ]; then 36 if [ "${CLASSOVERRIDE}" = "class-target" ]; then
38 cp ${STAGING_DATADIR}/apr/apr_rules.mk ${B}/build/rules.mk 37 cp ${STAGING_DATADIR}/apr/apr_rules.mk ${B}/build/rules.mk
38 sed -i -e 's#^CFLAGS=.*#CFLAGS=${TARGET_CFLAGS}#g' ${B}/build/rules.mk
39 fi 39 fi
40} 40}
41do_configure_prepend_class-native() { 41do_configure_prepend_class-native() {
@@ -50,6 +50,7 @@ do_configure_append_class-native() {
50 50
51do_configure_prepend_class-nativesdk() { 51do_configure_prepend_class-nativesdk() {
52 cp ${STAGING_DATADIR}/apr/apr_rules.mk ${S}/build/rules.mk 52 cp ${STAGING_DATADIR}/apr/apr_rules.mk ${S}/build/rules.mk
53 sed -i -e 's#^CFLAGS=.*#CFLAGS=${TARGET_CFLAGS}#g' ${S}/build/rules.mk
53} 54}
54 55
55do_configure_append_class-nativesdk() { 56do_configure_append_class-nativesdk() {
@@ -69,7 +70,7 @@ PACKAGECONFIG ??= "crypto gdbm"
69PACKAGECONFIG[ldap] = "--with-ldap,--without-ldap,openldap" 70PACKAGECONFIG[ldap] = "--with-ldap,--without-ldap,openldap"
70PACKAGECONFIG[crypto] = "--with-openssl=${STAGING_DIR_HOST}${prefix} --with-crypto,--without-crypto,openssl" 71PACKAGECONFIG[crypto] = "--with-openssl=${STAGING_DIR_HOST}${prefix} --with-crypto,--without-crypto,openssl"
71PACKAGECONFIG[sqlite3] = "--with-sqlite3=${STAGING_DIR_HOST}${prefix},--without-sqlite3,sqlite3" 72PACKAGECONFIG[sqlite3] = "--with-sqlite3=${STAGING_DIR_HOST}${prefix},--without-sqlite3,sqlite3"
72PACKAGECONFIG[gdbm] = "--with-gdbm=${STAGING_DIR_HOST}${prefix},--without-gdbm,gdbm" 73PACKAGECONFIG[gdbm] = "--with-dbm=gdbm --with-gdbm=${STAGING_DIR_HOST}${prefix},--without-gdbm,gdbm"
73 74
74#files ${libdir}/apr-util-1/*.so are not symlinks but loadable modules thus they are packaged in ${PN} 75#files ${libdir}/apr-util-1/*.so are not symlinks but loadable modules thus they are packaged in ${PN}
75FILES_${PN} += "${libdir}/apr-util-1/apr*${SOLIBS} ${libdir}/apr-util-1/apr*${SOLIBSDEV}" 76FILES_${PN} += "${libdir}/apr-util-1/apr*${SOLIBS} ${libdir}/apr-util-1/apr*${SOLIBSDEV}"
diff --git a/meta/recipes-support/boost/boost/arm-intrinsics.patch b/meta/recipes-support/boost/boost/arm-intrinsics.patch
deleted file mode 100644
index fe85c69a82..0000000000
--- a/meta/recipes-support/boost/boost/arm-intrinsics.patch
+++ /dev/null
@@ -1,55 +0,0 @@
1Upstream-Status: Backport
2
38/17/2010 - rebased to 1.44 by Qing He <qing.he@intel.com>
4
5diff --git a/boost/smart_ptr/detail/atomic_count_sync.hpp b/boost/smart_ptr/detail/atomic_count_sync.hpp
6index b6359b5..78b1cc2 100644
7--- a/boost/smart_ptr/detail/atomic_count_sync.hpp
8+++ b/boost/smart_ptr/detail/atomic_count_sync.hpp
9@@ -33,17 +33,46 @@ public:
10
11 long operator++()
12 {
13+#ifdef __ARM_ARCH_7A__
14+ int v1, tmp;
15+ asm volatile ("1: \n\t"
16+ "ldrex %0, %1 \n\t"
17+ "add %0 ,%0, #1 \n\t"
18+ "strex %2, %0, %1 \n\t"
19+ "cmp %2, #0 \n\t"
20+ "bne 1b \n\t"
21+ : "=&r" (v1), "+Q"(value_), "=&r"(tmp)
22+ );
23+#else
24 return __sync_add_and_fetch( &value_, 1 );
25+#endif
26 }
27
28 long operator--()
29 {
30+#ifdef __ARM_ARCH_7A__
31+ int v1, tmp;
32+ asm volatile ("1: \n\t"
33+ "ldrex %0, %1 \n\t"
34+ "sub %0 ,%0, #1 \n\t"
35+ "strex %2, %0, %1 \n\t"
36+ "cmp %2, #0 \n\t"
37+ "bne 1b \n\t"
38+ : "=&r" (v1), "+Q"(value_), "=&r"(tmp)
39+ );
40+ return value_;
41+#else
42 return __sync_add_and_fetch( &value_, -1 );
43+#endif
44 }
45
46 operator long() const
47 {
48+#if __ARM_ARCH_7A__
49+ return value_;
50+#else
51 return __sync_fetch_and_add( &value_, 0 );
52+#endif
53 }
54
55 private:
diff --git a/meta/recipes-support/boost/boost_1.74.0.bb b/meta/recipes-support/boost/boost_1.74.0.bb
index b01b390a59..9188303195 100644
--- a/meta/recipes-support/boost/boost_1.74.0.bb
+++ b/meta/recipes-support/boost/boost_1.74.0.bb
@@ -1,7 +1,7 @@
1require boost-${PV}.inc 1require boost-${PV}.inc
2require boost.inc 2require boost.inc
3 3
4SRC_URI += "file://arm-intrinsics.patch \ 4SRC_URI += " \
5 file://boost-CVE-2012-2677.patch \ 5 file://boost-CVE-2012-2677.patch \
6 file://boost-math-disable-pch-for-gcc.patch \ 6 file://boost-math-disable-pch-for-gcc.patch \
7 file://0001-Apply-boost-1.62.0-no-forced-flags.patch.patch \ 7 file://0001-Apply-boost-1.62.0-no-forced-flags.patch.patch \
diff --git a/meta/recipes-support/ca-certificates/ca-certificates/0001-certdata2pem.py-use-python3.patch b/meta/recipes-support/ca-certificates/ca-certificates/0001-certdata2pem.py-use-python3.patch
deleted file mode 100644
index aa2c85ff43..0000000000
--- a/meta/recipes-support/ca-certificates/ca-certificates/0001-certdata2pem.py-use-python3.patch
+++ /dev/null
@@ -1,37 +0,0 @@
1From b6d18ca77f131cdcaa10d0eaa9d303399767edf6 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Wed, 28 Aug 2019 19:18:14 +0200
4Subject: [PATCH] certdata2pem.py: use python3
5
6Comments in that file imply it is already py3 compatible.
7
8Upstream-Status: Pending
9Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
10---
11 mozilla/Makefile | 2 +-
12 mozilla/certdata2pem.py | 2 +-
13 2 files changed, 2 insertions(+), 2 deletions(-)
14
15diff --git a/mozilla/Makefile b/mozilla/Makefile
16index 6f46118..f98877c 100644
17--- a/mozilla/Makefile
18+++ b/mozilla/Makefile
19@@ -3,7 +3,7 @@
20 #
21
22 all:
23- python certdata2pem.py
24+ python3 certdata2pem.py
25
26 clean:
27 -rm -f *.crt
28diff --git a/mozilla/certdata2pem.py b/mozilla/certdata2pem.py
29index 0b02b2a..7d796f1 100644
30--- a/mozilla/certdata2pem.py
31+++ b/mozilla/certdata2pem.py
32@@ -1,4 +1,4 @@
33-#!/usr/bin/python
34+#!/usr/bin/python3
35 # vim:set et sw=4:
36 #
37 # certdata2pem.py - splits certdata.txt into multiple files
diff --git a/meta/recipes-support/ca-certificates/ca-certificates_20200601.bb b/meta/recipes-support/ca-certificates/ca-certificates_20210119.bb
index 6f39df7985..7dcc86fdc1 100644
--- a/meta/recipes-support/ca-certificates/ca-certificates_20200601.bb
+++ b/meta/recipes-support/ca-certificates/ca-certificates_20210119.bb
@@ -14,7 +14,7 @@ DEPENDS_class-nativesdk = "openssl-native"
14# Need rehash from openssl and run-parts from debianutils 14# Need rehash from openssl and run-parts from debianutils
15PACKAGE_WRITE_DEPS += "openssl-native debianutils-native" 15PACKAGE_WRITE_DEPS += "openssl-native debianutils-native"
16 16
17SRCREV = "b3a8980b781bc9a370e42714a605cd4191bb6c0b" 17SRCREV = "181be7ebd169b4a6fb5d90c3e6dc791e90534144"
18 18
19SRC_URI = "git://salsa.debian.org/debian/ca-certificates.git;protocol=https \ 19SRC_URI = "git://salsa.debian.org/debian/ca-certificates.git;protocol=https \
20 file://0002-update-ca-certificates-use-SYSROOT.patch \ 20 file://0002-update-ca-certificates-use-SYSROOT.patch \
@@ -23,7 +23,6 @@ SRC_URI = "git://salsa.debian.org/debian/ca-certificates.git;protocol=https \
23 file://default-sysroot.patch \ 23 file://default-sysroot.patch \
24 file://sbindir.patch \ 24 file://sbindir.patch \
25 file://0003-update-ca-certificates-use-relative-symlinks-from-ET.patch \ 25 file://0003-update-ca-certificates-use-relative-symlinks-from-ET.patch \
26 file://0001-certdata2pem.py-use-python3.patch \
27 " 26 "
28UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+)" 27UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+)"
29 28
@@ -84,8 +83,8 @@ do_install_append_class-native () {
84 SYSROOT="${D}${base_prefix}" ${D}${sbindir}/update-ca-certificates 83 SYSROOT="${D}${base_prefix}" ${D}${sbindir}/update-ca-certificates
85} 84}
86 85
87RDEPENDS_${PN}_class-target = "openssl-bin" 86RDEPENDS_${PN}_append_class-target = " openssl-bin openssl"
88RDEPENDS_${PN}_class-native = "openssl-native" 87RDEPENDS_${PN}_append_class-native = " openssl-native"
89RDEPENDS_${PN}_class-nativesdk = "nativesdk-openssl-bin" 88RDEPENDS_${PN}_append_class-nativesdk = " nativesdk-openssl-bin nativesdk-openssl"
90 89
91BBCLASSEXTEND = "native nativesdk" 90BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-support/curl/curl/0002-remove-void-protop-create-union-p.patch b/meta/recipes-support/curl/curl/0002-remove-void-protop-create-union-p.patch
new file mode 100644
index 0000000000..d0d01fb97c
--- /dev/null
+++ b/meta/recipes-support/curl/curl/0002-remove-void-protop-create-union-p.patch
@@ -0,0 +1,1609 @@
1From bfdb7ee65fc8b96f1fce10ef23871acb092b74b6 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Mon, 23 Nov 2020 08:32:41 +0100
4Subject: [PATCH] urldata: remove 'void *protop' and create the union 'p'
5
6... to avoid the use of 'void *' for the protocol specific structs done
7per transfer.
8
9Closes #6238
10
11Upstream-Status: Backport [https://github.com/curl/curl/commit/a95a6ce6b809693a1195e3b4347a6cfa0fbc2ee7]
12
13CVE: CVE-2020-8285
14
15Signed-off-by: Daniel Stenberg <daniel@haxx.se>
16Signed-off-by: Khairul Rohaizzat Jamaluddin <khairul.rohaizzat.jamaluddin@intel.com>
17
18---
19 docs/INTERNALS.md | 4 ++--
20 lib/file.c | 14 +++++++-------
21 lib/ftp.c | 36 ++++++++++++++++++------------------
22 lib/http.c | 14 +++++++-------
23 lib/http2.c | 50 +++++++++++++++++++++++++-------------------------
24 lib/http_proxy.c | 6 +++---
25 lib/imap.c | 26 +++++++++++++-------------
26 lib/mqtt.c | 10 +++++-----
27 lib/openldap.c | 8 ++++----
28 lib/pop3.c | 14 +++++++-------
29 lib/rtsp.c | 8 ++++----
30 lib/smb.c | 20 ++++++++++----------
31 lib/smtp.c | 22 +++++++++++-----------
32 lib/telnet.c | 30 +++++++++++++++---------------
33 lib/transfer.c | 8 ++++----
34 lib/url.c | 2 +-
35 lib/urldata.h | 19 +++++++++++++++++--
36 lib/vquic/ngtcp2.c | 24 ++++++++++++------------
37 lib/vquic/quiche.c | 10 +++++-----
38 lib/vssh/libssh.c | 10 +++++-----
39 lib/vssh/libssh2.c | 8 ++++----
40 lib/vssh/wolfssh.c | 8 ++++----
41 22 files changed, 183 insertions(+), 168 deletions(-)
42
43diff --git a/docs/INTERNALS.md b/docs/INTERNALS.md
44index 635e7b2..ca8988e 100644
45--- a/docs/INTERNALS.md
46+++ b/docs/INTERNALS.md
47@@ -980,8 +980,8 @@ for older and later versions as things don't change drastically that often.
48 protocol specific data that then gets associated with that `Curl_easy` for
49 the rest of this transfer. It gets freed again at the end of the transfer.
50 It will be called before the `connectdata` for the transfer has been
51- selected/created. Most protocols will allocate its private
52- `struct [PROTOCOL]` here and assign `Curl_easy->req.protop` to point to it.
53+ selected/created. Most protocols will allocate its private `struct
54+ [PROTOCOL]` here and assign `Curl_easy->req.p.[protocol]` to it.
55
56 `->connect_it` allows a protocol to do some specific actions after the TCP
57 connect is done, that can still be considered part of the connection phase.
58diff --git a/lib/file.c b/lib/file.c
59index cd3e49c..110e5c2 100644
60--- a/lib/file.c
61+++ b/lib/file.c
62@@ -119,8 +119,8 @@ const struct Curl_handler Curl_handler_file = {
63 static CURLcode file_setup_connection(struct connectdata *conn)
64 {
65 /* allocate the FILE specific struct */
66- conn->data->req.protop = calloc(1, sizeof(struct FILEPROTO));
67- if(!conn->data->req.protop)
68+ conn->data->req.p.file = calloc(1, sizeof(struct FILEPROTO));
69+ if(!conn->data->req.p.file)
70 return CURLE_OUT_OF_MEMORY;
71
72 return CURLE_OK;
73@@ -135,7 +135,7 @@ static CURLcode file_connect(struct connectdata *conn, bool *done)
74 {
75 struct Curl_easy *data = conn->data;
76 char *real_path;
77- struct FILEPROTO *file = data->req.protop;
78+ struct FILEPROTO *file = data->req.p.file;
79 int fd;
80 #ifdef DOS_FILESYSTEM
81 size_t i;
82@@ -209,7 +209,7 @@ static CURLcode file_connect(struct connectdata *conn, bool *done)
83 static CURLcode file_done(struct connectdata *conn,
84 CURLcode status, bool premature)
85 {
86- struct FILEPROTO *file = conn->data->req.protop;
87+ struct FILEPROTO *file = conn->data->req.p.file;
88 (void)status; /* not used */
89 (void)premature; /* not used */
90
91@@ -227,7 +227,7 @@ static CURLcode file_done(struct connectdata *conn,
92 static CURLcode file_disconnect(struct connectdata *conn,
93 bool dead_connection)
94 {
95- struct FILEPROTO *file = conn->data->req.protop;
96+ struct FILEPROTO *file = conn->data->req.p.file;
97 (void)dead_connection; /* not used */
98
99 if(file) {
100@@ -249,7 +249,7 @@ static CURLcode file_disconnect(struct connectdata *conn,
101
102 static CURLcode file_upload(struct connectdata *conn)
103 {
104- struct FILEPROTO *file = conn->data->req.protop;
105+ struct FILEPROTO *file = conn->data->req.p.file;
106 const char *dir = strchr(file->path, DIRSEP);
107 int fd;
108 int mode;
109@@ -391,7 +391,7 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
110 if(data->set.upload)
111 return file_upload(conn);
112
113- file = conn->data->req.protop;
114+ file = conn->data->req.p.file;
115
116 /* get the fd from the connection phase */
117 fd = file->fd;
118diff --git a/lib/ftp.c b/lib/ftp.c
119index 9fadac5..d1a9447 100644
120--- a/lib/ftp.c
121+++ b/lib/ftp.c
122@@ -1345,7 +1345,7 @@ static CURLcode ftp_state_use_pasv(struct connectdata *conn)
123 static CURLcode ftp_state_prepare_transfer(struct connectdata *conn)
124 {
125 CURLcode result = CURLE_OK;
126- struct FTP *ftp = conn->data->req.protop;
127+ struct FTP *ftp = conn->data->req.p.ftp;
128 struct Curl_easy *data = conn->data;
129
130 if(ftp->transfer != FTPTRANSFER_BODY) {
131@@ -1388,7 +1388,7 @@ static CURLcode ftp_state_prepare_transfer(struct connectdata *conn)
132 static CURLcode ftp_state_rest(struct connectdata *conn)
133 {
134 CURLcode result = CURLE_OK;
135- struct FTP *ftp = conn->data->req.protop;
136+ struct FTP *ftp = conn->data->req.p.ftp;
137 struct ftp_conn *ftpc = &conn->proto.ftpc;
138
139 if((ftp->transfer != FTPTRANSFER_BODY) && ftpc->file) {
140@@ -1409,7 +1409,7 @@ static CURLcode ftp_state_rest(struct connectdata *conn)
141 static CURLcode ftp_state_size(struct connectdata *conn)
142 {
143 CURLcode result = CURLE_OK;
144- struct FTP *ftp = conn->data->req.protop;
145+ struct FTP *ftp = conn->data->req.p.ftp;
146 struct ftp_conn *ftpc = &conn->proto.ftpc;
147
148 if((ftp->transfer == FTPTRANSFER_INFO) && ftpc->file) {
149@@ -1430,7 +1430,7 @@ static CURLcode ftp_state_list(struct connectdata *conn)
150 {
151 CURLcode result = CURLE_OK;
152 struct Curl_easy *data = conn->data;
153- struct FTP *ftp = data->req.protop;
154+ struct FTP *ftp = data->req.p.ftp;
155
156 /* If this output is to be machine-parsed, the NLST command might be better
157 to use, since the LIST command output is not specified or standard in any
158@@ -1508,7 +1508,7 @@ static CURLcode ftp_state_stor_prequote(struct connectdata *conn)
159 static CURLcode ftp_state_type(struct connectdata *conn)
160 {
161 CURLcode result = CURLE_OK;
162- struct FTP *ftp = conn->data->req.protop;
163+ struct FTP *ftp = conn->data->req.p.ftp;
164 struct Curl_easy *data = conn->data;
165 struct ftp_conn *ftpc = &conn->proto.ftpc;
166
167@@ -1565,7 +1565,7 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn,
168 bool sizechecked)
169 {
170 CURLcode result = CURLE_OK;
171- struct FTP *ftp = conn->data->req.protop;
172+ struct FTP *ftp = conn->data->req.p.ftp;
173 struct Curl_easy *data = conn->data;
174 struct ftp_conn *ftpc = &conn->proto.ftpc;
175
176@@ -1664,7 +1664,7 @@ static CURLcode ftp_state_quote(struct connectdata *conn,
177 {
178 CURLcode result = CURLE_OK;
179 struct Curl_easy *data = conn->data;
180- struct FTP *ftp = data->req.protop;
181+ struct FTP *ftp = data->req.p.ftp;
182 struct ftp_conn *ftpc = &conn->proto.ftpc;
183 bool quote = FALSE;
184 struct curl_slist *item;
185@@ -2033,7 +2033,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata *conn,
186 {
187 CURLcode result = CURLE_OK;
188 struct Curl_easy *data = conn->data;
189- struct FTP *ftp = data->req.protop;
190+ struct FTP *ftp = data->req.p.ftp;
191 struct ftp_conn *ftpc = &conn->proto.ftpc;
192
193 switch(ftpcode) {
194@@ -2166,7 +2166,7 @@ static CURLcode ftp_state_retr(struct connectdata *conn,
195 {
196 CURLcode result = CURLE_OK;
197 struct Curl_easy *data = conn->data;
198- struct FTP *ftp = data->req.protop;
199+ struct FTP *ftp = data->req.p.ftp;
200 struct ftp_conn *ftpc = &conn->proto.ftpc;
201
202 if(data->set.max_filesize && (filesize > data->set.max_filesize)) {
203@@ -2378,7 +2378,7 @@ static CURLcode ftp_state_get_resp(struct connectdata *conn,
204 {
205 CURLcode result = CURLE_OK;
206 struct Curl_easy *data = conn->data;
207- struct FTP *ftp = data->req.protop;
208+ struct FTP *ftp = data->req.p.ftp;
209
210 if((ftpcode == 150) || (ftpcode == 125)) {
211
212@@ -3138,7 +3138,7 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
213 bool premature)
214 {
215 struct Curl_easy *data = conn->data;
216- struct FTP *ftp = data->req.protop;
217+ struct FTP *ftp = data->req.p.ftp;
218 struct ftp_conn *ftpc = &conn->proto.ftpc;
219 struct pingpong *pp = &ftpc->pp;
220 ssize_t nread;
221@@ -3492,7 +3492,7 @@ static CURLcode ftp_do_more(struct connectdata *conn, int *completep)
222 bool complete = FALSE;
223
224 /* the ftp struct is inited in ftp_connect() */
225- struct FTP *ftp = data->req.protop;
226+ struct FTP *ftp = data->req.p.ftp;
227
228 /* if the second connection isn't done yet, wait for it */
229 if(!conn->bits.tcpconnect[SECONDARYSOCKET]) {
230@@ -3657,7 +3657,7 @@ CURLcode ftp_perform(struct connectdata *conn,
231
232 if(conn->data->set.opt_no_body) {
233 /* requested no body means no transfer... */
234- struct FTP *ftp = conn->data->req.protop;
235+ struct FTP *ftp = conn->data->req.p.ftp;
236 ftp->transfer = FTPTRANSFER_INFO;
237 }
238
239@@ -3692,7 +3692,7 @@ static void wc_data_dtor(void *ptr)
240 static CURLcode init_wc_data(struct connectdata *conn)
241 {
242 char *last_slash;
243- struct FTP *ftp = conn->data->req.protop;
244+ struct FTP *ftp = conn->data->req.p.ftp;
245 char *path = ftp->path;
246 struct WildcardData *wildcard = &(conn->data->wildcard);
247 CURLcode result = CURLE_OK;
248@@ -3826,7 +3826,7 @@ static CURLcode wc_statemach(struct connectdata *conn)
249 /* filelist has at least one file, lets get first one */
250 struct ftp_conn *ftpc = &conn->proto.ftpc;
251 struct curl_fileinfo *finfo = wildcard->filelist.head->ptr;
252- struct FTP *ftp = conn->data->req.protop;
253+ struct FTP *ftp = conn->data->req.p.ftp;
254
255 char *tmp_path = aprintf("%s%s", wildcard->path, finfo->filename);
256 if(!tmp_path)
257@@ -4099,7 +4099,7 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
258 {
259 struct Curl_easy *data = conn->data;
260 /* the ftp struct is already inited in ftp_connect() */
261- struct FTP *ftp = data->req.protop;
262+ struct FTP *ftp = data->req.p.ftp;
263 struct ftp_conn *ftpc = &conn->proto.ftpc;
264 const char *slashPos = NULL;
265 const char *fileName = NULL;
266@@ -4244,7 +4244,7 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
267 static CURLcode ftp_dophase_done(struct connectdata *conn,
268 bool connected)
269 {
270- struct FTP *ftp = conn->data->req.protop;
271+ struct FTP *ftp = conn->data->req.p.ftp;
272 struct ftp_conn *ftpc = &conn->proto.ftpc;
273
274 if(connected) {
275@@ -4341,7 +4341,7 @@ static CURLcode ftp_setup_connection(struct connectdata *conn)
276 char *type;
277 struct FTP *ftp;
278
279- conn->data->req.protop = ftp = calloc(sizeof(struct FTP), 1);
280+ conn->data->req.p.ftp = ftp = calloc(sizeof(struct FTP), 1);
281 if(NULL == ftp)
282 return CURLE_OUT_OF_MEMORY;
283
284diff --git a/lib/http.c b/lib/http.c
285index 8fcdd43..31d9112 100644
286--- a/lib/http.c
287+++ b/lib/http.c
288@@ -162,14 +162,14 @@ static CURLcode http_setup_conn(struct connectdata *conn)
289 during this request */
290 struct HTTP *http;
291 struct Curl_easy *data = conn->data;
292- DEBUGASSERT(data->req.protop == NULL);
293+ DEBUGASSERT(data->req.p.http == NULL);
294
295 http = calloc(1, sizeof(struct HTTP));
296 if(!http)
297 return CURLE_OUT_OF_MEMORY;
298
299 Curl_mime_initpart(&http->form, conn->data);
300- data->req.protop = http;
301+ data->req.p.http = http;
302
303 if(data->set.httpversion == CURL_HTTP_VERSION_3) {
304 if(conn->handler->flags & PROTOPT_SSL)
305@@ -425,7 +425,7 @@ static bool pickoneauth(struct auth *pick, unsigned long mask)
306 static CURLcode http_perhapsrewind(struct connectdata *conn)
307 {
308 struct Curl_easy *data = conn->data;
309- struct HTTP *http = data->req.protop;
310+ struct HTTP *http = data->req.p.http;
311 curl_off_t bytessent;
312 curl_off_t expectsend = -1; /* default is unknown */
313
314@@ -1109,7 +1109,7 @@ static size_t readmoredata(char *buffer,
315 void *userp)
316 {
317 struct connectdata *conn = (struct connectdata *)userp;
318- struct HTTP *http = conn->data->req.protop;
319+ struct HTTP *http = conn->data->req.p.http;
320 size_t fullsize = size * nitems;
321
322 if(!http->postsize)
323@@ -1167,7 +1167,7 @@ CURLcode Curl_buffer_send(struct dynbuf *in,
324 char *ptr;
325 size_t size;
326 struct Curl_easy *data = conn->data;
327- struct HTTP *http = data->req.protop;
328+ struct HTTP *http = data->req.p.http;
329 size_t sendsize;
330 curl_socket_t sockfd;
331 size_t headersize;
332@@ -1517,7 +1517,7 @@ CURLcode Curl_http_done(struct connectdata *conn,
333 CURLcode status, bool premature)
334 {
335 struct Curl_easy *data = conn->data;
336- struct HTTP *http = data->req.protop;
337+ struct HTTP *http = data->req.p.http;
338
339 /* Clear multipass flag. If authentication isn't done yet, then it will get
340 * a chance to be set back to true when we output the next auth header */
341@@ -1978,7 +1978,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
342 return result;
343 }
344 }
345- http = data->req.protop;
346+ http = data->req.p.http;
347 DEBUGASSERT(http);
348
349 if(!data->state.this_is_a_follow) {
350diff --git a/lib/http2.c b/lib/http2.c
351index d316da8..c41a1c2 100644
352--- a/lib/http2.c
353+++ b/lib/http2.c
354@@ -257,7 +257,7 @@ static unsigned int http2_conncheck(struct connectdata *check,
355 /* called from http_setup_conn */
356 void Curl_http2_setup_req(struct Curl_easy *data)
357 {
358- struct HTTP *http = data->req.protop;
359+ struct HTTP *http = data->req.p.http;
360 http->bodystarted = FALSE;
361 http->status_code = -1;
362 http->pausedata = NULL;
363@@ -391,7 +391,7 @@ char *curl_pushheader_bynum(struct curl_pushheaders *h, size_t num)
364 if(!h || !GOOD_EASY_HANDLE(h->data))
365 return NULL;
366 else {
367- struct HTTP *stream = h->data->req.protop;
368+ struct HTTP *stream = h->data->req.p.http;
369 if(num < stream->push_headers_used)
370 return stream->push_headers[num];
371 }
372@@ -413,7 +413,7 @@ char *curl_pushheader_byname(struct curl_pushheaders *h, const char *header)
373 !strcmp(header, ":") || strchr(header + 1, ':'))
374 return NULL;
375 else {
376- struct HTTP *stream = h->data->req.protop;
377+ struct HTTP *stream = h->data->req.p.http;
378 size_t len = strlen(header);
379 size_t i;
380 for(i = 0; i<stream->push_headers_used; i++) {
381@@ -460,7 +460,7 @@ static struct Curl_easy *duphandle(struct Curl_easy *data)
382 (void)Curl_close(&second);
383 }
384 else {
385- second->req.protop = http;
386+ second->req.p.http = http;
387 Curl_dyn_init(&http->header_recvbuf, DYN_H2_HEADERS);
388 Curl_http2_setup_req(second);
389 second->state.stream_weight = data->state.stream_weight;
390@@ -537,7 +537,7 @@ static int push_promise(struct Curl_easy *data,
391 /* ask the application */
392 H2BUGF(infof(data, "Got PUSH_PROMISE, ask application!\n"));
393
394- stream = data->req.protop;
395+ stream = data->req.p.http;
396 if(!stream) {
397 failf(data, "Internal NULL stream!\n");
398 (void)Curl_close(&newhandle);
399@@ -567,13 +567,13 @@ static int push_promise(struct Curl_easy *data,
400 if(rv) {
401 DEBUGASSERT((rv > CURL_PUSH_OK) && (rv <= CURL_PUSH_ERROROUT));
402 /* denied, kill off the new handle again */
403- http2_stream_free(newhandle->req.protop);
404- newhandle->req.protop = NULL;
405+ http2_stream_free(newhandle->req.p.http);
406+ newhandle->req.p.http = NULL;
407 (void)Curl_close(&newhandle);
408 goto fail;
409 }
410
411- newstream = newhandle->req.protop;
412+ newstream = newhandle->req.p.http;
413 newstream->stream_id = frame->promised_stream_id;
414 newhandle->req.maxdownload = -1;
415 newhandle->req.size = -1;
416@@ -583,8 +583,8 @@ static int push_promise(struct Curl_easy *data,
417 rc = Curl_multi_add_perform(data->multi, newhandle, conn);
418 if(rc) {
419 infof(data, "failed to add handle to multi\n");
420- http2_stream_free(newhandle->req.protop);
421- newhandle->req.protop = NULL;
422+ http2_stream_free(newhandle->req.p.http);
423+ newhandle->req.p.http = NULL;
424 Curl_close(&newhandle);
425 rv = CURL_PUSH_DENY;
426 goto fail;
427@@ -667,7 +667,7 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame,
428 return 0;
429 }
430
431- stream = data_s->req.protop;
432+ stream = data_s->req.p.http;
433 if(!stream) {
434 H2BUGF(infof(data_s, "No proto pointer for stream: %x\n",
435 stream_id));
436@@ -783,7 +783,7 @@ static int on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
437 internal error more than anything else! */
438 return NGHTTP2_ERR_CALLBACK_FAILURE;
439
440- stream = data_s->req.protop;
441+ stream = data_s->req.p.http;
442 if(!stream)
443 return NGHTTP2_ERR_CALLBACK_FAILURE;
444
445@@ -849,7 +849,7 @@ static int on_stream_close(nghttp2_session *session, int32_t stream_id,
446 }
447 H2BUGF(infof(data_s, "on_stream_close(), %s (err %d), stream %u\n",
448 nghttp2_http2_strerror(error_code), error_code, stream_id));
449- stream = data_s->req.protop;
450+ stream = data_s->req.p.http;
451 if(!stream)
452 return NGHTTP2_ERR_CALLBACK_FAILURE;
453
454@@ -894,7 +894,7 @@ static int on_begin_headers(nghttp2_session *session,
455 return 0;
456 }
457
458- stream = data_s->req.protop;
459+ stream = data_s->req.p.http;
460 if(!stream || !stream->bodystarted) {
461 return 0;
462 }
463@@ -952,7 +952,7 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
464 internal error more than anything else! */
465 return NGHTTP2_ERR_CALLBACK_FAILURE;
466
467- stream = data_s->req.protop;
468+ stream = data_s->req.p.http;
469 if(!stream) {
470 failf(data_s, "Internal NULL stream! 5\n");
471 return NGHTTP2_ERR_CALLBACK_FAILURE;
472@@ -1100,7 +1100,7 @@ static ssize_t data_source_read_callback(nghttp2_session *session,
473 internal error more than anything else! */
474 return NGHTTP2_ERR_CALLBACK_FAILURE;
475
476- stream = data_s->req.protop;
477+ stream = data_s->req.p.http;
478 if(!stream)
479 return NGHTTP2_ERR_CALLBACK_FAILURE;
480 }
481@@ -1161,7 +1161,7 @@ static void populate_settings(struct connectdata *conn,
482
483 void Curl_http2_done(struct Curl_easy *data, bool premature)
484 {
485- struct HTTP *http = data->req.protop;
486+ struct HTTP *http = data->req.p.http;
487 struct http_conn *httpc = &data->conn->proto.httpc;
488
489 /* there might be allocated resources done before this got the 'h2' pointer
490@@ -1398,7 +1398,7 @@ CURLcode Curl_http2_done_sending(struct connectdata *conn)
491 (conn->handler == &Curl_handler_http2)) {
492 /* make sure this is only attempted for HTTP/2 transfers */
493
494- struct HTTP *stream = conn->data->req.protop;
495+ struct HTTP *stream = conn->data->req.p.http;
496
497 struct http_conn *httpc = &conn->proto.httpc;
498 nghttp2_session *h2 = httpc->h2;
499@@ -1522,7 +1522,7 @@ static void h2_pri_spec(struct Curl_easy *data,
500 nghttp2_priority_spec *pri_spec)
501 {
502 struct HTTP *depstream = (data->set.stream_depends_on?
503- data->set.stream_depends_on->req.protop:NULL);
504+ data->set.stream_depends_on->req.p.http:NULL);
505 int32_t depstream_id = depstream? depstream->stream_id:0;
506 nghttp2_priority_spec_init(pri_spec, depstream_id, data->set.stream_weight,
507 data->set.stream_depends_e);
508@@ -1539,7 +1539,7 @@ static void h2_pri_spec(struct Curl_easy *data,
509 static int h2_session_send(struct Curl_easy *data,
510 nghttp2_session *h2)
511 {
512- struct HTTP *stream = data->req.protop;
513+ struct HTTP *stream = data->req.p.http;
514 if((data->set.stream_weight != data->state.stream_weight) ||
515 (data->set.stream_depends_e != data->state.stream_depends_e) ||
516 (data->set.stream_depends_on != data->state.stream_depends_on) ) {
517@@ -1569,7 +1569,7 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex,
518 ssize_t nread;
519 struct http_conn *httpc = &conn->proto.httpc;
520 struct Curl_easy *data = conn->data;
521- struct HTTP *stream = data->req.protop;
522+ struct HTTP *stream = data->req.p.http;
523
524 (void)sockindex; /* we always do HTTP2 on sockindex 0 */
525
526@@ -1874,7 +1874,7 @@ static ssize_t http2_send(struct connectdata *conn, int sockindex,
527 */
528 int rv;
529 struct http_conn *httpc = &conn->proto.httpc;
530- struct HTTP *stream = conn->data->req.protop;
531+ struct HTTP *stream = conn->data->req.p.http;
532 nghttp2_nv *nva = NULL;
533 size_t nheader;
534 size_t i;
535@@ -2183,7 +2183,7 @@ CURLcode Curl_http2_setup(struct connectdata *conn)
536 {
537 CURLcode result;
538 struct http_conn *httpc = &conn->proto.httpc;
539- struct HTTP *stream = conn->data->req.protop;
540+ struct HTTP *stream = conn->data->req.p.http;
541
542 DEBUGASSERT(conn->data->state.buffer);
543
544@@ -2238,7 +2238,7 @@ CURLcode Curl_http2_switched(struct connectdata *conn,
545 int rv;
546 ssize_t nproc;
547 struct Curl_easy *data = conn->data;
548- struct HTTP *stream = conn->data->req.protop;
549+ struct HTTP *stream = conn->data->req.p.http;
550
551 result = Curl_http2_setup(conn);
552 if(result)
553@@ -2358,7 +2358,7 @@ CURLcode Curl_http2_stream_pause(struct Curl_easy *data, bool pause)
554 return CURLE_OK;
555 #ifdef NGHTTP2_HAS_SET_LOCAL_WINDOW_SIZE
556 else {
557- struct HTTP *stream = data->req.protop;
558+ struct HTTP *stream = data->req.p.http;
559 struct http_conn *httpc = &data->conn->proto.httpc;
560 uint32_t window = !pause * HTTP2_HUGE_WINDOW_SIZE;
561 int rv = nghttp2_session_set_local_window_size(httpc->h2,
562diff --git a/lib/http_proxy.c b/lib/http_proxy.c
563index f188cbf..69aacb4 100644
564--- a/lib/http_proxy.c
565+++ b/lib/http_proxy.c
566@@ -102,9 +102,9 @@ CURLcode Curl_proxy_connect(struct connectdata *conn, int sockindex)
567 * This function might be called several times in the multi interface case
568 * if the proxy's CONNECT response is not instant.
569 */
570- prot_save = conn->data->req.protop;
571+ prot_save = conn->data->req.p.http;
572 memset(&http_proxy, 0, sizeof(http_proxy));
573- conn->data->req.protop = &http_proxy;
574+ conn->data->req.p.http = &http_proxy;
575 connkeep(conn, "HTTP proxy CONNECT");
576
577 /* for the secondary socket (FTP), use the "connect to host"
578@@ -125,7 +125,7 @@ CURLcode Curl_proxy_connect(struct connectdata *conn, int sockindex)
579 else
580 remote_port = conn->remote_port;
581 result = Curl_proxyCONNECT(conn, sockindex, hostname, remote_port);
582- conn->data->req.protop = prot_save;
583+ conn->data->req.p.http = prot_save;
584 if(CURLE_OK != result)
585 return result;
586 Curl_safefree(data->state.aptr.proxyuserpwd);
587diff --git a/lib/imap.c b/lib/imap.c
588index cad0e59..bda23a5 100644
589--- a/lib/imap.c
590+++ b/lib/imap.c
591@@ -244,7 +244,7 @@ static bool imap_matchresp(const char *line, size_t len, const char *cmd)
592 static bool imap_endofresp(struct connectdata *conn, char *line, size_t len,
593 int *resp)
594 {
595- struct IMAP *imap = conn->data->req.protop;
596+ struct IMAP *imap = conn->data->req.p.imap;
597 struct imap_conn *imapc = &conn->proto.imapc;
598 const char *id = imapc->resptag;
599 size_t id_len = strlen(id);
600@@ -605,7 +605,7 @@ static CURLcode imap_perform_list(struct connectdata *conn)
601 {
602 CURLcode result = CURLE_OK;
603 struct Curl_easy *data = conn->data;
604- struct IMAP *imap = data->req.protop;
605+ struct IMAP *imap = data->req.p.imap;
606
607 if(imap->custom)
608 /* Send the custom request */
609@@ -640,7 +640,7 @@ static CURLcode imap_perform_select(struct connectdata *conn)
610 {
611 CURLcode result = CURLE_OK;
612 struct Curl_easy *data = conn->data;
613- struct IMAP *imap = data->req.protop;
614+ struct IMAP *imap = data->req.p.imap;
615 struct imap_conn *imapc = &conn->proto.imapc;
616 char *mailbox;
617
618@@ -679,7 +679,7 @@ static CURLcode imap_perform_select(struct connectdata *conn)
619 static CURLcode imap_perform_fetch(struct connectdata *conn)
620 {
621 CURLcode result = CURLE_OK;
622- struct IMAP *imap = conn->data->req.protop;
623+ struct IMAP *imap = conn->data->req.p.imap;
624 /* Check we have a UID */
625 if(imap->uid) {
626
627@@ -727,7 +727,7 @@ static CURLcode imap_perform_append(struct connectdata *conn)
628 {
629 CURLcode result = CURLE_OK;
630 struct Curl_easy *data = conn->data;
631- struct IMAP *imap = data->req.protop;
632+ struct IMAP *imap = data->req.p.imap;
633 char *mailbox;
634
635 /* Check we have a mailbox */
636@@ -797,7 +797,7 @@ static CURLcode imap_perform_append(struct connectdata *conn)
637 static CURLcode imap_perform_search(struct connectdata *conn)
638 {
639 CURLcode result = CURLE_OK;
640- struct IMAP *imap = conn->data->req.protop;
641+ struct IMAP *imap = conn->data->req.p.imap;
642
643 /* Check we have a query string */
644 if(!imap->query) {
645@@ -1051,7 +1051,7 @@ static CURLcode imap_state_select_resp(struct connectdata *conn, int imapcode,
646 {
647 CURLcode result = CURLE_OK;
648 struct Curl_easy *data = conn->data;
649- struct IMAP *imap = conn->data->req.protop;
650+ struct IMAP *imap = conn->data->req.p.imap;
651 struct imap_conn *imapc = &conn->proto.imapc;
652 const char *line = data->state.buffer;
653
654@@ -1380,7 +1380,7 @@ static CURLcode imap_init(struct connectdata *conn)
655 struct Curl_easy *data = conn->data;
656 struct IMAP *imap;
657
658- imap = data->req.protop = calloc(sizeof(struct IMAP), 1);
659+ imap = data->req.p.imap = calloc(sizeof(struct IMAP), 1);
660 if(!imap)
661 result = CURLE_OUT_OF_MEMORY;
662
663@@ -1457,7 +1457,7 @@ static CURLcode imap_done(struct connectdata *conn, CURLcode status,
664 {
665 CURLcode result = CURLE_OK;
666 struct Curl_easy *data = conn->data;
667- struct IMAP *imap = data->req.protop;
668+ struct IMAP *imap = data->req.p.imap;
669
670 (void)premature;
671
672@@ -1517,7 +1517,7 @@ static CURLcode imap_perform(struct connectdata *conn, bool *connected,
673 /* This is IMAP and no proxy */
674 CURLcode result = CURLE_OK;
675 struct Curl_easy *data = conn->data;
676- struct IMAP *imap = data->req.protop;
677+ struct IMAP *imap = data->req.p.imap;
678 struct imap_conn *imapc = &conn->proto.imapc;
679 bool selected = FALSE;
680
681@@ -1640,7 +1640,7 @@ static CURLcode imap_disconnect(struct connectdata *conn, bool dead_connection)
682 /* Call this when the DO phase has completed */
683 static CURLcode imap_dophase_done(struct connectdata *conn, bool connected)
684 {
685- struct IMAP *imap = conn->data->req.protop;
686+ struct IMAP *imap = conn->data->req.p.imap;
687
688 (void)connected;
689
690@@ -1942,7 +1942,7 @@ static CURLcode imap_parse_url_path(struct connectdata *conn)
691 /* The imap struct is already initialised in imap_connect() */
692 CURLcode result = CURLE_OK;
693 struct Curl_easy *data = conn->data;
694- struct IMAP *imap = data->req.protop;
695+ struct IMAP *imap = data->req.p.imap;
696 const char *begin = &data->state.up.path[1]; /* skip leading slash */
697 const char *ptr = begin;
698
699@@ -2074,7 +2074,7 @@ static CURLcode imap_parse_custom_request(struct connectdata *conn)
700 {
701 CURLcode result = CURLE_OK;
702 struct Curl_easy *data = conn->data;
703- struct IMAP *imap = data->req.protop;
704+ struct IMAP *imap = data->req.p.imap;
705 const char *custom = data->set.str[STRING_CUSTOMREQUEST];
706
707 if(custom) {
708diff --git a/lib/mqtt.c b/lib/mqtt.c
709index f6f4416..86b22b8 100644
710--- a/lib/mqtt.c
711+++ b/lib/mqtt.c
712@@ -95,12 +95,12 @@ static CURLcode mqtt_setup_conn(struct connectdata *conn)
713 during this request */
714 struct MQTT *mq;
715 struct Curl_easy *data = conn->data;
716- DEBUGASSERT(data->req.protop == NULL);
717+ DEBUGASSERT(data->req.p.mqtt == NULL);
718
719 mq = calloc(1, sizeof(struct MQTT));
720 if(!mq)
721 return CURLE_OUT_OF_MEMORY;
722- data->req.protop = mq;
723+ data->req.p.mqtt = mq;
724 return CURLE_OK;
725 }
726
727@@ -110,7 +110,7 @@ static CURLcode mqtt_send(struct connectdata *conn,
728 CURLcode result = CURLE_OK;
729 curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
730 struct Curl_easy *data = conn->data;
731- struct MQTT *mq = data->req.protop;
732+ struct MQTT *mq = data->req.p.mqtt;
733 ssize_t n;
734 result = Curl_write(conn, sockfd, buf, len, &n);
735 if(!result && data->set.verbose)
736@@ -426,7 +426,7 @@ static CURLcode mqtt_read_publish(struct connectdata *conn,
737 unsigned char *pkt = (unsigned char *)data->state.buffer;
738 size_t remlen;
739 struct mqtt_conn *mqtt = &conn->proto.mqtt;
740- struct MQTT *mq = data->req.protop;
741+ struct MQTT *mq = data->req.p.mqtt;
742 unsigned char packet;
743
744 switch(mqtt->state) {
745@@ -533,7 +533,7 @@ static CURLcode mqtt_doing(struct connectdata *conn, bool *done)
746 CURLcode result = CURLE_OK;
747 struct mqtt_conn *mqtt = &conn->proto.mqtt;
748 struct Curl_easy *data = conn->data;
749- struct MQTT *mq = data->req.protop;
750+ struct MQTT *mq = data->req.p.mqtt;
751 ssize_t nread;
752 curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
753 unsigned char *pkt = (unsigned char *)data->state.buffer;
754diff --git a/lib/openldap.c b/lib/openldap.c
755index 782d6a0..c955df6 100644
756--- a/lib/openldap.c
757+++ b/lib/openldap.c
758@@ -410,7 +410,7 @@ static CURLcode ldap_do(struct connectdata *conn, bool *done)
759 if(!lr)
760 return CURLE_OUT_OF_MEMORY;
761 lr->msgid = msgid;
762- data->req.protop = lr;
763+ data->req.p.ldap = lr;
764 Curl_setup_transfer(data, FIRSTSOCKET, -1, FALSE, -1);
765 *done = TRUE;
766 return CURLE_OK;
767@@ -419,7 +419,7 @@ static CURLcode ldap_do(struct connectdata *conn, bool *done)
768 static CURLcode ldap_done(struct connectdata *conn, CURLcode res,
769 bool premature)
770 {
771- struct ldapreqinfo *lr = conn->data->req.protop;
772+ struct ldapreqinfo *lr = conn->data->req.p.ldap;
773
774 (void)res;
775 (void)premature;
776@@ -431,7 +431,7 @@ static CURLcode ldap_done(struct connectdata *conn, CURLcode res,
777 ldap_abandon_ext(li->ld, lr->msgid, NULL, NULL);
778 lr->msgid = 0;
779 }
780- conn->data->req.protop = NULL;
781+ conn->data->req.p.ldap = NULL;
782 free(lr);
783 }
784
785@@ -443,7 +443,7 @@ static ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf,
786 {
787 struct ldapconninfo *li = conn->proto.ldapc;
788 struct Curl_easy *data = conn->data;
789- struct ldapreqinfo *lr = data->req.protop;
790+ struct ldapreqinfo *lr = data->req.p.ldap;
791 int rc, ret;
792 LDAPMessage *msg = NULL;
793 LDAPMessage *ent;
794diff --git a/lib/pop3.c b/lib/pop3.c
795index 9ff5c78..04cc887 100644
796--- a/lib/pop3.c
797+++ b/lib/pop3.c
798@@ -551,7 +551,7 @@ static CURLcode pop3_perform_command(struct connectdata *conn)
799 {
800 CURLcode result = CURLE_OK;
801 struct Curl_easy *data = conn->data;
802- struct POP3 *pop3 = data->req.protop;
803+ struct POP3 *pop3 = data->req.p.pop3;
804 const char *command = NULL;
805
806 /* Calculate the default command */
807@@ -884,7 +884,7 @@ static CURLcode pop3_state_command_resp(struct connectdata *conn,
808 {
809 CURLcode result = CURLE_OK;
810 struct Curl_easy *data = conn->data;
811- struct POP3 *pop3 = data->req.protop;
812+ struct POP3 *pop3 = data->req.p.pop3;
813 struct pop3_conn *pop3c = &conn->proto.pop3c;
814 struct pingpong *pp = &pop3c->pp;
815
816@@ -1046,7 +1046,7 @@ static CURLcode pop3_init(struct connectdata *conn)
817 struct Curl_easy *data = conn->data;
818 struct POP3 *pop3;
819
820- pop3 = data->req.protop = calloc(sizeof(struct POP3), 1);
821+ pop3 = data->req.p.pop3 = calloc(sizeof(struct POP3), 1);
822 if(!pop3)
823 result = CURLE_OUT_OF_MEMORY;
824
825@@ -1120,7 +1120,7 @@ static CURLcode pop3_done(struct connectdata *conn, CURLcode status,
826 {
827 CURLcode result = CURLE_OK;
828 struct Curl_easy *data = conn->data;
829- struct POP3 *pop3 = data->req.protop;
830+ struct POP3 *pop3 = data->req.p.pop3;
831
832 (void)premature;
833
834@@ -1154,7 +1154,7 @@ static CURLcode pop3_perform(struct connectdata *conn, bool *connected,
835 {
836 /* This is POP3 and no proxy */
837 CURLcode result = CURLE_OK;
838- struct POP3 *pop3 = conn->data->req.protop;
839+ struct POP3 *pop3 = conn->data->req.p.pop3;
840
841 DEBUGF(infof(conn->data, "DO phase starts\n"));
842
843@@ -1386,7 +1386,7 @@ static CURLcode pop3_parse_url_path(struct connectdata *conn)
844 {
845 /* The POP3 struct is already initialised in pop3_connect() */
846 struct Curl_easy *data = conn->data;
847- struct POP3 *pop3 = data->req.protop;
848+ struct POP3 *pop3 = data->req.p.pop3;
849 const char *path = &data->state.up.path[1]; /* skip leading path */
850
851 /* URL decode the path for the message ID */
852@@ -1403,7 +1403,7 @@ static CURLcode pop3_parse_custom_request(struct connectdata *conn)
853 {
854 CURLcode result = CURLE_OK;
855 struct Curl_easy *data = conn->data;
856- struct POP3 *pop3 = data->req.protop;
857+ struct POP3 *pop3 = data->req.p.pop3;
858 const char *custom = data->set.str[STRING_CUSTOMREQUEST];
859
860 /* URL decode the custom request */
861diff --git a/lib/rtsp.c b/lib/rtsp.c
862index dbd7dc6..29e6d58 100644
863--- a/lib/rtsp.c
864+++ b/lib/rtsp.c
865@@ -114,7 +114,7 @@ static CURLcode rtsp_setup_connection(struct connectdata *conn)
866 {
867 struct RTSP *rtsp;
868
869- conn->data->req.protop = rtsp = calloc(1, sizeof(struct RTSP));
870+ conn->data->req.p.rtsp = rtsp = calloc(1, sizeof(struct RTSP));
871 if(!rtsp)
872 return CURLE_OUT_OF_MEMORY;
873
874@@ -199,7 +199,7 @@ static CURLcode rtsp_done(struct connectdata *conn,
875 CURLcode status, bool premature)
876 {
877 struct Curl_easy *data = conn->data;
878- struct RTSP *rtsp = data->req.protop;
879+ struct RTSP *rtsp = data->req.p.rtsp;
880 CURLcode httpStatus;
881
882 /* Bypass HTTP empty-reply checks on receive */
883@@ -232,7 +232,7 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
884 struct Curl_easy *data = conn->data;
885 CURLcode result = CURLE_OK;
886 Curl_RtspReq rtspreq = data->set.rtspreq;
887- struct RTSP *rtsp = data->req.protop;
888+ struct RTSP *rtsp = data->req.p.rtsp;
889 struct dynbuf req_buffer;
890 curl_off_t postsize = 0; /* for ANNOUNCE and SET_PARAMETER */
891 curl_off_t putsize = 0; /* for ANNOUNCE and SET_PARAMETER */
892@@ -764,7 +764,7 @@ CURLcode Curl_rtsp_parseheader(struct connectdata *conn,
893 /* Store the received CSeq. Match is verified in rtsp_done */
894 int nc = sscanf(&header[4], ": %ld", &CSeq);
895 if(nc == 1) {
896- struct RTSP *rtsp = data->req.protop;
897+ struct RTSP *rtsp = data->req.p.rtsp;
898 rtsp->CSeq_recv = CSeq; /* mark the request */
899 data->state.rtsp_CSeq_recv = CSeq; /* update the handle */
900 }
901diff --git a/lib/smb.c b/lib/smb.c
902index d493adc..9eba7ab 100644
903--- a/lib/smb.c
904+++ b/lib/smb.c
905@@ -204,7 +204,7 @@ static void conn_state(struct connectdata *conn, enum smb_conn_state newstate)
906 static void request_state(struct connectdata *conn,
907 enum smb_req_state newstate)
908 {
909- struct smb_request *req = conn->data->req.protop;
910+ struct smb_request *req = conn->data->req.p.smb;
911 #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
912 /* For debug purposes */
913 static const char * const names[] = {
914@@ -234,7 +234,7 @@ static CURLcode smb_setup_connection(struct connectdata *conn)
915 struct smb_request *req;
916
917 /* Initialize the request state */
918- conn->data->req.protop = req = calloc(1, sizeof(struct smb_request));
919+ conn->data->req.p.smb = req = calloc(1, sizeof(struct smb_request));
920 if(!req)
921 return CURLE_OUT_OF_MEMORY;
922
923@@ -342,7 +342,7 @@ static void smb_format_message(struct connectdata *conn, struct smb_header *h,
924 unsigned char cmd, size_t len)
925 {
926 struct smb_conn *smbc = &conn->proto.smbc;
927- struct smb_request *req = conn->data->req.protop;
928+ struct smb_request *req = conn->data->req.p.smb;
929 unsigned int pid;
930
931 memset(h, 0, sizeof(*h));
932@@ -505,7 +505,7 @@ static CURLcode smb_send_tree_connect(struct connectdata *conn)
933
934 static CURLcode smb_send_open(struct connectdata *conn)
935 {
936- struct smb_request *req = conn->data->req.protop;
937+ struct smb_request *req = conn->data->req.p.smb;
938 struct smb_nt_create msg;
939 size_t byte_count;
940
941@@ -535,7 +535,7 @@ static CURLcode smb_send_open(struct connectdata *conn)
942
943 static CURLcode smb_send_close(struct connectdata *conn)
944 {
945- struct smb_request *req = conn->data->req.protop;
946+ struct smb_request *req = conn->data->req.p.smb;
947 struct smb_close msg;
948
949 memset(&msg, 0, sizeof(msg));
950@@ -556,7 +556,7 @@ static CURLcode smb_send_tree_disconnect(struct connectdata *conn)
951
952 static CURLcode smb_send_read(struct connectdata *conn)
953 {
954- struct smb_request *req = conn->data->req.protop;
955+ struct smb_request *req = conn->data->req.p.smb;
956 curl_off_t offset = conn->data->req.offset;
957 struct smb_read msg;
958
959@@ -575,7 +575,7 @@ static CURLcode smb_send_read(struct connectdata *conn)
960 static CURLcode smb_send_write(struct connectdata *conn)
961 {
962 struct smb_write *msg;
963- struct smb_request *req = conn->data->req.protop;
964+ struct smb_request *req = conn->data->req.p.smb;
965 curl_off_t offset = conn->data->req.offset;
966 curl_off_t upload_size = conn->data->req.size - conn->data->req.bytecount;
967 CURLcode result = Curl_get_upload_buffer(conn->data);
968@@ -738,7 +738,7 @@ static void get_posix_time(time_t *out, curl_off_t timestamp)
969
970 static CURLcode smb_request_state(struct connectdata *conn, bool *done)
971 {
972- struct smb_request *req = conn->data->req.protop;
973+ struct smb_request *req = conn->data->req.p.smb;
974 struct smb_header *h;
975 struct smb_conn *smbc = &conn->proto.smbc;
976 enum smb_req_state next_state = SMB_DONE;
977@@ -923,7 +923,7 @@ static CURLcode smb_done(struct connectdata *conn, CURLcode status,
978 bool premature)
979 {
980 (void) premature;
981- Curl_safefree(conn->data->req.protop);
982+ Curl_safefree(conn->data->req.p.smb);
983 return status;
984 }
985
986@@ -957,7 +957,7 @@ static CURLcode smb_do(struct connectdata *conn, bool *done)
987 static CURLcode smb_parse_url_path(struct connectdata *conn)
988 {
989 struct Curl_easy *data = conn->data;
990- struct smb_request *req = data->req.protop;
991+ struct smb_request *req = data->req.p.smb;
992 struct smb_conn *smbc = &conn->proto.smbc;
993 char *path;
994 char *slash;
995diff --git a/lib/smtp.c b/lib/smtp.c
996index aea41bb..c5d0296 100644
997--- a/lib/smtp.c
998+++ b/lib/smtp.c
999@@ -484,7 +484,7 @@ static CURLcode smtp_perform_command(struct connectdata *conn)
1000 {
1001 CURLcode result = CURLE_OK;
1002 struct Curl_easy *data = conn->data;
1003- struct SMTP *smtp = data->req.protop;
1004+ struct SMTP *smtp = data->req.p.smtp;
1005
1006 if(smtp->rcpt) {
1007 /* We notify the server we are sending UTF-8 data if a) it supports the
1008@@ -697,7 +697,7 @@ static CURLcode smtp_perform_mail(struct connectdata *conn)
1009 any there do, as we need to correctly identify our support for SMTPUTF8
1010 in the envelope, as per RFC-6531 sect. 3.4 */
1011 if(conn->proto.smtpc.utf8_supported && !utf8) {
1012- struct SMTP *smtp = data->req.protop;
1013+ struct SMTP *smtp = data->req.p.smtp;
1014 struct curl_slist *rcpt = smtp->rcpt;
1015
1016 while(rcpt && !utf8) {
1017@@ -741,7 +741,7 @@ static CURLcode smtp_perform_rcpt_to(struct connectdata *conn)
1018 {
1019 CURLcode result = CURLE_OK;
1020 struct Curl_easy *data = conn->data;
1021- struct SMTP *smtp = data->req.protop;
1022+ struct SMTP *smtp = data->req.p.smtp;
1023 char *address = NULL;
1024 struct hostname host = { NULL, NULL, NULL, NULL };
1025
1026@@ -989,7 +989,7 @@ static CURLcode smtp_state_command_resp(struct connectdata *conn, int smtpcode,
1027 {
1028 CURLcode result = CURLE_OK;
1029 struct Curl_easy *data = conn->data;
1030- struct SMTP *smtp = data->req.protop;
1031+ struct SMTP *smtp = data->req.p.smtp;
1032 char *line = data->state.buffer;
1033 size_t len = strlen(line);
1034
1035@@ -1055,7 +1055,7 @@ static CURLcode smtp_state_rcpt_resp(struct connectdata *conn, int smtpcode,
1036 {
1037 CURLcode result = CURLE_OK;
1038 struct Curl_easy *data = conn->data;
1039- struct SMTP *smtp = data->req.protop;
1040+ struct SMTP *smtp = data->req.p.smtp;
1041 bool is_smtp_err = FALSE;
1042 bool is_smtp_blocking_err = FALSE;
1043
1044@@ -1278,7 +1278,7 @@ static CURLcode smtp_init(struct connectdata *conn)
1045 struct Curl_easy *data = conn->data;
1046 struct SMTP *smtp;
1047
1048- smtp = data->req.protop = calloc(sizeof(struct SMTP), 1);
1049+ smtp = data->req.p.smtp = calloc(sizeof(struct SMTP), 1);
1050 if(!smtp)
1051 result = CURLE_OUT_OF_MEMORY;
1052
1053@@ -1356,7 +1356,7 @@ static CURLcode smtp_done(struct connectdata *conn, CURLcode status,
1054 {
1055 CURLcode result = CURLE_OK;
1056 struct Curl_easy *data = conn->data;
1057- struct SMTP *smtp = data->req.protop;
1058+ struct SMTP *smtp = data->req.p.smtp;
1059 struct pingpong *pp = &conn->proto.smtpc.pp;
1060 char *eob;
1061 ssize_t len;
1062@@ -1442,7 +1442,7 @@ static CURLcode smtp_perform(struct connectdata *conn, bool *connected,
1063 /* This is SMTP and no proxy */
1064 CURLcode result = CURLE_OK;
1065 struct Curl_easy *data = conn->data;
1066- struct SMTP *smtp = data->req.protop;
1067+ struct SMTP *smtp = data->req.p.smtp;
1068
1069 DEBUGF(infof(conn->data, "DO phase starts\n"));
1070
1071@@ -1550,7 +1550,7 @@ static CURLcode smtp_disconnect(struct connectdata *conn, bool dead_connection)
1072 /* Call this when the DO phase has completed */
1073 static CURLcode smtp_dophase_done(struct connectdata *conn, bool connected)
1074 {
1075- struct SMTP *smtp = conn->data->req.protop;
1076+ struct SMTP *smtp = conn->data->req.p.smtp;
1077
1078 (void)connected;
1079
1080@@ -1703,7 +1703,7 @@ static CURLcode smtp_parse_custom_request(struct connectdata *conn)
1081 {
1082 CURLcode result = CURLE_OK;
1083 struct Curl_easy *data = conn->data;
1084- struct SMTP *smtp = data->req.protop;
1085+ struct SMTP *smtp = data->req.p.smtp;
1086 const char *custom = data->set.str[STRING_CUSTOMREQUEST];
1087
1088 /* URL decode the custom request */
1089@@ -1796,7 +1796,7 @@ CURLcode Curl_smtp_escape_eob(struct connectdata *conn, const ssize_t nread)
1090 ssize_t i;
1091 ssize_t si;
1092 struct Curl_easy *data = conn->data;
1093- struct SMTP *smtp = data->req.protop;
1094+ struct SMTP *smtp = data->req.p.smtp;
1095 char *scratch = data->state.scratch;
1096 char *newscratch = NULL;
1097 char *oldscratch = NULL;
1098diff --git a/lib/telnet.c b/lib/telnet.c
1099index c3b58e5..1fc5af1 100644
1100--- a/lib/telnet.c
1101+++ b/lib/telnet.c
1102@@ -247,7 +247,7 @@ CURLcode init_telnet(struct connectdata *conn)
1103 if(!tn)
1104 return CURLE_OUT_OF_MEMORY;
1105
1106- conn->data->req.protop = tn; /* make us known */
1107+ conn->data->req.p.telnet = tn; /* make us known */
1108
1109 tn->telrcv_state = CURL_TS_DATA;
1110
1111@@ -292,7 +292,7 @@ CURLcode init_telnet(struct connectdata *conn)
1112 static void negotiate(struct connectdata *conn)
1113 {
1114 int i;
1115- struct TELNET *tn = (struct TELNET *) conn->data->req.protop;
1116+ struct TELNET *tn = (struct TELNET *) conn->data->req.p.telnet;
1117
1118 for(i = 0; i < CURL_NTELOPTS; i++) {
1119 if(i == CURL_TELOPT_ECHO)
1120@@ -365,7 +365,7 @@ static void send_negotiation(struct connectdata *conn, int cmd, int option)
1121 static
1122 void set_remote_option(struct connectdata *conn, int option, int newstate)
1123 {
1124- struct TELNET *tn = (struct TELNET *)conn->data->req.protop;
1125+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
1126 if(newstate == CURL_YES) {
1127 switch(tn->him[option]) {
1128 case CURL_NO:
1129@@ -439,7 +439,7 @@ void set_remote_option(struct connectdata *conn, int option, int newstate)
1130 static
1131 void rec_will(struct connectdata *conn, int option)
1132 {
1133- struct TELNET *tn = (struct TELNET *)conn->data->req.protop;
1134+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
1135 switch(tn->him[option]) {
1136 case CURL_NO:
1137 if(tn->him_preferred[option] == CURL_YES) {
1138@@ -487,7 +487,7 @@ void rec_will(struct connectdata *conn, int option)
1139 static
1140 void rec_wont(struct connectdata *conn, int option)
1141 {
1142- struct TELNET *tn = (struct TELNET *)conn->data->req.protop;
1143+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
1144 switch(tn->him[option]) {
1145 case CURL_NO:
1146 /* Already disabled */
1147@@ -529,7 +529,7 @@ void rec_wont(struct connectdata *conn, int option)
1148 static void
1149 set_local_option(struct connectdata *conn, int option, int newstate)
1150 {
1151- struct TELNET *tn = (struct TELNET *)conn->data->req.protop;
1152+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
1153 if(newstate == CURL_YES) {
1154 switch(tn->us[option]) {
1155 case CURL_NO:
1156@@ -603,7 +603,7 @@ set_local_option(struct connectdata *conn, int option, int newstate)
1157 static
1158 void rec_do(struct connectdata *conn, int option)
1159 {
1160- struct TELNET *tn = (struct TELNET *)conn->data->req.protop;
1161+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
1162 switch(tn->us[option]) {
1163 case CURL_NO:
1164 if(tn->us_preferred[option] == CURL_YES) {
1165@@ -663,7 +663,7 @@ void rec_do(struct connectdata *conn, int option)
1166 static
1167 void rec_dont(struct connectdata *conn, int option)
1168 {
1169- struct TELNET *tn = (struct TELNET *)conn->data->req.protop;
1170+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
1171 switch(tn->us[option]) {
1172 case CURL_NO:
1173 /* Already disabled */
1174@@ -822,7 +822,7 @@ static CURLcode check_telnet_options(struct connectdata *conn)
1175 char option_keyword[128] = "";
1176 char option_arg[256] = "";
1177 struct Curl_easy *data = conn->data;
1178- struct TELNET *tn = (struct TELNET *)conn->data->req.protop;
1179+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
1180 CURLcode result = CURLE_OK;
1181 int binary_option;
1182
1183@@ -929,7 +929,7 @@ static void suboption(struct connectdata *conn)
1184 char varname[128] = "";
1185 char varval[128] = "";
1186 struct Curl_easy *data = conn->data;
1187- struct TELNET *tn = (struct TELNET *)data->req.protop;
1188+ struct TELNET *tn = (struct TELNET *)data->req.p.telnet;
1189
1190 printsub(data, '<', (unsigned char *)tn->subbuffer, CURL_SB_LEN(tn) + 2);
1191 switch(CURL_SB_GET(tn)) {
1192@@ -1004,7 +1004,7 @@ static void sendsuboption(struct connectdata *conn, int option)
1193 unsigned char *uc1, *uc2;
1194
1195 struct Curl_easy *data = conn->data;
1196- struct TELNET *tn = (struct TELNET *)data->req.protop;
1197+ struct TELNET *tn = (struct TELNET *)data->req.p.telnet;
1198
1199 switch(option) {
1200 case CURL_TELOPT_NAWS:
1201@@ -1062,7 +1062,7 @@ CURLcode telrcv(struct connectdata *conn,
1202 int in = 0;
1203 int startwrite = -1;
1204 struct Curl_easy *data = conn->data;
1205- struct TELNET *tn = (struct TELNET *)data->req.protop;
1206+ struct TELNET *tn = (struct TELNET *)data->req.p.telnet;
1207
1208 #define startskipping() \
1209 if(startwrite >= 0) { \
1210@@ -1280,7 +1280,7 @@ static CURLcode send_telnet_data(struct connectdata *conn,
1211 static CURLcode telnet_done(struct connectdata *conn,
1212 CURLcode status, bool premature)
1213 {
1214- struct TELNET *tn = (struct TELNET *)conn->data->req.protop;
1215+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
1216 (void)status; /* unused */
1217 (void)premature; /* not used */
1218
1219@@ -1290,7 +1290,7 @@ static CURLcode telnet_done(struct connectdata *conn,
1220 curl_slist_free_all(tn->telnet_vars);
1221 tn->telnet_vars = NULL;
1222
1223- Curl_safefree(conn->data->req.protop);
1224+ Curl_safefree(conn->data->req.p.telnet);
1225
1226 return CURLE_OK;
1227 }
1228@@ -1333,7 +1333,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
1229 if(result)
1230 return result;
1231
1232- tn = (struct TELNET *)data->req.protop;
1233+ tn = data->req.p.telnet;
1234
1235 result = check_telnet_options(conn);
1236 if(result)
1237diff --git a/lib/transfer.c b/lib/transfer.c
1238index a07c7af..4630609 100644
1239--- a/lib/transfer.c
1240+++ b/lib/transfer.c
1241@@ -167,7 +167,7 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, size_t bytes,
1242 bool sending_http_headers = FALSE;
1243
1244 if(conn->handler->protocol&(PROTO_FAMILY_HTTP|CURLPROTO_RTSP)) {
1245- const struct HTTP *http = data->req.protop;
1246+ const struct HTTP *http = data->req.p.http;
1247
1248 if(http->sending == HTTPSEND_REQUEST)
1249 /* We're sending the HTTP request headers, not the data.
1250@@ -426,7 +426,7 @@ CURLcode Curl_readrewind(struct connectdata *conn)
1251 CURLOPT_HTTPPOST, call app to rewind
1252 */
1253 if(conn->handler->protocol & PROTO_FAMILY_HTTP) {
1254- struct HTTP *http = data->req.protop;
1255+ struct HTTP *http = data->req.p.http;
1256
1257 if(http->sendit)
1258 mimepart = http->sendit;
1259@@ -1028,7 +1028,7 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
1260 /* HTTP pollution, this should be written nicer to become more
1261 protocol agnostic. */
1262 size_t fillcount;
1263- struct HTTP *http = k->protop;
1264+ struct HTTP *http = k->p.http;
1265
1266 if((k->exp100 == EXP100_SENDING_REQUEST) &&
1267 (http->sending == HTTPSEND_BODY)) {
1268@@ -1853,7 +1853,7 @@ Curl_setup_transfer(
1269 {
1270 struct SingleRequest *k = &data->req;
1271 struct connectdata *conn = data->conn;
1272- struct HTTP *http = data->req.protop;
1273+ struct HTTP *http = data->req.p.http;
1274 bool httpsending = ((conn->handler->protocol&PROTO_FAMILY_HTTP) &&
1275 (http->sending == HTTPSEND_REQUEST));
1276 DEBUGASSERT(conn != NULL);
1277diff --git a/lib/url.c b/lib/url.c
1278index 150667a..849d527 100644
1279--- a/lib/url.c
1280+++ b/lib/url.c
1281@@ -2060,7 +2060,7 @@ static CURLcode setup_connection_internals(struct connectdata *conn)
1282
1283 void Curl_free_request_state(struct Curl_easy *data)
1284 {
1285- Curl_safefree(data->req.protop);
1286+ Curl_safefree(data->req.p.http);
1287 Curl_safefree(data->req.newurl);
1288
1289 #ifndef CURL_DISABLE_DOH
1290diff --git a/lib/urldata.h b/lib/urldata.h
1291index 0ae9269..76baee3 100644
1292--- a/lib/urldata.h
1293+++ b/lib/urldata.h
1294@@ -645,8 +645,23 @@ struct SingleRequest {
1295 and the 'upload_present' contains the number of bytes available at this
1296 position */
1297 char *upload_fromhere;
1298- void *protop; /* Allocated protocol-specific data. Each protocol
1299- handler makes sure this points to data it needs. */
1300+
1301+ /* Allocated protocol-specific data. Each protocol handler makes sure this
1302+ points to data it needs. */
1303+ union {
1304+ struct FILEPROTO *file;
1305+ struct FTP *ftp;
1306+ struct HTTP *http;
1307+ struct IMAP *imap;
1308+ struct ldapreqinfo *ldap;
1309+ struct MQTT *mqtt;
1310+ struct POP3 *pop3;
1311+ struct RTSP *rtsp;
1312+ struct smb_request *smb;
1313+ struct SMTP *smtp;
1314+ struct SSHPROTO *ssh;
1315+ struct TELNET *telnet;
1316+ } p;
1317 #ifndef CURL_DISABLE_DOH
1318 struct dohdata doh; /* DoH specific data for this request */
1319 #endif
1320diff --git a/lib/vquic/ngtcp2.c b/lib/vquic/ngtcp2.c
1321index 20ee08d..18eeda8 100644
1322--- a/lib/vquic/ngtcp2.c
1323+++ b/lib/vquic/ngtcp2.c
1324@@ -962,7 +962,7 @@ static int cb_h3_stream_close(nghttp3_conn *conn, int64_t stream_id,
1325 void *stream_user_data)
1326 {
1327 struct Curl_easy *data = stream_user_data;
1328- struct HTTP *stream = data->req.protop;
1329+ struct HTTP *stream = data->req.p.http;
1330 (void)conn;
1331 (void)stream_id;
1332 (void)app_error_code;
1333@@ -1008,7 +1008,7 @@ static int cb_h3_recv_data(nghttp3_conn *conn, int64_t stream_id,
1334 void *user_data, void *stream_user_data)
1335 {
1336 struct Curl_easy *data = stream_user_data;
1337- struct HTTP *stream = data->req.protop;
1338+ struct HTTP *stream = data->req.p.http;
1339 CURLcode result = CURLE_OK;
1340 (void)conn;
1341
1342@@ -1067,7 +1067,7 @@ static int cb_h3_end_headers(nghttp3_conn *conn, int64_t stream_id,
1343 void *user_data, void *stream_user_data)
1344 {
1345 struct Curl_easy *data = stream_user_data;
1346- struct HTTP *stream = data->req.protop;
1347+ struct HTTP *stream = data->req.p.http;
1348 CURLcode result = CURLE_OK;
1349 (void)conn;
1350 (void)stream_id;
1351@@ -1091,7 +1091,7 @@ static int cb_h3_recv_header(nghttp3_conn *conn, int64_t stream_id,
1352 nghttp3_vec h3name = nghttp3_rcbuf_get_buf(name);
1353 nghttp3_vec h3val = nghttp3_rcbuf_get_buf(value);
1354 struct Curl_easy *data = stream_user_data;
1355- struct HTTP *stream = data->req.protop;
1356+ struct HTTP *stream = data->req.p.http;
1357 CURLcode result = CURLE_OK;
1358 (void)conn;
1359 (void)stream_id;
1360@@ -1255,7 +1255,7 @@ static ssize_t ngh3_stream_recv(struct connectdata *conn,
1361 CURLcode *curlcode)
1362 {
1363 curl_socket_t sockfd = conn->sock[sockindex];
1364- struct HTTP *stream = conn->data->req.protop;
1365+ struct HTTP *stream = conn->data->req.p.http;
1366 struct quicsocket *qs = conn->quic;
1367
1368 if(!stream->memlen) {
1369@@ -1313,7 +1313,7 @@ static int cb_h3_acked_stream_data(nghttp3_conn *conn, int64_t stream_id,
1370 void *stream_user_data)
1371 {
1372 struct Curl_easy *data = stream_user_data;
1373- struct HTTP *stream = data->req.protop;
1374+ struct HTTP *stream = data->req.p.http;
1375 (void)conn;
1376 (void)stream_id;
1377 (void)user_data;
1378@@ -1335,7 +1335,7 @@ static ssize_t cb_h3_readfunction(nghttp3_conn *conn, int64_t stream_id,
1379 {
1380 struct Curl_easy *data = stream_user_data;
1381 size_t nread;
1382- struct HTTP *stream = data->req.protop;
1383+ struct HTTP *stream = data->req.p.http;
1384 (void)conn;
1385 (void)stream_id;
1386 (void)user_data;
1387@@ -1398,7 +1398,7 @@ static ssize_t cb_h3_readfunction(nghttp3_conn *conn, int64_t stream_id,
1388 static CURLcode http_request(struct connectdata *conn, const void *mem,
1389 size_t len)
1390 {
1391- struct HTTP *stream = conn->data->req.protop;
1392+ struct HTTP *stream = conn->data->req.p.http;
1393 size_t nheader;
1394 size_t i;
1395 size_t authority_idx;
1396@@ -1641,7 +1641,7 @@ static ssize_t ngh3_stream_send(struct connectdata *conn,
1397 ssize_t sent;
1398 struct quicsocket *qs = conn->quic;
1399 curl_socket_t sockfd = conn->sock[sockindex];
1400- struct HTTP *stream = conn->data->req.protop;
1401+ struct HTTP *stream = conn->data->req.p.http;
1402
1403 if(!stream->h3req) {
1404 CURLcode result = http_request(conn, mem, len);
1405@@ -1909,7 +1909,7 @@ CURLcode Curl_quic_done_sending(struct connectdata *conn)
1406 {
1407 if(conn->handler == &Curl_handler_http3) {
1408 /* only for HTTP/3 transfers */
1409- struct HTTP *stream = conn->data->req.protop;
1410+ struct HTTP *stream = conn->data->req.p.http;
1411 struct quicsocket *qs = conn->quic;
1412 stream->upload_done = TRUE;
1413 (void)nghttp3_conn_resume_stream(qs->h3conn, stream->stream3_id);
1414@@ -1926,7 +1926,7 @@ void Curl_quic_done(struct Curl_easy *data, bool premature)
1415 (void)premature;
1416 if(data->conn->handler == &Curl_handler_http3) {
1417 /* only for HTTP/3 transfers */
1418- struct HTTP *stream = data->req.protop;
1419+ struct HTTP *stream = data->req.p.http;
1420 Curl_dyn_free(&stream->overflow);
1421 }
1422 }
1423@@ -1941,7 +1941,7 @@ bool Curl_quic_data_pending(const struct Curl_easy *data)
1424 buffer and allocated an overflow buffer. Since it's possible that
1425 there's no more data coming on the socket, we need to keep reading
1426 until the overflow buffer is empty. */
1427- const struct HTTP *stream = data->req.protop;
1428+ const struct HTTP *stream = data->req.p.http;
1429 return Curl_dyn_len(&stream->overflow) > 0;
1430 }
1431
1432diff --git a/lib/vquic/quiche.c b/lib/vquic/quiche.c
1433index fd9cb8b..c0e250d 100644
1434--- a/lib/vquic/quiche.c
1435+++ b/lib/vquic/quiche.c
1436@@ -131,7 +131,7 @@ static unsigned int quiche_conncheck(struct connectdata *conn,
1437
1438 static CURLcode quiche_do(struct connectdata *conn, bool *done)
1439 {
1440- struct HTTP *stream = conn->data->req.protop;
1441+ struct HTTP *stream = conn->data->req.p.http;
1442 stream->h3req = FALSE; /* not sent */
1443 return Curl_http(conn, done);
1444 }
1445@@ -460,7 +460,7 @@ static ssize_t h3_stream_recv(struct connectdata *conn,
1446 int rc;
1447 struct h3h1header headers;
1448 struct Curl_easy *data = conn->data;
1449- struct HTTP *stream = data->req.protop;
1450+ struct HTTP *stream = data->req.p.http;
1451 headers.dest = buf;
1452 headers.destlen = buffersize;
1453 headers.nlen = 0;
1454@@ -548,7 +548,7 @@ static ssize_t h3_stream_send(struct connectdata *conn,
1455 ssize_t sent;
1456 struct quicsocket *qs = conn->quic;
1457 curl_socket_t sockfd = conn->sock[sockindex];
1458- struct HTTP *stream = conn->data->req.protop;
1459+ struct HTTP *stream = conn->data->req.p.http;
1460
1461 if(!stream->h3req) {
1462 CURLcode result = http_request(conn, mem, len);
1463@@ -596,7 +596,7 @@ static CURLcode http_request(struct connectdata *conn, const void *mem,
1464 {
1465 /*
1466 */
1467- struct HTTP *stream = conn->data->req.protop;
1468+ struct HTTP *stream = conn->data->req.p.http;
1469 size_t nheader;
1470 size_t i;
1471 size_t authority_idx;
1472@@ -824,7 +824,7 @@ CURLcode Curl_quic_done_sending(struct connectdata *conn)
1473 if(conn->handler == &Curl_handler_http3) {
1474 /* only for HTTP/3 transfers */
1475 ssize_t sent;
1476- struct HTTP *stream = conn->data->req.protop;
1477+ struct HTTP *stream = conn->data->req.p.http;
1478 struct quicsocket *qs = conn->quic;
1479 fprintf(stderr, "!!! Curl_quic_done_sending\n");
1480 stream->upload_done = TRUE;
1481diff --git a/lib/vssh/libssh.c b/lib/vssh/libssh.c
1482index 8988e23..a84e1bf 100644
1483--- a/lib/vssh/libssh.c
1484+++ b/lib/vssh/libssh.c
1485@@ -662,7 +662,7 @@ static CURLcode myssh_statemach_act(struct connectdata *conn, bool *block)
1486 {
1487 CURLcode result = CURLE_OK;
1488 struct Curl_easy *data = conn->data;
1489- struct SSHPROTO *protop = data->req.protop;
1490+ struct SSHPROTO *protop = data->req.p.ssh;
1491 struct ssh_conn *sshc = &conn->proto.sshc;
1492 curl_socket_t sock = conn->sock[FIRSTSOCKET];
1493 int rc = SSH_NO_ERROR, err;
1494@@ -2129,7 +2129,7 @@ static CURLcode myssh_setup_connection(struct connectdata *conn)
1495 {
1496 struct SSHPROTO *ssh;
1497
1498- conn->data->req.protop = ssh = calloc(1, sizeof(struct SSHPROTO));
1499+ conn->data->req.p.ssh = ssh = calloc(1, sizeof(struct SSHPROTO));
1500 if(!ssh)
1501 return CURLE_OUT_OF_MEMORY;
1502
1503@@ -2152,7 +2152,7 @@ static CURLcode myssh_connect(struct connectdata *conn, bool *done)
1504 int rc;
1505
1506 /* initialize per-handle data if not already */
1507- if(!data->req.protop)
1508+ if(!data->req.p.ssh)
1509 myssh_setup_connection(conn);
1510
1511 /* We default to persistent connections. We set this already in this connect
1512@@ -2353,7 +2353,7 @@ static CURLcode scp_disconnect(struct connectdata *conn,
1513 static CURLcode myssh_done(struct connectdata *conn, CURLcode status)
1514 {
1515 CURLcode result = CURLE_OK;
1516- struct SSHPROTO *protop = conn->data->req.protop;
1517+ struct SSHPROTO *protop = conn->data->req.p.ssh;
1518
1519 if(!status) {
1520 /* run the state-machine */
1521@@ -2606,7 +2606,7 @@ static void sftp_quote(struct connectdata *conn)
1522 {
1523 const char *cp;
1524 struct Curl_easy *data = conn->data;
1525- struct SSHPROTO *protop = data->req.protop;
1526+ struct SSHPROTO *protop = data->req.p.ssh;
1527 struct ssh_conn *sshc = &conn->proto.sshc;
1528 CURLcode result;
1529
1530diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c
1531index 4f56bb4..3ed777f 100644
1532--- a/lib/vssh/libssh2.c
1533+++ b/lib/vssh/libssh2.c
1534@@ -789,7 +789,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
1535 {
1536 CURLcode result = CURLE_OK;
1537 struct Curl_easy *data = conn->data;
1538- struct SSHPROTO *sftp_scp = data->req.protop;
1539+ struct SSHPROTO *sftp_scp = data->req.p.ssh;
1540 struct ssh_conn *sshc = &conn->proto.sshc;
1541 curl_socket_t sock = conn->sock[FIRSTSOCKET];
1542 int rc = LIBSSH2_ERROR_NONE;
1543@@ -2989,7 +2989,7 @@ static CURLcode ssh_setup_connection(struct connectdata *conn)
1544 {
1545 struct SSHPROTO *ssh;
1546
1547- conn->data->req.protop = ssh = calloc(1, sizeof(struct SSHPROTO));
1548+ conn->data->req.p.ssh = ssh = calloc(1, sizeof(struct SSHPROTO));
1549 if(!ssh)
1550 return CURLE_OUT_OF_MEMORY;
1551
1552@@ -3013,7 +3013,7 @@ static CURLcode ssh_connect(struct connectdata *conn, bool *done)
1553 struct Curl_easy *data = conn->data;
1554
1555 /* initialize per-handle data if not already */
1556- if(!data->req.protop)
1557+ if(!data->req.p.ssh)
1558 ssh_setup_connection(conn);
1559
1560 /* We default to persistent connections. We set this already in this connect
1561@@ -3192,7 +3192,7 @@ static CURLcode scp_disconnect(struct connectdata *conn, bool dead_connection)
1562 static CURLcode ssh_done(struct connectdata *conn, CURLcode status)
1563 {
1564 CURLcode result = CURLE_OK;
1565- struct SSHPROTO *sftp_scp = conn->data->req.protop;
1566+ struct SSHPROTO *sftp_scp = conn->data->req.p.ssh;
1567
1568 if(!status) {
1569 /* run the state-machine */
1570diff --git a/lib/vssh/wolfssh.c b/lib/vssh/wolfssh.c
1571index dcbbab6..1b990e3 100644
1572--- a/lib/vssh/wolfssh.c
1573+++ b/lib/vssh/wolfssh.c
1574@@ -322,7 +322,7 @@ static CURLcode wssh_setup_connection(struct connectdata *conn)
1575 {
1576 struct SSHPROTO *ssh;
1577
1578- conn->data->req.protop = ssh = calloc(1, sizeof(struct SSHPROTO));
1579+ conn->data->req.p.ssh = ssh = calloc(1, sizeof(struct SSHPROTO));
1580 if(!ssh)
1581 return CURLE_OUT_OF_MEMORY;
1582
1583@@ -356,7 +356,7 @@ static CURLcode wssh_connect(struct connectdata *conn, bool *done)
1584 int rc;
1585
1586 /* initialize per-handle data if not already */
1587- if(!data->req.protop)
1588+ if(!data->req.p.ssh)
1589 wssh_setup_connection(conn);
1590
1591 /* We default to persistent connections. We set this already in this connect
1592@@ -429,7 +429,7 @@ static CURLcode wssh_statemach_act(struct connectdata *conn, bool *block)
1593 CURLcode result = CURLE_OK;
1594 struct ssh_conn *sshc = &conn->proto.sshc;
1595 struct Curl_easy *data = conn->data;
1596- struct SSHPROTO *sftp_scp = data->req.protop;
1597+ struct SSHPROTO *sftp_scp = data->req.p.ssh;
1598 WS_SFTPNAME *name;
1599 int rc = 0;
1600 *block = FALSE; /* we're not blocking by default */
1601@@ -1027,7 +1027,7 @@ static CURLcode wssh_block_statemach(struct connectdata *conn,
1602 static CURLcode wssh_done(struct connectdata *conn, CURLcode status)
1603 {
1604 CURLcode result = CURLE_OK;
1605- struct SSHPROTO *sftp_scp = conn->data->req.protop;
1606+ struct SSHPROTO *sftp_scp = conn->data->req.p.ssh;
1607
1608 if(!status) {
1609 /* run the state-machine */
diff --git a/meta/recipes-support/curl/curl/CVE-2020-8284.patch b/meta/recipes-support/curl/curl/CVE-2020-8284.patch
new file mode 100644
index 0000000000..4ae514ffa8
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2020-8284.patch
@@ -0,0 +1,210 @@
1From ec9cc725d598ac77de7b6df8afeec292b3c8ad46 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Tue, 24 Nov 2020 14:56:57 +0100
4Subject: [PATCH] ftp: CURLOPT_FTP_SKIP_PASV_IP by default
5
6The command line tool also independently sets --ftp-skip-pasv-ip by
7default.
8
9Ten test cases updated to adapt the modified --libcurl output.
10
11Bug: https://curl.se/docs/CVE-2020-8284.html
12CVE-2020-8284
13
14Reported-by: Varnavas Papaioannou
15
16Upstream-Status: Backport [https://github.com/curl/curl/commit/ec9cc725d598ac]
17
18CVE: CVE-2020-8284
19
20Signed-off-by: Daniel Stenberg <daniel@haxx.se>
21Signed-off-by: Khairul Rohaizzat Jamaluddin <khairul.rohaizzat.jamaluddin@intel.com>
22---
23 docs/cmdline-opts/ftp-skip-pasv-ip.d | 2 ++
24 docs/libcurl/opts/CURLOPT_FTP_SKIP_PASV_IP.3 | 8 +++++---
25 lib/url.c | 1 +
26 src/tool_cfgable.c | 1 +
27 tests/data/test1400 | 1 +
28 tests/data/test1401 | 1 +
29 tests/data/test1402 | 1 +
30 tests/data/test1403 | 1 +
31 tests/data/test1404 | 1 +
32 tests/data/test1405 | 1 +
33 tests/data/test1406 | 1 +
34 tests/data/test1407 | 1 +
35 tests/data/test1420 | 1 +
36 14 files changed, 18 insertions(+), 3 deletions(-)
37
38diff --git a/docs/cmdline-opts/ftp-skip-pasv-ip.d b/docs/cmdline-opts/ftp-skip-pasv-ip.d
39index d6fd4589b1e..bcf4e7e62f2 100644
40--- a/docs/cmdline-opts/ftp-skip-pasv-ip.d
41+++ b/docs/cmdline-opts/ftp-skip-pasv-ip.d
42@@ -10,4 +10,6 @@ to curl's PASV command when curl connects the data connection. Instead curl
43 will re-use the same IP address it already uses for the control
44 connection.
45
46+Since curl 7.74.0 this option is enabled by default.
47+
48 This option has no effect if PORT, EPRT or EPSV is used instead of PASV.
49diff --git a/docs/libcurl/opts/CURLOPT_FTP_SKIP_PASV_IP.3 b/docs/libcurl/opts/CURLOPT_FTP_SKIP_PASV_IP.3
50index d6217d0d8ca..fa87ddce769 100644
51--- a/docs/libcurl/opts/CURLOPT_FTP_SKIP_PASV_IP.3
52+++ b/docs/libcurl/opts/CURLOPT_FTP_SKIP_PASV_IP.3
53@@ -5,7 +5,7 @@
54 .\" * | (__| |_| | _ <| |___
55 .\" * \___|\___/|_| \_\_____|
56 .\" *
57-.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
58+.\" * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
59 .\" *
60 .\" * This software is licensed as described in the file COPYING, which
61 .\" * you should have received as part of this distribution. The terms
62@@ -35,11 +35,13 @@ address it already uses for the control connection. But it will use the port
63 number from the 227-response.
64
65 This option thus allows libcurl to work around broken server installations
66-that due to NATs, firewalls or incompetence report the wrong IP address back.
67+that due to NATs, firewalls or incompetence report the wrong IP address
68+back. Setting the option also reduces the risk for various sorts of client
69+abuse by malicious servers.
70
71 This option has no effect if PORT, EPRT or EPSV is used instead of PASV.
72 .SH DEFAULT
73-0
74+1 since 7.74.0, was 0 before then.
75 .SH PROTOCOLS
76 FTP
77 .SH EXAMPLE
78diff --git a/lib/url.c b/lib/url.c
79index f8b2a0030de..2b0ba87ba87 100644
80--- a/lib/url.c
81+++ b/lib/url.c
82@@ -497,6 +497,7 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data)
83 set->ftp_use_eprt = TRUE; /* FTP defaults to EPRT operations */
84 set->ftp_use_pret = FALSE; /* mainly useful for drftpd servers */
85 set->ftp_filemethod = FTPFILE_MULTICWD;
86+ set->ftp_skip_ip = TRUE; /* skip PASV IP by default */
87 #endif
88 set->dns_cache_timeout = 60; /* Timeout every 60 seconds by default */
89
90diff --git a/src/tool_cfgable.c b/src/tool_cfgable.c
91index c52d8e1c6bb..4c06d3557b7 100644
92--- a/src/tool_cfgable.c
93+++ b/src/tool_cfgable.c
94@@ -44,6 +44,7 @@ void config_init(struct OperationConfig *config)
95 config->tcp_nodelay = TRUE; /* enabled by default */
96 config->happy_eyeballs_timeout_ms = CURL_HET_DEFAULT;
97 config->http09_allowed = FALSE;
98+ config->ftp_skip_ip = TRUE;
99 }
100
101 static void free_config_fields(struct OperationConfig *config)
102diff --git a/tests/data/test1400 b/tests/data/test1400
103index 812ad0b88d9..b7060eca58e 100644
104--- a/tests/data/test1400
105+++ b/tests/data/test1400
106@@ -73,6 +73,7 @@ int main(int argc, char *argv[])
107 curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
108 curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
109 curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
110+ curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
111 curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
112
113 /* Here is a list of options the curl code used that cannot get generated
114diff --git a/tests/data/test1401 b/tests/data/test1401
115index f93b3d637de..a2629683aff 100644
116--- a/tests/data/test1401
117+++ b/tests/data/test1401
118@@ -87,6 +87,7 @@ int main(int argc, char *argv[])
119 curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
120 curl_easy_setopt(hnd, CURLOPT_COOKIE, "chocolate=chip");
121 curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
122+ curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
123 curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
124 curl_easy_setopt(hnd, CURLOPT_PROTOCOLS, (long)CURLPROTO_FILE |
125 (long)CURLPROTO_FTP |
126diff --git a/tests/data/test1402 b/tests/data/test1402
127index 7593c516da1..1bd55cb4e3b 100644
128--- a/tests/data/test1402
129+++ b/tests/data/test1402
130@@ -78,6 +78,7 @@ int main(int argc, char *argv[])
131 curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
132 curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
133 curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
134+ curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
135 curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
136
137 /* Here is a list of options the curl code used that cannot get generated
138diff --git a/tests/data/test1403 b/tests/data/test1403
139index ecb4dd3dcab..a7c9fcca322 100644
140--- a/tests/data/test1403
141+++ b/tests/data/test1403
142@@ -73,6 +73,7 @@ int main(int argc, char *argv[])
143 curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
144 curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
145 curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
146+ curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
147 curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
148
149 /* Here is a list of options the curl code used that cannot get generated
150diff --git a/tests/data/test1404 b/tests/data/test1404
151index 97622b63948..1d8e8cf7779 100644
152--- a/tests/data/test1404
153+++ b/tests/data/test1404
154@@ -147,6 +147,7 @@ int main(int argc, char *argv[])
155 curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
156 curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
157 curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
158+ curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
159 curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
160
161 /* Here is a list of options the curl code used that cannot get generated
162diff --git a/tests/data/test1405 b/tests/data/test1405
163index 2bac79eda74..b4087704f7b 100644
164--- a/tests/data/test1405
165+++ b/tests/data/test1405
166@@ -89,6 +89,7 @@ int main(int argc, char *argv[])
167 curl_easy_setopt(hnd, CURLOPT_POSTQUOTE, slist2);
168 curl_easy_setopt(hnd, CURLOPT_PREQUOTE, slist3);
169 curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
170+ curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
171 curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
172
173 /* Here is a list of options the curl code used that cannot get generated
174diff --git a/tests/data/test1406 b/tests/data/test1406
175index 51a166adff2..38f68d11ee1 100644
176--- a/tests/data/test1406
177+++ b/tests/data/test1406
178@@ -79,6 +79,7 @@ int main(int argc, char *argv[])
179 curl_easy_setopt(hnd, CURLOPT_URL, "smtp://%HOSTIP:%SMTPPORT/1406");
180 curl_easy_setopt(hnd, CURLOPT_UPLOAD, 1L);
181 curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
182+ curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
183 curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
184 curl_easy_setopt(hnd, CURLOPT_MAIL_FROM, "sender@example.com");
185 curl_easy_setopt(hnd, CURLOPT_MAIL_RCPT, slist1);
186diff --git a/tests/data/test1407 b/tests/data/test1407
187index f6879008fb2..a7e13ba7585 100644
188--- a/tests/data/test1407
189+++ b/tests/data/test1407
190@@ -62,6 +62,7 @@ int main(int argc, char *argv[])
191 curl_easy_setopt(hnd, CURLOPT_DIRLISTONLY, 1L);
192 curl_easy_setopt(hnd, CURLOPT_USERPWD, "user:secret");
193 curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
194+ curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
195 curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
196
197 /* Here is a list of options the curl code used that cannot get generated
198diff --git a/tests/data/test1420 b/tests/data/test1420
199index 057ecc4773a..4b8d7bbf418 100644
200--- a/tests/data/test1420
201+++ b/tests/data/test1420
202@@ -67,6 +67,7 @@ int main(int argc, char *argv[])
203 curl_easy_setopt(hnd, CURLOPT_URL, "imap://%HOSTIP:%IMAPPORT/1420/;MAILINDEX=1");
204 curl_easy_setopt(hnd, CURLOPT_USERPWD, "user:secret");
205 curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
206+ curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
207 curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
208
209 /* Here is a list of options the curl code used that cannot get generated
210
diff --git a/meta/recipes-support/curl/curl/CVE-2020-8285.patch b/meta/recipes-support/curl/curl/CVE-2020-8285.patch
new file mode 100644
index 0000000000..8a0231ba84
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2020-8285.patch
@@ -0,0 +1,257 @@
1From 69a358f2186e04cf44698b5100332cbf1ee7f01d Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Sat, 28 Nov 2020 00:27:21 +0100
4Subject: [PATCH] ftp: make wc_statemach loop instead of recurse
5
6CVE-2020-8285
7
8Fixes #6255
9Bug: https://curl.se/docs/CVE-2020-8285.html
10Reported-by: xnynx on github
11
12Upstream-Status: Backport [https://github.com/curl/curl/commit/69a358f2186e04]
13
14CVE: CVE-2020-8285
15
16Signed-off-by: Daniel Stenberg <daniel@haxx.se>
17Signed-off-by: Khairul Rohaizzat Jamaluddin <khairul.rohaizzat.jamaluddin@intel.com>
18---
19 lib/ftp.c | 202 +++++++++++++++++++++++++++---------------------------
20 1 file changed, 102 insertions(+), 100 deletions(-)
21
22diff --git a/lib/ftp.c b/lib/ftp.c
23index 50e7d7ddac9..bc355742172 100644
24--- a/lib/ftp.c
25+++ b/lib/ftp.c
26@@ -3800,129 +3800,131 @@ static CURLcode init_wc_data(struct connectdata *conn)
27 return result;
28 }
29
30-/* This is called recursively */
31 static CURLcode wc_statemach(struct connectdata *conn)
32 {
33 struct WildcardData * const wildcard = &(conn->data->wildcard);
34 CURLcode result = CURLE_OK;
35
36- switch(wildcard->state) {
37- case CURLWC_INIT:
38- result = init_wc_data(conn);
39- if(wildcard->state == CURLWC_CLEAN)
40- /* only listing! */
41- break;
42- wildcard->state = result ? CURLWC_ERROR : CURLWC_MATCHING;
43- break;
44+ for(;;) {
45+ switch(wildcard->state) {
46+ case CURLWC_INIT:
47+ result = init_wc_data(conn);
48+ if(wildcard->state == CURLWC_CLEAN)
49+ /* only listing! */
50+ return result;
51+ wildcard->state = result ? CURLWC_ERROR : CURLWC_MATCHING;
52+ return result;
53
54- case CURLWC_MATCHING: {
55- /* In this state is LIST response successfully parsed, so lets restore
56- previous WRITEFUNCTION callback and WRITEDATA pointer */
57- struct ftp_wc *ftpwc = wildcard->protdata;
58- conn->data->set.fwrite_func = ftpwc->backup.write_function;
59- conn->data->set.out = ftpwc->backup.file_descriptor;
60- ftpwc->backup.write_function = ZERO_NULL;
61- ftpwc->backup.file_descriptor = NULL;
62- wildcard->state = CURLWC_DOWNLOADING;
63-
64- if(Curl_ftp_parselist_geterror(ftpwc->parser)) {
65- /* error found in LIST parsing */
66- wildcard->state = CURLWC_CLEAN;
67- return wc_statemach(conn);
68- }
69- if(wildcard->filelist.size == 0) {
70- /* no corresponding file */
71- wildcard->state = CURLWC_CLEAN;
72- return CURLE_REMOTE_FILE_NOT_FOUND;
73+ case CURLWC_MATCHING: {
74+ /* In this state is LIST response successfully parsed, so lets restore
75+ previous WRITEFUNCTION callback and WRITEDATA pointer */
76+ struct ftp_wc *ftpwc = wildcard->protdata;
77+ conn->data->set.fwrite_func = ftpwc->backup.write_function;
78+ conn->data->set.out = ftpwc->backup.file_descriptor;
79+ ftpwc->backup.write_function = ZERO_NULL;
80+ ftpwc->backup.file_descriptor = NULL;
81+ wildcard->state = CURLWC_DOWNLOADING;
82+
83+ if(Curl_ftp_parselist_geterror(ftpwc->parser)) {
84+ /* error found in LIST parsing */
85+ wildcard->state = CURLWC_CLEAN;
86+ continue;
87+ }
88+ if(wildcard->filelist.size == 0) {
89+ /* no corresponding file */
90+ wildcard->state = CURLWC_CLEAN;
91+ return CURLE_REMOTE_FILE_NOT_FOUND;
92+ }
93+ continue;
94 }
95- return wc_statemach(conn);
96- }
97
98- case CURLWC_DOWNLOADING: {
99- /* filelist has at least one file, lets get first one */
100- struct ftp_conn *ftpc = &conn->proto.ftpc;
101- struct curl_fileinfo *finfo = wildcard->filelist.head->ptr;
102- struct FTP *ftp = conn->data->req.p.ftp;
103+ case CURLWC_DOWNLOADING: {
104+ /* filelist has at least one file, lets get first one */
105+ struct ftp_conn *ftpc = &conn->proto.ftpc;
106+ struct curl_fileinfo *finfo = wildcard->filelist.head->ptr;
107+ struct FTP *ftp = conn->data->req.p.ftp;
108
109- char *tmp_path = aprintf("%s%s", wildcard->path, finfo->filename);
110- if(!tmp_path)
111- return CURLE_OUT_OF_MEMORY;
112+ char *tmp_path = aprintf("%s%s", wildcard->path, finfo->filename);
113+ if(!tmp_path)
114+ return CURLE_OUT_OF_MEMORY;
115
116- /* switch default ftp->path and tmp_path */
117- free(ftp->pathalloc);
118- ftp->pathalloc = ftp->path = tmp_path;
119-
120- infof(conn->data, "Wildcard - START of \"%s\"\n", finfo->filename);
121- if(conn->data->set.chunk_bgn) {
122- long userresponse;
123- Curl_set_in_callback(conn->data, true);
124- userresponse = conn->data->set.chunk_bgn(
125- finfo, wildcard->customptr, (int)wildcard->filelist.size);
126- Curl_set_in_callback(conn->data, false);
127- switch(userresponse) {
128- case CURL_CHUNK_BGN_FUNC_SKIP:
129- infof(conn->data, "Wildcard - \"%s\" skipped by user\n",
130- finfo->filename);
131- wildcard->state = CURLWC_SKIP;
132- return wc_statemach(conn);
133- case CURL_CHUNK_BGN_FUNC_FAIL:
134- return CURLE_CHUNK_FAILED;
135+ /* switch default ftp->path and tmp_path */
136+ free(ftp->pathalloc);
137+ ftp->pathalloc = ftp->path = tmp_path;
138+
139+ infof(conn->data, "Wildcard - START of \"%s\"\n", finfo->filename);
140+ if(conn->data->set.chunk_bgn) {
141+ long userresponse;
142+ Curl_set_in_callback(conn->data, true);
143+ userresponse = conn->data->set.chunk_bgn(
144+ finfo, wildcard->customptr, (int)wildcard->filelist.size);
145+ Curl_set_in_callback(conn->data, false);
146+ switch(userresponse) {
147+ case CURL_CHUNK_BGN_FUNC_SKIP:
148+ infof(conn->data, "Wildcard - \"%s\" skipped by user\n",
149+ finfo->filename);
150+ wildcard->state = CURLWC_SKIP;
151+ continue;
152+ case CURL_CHUNK_BGN_FUNC_FAIL:
153+ return CURLE_CHUNK_FAILED;
154+ }
155 }
156- }
157
158- if(finfo->filetype != CURLFILETYPE_FILE) {
159- wildcard->state = CURLWC_SKIP;
160- return wc_statemach(conn);
161- }
162+ if(finfo->filetype != CURLFILETYPE_FILE) {
163+ wildcard->state = CURLWC_SKIP;
164+ continue;
165+ }
166
167- if(finfo->flags & CURLFINFOFLAG_KNOWN_SIZE)
168- ftpc->known_filesize = finfo->size;
169+ if(finfo->flags & CURLFINFOFLAG_KNOWN_SIZE)
170+ ftpc->known_filesize = finfo->size;
171
172- result = ftp_parse_url_path(conn);
173- if(result)
174- return result;
175+ result = ftp_parse_url_path(conn);
176+ if(result)
177+ return result;
178
179- /* we don't need the Curl_fileinfo of first file anymore */
180- Curl_llist_remove(&wildcard->filelist, wildcard->filelist.head, NULL);
181+ /* we don't need the Curl_fileinfo of first file anymore */
182+ Curl_llist_remove(&wildcard->filelist, wildcard->filelist.head, NULL);
183
184- if(wildcard->filelist.size == 0) { /* remains only one file to down. */
185- wildcard->state = CURLWC_CLEAN;
186- /* after that will be ftp_do called once again and no transfer
187- will be done because of CURLWC_CLEAN state */
188- return CURLE_OK;
189+ if(wildcard->filelist.size == 0) { /* remains only one file to down. */
190+ wildcard->state = CURLWC_CLEAN;
191+ /* after that will be ftp_do called once again and no transfer
192+ will be done because of CURLWC_CLEAN state */
193+ return CURLE_OK;
194+ }
195+ return result;
196 }
197- } break;
198
199- case CURLWC_SKIP: {
200- if(conn->data->set.chunk_end) {
201- Curl_set_in_callback(conn->data, true);
202- conn->data->set.chunk_end(conn->data->wildcard.customptr);
203- Curl_set_in_callback(conn->data, false);
204+ case CURLWC_SKIP: {
205+ if(conn->data->set.chunk_end) {
206+ Curl_set_in_callback(conn->data, true);
207+ conn->data->set.chunk_end(conn->data->wildcard.customptr);
208+ Curl_set_in_callback(conn->data, false);
209+ }
210+ Curl_llist_remove(&wildcard->filelist, wildcard->filelist.head, NULL);
211+ wildcard->state = (wildcard->filelist.size == 0) ?
212+ CURLWC_CLEAN : CURLWC_DOWNLOADING;
213+ continue;
214 }
215- Curl_llist_remove(&wildcard->filelist, wildcard->filelist.head, NULL);
216- wildcard->state = (wildcard->filelist.size == 0) ?
217- CURLWC_CLEAN : CURLWC_DOWNLOADING;
218- return wc_statemach(conn);
219- }
220
221- case CURLWC_CLEAN: {
222- struct ftp_wc *ftpwc = wildcard->protdata;
223- result = CURLE_OK;
224- if(ftpwc)
225- result = Curl_ftp_parselist_geterror(ftpwc->parser);
226+ case CURLWC_CLEAN: {
227+ struct ftp_wc *ftpwc = wildcard->protdata;
228+ result = CURLE_OK;
229+ if(ftpwc)
230+ result = Curl_ftp_parselist_geterror(ftpwc->parser);
231
232- wildcard->state = result ? CURLWC_ERROR : CURLWC_DONE;
233- } break;
234+ wildcard->state = result ? CURLWC_ERROR : CURLWC_DONE;
235+ return result;
236+ }
237
238- case CURLWC_DONE:
239- case CURLWC_ERROR:
240- case CURLWC_CLEAR:
241- if(wildcard->dtor)
242- wildcard->dtor(wildcard->protdata);
243- break;
244+ case CURLWC_DONE:
245+ case CURLWC_ERROR:
246+ case CURLWC_CLEAR:
247+ if(wildcard->dtor)
248+ wildcard->dtor(wildcard->protdata);
249+ return result;
250+ }
251 }
252-
253- return result;
254+ /* UNREACHABLE */
255 }
256
257 /***********************************************************************
diff --git a/meta/recipes-support/curl/curl/CVE-2020-8286.patch b/meta/recipes-support/curl/curl/CVE-2020-8286.patch
new file mode 100644
index 0000000000..8c75cba844
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2020-8286.patch
@@ -0,0 +1,131 @@
1From 5d3b28deac44c19e4d73fc80e4917d42ee43adfe Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Wed, 2 Dec 2020 23:01:11 +0100
4Subject: [PATCH] openssl: make the OCSP verification verify the certificate id
5
6CVE-2020-8286
7
8Reported by anonymous
9
10Bug: https://curl.se/docs/CVE-2020-8286.html
11
12Upstream-Status: Backport [https://github.com/curl/curl/commit/d9d01672785b]
13
14CVE: CVE-2020-8286
15
16Signed-off-by: Daniel Stenberg <daniel@haxx.se>
17Signed-off-by: Khairul Rohaizzat Jamaluddin <khairul.rohaizzat.jamaluddin@intel.com>
18
19---
20 lib/vtls/openssl.c | 83 +++++++++++++++++++++++++++++++++++-------------------
21 1 file changed, 54 insertions(+), 29 deletions(-)
22
23diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c
24index 1685a4a..22cbfe7 100644
25--- a/lib/vtls/openssl.c
26+++ b/lib/vtls/openssl.c
27@@ -1777,6 +1777,11 @@ static CURLcode verifystatus(struct connectdata *conn,
28 X509_STORE *st = NULL;
29 STACK_OF(X509) *ch = NULL;
30 struct ssl_backend_data *backend = connssl->backend;
31+ X509 *cert;
32+ OCSP_CERTID *id = NULL;
33+ int cert_status, crl_reason;
34+ ASN1_GENERALIZEDTIME *rev, *thisupd, *nextupd;
35+ int ret;
36
37 long len = SSL_get_tlsext_status_ocsp_resp(backend->handle, &status);
38
39@@ -1845,43 +1850,63 @@ static CURLcode verifystatus(struct connectdata *conn,
40 goto end;
41 }
42
43- for(i = 0; i < OCSP_resp_count(br); i++) {
44- int cert_status, crl_reason;
45- OCSP_SINGLERESP *single = NULL;
46-
47- ASN1_GENERALIZEDTIME *rev, *thisupd, *nextupd;
48+ /* Compute the certificate's ID */
49+ cert = SSL_get_peer_certificate(backend->handle);
50+ if(!cert) {
51+ failf(data, "Error getting peer certficate");
52+ result = CURLE_SSL_INVALIDCERTSTATUS;
53+ goto end;
54+ }
55
56- single = OCSP_resp_get0(br, i);
57- if(!single)
58- continue;
59+ for(i = 0; i < sk_X509_num(ch); i++) {
60+ X509 *issuer = sk_X509_value(ch, i);
61+ if(X509_check_issued(issuer, cert) == X509_V_OK) {
62+ id = OCSP_cert_to_id(EVP_sha1(), cert, issuer);
63+ break;
64+ }
65+ }
66+ X509_free(cert);
67
68- cert_status = OCSP_single_get0_status(single, &crl_reason, &rev,
69- &thisupd, &nextupd);
70+ if(!id) {
71+ failf(data, "Error computing OCSP ID");
72+ result = CURLE_SSL_INVALIDCERTSTATUS;
73+ goto end;
74+ }
75
76- if(!OCSP_check_validity(thisupd, nextupd, 300L, -1L)) {
77- failf(data, "OCSP response has expired");
78- result = CURLE_SSL_INVALIDCERTSTATUS;
79- goto end;
80- }
81+ /* Find the single OCSP response corresponding to the certificate ID */
82+ ret = OCSP_resp_find_status(br, id, &cert_status, &crl_reason, &rev,
83+ &thisupd, &nextupd);
84+ OCSP_CERTID_free(id);
85+ if(ret != 1) {
86+ failf(data, "Could not find certificate ID in OCSP response");
87+ result = CURLE_SSL_INVALIDCERTSTATUS;
88+ goto end;
89+ }
90
91- infof(data, "SSL certificate status: %s (%d)\n",
92- OCSP_cert_status_str(cert_status), cert_status);
93+ /* Validate the corresponding single OCSP response */
94+ if(!OCSP_check_validity(thisupd, nextupd, 300L, -1L)) {
95+ failf(data, "OCSP response has expired");
96+ result = CURLE_SSL_INVALIDCERTSTATUS;
97+ goto end;
98+ }
99
100- switch(cert_status) {
101- case V_OCSP_CERTSTATUS_GOOD:
102- break;
103+ infof(data, "SSL certificate status: %s (%d)\n",
104+ OCSP_cert_status_str(cert_status), cert_status);
105
106- case V_OCSP_CERTSTATUS_REVOKED:
107- result = CURLE_SSL_INVALIDCERTSTATUS;
108+ switch(cert_status) {
109+ case V_OCSP_CERTSTATUS_GOOD:
110+ break;
111
112- failf(data, "SSL certificate revocation reason: %s (%d)",
113- OCSP_crl_reason_str(crl_reason), crl_reason);
114- goto end;
115+ case V_OCSP_CERTSTATUS_REVOKED:
116+ result = CURLE_SSL_INVALIDCERTSTATUS;
117+ failf(data, "SSL certificate revocation reason: %s (%d)",
118+ OCSP_crl_reason_str(crl_reason), crl_reason);
119+ goto end;
120
121- case V_OCSP_CERTSTATUS_UNKNOWN:
122- result = CURLE_SSL_INVALIDCERTSTATUS;
123- goto end;
124- }
125+ case V_OCSP_CERTSTATUS_UNKNOWN:
126+ default:
127+ result = CURLE_SSL_INVALIDCERTSTATUS;
128+ goto end;
129 }
130
131 end:
diff --git a/meta/recipes-support/curl/curl_7.72.0.bb b/meta/recipes-support/curl/curl_7.72.0.bb
index 7d0268253d..a9b52a8a1d 100644
--- a/meta/recipes-support/curl/curl_7.72.0.bb
+++ b/meta/recipes-support/curl/curl_7.72.0.bb
@@ -7,6 +7,10 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=2e9fb35867314fe31c6a4977ef7dd531"
7 7
8SRC_URI = "https://curl.haxx.se/download/curl-${PV}.tar.bz2 \ 8SRC_URI = "https://curl.haxx.se/download/curl-${PV}.tar.bz2 \
9 file://0001-replace-krb5-config-with-pkg-config.patch \ 9 file://0001-replace-krb5-config-with-pkg-config.patch \
10 file://0002-remove-void-protop-create-union-p.patch \
11 file://CVE-2020-8284.patch \
12 file://CVE-2020-8285.patch \
13 file://CVE-2020-8286.patch \
10" 14"
11 15
12SRC_URI[sha256sum] = "ad91970864102a59765e20ce16216efc9d6ad381471f7accceceab7d905703ef" 16SRC_URI[sha256sum] = "ad91970864102a59765e20ce16216efc9d6ad381471f7accceceab7d905703ef"
diff --git a/meta/recipes-support/gpgme/gpgme_1.14.0.bb b/meta/recipes-support/gpgme/gpgme_1.14.0.bb
index 9fa8212808..fb7215381c 100644
--- a/meta/recipes-support/gpgme/gpgme_1.14.0.bb
+++ b/meta/recipes-support/gpgme/gpgme_1.14.0.bb
@@ -48,7 +48,7 @@ DEFAULT_LANGUAGES_class-target = "cpp"
48LANGUAGES ?= "${DEFAULT_LANGUAGES} python" 48LANGUAGES ?= "${DEFAULT_LANGUAGES} python"
49 49
50PYTHON_INHERIT = "${@bb.utils.contains('PACKAGECONFIG', 'python2', 'pythonnative', '', d)}" 50PYTHON_INHERIT = "${@bb.utils.contains('PACKAGECONFIG', 'python2', 'pythonnative', '', d)}"
51PYTHON_INHERIT .= "${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3native', '', d)}" 51PYTHON_INHERIT .= "${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3native python3targetconfig', '', d)}"
52 52
53EXTRA_OECONF += '--enable-languages="${LANGUAGES}" \ 53EXTRA_OECONF += '--enable-languages="${LANGUAGES}" \
54 --disable-gpgconf-test \ 54 --disable-gpgconf-test \
diff --git a/meta/recipes-support/iso-codes/iso-codes_4.5.0.bb b/meta/recipes-support/iso-codes/iso-codes_4.5.0.bb
index 9d02f5c794..0b4582b202 100644
--- a/meta/recipes-support/iso-codes/iso-codes_4.5.0.bb
+++ b/meta/recipes-support/iso-codes/iso-codes_4.5.0.bb
@@ -5,7 +5,7 @@ BUGTRACKER = "https://salsa.debian.org/iso-codes-team/iso-codes/issues"
5LICENSE = "LGPLv2.1" 5LICENSE = "LGPLv2.1"
6LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" 6LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
7 7
8SRC_URI = "git://salsa.debian.org/iso-codes-team/iso-codes.git;protocol=http;branch=main;" 8SRC_URI = "git://salsa.debian.org/iso-codes-team/iso-codes.git;protocol=https;branch=main;"
9SRCREV = "a36019e5014bff251f83d522ddcfebaecf52afd3" 9SRCREV = "a36019e5014bff251f83d522ddcfebaecf52afd3"
10 10
11# inherit gettext cannot be used, because it adds gettext-native to BASEDEPENDS which 11# inherit gettext cannot be used, because it adds gettext-native to BASEDEPENDS which
diff --git a/meta/recipes-support/libcroco/files/CVE-2020-12825.patch b/meta/recipes-support/libcroco/files/CVE-2020-12825.patch
new file mode 100644
index 0000000000..42f92e3607
--- /dev/null
+++ b/meta/recipes-support/libcroco/files/CVE-2020-12825.patch
@@ -0,0 +1,192 @@
1From fdf78a4877afa987ba646a8779b513f258e6d04c Mon Sep 17 00:00:00 2001
2From: Michael Catanzaro <mcatanzaro@gnome.org>
3Date: Fri, 31 Jul 2020 15:21:53 -0500
4Subject: [PATCH] libcroco: Limit recursion in block and any productions
5
6 (CVE-2020-12825)
7
8If we don't have any limits, we can recurse forever and overflow the
9stack.
10
11Fixes #8
12This is per https://gitlab.gnome.org/Archive/libcroco/-/issues/8
13
14https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1404
15
16CVE: CVE-2020-12825
17Upstream-Status: Backport [https://gitlab.gnome.org/Archive/libcroco/-/commit/6eb257e5c731c691eb137fca94e916ca73941a5a]
18Comment: No refreshing changes done.
19Signed-off-by: Saloni Jain <Saloni.Jain@kpit.com>
20
21---
22 src/cr-parser.c | 44 +++++++++++++++++++++++++++++---------------
23 1 file changed, 29 insertions(+), 15 deletions(-)
24
25diff --git a/src/cr-parser.c b/src/cr-parser.c
26index 18c9a01..f4a62e3 100644
27--- a/src/cr-parser.c
28+++ b/src/cr-parser.c
29@@ -136,6 +136,8 @@ struct _CRParserPriv {
30
31 #define CHARS_TAB_SIZE 12
32
33+#define RECURSIVE_CALLERS_LIMIT 100
34+
35 /**
36 * IS_NUM:
37 *@a_char: the char to test.
38@@ -344,9 +346,11 @@ static enum CRStatus cr_parser_parse_selector_core (CRParser * a_this);
39
40 static enum CRStatus cr_parser_parse_declaration_core (CRParser * a_this);
41
42-static enum CRStatus cr_parser_parse_any_core (CRParser * a_this);
43+static enum CRStatus cr_parser_parse_any_core (CRParser * a_this,
44+ guint n_calls);
45
46-static enum CRStatus cr_parser_parse_block_core (CRParser * a_this);
47+static enum CRStatus cr_parser_parse_block_core (CRParser * a_this,
48+ guint n_calls);
49
50 static enum CRStatus cr_parser_parse_value_core (CRParser * a_this);
51
52@@ -784,7 +788,7 @@ cr_parser_parse_atrule_core (CRParser * a_this)
53 cr_parser_try_to_skip_spaces_and_comments (a_this);
54
55 do {
56- status = cr_parser_parse_any_core (a_this);
57+ status = cr_parser_parse_any_core (a_this, 0);
58 } while (status == CR_OK);
59
60 status = cr_tknzr_get_next_token (PRIVATE (a_this)->tknzr,
61@@ -795,7 +799,7 @@ cr_parser_parse_atrule_core (CRParser * a_this)
62 cr_tknzr_unget_token (PRIVATE (a_this)->tknzr,
63 token);
64 token = NULL;
65- status = cr_parser_parse_block_core (a_this);
66+ status = cr_parser_parse_block_core (a_this, 0);
67 CHECK_PARSING_STATUS (status,
68 FALSE);
69 goto done;
70@@ -930,11 +934,11 @@ cr_parser_parse_selector_core (CRParser * a_this)
71
72 RECORD_INITIAL_POS (a_this, &init_pos);
73
74- status = cr_parser_parse_any_core (a_this);
75+ status = cr_parser_parse_any_core (a_this, 0);
76 CHECK_PARSING_STATUS (status, FALSE);
77
78 do {
79- status = cr_parser_parse_any_core (a_this);
80+ status = cr_parser_parse_any_core (a_this, 0);
81
82 } while (status == CR_OK);
83
84@@ -956,10 +960,12 @@ cr_parser_parse_selector_core (CRParser * a_this)
85 *in chapter 4.1 of the css2 spec.
86 *block ::= '{' S* [ any | block | ATKEYWORD S* | ';' ]* '}' S*;
87 *@param a_this the current instance of #CRParser.
88+ *@param n_calls used to limit recursion depth
89 *FIXME: code this function.
90 */
91 static enum CRStatus
92-cr_parser_parse_block_core (CRParser * a_this)
93+cr_parser_parse_block_core (CRParser * a_this,
94+ guint n_calls)
95 {
96 CRToken *token = NULL;
97 CRInputPos init_pos;
98@@ -967,6 +973,9 @@ cr_parser_parse_block_core (CRParser * a_this)
99
100 g_return_val_if_fail (a_this && PRIVATE (a_this), CR_BAD_PARAM_ERROR);
101
102+ if (n_calls > RECURSIVE_CALLERS_LIMIT)
103+ return CR_ERROR;
104+
105 RECORD_INITIAL_POS (a_this, &init_pos);
106
107 status = cr_tknzr_get_next_token (PRIVATE (a_this)->tknzr, &token);
108@@ -996,13 +1005,13 @@ cr_parser_parse_block_core (CRParser * a_this)
109 } else if (token->type == CBO_TK) {
110 cr_tknzr_unget_token (PRIVATE (a_this)->tknzr, token);
111 token = NULL;
112- status = cr_parser_parse_block_core (a_this);
113+ status = cr_parser_parse_block_core (a_this, n_calls + 1);
114 CHECK_PARSING_STATUS (status, FALSE);
115 goto parse_block_content;
116 } else {
117 cr_tknzr_unget_token (PRIVATE (a_this)->tknzr, token);
118 token = NULL;
119- status = cr_parser_parse_any_core (a_this);
120+ status = cr_parser_parse_any_core (a_this, n_calls + 1);
121 CHECK_PARSING_STATUS (status, FALSE);
122 goto parse_block_content;
123 }
124@@ -1109,7 +1118,7 @@ cr_parser_parse_value_core (CRParser * a_this)
125 status = cr_tknzr_unget_token (PRIVATE (a_this)->tknzr,
126 token);
127 token = NULL;
128- status = cr_parser_parse_block_core (a_this);
129+ status = cr_parser_parse_block_core (a_this, 0);
130 CHECK_PARSING_STATUS (status, FALSE);
131 ref++;
132 goto continue_parsing;
133@@ -1123,7 +1132,7 @@ cr_parser_parse_value_core (CRParser * a_this)
134 status = cr_tknzr_unget_token (PRIVATE (a_this)->tknzr,
135 token);
136 token = NULL;
137- status = cr_parser_parse_any_core (a_this);
138+ status = cr_parser_parse_any_core (a_this, 0);
139 if (status == CR_OK) {
140 ref++;
141 goto continue_parsing;
142@@ -1162,10 +1171,12 @@ cr_parser_parse_value_core (CRParser * a_this)
143 * | FUNCTION | DASHMATCH | '(' any* ')' | '[' any* ']' ] S*;
144 *
145 *@param a_this the current instance of #CRParser.
146+ *@param n_calls used to limit recursion depth
147 *@return CR_OK upon successfull completion, an error code otherwise.
148 */
149 static enum CRStatus
150-cr_parser_parse_any_core (CRParser * a_this)
151+cr_parser_parse_any_core (CRParser * a_this,
152+ guint n_calls)
153 {
154 CRToken *token1 = NULL,
155 *token2 = NULL;
156@@ -1174,6 +1185,9 @@ cr_parser_parse_any_core (CRParser * a_this)
157
158 g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR);
159
160+ if (n_calls > RECURSIVE_CALLERS_LIMIT)
161+ return CR_ERROR;
162+
163 RECORD_INITIAL_POS (a_this, &init_pos);
164
165 status = cr_tknzr_get_next_token (PRIVATE (a_this)->tknzr, &token1);
166@@ -1212,7 +1226,7 @@ cr_parser_parse_any_core (CRParser * a_this)
167 *We consider parameter as being an "any*" production.
168 */
169 do {
170- status = cr_parser_parse_any_core (a_this);
171+ status = cr_parser_parse_any_core (a_this, n_calls + 1);
172 } while (status == CR_OK);
173
174 ENSURE_PARSING_COND (status == CR_PARSING_ERROR);
175@@ -1237,7 +1251,7 @@ cr_parser_parse_any_core (CRParser * a_this)
176 }
177
178 do {
179- status = cr_parser_parse_any_core (a_this);
180+ status = cr_parser_parse_any_core (a_this, n_calls + 1);
181 } while (status == CR_OK);
182
183 ENSURE_PARSING_COND (status == CR_PARSING_ERROR);
184@@ -1265,7 +1279,7 @@ cr_parser_parse_any_core (CRParser * a_this)
185 }
186
187 do {
188- status = cr_parser_parse_any_core (a_this);
189+ status = cr_parser_parse_any_core (a_this, n_calls + 1);
190 } while (status == CR_OK);
191
192 ENSURE_PARSING_COND (status == CR_PARSING_ERROR);
diff --git a/meta/recipes-support/libcroco/libcroco_0.6.13.bb b/meta/recipes-support/libcroco/libcroco_0.6.13.bb
index 9171a9de5c..a443ff23fe 100644
--- a/meta/recipes-support/libcroco/libcroco_0.6.13.bb
+++ b/meta/recipes-support/libcroco/libcroco_0.6.13.bb
@@ -18,3 +18,6 @@ inherit gnomebase gtk-doc binconfig-disabled
18 18
19SRC_URI[archive.md5sum] = "c80c5a8385011a0260dce6bd0da93dce" 19SRC_URI[archive.md5sum] = "c80c5a8385011a0260dce6bd0da93dce"
20SRC_URI[archive.sha256sum] = "767ec234ae7aa684695b3a735548224888132e063f92db585759b422570621d4" 20SRC_URI[archive.sha256sum] = "767ec234ae7aa684695b3a735548224888132e063f92db585759b422570621d4"
21
22SRC_URI +="file://CVE-2020-12825.patch \
23"
diff --git a/meta/recipes-support/libevdev/libevdev/determinism.patch b/meta/recipes-support/libevdev/libevdev/determinism.patch
index f6b7fc82d3..71cbd876eb 100644
--- a/meta/recipes-support/libevdev/libevdev/determinism.patch
+++ b/meta/recipes-support/libevdev/libevdev/determinism.patch
@@ -9,7 +9,8 @@ Sort to remove this inconsistency.
9RP 2020/2/7 9RP 2020/2/7
10 10
11Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> 11Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
12Upstream-Status: Pending 12Submitted: https://lists.freedesktop.org/archives/input-tools/2021-February/001560.html
13Upstream-Status: Backport [https://gitlab.freedesktop.org/libevdev/libevdev/-/commit/8d70f449892c6f7659e07bb0f06b8347677bb7d8]
13 14
14--- 15---
15 libevdev/make-event-names.py | 6 +++--- 16 libevdev/make-event-names.py | 6 +++---
diff --git a/meta/recipes-support/libexif/files/CVE-2020-0198.patch b/meta/recipes-support/libexif/files/CVE-2020-0198.patch
new file mode 100644
index 0000000000..2a48844cb2
--- /dev/null
+++ b/meta/recipes-support/libexif/files/CVE-2020-0198.patch
@@ -0,0 +1,66 @@
1From ca71eda33fe8421f98fbe20eb4392473357c1c43 Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Wed, 30 Dec 2020 10:22:47 +0800
4Subject: [PATCH] fixed another unsigned integer overflow
5
6first fixed by google in android fork,
7https://android.googlesource.com/platform/external/libexif/+/1e187b62682ffab5003c702657d6d725b4278f16%5E%21/#F0
8
9(use a more generic overflow check method, also check second overflow instance.)
10
11https://security-tracker.debian.org/tracker/CVE-2020-0198
12
13Upstream-Status: Backport[https://github.com/libexif/libexif/commit/ce03ad7ef4e8aeefce79192bf5b6f69fae396f0c]
14CVE: CVE-2020-0198
15
16Signed-off-by: Changqing Li <changqing.li@windriver.com>
17---
18 libexif/exif-data.c | 10 ++++++----
19 1 file changed, 6 insertions(+), 4 deletions(-)
20
21diff --git a/libexif/exif-data.c b/libexif/exif-data.c
22index 8b280d3..34d58fc 100644
23--- a/libexif/exif-data.c
24+++ b/libexif/exif-data.c
25@@ -47,6 +47,8 @@
26 #undef JPEG_MARKER_APP1
27 #define JPEG_MARKER_APP1 0xe1
28
29+#define CHECKOVERFLOW(offset,datasize,structsize) (( offset >= datasize) || (structsize > datasize) || (offset > datasize - structsize ))
30+
31 static const unsigned char ExifHeader[] = {0x45, 0x78, 0x69, 0x66, 0x00, 0x00};
32
33 struct _ExifDataPrivate
34@@ -327,7 +329,7 @@ exif_data_load_data_thumbnail (ExifData *data, const unsigned char *d,
35 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", "Bogus thumbnail offset (%u).", o);
36 return;
37 }
38- if (s > ds - o) {
39+ if (CHECKOVERFLOW(o,ds,s)) {
40 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", "Bogus thumbnail size (%u), max would be %u.", s, ds-o);
41 return;
42 }
43@@ -420,9 +422,9 @@ exif_data_load_data_content (ExifData *data, ExifIfd ifd,
44 }
45
46 /* Read the number of entries */
47- if ((offset + 2 < offset) || (offset + 2 < 2) || (offset + 2 > ds)) {
48+ if (CHECKOVERFLOW(offset, ds, 2)) {
49 exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA, "ExifData",
50- "Tag data past end of buffer (%u > %u)", offset+2, ds);
51+ "Tag data past end of buffer (%u+2 > %u)", offset, ds);
52 return;
53 }
54 n = exif_get_short (d + offset, data->priv->order);
55@@ -431,7 +433,7 @@ exif_data_load_data_content (ExifData *data, ExifIfd ifd,
56 offset += 2;
57
58 /* Check if we have enough data. */
59- if (offset + 12 * n > ds) {
60+ if (CHECKOVERFLOW(offset, ds, 12*n)) {
61 n = (ds - offset) / 12;
62 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData",
63 "Short data; only loading %hu entries...", n);
64--
652.17.1
66
diff --git a/meta/recipes-support/libexif/files/CVE-2020-0452.patch b/meta/recipes-support/libexif/files/CVE-2020-0452.patch
new file mode 100644
index 0000000000..a117b8b369
--- /dev/null
+++ b/meta/recipes-support/libexif/files/CVE-2020-0452.patch
@@ -0,0 +1,39 @@
1From 302acd49eba0a125b0f20692df6abc6f7f7ca53e Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Wed, 30 Dec 2020 10:18:51 +0800
4Subject: [PATCH] fixed a incorrect overflow check that could be optimized
5 away.
6
7inspired by:
8https://android.googlesource.com/platform/external/libexif/+/8e7345f3bc0bad06ac369d6cbc1124c8ceaf7d4b
9
10https://source.android.com/security/bulletin/2020-11-01
11
12CVE-2020-0452
13
14Upsteam-Status: Backport[https://github.com/libexif/libexif/commit/9266d14b5ca4e29b970fa03272318e5f99386e06]
15CVE: CVE-2020-0452
16
17Signed-off-by: Changqing Li <changqing.li@windriver.com>
18---
19 libexif/exif-entry.c | 4 ++--
20 1 file changed, 2 insertions(+), 2 deletions(-)
21
22diff --git a/libexif/exif-entry.c b/libexif/exif-entry.c
23index 5de215f..3a6ce84 100644
24--- a/libexif/exif-entry.c
25+++ b/libexif/exif-entry.c
26@@ -1371,8 +1371,8 @@ exif_entry_get_value (ExifEntry *e, char *val, unsigned int maxlen)
27 {
28 unsigned char *utf16;
29
30- /* Sanity check the size to prevent overflow */
31- if (e->size+sizeof(uint16_t)+1 < e->size) break;
32+ /* Sanity check the size to prevent overflow. Note EXIF files are 64kb at most. */
33+ if (e->size >= 65536 - sizeof(uint16_t)*2) break;
34
35 /* The tag may not be U+0000-terminated , so make a local
36 U+0000-terminated copy before converting it */
37--
382.17.1
39
diff --git a/meta/recipes-support/libexif/libexif_0.6.22.bb b/meta/recipes-support/libexif/libexif_0.6.22.bb
index 2478ba07d8..dc30926c59 100644
--- a/meta/recipes-support/libexif/libexif_0.6.22.bb
+++ b/meta/recipes-support/libexif/libexif_0.6.22.bb
@@ -8,6 +8,8 @@ def version_underscore(v):
8 return "_".join(v.split(".")) 8 return "_".join(v.split("."))
9 9
10SRC_URI = "https://github.com/libexif/libexif/releases/download/libexif-${@version_underscore("${PV}")}-release/libexif-${PV}.tar.xz \ 10SRC_URI = "https://github.com/libexif/libexif/releases/download/libexif-${@version_underscore("${PV}")}-release/libexif-${PV}.tar.xz \
11 file://CVE-2020-0198.patch \
12 file://CVE-2020-0452.patch \
11 " 13 "
12 14
13SRC_URI[sha256sum] = "5048f1c8fc509cc636c2f97f4b40c293338b6041a5652082d5ee2cf54b530c56" 15SRC_URI[sha256sum] = "5048f1c8fc509cc636c2f97f4b40c293338b6041a5652082d5ee2cf54b530c56"
diff --git a/meta/recipes-support/libgcrypt/libgcrypt_1.8.6.bb b/meta/recipes-support/libgcrypt/libgcrypt_1.8.6.bb
index ac09417e89..832d07d515 100644
--- a/meta/recipes-support/libgcrypt/libgcrypt_1.8.6.bb
+++ b/meta/recipes-support/libgcrypt/libgcrypt_1.8.6.bb
@@ -28,6 +28,9 @@ SRC_URI = "${GNUPG_MIRROR}/libgcrypt/libgcrypt-${PV}.tar.bz2 \
28" 28"
29SRC_URI[sha256sum] = "0cba2700617b99fc33864a0c16b1fa7fdf9781d9ed3509f5d767178e5fd7b975" 29SRC_URI[sha256sum] = "0cba2700617b99fc33864a0c16b1fa7fdf9781d9ed3509f5d767178e5fd7b975"
30 30
31# Below whitelisted CVEs are disputed and not affecting crypto libraries for any distro.
32CVE_CHECK_WHITELIST += "CVE-2018-12433 CVE-2018-12438"
33
31BINCONFIG = "${bindir}/libgcrypt-config" 34BINCONFIG = "${bindir}/libgcrypt-config"
32 35
33inherit autotools texinfo binconfig-disabled pkgconfig 36inherit autotools texinfo binconfig-disabled pkgconfig
diff --git a/meta/recipes-support/lz4/lz4_1.9.2.bb b/meta/recipes-support/lz4/lz4_1.9.2.bb
index 6510156ed0..455d2a5141 100644
--- a/meta/recipes-support/lz4/lz4_1.9.2.bb
+++ b/meta/recipes-support/lz4/lz4_1.9.2.bb
@@ -11,7 +11,7 @@ PE = "1"
11 11
12SRCREV = "fdf2ef5809ca875c454510610764d9125ef2ebbd" 12SRCREV = "fdf2ef5809ca875c454510610764d9125ef2ebbd"
13 13
14SRC_URI = "git://github.com/lz4/lz4.git \ 14SRC_URI = "git://github.com/lz4/lz4.git;branch=dev \
15 file://run-ptest \ 15 file://run-ptest \
16 " 16 "
17UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>.*)" 17UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>.*)"
diff --git a/meta/recipes-support/p11-kit/p11-kit_0.23.21.bb b/meta/recipes-support/p11-kit/p11-kit_0.23.22.bb
index b1fd2334b2..c539ecdbc6 100644
--- a/meta/recipes-support/p11-kit/p11-kit_0.23.21.bb
+++ b/meta/recipes-support/p11-kit/p11-kit_0.23.22.bb
@@ -2,17 +2,18 @@ SUMMARY = "Provides a way to load and enumerate PKCS#11 modules"
2LICENSE = "BSD-3-Clause" 2LICENSE = "BSD-3-Clause"
3LIC_FILES_CHKSUM = "file://COPYING;md5=02933887f609807fbb57aa4237d14a50" 3LIC_FILES_CHKSUM = "file://COPYING;md5=02933887f609807fbb57aa4237d14a50"
4 4
5inherit meson gettext pkgconfig gtk-doc bash-completion 5inherit meson gettext pkgconfig gtk-doc bash-completion manpages
6 6
7DEPENDS = "libtasn1 libtasn1-native libffi" 7DEPENDS = "libtasn1 libtasn1-native libffi"
8 8
9DEPENDS_append = "${@' glib-2.0' if d.getVar('GTKDOC_ENABLED') == 'True' else ''}" 9DEPENDS_append = "${@' glib-2.0' if d.getVar('GTKDOC_ENABLED') == 'True' else ''}"
10 10
11SRC_URI = "git://github.com/p11-glue/p11-kit" 11SRC_URI = "git://github.com/p11-glue/p11-kit;branch=0.23"
12SRCREV = "fd8b56f3ee971f94dc6fc95411fc01e1c12153ab" 12SRCREV = "bd97afbfe28d5fbbde95ce36ff7a8834fc0291ee"
13S = "${WORKDIR}/git" 13S = "${WORKDIR}/git"
14 14
15PACKAGECONFIG ??= "" 15PACKAGECONFIG ??= ""
16PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,libxslt-native"
16PACKAGECONFIG[trust-paths] = "-Dtrust_paths=/etc/ssl/certs/ca-certificates.crt,,,ca-certificates" 17PACKAGECONFIG[trust-paths] = "-Dtrust_paths=/etc/ssl/certs/ca-certificates.crt,,,ca-certificates"
17 18
18GTKDOC_MESON_OPTION = 'gtk_doc' 19GTKDOC_MESON_OPTION = 'gtk_doc'
diff --git a/meta/recipes-support/sqlite/sqlite3_3.33.0.bb b/meta/recipes-support/sqlite/sqlite3_3.33.0.bb
index 611a1bd923..33f041a161 100644
--- a/meta/recipes-support/sqlite/sqlite3_3.33.0.bb
+++ b/meta/recipes-support/sqlite/sqlite3_3.33.0.bb
@@ -8,3 +8,5 @@ SRC_URI[sha256sum] = "106a2c48c7f75a298a7557bcc0d5f4f454e5b43811cc738b7ca294d695
8 8
9# -19242 is only an issue in specific development branch commits 9# -19242 is only an issue in specific development branch commits
10CVE_CHECK_WHITELIST += "CVE-2019-19242" 10CVE_CHECK_WHITELIST += "CVE-2019-19242"
11# This is believed to be iOS specific (https://groups.google.com/g/sqlite-dev/c/U7OjAbZO6LA)
12CVE_CHECK_WHITELIST += "CVE-2015-3717"
diff --git a/meta/recipes-support/vim/files/racefix.patch b/meta/recipes-support/vim/files/racefix.patch
new file mode 100644
index 0000000000..48dca44cad
--- /dev/null
+++ b/meta/recipes-support/vim/files/racefix.patch
@@ -0,0 +1,33 @@
1The creation of the LINGUAS file is duplicated for each desktop file
2which can lead the commands to race against each other. Rework
3the makefile to avoid this as the expense of leaving the file on disk.
4
5Upstream-Status: Pending
6RP 2021/2/15
7
8Index: git/src/po/Makefile
9===================================================================
10--- git.orig/src/po/Makefile
11+++ git/src/po/Makefile
12@@ -165,17 +165,16 @@ $(PACKAGE).pot: ../*.c ../if_perl.xs ../
13 po/gvim.desktop.in po/vim.desktop.in
14 mv -f ../$(PACKAGE).po $(PACKAGE).pot
15
16-vim.desktop: vim.desktop.in $(POFILES)
17+LINGUAS:
18 echo $(LANGUAGES) | tr " " "\n" |sed -e '/\./d' | sort > LINGUAS
19+
20+vim.desktop: vim.desktop.in $(POFILES) LINGUAS
21 $(MSGFMT) --desktop -d . --template vim.desktop.in -o tmp_vim.desktop
22- rm -f LINGUAS
23 if command -v desktop-file-validate; then desktop-file-validate tmp_vim.desktop; fi
24 mv tmp_vim.desktop vim.desktop
25
26-gvim.desktop: gvim.desktop.in $(POFILES)
27- echo $(LANGUAGES) | tr " " "\n" |sed -e '/\./d' | sort > LINGUAS
28+gvim.desktop: gvim.desktop.in $(POFILES) LINGUAS
29 $(MSGFMT) --desktop -d . --template gvim.desktop.in -o tmp_gvim.desktop
30- rm -f LINGUAS
31 if command -v desktop-file-validate; then desktop-file-validate tmp_gvim.desktop; fi
32 mv tmp_gvim.desktop gvim.desktop
33
diff --git a/meta/recipes-support/vim/vim.inc b/meta/recipes-support/vim/vim.inc
index 4d2886c19e..d57f784da5 100644
--- a/meta/recipes-support/vim/vim.inc
+++ b/meta/recipes-support/vim/vim.inc
@@ -12,6 +12,7 @@ SRC_URI = "git://github.com/vim/vim.git \
12 file://vim-add-knob-whether-elf.h-are-checked.patch \ 12 file://vim-add-knob-whether-elf.h-are-checked.patch \
13 file://0001-src-Makefile-improve-reproducibility.patch \ 13 file://0001-src-Makefile-improve-reproducibility.patch \
14 file://no-path-adjust.patch \ 14 file://no-path-adjust.patch \
15 file://racefix.patch \
15" 16"
16SRCREV = "98056533b96b6b5d8849641de93185dd7bcadc44" 17SRCREV = "98056533b96b6b5d8849641de93185dd7bcadc44"
17 18
@@ -68,8 +69,10 @@ EXTRA_OECONF = " \
68 --disable-gtktest \ 69 --disable-gtktest \
69 --disable-xim \ 70 --disable-xim \
70 --disable-netbeans \ 71 --disable-netbeans \
72 --disable-desktop-database-update \
71 --with-tlib=ncurses \ 73 --with-tlib=ncurses \
72 ac_cv_small_wchar_t=no \ 74 ac_cv_small_wchar_t=no \
75 ac_cv_path_GLIB_COMPILE_RESOURCES=no \
73 vim_cv_getcwd_broken=no \ 76 vim_cv_getcwd_broken=no \
74 vim_cv_memmove_handles_overlap=yes \ 77 vim_cv_memmove_handles_overlap=yes \
75 vim_cv_stat_ignores_slash=no \ 78 vim_cv_stat_ignores_slash=no \
diff --git a/scripts/contrib/documentation-audit.sh b/scripts/contrib/documentation-audit.sh
index 1191f57a8e..f436f9bae0 100755
--- a/scripts/contrib/documentation-audit.sh
+++ b/scripts/contrib/documentation-audit.sh
@@ -27,7 +27,7 @@ fi
27 27
28echo "REMINDER: you need to build for MACHINE=qemux86 or you won't get useful results" 28echo "REMINDER: you need to build for MACHINE=qemux86 or you won't get useful results"
29echo "REMINDER: you need to set LICENSE_FLAGS_WHITELIST appropriately in local.conf or " 29echo "REMINDER: you need to set LICENSE_FLAGS_WHITELIST appropriately in local.conf or "
30echo " you'll get false positives. For example, LICENSE_FLAGS_WHITELIST = \"Commercial\"" 30echo " you'll get false positives. For example, LICENSE_FLAGS_WHITELIST = \"commercial\""
31 31
32for pkg in `bitbake -s | awk '{ print \$1 }'`; do 32for pkg in `bitbake -s | awk '{ print \$1 }'`; do
33 if [[ "$pkg" == "Loading" || "$pkg" == "Loaded" || 33 if [[ "$pkg" == "Loading" || "$pkg" == "Loaded" ||
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 261d642d4a..f364a45283 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -474,7 +474,11 @@ def symlink_oelocal_files_srctree(rd,srctree):
474 destpth = os.path.join(srctree, relpth, fn) 474 destpth = os.path.join(srctree, relpth, fn)
475 if os.path.exists(destpth): 475 if os.path.exists(destpth):
476 os.unlink(destpth) 476 os.unlink(destpth)
477 os.symlink('oe-local-files/%s' % fn, destpth) 477 if relpth != '.':
478 back_relpth = os.path.relpath(local_files_dir, root)
479 os.symlink('%s/oe-local-files/%s/%s' % (back_relpth, relpth, fn), destpth)
480 else:
481 os.symlink('oe-local-files/%s' % fn, destpth)
478 addfiles.append(os.path.join(relpth, fn)) 482 addfiles.append(os.path.join(relpth, fn))
479 if addfiles: 483 if addfiles:
480 bb.process.run('git add %s' % ' '.join(addfiles), cwd=srctree) 484 bb.process.run('git add %s' % ' '.join(addfiles), cwd=srctree)
@@ -589,6 +593,16 @@ def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, works
589 else: 593 else:
590 task = 'do_patch' 594 task = 'do_patch'
591 595
596 if 'noexec' in (d.getVarFlags(task, False) or []) or 'task' not in (d.getVarFlags(task, False) or []):
597 logger.info('The %s recipe has %s disabled. Running only '
598 'do_configure task dependencies' % (pn, task))
599
600 if 'depends' in d.getVarFlags('do_configure', False):
601 pn = d.getVarFlags('do_configure', False)['depends']
602 pn = pn.replace('${PV}', d.getVar('PV'))
603 pn = pn.replace('${COMPILERDEP}', d.getVar('COMPILERDEP'))
604 task = None
605
592 # Run the fetch + unpack tasks 606 # Run the fetch + unpack tasks
593 res = tinfoil.build_targets(pn, 607 res = tinfoil.build_targets(pn,
594 task, 608 task,
@@ -600,6 +614,17 @@ def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, works
600 if not res: 614 if not res:
601 raise DevtoolError('Extracting source for %s failed' % pn) 615 raise DevtoolError('Extracting source for %s failed' % pn)
602 616
617 if not is_kernel_yocto and ('noexec' in (d.getVarFlags('do_patch', False) or []) or 'task' not in (d.getVarFlags('do_patch', False) or [])):
618 workshareddir = d.getVar('S')
619 if os.path.islink(srctree):
620 os.unlink(srctree)
621
622 os.symlink(workshareddir, srctree)
623
624 # The initial_rev file is created in devtool_post_unpack function that will not be executed if
625 # do_unpack/do_patch tasks are disabled so we have to directly say that source extraction was successful
626 return True, True
627
603 try: 628 try:
604 with open(os.path.join(tempdir, 'initial_rev'), 'r') as f: 629 with open(os.path.join(tempdir, 'initial_rev'), 'r') as f:
605 initial_rev = f.read() 630 initial_rev = f.read()
@@ -847,10 +872,11 @@ def modify(args, config, basepath, workspace):
847 if not initial_rev: 872 if not initial_rev:
848 return 1 873 return 1
849 logger.info('Source tree extracted to %s' % srctree) 874 logger.info('Source tree extracted to %s' % srctree)
850 # Get list of commits since this revision 875 if os.path.exists(os.path.join(srctree, '.git')):
851 (stdout, _) = bb.process.run('git rev-list --reverse %s..HEAD' % initial_rev, cwd=srctree) 876 # Get list of commits since this revision
852 commits = stdout.split() 877 (stdout, _) = bb.process.run('git rev-list --reverse %s..HEAD' % initial_rev, cwd=srctree)
853 check_commits = True 878 commits = stdout.split()
879 check_commits = True
854 else: 880 else:
855 if os.path.exists(os.path.join(srctree, '.git')): 881 if os.path.exists(os.path.join(srctree, '.git')):
856 # Check if it's a tree previously extracted by us. This is done 882 # Check if it's a tree previously extracted by us. This is done
@@ -927,12 +953,17 @@ def modify(args, config, basepath, workspace):
927 953
928 if bb.data.inherits_class('kernel', rd): 954 if bb.data.inherits_class('kernel', rd):
929 f.write('SRCTREECOVEREDTASKS = "do_validate_branches do_kernel_checkout ' 955 f.write('SRCTREECOVEREDTASKS = "do_validate_branches do_kernel_checkout '
930 'do_fetch do_unpack do_kernel_configme do_kernel_configcheck"\n') 956 'do_fetch do_unpack do_kernel_configcheck"\n')
931 f.write('\ndo_patch[noexec] = "1"\n') 957 f.write('\ndo_patch[noexec] = "1"\n')
932 f.write('\ndo_configure_append() {\n' 958 f.write('\ndo_configure_append() {\n'
933 ' cp ${B}/.config ${S}/.config.baseline\n' 959 ' cp ${B}/.config ${S}/.config.baseline\n'
934 ' ln -sfT ${B}/.config ${S}/.config.new\n' 960 ' ln -sfT ${B}/.config ${S}/.config.new\n'
935 '}\n') 961 '}\n')
962 f.write('\ndo_kernel_configme_prepend() {\n'
963 ' if [ -e ${S}/.config ]; then\n'
964 ' mv ${S}/.config ${S}/.config.old\n'
965 ' fi\n'
966 '}\n')
936 if rd.getVarFlag('do_menuconfig','task'): 967 if rd.getVarFlag('do_menuconfig','task'):
937 f.write('\ndo_configure_append() {\n' 968 f.write('\ndo_configure_append() {\n'
938 ' if [ ! ${DEVTOOL_DISABLE_MENUCONFIG} ]; then\n' 969 ' if [ ! ${DEVTOOL_DISABLE_MENUCONFIG} ]; then\n'
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index 0c1de8cdc7..5a057e95f5 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -178,7 +178,7 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, srcbranch, branch, kee
178 uri, rev = _get_uri(crd) 178 uri, rev = _get_uri(crd)
179 if srcrev: 179 if srcrev:
180 rev = srcrev 180 rev = srcrev
181 if uri.startswith('git://'): 181 if uri.startswith('git://') or uri.startswith('gitsm://'):
182 __run('git fetch') 182 __run('git fetch')
183 __run('git checkout %s' % rev) 183 __run('git checkout %s' % rev)
184 __run('git tag -f devtool-base-new') 184 __run('git tag -f devtool-base-new')
@@ -270,7 +270,7 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, srcbranch, branch, kee
270 else: 270 else:
271 logger.warning('Command \'%s\' failed:\n%s' % (e.command, e.stdout)) 271 logger.warning('Command \'%s\' failed:\n%s' % (e.command, e.stdout))
272 if not skiptag: 272 if not skiptag:
273 if uri.startswith('git://'): 273 if uri.startswith('git://') or uri.startswith('gitsm://'):
274 suffix = 'new' 274 suffix = 'new'
275 else: 275 else:
276 suffix = newpv 276 suffix = newpv
diff --git a/scripts/lib/recipetool/create_npm.py b/scripts/lib/recipetool/create_npm.py
index 579b7ae48a..2bcae91dfa 100644
--- a/scripts/lib/recipetool/create_npm.py
+++ b/scripts/lib/recipetool/create_npm.py
@@ -204,6 +204,9 @@ class NpmRecipeHandler(RecipeHandler):
204 self._run_npm_install(d, srctree, registry, dev) 204 self._run_npm_install(d, srctree, registry, dev)
205 shrinkwrap_file = self._generate_shrinkwrap(d, srctree, dev) 205 shrinkwrap_file = self._generate_shrinkwrap(d, srctree, dev)
206 206
207 with open(shrinkwrap_file, "r") as f:
208 shrinkwrap = json.load(f)
209
207 if os.path.exists(lock_copy): 210 if os.path.exists(lock_copy):
208 bb.utils.movefile(lock_copy, lock_file) 211 bb.utils.movefile(lock_copy, lock_file)
209 212
@@ -226,7 +229,8 @@ class NpmRecipeHandler(RecipeHandler):
226 value = origvalue.replace("version=" + data["version"], "version=${PV}") 229 value = origvalue.replace("version=" + data["version"], "version=${PV}")
227 value = value.replace("version=latest", "version=${PV}") 230 value = value.replace("version=latest", "version=${PV}")
228 values = [line.strip() for line in value.strip('\n').splitlines()] 231 values = [line.strip() for line in value.strip('\n').splitlines()]
229 values.append(url_recipe) 232 if "dependencies" in shrinkwrap:
233 values.append(url_recipe)
230 return values, None, 4, False 234 return values, None, 4, False
231 235
232 (_, newlines) = bb.utils.edit_metadata(lines_before, ["SRC_URI"], _handle_srcuri) 236 (_, newlines) = bb.utils.edit_metadata(lines_before, ["SRC_URI"], _handle_srcuri)
diff --git a/scripts/lib/wic/canned-wks/common.wks.inc b/scripts/lib/wic/canned-wks/common.wks.inc
index 89880b417b..4fd29fa8c1 100644
--- a/scripts/lib/wic/canned-wks/common.wks.inc
+++ b/scripts/lib/wic/canned-wks/common.wks.inc
@@ -1,3 +1,3 @@
1# This file is included into 3 canned wks files from this directory 1# This file is included into 3 canned wks files from this directory
2part /boot --source bootimg-pcbios --ondisk sda --label boot --active --align 1024 2part /boot --source bootimg-pcbios --ondisk sda --label boot --active --align 1024
3part / --source rootfs --use-uuid --fstype=ext4 --label platform --align 1024 3part / --source rootfs --use-uuid --fstype=ext4 --mkfs-extraopts "-T default" --label platform --align 1024
diff --git a/scripts/lib/wic/canned-wks/directdisk-gpt.wks b/scripts/lib/wic/canned-wks/directdisk-gpt.wks
index 8d7d8de6ea..cf16c0c30b 100644
--- a/scripts/lib/wic/canned-wks/directdisk-gpt.wks
+++ b/scripts/lib/wic/canned-wks/directdisk-gpt.wks
@@ -4,7 +4,7 @@
4 4
5 5
6part /boot --source bootimg-pcbios --ondisk sda --label boot --active --align 1024 6part /boot --source bootimg-pcbios --ondisk sda --label boot --active --align 1024
7part / --source rootfs --ondisk sda --fstype=ext4 --label platform --align 1024 --use-uuid 7part / --source rootfs --ondisk sda --fstype=ext4 --mkfs-extraopts "-T default" --label platform --align 1024 --use-uuid
8 8
9bootloader --ptable gpt --timeout=0 --append="rootwait rootfstype=ext4 video=vesafb vga=0x318 console=tty0 console=ttyS0,115200n8" 9bootloader --ptable gpt --timeout=0 --append="rootwait rootfstype=ext4 video=vesafb vga=0x318 console=tty0 console=ttyS0,115200n8"
10 10
diff --git a/scripts/lib/wic/canned-wks/mkefidisk.wks b/scripts/lib/wic/canned-wks/mkefidisk.wks
index 9f534fe184..d1878e23e5 100644
--- a/scripts/lib/wic/canned-wks/mkefidisk.wks
+++ b/scripts/lib/wic/canned-wks/mkefidisk.wks
@@ -4,7 +4,7 @@
4 4
5part /boot --source bootimg-efi --sourceparams="loader=grub-efi" --ondisk sda --label msdos --active --align 1024 5part /boot --source bootimg-efi --sourceparams="loader=grub-efi" --ondisk sda --label msdos --active --align 1024
6 6
7part / --source rootfs --ondisk sda --fstype=ext4 --label platform --align 1024 --use-uuid 7part / --source rootfs --ondisk sda --fstype=ext4 --mkfs-extraopts "-T default" --label platform --align 1024 --use-uuid
8 8
9part swap --ondisk sda --size 44 --label swap1 --fstype=swap 9part swap --ondisk sda --size 44 --label swap1 --fstype=swap
10 10
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index 913e3283dc..3eb669da39 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -229,6 +229,23 @@ class KickStart():
229 err = "%s:%d: SquashFS does not support LABEL" \ 229 err = "%s:%d: SquashFS does not support LABEL" \
230 % (confpath, lineno) 230 % (confpath, lineno)
231 raise KickStartError(err) 231 raise KickStartError(err)
232 if parsed.fstype == 'msdos' or parsed.fstype == 'vfat':
233 if parsed.fsuuid:
234 if parsed.fsuuid.upper().startswith('0X'):
235 if len(parsed.fsuuid) > 10:
236 err = "%s:%d: fsuuid %s given in wks kickstart file " \
237 "exceeds the length limit for %s filesystem. " \
238 "It should be in the form of a 32 bit hexadecimal" \
239 "number (for example, 0xABCD1234)." \
240 % (confpath, lineno, parsed.fsuuid, parsed.fstype)
241 raise KickStartError(err)
242 elif len(parsed.fsuuid) > 8:
243 err = "%s:%d: fsuuid %s given in wks kickstart file " \
244 "exceeds the length limit for %s filesystem. " \
245 "It should be in the form of a 32 bit hexadecimal" \
246 "number (for example, 0xABCD1234)." \
247 % (confpath, lineno, parsed.fsuuid, parsed.fstype)
248 raise KickStartError(err)
232 if parsed.use_label and not parsed.label: 249 if parsed.use_label and not parsed.label:
233 err = "%s:%d: Must set the label with --label" \ 250 err = "%s:%d: Must set the label with --label" \
234 % (confpath, lineno) 251 % (confpath, lineno)
diff --git a/scripts/lib/wic/misc.py b/scripts/lib/wic/misc.py
index 4b08d649c6..57c042c503 100644
--- a/scripts/lib/wic/misc.py
+++ b/scripts/lib/wic/misc.py
@@ -26,6 +26,7 @@ logger = logging.getLogger('wic')
26 26
27# executable -> recipe pairs for exec_native_cmd 27# executable -> recipe pairs for exec_native_cmd
28NATIVE_RECIPES = {"bmaptool": "bmap-tools", 28NATIVE_RECIPES = {"bmaptool": "bmap-tools",
29 "dumpe2fs": "e2fsprogs",
29 "grub-mkimage": "grub-efi", 30 "grub-mkimage": "grub-efi",
30 "isohybrid": "syslinux", 31 "isohybrid": "syslinux",
31 "mcopy": "mtools", 32 "mcopy": "mtools",
@@ -138,9 +139,12 @@ def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""):
138 if pseudo: 139 if pseudo:
139 cmd_and_args = pseudo + cmd_and_args 140 cmd_and_args = pseudo + cmd_and_args
140 141
141 native_paths = "%s/sbin:%s/usr/sbin:%s/usr/bin:%s/bin" % \ 142 hosttools_dir = get_bitbake_var("HOSTTOOLS_DIR")
143
144 native_paths = "%s/sbin:%s/usr/sbin:%s/usr/bin:%s/bin:%s" % \
142 (native_sysroot, native_sysroot, 145 (native_sysroot, native_sysroot,
143 native_sysroot, native_sysroot) 146 native_sysroot, native_sysroot,
147 hosttools_dir)
144 148
145 native_cmd_and_args = "export PATH=%s:$PATH;%s" % \ 149 native_cmd_and_args = "export PATH=%s:$PATH;%s" % \
146 (native_paths, cmd_and_args) 150 (native_paths, cmd_and_args)
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index ebe250b00d..85f9847047 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -54,6 +54,9 @@ class Partition():
54 self.uuid = args.uuid 54 self.uuid = args.uuid
55 self.fsuuid = args.fsuuid 55 self.fsuuid = args.fsuuid
56 self.type = args.type 56 self.type = args.type
57 self.updated_fstab_path = None
58 self.has_fstab = False
59 self.update_fstab_in_rootfs = False
57 60
58 self.lineno = lineno 61 self.lineno = lineno
59 self.source_file = "" 62 self.source_file = ""
@@ -118,11 +121,15 @@ class Partition():
118 return self.fixed_size if self.fixed_size else self.size 121 return self.fixed_size if self.fixed_size else self.size
119 122
120 def prepare(self, creator, cr_workdir, oe_builddir, rootfs_dir, 123 def prepare(self, creator, cr_workdir, oe_builddir, rootfs_dir,
121 bootimg_dir, kernel_dir, native_sysroot): 124 bootimg_dir, kernel_dir, native_sysroot, updated_fstab_path):
122 """ 125 """
123 Prepare content for individual partitions, depending on 126 Prepare content for individual partitions, depending on
124 partition command parameters. 127 partition command parameters.
125 """ 128 """
129 self.updated_fstab_path = updated_fstab_path
130 if self.updated_fstab_path and not (self.fstype.startswith("ext") or self.fstype == "msdos"):
131 self.update_fstab_in_rootfs = True
132
126 if not self.source: 133 if not self.source:
127 if not self.size and not self.fixed_size: 134 if not self.size and not self.fixed_size:
128 raise WicError("The %s partition has a size of zero. Please " 135 raise WicError("The %s partition has a size of zero. Please "
@@ -207,11 +214,21 @@ class Partition():
207 214
208 p_prefix = os.environ.get("PSEUDO_PREFIX", "%s/usr" % native_sysroot) 215 p_prefix = os.environ.get("PSEUDO_PREFIX", "%s/usr" % native_sysroot)
209 if (pseudo_dir): 216 if (pseudo_dir):
217 # Canonicalize the ignore paths. This corresponds to
218 # calling oe.path.canonicalize(), which is used in bitbake.conf.
219 ignore_paths = [rootfs] + (get_bitbake_var("PSEUDO_IGNORE_PATHS") or "").split(",")
220 canonical_paths = []
221 for path in ignore_paths:
222 if "$" not in path:
223 trailing_slash = path.endswith("/") and "/" or ""
224 canonical_paths.append(os.path.realpath(path) + trailing_slash)
225 ignore_paths = ",".join(canonical_paths)
226
210 pseudo = "export PSEUDO_PREFIX=%s;" % p_prefix 227 pseudo = "export PSEUDO_PREFIX=%s;" % p_prefix
211 pseudo += "export PSEUDO_LOCALSTATEDIR=%s;" % pseudo_dir 228 pseudo += "export PSEUDO_LOCALSTATEDIR=%s;" % pseudo_dir
212 pseudo += "export PSEUDO_PASSWD=%s;" % rootfs_dir 229 pseudo += "export PSEUDO_PASSWD=%s;" % rootfs_dir
213 pseudo += "export PSEUDO_NOSYMLINKEXP=1;" 230 pseudo += "export PSEUDO_NOSYMLINKEXP=1;"
214 pseudo += "export PSEUDO_IGNORE_PATHS=%s;" % (rootfs + "," + (get_bitbake_var("PSEUDO_IGNORE_PATHS") or "")) 231 pseudo += "export PSEUDO_IGNORE_PATHS=%s;" % ignore_paths
215 pseudo += "%s " % get_bitbake_var("FAKEROOTCMD") 232 pseudo += "%s " % get_bitbake_var("FAKEROOTCMD")
216 else: 233 else:
217 pseudo = None 234 pseudo = None
@@ -237,7 +254,7 @@ class Partition():
237 254
238 prefix = "ext" if self.fstype.startswith("ext") else self.fstype 255 prefix = "ext" if self.fstype.startswith("ext") else self.fstype
239 method = getattr(self, "prepare_rootfs_" + prefix) 256 method = getattr(self, "prepare_rootfs_" + prefix)
240 method(rootfs, oe_builddir, rootfs_dir, native_sysroot, pseudo) 257 method(rootfs, cr_workdir, oe_builddir, rootfs_dir, native_sysroot, pseudo)
241 self.source_file = rootfs 258 self.source_file = rootfs
242 259
243 # get the rootfs size in the right units for kickstart (kB) 260 # get the rootfs size in the right units for kickstart (kB)
@@ -245,7 +262,7 @@ class Partition():
245 out = exec_cmd(du_cmd) 262 out = exec_cmd(du_cmd)
246 self.size = int(out.split()[0]) 263 self.size = int(out.split()[0])
247 264
248 def prepare_rootfs_ext(self, rootfs, oe_builddir, rootfs_dir, 265 def prepare_rootfs_ext(self, rootfs, cr_workdir, oe_builddir, rootfs_dir,
249 native_sysroot, pseudo): 266 native_sysroot, pseudo):
250 """ 267 """
251 Prepare content for an ext2/3/4 rootfs partition. 268 Prepare content for an ext2/3/4 rootfs partition.
@@ -269,10 +286,21 @@ class Partition():
269 (self.fstype, extraopts, rootfs, label_str, self.fsuuid, rootfs_dir) 286 (self.fstype, extraopts, rootfs, label_str, self.fsuuid, rootfs_dir)
270 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) 287 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
271 288
289 if self.updated_fstab_path and self.has_fstab:
290 debugfs_script_path = os.path.join(cr_workdir, "debugfs_script")
291 with open(debugfs_script_path, "w") as f:
292 f.write("cd etc\n")
293 f.write("rm fstab\n")
294 f.write("write %s fstab\n" % (self.updated_fstab_path))
295 debugfs_cmd = "debugfs -w -f %s %s" % (debugfs_script_path, rootfs)
296 exec_native_cmd(debugfs_cmd, native_sysroot)
297
272 mkfs_cmd = "fsck.%s -pvfD %s" % (self.fstype, rootfs) 298 mkfs_cmd = "fsck.%s -pvfD %s" % (self.fstype, rootfs)
273 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) 299 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
274 300
275 def prepare_rootfs_btrfs(self, rootfs, oe_builddir, rootfs_dir, 301 self.check_for_Y2038_problem(rootfs, native_sysroot)
302
303 def prepare_rootfs_btrfs(self, rootfs, cr_workdir, oe_builddir, rootfs_dir,
276 native_sysroot, pseudo): 304 native_sysroot, pseudo):
277 """ 305 """
278 Prepare content for a btrfs rootfs partition. 306 Prepare content for a btrfs rootfs partition.
@@ -295,7 +323,7 @@ class Partition():
295 self.mkfs_extraopts, self.fsuuid, rootfs) 323 self.mkfs_extraopts, self.fsuuid, rootfs)
296 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) 324 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
297 325
298 def prepare_rootfs_msdos(self, rootfs, oe_builddir, rootfs_dir, 326 def prepare_rootfs_msdos(self, rootfs, cr_workdir, oe_builddir, rootfs_dir,
299 native_sysroot, pseudo): 327 native_sysroot, pseudo):
300 """ 328 """
301 Prepare content for a msdos/vfat rootfs partition. 329 Prepare content for a msdos/vfat rootfs partition.
@@ -324,12 +352,16 @@ class Partition():
324 mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, rootfs_dir) 352 mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, rootfs_dir)
325 exec_native_cmd(mcopy_cmd, native_sysroot) 353 exec_native_cmd(mcopy_cmd, native_sysroot)
326 354
355 if self.updated_fstab_path and self.has_fstab:
356 mcopy_cmd = "mcopy -i %s %s ::/etc/fstab" % (rootfs, self.updated_fstab_path)
357 exec_native_cmd(mcopy_cmd, native_sysroot)
358
327 chmod_cmd = "chmod 644 %s" % rootfs 359 chmod_cmd = "chmod 644 %s" % rootfs
328 exec_cmd(chmod_cmd) 360 exec_cmd(chmod_cmd)
329 361
330 prepare_rootfs_vfat = prepare_rootfs_msdos 362 prepare_rootfs_vfat = prepare_rootfs_msdos
331 363
332 def prepare_rootfs_squashfs(self, rootfs, oe_builddir, rootfs_dir, 364 def prepare_rootfs_squashfs(self, rootfs, cr_workdir, oe_builddir, rootfs_dir,
333 native_sysroot, pseudo): 365 native_sysroot, pseudo):
334 """ 366 """
335 Prepare content for a squashfs rootfs partition. 367 Prepare content for a squashfs rootfs partition.
@@ -358,6 +390,8 @@ class Partition():
358 (self.fstype, extraopts, label_str, self.fsuuid, rootfs) 390 (self.fstype, extraopts, label_str, self.fsuuid, rootfs)
359 exec_native_cmd(mkfs_cmd, native_sysroot) 391 exec_native_cmd(mkfs_cmd, native_sysroot)
360 392
393 self.check_for_Y2038_problem(rootfs, native_sysroot)
394
361 def prepare_empty_partition_btrfs(self, rootfs, oe_builddir, 395 def prepare_empty_partition_btrfs(self, rootfs, oe_builddir,
362 native_sysroot): 396 native_sysroot):
363 """ 397 """
@@ -419,3 +453,37 @@ class Partition():
419 453
420 mkswap_cmd = "mkswap %s -U %s %s" % (label_str, self.fsuuid, path) 454 mkswap_cmd = "mkswap %s -U %s %s" % (label_str, self.fsuuid, path)
421 exec_native_cmd(mkswap_cmd, native_sysroot) 455 exec_native_cmd(mkswap_cmd, native_sysroot)
456
457 def check_for_Y2038_problem(self, rootfs, native_sysroot):
458 """
459 Check if the filesystem is affected by the Y2038 problem
460 (Y2038 problem = 32 bit time_t overflow in January 2038)
461 """
462 def get_err_str(part):
463 err = "The {} filesystem {} has no Y2038 support."
464 if part.mountpoint:
465 args = [part.fstype, "mounted at %s" % part.mountpoint]
466 elif part.label:
467 args = [part.fstype, "labeled '%s'" % part.label]
468 elif part.part_name:
469 args = [part.fstype, "in partition '%s'" % part.part_name]
470 else:
471 args = [part.fstype, "in partition %s" % part.num]
472 return err.format(*args)
473
474 # ext2 and ext3 are always affected by the Y2038 problem
475 if self.fstype in ["ext2", "ext3"]:
476 logger.warn(get_err_str(self))
477 return
478
479 ret, out = exec_native_cmd("dumpe2fs %s" % rootfs, native_sysroot)
480
481 # if ext4 is affected by the Y2038 problem depends on the inode size
482 for line in out.splitlines():
483 if line.startswith("Inode size:"):
484 size = int(line.split(":")[1].strip())
485 if size < 256:
486 logger.warn("%s Inodes (of size %d) are too small." %
487 (get_err_str(self), size))
488 break
489
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index 55db826e93..ea709e8c54 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -54,15 +54,16 @@ class DirectPlugin(ImagerPlugin):
54 self.native_sysroot = native_sysroot 54 self.native_sysroot = native_sysroot
55 self.oe_builddir = oe_builddir 55 self.oe_builddir = oe_builddir
56 56
57 self.debug = options.debug
57 self.outdir = options.outdir 58 self.outdir = options.outdir
58 self.compressor = options.compressor 59 self.compressor = options.compressor
59 self.bmap = options.bmap 60 self.bmap = options.bmap
60 self.no_fstab_update = options.no_fstab_update 61 self.no_fstab_update = options.no_fstab_update
61 self.original_fstab = None 62 self.updated_fstab_path = None
62 63
63 self.name = "%s-%s" % (os.path.splitext(os.path.basename(wks_file))[0], 64 self.name = "%s-%s" % (os.path.splitext(os.path.basename(wks_file))[0],
64 strftime("%Y%m%d%H%M")) 65 strftime("%Y%m%d%H%M"))
65 self.workdir = tempfile.mkdtemp(dir=self.outdir, prefix='tmp.wic.') 66 self.workdir = self.setup_workdir(options.workdir)
66 self._image = None 67 self._image = None
67 self.ptable_format = self.ks.bootloader.ptable 68 self.ptable_format = self.ks.bootloader.ptable
68 self.parts = self.ks.partitions 69 self.parts = self.ks.partitions
@@ -78,6 +79,16 @@ class DirectPlugin(ImagerPlugin):
78 self._image = PartitionedImage(image_path, self.ptable_format, 79 self._image = PartitionedImage(image_path, self.ptable_format,
79 self.parts, self.native_sysroot) 80 self.parts, self.native_sysroot)
80 81
82 def setup_workdir(self, workdir):
83 if workdir:
84 if os.path.exists(workdir):
85 raise WicError("Internal workdir '%s' specified in wic arguments already exists!" % (workdir))
86
87 os.makedirs(workdir)
88 return workdir
89 else:
90 return tempfile.mkdtemp(dir=self.outdir, prefix='tmp.wic.')
91
81 def do_create(self): 92 def do_create(self):
82 """ 93 """
83 Plugin entry point. 94 Plugin entry point.
@@ -90,11 +101,8 @@ class DirectPlugin(ImagerPlugin):
90 finally: 101 finally:
91 self.cleanup() 102 self.cleanup()
92 103
93 def _write_fstab(self, image_rootfs): 104 def update_fstab(self, image_rootfs):
94 """overriden to generate fstab (temporarily) in rootfs. This is called 105 """Assume partition order same as in wks"""
95 from _create, make sure it doesn't get called from
96 BaseImage.create()
97 """
98 if not image_rootfs: 106 if not image_rootfs:
99 return 107 return
100 108
@@ -104,18 +112,9 @@ class DirectPlugin(ImagerPlugin):
104 112
105 with open(fstab_path) as fstab: 113 with open(fstab_path) as fstab:
106 fstab_lines = fstab.readlines() 114 fstab_lines = fstab.readlines()
107 self.original_fstab = fstab_lines.copy()
108
109 if self._update_fstab(fstab_lines, self.parts):
110 with open(fstab_path, "w") as fstab:
111 fstab.writelines(fstab_lines)
112 else:
113 self.original_fstab = None
114 115
115 def _update_fstab(self, fstab_lines, parts):
116 """Assume partition order same as in wks"""
117 updated = False 116 updated = False
118 for part in parts: 117 for part in self.parts:
119 if not part.realnum or not part.mountpoint \ 118 if not part.realnum or not part.mountpoint \
120 or part.mountpoint == "/": 119 or part.mountpoint == "/":
121 continue 120 continue
@@ -144,7 +143,10 @@ class DirectPlugin(ImagerPlugin):
144 fstab_lines.append(line) 143 fstab_lines.append(line)
145 updated = True 144 updated = True
146 145
147 return updated 146 if updated:
147 self.updated_fstab_path = os.path.join(self.workdir, "fstab")
148 with open(self.updated_fstab_path, "w") as f:
149 f.writelines(fstab_lines)
148 150
149 def _full_path(self, path, name, extention): 151 def _full_path(self, path, name, extention):
150 """ Construct full file path to a file we generate. """ 152 """ Construct full file path to a file we generate. """
@@ -160,7 +162,7 @@ class DirectPlugin(ImagerPlugin):
160 a partitioned image. 162 a partitioned image.
161 """ 163 """
162 if not self.no_fstab_update: 164 if not self.no_fstab_update:
163 self._write_fstab(self.rootfs_dir.get("ROOTFS_DIR")) 165 self.update_fstab(self.rootfs_dir.get("ROOTFS_DIR"))
164 166
165 for part in self.parts: 167 for part in self.parts:
166 # get rootfs size from bitbake variable if it's not set in .ks file 168 # get rootfs size from bitbake variable if it's not set in .ks file
@@ -273,14 +275,9 @@ class DirectPlugin(ImagerPlugin):
273 if os.path.isfile(path): 275 if os.path.isfile(path):
274 shutil.move(path, os.path.join(self.outdir, fname)) 276 shutil.move(path, os.path.join(self.outdir, fname))
275 277
276 #Restore original fstab 278 # remove work directory when it is not in debugging mode
277 if self.original_fstab: 279 if not self.debug:
278 fstab_path = self.rootfs_dir.get("ROOTFS_DIR") + "/etc/fstab" 280 shutil.rmtree(self.workdir, ignore_errors=True)
279 with open(fstab_path, "w") as fstab:
280 fstab.writelines(self.original_fstab)
281
282 # remove work directory
283 shutil.rmtree(self.workdir, ignore_errors=True)
284 281
285# Overhead of the MBR partitioning scheme (just one sector) 282# Overhead of the MBR partitioning scheme (just one sector)
286MBR_OVERHEAD = 1 283MBR_OVERHEAD = 1
@@ -343,6 +340,13 @@ class PartitionedImage():
343 part.fsuuid = '0x' + str(uuid.uuid4())[:8].upper() 340 part.fsuuid = '0x' + str(uuid.uuid4())[:8].upper()
344 else: 341 else:
345 part.fsuuid = str(uuid.uuid4()) 342 part.fsuuid = str(uuid.uuid4())
343 else:
344 #make sure the fsuuid for vfat/msdos align with format 0xYYYYYYYY
345 if part.fstype == 'vfat' or part.fstype == 'msdos':
346 if part.fsuuid.upper().startswith("0X"):
347 part.fsuuid = '0x' + part.fsuuid.upper()[2:].rjust(8,"0")
348 else:
349 part.fsuuid = '0x' + part.fsuuid.upper().rjust(8,"0")
346 350
347 def prepare(self, imager): 351 def prepare(self, imager):
348 """Prepare an image. Call prepare method of all image partitions.""" 352 """Prepare an image. Call prepare method of all image partitions."""
@@ -351,7 +355,8 @@ class PartitionedImage():
351 # sizes before we can add them and do the layout. 355 # sizes before we can add them and do the layout.
352 part.prepare(imager, imager.workdir, imager.oe_builddir, 356 part.prepare(imager, imager.workdir, imager.oe_builddir,
353 imager.rootfs_dir, imager.bootimg_dir, 357 imager.rootfs_dir, imager.bootimg_dir,
354 imager.kernel_dir, imager.native_sysroot) 358 imager.kernel_dir, imager.native_sysroot,
359 imager.updated_fstab_path)
355 360
356 # Converting kB to sectors for parted 361 # Converting kB to sectors for parted
357 part.size_sec = part.disk_size * 1024 // self.sector_size 362 part.size_sec = part.disk_size * 1024 // self.sector_size
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
index f1db83f8a1..96d940a91d 100644
--- a/scripts/lib/wic/plugins/source/rootfs.py
+++ b/scripts/lib/wic/plugins/source/rootfs.py
@@ -94,6 +94,7 @@ class RootfsPlugin(SourcePlugin):
94 "it is not a valid path, exiting" % part.rootfs_dir) 94 "it is not a valid path, exiting" % part.rootfs_dir)
95 95
96 part.rootfs_dir = cls.__get_rootfs_dir(rootfs_dir) 96 part.rootfs_dir = cls.__get_rootfs_dir(rootfs_dir)
97 part.has_fstab = os.path.exists(os.path.join(part.rootfs_dir, "etc/fstab"))
97 pseudo_dir = os.path.join(part.rootfs_dir, "../pseudo") 98 pseudo_dir = os.path.join(part.rootfs_dir, "../pseudo")
98 if not os.path.lexists(pseudo_dir): 99 if not os.path.lexists(pseudo_dir):
99 logger.warn("%s folder does not exist. " 100 logger.warn("%s folder does not exist. "
@@ -103,9 +104,9 @@ class RootfsPlugin(SourcePlugin):
103 new_rootfs = None 104 new_rootfs = None
104 new_pseudo = None 105 new_pseudo = None
105 # Handle excluded paths. 106 # Handle excluded paths.
106 if part.exclude_path or part.include_path or part.change_directory: 107 if part.exclude_path or part.include_path or part.change_directory or part.update_fstab_in_rootfs:
107 # We need a new rootfs directory we can delete files from. Copy to 108 # We need a new rootfs directory we can safely modify without
108 # workdir. 109 # interfering with other tasks. Copy to workdir.
109 new_rootfs = os.path.realpath(os.path.join(cr_workdir, "rootfs%d" % part.lineno)) 110 new_rootfs = os.path.realpath(os.path.join(cr_workdir, "rootfs%d" % part.lineno))
110 111
111 if os.path.lexists(new_rootfs): 112 if os.path.lexists(new_rootfs):
@@ -199,17 +200,33 @@ class RootfsPlugin(SourcePlugin):
199 if not os.path.lexists(full_path): 200 if not os.path.lexists(full_path):
200 continue 201 continue
201 202
203 if new_pseudo:
204 pseudo = cls.__get_pseudo(native_sysroot, new_rootfs, new_pseudo)
205 else:
206 pseudo = None
202 if path.endswith(os.sep): 207 if path.endswith(os.sep):
203 # Delete content only. 208 # Delete content only.
204 for entry in os.listdir(full_path): 209 for entry in os.listdir(full_path):
205 full_entry = os.path.join(full_path, entry) 210 full_entry = os.path.join(full_path, entry)
206 if os.path.isdir(full_entry) and not os.path.islink(full_entry): 211 rm_cmd = "rm -rf %s" % (full_entry)
207 shutil.rmtree(full_entry) 212 exec_native_cmd(rm_cmd, native_sysroot, pseudo)
208 else:
209 os.remove(full_entry)
210 else: 213 else:
211 # Delete whole directory. 214 # Delete whole directory.
212 shutil.rmtree(full_path) 215 rm_cmd = "rm -rf %s" % (full_path)
216 exec_native_cmd(rm_cmd, native_sysroot, pseudo)
217
218 # Update part.has_fstab here as fstab may have been added or
219 # removed by the above modifications.
220 part.has_fstab = os.path.exists(os.path.join(new_rootfs, "etc/fstab"))
221 if part.update_fstab_in_rootfs and part.has_fstab:
222 fstab_path = os.path.join(new_rootfs, "etc/fstab")
223 # Assume that fstab should always be owned by root with fixed permissions
224 install_cmd = "install -m 0644 %s %s" % (part.updated_fstab_path, fstab_path)
225 if new_pseudo:
226 pseudo = cls.__get_pseudo(native_sysroot, new_rootfs, new_pseudo)
227 else:
228 pseudo = None
229 exec_native_cmd(install_cmd, native_sysroot, pseudo)
213 230
214 part.prepare_rootfs(cr_workdir, oe_builddir, 231 part.prepare_rootfs(cr_workdir, oe_builddir,
215 new_rootfs or part.rootfs_dir, native_sysroot, 232 new_rootfs or part.rootfs_dir, native_sysroot,
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index 93220e3617..75dd23efa3 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -598,6 +598,9 @@ def main():
598 logger.error("Unable to find bitbake by searching parent directory of this script or PATH") 598 logger.error("Unable to find bitbake by searching parent directory of this script or PATH")
599 sys.exit(1) 599 sys.exit(1)
600 logger.debug('Found bitbake path: %s' % bitbakepath) 600 logger.debug('Found bitbake path: %s' % bitbakepath)
601 if not os.environ.get('BUILDDIR', ''):
602 logger.error("This script can only be run after initialising the build environment (e.g. by using oe-init-build-env)")
603 sys.exit(1)
601 tinfoil = tinfoil_init() 604 tinfoil = tinfoil_init()
602 try: 605 try:
603 args.pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR') 606 args.pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR')
diff --git a/scripts/oe-run-native b/scripts/oe-run-native
index 4e63e69cc4..22958d97e7 100755
--- a/scripts/oe-run-native
+++ b/scripts/oe-run-native
@@ -43,7 +43,7 @@ fi
43OLD_PATH=$PATH 43OLD_PATH=$PATH
44 44
45# look for a tool only in native sysroot 45# look for a tool only in native sysroot
46PATH=$OECORE_NATIVE_SYSROOT/usr/bin:$OECORE_NATIVE_SYSROOT/bin:$OECORE_NATIVE_SYSROOT/usr/sbin:$OECORE_NATIVE_SYSROOT/sbin$(find $OECORE_NATIVE_SYSROOT/usr/bin/*-native -maxdepth 1 -type d -printf ":%p") 46PATH=$OECORE_NATIVE_SYSROOT/usr/bin:$OECORE_NATIVE_SYSROOT/bin:$OECORE_NATIVE_SYSROOT/usr/sbin:$OECORE_NATIVE_SYSROOT/sbin$(find $OECORE_NATIVE_SYSROOT/usr/bin -maxdepth 1 -name "*-native" -type d -printf ":%p")
47tool_find=`/usr/bin/which $tool 2>/dev/null` 47tool_find=`/usr/bin/which $tool 2>/dev/null`
48 48
49if [ -n "$tool_find" ] ; then 49if [ -n "$tool_find" ] ; then
diff --git a/scripts/runqemu b/scripts/runqemu
index e5e66f3453..b80fec1c99 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -1340,6 +1340,8 @@ class BaseConfig(object):
1340 1340
1341 for ovmf in self.ovmf_bios: 1341 for ovmf in self.ovmf_bios:
1342 format = ovmf.rsplit('.', 1)[-1] 1342 format = ovmf.rsplit('.', 1)[-1]
1343 if format == "bin":
1344 format = "raw"
1343 self.qemu_opt += ' -drive if=pflash,format=%s,file=%s' % (format, ovmf) 1345 self.qemu_opt += ' -drive if=pflash,format=%s,file=%s' % (format, ovmf)
1344 1346
1345 self.qemu_opt += ' ' + self.qemu_opt_script 1347 self.qemu_opt += ' ' + self.qemu_opt_script
diff --git a/scripts/verify-bashisms b/scripts/verify-bashisms
index fb0cc719ea..14d8c298e9 100755
--- a/scripts/verify-bashisms
+++ b/scripts/verify-bashisms
@@ -100,7 +100,7 @@ if __name__=='__main__':
100 args = parser.parse_args() 100 args = parser.parse_args()
101 101
102 if shutil.which("checkbashisms.pl") is None: 102 if shutil.which("checkbashisms.pl") is None:
103 print("Cannot find checkbashisms.pl on $PATH, get it from https://anonscm.debian.org/cgit/collab-maint/devscripts.git/plain/scripts/checkbashisms.pl") 103 print("Cannot find checkbashisms.pl on $PATH, get it from https://salsa.debian.org/debian/devscripts/raw/master/scripts/checkbashisms.pl")
104 sys.exit(1) 104 sys.exit(1)
105 105
106 # The order of defining the worker function, 106 # The order of defining the worker function,
diff --git a/scripts/wic b/scripts/wic
index 24700f380f..a741aed364 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -312,6 +312,8 @@ def wic_init_parser_create(subparser):
312 312
313 subparser.add_argument("-o", "--outdir", dest="outdir", default='.', 313 subparser.add_argument("-o", "--outdir", dest="outdir", default='.',
314 help="name of directory to create image in") 314 help="name of directory to create image in")
315 subparser.add_argument("-w", "--workdir",
316 help="temporary workdir to use for intermediate files")
315 subparser.add_argument("-e", "--image-name", dest="image_name", 317 subparser.add_argument("-e", "--image-name", dest="image_name",
316 help="name of the image to use the artifacts from " 318 help="name of the image to use the artifacts from "
317 "e.g. core-image-sato") 319 "e.g. core-image-sato")
diff --git a/scripts/yocto-check-layer b/scripts/yocto-check-layer
index b7c83c8b54..deba3cb4f8 100755
--- a/scripts/yocto-check-layer
+++ b/scripts/yocto-check-layer
@@ -138,6 +138,9 @@ def main():
138 layer['type'] == LayerType.ERROR_BSP_DISTRO: 138 layer['type'] == LayerType.ERROR_BSP_DISTRO:
139 continue 139 continue
140 140
141 # Reset to a clean backup copy for each run
142 shutil.copyfile(bblayersconf + '.backup', bblayersconf)
143
141 if check_bblayers(bblayersconf, layer['path'], logger): 144 if check_bblayers(bblayersconf, layer['path'], logger):
142 logger.info("%s already in %s. To capture initial signatures, layer under test should not present " 145 logger.info("%s already in %s. To capture initial signatures, layer under test should not present "
143 "in BBLAYERS. Please remove %s from BBLAYERS." % (layer['name'], bblayersconf, layer['name'])) 146 "in BBLAYERS. Please remove %s from BBLAYERS." % (layer['name'], bblayersconf, layer['name']))