* Re: [PATCH 4.9] x86/pti/efi: broken conversion from efi to kernel page table
2018-01-11 21:58 [PATCH 4.9] x86/pti/efi: broken conversion from efi to kernel page table Pavel Tatashin
@ 2018-01-12 13:58 ` Ingo Molnar
2018-01-12 14:09 ` Pavel Tatashin
2018-01-12 14:27 ` Jiri Kosina
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Ingo Molnar @ 2018-01-12 13:58 UTC (permalink / raw)
To: Pavel Tatashin
Cc: steven.sistare, linux-kernel, tglx, mingo, hpa, x86, gregkh,
jkosina, hughd, dave.hansen, luto, torvalds
* Pavel Tatashin <pasha.tatashin@oracle.com> wrote:
> The page table order must be increased for EFI table in order to avoid a
> bug where NMI tries to change the page table to kernel page table, while
> efi page table is active.
>
> For more disccussion about this bug, see this thread:
> http://lkml.iu.edu/hypermail/linux/kernel/1801.1/00951.html
>
> Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
> Reviewed-by: Steven Sistare <steven.sistare@oracle.com>
> ---
> arch/x86/include/asm/pgalloc.h | 11 +++++++++++
> arch/x86/platform/efi/efi_64.c | 2 +-
> 2 files changed, 12 insertions(+), 1 deletion(-)
Is there a Git tree/branch I could follow to see the very latest v4.9 PTI backport
commits?
Thanks,
Ingo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4.9] x86/pti/efi: broken conversion from efi to kernel page table
2018-01-12 13:58 ` Ingo Molnar
@ 2018-01-12 14:09 ` Pavel Tatashin
0 siblings, 0 replies; 9+ messages in thread
From: Pavel Tatashin @ 2018-01-12 14:09 UTC (permalink / raw)
To: Ingo Molnar
Cc: Steve Sistare, Linux Kernel Mailing List, Thomas Gleixner, mingo,
hpa, x86, Greg Kroah-Hartman, Jiri Kosina, Hugh Dickins,
dave.hansen, Andy Lutomirski, Linus Torvalds
Hi Ingo,
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/log/?h=linux-4.9.y&ofs=50
4.9 PTI backport is in 4.9.75.
Thank you,
Pavel
On Fri, Jan 12, 2018 at 8:58 AM, Ingo Molnar <mingo@kernel.org> wrote:
>
> * Pavel Tatashin <pasha.tatashin@oracle.com> wrote:
>
>> The page table order must be increased for EFI table in order to avoid a
>> bug where NMI tries to change the page table to kernel page table, while
>> efi page table is active.
>>
>> For more disccussion about this bug, see this thread:
>> http://lkml.iu.edu/hypermail/linux/kernel/1801.1/00951.html
>>
>> Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
>> Reviewed-by: Steven Sistare <steven.sistare@oracle.com>
>> ---
>> arch/x86/include/asm/pgalloc.h | 11 +++++++++++
>> arch/x86/platform/efi/efi_64.c | 2 +-
>> 2 files changed, 12 insertions(+), 1 deletion(-)
>
> Is there a Git tree/branch I could follow to see the very latest v4.9 PTI backport
> commits?
>
> Thanks,
>
> Ingo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4.9] x86/pti/efi: broken conversion from efi to kernel page table
2018-01-11 21:58 [PATCH 4.9] x86/pti/efi: broken conversion from efi to kernel page table Pavel Tatashin
2018-01-12 13:58 ` Ingo Molnar
@ 2018-01-12 14:27 ` Jiri Kosina
2018-01-13 13:16 ` Greg KH
2018-01-13 13:18 ` Greg KH
2018-01-13 17:12 ` Greg KH
3 siblings, 1 reply; 9+ messages in thread
From: Jiri Kosina @ 2018-01-12 14:27 UTC (permalink / raw)
To: Pavel Tatashin
Cc: steven.sistare, linux-kernel, tglx, mingo, hpa, x86, gregkh,
jkosina, hughd, dave.hansen, luto, torvalds
On Thu, 11 Jan 2018, Pavel Tatashin wrote:
> The page table order must be increased for EFI table in order to avoid a
> bug where NMI tries to change the page table to kernel page table, while
> efi page table is active.
>
> For more disccussion about this bug, see this thread:
> http://lkml.iu.edu/hypermail/linux/kernel/1801.1/00951.html
>
> Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
> Reviewed-by: Steven Sistare <steven.sistare@oracle.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
We are carrying similar patch in our 4.4 codestream as well.
Please note that this is needed only for those trees that have 67a9108ed43
("x86/efi: Build our own page table structures") backported to it. That
used to be in some -stable releases, and some had it reverted, so please
check that.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4.9] x86/pti/efi: broken conversion from efi to kernel page table
2018-01-12 14:27 ` Jiri Kosina
@ 2018-01-13 13:16 ` Greg KH
0 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2018-01-13 13:16 UTC (permalink / raw)
To: Jiri Kosina
Cc: Pavel Tatashin, steven.sistare, linux-kernel, tglx, mingo, hpa,
x86, jkosina, hughd, dave.hansen, luto, torvalds
On Fri, Jan 12, 2018 at 03:27:32PM +0100, Jiri Kosina wrote:
> On Thu, 11 Jan 2018, Pavel Tatashin wrote:
>
> > The page table order must be increased for EFI table in order to avoid a
> > bug where NMI tries to change the page table to kernel page table, while
> > efi page table is active.
> >
> > For more disccussion about this bug, see this thread:
> > http://lkml.iu.edu/hypermail/linux/kernel/1801.1/00951.html
> >
> > Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
> > Reviewed-by: Steven Sistare <steven.sistare@oracle.com>
>
> Acked-by: Jiri Kosina <jkosina@suse.cz>
>
> We are carrying similar patch in our 4.4 codestream as well.
>
> Please note that this is needed only for those trees that have 67a9108ed43
> ("x86/efi: Build our own page table structures") backported to it. That
> used to be in some -stable releases, and some had it reverted, so please
> check that.
The 4.4-stable tree reverted this patch, so I'll take the 4.4-specific
patch for this that was just sent.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4.9] x86/pti/efi: broken conversion from efi to kernel page table
2018-01-11 21:58 [PATCH 4.9] x86/pti/efi: broken conversion from efi to kernel page table Pavel Tatashin
2018-01-12 13:58 ` Ingo Molnar
2018-01-12 14:27 ` Jiri Kosina
@ 2018-01-13 13:18 ` Greg KH
2018-01-13 17:12 ` Greg KH
3 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2018-01-13 13:18 UTC (permalink / raw)
To: Pavel Tatashin
Cc: steven.sistare, linux-kernel, tglx, mingo, hpa, x86, jkosina,
hughd, dave.hansen, luto, torvalds
On Thu, Jan 11, 2018 at 04:58:20PM -0500, Pavel Tatashin wrote:
> The page table order must be increased for EFI table in order to avoid a
> bug where NMI tries to change the page table to kernel page table, while
> efi page table is active.
>
> For more disccussion about this bug, see this thread:
> http://lkml.iu.edu/hypermail/linux/kernel/1801.1/00951.html
>
> Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
> Reviewed-by: Steven Sistare <steven.sistare@oracle.com>
> Acked-by: Jiri Kosina <jkosina@suse.cz>
> ---
> arch/x86/include/asm/pgalloc.h | 11 +++++++++++
> arch/x86/platform/efi/efi_64.c | 2 +-
> 2 files changed, 12 insertions(+), 1 deletion(-)
Now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4.9] x86/pti/efi: broken conversion from efi to kernel page table
2018-01-11 21:58 [PATCH 4.9] x86/pti/efi: broken conversion from efi to kernel page table Pavel Tatashin
` (2 preceding siblings ...)
2018-01-13 13:18 ` Greg KH
@ 2018-01-13 17:12 ` Greg KH
2018-01-13 17:40 ` Pavel Tatashin
3 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2018-01-13 17:12 UTC (permalink / raw)
To: Pavel Tatashin
Cc: steven.sistare, linux-kernel, tglx, mingo, hpa, x86, jkosina,
hughd, dave.hansen, luto, torvalds
On Thu, Jan 11, 2018 at 04:58:20PM -0500, Pavel Tatashin wrote:
> The page table order must be increased for EFI table in order to avoid a
> bug where NMI tries to change the page table to kernel page table, while
> efi page table is active.
>
> For more disccussion about this bug, see this thread:
> http://lkml.iu.edu/hypermail/linux/kernel/1801.1/00951.html
>
> Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
> Reviewed-by: Steven Sistare <steven.sistare@oracle.com>
> Acked-by: Jiri Kosina <jkosina@suse.cz>
> ---
> arch/x86/include/asm/pgalloc.h | 11 +++++++++++
> arch/x86/platform/efi/efi_64.c | 2 +-
> 2 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/include/asm/pgalloc.h b/arch/x86/include/asm/pgalloc.h
> index b6d425999f99..1178a51b77f3 100644
> --- a/arch/x86/include/asm/pgalloc.h
> +++ b/arch/x86/include/asm/pgalloc.h
> @@ -27,6 +27,17 @@ static inline void paravirt_release_pud(unsigned long pfn) {}
> */
> extern gfp_t __userpte_alloc_gfp;
>
> +#ifdef CONFIG_PAGE_TABLE_ISOLATION
> +/*
> + * Instead of one PGD, we acquire two PGDs. Being order-1, it is
> + * both 8k in size and 8k-aligned. That lets us just flip bit 12
> + * in a pointer to swap between the two 4k halves.
> + */
> +#define PGD_ALLOCATION_ORDER 1
> +#else
> +#define PGD_ALLOCATION_ORDER 0
> +#endif
This conflicts with the definition of PGD_ALLOCATION_ORDER in
arch/x86/mm/pgtable.c that says:
/*
* Instead of one pgd, Kaiser acquires two pgds. Being order-1, it is
* both 8k in size and 8k-aligned. That lets us just flip bit 12
* in a pointer to swap between the two 4k halves.
*/
#define PGD_ALLOCATION_ORDER kaiser_enabled
So, which is it?
I'm going to go drop this from the 4.9 stable queue because of this.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4.9] x86/pti/efi: broken conversion from efi to kernel page table
2018-01-13 17:12 ` Greg KH
@ 2018-01-13 17:40 ` Pavel Tatashin
2018-01-13 18:14 ` Greg KH
0 siblings, 1 reply; 9+ messages in thread
From: Pavel Tatashin @ 2018-01-13 17:40 UTC (permalink / raw)
To: Greg KH
Cc: Steve Sistare, Linux Kernel Mailing List, Thomas Gleixner, mingo,
hpa, x86, Jiri Kosina, Hugh Dickins, dave.hansen,
Andy Lutomirski, Linus Torvalds
Hi Greg,
Yeah, the one in pgtable.c needs to be removed, I wonder how it
compiled... I will submit a new patch for 4.9 sometime later.
Thank you,
Pavel
On Sat, Jan 13, 2018 at 12:12 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Thu, Jan 11, 2018 at 04:58:20PM -0500, Pavel Tatashin wrote:
>> The page table order must be increased for EFI table in order to avoid a
>> bug where NMI tries to change the page table to kernel page table, while
>> efi page table is active.
>>
>> For more disccussion about this bug, see this thread:
>> http://lkml.iu.edu/hypermail/linux/kernel/1801.1/00951.html
>>
>> Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
>> Reviewed-by: Steven Sistare <steven.sistare@oracle.com>
>> Acked-by: Jiri Kosina <jkosina@suse.cz>
>> ---
>> arch/x86/include/asm/pgalloc.h | 11 +++++++++++
>> arch/x86/platform/efi/efi_64.c | 2 +-
>> 2 files changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/include/asm/pgalloc.h b/arch/x86/include/asm/pgalloc.h
>> index b6d425999f99..1178a51b77f3 100644
>> --- a/arch/x86/include/asm/pgalloc.h
>> +++ b/arch/x86/include/asm/pgalloc.h
>> @@ -27,6 +27,17 @@ static inline void paravirt_release_pud(unsigned long pfn) {}
>> */
>> extern gfp_t __userpte_alloc_gfp;
>>
>> +#ifdef CONFIG_PAGE_TABLE_ISOLATION
>> +/*
>> + * Instead of one PGD, we acquire two PGDs. Being order-1, it is
>> + * both 8k in size and 8k-aligned. That lets us just flip bit 12
>> + * in a pointer to swap between the two 4k halves.
>> + */
>> +#define PGD_ALLOCATION_ORDER 1
>> +#else
>> +#define PGD_ALLOCATION_ORDER 0
>> +#endif
>
> This conflicts with the definition of PGD_ALLOCATION_ORDER in
> arch/x86/mm/pgtable.c that says:
>
> /*
> * Instead of one pgd, Kaiser acquires two pgds. Being order-1, it is
> * both 8k in size and 8k-aligned. That lets us just flip bit 12
> * in a pointer to swap between the two 4k halves.
> */
> #define PGD_ALLOCATION_ORDER kaiser_enabled
>
> So, which is it?
>
> I'm going to go drop this from the 4.9 stable queue because of this.
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4.9] x86/pti/efi: broken conversion from efi to kernel page table
2018-01-13 17:40 ` Pavel Tatashin
@ 2018-01-13 18:14 ` Greg KH
0 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2018-01-13 18:14 UTC (permalink / raw)
To: Pavel Tatashin
Cc: Steve Sistare, Linux Kernel Mailing List, Thomas Gleixner, mingo,
hpa, x86, Jiri Kosina, Hugh Dickins, dave.hansen,
Andy Lutomirski, Linus Torvalds
On Sat, Jan 13, 2018 at 12:40:10PM -0500, Pavel Tatashin wrote:
> Hi Greg,
>
> Yeah, the one in pgtable.c needs to be removed, I wonder how it
> compiled... I will submit a new patch for 4.9 sometime later.
It builds, just gives a warning, easy to miss if you aren't looking for
it :)
^ permalink raw reply [flat|nested] 9+ messages in thread