В ядре Linux устранена следующая уязвимость: bpf: Fix vmlinux BTF prep race in bpf_get_btf_vmlinux bpf_get_btf_vmlinux() лениво анализирует vmlinux BTF под bpf_verifier_lock, но публикует результат через обычный магазин и перепроверяет его с помощью простой безблокировочной загрузки. Ничто не приказывает магазинам инициализировать struct btf внутри btf_parse_vmlinux () против магазина, публикующего указатель: на слабо упорядоченной дуге конкурирующий первый звонящий, принимающий быстрый путь без блокировки, может в принципе наблюдать указатель до того, как будет видно проанализированное содержимое. mutex_unlock() не помогает такому считывателю, поскольку он синхронизируется только с более поздним приобретением того же замка. Таким образом, опубликуйте указатель с smp_store_release () и прочитайте его на быстром пути с smp_load_acquire ().
Необходима семантика приобретения, а не READ_ONCE(): btf_parse_vmlinux() также заполняет глобалы вне возвращаемого объекта (например, bpf_ctx_convert.t). Зависимость от адреса будет только упорядочивать доступы, выполняемые через указатель, и не охватывать другие глобальные.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: bpf: Fix vmlinux BTF prep race in bpf_get_btf_vmlinux bpf_get_btf_vmlinux() lazily parses the vmlinux BTF under the bpf_verifier_lock, but publishes the result through a plain store and re-checks it through a plain lockless load. Nothing orders the stores initializing the struct btf inside btf_parse_vmlinux() against the store publishing the pointer: On a weakly ordered arch, a concurrent first-time caller taking the lockless fast path could in principle observe the pointer before the parsed contents are visible. The mutex_unlock() does not help such a reader given it only synchronizes with a later acquisition of the same lock. Thus, publish the pointer with smp_store_release() and read it on the fast path with smp_load_acquire(). Acquire semantics are needed rather than a dependency-ordered READ_ONCE(): btf_parse_vmlinux() also populates globals outside the returned object (e.g. bpf_ctx_convert.t). An address dependency would only order accesses performed through the pointer and not cover other globals.
Характеристики атаки
Последствия
Строка CVSS v3.1