From: Ingo Molnar <mingo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
Cc: Scott Ashcroft
<scott.ashcroft-qw6QB7/foO7QT0dZR+AlfA@public.gmane.org>,
"H . Peter Anvin" <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>,
Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
Ard Biesheuvel
<ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Maarten Lankhorst
<maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
Matthew Garrett <mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>,
Borislav Petkov <bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org>,
Ben Hutchings <ben-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>,
Raphael Hertzog <hertzog-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>,
Roger Shimizu
<rogershimizu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Alexis Murzeau <amurzeau-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH] x86/efi: Always map boot service regions into new EFI page tables
Date: Mon, 14 Mar 2016 13:05:02 +0100 [thread overview]
Message-ID: <20160314120502.GA17388@gmail.com> (raw)
In-Reply-To: <20160314113502.GC2619-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
* Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org> wrote:
> On Mon, 14 Mar, at 11:30:19AM, Ingo Molnar wrote:
> >
> > * Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org> wrote:
> >
> > > diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
> > > index 8fee5b6f8f66..af74849e8c0f 100644
> > > --- a/arch/x86/mm/pageattr.c
> > > +++ b/arch/x86/mm/pageattr.c
> > > @@ -1055,7 +1055,7 @@ static int populate_pud(struct cpa_data *cpa, unsigned long start, pgd_t *pgd,
> > > /*
> > > * Map everything starting from the Gb boundary, possibly with 1G pages
> > > */
> > > - while (end - start >= PUD_SIZE) {
> > > + while (cpu_has_gbpages && end - start >= PUD_SIZE) {
> > > set_pud(pud, __pud(cpa->pfn << PAGE_SHIFT | _PAGE_PSE |
> > > massage_pgprot(pud_pgprot)));
> >
> > Btw., can 'cpa->pfn << PAGE_SHIFT' possibly work on 32-bit systems?
> >
> > cpa->pfn is unsigned long, so the result gets truncated to 32 bits ...
> >
> > cpa->pfn should be u64.
>
> That is a nice catch.
>
> Note that we never run this code on 32-bit right now. Moving 32-bit to
> this code and away from the old_map scheme is on my TODO list.
There's a number of such occurences that look suspicious:
triton:~/tip> git grep 'cpa->pfn.*<<.*PAGE_SHIFT' arch/x86/
arch/x86/mm/pageattr.c: set_pmd(pmd, __pmd(cpa->pfn << PAGE_SHIFT | _PAGE_PSE |
arch/x86/mm/pageattr.c: set_pud(pud, __pud(cpa->pfn << PAGE_SHIFT | _PAGE_PSE |
arch/x86/mm/pageattr.c: unsigned long laddr = (unsigned long)__va(cpa->pfn << PAGE_SHIFT);
arch/x86/mm/pageattr.c: unsigned long temp_cpa_vaddr = (cpa->pfn << PAGE_SHIFT) +
are you sure none of the code runs on 32-bit?
All this got introduced with:
| commit edc3b9129cecd0f0857112136f5b8b1bc1d45918
| Author: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
| Date: Fri Nov 27 21:09:31 2015 +0000
|
| x86/mm/pat: Ensure cpa->pfn only contains page frame numbers
AFAICS.
Even if none of this is run on 32-bit, we should really fix it to be u64, because
the code is really bogus and the fix is easy ...
Thanks,
Ingo
next prev parent reply other threads:[~2016-03-14 12:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-11 11:19 [GIT PULL] EFI urgent fix for v4.6 queue Matt Fleming
[not found] ` <1457695163-29632-1-git-send-email-matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-03-11 11:19 ` [PATCH] x86/efi: Always map boot service regions into new EFI page tables Matt Fleming
2016-03-13 17:09 ` Scott Ashcroft
[not found] ` <1457888975.3884.9.camel-qw6QB7/foO7QT0dZR+AlfA@public.gmane.org>
2016-03-13 21:58 ` Matt Fleming
[not found] ` <20160313215847.GA2619-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-03-13 23:07 ` Matt Fleming
2016-03-13 23:44 ` Scott Ashcroft
[not found] ` <20160313230736.GB2619-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-03-14 1:09 ` Scott Ashcroft
2016-03-14 10:30 ` Ingo Molnar
[not found] ` <20160314103019.GA32573-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-14 11:35 ` Matt Fleming
[not found] ` <20160314113502.GC2619-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-03-14 12:05 ` Ingo Molnar [this message]
[not found] ` <20160314120502.GA17388-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-14 14:27 ` Matt Fleming
[not found] ` <20160314142734.GE2619-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-03-14 16:47 ` Ingo Molnar
2016-03-15 15:54 ` Matt Fleming
[not found] ` <20160315155418.GH2619-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-03-15 16:05 ` Borislav Petkov
2016-03-15 16:25 ` Julia Lawall
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=20160314120502.GA17388@gmail.com \
--to=mingo-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=amurzeau-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=ben-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org \
--cc=bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org \
--cc=hertzog-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org \
--cc=hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org \
--cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org \
--cc=mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org \
--cc=rogershimizu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=scott.ashcroft-qw6QB7/foO7QT0dZR+AlfA@public.gmane.org \
--cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.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;
as well as URLs for NNTP newsgroup(s).