From: Mariusz Ceier <mceier+kernel@gmail.com>
To: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-mm@kvack.org, Aaro Koskinen <aaro.koskinen@nokia.com>,
aarcange@redhat.com, luto@kernel.org, arjan@linux.intel.com,
Borislav Petkov <bp@alien8.de>,
dan.j.williams@intel.com, dwmw2@infradead.org,
gregkh@linuxfoundation.org, hughd@google.com,
jpoimboe@redhat.com, jgross@suse.com, keescook@google.com,
Linus Torvalds <torvalds@linux-foundation.org>,
namit@vmware.com, peterz@infradead.org,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 2/2] x86, pti: fix boot warning from Global-bit setting
Date: Tue, 17 Apr 2018 23:56:36 +0200 [thread overview]
Message-ID: <CAJTyqKMLh4QoNYUF1BZ5D51L8ZEt_fxqNRWYBON+27icavY8tQ@mail.gmail.com> (raw)
In-Reply-To: <20180417211304.7B3F1FDB@viggo.jf.intel.com>
On 17 April 2018 at 23:13, Dave Hansen <dave.hansen@linux.intel.com> wrote:
>
> These are _very_ lightly tested. I'm throwing them out there for
> folks are looking for a fix.
>
> ---
>
> From: Dave Hansen <dave.hansen@linux.intel.com>
>
> pageattr.c is not friendly when it encounters empty (zero) PTEs. The
> kernel linear map is exempt from these checks, but kernel text is not.
> This patch adds the code to also exempt kernel text from these checks.
> The proximate cause of these warnings was most likely an __init area
> that spanned a 2MB page boundary that resulted in a "zero" PMD.
>
> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
> Fixes: 39114b7a7 (x86/pti: Never implicitly clear _PAGE_GLOBAL for kernel image)
> Reported-by: Mariusz Ceier <mceier@gmail.com>
> Reported-by: Aaro Koskinen <aaro.koskinen@nokia.com>
> Cc: Andrea Arcangeli <aarcange@redhat.com>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: Arjan van de Ven <arjan@linux.intel.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Hugh Dickins <hughd@google.com>
> Cc: Josh Poimboeuf <jpoimboe@redhat.com>
> Cc: Juergen Gross <jgross@suse.com>
> Cc: Kees Cook <keescook@google.com>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Nadav Amit <namit@vmware.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: linux-mm@kvack.org
> ---
>
> b/arch/x86/mm/pageattr.c | 17 +++++++++++++++--
> 1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff -puN arch/x86/mm/pageattr.c~pti-glb-warning-inpageattr arch/x86/mm/pageattr.c
> --- a/arch/x86/mm/pageattr.c~pti-glb-warning-inpageattr 2018-04-17 14:10:22.695395554 -0700
> +++ b/arch/x86/mm/pageattr.c 2018-04-17 14:10:22.721395554 -0700
> @@ -1151,6 +1151,16 @@ static int populate_pgd(struct cpa_data
> return 0;
> }
>
> +bool __cpa_pfn_in_highmap(unsigned long pfn)
> +{
> + /*
> + * Kernel text has an alias mapping at a high address, known
> + * here as "highmap".
> + */
> + return within_inclusive(pfn, highmap_start_pfn(),
> + highmap_end_pfn());
> +}
> +
> static int __cpa_process_fault(struct cpa_data *cpa, unsigned long vaddr,
> int primary)
> {
> @@ -1183,6 +1193,10 @@ static int __cpa_process_fault(struct cp
> cpa->numpages = 1;
> cpa->pfn = __pa(vaddr) >> PAGE_SHIFT;
> return 0;
> +
> + } else if (__cpa_pfn_in_highmap(cpa->pfn)) {
> + /* Faults in the highmap are OK, so do not warn: */
> + return -EFAULT;
> } else {
> WARN(1, KERN_WARNING "CPA: called for zero pte. "
> "vaddr = %lx cpa->vaddr = %lx\n", vaddr,
> @@ -1335,8 +1349,7 @@ static int cpa_process_alias(struct cpa_
> * to touch the high mapped kernel as well:
> */
> if (!within(vaddr, (unsigned long)_text, _brk_end) &&
> - within_inclusive(cpa->pfn, highmap_start_pfn(),
> - highmap_end_pfn())) {
> + __cpa_pfn_in_highmap(cpa->pfn)) {
> unsigned long temp_cpa_vaddr = (cpa->pfn << PAGE_SHIFT) +
> __START_KERNEL_map - phys_base;
> alias_cpa = *cpa;
> _
I confirm that these 2 patches fix the BUG for me in kernel 4.17.0-rc1.
Thanks
next prev parent reply other threads:[~2018-04-17 21:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-17 21:13 [PATCH 1/2] x86, pti: fix boot problems " Dave Hansen
2018-04-17 21:13 ` [PATCH 2/2] x86, pti: fix boot warning " Dave Hansen
2018-04-17 21:56 ` Mariusz Ceier [this message]
2018-04-18 11:05 ` kbuild test robot
2018-04-18 12:26 ` kbuild test robot
2018-04-20 10:16 ` Thomas Gleixner
2018-04-20 19:44 ` Dave Hansen
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=CAJTyqKMLh4QoNYUF1BZ5D51L8ZEt_fxqNRWYBON+27icavY8tQ@mail.gmail.com \
--to=mceier+kernel@gmail.com \
--cc=aarcange@redhat.com \
--cc=aaro.koskinen@nokia.com \
--cc=arjan@linux.intel.com \
--cc=bp@alien8.de \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=dwmw2@infradead.org \
--cc=gregkh@linuxfoundation.org \
--cc=hughd@google.com \
--cc=jgross@suse.com \
--cc=jpoimboe@redhat.com \
--cc=keescook@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=namit@vmware.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/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