Skip to content

Commit

Permalink
x86/mm: Add clarifying comments for user addr space
Browse files Browse the repository at this point in the history
The SMAP and Reserved checking do not have nice comments.  Add
some to clarify and make it match everything else.

Cc: [email protected]
Cc: Jann Horn <[email protected]>
Cc: Sean Christopherson <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Signed-off-by: Dave Hansen <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
  • Loading branch information
hansendc authored and Peter Zijlstra committed Oct 9, 2018
1 parent aa37c51 commit 5b0c2ca
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arch/x86/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -1276,9 +1276,17 @@ void do_user_addr_fault(struct pt_regs *regs,
if (unlikely(kprobes_fault(regs)))
return;

/*
* Reserved bits are never expected to be set on
* entries in the user portion of the page tables.
*/
if (unlikely(hw_error_code & X86_PF_RSVD))
pgtable_bad(regs, hw_error_code, address);

/*
* Check for invalid kernel (supervisor) access to user
* pages in the user address space.
*/
if (unlikely(smap_violation(hw_error_code, regs))) {
bad_area_nosemaphore(regs, hw_error_code, address, NULL);
return;
Expand Down

0 comments on commit 5b0c2ca

Please sign in to comment.