[Devel] [PATCH hci-8.1] fs/fuse/kio: do not panic on unaligned memory access in cs accel

Konstantin Khorenko khorenko at virtuozzo.com
Mon Nov 30 19:02:57 MSK 2026


Please, send an ACK for the patch and after that

i can apply this with the following fixes on my side:

- trailers: dropped "Affects:" (it repeats the URL) and the blank
  lines between them, put them in the usual order: URL, Fixes,
  Feature, Signed-off-by. With the blank lines git saw only Feature:
  as a trailer.

On Mon, 30 Nov 2026 22:57:17 +0800, Alexey Kuznetsov wrote:
> Nevertheless,
> new kernels have allowed O_DIRECT access to tmpfs
> (e88e0d366f9c "tmpfs: trivial support for direct IO"), which does
> not imply any memory alignment constraints. Our tests really use
> tmpfs.

Not only tmpfs. On ext4/xfs CS disks an O_DIRECT read of a hole or
an unwritten extent goes through iomap_dio_hole_iter(), which fills
the buffer without the memory alignment check of the bio path, and
ext4 data=journal falls back to buffered reads. So the BUG_ON could
fire in production before the tmpfs change, and the fix is worth
having on every branch with 5acc64b761cd.

> - vstorage deliberately does not check memory alignment anywhere.

init_crypted_data() does check it, (bv_offset | bv_len) & 511, before
the encrypted write is submitted.

> +		if (unlikely(len & 511)) {
> +			put_page(page);

No change needed now, a thought for later: this fires only after the
local read is done and the earlier pages are decrypted in place.
The error then goes through map_notify_soft_error() and closes the
congestion window of the local CS (eff_cwnd = 1) until its next
success. The same check in csa_submit() for IREQ_F_CRYPT, as on the
write path, would fall back before any IO and without that.

Separate patches, not needed for this one. I created a task:

1. csa_submit() leaks the crc_page[] references taken by
   quick_crc_fetch() on its synchronous error returns ("Not a bvec",
   "AIO submit rejected"); the caller falls back to the network and
   the union with iochunk.ir overwrites the pointers. Unaligned
   O_DIRECT reads on block-backed CS storage with CRC take this path.
   https://virtuozzo.atlassian.net/browse/VSTOR-158112

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team



More information about the Devel mailing list