GoogleCloudPlatform / GoogleCloudPlatform/compute-virtual-ethernet-linux
napi_disable() hang when a XDP_ZEROCOPY app terminates without cleanup
- Dominant language
- C
- Stars
- 91
- Forks
- 44
- Avg merge
- 1h 21m
- Merged PRs (30d)
- 2
Description
Hi,
Using gve 1.4.11 on an Ubuntu 24.04 GCP C3D instance, it seems that if an application creates an AF_XDP socket with the XDP_ZEROCOPY flag enabled, installs an eBPF program, and then terminates without cleaning up (eg. due to exit(), SIGKILL, or a crash), a kworker thread will get stuck in napi_disable:
```
/proc/379/task/379: D (disk sleep)
[<0>] napi_disable+0x1d/0x50
[<0>] gve_xsk_pool_disable+0xda/0x1d0 [gve]
[<0>] gve_xdp+0x1b3/0x260 [gve]
[<0>] xp_disable_drv_zc+0x92/0x110
[<0>] xp_clear_dev+0x5b/0xf0
[<0>] xp_release_deferred+0x20/0x90
[<0>] process_one_work+0x182/0x350
[<0>] worker_thread+0x2ea/0x430
[<0>] kthread+0xf9/0x210
[<0>] ret_from_fork+0x111/0x120
[<0>] ret_from_fork_asm+0x1a/0x30
```
AFAICT, this appears to subsequently hang anything that requires rtnl_lock - eg. "ip address list" will stall.
I have a small repro case, but can't currently seem to upload it... will keep trying :(
Contributor guide
Research direction
Start from the reported call path through gve_xsk_pool_disable, gve_xdp, xp_disable_drv_zc, xp_clear_dev, and xp_release_deferred. Reproduce the AF_XDP XDP_ZEROCOPY termination case using the described stack trace and check that cleanup no longer leaves napi_disable stuck or blocks rtnl_lock users such as "ip address list".
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, linux
- Domain
- networking, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100