Skip to content

netlink: do not ack a successful dump - #15949

Merged
copybara-service[bot] merged 1 commit into
gvisor:masterfrom
adi-IL:fix-netlink-dump-ack
Oct 30, 2026
Merged

copybara-service[bot] merged 1 commit into
gvisor:masterfrom
adi-IL:fix-netlink-dump-ack

Conversation

@adi-IL

@adi-IL adi-IL commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Fixes #15945

A netlink dump request with NLM_F_ACK gets an NLMSG_ERROR ack in the reply stream, which breaks libnl caches with NLE_SEQ_MISMATCH. Linux doesn't send that ack: once __netlink_dump_start starts a dump it returns -EINTR, and netlink_rcv_skb skips the ack in that case.

ProcessMessages now skips DumpAckMessage when the handler produced a multipart reply (ms.Multi) and returned no error. It keys on the reply, not the NLM_F_DUMP bit, so non-dump requests and errors are still acked as before.

Testing: new NetlinkRouteTest.GetLinkDumpWithAck sends RTM_GETLINK with NLM_F_DUMP|NLM_F_ACK and checks that no NLMSG_ERROR arrives, NLMSG_DONE does, and nothing is left to read afterwards. It fails without the change and passes with it. The rest of //test/syscalls:socket_netlink_route_test_runsc_ptrace passes, including LinkUp, ChangeMTU, ChangeLinkName and GetLinkByIndexNotFound, which cover non-dump acks and error acks.

A dump request with NLM_F_ACK got an NLMSG_ERROR ack in the same reply
as the dump, which breaks libnl caches with NLE_SEQ_MISMATCH. Linux
skips the ack once a dump has started and still acks errors.

Fixes gvisor#15945
@carzh carzh self-assigned this Oct 30, 2026
@carzh carzh added the ready to pull Causes the PR to be imported into Google. Will be removed soon. label Oct 30, 2026
copybara-service Bot pushed a commit that referenced this pull request Oct 30, 2026
Fixes #15945

A netlink dump request with NLM_F_ACK gets an NLMSG_ERROR ack in the reply stream, which breaks libnl caches with NLE_SEQ_MISMATCH. Linux doesn't send that ack: once `__netlink_dump_start` starts a dump it returns -EINTR, and `netlink_rcv_skb` skips the ack in that case.

`ProcessMessages` now skips `DumpAckMessage` when the handler produced a multipart reply (`ms.Multi`) and returned no error. It keys on the reply, not the NLM_F_DUMP bit, so non-dump requests and errors are still acked as before.

Testing: new `NetlinkRouteTest.GetLinkDumpWithAck` sends RTM_GETLINK with NLM_F_DUMP|NLM_F_ACK and checks that no NLMSG_ERROR arrives, NLMSG_DONE does, and nothing is left to read afterwards. It fails without the change and passes with it. The rest of `//test/syscalls:socket_netlink_route_test_runsc_ptrace` passes, including `LinkUp`, `ChangeMTU`, `ChangeLinkName` and `GetLinkByIndexNotFound`, which cover non-dump acks and error acks.
FUTURE_COPYBARA_INTEGRATE_REVIEW=#15949 from adi-IL:fix-netlink-dump-ack 9241ad3
PiperOrigin-RevId: 1010745170
@copybara-service
copybara-service Bot merged commit 7317e2f into gvisor:master Oct 30, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to pull Causes the PR to be imported into Google. Will be removed soon.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

netlink: dump requests with NLM_F_ACK are acked before NLMSG_DONE, which breaks libnl caches

2 participants