The user-mode syscall verifiers for the 16-bit ("wide data") UART API in drivers/serial/uart_handlers.c validated the wrong driver operation. z_vrfy_uart_poll_out_u16(), z_vrfy_uart_tx_u16() and z_vrfy_uart_rx_enable_u16() each ran K_SYSCALL_DRIVER_UART() against the 8-bit op (poll_out, tx, rx_enable) rather than the 16-bit op that the corresponding implementation dereferences (poll_out_u16, tx_u16, rx_enable_u16). z_impl_uart_poll_out_u16(), z_impl_uart_tx_u16() and z_impl_uart_rx_enable_u16() in include/zephyr/drivers/uart/uart_internal.h call their op unconditionally, with no NULL guard of their own, because the verifier is supposed to have established that the op exists. CONFIG_UART_WIDE_DATA - это выбираемая приложением опция, которую не выбирает ни один драйвер, и только горстка последовательных драйверов в дереве выполняет любую операцию _u16; каждый другой драйвер оставляет эти структурные члены uart_driver_api NULL, все еще предоставляя 8-битные операции старой проверенной проверки. В сборке с CONFIG_USERSPACE и CONFIG_UART_WIDE_DATA (плюс CONFIG_UART_ASYNC_API для вариантов uart_tx_u16() и uart_rx_enable_u16()) непривилегированный поток пользовательского режима, который законно содержит доступ к такому объекту устройства UART, может вызывать syscall _u16: объект, разрешение и op проверяют все проходы, а реализация на стороне ядра затем выполняет косвенный вызов через функцию NULL. Результатом является исключение CPU, взятое в контексте ядра вместо предполагаемого возвращения K_OOPS или -ENOSYS.
С k_sys_fatal_error_handler () по умолчанию это останавливает систему (или перезагружает ее под CONFIG_RESET_ON_FATAL_ERROR), поэтому поток, ограниченный песочницей пользовательского пространства, может отказать в обслуживании всему устройству - возможность, которую специально предназначена для удержания границы привилегий пользовательского режима. Целью вызова является фиксированный NULL, поэтому нет контролируемого злоумышленником выполнения кода и раскрытия памяти; отдельные проверки границ K_SYSCALL_MEMORY_ARRAY_READ()/K_SYSCALL_MEMORY_ARRAY_WRITE() на буфере вызывающего абонента были и остаются правильными. Фиксирует каждый верификатор при сопоставлении _u16 op, используя простую проверку объекта K_SYSCALL_OBJ(), где op не существует или где реализация уже тестирует его для NULL.
Показать оригинальное описание (EN)
The user-mode syscall verifiers for the 16-bit ("wide data") UART API in drivers/serial/uart_handlers.c validated the wrong driver operation. z_vrfy_uart_poll_out_u16(), z_vrfy_uart_tx_u16() and z_vrfy_uart_rx_enable_u16() each ran K_SYSCALL_DRIVER_UART() against the 8-bit op (poll_out, tx, rx_enable) rather than the 16-bit op that the corresponding implementation dereferences (poll_out_u16, tx_u16, rx_enable_u16). z_impl_uart_poll_out_u16(), z_impl_uart_tx_u16() and z_impl_uart_rx_enable_u16() in include/zephyr/drivers/uart/uart_internal.h call their op unconditionally, with no NULL guard of their own, because the verifier is supposed to have established that the op exists. CONFIG_UART_WIDE_DATA is an application-selectable option that no driver selects, and only a handful of the serial drivers in the tree implement any _u16 operation; every other driver leaves those struct uart_driver_api members NULL while still providing the 8-bit ops the old check inspected. In a build with CONFIG_USERSPACE and CONFIG_UART_WIDE_DATA (plus CONFIG_UART_ASYNC_API for the uart_tx_u16() and uart_rx_enable_u16() variants), an unprivileged user-mode thread that legitimately holds access to such a UART device object can invoke the _u16 syscall: the object, permission and op checks all pass, and the kernel-side implementation then performs an indirect call through a NULL function pointer while running at supervisor privilege. The result is a CPU exception taken in kernel context instead of the intended K_OOPS or -ENOSYS return. With the default k_sys_fatal_error_handler() this halts the system (or warm-reboots it under CONFIG_RESET_ON_FATAL_ERROR), so a thread confined by the userspace sandbox can deny service to the whole device — a capability the user-mode privilege boundary is specifically meant to withhold. The call target is a fixed NULL, so there is no attacker-controlled code execution and no memory disclosure; the separate K_SYSCALL_MEMORY_ARRAY_READ()/K_SYSCALL_MEMORY_ARRAY_WRITE() bounds checks on the caller's buffer were and remain correct. The fix points each verifier at the matching _u16 op, using a plain K_SYSCALL_OBJ() object check where the op does not exist or where the implementation already tests it for NULL.
Характеристики атаки
Последствия
Строка CVSS v3.1