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: <CAKgT0UfGCzfMqM_GdYsfsowAasW7-awYjSp=FBmB99rDuZpc8g@mail.gmail.com>
Date:   Tue, 19 Nov 2019 16:02:07 -0800
From:   Alexander Duyck <alexander.duyck@...il.com>
To:     Dan Williams <dan.j.williams@...el.com>
Cc:     Christoph Hellwig <hch@....de>,
        Russell King <linux@...linux.org.uk>,
        Don Dutile <ddutile@...hat.com>, stable@...r.kernel.org,
        Marek Szyprowski <m.szyprowski@...sung.com>,
        Robin Murphy <robin.murphy@....com>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-mm <linux-mm@...ck.org>
Subject: Re: [PATCH] dma/debug: Fix dma vs cow-page collision detection

On Tue, Nov 19, 2019 at 9:49 AM Dan Williams <dan.j.williams@...el.com> wrote:
>
> The debug_dma_assert_idle() infrastructure was put in place to catch a
> data corruption scenario first identified by the now defunct NET_DMA
> receive offload feature. It caught cases where dma was in flight to a
> stale page because the dma raced the cpu writing the page, and the cpu
> write triggered cow_user_page().
>
> However, the dma-debug tracking is overeager and also triggers in cases
> where the dma device is reading from a page that is also undergoing
> cow_user_page().
>
> The fix proposed was originally posted in 2016, and Russell reported
> "Yes, that seems to avoid the warning for me from an initial test", and
> now Don is also reporting that this fix is addressing a similar false
> positive report that he is seeing.
>
> Link: https://lore.kernel.org/r/CAPcyv4j8fWqwAaX5oCdg5atc+vmp57HoAGT6AfBFwaCiv0RbAQ@mail.gmail.com
> Reported-by: Russell King <linux@...linux.org.uk>
> Reported-by: Don Dutile <ddutile@...hat.com>
> Fixes: 0abdd7a81b7e ("dma-debug: introduce debug_dma_assert_idle()")
> Cc: <stable@...r.kernel.org>
> Cc: Christoph Hellwig <hch@....de>
> Cc: Marek Szyprowski <m.szyprowski@...sung.com>
> Cc: Robin Murphy <robin.murphy@....com>
> Signed-off-by: Dan Williams <dan.j.williams@...el.com>
> ---
>  kernel/dma/debug.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c
> index 099002d84f46..11a6db53d193 100644
> --- a/kernel/dma/debug.c
> +++ b/kernel/dma/debug.c
> @@ -587,7 +587,7 @@ void debug_dma_assert_idle(struct page *page)
>         }
>         spin_unlock_irqrestore(&radix_lock, flags);
>
> -       if (!entry)
> +       if (!entry || entry->direction != DMA_FROM_DEVICE)
>                 return;
>
>         cln = to_cacheline_number(entry);

If I am understanding right DMA_TO_DEVICE is fine, but won't  you also
need to cover the DMA_BIDIRECTIONAL case since it is possible for a
device to also write the memory in that case?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ