[0/3] xfs: avoid IO issues unaligned memory allocation
mbox series

Message ID 20190821083820.11725-1-david@fromorbit.com
Headers show
Series
  • xfs: avoid IO issues unaligned memory allocation
Related show

Message

Dave Chinner Aug. 21, 2019, 8:38 a.m. UTC
Hi folks,

These patches fix the issue reported by Vishal on 5.3-rc1 with pmem,
reproduced on brd, and previously seen with xenblk.

The core issue is that when memory allocation debugging is turned
on, heap memory is no longer naturally aligned and that means
we attach memory with large memory regions with random alignment to
bios. Some block drivers only support 512 byte aligned memory
buffers, and these then silently break when fed an unaligned
buffers.

This happens silently because nothing in the block or driver layers
actually validates that memory buffers containing kernel memory
are correctly aligned. Buffers may be bounced in the drivers if
they are unaligned, but not all driver support this, hence the
breakage.

This patchset added memory allocation tracing, 512 byte aligned
allocation support via kmem_alloc_io(), and a re-implementation of
bio_add_page() to add memory buffer alignment verification. The last
patch causes unaligned allocations to fail fast, noisily and safely,
such that any developer running KASAN will immediately notice if
XFS attaches an unaligned mmemory buffer to a bio....

Cheers,

Dave.