On 09/24/2015 02:30 AM, Ingo Molnar wrote: >> To answer your question in the comment: it looks useful to have some sort of >> 'extended page fault error code' information here, which shows why the page >> fault >> happened. With the regular error_code it's easy - with protection keys >> there's 16 >> separate keys possible and user-space might not know the actual key value in >> the >> pte. > > Btw., alternatively we could also say that user-space should know what > protection > key it used when it created the mapping - there's no need to recover it for > every > page fault.
That's true. We don't, for instance, tell userspace whether it was a write that caused a fault. But, other than smaps we don't have *any* way to tell userspace what protection key a page has. I think some mechanism is going to be required for this to be reasonably debuggable. > OTOH, as long as we don't do a separate find_vma(), it looks cheap enough to > look > up the pkey value of that address and give it to user-space in the signal > frame. I still think that find_vma() in this case is pretty darn cheap, definitely if you compare it to the cost of the entire fault path. > 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. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/