[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1805161153220.1627@nanos.tec.linutronix.de>
Date: Wed, 16 May 2018 11:53:41 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
cc: Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, Hugh Dickins <hughd@...gle.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCHv2 2/2] x86/boot/compressed/64: Fix moving page table out
of trampoline memory
On Wed, 16 May 2018, Kirill A. Shutemov wrote:
> cleanup_trampoline() relocates the top-level page table out of
> trampoline memory. We use 'top_pgtable' as our new top-level page table.
>
> But if the 'top_pgtable' would be referenced from C in a usual way,
> the address of the table will be calculated relative to RIP.
> After kernel gets relocated, the address will be in the middle of
> decompression buffer and the page table may get overwritten.
> This leads to a crash.
>
> We calculate the address of other page tables relative to the relocation
> address. It makes them safe. We should do the same for 'top_pgtable'.
>
> Calculate the address of 'top_pgtable' in assembly and pass down to
> cleanup_trampoline().
>
> Move the page table to .pgtable section where the rest of page tables
> are. The section is @nobits so we save 4k in kernel image.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
> Fixes: e9d0e6330eb8 ("x86/boot/compressed/64: Prepare new top-level page table for trampoline")
Reviewed-by: Thomas Gleixner <tglx@...utronix.de>
Powered by blists - more mailing lists