tipc: fix netlink gate and receive-path bugs
Subsystems (3)
v4 cover tipc: fix netlink gate and receive-path bugs
This is v4 of the public TIPC series. The only change from v3 is in patch 1: TIPC_NL_MEDIA_SET now uses GENL_UNS_ADMIN_PERM like the other mutators, instead of GENL_ADMIN_PERM, so the whole series uses the namespace-aware CAP_NET_ADMIN check that matches the legacy TIPC netlink path. Patches 2 and 3 are unchanged.
Patch 1 gives the TIPCv2 mutating generic-netlink operations the admin gate the legacy API already has, so a local unprivileged process can no longer change TIPC state. Patch 2 drops CONN_ACK messages that acknowledge more outstanding sends than exist, preventing the snt_unacked underflow. Patch 3 rejects peer bindings with lower > upper, which would otherwise leak binding-table memory.
Changes in v4:
- Patch 1: use GENL_UNS_ADMIN_PERM for TIPC_NL_MEDIA_SET as well, rather than GENL_ADMIN_PERM. This keeps the same namespace-aware CAP_NET_ADMIN check that netlink_net_capable() performs on the legacy path, so CAP_NET_ADMIN holders in a non-initial user namespace (containers) keep working (Tung Quang Nguyen).
Changes in v3:
- Drop the discovery-message length patch; tipc_msg_validate() already rejects the short messages it guarded against (Tung Quang Nguyen).
- Patch 2 (snt_unacked): drop the conn_ack local and test
tsk->snt_unacked against msg_conn_ack() inline (Tung Quang Nguyen).
- Patch 3 (inverted ranges): restructure the declaration block, moving ua below key at the maintainer's request (Tung Quang Nguyen).
Changes in v2:
- Patch 1 uses GENL_ADMIN_PERM for TIPC_NL_MEDIA_SET and GENL_UNS_ADMIN_PERM for the netns-scoped mutators.
- Patch 2 validates msg_conn_ack() at the start of the CONN_ACK block and drops invalid messages instead of capping the value.
- Patch 3 reorders the new u32 declarations in reverse-Xmas-tree order.
Michael Bommarito (3):
tipc: require net admin for TIPCv2 netlink mutators
tipc: prevent snt_unacked underflow on CONN_ACK
tipc: reject inverted service ranges from peer bindings
net/tipc/name_distr.c | 13 +++++++++++-- net/tipc/netlink.c | 12 ++++++++++++ net/tipc/socket.c | 3 +++ 3 files changed, 26 insertions(+), 2 deletions(-)
Signature · 1 line
2.53.0
PATCH v4 1/3 tipc: require net admin for TIPCv2 netlink mutators
TIPCv2 registers mutating generic-netlink operations without admin permission flags. Generic netlink only checks CAP_NET_ADMIN when an operation sets GENL_ADMIN_PERM or GENL_UNS_ADMIN_PERM, so a local unprivileged process can currently change TIPC state through commands such as TIPC_NL_NET_SET, TIPC_NL_KEY_SET, TIPC_NL_KEY_FLUSH, and bearer enable/disable.
The legacy TIPC netlink API already checks netlink_net_capable(..., CAP_NET_ADMIN) for administrative commands. Give the TIPCv2 mutators the equivalent generic-netlink gate. Use GENL_UNS_ADMIN_PERM, which maps to the same namespace-aware CAP_NET_ADMIN check that netlink_net_capable() performs, so the behaviour matches the legacy path and keeps working for CAP_NET_ADMIN holders in a non-initial user namespace (containers).
A QEMU/KASAN repro run as uid/gid 65534 with zero effective capabilities previously succeeded in changing the network id and node identity, setting and flushing key material, and enabling/disabling a UDP bearer. With this patch applied the same operations fail with -EPERM.
--- net/tipc/netlink.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
net/tipc/netlink.c +12 -0
@@ -152,11 +152,13 @@ static const struct genl_ops tipc_genl_v2_ops[] = { { .cmd = TIPC_NL_BEARER_DISABLE, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_UNS_ADMIN_PERM, .doit = tipc_nl_bearer_disable, }, { .cmd = TIPC_NL_BEARER_ENABLE, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_UNS_ADMIN_PERM, .doit = tipc_nl_bearer_enable, }, {
@@ -168,11 +170,13 @@ static const struct genl_ops tipc_genl_v2_ops[] = { { .cmd = TIPC_NL_BEARER_ADD, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_UNS_ADMIN_PERM, .doit = tipc_nl_bearer_add, }, { .cmd = TIPC_NL_BEARER_SET, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_UNS_ADMIN_PERM, .doit = tipc_nl_bearer_set, }, {
@@ -197,11 +201,13 @@ static const struct genl_ops tipc_genl_v2_ops[] = { { .cmd = TIPC_NL_LINK_SET, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_UNS_ADMIN_PERM, .doit = tipc_nl_node_set_link, }, { .cmd = TIPC_NL_LINK_RESET_STATS, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_UNS_ADMIN_PERM, .doit = tipc_nl_node_reset_link_stats, }, {
@@ -213,6 +219,7 @@ static const struct genl_ops tipc_genl_v2_ops[] = { { .cmd = TIPC_NL_MEDIA_SET, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_UNS_ADMIN_PERM, .doit = tipc_nl_media_set, }, {
@@ -228,6 +235,7 @@ static const struct genl_ops tipc_genl_v2_ops[] = { { .cmd = TIPC_NL_NET_SET, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_UNS_ADMIN_PERM, .doit = tipc_nl_net_set, }, {
@@ -238,6 +246,7 @@ static const struct genl_ops tipc_genl_v2_ops[] = { { .cmd = TIPC_NL_MON_SET, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_UNS_ADMIN_PERM, .doit = tipc_nl_node_set_monitor, }, {
@@ -255,6 +264,7 @@ static const struct genl_ops tipc_genl_v2_ops[] = { { .cmd = TIPC_NL_PEER_REMOVE, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_UNS_ADMIN_PERM, .doit = tipc_nl_peer_rm, },#ifdef CONFIG_TIPC_MEDIA_UDP
@@ -269,11 +279,13 @@ static const struct genl_ops tipc_genl_v2_ops[] = { { .cmd = TIPC_NL_KEY_SET, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_UNS_ADMIN_PERM, .doit = tipc_nl_node_set_key, }, { .cmd = TIPC_NL_KEY_FLUSH, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, + .flags = GENL_UNS_ADMIN_PERM, .doit = tipc_nl_node_flush_key, }, #endif
Signature · 1 line
2.53.0
PATCH v4 2/3 tipc: prevent snt_unacked underflow on CONN_ACK
In reply to Michael Bommaritotipc_sk_conn_proto_rcv() subtracts the peer-supplied connection ack count from the unsigned 16-bit send counter snt_unacked without checking that it does not exceed the number of messages actually outstanding:
tsk->snt_unacked -= msg_conn_ack(hdr);
msg_conn_ack() is read straight from a received CONN_MANAGER/CONN_ACK message. If the ack count is larger than snt_unacked, the subtraction wraps to a near-maximum value, leaving tsk_conn_cong() permanently true and starving the connection of further transmits.
Validate the ACK count at the start of the CONN_ACK block and drop the message if it acknowledges more messages than are outstanding. A peer (or, for a local connection, the connected peer socket) can otherwise wedge a TIPC connection's send side by sending an oversized connection ack.
--- net/tipc/socket.c | 3 +++ 1 file changed, 3 insertions(+)
net/tipc/socket.c +3 -0
@@ -1362,6 +1362,9 @@ static void tipc_sk_conn_proto_rcv(struct tipc_sock *tsk, struct sk_buff *skb,__skb_queue_tail (xmitq, skb);return ; }else if (mtyp ==CONN_ACK ) { +if (tsk->snt_unacked <msg_conn_ack (hdr)) + goto exit; + was_cong =tsk_conn_cong (tsk);tipc_sk_push_backlog (tsk,msg_nagle_ack (hdr)); tsk->snt_unacked -=msg_conn_ack (hdr);
Signature · 1 line
2.53.0
PATCH v4 3/3 tipc: reject inverted service ranges from peer bindings
In reply to Michael Bommaritotipc_update_nametbl() inserts a binding advertised by a peer node using the lower and upper service-range bounds taken directly from the wire, without checking that lower <= upper. The local bind path validates the ordering (tipc_uaddr_valid()), but the name-distribution path does not.
A binding with lower > upper is inserted at the far end of the service-range rbtree (keyed on lower) where no lookup or withdrawal can ever match it (service_range_foreach_match() requires sr->lower <= end). The publication, its service_range node and the augmented rbtree entry are then leaked for the lifetime of the namespace, and there is no per-peer cap equivalent to TIPC_MAX_PUBL on locally created bindings.
Reject inverted ranges in the network path as well. A peer node can otherwise leak unbounded binding-table memory by sending PUBLICATION items with lower > upper.
--- net/tipc/name_distr.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
net/tipc/name_distr.c +11 -2
@@ -280,12 +280,21 @@ static bool tipc_update_nametbl(struct net *net, struct distr_item *i, u32 node, u32 dtype) {struct publication *p =NULL ; +u32 lower =ntohl (i->lower); +u32 upper =ntohl (i->upper);struct tipc_socket_addr sk; -struct tipc_uaddr ua;u32 key =ntohl (i->key); +struct tipc_uaddr ua; + +/* A peer-advertised binding with lower > upper can never be matched +* or withdrawn and would leak the publication; the local bind path +* rejects such ranges, so reject ranges learned from the network too. +*/ +if (lower > upper) +return false;tipc_uaddr (&ua,TIPC_SERVICE_RANGE ,TIPC_CLUSTER_SCOPE , -ntohl (i->type),ntohl (i->lower),ntohl (i->upper)); +ntohl (i->type), lower, upper); sk.ref =ntohl (i->port); sk.node = node;
Signature · 1 line
2.53.0
Quoted 46 lines
Subject: [PATCH net v4 0/3] tipc: fix netlink gate and receive-path bugs
This is v4 of the public TIPC series. The only change from v3 is in patch 1:
TIPC_NL_MEDIA_SETnow usesGENL_UNS_ADMIN_PERMlike the other mutators, instead ofGENL_ADMIN_PERM, so the whole series uses the namespace-awareCAP_NET_ADMINcheck that matches the legacy TIPC netlink path. Patches 2 and 3 are unchanged.Patch 1 gives the TIPCv2 mutating generic-netlink operations the admin gate the legacy API already has, so a local unprivileged process can no longer change TIPC state. Patch 2 drops
CONN_ACKmessages that acknowledge more outstanding sends than exist, preventing thesnt_unackedunderflow. Patch 3 rejects peer bindings with lower > upper, which would otherwise leak binding- table memory.Changes in v4:
- Patch 1: use
GENL_UNS_ADMIN_PERMforTIPC_NL_MEDIA_SETas well, rather thanGENL_ADMIN_PERM. This keeps the same namespace-awareCAP_NET_ADMINcheck thatnetlink_net_capable()performs on the legacy path, soCAP_NET_ADMINholders in a non-initial user namespace (containers) keep working (Tung Quang Nguyen).Changes in v3:
- Drop the discovery-message length patch;
tipc_msg_validate()already rejects the short messages it guarded against (Tung Quang Nguyen).
- Patch 2 (snt_unacked): drop theconn_acklocal and testtsk->snt_unackedagainstmsg_conn_ack()inline (Tung Quang Nguyen).
- Patch 3 (inverted ranges): restructure the declaration block, moving ua below key at the maintainer's request (Tung Quang Nguyen).Changes in v2:
- Patch 1 uses
GENL_ADMIN_PERMforTIPC_NL_MEDIA_SETandGENL_UNS_ADMIN_PERMfor the netns-scoped mutators.
- Patch 2 validatesmsg_conn_ack()at the start of theCONN_ACKblock and drops invalid messages instead of capping the value.
- Patch 3 reorders the new u32 declarations in reverse-Xmas-tree order.Michael Bommarito (3):
tipc: require net admin for TIPCv2 netlink mutators
tipc: preventsnt_unackedunderflow onCONN_ACK
tipc: reject inverted service ranges from peer bindings
Quoted 7 lines
net/tipc/name_distr.c | 13 +++++++++++-- net/tipc/netlink.c | 12 ++++++++++++ net/tipc/socket.c | 3 +++ 3 files changed, 26 insertions(+), 2 deletions(-)--
2.53.0
For the entire series:
This series was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 6 lines · On Wed, 10 Jun 2026 08:40:00 -0400 you wrote:
This is v4 of the public TIPC series. The only change from v3 is in patch 1:
TIPC_NL_MEDIA_SETnow usesGENL_UNS_ADMIN_PERMlike the other mutators, instead ofGENL_ADMIN_PERM, so the whole series uses the namespace-awareCAP_NET_ADMINcheck that matches the legacy TIPC netlink path. Patches 2 and 3 are unchanged.
Quoted 8 lines
Patch 1 gives the TIPCv2 mutating generic-netlink operations the admin gate the legacy API already has, so a local unprivileged process can no longer change TIPC state. Patch 2 drops
CONN_ACKmessages that acknowledge more outstanding sends than exist, preventing thesnt_unackedunderflow. Patch 3 rejects peer bindings with lower > upper, which would otherwise leak binding-table memory.[...]
Here is the summary with links:
- [net,v4,1/3] tipc: require net admin for TIPCv2 netlink mutators
https://git.kernel.org/netdev/net/c/86b0c540e2ea - [net,v4,2/3] tipc: prevent snt_unacked underflow on CONN_ACK https://git.kernel.org/netdev/net/c/ab3e10b44ba5 - [net,v4,3/3] tipc: reject inverted service ranges from peer bindings https://git.kernel.org/netdev/net/c/2afb648f7b99
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html