In the Linux kernel, the following vulnerability has been resolved: nvme: wait for SRCU readers before splicing the namespace list Readers walk ctrl->namespaces under ctrl->srcu, and some of them sleep there, e.g. nvme_wait_freeze() waiting for I/O to drain. nvme_remove_namespaces() moves the list onto its on-stack ns_list with list_splice_init_rcu(), which only waits for RCU readers before relinking the entries. Читатель, все еще находящийся в последнем пространстве имён, следует своему следующему указателю на ns_list вместо ctrl->namespaces и рассматривает стек как пространство имён. Удаление контроллера, в то время как Format NVM ожидает запоздалого чтения в последнем пространстве имен: BUG: KASAN: stack-out-of-bounds в nvme_wait_freeze+0x102/0x120 Read размера 8 в addr ff110001d2f3fc38 по задаче nvme/4413 Call Trace: nvme_wait_freeze nvme_passthru_start nvme_submit_user_cmd nvme_user_cmd nvme_dev_ioctl BUG: невозможно обработать ошибку страницы для адреса: ffffffff8af04850 Use list_splice_init_srcu(), который ждет считывателей SRCU.
Это также исключает льготный период RCU из каждого удаления контроллера. Удаление 64 контроллеров tcp с одним пространством имен каждый, медиана 3 работает на каждом из двух ботинок на ядро: до после nvme disconnect-all (ms) 3491 / 3509 2996 / 3165 nvme_remove_namespaces () avg (ms) 39.0 / 40.5 31.9 / 34.7
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: nvme: wait for SRCU readers before splicing the namespace list Readers walk ctrl->namespaces under ctrl->srcu, and some of them sleep there, e.g. nvme_wait_freeze() waiting for I/O to drain. nvme_remove_namespaces() moves the list onto its on-stack ns_list with list_splice_init_rcu(), which only waits for RCU readers before relinking the entries. A reader still on the last namespace then follows its next pointer to ns_list instead of ctrl->namespaces and treats the stack as a namespace. Deleting a controller while a Format NVM passthrough waits for a delayed read on the last namespace gives: BUG: KASAN: stack-out-of-bounds in nvme_wait_freeze+0x102/0x120 Read of size 8 at addr ff110001d2f3fc38 by task nvme/4413 Call Trace: nvme_wait_freeze nvme_passthru_start nvme_submit_user_cmd nvme_user_cmd nvme_dev_ioctl BUG: unable to handle page fault for address: ffffffff8af04850 Use list_splice_init_srcu() instead, which waits for the SRCU readers. This also takes the RCU grace period out of every controller deletion. Deleting 64 tcp controllers with one namespace each, median of 3 runs on each of two boots per kernel: before after nvme disconnect-all (ms) 3491 / 3509 2996 / 3165 nvme_remove_namespaces() avg (ms) 39.0 / 40.5 31.9 / 34.7