* [PATCH] x86: Remove nx_enabled from fault.c
@ 2008-01-25 4:41 Harvey Harrison
2008-01-25 10:14 ` Ingo Molnar
0 siblings, 1 reply; 2+ messages in thread
From: Harvey Harrison @ 2008-01-25 4:41 UTC (permalink / raw)
To: Ingo Molnar; +Cc: H. Peter Anvin, LKML, Thomas Gleixner, Andi Kleen
On !PAE 32-bit, _PAGE_NX will be 0, making is_prefetch always
return early. The test is sufficient on PAE as __supported_pte_mask
is updated in the same places as nx_enabled in init_32.c which also
takes disable_nx into account.
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
arch/x86/mm/fault.c | 13 ++++---------
1 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index bdf0282..32755eb 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -92,18 +92,13 @@ static int is_prefetch(struct pt_regs *regs, unsigned long addr,
unsigned char *max_instr;
#ifdef CONFIG_X86_32
-# ifdef CONFIG_X86_PAE
- /* If it was a exec fault on NX page, ignore */
- if (nx_enabled && (error_code & PF_INSTR))
+ if (!(__supported_pte_mask & _PAGE_NX))
return 0;
-# else
- return 0;
-# endif
-#else /* CONFIG_X86_64 */
+#endif
+
/* If it was a exec fault on NX page, ignore */
if (error_code & PF_INSTR)
return 0;
-#endif
instr = (unsigned char *)convert_ip_to_linear(current, regs);
max_instr = instr + 15;
@@ -468,7 +463,7 @@ static int vmalloc_fault(unsigned long address)
pmd_t *pmd, *pmd_ref;
pte_t *pte, *pte_ref;
- if (address >= VMALLOC_START && address < VMALLOC_END)
+ if (!(address >= VMALLOC_START && address < VMALLOC_END))
return -1;
/* Copy kernel mappings over when needed. This can also
--
1.5.4.rc4.1142.gf5a97
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] x86: Remove nx_enabled from fault.c
2008-01-25 4:41 [PATCH] x86: Remove nx_enabled from fault.c Harvey Harrison
@ 2008-01-25 10:14 ` Ingo Molnar
0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-01-25 10:14 UTC (permalink / raw)
To: Harvey Harrison; +Cc: H. Peter Anvin, LKML, Thomas Gleixner, Andi Kleen
* Harvey Harrison <harvey.harrison@gmail.com> wrote:
> On !PAE 32-bit, _PAGE_NX will be 0, making is_prefetch always return
> early. The test is sufficient on PAE as __supported_pte_mask is
> updated in the same places as nx_enabled in init_32.c which also takes
> disable_nx into account.
> @@ -92,18 +92,13 @@ static int is_prefetch(struct pt_regs *regs, unsigned long addr,
> unsigned char *max_instr;
>
> #ifdef CONFIG_X86_32
> -# ifdef CONFIG_X86_PAE
> - /* If it was a exec fault on NX page, ignore */
> - if (nx_enabled && (error_code & PF_INSTR))
> + if (!(__supported_pte_mask & _PAGE_NX))
> return 0;
> -# else
> - return 0;
> -# endif
> -#else /* CONFIG_X86_64 */
> +#endif
> +
thanks, applied this portion of the patch.
> @@ -468,7 +463,7 @@ static int vmalloc_fault(unsigned long address)
> pmd_t *pmd, *pmd_ref;
> pte_t *pte, *pte_ref;
>
> - if (address >= VMALLOC_START && address < VMALLOC_END)
> + if (!(address >= VMALLOC_START && address < VMALLOC_END))
> return -1;
hm, what's this?
Ingo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-01-25 10:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-25 4:41 [PATCH] x86: Remove nx_enabled from fault.c Harvey Harrison
2008-01-25 10:14 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox