Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH net 0/2] net/rds: fix init failures leaving built-in transports on a dead core
@ 2026-10-21 19:58 Allison Henderson
  2026-10-21 19:58 ` [PATCH net 1/2] net/rds: do not fail init when CONFIG_SYSCTL=n Allison Henderson
  2026-10-21 19:58 ` [PATCH net 2/2] net/rds: do not initialize transports after rds_init() failed Allison Henderson
  0 siblings, 2 replies; 5+ messages in thread
From: Allison Henderson @ 2026-10-21 19:58 UTC (permalink / raw)
  To: netdev, linux-rdma, pabeni, edumazet, kuba, horms
  Cc: achender, oleg, joel.granados

The kernel test robot hit a slab-use-after-free on rds_wq at boot with
CONFIG_SYSCTL=n and RDS, RDS_RDMA and RDS_TCP built in [1].  Two
separate bugs are involved.

With CONFIG_SYSCTL=n, register_net_sysctl() is a stub that returns
NULL, and RDS treats that as -ENOMEM, so rds_init() fails even though
every tunable has a usable default.  Patch 1 only treats NULL as a
failure when sysctl support is built in.

Second, when RDS is built in, a failed rds_init() does not stop the
rds_rdma and rds_tcp initcalls.  They run against a core that has
already been torn down and queue onto or flush the freed rds_wq.  The
error path of rds_ib_init() did this in the robot's report.  The
rds_tcp listen socket can also do it when an incoming connection
arrives.  Patch 2 makes both transports bail out with -ENODEV unless
rds_init() succeeded.  Modular builds can't hit this, because the
transports need symbols from rds.ko.

Thanks to Oleg Nesterov and Joel Granados for the analysis in [2].

Testing: x86_64 under virtme-ng, built in RDS/RDS_RDMA/RDS_TCP,
CONFIG_SYSCTL=n, KASAN, booted with initcall_debug:
  - net/main: rds_init() returns -ENOMEM, then rds_rdma_init() hits
    KASAN slab-use-after-free in __flush_workqueue() from rds_ib_init(),
    reproducing [1].
  - patch 2 only: rds_init() still returns -ENOMEM; rds_rdma_init() and
    rds_tcp_init() return -ENODEV and the boot completes cleanly.
  - both patches: rds_init(), rds_rdma_init() and rds_tcp_init() all
    return 0, no KASAN reports.

[1] https://lore.kernel.org/oe-lkp/202610190310.9737b2e3-lkp@intel.com
[2] https://lore.kernel.org/all/atdoGiW_sHlWgOwt@redhat.com/


Allison Henderson (2):
  net/rds: do not fail init when CONFIG_SYSCTL=n
  net/rds: do not initialize transports after rds_init() failed

 net/rds/af_rds.c         | 14 ++++++++++++++
 net/rds/ib_sysctl.c      |  2 +-
 net/rds/rdma_transport.c |  3 +++
 net/rds/rds.h            |  1 +
 net/rds/sysctl.c         |  2 +-
 net/rds/tcp.c            |  5 ++++-
 6 files changed, 24 insertions(+), 3 deletions(-)

-- 
2.50.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-21 20:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-21 19:58 [PATCH net 0/2] net/rds: fix init failures leaving built-in transports on a dead core Allison Henderson
2026-10-21 19:58 ` [PATCH net 1/2] net/rds: do not fail init when CONFIG_SYSCTL=n Allison Henderson
2026-10-21 20:03   ` sashiko-bot
2026-10-21 19:58 ` [PATCH net 2/2] net/rds: do not initialize transports after rds_init() failed Allison Henderson
2026-10-21 20:03   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox