В ядре Linux была устранена следующая уязвимость: io_uring/bpf-ops: очистить bpf_ctx при отправке SQEs bpf_io_uring_submit_sqes() вызывает io_submit_sqes() из программы цикла, с набором current->bpf_ctx, и запросы, выпущенные встроенным запуском с ним, тоже установлены. Код сокета использует has_current_bpf_ctx() для распознавания вызовов от bpf_setsockopt() и друзей, где абонент держит замок сокета и уже был проверен, и пропускает оба. Таким образом, SOCKET_URING_OP_SETSOCKOPT от SQ проходит sockopt_capable () без возможности и работает без lock_sock ().
Задача без возможности может установить SO_MARK, IP_TRANSPARENT или TCP_REPAIR, и два потока, меняющих IP_OPTIONS на одном сокете, один через кольцо, удваивается бесплатно в кратчайшие сроки. SOCK_DESTROY через IORING_OP_SENDMSG заканчивается в tcp_abort() без блокировки таким же образом. Очистить контекст запуска вокруг io_submit_sqes(). SQEs приходит из пользовательского пространства и должен быть выпущен, как и у любого другого кольца.
Они по-прежнему работают в разделе чтения задач RCU программы, поэтому запрос, который там спит, задерживает этот льготный период, но другие типы запросов уже делают это.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: io_uring/bpf-ops: clear bpf_ctx while submitting SQEs bpf_io_uring_submit_sqes() calls io_submit_sqes() from inside the loop program, with current->bpf_ctx set, and requests issued inline run with it set too. The socket code uses has_current_bpf_ctx() to recognize calls from bpf_setsockopt() and friends, where the caller holds the socket lock and has already been vetted, and skips both. So a SOCKET_URING_OP_SETSOCKOPT from the SQ passes sockopt_capable() without the capability, and runs without lock_sock(). A task with no capability can set SO_MARK, IP_TRANSPARENT or TCP_REPAIR, and two threads changing IP_OPTIONS on one socket, one through the ring, double free in no time. SOCK_DESTROY via IORING_OP_SENDMSG ends up in tcp_abort() without the lock the same way. Clear the run context around io_submit_sqes(). The SQEs come from userspace and must be issued like those of any other ring. They still run inside the program's RCU tasks trace read section, so a request that sleeps there holds up that grace period, but other request types do that already.