Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1369635

[PATCH] x86/mm/pat: Fix BUG_ON in mmap_mem on QEMU/i386

From Toshi Kani <toshi.kani@hpe.com>
Newsgroups linux.kernel
Subject [PATCH] x86/mm/pat: Fix BUG_ON in mmap_mem on QEMU/i386
Date 2016-04-02 00:30 +0200
Message-ID <rjfJM-2rv-11@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


The following BUG_ON error was reported on QEMU/i386:

  kernel BUG at arch/x86/mm/physaddr.c:79!
  Call Trace:
  phys_mem_access_prot_allowed
  mmap_mem
  ? mmap_region
  mmap_region
  do_mmap
  vm_mmap_pgoff
  SyS_mmap_pgoff
  do_int80_syscall_32
  entry_INT80_32

after commit edfe63ec97ed ("x86/mtrr: Fix Xorg crashes in Qemu
sessions").

PAT is now set to disabled state when MTRRs are disabled.  This
led the __pa(high_memory) check in phys_mem_access_prot_allowed()
to resurrect on x86/32.

When the system does not have much memory, 'high_memory' points to
the maximum memory address + 1, which is empty.  When
CONFIG_DEBUG_VIRTUAL is also set, __pa() calls __phys_addr(), which
in turn calls slow_virt_to_phys() for high_memory.  Because
high_memory does not point to a valid memory address, this address
is not mapped.  Hence, BUG_ON.

Use __pa_nodebug() as the code does not expect a valid virtual
mapping for high_memory.

Reported-by: kernel test robot <ying.huang@linux.intel.com>
Link: https://lkml.org/lkml/2016/4/1/608
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Thomas Gleixner <tglx@linutronix.de>
Ingo Molnar <mingo@kernel.org>
H. Peter Anvin <hpa@zytor.com>
Borislav Petkov <bp@suse.de>
---
This patch is based on -tip.
---
 arch/x86/mm/pat.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index c4c3ddc..26b7202 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -792,7 +792,7 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
 	      boot_cpu_has(X86_FEATURE_K6_MTRR) ||
 	      boot_cpu_has(X86_FEATURE_CYRIX_ARR) ||
 	      boot_cpu_has(X86_FEATURE_CENTAUR_MCR)) &&
-	    (pfn << PAGE_SHIFT) >= __pa(high_memory)) {
+	    (pfn << PAGE_SHIFT) >= __pa_nodebug(high_memory)) {
 		pcm = _PAGE_CACHE_MODE_UC;
 	}
 #endif

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] x86/mm/pat: Fix BUG_ON in mmap_mem on QEMU/i386 Toshi Kani <toshi.kani@hpe.com> - 2016-04-02 00:30 +0200
  Re: [PATCH] x86/mm/pat: Fix BUG_ON in mmap_mem on QEMU/i386 Borislav Petkov <bp@suse.de> - 2016-04-05 13:10 +0200
    Re: [PATCH] x86/mm/pat: Fix BUG_ON in mmap_mem on QEMU/i386 Toshi Kani <toshi.kani@hpe.com> - 2016-04-05 17:40 +0200
      Re: [PATCH] x86/mm/pat: Fix BUG_ON in mmap_mem on QEMU/i386 Toshi Kani <toshi.kani@hpe.com> - 2016-04-08 18:50 +0200
        Re: [Xen-devel] [PATCH] x86/mm/pat: Fix BUG_ON in mmap_mem on  QEMU/i386 David Vrabel <david.vrabel@citrix.com> - 2016-04-08 19:10 +0200
          Re: [Xen-devel] [PATCH] x86/mm/pat: Fix BUG_ON in mmap_mem on  QEMU/i386 Toshi Kani <toshi.kani@hpe.com> - 2016-04-08 19:10 +0200

csiph-web