From: Andrea Arcangeli <aarcange@redhat.com>
To: Xishi Qiu <qiuxishi@huawei.com>
Cc: Jiri Kosina <jikos@kernel.org>,
dave.hansen@linux.intel.com, LKML <linux-kernel@vger.kernel.org>,
Linux MM <linux-mm@kvack.org>,
Yisheng Xie <xieyisheng1@huawei.com>,
"Wangkefeng (Maro)" <wangkefeng.wang@huawei.com>,
Hanjun Guo <guohanjun@huawei.com>,
Zhao Hongjiang <zhaohongjiang@huawei.com>
Subject: Re: [RFC] boot failed when enable KAISER/KPTI
Date: Sat, 6 Jan 2018 18:37:29 +0100 [thread overview]
Message-ID: <20180106173729.GD25546@redhat.com> (raw)
In-Reply-To: <5A50708A.9010902@huawei.com>
Hello Xishi,
On Sat, Jan 06, 2018 at 02:45:30PM +0800, Xishi Qiu wrote:
> How about this fix patch? I tested and it works.
>
> diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
> index 088681d..f6c32f5 100644
> --- a/arch/x86/kernel/tboot.c
> +++ b/arch/x86/kernel/tboot.c
> @@ -131,6 +131,8 @@ static int map_tboot_page(unsigned long vaddr, unsigned long pfn,
> pud = pud_alloc(&tboot_mm, pgd, vaddr);
> if (!pud)
> return -1;
> + if (__supported_pte_mask & _PAGE_NX)
> + pgd->pgd &= ~_PAGE_NX;
> pmd = pmd_alloc(&tboot_mm, pud, vaddr);
> if (!pmd)
> return -1;
Oh great that you already verified this.
The only difference from the above to what I applied is that I didn't
check "__supported_pte_mask & _PAGE_NX", but that's superflous
here. It won't hurt to add it, your patch is fine as well.
The location where to do the NX clearing is the correct one and same
optimal place as in efi_64.c too (right after pud_alloc success).
Only the setting of NX requires verification that it's in the
__supported_pte_mask first, the clearing is always fine (worst case it
will do nothing).
On a side note, I already verified if NX is disabled (-cpu nx=off) the
pgd isn't NX poisoned in the first place, but clearing NX won't hurt
even in such case.
Thanks,
Andrea
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2018-01-06 17:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-05 5:14 Xishi Qiu
2018-01-05 18:33 ` Jiri Kosina
2018-01-06 6:45 ` Xishi Qiu
2018-01-06 17:37 ` Andrea Arcangeli [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180106173729.GD25546@redhat.com \
--to=aarcange@redhat.com \
--cc=dave.hansen@linux.intel.com \
--cc=guohanjun@huawei.com \
--cc=jikos@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=qiuxishi@huawei.com \
--cc=wangkefeng.wang@huawei.com \
--cc=xieyisheng1@huawei.com \
--cc=zhaohongjiang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox