[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPcyv4gkr18sYYi=mgQf0AxP6NbPinT4pDRLwaUTuqsFnPEEmQ@mail.gmail.com>
Date: Mon, 1 May 2017 09:00:04 -0700
From: Dan Williams <dan.j.williams@...el.com>
To: Baoquan He <bhe@...hat.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, X86 ML <x86@...nel.org>,
Kees Cook <keescook@...omium.org>,
Thomas Garnier <thgarnie@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Yasuaki Ishimatsu <yasu.isimatu@...il.com>,
Jinbum Park <jinb.park7@...il.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Yinghai Lu <yinghai@...nel.org>, Dave Young <dyoung@...hat.com>
Subject: Re: [PATCH v2] x86/mm: Fix incorrect for loop count calculation in sync_global_pgds
On Mon, May 1, 2017 at 8:55 AM, Baoquan He <bhe@...hat.com> wrote:
> Jeff Moyer reported that on his system with two memory regions 0~64G and
> 1T~1T+192G, and kernel option "memmap=192G!1024G" added, enabling kaslr
> will make system hang intermittently during boot. While adding 'nokaslr'
> won't.
>
> This is because the for loop count calculation in sync_global_pgds is
> not correct. When a mapping area crosses pgd entries, we should
> calculate the starting address of region which next pgd covers and assign
> it to next for loop count, but not add PGDIR_SIZE directly. The old
> code works right only if the mapping area is times of PGDIR_SIZE,
> otherwize the end region could be skipped so that it can't be synchronized
> to all other processes from kernel pgd init_mm.pgd.
>
> In Jeff's system, emulated pmem area [1024G, 1216G) is smaller than
> PGDIR_SIZE. While 'nokaslr' works because PAGE_OFFSET is 1T aligned, it
> makes this area be mapped inside one pgd entry. With kaslr enabled,
> this area could cross two pgd entries, then the next pgd entry won't
> be synced to all other processes. That is why we saw empty PGD.
>
> Fix it in this patch.
>
[..]
>
> Reported-by: Jeff Moyer <jmoyer@...hat.com>
> Signed-off-by: Baoquan He <bhe@...hat.com>
[..]
Reviewed-by: Dan Williams <dan.j.williams@...el.com>
Powered by blists - more mailing lists