Zephyrの脆弱性、ユーザーモードからカーネルの範囲外に書き込まれるおそれ
Summary
Zephyrの GPIO システムコールで、ピン番号の検査が行われていないため、ユーザーモードから範囲外のカーネルメモリに書き込まれるおそれがあります。影響を受けるのは2.2.0から4.4.2までのバージョンで、CONFIG_USERSPACE を有効にしたビルドだけが対象です。修正版の情報は確認できていないため、最新の情報を確認してください。
AI summary
Written by an external AI model and may contain mistakes. Check the original description and references below before acting on it.
Zephyrの GPIO システムコールで、ピン番号の検査が行われていないため、ユーザーモードから範囲外のカーネルメモリに書き込まれるおそれがあります。影響を受けるのは2.2.0から4.4.2までのバージョンで、CONFIG_USERSPACE を有効にしたビルドだけが対象です。修正版の情報は確認できていないため、最新の情報を確認してください。
Affected packages
| Ecosystem | Package | Affected | Fixed |
|---|---|---|---|
| zephyrproject | zephyr |
2.2.0 – 4.4.2 |
— |
Original description The description as published by the source.
The GPIO syscall handlers in drivers/gpio/gpio_handlers.c did not validate the pin argument supplied by a user-mode caller. z_vrfy_gpio_pin_configure(), z_vrfy_gpio_pin_get_config() and z_vrfy_gpio_pin_interrupt_configure() verified only the device object (K_SYSCALL_DRIVER_GPIO() / K_SYSCALL_OBJ()) and then passed the caller-supplied gpio_pin_t straight through to z_impl_gpio_pin_*() and on to the driver. The only pin check in include/zephyr/drivers/gpio.h was __ASSERT(gpio_port_pin_is_supported(cfg->port_pin_mask, pin), ...), which compiles to nothing unless CONFIG_ASSERT is enabled, so in a production build no check existed at all.
GPIO drivers use pin as a shift count and as an array index on the documented assumption that it is a pin the controller supports. On STM32, for example, gpio_stm32_pin_interrupt_configure() turns pin into an EXTI line and stm32_gpio_intc_set_irq_callback() writes data->cb[line_num].cb and data->cb[line_num].data into a NUM_EXTI_LINES-entry array (default 16) in drivers/interrupt_controller/intc_gpio_stm32.c, guarded only by a compiled-out __ASSERT_NO_MSG(); the same function then reads exti_irq_table[line_num] and calls irq_enable() on the result. Other controllers index fixed-size per-pin configuration tables the same way — drivers/gpio/gpio_ite_it8xxx2_v2.c reads an MMIO base pointer out of wuc_base[8] with the caller's pin and performs a read-modify-write through it.
The issue is reachable only in builds with CONFIG_USERSPACE=y (the file is…
Source: CVE.org (CVE Program・cvelistV5) NVD