Re: [net/bpf] 3051bf36c2 BUG: unable to handle kernel paging request at 0000a7cf
From: Linus Torvalds
Date: Thu Mar 09 2017 - 13:10:44 EST
On Thu, Mar 9, 2017 at 9:51 AM, Daniel Borkmann <daniel@xxxxxxxxxxxxx> wrote:
> What I see is that original cr4 is 0x610. The cpu_tlbstate.cr4 is
> consistent to native_read_cr4() and since cr4 is != 0, it tells me
> based on the comment in native_read_cr4() that cr4 seems to be
> supported. Thus, meaning we end up with writing ...
> ... twice, and this just doesn't trigger the desired TLB flush.
Very odd. We should always have PGE (0x0080) set in cr4 (if the CPU
But yes, if PGE is clear then that certainly explains the bug, and
it's not an emulation issue.
> I changed the code into the following ...
> cr4 = this_cpu_read(cpu_tlbstate.cr4);
> /* clear PGE */
> - native_write_cr4(cr4 & ~X86_CR4_PGE);
> + native_write_cr4(cr4 ^ X86_CR4_PGE);
> /* write old PGE again and flush TLBs */
Yeah, good for debugging, but not a good patch in general. The only
valid reason for not having PGE enabled would be that the CPU doesn't
support PGE at all.