From: Yibo Liu <yiboliume@gmail.com>
To: "Philipp Reisner" <philipp.reisner@linbit.com>,
"Lars Ellenberg" <lars.ellenberg@linbit.com>,
"Christoph Böhmwalder" <christoph.boehmwalder@linbit.com>,
"Jens Axboe" <axboe@kernel.dk>
Cc: drbd-dev@lists.linux.dev, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org, Yibo Liu <yiboliume@gmail.com>
Subject: [PATCH 0/2] drbd: validate payload sizes received from the peer
Date: Thu, 15 Oct 2026 15:27:58 -0700 [thread overview]
Message-ID: <20261015222800.85928-1-yiboliume@gmail.com> (raw)
Two places in the DRBD receive path take a payload size from the peer's
packet header and use it without comparing it to the size they expect.
Commit bd910a7660d2 ("drbd: reject data replies with an out-of-range
payload size") already rejects negative sizes in recv_dless_read();
these patches cover the remaining cases:
1/2 rejects a P_DATA_REPLY whose size differs from the read request.
A short reply currently completes the read successfully with part
of the bio never written.
2/2 rejects P_CSUM_RS_REQUEST and P_OV_REPLY packets whose digest
length does not match the configured algorithm, and makes the
worker compare digests only when their sizes match. A short digest
currently causes an out-of-bounds read in memcmp(), and a huge one
triggers a page allocator warning.
Like the earlier fixes, this only matters for a peer that does not
follow the protocol; a correct peer always sends the expected sizes.
The problems were found with the help of an AI coding assistant and
were reproduced on block-7.3 before posting (details below the "---" of
each patch). Testing:
- before/after runs of the reproducer in an arm64 virtme-ng KASAN guest
- a complete csums-alg resync and an online verify as regression tests
- each patch built with W=1 and sparse (C=2), arm64, gcc 13.3: no new
warnings
- checkpatch.pl --strict clean
Not built with clang or for other architectures.
Yibo Liu (2):
drbd: reject data replies whose size does not match the request
drbd: validate digest size in checksum resync and verify requests
drivers/block/drbd/drbd_receiver.c | 14 ++++++++++++--
drivers/block/drbd/drbd_worker.c | 8 ++++----
2 files changed, 16 insertions(+), 6 deletions(-)
base-commit: 41cab3a71dc7be62114d91cc849424879062d324
--
2.39.5 (Apple Git-154)
next reply other threads:[~2026-10-15 22:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 22:27 Yibo Liu [this message]
2026-10-15 22:27 ` [PATCH 1/2] drbd: reject data replies whose size does not match the request Yibo Liu
2026-10-15 22:28 ` [PATCH 2/2] drbd: validate digest size in checksum resync and verify requests Yibo Liu
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=20261015222800.85928-1-yiboliume@gmail.com \
--to=yiboliume@gmail.com \
--cc=axboe@kernel.dk \
--cc=christoph.boehmwalder@linbit.com \
--cc=drbd-dev@lists.linux.dev \
--cc=lars.ellenberg@linbit.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=philipp.reisner@linbit.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