*** This bug is a duplicate of bug 2169269 ***
    https://bugs.launchpad.net/bugs/2169269

Affects me too: still present in 6.8.0-149.149 (noble)

Reproduced on Ubuntu 24.04.5 LTS with linux-image-6.8.0-147-generic and
linux-image-6.8.0-149-generic. It did not occur on 6.8.0-85-generic (many
connect/disconnect cycles with the same server and configuration), which is
consistent with the 142 -> 146 regression reported here.

Setup
- Hardware: MSI MS-7917 (Z97 GAMING 5), BIOS V1.11 05/28/2015,
  Intel Core i5-4690K (4 cores), 24 GB RAM
- Client: NetworkManager-l2tp, L2TP/IPsec (strongSwan/charon, IKEv1, ESP in
  UDP encapsulation on port 4500) with pppd; kernel modules l2tp_core,
  l2tp_netlink, l2tp_ppp, pppox
- Only this one L2TP/IPsec server triggers it; my OpenVPN connections are fine
- Kernel is tainted by the proprietary NVIDIA driver 580.178.04 (DKMS,
  flags P/O/E); NVIDIA modules do not appear in any of the traces below
- Cisco Secure Client (vpnagentd) is also installed and running; it does not
  appear in the traces either

Symptoms
Earlier (6.8.0-147) the whole machine froze shortly after disconnecting from
the L2TP server, sometimes immediately and sometimes minutes later. On
6.8.0-149 it happened right after connecting (11 Nov) and again on 12 Nov,
with a black screen of kernel messages and a hard reset needed.

Kernel log from 6.8.0-149 (first splat, in a kworker):

refcount_t: addition on 0; use-after-free.
WARNING: CPU: 1 PID: 716052 at lib/refcount.c:25 
refcount_warn_saturate+0x12e/0x150
CPU: 1 PID: 716052 Comm: kworker/1:0 Tainted: P OE 6.8.0-149-generic #149-Ubuntu
Hardware name: MSI MS-7917/Z97 GAMING 5 (MS-7917), BIOS V1.11 05/28/2015
Workqueue: events xfrm_trans_reinject
Call Trace:
 l2tp_tunnel_get_session+0xc8/0xd0 [l2tp_core]
 l2tp_udp_recv_core+0xb1/0x350 [l2tp_core]
 l2tp_udp_encap_recv+0x2c/0x54 [l2tp_core]
 udp_queue_rcv_one_skb+0x27b/0x550
 udp_queue_rcv_skb+0x4f/0x80
 udp_unicast_rcv_skb+0x7a/0xa0
 __udp4_lib_rcv+0x627/0x6f0
 udp_rcv+0x25/0x40
 ip_protocol_deliver_rcu+0xd8/0x210
 ip_local_deliver_finish+0x77/0xa0
 ip_local_deliver+0x6e/0x120
 xfrm4_rcv_encap_finish2+0x3c/0x60
 xfrm_trans_reinject+0xf0/0x190
 process_one_work+0x184/0x3a0
 worker_thread+0x18b/0x330
 kthread+0xf2/0x120
 ret_from_fork+0x47/0x70

More refcount_t warnings follow ("underflow; use-after-free", "saturated;
leaking memory"). About a second later an unrelated process crashes on
corrupted memory:

BUG: kernel NULL pointer dereference, address: 0000000000000f98
Oops: 0000 [#1] PREEMPT SMP PTI
CPU: 0 PID: 752651 Comm: runc:[2:INIT] Tainted: P W OE 6.8.0-149-generic
RIP: 0010:kmalloc_node_trace+0xf2/0x390
Call Trace: alloc_fair_sched_group -> sched_create_group ->
 sched_autogroup_create_attach -> ksys_setsid

The same signature (refcount_t addition on 0 in l2tp_tunnel_get_session)
appeared again on a later boot (12 Nov).

On another occasion the console showed a warning in the PPP transmit path:
WARNING: CPU: 0 PID: 752603 at net/l2tp/l2tp_ppp.c:166
 pppol2tp_xmit+0x1e1/0x220 [l2tp_ppp], Comm: pppd
 (call chain: ppp_write -> ppp_channel_push -> __ppp_channel_push)

Possibly relevant (not verified):
- The 6.8.0-146 changelog (stable patchset, LP: #2164796) includes
  "xfrm: hold dev ref until after transport_finish NF_HOOK", which touches
  the xfrm_trans_reinject path seen in the trace above.
- l2tp_tunnel_get_session() appears to take its session reference without
  refcount_inc_not_zero(); upstream has been hardening the other session
  getters this way (e.g. l2tp_session_get_by_ifname).

Happy to test a proposed kernel or a patch, and to retest with the NVIDIA
modules not loaded if that helps triage.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2171060

Title:
  l2tp_core: refcount_t "addition on 0; use-after-free" in
  l2tp_tunnel_get_session on every L2TP/IPsec connect, system freezes
  (regression 6.8.0-142 -> 6.8.0-146, still present in 6.8.0-147, noble)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2171060/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to