public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman•id.au>
To: Breno Leitao <leitao@debian•org>, linuxppc-dev@lists•ozlabs.org
Cc: gromero@br•ibm.com
Subject: Re: kernel BUG at mm/usercopy.c:72!
Date: Thu, 18 May 2017 20:17:20 +1000	[thread overview]
Message-ID: <87zieajwpb.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <20170515191949.GA13641@gmail.com>

Breno Leitao <leitao@debian•org> writes:

> Hello,
>
> Kernel 4.12-rc1 is showing a bug when I try it on a POWER8 virtual
> machine. Justing SSHing into the machine causes this issue.

Can you try this?

cheers

diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index 2a32483c7b6c..8da5d4c1cab2 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -132,7 +132,19 @@ extern long long virt_phys_offset;
 #define virt_to_pfn(kaddr)	(__pa(kaddr) >> PAGE_SHIFT)
 #define virt_to_page(kaddr)	pfn_to_page(virt_to_pfn(kaddr))
 #define pfn_to_kaddr(pfn)	__va((pfn) << PAGE_SHIFT)
+
+#ifdef CONFIG_PPC_BOOK3S_64
+/*
+ * On hash the vmalloc and other regions alias to the kernel region when passed
+ * through __pa(), which virt_to_pfn() uses. That means virt_addr_valid() can
+ * return true for some vmalloc addresses, which is incorrect. So explicitly
+ * check that the address is in the kernel region.
+ */
+#define virt_addr_valid(kaddr) (REGION_ID(kaddr) == KERNEL_REGION_ID && \
+				pfn_valid(virt_to_pfn(kaddr)))
+#else
 #define virt_addr_valid(kaddr)	pfn_valid(virt_to_pfn(kaddr))
+#endif
 
 /*
  * On Book-E parts we need __va to parse the device tree and we can't

      parent reply	other threads:[~2017-05-18 10:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-15 19:19 kernel BUG at mm/usercopy.c:72! Breno Leitao
2017-05-16  4:00 ` Anshuman Khandual
2017-05-16  4:44   ` Balbir Singh
2017-05-16  5:04     ` Anshuman Khandual
2017-05-16 11:02 ` Michael Ellerman
2017-05-16 16:15   ` Breno Leitao
2017-05-16 11:09 ` Michael Ellerman
2017-05-16 14:32   ` Kees Cook
2017-05-16 14:35     ` Laura Abbott
2017-05-18  5:09       ` Michael Ellerman
2017-05-17 10:05     ` Balbir Singh
2017-05-18 10:16     ` Michael Ellerman
2017-05-18 10:58       ` Balbir Singh
2017-05-18 10:17 ` Michael Ellerman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zieajwpb.fsf@concordia.ellerman.id.au \
    --to=mpe@ellerman$(echo .)id.au \
    --cc=gromero@br$(echo .)ibm.com \
    --cc=leitao@debian$(echo .)org \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox