On Sat, Feb 28, 2015 at 1:14 PM, Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> wrote: > > BTW. I fail to see how x86 checks PF_INSTR vs. VM_NOEXEC ... or it doesn't ? It doesn't. x86 traditionally doesn't have an execute bit, so traditionally "read == exec". So PF_INSTR really wasn't historically very useful, in that it would only show if the *first* access to a page was an instruction fetch - if you did a regular read to brign the page in, then subsequent instruction fetches would just work. Then NX came along, and what happens now is - we handle write faults separately (see the first part of access_error() - so now we know it was a read or an instruction fetch - if PF_PROT is set, that means that the present bit was set in the page tables, so it must have been an exec access to a NX page - otherwise, we just say "PROTNONE means no access, otherwise populate the page tables" .. and if it turns out that it was a PF_INSTR to a NX page, we'll end up taking the page fault *again* after it's been populated, and now since the page table was populated, the access_error() will catch it with the PF_PROT case. Or something like that. I might have screwed up some detail, but it should all work. Linus -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>