[Devel] [PATCH hci-8.1] fs/fuse/kio: do not panic on unaligned memory access in cs accel
Alexey Kuznetsov
kuznet at virtuozzo.com
Mon Nov 30 21:12:47 MSK 2026
Acknowledged.
It is for 8.1 as marked in the subject, and of course of 8.2.
Actually all the versions are affected, but I would not care,
it is still marginal. But because such simple and fatal bug
has been found in testing 8.1 I guess it would be better
to fix it at least starting from there.
> Not only tmpfs
Sure. There are lots of bizarre configurations.
F.e. csd could be started even on top on vstorage itself. :-)
Meatbags are more stupid than Claude but still have a common
sense which saves a lot of time and have to protect themselves
of redundant anality. tmpfs is special in sense it is really used in tests.
Anyway, in production it would be not so bad to reject initialization cs accel
requests unless it is ext4 with options used in real life i.e. ordered metadata
journal, no fast commits, no crypto. Acttually, it is not about kernel part,
user space will corrupt itself unless it is ext4 with exactly these properties.
It is safe but inconvenient, we will have to add knobs to override this
for tests.
> The error then goes through map_notify_soft_error() and closes the
congestion window of the local CS
It should not. It was supposed to be intercepted in map_read_error()
and ignored w/o harming any state. But everything is possible,
I will check.
> csa_submit() leaks the crc_page
This sounds really serious! If this is true, it is a bug
much worse than even oops. "AIO submit rejected" path is not exotic
and if it leaks it is fatal.
On Tue, Dec 1, 2026 at 12:11 AM Konstantin Khorenko
<khorenko at virtuozzo.com> wrote:
>
> 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