В ядре Linux устранена следующая уязвимость:
net/sched: act_tunnel_key: отложить dst_release до обратного вызова RCU
Исправьте состояние гонки use-after-free в Tunnel_key_release_params(). Функция синхронно освобождает метаданные_dst старых параметров.
через dst_release(), откладывая освобождение структуры параметров с помощью
kfree_rcu(). Параллельное считывающее устройство Tunnel_key_act() на пути данных может
по-прежнему удерживайте старый указатель параметров (под rcu_read_lock_bh) и продолжайте
вызвать dst_clone(¶ms->tcft_enc_metadata->dst) после записи
dst_release уже переместил rcuref dst на RCUREF_DEAD.
zdi-disclosures@trendmicro.com подготовил POC, который я (и Виктор) проверили.
Об этом сообщает КАСАН:
==============================================================
ОШИБКА: KASAN: slab-use-after-free в Instrument_atomic_read_write include/linux/instrumented.h:112
ОШИБКА: KASAN: slab-use-after-free вatomic_sub_return_release include/linux/atomic/atomic-instrumented.h:326
ОШИБКА: KASAN: slab-use-after-free в __rcuref_put include/linux/rcuref.h:109
ОШИБКА: KASAN: slab-use-after-free в rcuref_put include/linux/rcuref.h:173
ОШИБКА: KASAN: slab-use-after-free в dst_release+0x5b/0x370 net/core/dst.c:168
Запись размера 4 по адресу ffff88806158de40 с помощью задачи poc/9388. ЦП: 0 UID: 0 PID: 9388 Связь: poc Tainted: G W 7.1.0-rc7 #7 PREEMPT(ленивый)
Испорчено: [W]=ПРЕДУПРЕЖДАТЬ
Имя оборудования: QEMU Ubuntu 25.10 PC v2 (i440FX + PIIX, + машина 10.1, 1996 г.), BIOS 1.16.3-debian-1.16.3-2 01.04.2014
Отслеживание вызова:
<ЗАДАЧА>
__dump_stack lib/dump_stack.c:94
dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378
print_report+0x139/0x4ad мм/kasan/report.c:482
kasan_report+0xe4/0x1d0 мм/kasan/report.c:595
check_region_inline мм/kasan/generic.c:186
kasan_check_range+0x125/0x200 мм/kasan/generic.c:200
Instrument_atomic_read_write include/linux/instrumented.h:112
atomic_sub_return_release include/linux/atomic/atomic-instrumented.h:326
__rcuref_put include/linux/rcuref.h:109
rcuref_put include/linux/rcuref.h:173
dst_release+0x5b/0x370 net/core/dst.c:168
refdst_drop include/net/dst.h:272
skb_dst_drop include/net/dst.h:284
skb_release_head_state+0x293/0x400 net/core/skbuff.c:1163
skb_release_all net/core/skbuff.c:1187
[..]
Выделено заданием 9391:
kasan_save_stack+0x30/0x50 мм/kasan/common.c:57
kasan_save_track+0x14/0x30 мм/kasan/common.c:78
яд_kmalloc_redzone мм/kasan/common.c:398
__kasan_kmalloc+0x9a/0xb0 мм/kasan/common.c:415
kasan_kmalloc include/linux/kasan.h:263
__do_kmalloc_node мм/slub.c:5296
__kmalloc_noprof+0x2f1/0x830 мм/slub.c:5308
kmalloc_noprof include/linux/slab.h:954
kzalloc_noprof include/linux/slab.h:1188
offload_action_alloc+0x2f/0x130 net/core/flow_offload.c:35
tcf_action_offload_add_ex+0x1ba/0x880 net/sched/act_api.c:258
tcf_action_offload_add net/sched/act_api.c:293
tcf_action_init+0x66e/0xa20 net/sched/act_api.c:1547
tcf_action_add+0xf6/0x5d0 net/sched/act_api.c:2101
[..]
Освобожден заданием 9391:
kasan_save_stack+0x30/0x50 мм/kasan/common.c:57
kasan_save_track+0x14/0x30 мм/kasan/common.c:78
kasan_save_free_info+0x3b/0x70 мм/kasan/generic.c:584
яд_slab_object мм/kasan/common.c:253
__kasan_slab_free+0x6b/0x90 мм/kasan/common.c:285
kasan_slab_free include/linux/kasan.h:235
slab_free_hook мм/slub.c:2689
slab_free мм/slub.c:6251
kfree+0x21f/0x6b0 мм/slub.c:6566
tcf_action_offload_add_ex+0x4ad/0x880 net/sched/act_api.c:284
tcf_action_offload_add net/sched/act_api.c:293
tcf_action_init+0x66e/0xa20 net/sched/act_api.c:1547
tcf_action_add+0xf6/0x5d0 net/sched/act_api.c:2101
Адрес ошибки принадлежит объекту по адресу ffff88806158de00.
который принадлежит кешу kmalloc-256 размером 256
Адрес ошибки находится в 64 байтах внутри
освобождена 256-байтовая область [ffff88806158de00, ffff88806158df00)
Глючный адрес принадлежит физической странице:
страница: refcount:0 Mapcount:0 отображение:0000000000000000 индекс:0xffff88806158d600 pfn:0x6158c
голова: порядок: 1 количество карт: 0 вся_карта
---усечено---
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: net/sched: act_tunnel_key: Defer dst_release to RCU callback Fix a race-condition use-after-free in tunnel_key_release_params(). The function releases the metadata_dst of the old params synchronously via dst_release() while deferring the params struct free with kfree_rcu(). A concurrent tunnel_key_act() reader on the datapath may still hold the old params pointer (under rcu_read_lock_bh) and proceed to call dst_clone(¶ms->tcft_enc_metadata->dst) after the writer's dst_release has already pushed the dst's rcuref to RCUREF_DEAD. zdi-disclosures@trendmicro.com produced a poc which i (and Victor) verified that KASAN reports: ================================================================== BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:112 BUG: KASAN: slab-use-after-free in atomic_sub_return_release include/linux/atomic/atomic-instrumented.h:326 BUG: KASAN: slab-use-after-free in __rcuref_put include/linux/rcuref.h:109 BUG: KASAN: slab-use-after-free in rcuref_put include/linux/rcuref.h:173 BUG: KASAN: slab-use-after-free in dst_release+0x5b/0x370 net/core/dst.c:168 Write of size 4 at addr ffff88806158de40 by task poc/9388 CPU: 0 UID: 0 PID: 9388 Comm: poc Tainted: G W 7.1.0-rc7 #7 PREEMPT(lazy) Tainted: [W]=WARN Hardware name: QEMU Ubuntu 25.10 PC v2 (i440FX + PIIX, + 10.1 machine, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 print_report+0x139/0x4ad mm/kasan/report.c:482 kasan_report+0xe4/0x1d0 mm/kasan/report.c:595 check_region_inline mm/kasan/generic.c:186 kasan_check_range+0x125/0x200 mm/kasan/generic.c:200 instrument_atomic_read_write include/linux/instrumented.h:112 atomic_sub_return_release include/linux/atomic/atomic-instrumented.h:326 __rcuref_put include/linux/rcuref.h:109 rcuref_put include/linux/rcuref.h:173 dst_release+0x5b/0x370 net/core/dst.c:168 refdst_drop include/net/dst.h:272 skb_dst_drop include/net/dst.h:284 skb_release_head_state+0x293/0x400 net/core/skbuff.c:1163 skb_release_all net/core/skbuff.c:1187 [..] Allocated by task 9391: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:398 __kasan_kmalloc+0x9a/0xb0 mm/kasan/common.c:415 kasan_kmalloc include/linux/kasan.h:263 __do_kmalloc_node mm/slub.c:5296 __kmalloc_noprof+0x2f1/0x830 mm/slub.c:5308 kmalloc_noprof include/linux/slab.h:954 kzalloc_noprof include/linux/slab.h:1188 offload_action_alloc+0x2f/0x130 net/core/flow_offload.c:35 tcf_action_offload_add_ex+0x1ba/0x880 net/sched/act_api.c:258 tcf_action_offload_add net/sched/act_api.c:293 tcf_action_init+0x66e/0xa20 net/sched/act_api.c:1547 tcf_action_add+0xf6/0x5d0 net/sched/act_api.c:2101 [..] Freed by task 9391: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:253 __kasan_slab_free+0x6b/0x90 mm/kasan/common.c:285 kasan_slab_free include/linux/kasan.h:235 slab_free_hook mm/slub.c:2689 slab_free mm/slub.c:6251 kfree+0x21f/0x6b0 mm/slub.c:6566 tcf_action_offload_add_ex+0x4ad/0x880 net/sched/act_api.c:284 tcf_action_offload_add net/sched/act_api.c:293 tcf_action_init+0x66e/0xa20 net/sched/act_api.c:1547 tcf_action_add+0xf6/0x5d0 net/sched/act_api.c:2101 The buggy address belongs to the object at ffff88806158de00 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 64 bytes inside of freed 256-byte region [ffff88806158de00, ffff88806158df00) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88806158d600 pfn:0x6158c head: order:1 mapcount:0 entire_map ---truncated---
Характеристики атаки
Последствия
Строка CVSS v3.1