Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1233155
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 10/26] x86, pkeys: notify userspace about protection key faults |
| Date | 2015-09-26 08:30 +0200 |
| Message-ID | <qcR9D-d5-5@gated-at.bofh.it> (permalink) |
| References | (2 earlier) <qcb0K-7l5-27@gated-at.bofh.it> <qcbaq-7wh-11@gated-at.bofh.it> <qciOC-1BH-15@gated-at.bofh.it> <qcvst-2R9-7@gated-at.bofh.it> <qcKrv-7uN-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
* Dave Hansen <dave@sr71.net> wrote:
> On 09/25/2015 12:11 AM, Ingo Molnar wrote:
> >>> > > Btw., how does pkey support interact with hugepages?
> >> >
> >> > Surprisingly little. I've made sure that everything works with huge pages and
> >> > that the (huge) PTEs and VMAs get set up correctly, but I'm not sure I had to
> >> > touch the huge page code at all. I have test code to ensure that it works the
> >> > same as with small pages, but everything worked pretty naturally.
> > Yeah, so the reason I'm asking about expectations is that this code:
> >
> > + follow_ret = follow_pte(tsk->mm, address, &ptep, &ptl);
> > + if (!follow_ret) {
> > + /*
> > + * On a successful follow, make sure to
> > + * drop the lock.
> > + */
> > + pte = *ptep;
> > + pte_unmap_unlock(ptep, ptl);
> > + ret = pte_pkey(pte);
> >
> > is visibly hugepage-unsafe: if a vma is hugepage mapped, there are no ptes, only
> > pmds - and the protection key index lives in the pmd. We don't seem to recover
> > that information properly.
>
> You got me on this one. I assumed that follow_pte() handled huge pages.
> It does not.
>
> But, the code still worked. Since follow_pte() fails for all huge
> pages, it just falls back to pulling the protection key out of the VMA,
> which _does_ work for huge pages.
That might be true for explicit hugetlb vmas, but what about transparent hugepages
that can show up in regular vmas?
> I've actually removed the PTE walking and I just now use the VMA directly. I
> don't see a ton of additional value from walking the page tables when we can get
> what we need from the VMA.
That's actually good, because it's also cheap, especially if we can get rid of the
extra find_vma().
and we (thankfully) have no non-linear vmas to worry about anymore.
Thanks,
Ingo
--
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 10/26] x86, pkeys: notify userspace about protection key faults Ingo Molnar <mingo@kernel.org> - 2015-09-24 11:30 +0200
Re: [PATCH 10/26] x86, pkeys: notify userspace about protection key faults Ingo Molnar <mingo@kernel.org> - 2015-09-24 11:40 +0200
Re: [PATCH 10/26] x86, pkeys: notify userspace about protection key faults Dave Hansen <dave@sr71.net> - 2015-09-24 19:50 +0200
Re: [PATCH 10/26] x86, pkeys: notify userspace about protection key faults Ingo Molnar <mingo@kernel.org> - 2015-09-25 09:20 +0200
Re: [PATCH 10/26] x86, pkeys: notify userspace about protection key faults Dave Hansen <dave@sr71.net> - 2015-09-26 01:20 +0200
Re: [PATCH 10/26] x86, pkeys: notify userspace about protection key faults Ingo Molnar <mingo@kernel.org> - 2015-09-26 08:30 +0200
Re: [PATCH 10/26] x86, pkeys: notify userspace about protection key faults Dave Hansen <dave@sr71.net> - 2015-09-28 00:50 +0200
Re: [PATCH 10/26] x86, pkeys: notify userspace about protection key faults Ingo Molnar <mingo@kernel.org> - 2015-09-28 08:00 +0200
Re: [PATCH 10/26] x86, pkeys: notify userspace about protection key faults Dave Hansen <dave@sr71.net> - 2015-09-24 19:20 +0200
Re: [PATCH 10/26] x86, pkeys: notify userspace about protection key faults Christian Borntraeger <borntraeger@de.ibm.com> - 2015-09-28 21:30 +0200
Re: [PATCH 10/26] x86, pkeys: notify userspace about protection key faults Dave Hansen <dave@sr71.net> - 2015-09-28 21:40 +0200
csiph-web