From: Allison Henderson <achender@kernel.org>
To: Xie Maoyi <maoyi.xie@ntu.edu.sg>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
"rds-devel@oss.oracle.com" <rds-devel@oss.oracle.com>
Subject: Re: rds: possible cross netns leak via RDS_INFO_* getsockopt
Date: Tue, 05 May 2026 15:07:49 -0700 [thread overview]
Message-ID: <2962d0cbd5313ab482ece5543bafa0d2f0c32cc3.camel@kernel.org> (raw)
In-Reply-To: <TYZPR01MB6758F43459242F22946A8192DC3E2@TYZPR01MB6758.apcprd01.prod.exchangelabs.com>
On Tue, 2026-05-05 at 08:37 +0000, Xie Maoyi wrote:
> Hi all,
>
> We are not sure whether what we observed is a real bug or
> intended behaviour. We would appreciate your view.
>
> In net/rds/info.c, rds_info_getsockopt() dispatches to handlers
> registered in rds_info_funcs[]. Each handler reads a global list
> that is not pernet:
>
> rds_sock_info / rds6_sock_info -> rds_sock_list
> rds_tcp_tc_info / rds6_tcp_tc_info -> rds_tcp_tc_list
> rds_conn_info / rds6_conn_info -> rds_conn_hash[]
>
> None of those filter by the caller's netns. rds_info_getsockopt()
> also has no netns or capable() check. rds_create() has no
> capable() check either. So AF_RDS is reachable from an
> unprivileged user namespace.
>
> Our reading is that an unprivileged caller in a fresh user_ns
> plus netns can read RDS state from init_net. We see this in
> practice on the latest net tree.
>
> The fields that come back include:
>
> RDS_INFO_SOCKETS: bound addr, port, sock inode of every
> RDS socket on the host
> RDS_INFO_TCP_SOCKETS: peer addr, port, last_sent_nxt,
> last_expected_una, last_seen_una of
> every rds-tcp connection on the host
> RDS_INFO_CONNECTIONS: peer addr, port, cp_next_tx_seq,
> cp_next_rx_seq of every RDS connection
>
> A small reproducer is attached as poc_rds_info.c. With rds and
> rds_tcp loaded, the steps are:
>
> modprobe rds
> modprobe rds_tcp
> ./poc_rds_info
>
> The PoC binds an AF_RDS socket in init_net to 127.0.0.1:4242 as
> root. It then enters a fresh user_ns plus netns and opens AF_RDS
> there. The attacker side reads RDS_INFO_SOCKETS and sees the
> init_net socket. A run log is attached as poc_verification.log.
>
> We are not sure if this counts as a bug or is by design. The
> RDS_INFO_* interface looks diagnostic. It may be expected to be
> host wide. On the other hand, AF_RDS is reachable from an
> unprivileged user namespace, which is what surprised us.
>
> Could you let us know whether you consider this worth fixing? If
> yes, we have a draft patch that gates rds_info_getsockopt() to
> init_net. We can send it once you confirm the direction.
>
> Thanks for your time.
>
> Maoyi Xie and Praveen Kakkolangara
>
> Maoyi Xie
> Nanyang Technological University
> https://maoyixie.com/
Hi Xie,
Thanks for looking into this. I think your findings are valid, diagnostic or debug tools shouldn't allow callers
visibility into another netns. Note though that while the ib transport is limited to init_net the tcp transport is not
(see rds_set_transport()). So one gate in rds_info_getsockopt would incorrectly filter netns that a tcp connection
might have legitimate visibility to. So the fix would need a filter in each of the three handlers you've identified,
where we can compare the netns of the socket to the netns of the entry (or c_net for connection paths), and only copy
info for relevant sockets instead of every entry in the respective global list/hash.
Allison
> ________________________________
>
> CONFIDENTIALITY: This email is intended solely for the person(s) named and may be confidential and/or privileged. If you are not the intended recipient, please delete it, notify us and do not copy, use, or disclose its contents.
> Towards a sustainable earth: Print only when necessary. Thank you.
next prev parent reply other threads:[~2026-05-05 22:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-05 8:37 rds: possible cross netns leak via RDS_INFO_* getsockopt Xie Maoyi
2026-05-05 22:07 ` Allison Henderson [this message]
2026-05-06 7:10 ` Xie Maoyi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2962d0cbd5313ab482ece5543bafa0d2f0c32cc3.camel@kernel.org \
--to=achender@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=maoyi.xie@ntu.edu.sg \
--cc=netdev@vger.kernel.org \
--cc=rds-devel@oss.oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox