From 079ba18aacdfcf95964c63db89d67099f695177f Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 8 Aug 2006 04:01:29 +0000 Subject: [PATCH] Pass VM_PROT_EXECUTE to vm_fault() instead of VM_PROT_READ if the page fault was caused by an instruction fetch. --- sys/amd64/amd64/trap.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index ebad9a0f69eb..1b6488f22e83 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -566,8 +566,14 @@ trap_pfault(frame, usermode) map = &vm->vm_map; } + /* + * PGEX_I is defined only if the execute disable bit capability is + * supported and enabled; otherwise, that bit is reserved, i.e., zero. + */ if (frame->tf_err & PGEX_W) ftype = VM_PROT_WRITE; + else if (frame->tf_err & PGEX_I) + ftype = VM_PROT_EXECUTE; else ftype = VM_PROT_READ;