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]
Message-ID: <20251015041846.GB7073@lst.de>
Date: Wed, 15 Oct 2025 06:18:46 +0200
From: Christoph Hellwig <hch@....de>
To: Keith Busch <kbusch@...nel.org>
Cc: Leon Romanovsky <leon@...nel.org>, Christoph Hellwig <hch@....de>,
	Jens Axboe <axboe@...nel.dk>, Jason Gunthorpe <jgg@...dia.com>,
	linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-nvme@...ts.infradead.org, Sagi Grimberg <sagi@...mberg.me>
Subject: Re: [PATCH 3/4] block-dma: properly take MMIO path

On Mon, Oct 13, 2025 at 01:34:30PM -0600, Keith Busch wrote:
> On Mon, Oct 13, 2025 at 10:29:40PM +0300, Leon Romanovsky wrote:
> > On Mon, Oct 13, 2025 at 01:01:18PM -0600, Keith Busch wrote:
> > > On Mon, Oct 13, 2025 at 06:34:11PM +0300, Leon Romanovsky wrote:
> > > >  static bool blk_dma_map_direct(struct request *req, struct device *dma_dev,
> > > >  		struct blk_dma_iter *iter, struct phys_vec *vec)
> > > >  {
> > > > +	unsigned int attrs = 0;
> > > > +
> > > > +	if (req->cmd_flags & REQ_MMIO)
> > > > +		attrs |= DMA_ATTR_MMIO;
> > > 
> > > Since data and integrity paylods use these same functions and may point
> > > to different kinds of memory, I think you'd have to pass the 'attrs'
> > > from the caller since it knows which flags to check for MMIO dma.
> > 
> > I think that hunk will fix it.
> > 
> > diff --git a/block/blk-mq-dma.c b/block/blk-mq-dma.c
> > index 38f5c34ca223..8af88ba97c7a 100644
> > --- a/block/blk-mq-dma.c
> > +++ b/block/blk-mq-dma.c
> > @@ -88,9 +88,11 @@ static bool blk_dma_map_bus(struct blk_dma_iter *iter, struct phys_vec *vec)
> >  static bool blk_dma_map_direct(struct request *req, struct device *dma_dev,
> >                 struct blk_dma_iter *iter, struct phys_vec *vec)
> >  {
> > +       struct bio_integrity_payload *bip = bio_integrity(req->bio);
> >         unsigned int attrs = 0;
> > 
> > -       if (req->cmd_flags & REQ_MMIO)
> > +       if ((!bip && req->cmd_flags & REQ_MMIO) ||
> > +           bio_integrity_flagged(req->bio, BIP_MMIO))
> >                 attrs |= DMA_ATTR_MMIO;
> 
> If cmd_flags has REQ_MMIO set, but the integrity flag doesn't have
> BIP_MMIO set, you will skip setting DMA_ATTR_MMIO, but I think we need
> that set when this is called for the data payload.

Yes, we just need to check the relevant flag in the caller
and pass it in.  Or maybe just stash it in  struct blk_dma_iter.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ