Re: [RFC v2][PATCH 04/11] x86: Implement __arch_rare_write_begin/unmap()
From: Peter Zijlstra
Date: Fri Apr 07 2017 - 05:37:52 EST
On Wed, Mar 29, 2017 at 11:15:56AM -0700, Kees Cook wrote:
> +static __always_inline unsigned long __arch_rare_write_end(void)
> +{
> + unsigned long cr0;
> +
> + barrier();
> + cr0 = read_cr0() ^ X86_CR0_WP;
> + BUG_ON(!(cr0 & X86_CR0_WP));
> + write_cr0(cr0);
> + barrier();
> + preempt_enable_no_resched();
NAK
> + return cr0 ^ X86_CR0_WP;
> +}