linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Florian Fainelli <f.fainelli@gmail.com>,
	Abbott Liu <liuwenliang@huawei.com>,
	 Russell King <linux@armlinux.org.uk>,
	Ard Biesheuvel <ardb@kernel.org>,
	 Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Mike Rapoport <rppt@linux.ibm.com>,
	 Will Deacon <will@kernel.org>
Cc: Dmitry Vyukov <dvyukov@google.com>,
	kasan-dev <kasan-dev@googlegroups.com>,
	Alexander Potapenko <glider@google.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 4/5 v10] ARM: Initialize the mapping of KASan shadow memory
Date: Mon, 29 Jun 2020 16:07:06 +0200	[thread overview]
Message-ID: <CACRpkdbuRCXvnaKvAcqQPCWBWmJYQ9orVhWNrOdhUVJUD2Zbbw@mail.gmail.com> (raw)
In-Reply-To: <20200615090247.5218-5-linus.walleij@linaro.org>

Asking for help here!

I have a problem with populating PTEs for the LPAE usecase using
Versatile Express Cortex A15 (TC1) in QEMU.

In this loop of the patch:

On Mon, Jun 15, 2020 at 11:05 AM Linus Walleij <linus.walleij@linaro.org> wrote:

> +static void __init kasan_pte_populate(pmd_t *pmdp, unsigned long addr,
> +                                     unsigned long end, int node, bool early)
> +{
> +       unsigned long next;
> +       pte_t *ptep = pte_offset_kernel(pmdp, addr);

(...)

> +       do {
> +               next = pmd_addr_end(addr, end);
> +               kasan_pte_populate(pmdp, addr, next, node, early);
> +       } while (pmdp++, addr = next, addr != end && pmd_none(READ_ONCE(*pmdp)));

I first populate the PMD for 0x6ee00000 .. 0x6f000000
and this works fine, and the PTEs are all initialized.
pte_offset_kernel() returns something reasonable.
(0x815F5000).

Next the kernel processes the PMD for
0x6f000000 .. 0x6f200000 and now I run into trouble,
because pte_offset_kernel() suddenly returns a NULL
pointer 0x00000000.

Naturally dereferencing the pointer when checking
if (pte_none(*ptep)) hangs the machine since this
is in early init.

Does anyone have hints on why this happens, and why it
only happens on LPAE? non-LPAE on the Versatile Express
QEMU A15 works fine.

I'm debugging, but any hints are very welcome.

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-06-29 14:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-15  9:02 [PATCH 0/5 v10] KASan for Arm Linus Walleij
2020-06-15  9:02 ` [PATCH 1/5 v10] ARM: Disable KASan instrumentation for some code Linus Walleij
2020-06-15  9:02 ` [PATCH 2/5 v10] ARM: Replace string mem* functions for KASan Linus Walleij
2020-06-15  9:02 ` [PATCH 3/5 v10] ARM: Define the virtual space of KASan's shadow region Linus Walleij
2020-06-15  9:02 ` [PATCH 4/5 v10] ARM: Initialize the mapping of KASan shadow memory Linus Walleij
2020-06-15 14:33   ` Mike Rapoport
2020-06-30 13:22     ` Linus Walleij
2020-06-30 14:45       ` Mike Rapoport
2020-06-29 14:07   ` Linus Walleij [this message]
2020-06-29 14:37     ` Russell King - ARM Linux admin
2020-06-30  9:38       ` Linus Walleij
2020-06-15  9:02 ` [PATCH 5/5 v10] ARM: Enable KASan for ARM Linus Walleij

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=CACRpkdbuRCXvnaKvAcqQPCWBWmJYQ9orVhWNrOdhUVJUD2Zbbw@mail.gmail.com \
    --to=linus.walleij@linaro.org \
    --cc=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=aryabinin@virtuozzo.com \
    --cc=dvyukov@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=liuwenliang@huawei.com \
    --cc=rppt@linux.ibm.com \
    --cc=will@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).