Skip to contentSkip to conversation

x86: More users of PF_ constants in fault_32|64.c

PATCH Applied Harvey Harrison 2 participants 2 messages Jan 9, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: More users of PF_ constants in fault_32|64.c

Should be the last of the error_code tests that could use the PF_ defines. Makes X86_32|64 a little closer.

---
 arch/x86/mm/fault_32.c |    7 ++++---
 arch/x86/mm/fault_64.c |    2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)
arch/x86/mm/fault_32.c +4 -3
index 50a9930..adf5fed 100644
@@ -404,7 +404,8 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
 	 * protection error (error_code & 9) == 0.
 	 */
 	if (unlikely(address >= TASK_SIZE)) {
-		if (!(error_code & 0x0000000d) && vmalloc_fault(address) >= 0)
+		if (!(error_code & (PF_RSVD|PF_USER|PF_PROT)) &&
+		    vmalloc_fault(address) >= 0)
 			return;
 		if (notify_page_fault(regs))
 			return;
@@ -607,7 +608,7 @@ no_context:
 		__typeof__(pte_val(__pte(0))) page;
 
 #ifdef CONFIG_X86_PAE
-		if (error_code & 16) {
+		if (error_code & PF_INSTR) {
 			pte_t *pte = lookup_address(address);
 
 			if (pte && pte_present(*pte) && !pte_exec_kernel(*pte))
@@ -678,7 +679,7 @@ out_of_memory:
 		goto survive;
 	}
 	printk("VM: killing process %s\n", tsk->comm);
-	if (error_code & 4)
+	if (error_code & PF_USER)
 		do_group_exit(SIGKILL);
 	goto no_context;
 
arch/x86/mm/fault_64.c +1 -1
index 018ab78..267a1d5 100644
@@ -681,7 +681,7 @@ out_of_memory:
 		goto again;
 	}
 	printk("VM: killing process %s\n", tsk->comm);
-	if (error_code & 4)
+	if (error_code & PF_USER)
 		do_group_exit(SIGKILL);
 	goto no_context;
 
Signature · 1 line
1.5.4.rc2.1164.g6451
Applied
#1 lore raw
Quoted 2 lines · Harvey Harrison

Should be the last of the error_code tests that could use the PF_ defines. Makes X86_32|64 a little closer.

thanks, applied.

Ingo