Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1270971
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 1/5] x86/mm/pageattr: Ensure cpa->pfn only contains page frame numbers |
| Date | 2015-11-17 10:00 +0100 |
| Message-ID | <qvKhk-2Hb-9@gated-at.bofh.it> (permalink) |
| References | <quRbc-1jj-11@gated-at.bofh.it> <quRbc-1jj-31@gated-at.bofh.it> <qvyzw-3C8-13@gated-at.bofh.it> <qvzvC-4cE-59@gated-at.bofh.it> <qvzOV-4k5-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, 16 Nov 2015, Thomas Gleixner wrote:
> On Mon, 16 Nov 2015, Borislav Petkov wrote:
> > On Mon, Nov 16, 2015 at 09:19:01PM +0100, Thomas Gleixner wrote:
> > > On Sat, 14 Nov 2015, Matt Fleming wrote:
> > > > The x86 pageattr code is confused about the data that is stored
> > > > cpa->pfn, sometimes it's treated as a page frame number, sometimes
> > > > it's treated as an unshifted physical address, and in one place it's
> > > > treated as a pte.
> > >
> > > Yuck.
> >
> > This paragraph should read like this instead:
> >
> > "Boris used cpa->pfn as a scratch variable to contain the physical
> > address. He realizes now that he should've added a separate
> > cpa_data.phys_addr then, instead of confusing everybody."
> >
> > > > The result of this is that the mapping functions do not map the
> > > > intended physical address.
> > > >
> > > > This isn't a problem in practice because most of the addresses we're
> > > > mapping in the EFI code paths are already mapped in 'trampoline_pgd'
> > > > and so the pageattr mappings functions don't actually do anything in
> > > > this case. But when we move to using a separate page table for the EFI
> > > > runtime this will be an issue.
> > >
> > > Are you sure that this does not affect existing kernel versions?
> >
> > Shouldn't because with this new patchset we're copying all the PGDs from
> > the kernel page table before doing an EFI call, see
> > efi_sync_low_kernel_mappings() in patch 5.
> >
> > > > while (num_pages-- && start < end) {
> > > > -
> > > > - /* deal with the NX bit */
> > > > - if (!(pgprot_val(pgprot) & _PAGE_NX))
> > > > - cpa->pfn &= ~_PAGE_NX;
> > >
> > > That should be a seperate patch because this is just bogus code and
> > > has nothing to do with the pfn confusion.
> >
> > Why bogus?
>
> Even with cpa->pfn used as an address it cannot ever be set as the
> address is page aligned ....
Gah. Misread it. _PAGE_NX is bit 63 and it can be set when cpa->pfn is
abused as an address. So yes, it should go away with that patch.
Thanks,
tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH v2 1/5] x86/mm/pageattr: Ensure cpa->pfn only contains page frame numbers Thomas Gleixner <tglx@linutronix.de> - 2015-11-16 21:30 +0100
Re: [PATCH v2 1/5] x86/mm/pageattr: Ensure cpa->pfn only contains page frame numbers Borislav Petkov <bp@suse.de> - 2015-11-16 22:30 +0100
Re: [PATCH v2 1/5] x86/mm/pageattr: Ensure cpa->pfn only contains page frame numbers Thomas Gleixner <tglx@linutronix.de> - 2015-11-16 22:50 +0100
Re: [PATCH v2 1/5] x86/mm/pageattr: Ensure cpa->pfn only contains page frame numbers Thomas Gleixner <tglx@linutronix.de> - 2015-11-17 10:00 +0100
Re: [PATCH v2 1/5] x86/mm/pageattr: Ensure cpa->pfn only contains page frame numbers Matt Fleming <matt@codeblueprint.co.uk> - 2015-11-17 10:50 +0100
Re: [PATCH v2 1/5] x86/mm/pageattr: Ensure cpa->pfn only contains page frame numbers Ingo Molnar <mingo@kernel.org> - 2015-11-18 09:20 +0100
Re: [PATCH v2 1/5] x86/mm/pageattr: Ensure cpa->pfn only contains page frame numbers Matt Fleming <matt@codeblueprint.co.uk> - 2015-11-20 13:10 +0100
csiph-web