lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 5 Apr 2016 00:45:08 +0100
From:	Al Viro <viro@...IV.linux.org.uk>
To:	Christoph Hellwig <hch@...radead.org>
Cc:	Jens Axboe <axboe@...com>, linux-kernel@...r.kernel.org,
	linux-block@...r.kernel.org
Subject: Re: [RFC] weird semantics of SG_DXFER_TO_FROM_DEV in BLK_DEV_SKD
 (drivers/block/skd*)

On Mon, Apr 04, 2016 at 08:50:42PM +0100, Al Viro wrote:

> What happens if somebody issues SG_IO with 256-segment vector, each segment
> 1 byte long and page-aligned?  Will the driver really be happy with the
> resulting request, as long as it hasn't claimed non-zero queue_virt_boundary?
> Because AFAICS we'll get a request with a pile of bvecs, each with
> ->bv_offset equal to 0 and ->bv_len equal to 1; can that really work?

OK, it really doesn't make sense.  What happened, AFAICS, is that when
blk_rq_map_user_iov() has grown a "misaligned, need to copy" code, the
check had been mishandled - rather than checking both the base and the
length of segments, as blk_rq_map_{user,kern} used to do (and as ..._kern
is still doing) it checked only the base.

Then in "block: use blk_rq_map_user_iov to implement blk_rq_map_user" you've
missed that problem, which got us the current situaiton.  Note that e.g.
PIO case of libata really wants copy in case of 500 bytes + 12 bytes
vector - it'll splat the last 12 bytes adjacent to the end of the first
segment, etc.

AFAICS, what we need there is simply
	nr_pages = iov_iter_npages(iter);
	alignment = iov_iter_alignment(iter);
	if (alignment & (queue_dma_alignment(q) | q->dma_pad_mask))
		copy = true;
and I really wonder if we care about special-casing the situation when the
ends are not aligned to queue_virt_boundary(q).  If we don't, we might as
well add queue_virt_boundary(q) to the mask we are checking.  If we do,
it's not hard to add a variant that would calculate both the alignment and
alignment for internal boundaries...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ