Public bug reported:

This is a REGRESSION. The reporter has used this exact L2TP/IPsec setup
on this exact machine for more than 1.5 years with no such failures.
Hangs started recently. Last known-good kernel: 6.8.0-138-generic (still
installed). Affected kernel: 6.8.0-149-generic.

== Summary ==

On tearing down an L2TP/IPsec tunnel (NetworkManager + network-
manager-l2tp + xl2tpd + pppd + strongSwan), the kernel emits:

    ------------[ cut here ]------------
    rcuref - imbalanced put()
    WARNING: CPU: 4 PID: 28844 at lib/rcuref.c:266 rcuref_put_slowpath+0x7d/0x90
    CPU: 4 PID: 28844 Comm: pppd  Tainted: P           OE  6.8.0-149-generic 
#149~22.04.1-Ubuntu
    Hardware name: Micro-Star International Co., Ltd. MS-7B86/B450-A PRO MAX 
(MS-7B86), BIOS M.B0 12/03/2020
    RIP: 0010:rcuref_put_slowpath+0x7d/0x90
    Call Trace:
     <TASK>
     dst_release+0x5d/0xf0
     __sk_dst_check+0x7a/0xa0
     __ip_queue_xmit+0x2a0/0x510
     ip_queue_xmit+0x15/0x30
     l2tp_xmit_core.constprop.0+0x227/0x460 [l2tp_core]
     l2tp_xmit_skb+0x30/0xa0 [l2tp_core]
     pppol2tp_xmit+0x114/0x220 [l2tp_ppp]
     __ppp_channel_push+0x53/0xd0
     ppp_channel_push+0x44/0x90
     ppp_write+0xf5/0x160
     vfs_write+0x100/0x470

"rcuref - imbalanced put()" means an EXTRA put() is performed on the
cached route (struct dst_entry) in the L2TP transmit path: the reference
is dropped more times than it was taken. This is a double free of dst,
which silently corrupts kernel memory.

== Impact ==

Minutes to hours after the warning, the machine hangs completely:
 - softlockup_panic=1        -- never fires
 - hardlockup_panic=1 (NMI)  -- never fires
 - panic_on_rcu_stall=1      -- never fires
 - panic_on_oops=1           -- never fires
 - No panic, no kdump (the hang is memory corruption, not an oops)

Only a hardware watchdog (sp5100_tco) recovers the box. panic_on_warn=1
catches it only when the WARNING happens to fire before the hang;
usually the hang comes first.

== Environment ==

 - Ubuntu 22.04.5 LTS (jammy)
 - Kernel 6.8.0-149-generic (#149~22.04.1-Ubuntu); 
linux-image-generic-hwe-22.04 = 6.8.0-149.149~22.04.1
 - network-manager-l2tp 1.20.0-1build2, network-manager-l2tp-gnome 
1.20.0-1build2
 - xl2tpd 1.3.16-1ubuntu0.1
 - strongswan / strongswan-charon / strongswan-libcharon 5.9.5-2ubuntu2.8
 - ppp 2.4.9-1+1ubuntu3
 - Tunnel type: L2TP/IPsec, IKEv1 (main mode), PSK + XAUTH, MTU/MRU 1400
 - Modules: l2tp_core, l2tp_ppp, l2tp_netlink, pppox

== Steps to reproduce ==

 1. Connect an L2TP/IPsec tunnel via NetworkManager.
 2. Disconnect it.
 3. On teardown the WARNING above fires intermittently; the system may hang 
minutes-to-hours later.

The trigger is teardown (closing the tunnel), not connection.

== Additional warnings seen in the same sessions ==

    refcount_t: addition on 0; use-after-free.
    WARNING: CPU: 11 PID: 128 at lib/refcount.c:25 
refcount_warn_saturate+0x12e/0x150
     l2tp_tunnel_get_session+0xc8/0xd0 [l2tp_core]

    refcount_t: underflow; use-after-free.
    WARNING: CPU: 11 PID: 128 at lib/refcount.c:28 
refcount_warn_saturate+0xa3/0x150
     l2tp_tunnel_get_session+0xbc/0xd0 [l2tp_core]

Both point at reference-count corruption in l2tp_core, consistent with
the dst double-free above.

== Bisection hint ==

Regression introduced between 6.8.0-138-generic (clean) and
6.8.0-149-generic (buggy).

== Requested fix ==

Correct the reference counting in l2tp_xmit_core() / the
sk->sk_dst_cache handling so the cached dst is released exactly once,
and audit l2tp_tunnel_get_session() refcounting.

** Affects: linux (Ubuntu)
     Importance: Undecided
         Status: New

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

Title:
  launchpad-submit

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


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

Reply via email to