lkml.org 
[lkml]   [2013]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectOn the correctness of dbe3ed1c078c193be34326728d494c5c4bc115e2
A truly ancient commit (v2.6.23), dbe3ed1c078c193be34326728d494c5c4bc115e2:

x86-64: page faults from user mode are always user faults

Randy Dunlap noticed an interesting "crashme" behaviour on his dual
Prescott Xeon setup, where he gets page faults with the error code
having a zero "user" bit, but the register state points back to user
mode.

This may be a CPU microcode buglet triggered by some strange
instruction pattern that crashme generates, and loading a microcode
update seems to possibly have fixed it.

Regardless, we really should trust the register state more than the
error code, since it's really the register state that determines
whether we can actually send a signal, or whether we're in kernel
mode and need to oops/kill the process in the case of a page fault.

... introduced the following code (since slightly modified):

+ /*
+ * User-mode registers count as a user access even for any
+ * potential system fault or CPU buglet.
+ */
+ if (user_mode_vm(regs))
+ error_code |= PF_USER;
+

This has the end result that we treat a user space instruction which
touches a privileged data structure that then page faults (e.g. a
segment load which causes #PF on the GDT) as a user-space fault.

This seems very wrong to me, since such a #PF would indicate a serious
error in the kernel.

If this was a buglet introduced by a specific processor ("Prescott Xeon"
I presume means Nocona) and then even fixed in a patch, I'm concerned
that we are putting the cart before the horse with this change.

I went through the errata sheets for the CPUs of the time, but nothing
jumped out at me as causing this kind of problem, although there is a
mention of a couple of undefined opcodes which ought to #UD being able
to generate a "load to an incorrect address". Kind of a stretch, though.

-hpa


\
 
 \ /
  Last update: 2013-09-01 14:41    [W:2.317 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site