From: Yuqiang Sun <izaiahsun@gmail.com>
To: leon@kernel.org
Cc: haris.iqbal@ionos.com, jinpu.wang@ionos.com, jgg@ziepe.ca,
guoqing.jiang@linux.dev, lgs201920130244@gmail.com,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH 1/3] RDMA/rtrs-srv: Do not free the path on path file creation failure
Date: Tue, 3 Nov 2026 21:49:39 +0800 [thread overview]
Message-ID: <20261103134939.55513-1-izaiahsun@gmail.com> (raw)
In-Reply-To: <20261103122024.GG264423@unreal>
On Tue, Nov 03, 2026 at 02:20:24PM +0200, Leon Romanovsky wrote:
> Interesting claim. How did you trigger the KASAN warning in the RDMA ULP?
With soft-RoCE in a KVM guest, with both ends of rtrs in the same guest,
and failslab standing in for an allocation failure:
- Kernel: rdma for-next c3e8e9451e6f, x86_64, with KASAN, RDMA_RXE,
INFINIBAND_RTRS_CLIENT/SERVER, BLK_DEV_RNBD_CLIENT/SERVER, BLK_DEV_RAM,
FAILSLAB and FAULT_INJECTION_STACKTRACE_FILTER, all built in.
- In the guest: "rdma link add rxe0 type rxe netdev eth0", then failslab
is limited to call stacks through rtrs_srv_create_path_files()
(require-start/require-end set to its range from /proc/kallsyms,
stacktrace-depth 32, probability 100, times 1, interval N), and /dev/ram0
is mapped through the rnbd client:
echo "sessname=s1 path=ip:10.0.2.15 device_path=/dev/ram0" \
> /sys/class/rnbd-client/ctl/map_device
- The server handles the client's info request in its completion worker,
in rtrs_srv_info_req_done(). With N chosen so that the failing
allocation is the one in kobject_init_and_add() of srv_path->kobj,
rtrs_srv_create_path_files() fails, its kobject_put() frees srv_path
through rtrs_srv_release(), and process_info_req() and
rtrs_srv_info_req_done() go on using it: that is the KASAN report in
the changelog, followed by more in rtrs_srv_close_work() and a general
protection fault. Failing the stats kobject instead gives reports of
the same kind.
The steps in the guest, after boot:
ip link set eth0 up
ip addr add 10.0.2.15/24 dev eth0
rdma link add rxe0 type rxe netdev eth0
f=rtrs_srv_create_path_files
start=$(awk -v f=$f '$3 == f {print $1; exit}' /proc/kallsyms)
end=$(sort /proc/kallsyms |
awk -v s=$start 'found && $1 != s {print $1; exit} $1 == s {found=1}')
F=/sys/kernel/debug/failslab
echo 0x$start > $F/require-start
echo 0x$end > $F/require-end
echo 32 > $F/stacktrace-depth
echo N > $F/task-filter
echo N > $F/ignore-gfp-wait
echo $N > $F/interval
echo 1 > $F/times
echo 2 > $F/verbose
echo 100 > $F/probability
echo "sessname=s1 path=ip:10.0.2.15 device_path=/dev/ram0" \
> /sys/class/rnbd-client/ctl/map_device
With verbose=2 failslab prints the stack of the allocation it fails, so
N is found by trying N=1, 2, ... until it is the one in
kobject_init_and_add() for srv_path->kobj (21 in our build).
So it needs an allocation failure while a client connects; nothing else
is unusual. I can send the full KASAN log, the init script and the
kernel config if that helps. The client that triggers patch 2's
use-after-free from the network by sending an empty pathname (fixed by
patch 3) is not public; I can send it to you privately if you want it.
Thanks,
Yuqiang
next prev parent reply other threads:[~2026-11-03 13:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 4:27 [PATCH 0/3] RDMA/rtrs-srv: fix use-after-free on sysfs setup failure Yuqiang Sun
2026-10-29 4:27 ` [PATCH 1/3] RDMA/rtrs-srv: Do not free the path on path file creation failure Yuqiang Sun
2026-11-03 12:20 ` Leon Romanovsky
2026-11-03 13:49 ` Yuqiang Sun [this message]
2026-10-29 4:27 ` [PATCH 2/3] RDMA/rtrs-srv: Balance the session device reference in sysfs setup Yuqiang Sun
2026-10-29 4:27 ` [PATCH 3/3] RDMA/rtrs-srv: Reject an empty pathname Yuqiang Sun
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=20261103134939.55513-1-izaiahsun@gmail.com \
--to=izaiahsun@gmail.com \
--cc=guoqing.jiang@linux.dev \
--cc=haris.iqbal@ionos.com \
--cc=jgg@ziepe.ca \
--cc=jinpu.wang@ionos.com \
--cc=leon@kernel.org \
--cc=lgs201920130244@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®