lkml.org 
[lkml]   [2019]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] x86/mm/pti: in pti_clone_pgtable() don't increase addr by PUD_SIZE
Date
On Tue, 2019-08-20 at 09:21 -0400, Song Liu wrote:
> > On Aug 20, 2019, at 4:16 AM, Thomas Gleixner <tglx@linutronix.de>
> > wrote:
> >
> > On Tue, 20 Aug 2019, Peter Zijlstra wrote:
> > > What that code wants to do is skip to the end of the pud, a
> > > pmd_size
> > > increase will not do that. And right below this, there's a second
> > > instance of this exact pattern.
> > >
> > > Did I get the below right?
> > >
> > > ---
> > > diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c
> > > index b196524759ec..32b20b3cb227 100644
> > > --- a/arch/x86/mm/pti.c
> > > +++ b/arch/x86/mm/pti.c
> > > @@ -330,12 +330,14 @@ pti_clone_pgtable(unsigned long start,
> > > unsigned long end,
> > >
> > > pud = pud_offset(p4d, addr);
> > > if (pud_none(*pud)) {
> > > + addr &= PUD_MASK;
> > > addr += PUD_SIZE;
> >
> > round_up(addr, PUD_SIZE);
>
> I guess we need "round_up(addr + PMD_SIZE, PUD_SIZE)".

What does that do if start is less than PMD_SIZE
away from the next PUD_SIZE boundary?

How about: round_up(addr + 1, PUD_SIZE) ?

\
 
 \ /
  Last update: 2019-08-20 15:57    [W:0.087 / U:0.620 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site