From: Kees Cook <keescook@chromium.org>
To: Laura Abbott <labbott@redhat.com>
Cc: "x86@kernel.org" <x86@kernel.org>, LKP <lkp@01.org>,
kernel test robot <fengguang.wu@intel.com>,
LKML <linux-kernel@vger.kernel.org>,
Linux-MM <linux-mm@kvack.org>,
wfg@linux.intel.com
Subject: Re: [mm/usercopy] 517e1fbeb6: kernel BUG at arch/x86/mm/physaddr.c:78!
Date: Mon, 8 May 2017 12:15:11 -0700 [thread overview]
Message-ID: <CAGXu5jJQdf0KXKuTaqyH7YP=NL-0WYNKDYOZJSVjkjrYd4tG9A@mail.gmail.com> (raw)
In-Reply-To: <851cb32e-e9da-a710-6e4d-ed2e8790ae70@redhat.com>
On Mon, May 8, 2017 at 11:41 AM, Laura Abbott <labbott@redhat.com> wrote:
> On 05/07/2017 07:51 AM, Kees Cook wrote:
>> On Sun, May 7, 2017 at 2:06 AM, kernel test robot
>> <fengguang.wu@intel.com> wrote:
>>> Greetings,
>>>
>>> 0day kernel testing robot got the below dmesg and the first bad commit is
>>>
>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>>>
>>> commit 517e1fbeb65f5eade8d14f46ac365db6c75aea9b
>>> Author: Laura Abbott <labbott@redhat.com>
>>> AuthorDate: Tue Apr 4 14:09:00 2017 -0700
>>> Commit: Kees Cook <keescook@chromium.org>
>>> CommitDate: Wed Apr 5 12:30:18 2017 -0700
>>>
>>> mm/usercopy: Drop extra is_vmalloc_or_module() check
>>>
>>> Previously virt_addr_valid() was insufficient to validate if virt_to_page()
>>> could be called on an address on arm64. This has since been fixed up so
>>> there is no need for the extra check. Drop it.
>>>
>>> Signed-off-by: Laura Abbott <labbott@redhat.com>
>>> Acked-by: Mark Rutland <mark.rutland@arm.com>
>>> Signed-off-by: Kees Cook <keescook@chromium.org>
>>
>> This appears to be from CONFIG_DEBUG_VIRTUAL on __phys_addr, used by
>> hardened usercopy, probably during virt_addr_valid(). I'll take a
>> closer look on Monday...
>>
>> -Kees
>>
>
> So this looks like a strange edge case/bug on x86 32-bit.
> virt_addr_valid is returning true on vmalloc addresses because
> __vmalloc_start_set is never getting set because the below
> configuration uses CONFIG_NEED_MULTIPLE_NODES=y and that variable
> only gets set with CONFIG_NEED_MULTIPLE_NODES=n currently. If
> I set it in arch/x86/mm/numa_32.c, it seems to work:
>
> Thanks,
> Laura
>
>
> diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c
> index 6b7ce62..aca6295 100644
> --- a/arch/x86/mm/numa_32.c
> +++ b/arch/x86/mm/numa_32.c
> @@ -100,5 +100,6 @@ void __init initmem_init(void)
> printk(KERN_DEBUG "High memory starts at vaddr %08lx\n",
> (ulong) pfn_to_kaddr(highstart_pfn));
>
> + __vmalloc_start_set = true;
> setup_bootmem_allocator();
> }
Ah, nice catch. Can you send this as a normal patch for Ingo to apply?
-Kees
--
Kees Cook
Pixel Security
next prev parent reply other threads:[~2017-05-08 19:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-07 9:06 [mm/usercopy] 517e1fbeb6: kernel BUG at arch/x86/mm/physaddr.c:78! kernel test robot
2017-05-07 14:51 ` Kees Cook
2017-05-08 18:41 ` Laura Abbott
2017-05-08 19:15 ` Kees Cook [this message]
2017-05-08 21:23 ` [PATCH] x86/mm: Set __vmalloc_start_set in numa_32.c Laura Abbott
2017-05-08 22:28 ` Kees Cook
2017-05-09 6:40 ` [tip:x86/urgent] x86/mm/32: Set the '__vmalloc_start_set' flag in initmem_init() tip-bot for Laura Abbott
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='CAGXu5jJQdf0KXKuTaqyH7YP=NL-0WYNKDYOZJSVjkjrYd4tG9A@mail.gmail.com' \
--to=keescook@chromium.org \
--cc=fengguang.wu@intel.com \
--cc=labbott@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@01.org \
--cc=wfg@linux.intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).