mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lecopzer Chen <lecopzer.chen@mediatek.com>
To: <linus.walleij@linaro.org>
Cc: <andreyknvl@gmail.com>, <anshuman.khandual@arm.com>,
	<ardb@kernel.org>, <arnd@arndb.de>, <dvyukov@google.com>,
	<geert+renesas@glider.be>, <glider@google.com>,
	<kasan-dev@googlegroups.com>, <lecopzer.chen@mediatek.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux@armlinux.org.uk>,
	<lukas.bulwahn@gmail.com>, <mark.rutland@arm.com>,
	<masahiroy@kernel.org>, <matthias.bgg@gmail.com>,
	<rmk+kernel@armlinux.org.uk>, <ryabinin.a.a@gmail.com>,
	<yj.chiang@mediatek.com>
Subject: Re: [PATCH v2 1/2] arm: kasan: support CONFIG_KASAN_VMALLOC
Date: Mon, 14 Feb 2022 00:06:56 +0800	[thread overview]
Message-ID: <20220213160656.17605-1-lecopzer.chen@mediatek.com> (raw)
In-Reply-To: <CACRpkdYDg3saLpfHg=R1kYpnC_BBNgBbe7un-B4e8bgDYPq1Fg@mail.gmail.com>

Hi Linus
 
Thanks for your review.
 
> > -       kasan_populate_early_shadow(kasan_mem_to_shadow((void *)VMALLOC_START),
> > +       if (!IS_ENABLED(CONFIG_KASAN_VMALLOC))
> > +               kasan_populate_early_shadow(kasan_mem_to_shadow((void *)VMALLOC_START),
> > +                                           kasan_mem_to_shadow((void *)VMALLOC_END));
> > +
> > +       kasan_populate_early_shadow(kasan_mem_to_shadow((void *)VMALLOC_END),
> >                                     kasan_mem_to_shadow((void *)-1UL) + 1);
> 
> Where is this actually mapped?
> 
> Can you print out where
> kasan_mem_to_shadow((void *)VMALLOC_START)
> kasan_mem_to_shadow((void *)VMALLOC_END)
> as well as KASAN_SHADOW_START and KASAN_SHADOW_END
> points?
> 
> When I looked into this getting the shadow memory between
> KASAN_SHADOW_START and KASAN_SHADOW_END
> seemed like the big problem since this is static, so how is Kasan
> solving this now?

For quick answer:
As I knwon, the definition of KASAN_SHADOW_START and END

(@arch/arm/include/asm/kasan_def.h)
* 1) KASAN_SHADOW_START
 *   This value begins with the MODULE_VADDR's shadow address. It is the
 *   start of kernel virtual space....
 *
 * 2) KASAN_SHADOW_END
 *   This value is the 0x100000000's shadow address: the mapping that would
 *   be after the end of the kernel memory at 0xffffffff....

and the virt address of vmalloc for ARM32 is also between MODULE_VADDR and
0x100000000 (ZONE_HIGHMEM), so nothing needs to do.

If there is any cases may break this assumption, please correct me, thanks.

> 
> Please patch the picture in
> include/asm/kasan_def.h
> and the info in
> Documentation/arm/memory.rst
> so it clearly reflects where VMALLOC is shadowed.

Thanks for suggestion, Yes, we really do need to update doc for memory layout.
I'll study how to add it and provide in v3.





  reply	other threads:[~2022-02-13 16:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-12  7:47 [PATCH v2 0/2] " Lecopzer Chen
2022-02-12  7:47 ` [PATCH v2 1/2] " Lecopzer Chen
2022-02-12 21:26   ` Linus Walleij
2022-02-13 16:06     ` Lecopzer Chen [this message]
2022-02-12  7:47 ` [PATCH v2 2/2] arm: kconfig: fix MODULE_PLTS for KASAN with KASAN_VMALLOC Lecopzer Chen

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=20220213160656.17605-1-lecopzer.chen@mediatek.com \
    --to=lecopzer.chen@mediatek.com \
    --cc=andreyknvl@gmail.com \
    --cc=anshuman.khandual@arm.com \
    --cc=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=dvyukov@google.com \
    --cc=geert+renesas@glider.be \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lukas.bulwahn@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=masahiroy@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=ryabinin.a.a@gmail.com \
    --cc=yj.chiang@mediatek.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®