В ядре Linux была устранена следующая уязвимость: ipv6: Prevent rt6_insert_exception() для умирающего fib6_info. fib6_nh_flush_exceptions() всегда устанавливает from->exception_bucket_flushed 1 под rt6_exception_lock, чтобы rt6_insert_exception() не вставлял новое исключение для умирающего fib6_info. Флаг был заменен битом FIB6_EXCEPTION_BUCKET_FLUSHED, хранящимся в nh->rt6i_exception_bucket. Проблема в том, что теперь бит устанавливается только тогда, когда ведро не NULL и fib6_nh_flush_exceptions() вызывается из fib6_nh_release() после того, как fib6_ref уже достиг нуля.
Если rt6_insert_exception() вызывается во время удаления целевого fib6_info через fib6_purge_rt(), новое исключение может быть успешно создано, потому что rt6_flush_exceptions() больше не задает бит. Это создает референсный цикл между fib6_info и маршрутом исключения, пропуская fib6_info, его устройство nexthop и все маршруты для CPU в fib6_nh->rt6i_pcpu, что останавливает от регистрации netdev. [ 34.680602] unregister_netdevice: ожидание, когда gre6 станет бесплатным. Количество пользователей 68 [44.920675] unregister_netdevice: ожидание, когда gre6 станет бесплатным.
Количество пользователей 68 [55.176582] unregister_netdevice: ожидание, когда gre6 станет бесплатным. Количество пользователей 68 Let's вызов fib6_drop_pcpu_from() перед rt6_flush_exceptions(), установить fib6_destroying перед rt6_exception_lock, и проверить f6i->fib6_destroying в rt6_insert_exception(). Обратите внимание, что логика FIB6_EXCEPTION_BUCKET_FLUSHED мертва, и мы можем очистить ее в сети.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: ipv6: Prevent rt6_insert_exception() for dying fib6_info. Before the cited commit, fib6_nh_flush_exceptions() always set from->exception_bucket_flushed = 1 under rt6_exception_lock to prevent rt6_insert_exception() from inserting a new exception for a dying fib6_info. The flag was replaced with the FIB6_EXCEPTION_BUCKET_FLUSHED bit stored in nh->rt6i_exception_bucket. The problem is that now the bit is only set when the bucket is not NULL and fib6_nh_flush_exceptions() is called from fib6_nh_release() after fib6_ref has already reached zero. If rt6_insert_exception() is called while the target fib6_info is being removed via fib6_purge_rt(), a new exception could be created successfully because rt6_flush_exceptions() no longer sets the bit. This creates a reference cycle between the fib6_info and the exception route, leaking the fib6_info, its nexthop device, and all per-CPU routes in fib6_nh->rt6i_pcpu, which stalls netdev unregistration. [ 34.680602] unregister_netdevice: waiting for gre6 to become free. Usage count = 68 [ 44.920675] unregister_netdevice: waiting for gre6 to become free. Usage count = 68 [ 55.176582] unregister_netdevice: waiting for gre6 to become free. Usage count = 68 Let's call fib6_drop_pcpu_from() before rt6_flush_exceptions(), to set fib6_destroying before rt6_exception_lock, and check f6i->fib6_destroying in rt6_insert_exception(). Note that FIB6_EXCEPTION_BUCKET_FLUSHED logic is dead and we can clean it up in net-next.