Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932865AbdCIRsu (ORCPT ); Thu, 9 Mar 2017 12:48:50 -0500 Received: from mail-io0-f194.google.com ([209.85.223.194]:33890 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932703AbdCIRsr (ORCPT ); Thu, 9 Mar 2017 12:48:47 -0500 MIME-Version: 1.0 In-Reply-To: <58C16C6A.2060400@iogearbox.net> References: <20170301125426.l4nf65rx4wahohyl@wfg-t540p.sh.intel.com> <20170302202338.ci6wwb3yzjmdy4n2@wfg-t540p.sh.intel.com> <58B88353.2010508@iogearbox.net> <58C08535.3070000@iogearbox.net> <7af7bcc9-9115-be9f-2240-a022487e9b70@redhat.com> <58C152F1.9090004@iogearbox.net> <58C157E6.1010909@iogearbox.net> <58C16C6A.2060400@iogearbox.net> From: Linus Torvalds Date: Thu, 9 Mar 2017 09:48:20 -0800 X-Google-Sender-Auth: t-NyQUJvrI49AuwXMasDXNs6aMs Message-ID: Subject: Re: [net/bpf] 3051bf36c2 BUG: unable to handle kernel paging request at 0000a7cf To: Daniel Borkmann Cc: Thomas Gleixner , Kees Cook , Laura Abbott , Ingo Molnar , Peter Anvin , Fengguang Wu , Network Development , LKML , LKP , ast@fb.com, "the arch/x86 maintainers" , "David S. Miller" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 950 Lines: 25 On Thu, Mar 9, 2017 at 6:53 AM, Daniel Borkmann wrote: > > Fwiw, I tried switching from using cr4 > (__native_flush_tlb_global_irq_disabled()) > to slower cr3 (__native_flush_tlb()) in "-cpu kvm64" mode, and it looks like > it also lets all test cases pass (rodata_test, test_setmem, test_bpf), no > corruption happening, etc. Ok. I think this is conclusive: the qemu "-cpu kvm64" case is definitely broken, since changing CR4.PGE is definitely architecturally defined to flush all TLB entries. This is not a guest kernel bug. Of course, the bug may still be in the *host* kernel. Maybe the emulation does something wrong. I see if (((cr4 ^ old_cr4) & pdptr_bits) || (!(cr4 & X86_CR4_PCIDE) && (old_cr4 & X86_CR4_PCIDE))) kvm_mmu_reset_context(vcpu); (where pdptr_bits includes the PGE bit), but I'm not sure if emulation is supposed to do something else too. Linus