В ядре Linux устранена следующая уязвимость:
NFSD: отложить очистку подобъекта в обратных вызовах экспорта.
svc_export_put() немедленно вызывает path_put() и auth_domain_put().
когда последнее задание удаляется, до истечения льготного периода RCU. РКУ
читатели в e_show() и c_show() получают доступ к ex_path (через
seq_path/d_path) и ex_client->name (через seq_escape) без
держит ссылку. Если cache_clean удаляет запись и удаляет
последней ссылки одновременно, подобъекты освобождаются, пока они еще
используется, создавая разыменование NULL-указателя в d_path.
Commit 2530766492ec («nfsd: исправить UAF при доступе к ex_uuid или
ex_stats") переместил ex_uuid и ex_stats без ex_stats в
обратный вызов call_rcu, но path_put() и auth_domain_put() остались запущенными
до льготного периода, потому что оба могут спать и вызывать_rcu
обратные вызовы выполняются в контексте softirq. Замените call_rcu/kfree_rcu на Queue_rcu_work(), что отложит
обратный вызов до истечения льготного периода RCU и выполняет его в процессе
контекст, в котором разрешен сон. Это позволяет path_put() и
auth_domain_put() будет перемещен в отложенный обратный вызов рядом с
другие выпуски ресурсов.
Примените то же исправление к expkey_put(),
который имеет тот же шаблон, что и ek_path и ek_client. Выделенная рабочая очередь охватывает только NFSD
экспорт рабочих элементов выпуска; очистка общего
system_unbound_wq зависает из-за несвязанной работы других
подсистемы. nfsd_export_shutdown() использует rcu_barrier(), за которым следует
с помощьюlush_workqueue(), чтобы гарантировать все обратные вызовы отложенного выпуска
завершиться до того, как кэши экспорта будут уничтожены. Редактор: Джефф Лейтон <jlayton@kernel.org>
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: NFSD: Defer sub-object cleanup in export put callbacks svc_export_put() calls path_put() and auth_domain_put() immediately when the last reference drops, before the RCU grace period. RCU readers in e_show() and c_show() access both ex_path (via seq_path/d_path) and ex_client->name (via seq_escape) without holding a reference. If cache_clean removes the entry and drops the last reference concurrently, the sub-objects are freed while still in use, producing a NULL pointer dereference in d_path. Commit 2530766492ec ("nfsd: fix UAF when access ex_uuid or ex_stats") moved kfree of ex_uuid and ex_stats into the call_rcu callback, but left path_put() and auth_domain_put() running before the grace period because both may sleep and call_rcu callbacks execute in softirq context. Replace call_rcu/kfree_rcu with queue_rcu_work(), which defers the callback until after the RCU grace period and executes it in process context where sleeping is permitted. This allows path_put() and auth_domain_put() to be moved into the deferred callback alongside the other resource releases. Apply the same fix to expkey_put(), which has the identical pattern with ek_path and ek_client. A dedicated workqueue scopes the shutdown drain to only NFSD export release work items; flushing the shared system_unbound_wq would stall on unrelated work from other subsystems. nfsd_export_shutdown() uses rcu_barrier() followed by flush_workqueue() to ensure all deferred release callbacks complete before the export caches are destroyed. Reviwed-by: Jeff Layton <jlayton@kernel.org>