Thread (63 messages) flat view 63 messages, 13 authors, 2017-04-10

[RFC v2][PATCH 04/11] x86: Implement __arch_rare_write_begin/unmap()

From: Kees Cook <hidden>
Date: 2017-03-30 01:42:00
Also in: lkml

On Wed, Mar 29, 2017 at 3:38 PM, Andy Lutomirski [off-list ref] wrote:
On Wed, Mar 29, 2017 at 11:15 AM, Kees Cook [off-list ref] wrote:
quoted
Based on PaX's x86 pax_{open,close}_kernel() implementation, this
allows HAVE_ARCH_RARE_WRITE to work on x86.
quoted
+
+static __always_inline unsigned long __arch_rare_write_begin(void)
+{
+       unsigned long cr0;
+
+       preempt_disable();
This looks wrong.  DEBUG_LOCKS_WARN_ON(!irqs_disabled()) would work,
as would local_irq_disable().  There's no way that just disabling
preemption is enough.

(Also, how does this interact with perf nmis?)
Do you mean preempt_disable() isn't strong enough here? I'm open to
suggestions. The goal would be to make sure nothing between _begin and
_end would get executed without interruption...

-Kees

-- 
Kees Cook
Pixel Security
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help