Skip to content

netlink.LinkSubscribe panics on UniFi Cloud Gateway Fiber #1099

@cuonglm

Description

@cuonglm

Hello,

Our project use netlink library to monitor network changes, the code is straight and simple:

https://github.com/Control-D-Inc/ctrld/blob/b9ece6d7b902e9a53f0e1e7618f6bd92eeae2b04/cmd/cli/netlink_linux.go#L14

However, on Ubiquiti Cloud Gateway Fiber device, we received report from our users that the binary panic with this stacktrace:

Jun 29 07:19:57 UCG-Fiber ctrld[1750167]: Jun 29 07:19:57.286 INF [e322ab] REPLY: upstream.0 -> [Edited IP]:33378 (UCG-Fiber): NOERROR
Jun 29 07:19:57 UCG-Fiber ctrld[1750167]: Jun 29 07:19:57.286 DBG [e322ab] received response of 78 bytes in 61.225646ms
Jun 29 07:19:57 UCG-Fiber ctrld[1750167]: panic: runtime error: slice bounds out of range [:16] with capacity 4
Jun 29 07:19:57 UCG-Fiber ctrld[1750167]: goroutine 123 [running]:
Jun 29 07:19:57 UCG-Fiber ctrld[1750167]: github.com/vishvananda/netlink/nl.DeserializeIfInfomsg(...)
Jun 29 07:19:57 UCG-Fiber ctrld[1750167]:         /go/pkg/mod/github.com/vishvananda/netlink@v1.2.1-beta.2/nl/nl_linux.go:165
Jun 29 07:19:57 UCG-Fiber ctrld[1750167]: github.com/vishvananda/netlink.linkSubscribeAt.func2()
Jun 29 07:19:57 UCG-Fiber ctrld[1750167]:         /go/pkg/mod/github.com/vishvananda/netlink@v1.2.1-beta.2/link_linux.go:2152 +0x2d8
Jun 29 07:19:57 UCG-Fiber ctrld[1750167]: created by github.com/vishvananda/netlink.linkSubscribeAt in goroutine 119
Jun 29 07:19:57 UCG-Fiber ctrld[1750167]:         /go/pkg/mod/github.com/vishvananda/netlink@v1.2.1-beta.2/link_linux.go:2120 +0x2b0
Jun 29 07:19:57 UCG-Fiber systemd[1]: ctrld.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jun 29 07:19:57 UCG-Fiber systemd[1]: ctrld.service: Failed with result 'exit-code'.
Jun 29 07:19:57 UCG-Fiber systemd[1]: ctrld.service: Consumed 1.029s CPU time.
Jun 29 07:21:57 UCG-Fiber systemd[1]: ctrld.service: Scheduled restart job, restart counter is at 2.
Jun 29 07:21:57 UCG-Fiber systemd[1]: Stopped A highly configurable, multi-protocol DNS forwarding proxy.
Jun 29 07:21:57 UCG-Fiber systemd[1]: ctrld.service: Consumed 1.029s CPU time.
Jun 29 07:21:57 UCG-Fiber systemd[1]: Started A highly configurable, multi-protocol DNS forwarding proxy.

It seems to me that either netlink does not handle the message correctly, or the kernel on Ubiquiti Cloud Gateway Fiber may return an invalid message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions