lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 15 May 2014 20:22:43 +0100
From:	Keir Fraser <keir.xen@...il.com>
To:	"H. Peter Anvin" <hpa@...or.com>
CC:	David Vrabel <david.vrabel@...rix.com>,
	xen-devel@...ts.xenproject.org, x86@...nel.org,
	linux-kernel@...r.kernel.org, Dave Hansen <dave.hansen@...el.com>,
	Ingo Molnar <mingo@...hat.com>, Mel Gorman <mgorman@...e.de>,
	Boris Ostrovsky <boris.ostrovsky@...cle.com>,
	Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [Xen-devel] [PATCH 7/9] x86: skip check for spurious faults for
 non-present faults

H. Peter Anvin wrote:
> On 04/15/2014 07:15 AM, David Vrabel wrote:
>> If a fault on a kernel address is due to a non-present page, then it
>> cannot be the result of stale TLB entry from a protection change (RO
>> to RW or NX to X).  Thus the pagetable walk in spurious_fault() can be
>> skipped.
>
> Erk... this code is screaming WTF to me.  The x86 architecture is such
> that the CPU is responsible for avoiding these faults.

Not in this case...

> <dig>  <dig>  <dig>
>
> 5b727a3b0158a129827c21ce3bfb0ba997e8ddd0
>
>      x86: ignore spurious faults
>
>      When changing a kernel page from RO->RW, it's OK to leave stale TLB
>      entries around, since doing a global flush is expensive and they
>      pose no security problem.  They can, however, generate a spurious
>      fault, which we should catch and simply return from (which will
>      have the side-effect of reloading the TLB to the current PTE).
>
>      This can occur when running under Xen, because it frequently changes
>      kernel pages from RW->RO->RW to implement Xen's pagetable semantics.
>      It could also occur when using CONFIG_DEBUG_PAGEALLOC, since it
>      avoids doing a global TLB flush after changing page permissions.
>
>      Signed-off-by: Jeremy Fitzhardinge<jeremy@...source.com>
>      Cc: Harvey Harrison<harvey.harrison@...il.com>
>      Signed-off-by: Ingo Molnar<mingo@...e.hu>
>      Signed-off-by: Thomas Gleixner<tglx@...utronix.de>
>
> Again WTF?
>
> Are we chasing hardware errata here?  Or did someone go off and *assume*
> that the x86 hardware architecture work a certain way?  Or is there
> something way more subtle going on?

See Intel Developer's Manual Vol 3 Section 4.10.4.3, 3rd bullet... This 
is expected behaviour, probably to make copy-on-write faults faster.

  -- Keir

> I guess next step is mailing list archaeology...
>
> Does anyone still have contacts with Jeremy, and if so, could they poke
> him perhaps?
>
> 	-hpa
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@...ts.xen.org
> http://lists.xen.org/xen-devel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ