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: <ZWO-x_ElKe6qtsIq@x1n>
Date:   Sun, 26 Nov 2023 16:55:19 -0500
From:   Peter Xu <peterx@...hat.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        Dan Williams <dan.j.williams@...el.com>,
        Mel Gorman <mgorman@...e.de>,
        Matthew Wilcox <willy@...radead.org>,
        "Aneesh Kumar K . V" <aneesh.kumar@...ux.vnet.ibm.com>,
        Christoph Hellwig <hch@....de>
Subject: Re: [PATCH] mm/gup: Fix follow_devmap_p[mu]d() on page==NULL handling

On Fri, Nov 24, 2023 at 11:20:59AM -0800, Andrew Morton wrote:
> On Thu, 23 Nov 2023 13:02:22 -0500 Peter Xu <peterx@...hat.com> wrote:
> 
> > This is a bug found not by any report but only by code observations.
> > 
> > When GUP sees a devpmd/devpud and if page==NULL is returned, it means a
> > fault is probably required.  Here falling through when page==NULL can cause
> > unexpected behavior.
> > 
> 
> Well this is worrisome.  We aren't able to construct a test case to
> demonstrate this bug?  Why is that?  Is it perhaps just dead code?

IIUC it's not dead code. Take the example of follow_devmap_pmd(), it can
return page==NULL at least when seeing write bit missing:

	if (flags & FOLL_WRITE && !pmd_write(*pmd))
		return NULL;

AFAICT it can happen if someone does "echo 4 > /proc/$PID/clear_refs" when
the mm contains the devmap pmd.  Same to pud.

It'll be nice if someone that works with dax would like to verify it.  In
my series (refactor hugetlb gup, part 2) IIUC some hugetlb selftest can
start to trigger this path, but I'll need to check.  So far it's dax-only.

Thanks,

-- 
Peter Xu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ