** Description changed:

  [ Impact ]
  
  In environments with high network interface churn, the `lldpd` daemon
  can crash when interfaces are rapidly added and removed.
  
  This occurs due to a race condition and memory handling fault when
  `lldpd` processes Netlink events concurrently with its internal polling
  loop.
  
  The fix backports the upstream resolution for issue #744 (included in
  upstream release 1.0.20), which safely handles concurrent interface
  additions/removals in the Netlink event processor without crashing.
  
  [ Test Plan ]
  
  The upstream bug report has a simple script that can be used to
  reproduce the issue:
  
  ```
  #!/bin/env python3
  import subprocess
  import time
  
  # add dummy interface ethx
  subprocess.run(['ip', 'link', 'add', 'ethx', 'type', 'dummy'], check=True)
  subprocess.run(['ip', 'link', 'set', 'ethx', 'up'], check=True)
  time.sleep(2)
  
  # remove dummy interface ethx(in fact this won't remove nic)
  subprocess.run(['ip', 'link', 'del', 'ethx'], check=True)
  
  # immediately add dummy nic ethx
  subprocess.run(['ip', 'link', 'add', 'ethx', 'type', 'dummy'], check=True)
  subprocess.run(['ip', 'link', 'set', 'ethx', 'up'], check=True)
  
  time.sleep(1)
  # delay 1s,now lldpd will update and reinit ethx
  
  # now remove ethx, as this will result in bind raw socket failure and trigger 
"lldpd_hardware_cleanup(cfg, hardware)"
  subprocess.run(['ip', 'link', 'del', 'ethx'], check=True)
  ```
  
  I've successfully reproduced this in a VM with 4 vCPUs and 8GB memory.
  
  Just run:
  sudo tail -f /var/log/syslog &
  sudo python3 repro.py
  
  After a few executions attempt the following error is seen:
  
  2026-09-23T00:52:29.271773+00:00 cases-lldpd-noble kernel: lldpd[2126]: 
segfault at 616dff74f ip 0000616dfea8ced0 sp 00007ffcc5cf3220 error 4 in 
lldpd[616dfea78000+22000] likely on CPU 3 (core 0, socket 3)
  2026-09-23T00:52:29.271786+00:00 cases-lldpd-noble kernel: Code: 48 8b b5 b0 
fe ff ff 4c 89 e2 48 89 df e8 18 86 00 00 4c 89 e6 48 89 df e8 5d 84 00 00 4c 
8b a3 30 01 00 00 4d 85 e4 74 29 90 <41> 8b 44 24 44 85 c0 74 16 4c 89 e6 48 89 
df e8 1c f5 ff ff 4c 89
  2026-09-23T00:52:30.075982+00:00 cases-lldpd-noble systemd[1]: lldpd.service: 
Main process exited, code=dumped, status=11/SEGV
  
  Issue is reproduceable in Noble and Resolute.
  
+ [ Where problems could occur ]
+ 
+ The change affects interfaces that fail initialization, particularly
+ when an interface is being converted from another type. If cleanup is
+ skipped, a new interface whose initialization fails would leave its'
+ allocated resources behind. A regression could appear as increasing
+ memory use after a herd of such failures. However, such scenario seems
+ uncommon because it means the interface disappears between the netlink
+ scan and socket setup or creating socket fails.
+ 
  [ Other Info ]
  
  Upstream Issue: https://github.com/lldpd/lldpd/issues/744
  Upstream Fix: 
https://github.com/lldpd/lldpd/commit/705087fe48483f14ae63295bfe67044738eea1d6
  Affected Ubuntu series: Noble (24.04), Resolute (26.04)

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

Title:
  SRU: Fix crash on rapid addition/removal of interfaces (Upstream #744)

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


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

Reply via email to