CVSROOT: /cvs Module name: src Changes by: mi...@cvs.openbsd.org 2016/12/13 12:02:39
Modified files: sys/dev/pv : xbf.c Log message: Bounce unaligned transfer data through a scratch buffer Thanks to the detailed report from Nathanael Rensen, the issue with unaligned transfer data became apparent: the backend expects buffers be multiple of 512 bytes and to be 512 byte aligned, which is not always satisfied. This isn't an issue when requests are coming from the buffer cache, but can happen with raw device access since physio(9) ensures the former requirement is met by disallowing non-block sized reads, but doesn't enforce the latter. It remaps userland buffers into the kernel virtual space which preserves the data offset within the memory page and thus the original alignment. Buffers with offsets under the block size can't be referenced by Blkfront ring descriptors that measure data in blocks and must be substituted with temporary buffers for the duration of the I/O operation.