]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
x86/mm: Clarify hardware vs. software "error_code"
authorDave Hansen <dave.hansen@linux.intel.com>
Thu, 4 Jul 2019 15:17:00 +0000 (17:17 +0200)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:56:05 +0000 (19:56 -0600)
commitf0c8f6bbbb38df648618b316b74c5496471106d9
tree50dc36ce4eeb42ded5289bcc0e5a4ac97451fa6c
parent48fc39a1ef0d9aa91052af8cda6e75c493bd3858
x86/mm: Clarify hardware vs. software "error_code"

BugLink: https://bugs.launchpad.net/bugs/1827884
We pass around a variable called "error_code" all around the page
fault code.  Sounds simple enough, especially since "error_code" looks
like it exactly matches the values that the hardware gives us on the
stack to report the page fault error code (PFEC in SDM parlance).

But, that's not how it works.

For part of the page fault handler, "error_code" does exactly match
PFEC.  But, during later parts, it diverges and starts to mean
something a bit different.

Give it two names for its two jobs.

The place it diverges is also really screwy.  It's only in a spot
where the hardware tells us we have kernel-mode access that occurred
while we were in usermode accessing user-controlled address space.
Add a warning in there.

Cc: x86@kernel.org
Cc: Jann Horn <jannh@google.com>
Cc: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20180928160220.4A2272C9@viggo.jf.intel.com
(cherry picked from commit 164477c2331be75d9bd57fb76704e676b2bcd1cd)
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Connor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
arch/x86/mm/fault.c