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] [day] [month] [year] [list]
Date:   Fri, 15 Sep 2023 18:18:21 +0100
From:   Matthew Wilcox <willy@...radead.org>
To:     Ben Wolsieffer <ben.wolsieffer@...ring.com>,
        David Howells <dhowells@...hat.com>
Cc:     linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        Vlastimil Babka <vbabka@...e.cz>,
        "Liam R. Howlett" <Liam.Howlett@...cle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Oleg Nesterov <oleg@...hat.com>,
        Giulio Benetti <giulio.benetti@...ettiengineering.com>,
        Davidlohr Bueso <dave@...olabs.net>
Subject: Re: [PATCH] proc: nommu: fix empty /proc/<pid>/maps

On Fri, Sep 15, 2023 at 12:00:56PM -0400, Ben Wolsieffer wrote:
> On no-MMU, /proc/<pid>/maps reads as an empty file. This happens because
> find_vma(mm, 0) always returns NULL (assuming no vma actually contains
> the zero address, which is normally the case).

Your patch is correct, but this is a deeper problem.  find_vma() on
MMU architectures returns the first VMA which is >= addr.

 * Returns: The VMA associated with addr, or the next VMA.
 * May return %NULL in the case of no VMA at addr or above.

But that's not how find_vma() behaves on nommu!  And I'd be tempted to
blame the maple tree conversion, but this is how it looked before the
maple tree:

-       /* trawl the list (there may be multiple mappings in which addr
-        * resides) */
-       for (vma = mm->mmap; vma; vma = vma->vm_next) {
-               if (vma->vm_start > addr)
-                       return NULL;
-               if (vma->vm_end > addr) {
-                       vmacache_update(addr, vma);
-                       return vma;
-               }
-       }

So calling find_vma(0) always returned NULL.  Unless there was a VMA
at 0, which there probably wasn't.

Why does nommu behave differently?  Dave, you introduced it back in 2005
(yes, I had to go to the git history tree for this one)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ