All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@linux.ibm.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Abbott Liu <liuwenliang@huawei.com>,
	Russell King <linux@armlinux.org.uk>,
	kasan-dev <kasan-dev@googlegroups.com>,
	Alexander Potapenko <glider@google.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 4/5 v10] ARM: Initialize the mapping of KASan shadow memory
Date: Tue, 30 Jun 2020 17:45:24 +0300	[thread overview]
Message-ID: <20200630144524.GB2500444@linux.ibm.com> (raw)
In-Reply-To: <CACRpkdZvQgPXBsdUO1JwBW0gE-Jhse0s8U0-Y5BGCcxkq_Ue2g@mail.gmail.com>

On Tue, Jun 30, 2020 at 03:22:19PM +0200, Linus Walleij wrote:
> Hi Mike!
> 
> First a BIG THANKS for your help! With the aid of your review comments
> and the further comments from Russell I have really progressed with this
> patch set the last few days.
> 
> On Mon, Jun 15, 2020 at 4:33 PM Mike Rapoport <rppt@linux.ibm.com> wrote:
> 
> > > -#define pud_populate(mm,pmd,pte)     BUG()
> > > -
> > > +#ifndef CONFIG_KASAN
> > > +#define pud_populate(mm, pmd, pte)   BUG()
> > > +#else
> > > +#define pud_populate(mm, pmd, pte)   do { } while (0)
> >
> > Hmm, is this really necessary? Regardless of CONFIG_KASAN pud_populate()
> > should never be called for non-LPAE case...
> 
> It is necessary because the generic KASan code in
> mm/kasan/init.c unconditionally calls pud_populate() and act as
> if pud's always exist and need to be populated.
> 
> Possibly this means that pud_populate() should just be turned
> into do { } while (0) as well (like other functions called unconditionally
> from the VMM) but I'll leave this in for now.

Yes, making pud_populate() a NOP will match the "generic" implementation
in asm-generic/pgtable-nopmd.h. 

If this patchset will get to v12, maybe it would be worth doing that  :)

> >         cpu_switch_mm(tmp_pgd_table, &init_mm);
> >
> > And, why do we need a context switch here at all?
> 
> This is really just a way of reusing that function call to replace
> the master page table pointer TTBR0 (Translation Table Base Register)
> while setting up the shadow memory.

Right, but is this really necessary to create the shadow page table?

If I remember correctly, the mm parameter is anyway not used by ARM page
table manpulators and pgd_offset_k() can be replaced by
pgd_offset_pgd(tmp_pgd_table, ...).

> Yours,
> Linus Walleij

-- 
Sincerely yours,
Mike.

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

  reply	other threads:[~2020-06-30 14:47 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 [this message]
2020-06-29 14:07   ` Linus Walleij
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=20200630144524.GB2500444@linux.ibm.com \
    --to=rppt@linux.ibm.com \
    --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=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=liuwenliang@huawei.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.