Re: [PATCH v5 34/38] kmsan: dma: unpoison memory mapped by dma_direct_map_page()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 25, 2020 at 5:19 PM Christoph Hellwig <hch@xxxxxx> wrote:
>
> On Wed, Mar 25, 2020 at 05:12:45PM +0100, glider@xxxxxxxxxx wrote:
> > diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
> > index a8560052a915f..63dc1a594964a 100644
> > --- a/kernel/dma/direct.c
> > +++ b/kernel/dma/direct.c
> > @@ -367,6 +367,7 @@ dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
> >                            &dma_addr, size, *dev->dma_mask, dev->bus_dma_limit);
> >               return DMA_MAPPING_ERROR;
> >       }
> > +     kmsan_handle_dma(page_address(page) + offset, size, dir);
>
> This needs to go into dma_map_page so that it also covers IOMMUs.
> dma_map_sg_atttrs will also need similar treatment.

Thanks, will be done in v6!

> Also the page
> doesn't have to be mapped into kernel address space, you probably
> want to pass the page to kmsan_handle_dma and throw in a highmem
> check there.

Do you mean comparing the address to TASK_SIZE, or is there a more
portable way to check that?

-- 
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux