Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
* [PATCH 0/2] drbd: validate payload sizes received from the peer
@ 2026-10-15 22:27 Yibo Liu
  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
  0 siblings, 2 replies; 3+ messages in thread
From: Yibo Liu @ 2026-10-15 22:27 UTC (permalink / raw)
  To: Philipp Reisner, Lars Ellenberg, Christoph Böhmwalder,
	Jens Axboe
  Cc: drbd-dev, linux-block, linux-kernel, Yibo Liu

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)


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

end of thread, other threads:[~2026-10-15 22:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-15 22:27 [PATCH 0/2] drbd: validate payload sizes received from the peer Yibo Liu
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

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