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  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]
Date:   Fri, 1 Mar 2019 13:49:53 +0200
From:   Mike Rapoport <rppt@...ux.ibm.com>
To:     "Kirill A. Shutemov" <kirill@...temov.name>
Cc:     Steven Price <steven.price@....com>,
        Mark Rutland <Mark.Rutland@....com>, x86@...nel.org,
        Arnd Bergmann <arnd@...db.de>,
        Ard Biesheuvel <ard.biesheuvel@...aro.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Catalin Marinas <catalin.marinas@....com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Will Deacon <will.deacon@....com>,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        Jérôme Glisse <jglisse@...hat.com>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Andy Lutomirski <luto@...nel.org>,
        "H. Peter Anvin" <hpa@...or.com>,
        James Morse <james.morse@....com>,
        Thomas Gleixner <tglx@...utronix.de>,
        linux-arm-kernel@...ts.infradead.org,
        "Liang, Kan" <kan.liang@...ux.intel.com>
Subject: Re: [PATCH v2 03/13] mm: Add generic p?d_large() macros

Hi Kirill,

On Thu, Feb 21, 2019 at 05:57:06PM +0300, Kirill A. Shutemov wrote:
> On Thu, Feb 21, 2019 at 02:46:18PM +0000, Steven Price wrote:
> > On 21/02/2019 14:28, Kirill A. Shutemov wrote:
> > > On Thu, Feb 21, 2019 at 11:34:52AM +0000, Steven Price wrote:
> > >> From: James Morse <james.morse@....com>
> > >>
> > >> Exposing the pud/pgd levels of the page tables to walk_page_range() means
> > >> we may come across the exotic large mappings that come with large areas
> > >> of contiguous memory (such as the kernel's linear map).
> > >>
> > >> For architectures that don't provide p?d_large() macros, provided a
> > >> does nothing default.
> > > 
> > > Nak, sorry.
> > > 
> > > Power will get broken by the patch. It has pmd_large() inline function,
> > > that will be overwritten by the define from this patch.
> > > 
> > > I believe it requires more ground work on arch side in general.
> > > All architectures that has huge page support has to provide these helpers
> > > (and matching defines) before you can use it in a generic code.
> > 
> > Sorry about that, I had compile tested on power, but obviously not the
> > right config to actually see the breakage.
> 
> I don't think you'll catch it at compile-time. It would silently override
> the helper with always-false.

Can you explain why the compiler would override the helper define in, e.g.
arch/powerpc/include/asm/pgtable.h with the generic (0)?
Actually, I've tried to compile this on power with deliberately adding
errors to both power-specific and the generic definition of pmd_large and
the compilation failed the way I expected in the power-specific helper.
 
> > I'll do some grepping - hopefully this is just a case of exposing the
> > functions/defines that already exist for those architectures.
> 
> I see the same type of breakage on s390 and sparc.
> 
> > Note that in terms of the new page walking code, these new defines are
> > only used when walking a page table without a VMA (which isn't currently
> > done), so architectures which don't use p?d_large currently will work
> > fine with the generic versions. They only need to provide meaningful
> > definitions when switching to use the walk-without-a-VMA functionality.
> 
> How other architectures would know that they need to provide the helpers
> to get walk-without-a-VMA functionality? This looks very fragile to me.
> 
> -- 
>  Kirill A. Shutemov

-- 
Sincerely yours,
Mike.

Powered by blists - more mailing lists