[haiku-commits] haiku: hrev53522 - src/system/kernel/arch/x86

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 30 Sep 2019 22:50:18 -0400 (EDT)

hrev53522 adds 1 changeset to branch 'master'
old head: d19c9471b16dfe6f7bf2d03525b0bc95080f6c03
new head: 9268c3d7e5b6af830631b237ef55fa4baadf3b01
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=9268c3d7e5b6+%5Ed19c9471b16d

----------------------------------------------------------------------------

9268c3d7e5b6: x86: Reorder ifs in page fault handler
  
  * If interrupts were disabled, SMAP and SMEP violation message was
    shadowed by confusing "page fault but interrupts disabled" panic.
  
  Change-Id: I7470329984e55330f35fdca9b7c253fc4684e0c8
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/1891
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>
  Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>

                                  [ Kacper Kasper <kacperkasper@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53522
Commit:      9268c3d7e5b6af830631b237ef55fa4baadf3b01
URL:         https://git.haiku-os.org/haiku/commit/?id=9268c3d7e5b6
Author:      Kacper Kasper <kacperkasper@xxxxxxxxx>
Date:        Fri Sep 27 20:24:49 2019 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Tue Oct  1 02:50:14 2019 UTC

----------------------------------------------------------------------------

1 file changed, 15 insertions(+), 15 deletions(-)
src/system/kernel/arch/x86/arch_int.cpp | 30 ++++++++++++++---------------

----------------------------------------------------------------------------

diff --git a/src/system/kernel/arch/x86/arch_int.cpp 
b/src/system/kernel/arch/x86/arch_int.cpp
index 5588d5d181..416e9d21c4 100644
--- a/src/system/kernel/arch/x86/arch_int.cpp
+++ b/src/system/kernel/arch/x86/arch_int.cpp
@@ -296,6 +296,21 @@ x86_page_fault_exception(struct iframe* frame)
                panic("page fault in debugger without fault handler! Touching "
                        "address %p from ip %p\n", (void*)cr2, 
(void*)frame->ip);
                return;
+       } else if (!IFRAME_IS_USER(frame)
+               && (frame->error_code & PGFAULT_I) != 0
+               && (x86_read_cr4() & IA32_CR4_SMEP) != 0) {
+               // check that: 1. come not from userland,
+               // 2. is an instruction fetch, 3. smep is enabled
+               panic("SMEP violation user-mapped address %p touched from 
kernel %p\n",
+                       (void*)cr2, (void*)frame->ip);
+       } else if ((frame->flags & X86_EFLAGS_ALIGNMENT_CHECK) == 0
+               && !IFRAME_IS_USER(frame)
+               && (frame->error_code & PGFAULT_P) != 0
+               && (x86_read_cr4() & IA32_CR4_SMAP) != 0) {
+               // check that: 1. AC flag is not set, 2. come not from userland,
+               // 3. is a page-protection violation, 4. smap is enabled
+               panic("SMAP violation user-mapped address %p touched from 
kernel %p\n",
+                       (void*)cr2, (void*)frame->ip);
        } else if ((frame->flags & X86_EFLAGS_INTERRUPT) == 0) {
                // interrupts disabled
 
@@ -327,21 +342,6 @@ x86_page_fault_exception(struct iframe* frame)
                panic("page fault not allowed at this place. Touching address "
                        "%p from ip %p\n", (void*)cr2, (void*)frame->ip);
                return;
-       } else if (!IFRAME_IS_USER(frame)
-               && (frame->error_code & PGFAULT_I) != 0
-               && (x86_read_cr4() & IA32_CR4_SMEP) != 0) {
-               // check that: 1. come not from userland,
-               // 2. is an instruction fetch, 3. smep is enabled
-               panic("SMEP violation user-mapped address %p touched from 
kernel %p\n",
-                       (void*)cr2, (void*)frame->ip);
-       } else if ((frame->flags & X86_EFLAGS_ALIGNMENT_CHECK) == 0
-               && !IFRAME_IS_USER(frame)
-               && (frame->error_code & PGFAULT_P) != 0
-               && (x86_read_cr4() & IA32_CR4_SMAP) != 0) {
-               // check that: 1. AC flag is not set, 2. come not from userland,
-               // 3. is a page-protection violation, 4. smap is enabled
-               panic("SMAP violation user-mapped address %p touched from 
kernel %p\n",
-                       (void*)cr2, (void*)frame->ip);
        }
 
        enable_interrupts();


Other related posts:

  • » [haiku-commits] haiku: hrev53522 - src/system/kernel/arch/x86 - waddlesplash