From f2c5f3fadc68922d6b5dcb8967fd5de9f785c3ec Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Thu, 9 Apr 2026 14:32:51 +0200 Subject: libgpiod: update to v2.2.4 Bug-fix release addressing several issues discovered during an AI-augmented security audit. The most severe bug was found in the C extension code of the python bindings - which also get an update - but there were some memory leaks and integer overflow bugs in the core C library as well as in tools and DBus daemon. Full changelog: Bug fixes: - fix buffer over-read bugs when translating uAPI structs to library types - fix variable and argument types where necessary - sanitize values returned by the kernel to avoid potential buffer overflows - fix memory leaks in gpio-tools - add missing return value checks in gpio-tools - fix period parsing in gpio-tools - use correct loop counter in error path in gpio-manager Improvements: - make tests work with newer coreutils by removing cases checking tools' behavior on SIGINT which stopped working due to changes in behavior of the timeout tool Also: drop the patch that's now upstream from the recipe. Signed-off-by: Bartosz Golaszewski Signed-off-by: Khem Raj --- ...0001-tools-tests-remove-SIGINT-test-cases.patch | 83 ---------------- meta-oe/recipes-support/libgpiod/libgpiod_2.2.3.bb | 107 --------------------- meta-oe/recipes-support/libgpiod/libgpiod_2.2.4.bb | 106 ++++++++++++++++++++ 3 files changed, 106 insertions(+), 190 deletions(-) delete mode 100644 meta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-tools-tests-remove-SIGINT-test-cases.patch delete mode 100644 meta-oe/recipes-support/libgpiod/libgpiod_2.2.3.bb create mode 100644 meta-oe/recipes-support/libgpiod/libgpiod_2.2.4.bb diff --git a/meta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-tools-tests-remove-SIGINT-test-cases.patch b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-tools-tests-remove-SIGINT-test-cases.patch deleted file mode 100644 index 7fe06b9882..0000000000 --- a/meta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-tools-tests-remove-SIGINT-test-cases.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 3c38c5f9ab49384039f35408656a88f87619dd03 Mon Sep 17 00:00:00 2001 -From: Bartosz Golaszewski -Date: Wed, 18 Mar 2026 14:07:06 +0100 -Subject: [libgpiod][PATCH] tools: tests: remove SIGINT test cases - -In coreutils v9.10 (specifically with commit 8c2461933411 ("timeout: -honor ignored signal dispositions")) the behavior of timeout changed and -it will no longer propagate SIGINT or SIGQUIT in shell background jobs. -This breaks the test cases checking the behavior of tools after SIGINT. -We have to assume that if exit after SIGTERM works, then so does it -after SIGINT and remove the failing tests. - -Upstream-Status: Submitted [https://lore.kernel.org/all/20260318131413.56575-1-bartosz.golaszewski@oss.qualcomm.com/] -Signed-off-by: Bartosz Golaszewski ---- - tools/gpio-tools-test.bash | 37 ------------------------------------- - 1 file changed, 37 deletions(-) - -diff --git a/tools/gpio-tools-test.bash b/tools/gpio-tools-test.bash -index 71d6e3d..62f6836 100755 ---- a/tools/gpio-tools-test.bash -+++ b/tools/gpio-tools-test.bash -@@ -1415,17 +1415,6 @@ test_gpioset_with_lines_strictly_by_name() { - gpiosim_check_value sim0 6 0 - } - --test_gpioset_interactive_after_SIGINT() { -- gpiosim_chip sim0 num_lines=8 line_name=1:foo -- -- dut_run gpioset -i foo=1 -- -- dut_kill -SIGINT -- dut_wait -- -- status_is 130 --} -- - test_gpioset_interactive_after_SIGTERM() { - gpiosim_chip sim0 num_lines=8 line_name=1:foo - -@@ -1907,20 +1896,6 @@ test_gpiomon_multiple_lines_across_multiple_chips() { - assert_fail dut_readable - } - --test_gpiomon_exit_after_SIGINT() { -- gpiosim_chip sim0 num_lines=8 -- -- local sim0=${GPIOSIM_CHIP_NAME[sim0]} -- -- dut_run gpiomon --banner --chip "$sim0" 4 -- dut_regex_match "Monitoring line .*" -- -- dut_kill -SIGINT -- dut_wait -- -- status_is 130 --} -- - test_gpiomon_exit_after_SIGTERM() { - gpiosim_chip sim0 num_lines=8 - -@@ -2503,18 +2478,6 @@ test_gpionotify_multiple_lines_across_multiple_chips() { - assert_fail dut_readable - } - --test_gpionotify_exit_after_SIGINT() { -- gpiosim_chip sim0 num_lines=8 -- -- dut_run gpionotify --banner --chip "${GPIOSIM_CHIP_NAME[sim0]}" 4 -- dut_regex_match "Watching line .*" -- -- dut_kill -SIGINT -- dut_wait -- -- status_is 130 --} -- - test_gpionotify_exit_after_SIGTERM() { - gpiosim_chip sim0 num_lines=8 - --- -2.47.3 - diff --git a/meta-oe/recipes-support/libgpiod/libgpiod_2.2.3.bb b/meta-oe/recipes-support/libgpiod/libgpiod_2.2.3.bb deleted file mode 100644 index 38829a620f..0000000000 --- a/meta-oe/recipes-support/libgpiod/libgpiod_2.2.3.bb +++ /dev/null @@ -1,107 +0,0 @@ -require libgpiod.inc - -inherit systemd update-rc.d useradd gobject-introspection - -LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later & CC-BY-SA-4.0" -LIC_FILES_CHKSUM = " \ - file://LICENSES/GPL-2.0-or-later.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://LICENSES/LGPL-2.1-or-later.txt;md5=4b54a1fd55a448865a0b32d41598759d \ - file://LICENSES/CC-BY-SA-4.0.txt;md5=fba3b94d88bfb9b81369b869a1e9a20f \ -" - -FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}-2.x:" - -SRC_URI += " \ - file://gpio-manager.init \ - file://0001-tools-tests-remove-SIGINT-test-cases.patch \ -" - -SRC_URI[sha256sum] = "70012b0262e4b90f140431efa841ca89643b02ea6c09f507e23cec664a51b71a" - -# Enable all project features for ptest -PACKAGECONFIG[tests] = " \ - --enable-tests --enable-tools --enable-bindings-cxx --enable-bindings-glib --enable-gpioset-interactive --enable-dbus, \ - --disable-tests, \ - kmod util-linux glib-2.0 catch2 libedit glib-2.0-native libgudev, \ - bash ${VIRTUAL-RUNTIME_dbus} glib-2.0-utils libgpiod-manager-cfg shunit2 \ -" -PACKAGECONFIG[gpioset-interactive] = "--enable-gpioset-interactive,--disable-gpioset-interactive,libedit" -PACKAGECONFIG[glib] = "--enable-bindings-glib,--disable-bindings-glib,glib-2.0 glib-2.0-native" -PACKAGECONFIG[dbus] = "--enable-dbus,--disable-dbus,glib-2.0 glib-2.0-native libgudev,${VIRTUAL-RUNTIME_dbus}" - -PACKAGES =+ "${PN}-gpiosim ${PN}-glib ${PN}-manager ${PN}-manager-cfg ${PN}-cli" -FILES:${PN}-tools += "${bindir}/gpionotify" -FILES:${PN}-gpiosim += "${libdir}/libgpiosim.so.*" -FILES:${PN}-gpiosim-dev += "${includedir}/gpiosim.h" -FILES:${PN}-glib += "${libdir}/libgpiod-glib.so.*" -FILES:${PN}-manager += " \ - ${bindir}/gpio-manager \ - ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_system_unitdir}/gpio-manager.service', '', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '${sysconfdir}/init.d/gpio-manager', '', d)} \ -" -FILES:${PN}-manager-cfg += " \ - ${sysconfdir}/dbus-1/system.d/io.gpiod1.conf \ - ${datadir}/dbus-1/interfaces/io.gpiod1.xml \ - ${nonarch_base_libdir}/udev/rules.d/90-gpio.rules \ -" -FILES:${PN}-cli += "${bindir}/gpiocli" - -RDEPENDS:${PN}-manager += "${VIRTUAL-RUNTIME_dbus} ${PN}-manager-cfg" -RDEPENDS:${PN}-cli += "${PN}-manager" - -SYSTEMD_PACKAGES = "${PN}-manager" - -python __anonymous() { - distro_features = d.getVar("DISTRO_FEATURES").split() - packageconfig = d.getVar("PACKAGECONFIG").split() - pn = d.getVar("PN") - - if "systemd" in distro_features and "dbus" in packageconfig: - d.appendVar("EXTRA_OECONF", " --enable-systemd") - # We need to set it conditionally or else the systemd class will look - # for the file that we don't install with systemd support disabled. - d.setVar("SYSTEMD_SERVICE:{}-manager".format(pn), "gpio-manager.service") - else: - d.appendVar("EXTRA_OECONF", " --disable-systemd") - - # Disable gobject introspection set by the bbclass if we don't want it. - if not any(cfg in ["glib", "dbus", "ptest"] for cfg in packageconfig): - d.setVar("GI_DATA_ENABLED", "False") -} - -UPDATERCPN = "${PN}-manager" -INITSCRIPT_NAME = "gpio-manager" -INITSCRIPT_PARAMS = "start 20 2 3 4 5 . stop 20 0 1 6 ." - -USERADD_PACKAGES = "${PN}-manager" -GROUPADD_PARAM:${PN}-manager = "--system gpio" -USERADD_PARAM:${PN}-manager = "--system -M -s /bin/nologin -g gpio gpio-manager" - -RDEPENDS:${PN}-ptest += " \ - ${@bb.utils.contains('PTEST_ENABLED', '1', 'shunit2 bash', '', d)} \ -" -RRECOMMENDS:${PN}-gpiosim += "kernel-module-gpio-sim kernel-module-configfs" -INSANE_SKIP:${PN}-ptest += "buildpaths" - -do_compile:prepend() { - export GIR_EXTRA_LIBS_PATH="${B}/lib/.libs" -} - -do_install:append() { - if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then - install -d ${D}${sysconfdir}/init.d - install -m 0755 ${UNPACKDIR}/gpio-manager.init ${D}${sysconfdir}/init.d/gpio-manager - fi -} - -do_install_ptest:append() { - install -m 0755 ${B}/bindings/cxx/tests/.libs/gpiod-cxx-test ${D}${PTEST_PATH}/tests/ - install -m 0755 ${S}/tools/gpio-tools-test.bash ${D}${PTEST_PATH}/tests/ - install -m 0644 ${S}/tests/scripts/gpiod-bash-test-helper.inc ${D}${PTEST_PATH}/tests/ - install -m 0644 ${S}/tests/gpiosim/gpiosim.h ${D}${includedir}/gpiosim.h - install -m 0755 ${B}/bindings/glib/tests/.libs/gpiod-glib-test ${D}${PTEST_PATH}/tests/ - install -m 0755 ${B}/dbus/tests/.libs/gpiodbus-test ${D}${PTEST_PATH}/tests/ - install -m 0755 ${S}/dbus/client/gpiocli-test.bash ${D}${PTEST_PATH}/tests/ - install -m 0755 ${B}/dbus/manager/.libs/gpio-manager ${D}${PTEST_PATH}/tests/ - install -m 0755 ${B}/dbus/client/.libs/gpiocli ${D}${PTEST_PATH}/tests/ -} diff --git a/meta-oe/recipes-support/libgpiod/libgpiod_2.2.4.bb b/meta-oe/recipes-support/libgpiod/libgpiod_2.2.4.bb new file mode 100644 index 0000000000..2c8d9f1873 --- /dev/null +++ b/meta-oe/recipes-support/libgpiod/libgpiod_2.2.4.bb @@ -0,0 +1,106 @@ +require libgpiod.inc + +inherit systemd update-rc.d useradd gobject-introspection + +LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later & CC-BY-SA-4.0" +LIC_FILES_CHKSUM = " \ + file://LICENSES/GPL-2.0-or-later.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://LICENSES/LGPL-2.1-or-later.txt;md5=4b54a1fd55a448865a0b32d41598759d \ + file://LICENSES/CC-BY-SA-4.0.txt;md5=fba3b94d88bfb9b81369b869a1e9a20f \ +" + +FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}-2.x:" + +SRC_URI += " \ + file://gpio-manager.init \ +" + +SRC_URI[sha256sum] = "13207176b0eb9b3e0f02552d5f49f5a6a449343ce47416158bb484d9d3019592" + +# Enable all project features for ptest +PACKAGECONFIG[tests] = " \ + --enable-tests --enable-tools --enable-bindings-cxx --enable-bindings-glib --enable-gpioset-interactive --enable-dbus, \ + --disable-tests, \ + kmod util-linux glib-2.0 catch2 libedit glib-2.0-native libgudev, \ + bash ${VIRTUAL-RUNTIME_dbus} glib-2.0-utils libgpiod-manager-cfg shunit2 \ +" +PACKAGECONFIG[gpioset-interactive] = "--enable-gpioset-interactive,--disable-gpioset-interactive,libedit" +PACKAGECONFIG[glib] = "--enable-bindings-glib,--disable-bindings-glib,glib-2.0 glib-2.0-native" +PACKAGECONFIG[dbus] = "--enable-dbus,--disable-dbus,glib-2.0 glib-2.0-native libgudev,${VIRTUAL-RUNTIME_dbus}" + +PACKAGES =+ "${PN}-gpiosim ${PN}-glib ${PN}-manager ${PN}-manager-cfg ${PN}-cli" +FILES:${PN}-tools += "${bindir}/gpionotify" +FILES:${PN}-gpiosim += "${libdir}/libgpiosim.so.*" +FILES:${PN}-gpiosim-dev += "${includedir}/gpiosim.h" +FILES:${PN}-glib += "${libdir}/libgpiod-glib.so.*" +FILES:${PN}-manager += " \ + ${bindir}/gpio-manager \ + ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_system_unitdir}/gpio-manager.service', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '${sysconfdir}/init.d/gpio-manager', '', d)} \ +" +FILES:${PN}-manager-cfg += " \ + ${sysconfdir}/dbus-1/system.d/io.gpiod1.conf \ + ${datadir}/dbus-1/interfaces/io.gpiod1.xml \ + ${nonarch_base_libdir}/udev/rules.d/90-gpio.rules \ +" +FILES:${PN}-cli += "${bindir}/gpiocli" + +RDEPENDS:${PN}-manager += "${VIRTUAL-RUNTIME_dbus} ${PN}-manager-cfg" +RDEPENDS:${PN}-cli += "${PN}-manager" + +SYSTEMD_PACKAGES = "${PN}-manager" + +python __anonymous() { + distro_features = d.getVar("DISTRO_FEATURES").split() + packageconfig = d.getVar("PACKAGECONFIG").split() + pn = d.getVar("PN") + + if "systemd" in distro_features and "dbus" in packageconfig: + d.appendVar("EXTRA_OECONF", " --enable-systemd") + # We need to set it conditionally or else the systemd class will look + # for the file that we don't install with systemd support disabled. + d.setVar("SYSTEMD_SERVICE:{}-manager".format(pn), "gpio-manager.service") + else: + d.appendVar("EXTRA_OECONF", " --disable-systemd") + + # Disable gobject introspection set by the bbclass if we don't want it. + if not any(cfg in ["glib", "dbus", "ptest"] for cfg in packageconfig): + d.setVar("GI_DATA_ENABLED", "False") +} + +UPDATERCPN = "${PN}-manager" +INITSCRIPT_NAME = "gpio-manager" +INITSCRIPT_PARAMS = "start 20 2 3 4 5 . stop 20 0 1 6 ." + +USERADD_PACKAGES = "${PN}-manager" +GROUPADD_PARAM:${PN}-manager = "--system gpio" +USERADD_PARAM:${PN}-manager = "--system -M -s /bin/nologin -g gpio gpio-manager" + +RDEPENDS:${PN}-ptest += " \ + ${@bb.utils.contains('PTEST_ENABLED', '1', 'shunit2 bash', '', d)} \ +" +RRECOMMENDS:${PN}-gpiosim += "kernel-module-gpio-sim kernel-module-configfs" +INSANE_SKIP:${PN}-ptest += "buildpaths" + +do_compile:prepend() { + export GIR_EXTRA_LIBS_PATH="${B}/lib/.libs" +} + +do_install:append() { + if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${UNPACKDIR}/gpio-manager.init ${D}${sysconfdir}/init.d/gpio-manager + fi +} + +do_install_ptest:append() { + install -m 0755 ${B}/bindings/cxx/tests/.libs/gpiod-cxx-test ${D}${PTEST_PATH}/tests/ + install -m 0755 ${S}/tools/gpio-tools-test.bash ${D}${PTEST_PATH}/tests/ + install -m 0644 ${S}/tests/scripts/gpiod-bash-test-helper.inc ${D}${PTEST_PATH}/tests/ + install -m 0644 ${S}/tests/gpiosim/gpiosim.h ${D}${includedir}/gpiosim.h + install -m 0755 ${B}/bindings/glib/tests/.libs/gpiod-glib-test ${D}${PTEST_PATH}/tests/ + install -m 0755 ${B}/dbus/tests/.libs/gpiodbus-test ${D}${PTEST_PATH}/tests/ + install -m 0755 ${S}/dbus/client/gpiocli-test.bash ${D}${PTEST_PATH}/tests/ + install -m 0755 ${B}/dbus/manager/.libs/gpio-manager ${D}${PTEST_PATH}/tests/ + install -m 0755 ${B}/dbus/client/.libs/gpiocli ${D}${PTEST_PATH}/tests/ +} -- cgit v1.2.3-54-g00ecf