CVE-2026-64459
Beschrijving NL
In de Linux kernel is de volgende kwetsbaarheid verholpen:
tcp: herstel RCU respijtperiode in tcp_ao_destroy_sock
Commit 51e547e8c89c ("tcp: Gratis TCP-AO/TCP-MD5 info/keys zonder RCU")
verwijderde de call_rcu() callback van tcp_ao_destroy_sock(), met het argument dat
"de vernietiging van informatie/sleutels wordt uitgesteld totdat de contactdoosvernietiger"
en dus "niemand kan het meer ontdekken". Dat argument geldt niet voor de oproepsite in tcp_connect()
(net/ipv4/tcp_output.c:4327-4332). Op dat moment bevindt het stopcontact zich in
TCP_SYN_SENT, is al ingevoegd in de inet ehash door
inet_hash_connect() in tcp_v4_connect(), en is daarom heel erg
detecteerbaar: elke softirq die tcp_v4_rcv() op een andere CPU draait, kan
de socket uit de ehash, loop in tcp_inbound_hash() en laad
tp->ao_info via impliciete RCU voordat bh_lock_sock_nested() wordt aangenomen
de vernietigende CPU. Het lezerspad voert vervolgens __tcp_ao_do_lookup() (net/ipv4/tcp_ao.c:208) in
die tp- >ao_info opnieuw laadt via rcu_dereference_check(); het opnieuw laden kan
nog steeds de (bijna-vrije) wijzer in acht nemen omdat er geen
synchronize_rcu() tussen rcu_assign_pointer(tp->ao_info, NULL) en
tcp_ao_info_free() in tcp_ao_destroy_sock(). De vastgelegde aanwijzer is
vervolgens bij lijn 223 gelopen:
hlist_for_each_entry_rcu(sleutel, &ao->hoofd, knooppunt, ...)
De synchrone kfree () van de schrijver is vrij om te voltooien tussen de regel
218 opnieuw ophalen en de regel 223 hlist iteratie. De plaat wordt hergebruikt
(of gewoon LIST_POISON1-gestempeld indien nog niet hergebruikt) en de iteratie
loopt aanvaller-gecontroleerd of vergiftigd geheugen in softirq context. Reproducer (geen debug shim, stock x86_64 v7.1-rc2 SMP+KASAN, QEMU+KVM):
een onbevoorrechte uid=1000 proces in CLONE_NEWUSER|CLONE_NEWNET
installeert TCP_MD5SIG + TCP_AO_ADD_KEY op een TCP-socket, spuit gesmeed
TCP-AO segmenteert naar zijn uiteindelijke 4-tupel via ruwe sockets, dan
calls connect(). De md5-wins reconciliatie in tcp_connect() vuren
tcp_ao_destroy_sock(); de softirq backlog lezer op de loopback
NAPI-pad crasht op de bevrijde ao->head.first walk:
Oeps: algemene beschermingsfout, waarschijnlijk voor niet-canoniek
adres 0xfbd59c000000002f
KASAN: misschien wild-memory-access binnen bereik
[0xdead000000000178-0xdead00000000017f]
CPU: 0 UID: 1000 PID: 100 Comm: repro_userns
RIP: 0010:__tcp_ao_do_lookup+0x107/0x1c0
Oproepspoor:
__tcp_ao_do_lookup+ 0x107/0x1c0
tcp_ao_inbound_lookup.constprop.0+0x12a/0x200
tcp_inbound_ao_hash+0x5ea/0x1520
tcp_inbound_hash+0x7ce/0x1240
tcp_v4_rcv+0x1e7a/0x3e10
... Herstel de RCU respijtperiode: voeg struct rcu_head opnieuw toe aan tcp_ao_info
en vervang de synchrone tcp_ao_info_free() door een call_rcu()
callback. Lezers die tp- >ao_info hebben vastgelegd vóór rcu_assign_pointer
NULLed ziet het nu dat het object geldig blijft tot rcu_read_unlock(). Als de patch is aangebracht, loopt de reproducent 2000 iteraties schoon
op dezelfde kernel build.
Origineel (Engels) tonen
In the Linux kernel, the following vulnerability has been resolved:
tcp: restore RCU grace period in tcp_ao_destroy_sock
Commit 51e547e8c89c ("tcp: Free TCP-AO/TCP-MD5 info/keys without RCU")
removed the call_rcu() callback from tcp_ao_destroy_sock(), arguing that
"the destruction of info/keys is delayed until the socket destructor"
and therefore "no one can discover it anymore".
That argument does not hold for the call site in tcp_connect()
(net/ipv4/tcp_output.c:4327-4332). At that point the socket is in
TCP_SYN_SENT, has already been inserted into the inet ehash by
inet_hash_connect() in tcp_v4_connect(), and is therefore very much
discoverable: any softirq running tcp_v4_rcv() on another CPU can take
the socket out of the ehash, walk into tcp_inbound_hash(), and load
tp->ao_info via implicit RCU before bh_lock_sock_nested() is taken on
the destroying CPU.
The reader path then enters __tcp_ao_do_lookup() (net/ipv4/tcp_ao.c:208)
which re-loads tp->ao_info via rcu_dereference_check(); the re-load can
still observe the (about-to-be-freed) pointer because there is no
synchronize_rcu() between rcu_assign_pointer(tp->ao_info, NULL) and
tcp_ao_info_free() in tcp_ao_destroy_sock(). The captured pointer is
then walked at line 223:
hlist_for_each_entry_rcu(key, &ao->head, node, ...)
The writer's synchronous kfree() is free to complete between the line
218 re-fetch and the line 223 hlist iteration. The slab is reused
(or simply LIST_POISON1-stamped if not yet reused) and the iteration
walks attacker-controlled or poison memory in softirq context.
Reproducer (no debug shim, stock x86_64 v7.1-rc2 SMP+KASAN, QEMU+KVM):
an unprivileged uid=1000 process inside CLONE_NEWUSER|CLONE_NEWNET
installs TCP_MD5SIG + TCP_AO_ADD_KEY on a TCP socket, sprays forged
TCP-AO segments toward its eventual 4-tuple via raw sockets, then
calls connect(). The md5-wins reconciliation in tcp_connect() fires
tcp_ao_destroy_sock(); the softirq backlog reader on the loopback
NAPI path crashes on the freed ao->head.first walk:
Oops: general protection fault, probably for non-canonical
address 0xfbd59c000000002f
KASAN: maybe wild-memory-access in range
[0xdead000000000178-0xdead00000000017f]
CPU: 0 UID: 1000 PID: 100 Comm: repro_userns
RIP: 0010:__tcp_ao_do_lookup+0x107/0x1c0
Call Trace:
__tcp_ao_do_lookup+0x107/0x1c0
tcp_ao_inbound_lookup.constprop.0+0x12a/0x200
tcp_inbound_ao_hash+0x5ea/0x1520
tcp_inbound_hash+0x7ce/0x1240
tcp_v4_rcv+0x1e7a/0x3e10
...
Restore the RCU grace period: re-add struct rcu_head to tcp_ao_info
and replace the synchronous tcp_ao_info_free() with a call_rcu()
callback. Readers that captured tp->ao_info before rcu_assign_pointer
NULLed it now see the object remain valid until rcu_read_unlock().
With the patch applied the reproducer runs cleanly for 2000 iterations
on the same kernel build.