lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdarYrhtrv2W8+MQm6QNFkrqE-EUVz4cm7kGvsbWgBdk+Q@mail.gmail.com>
Date:   Thu, 1 Sep 2022 15:12:12 +0200
From:   Linus Walleij <linus.walleij@...aro.org>
To:     Alexander Sverdlin <alexander.sverdlin@...ia.com>
Cc:     kasan-dev@...glegroups.com,
        Lecopzer Chen <lecopzer.chen@...iatek.com>,
        Andrey Ryabinin <ryabinin.a.a@...il.com>,
        Alexander Potapenko <glider@...gle.com>,
        Andrey Konovalov <andreyknvl@...il.com>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Vincenzo Frascino <vincenzo.frascino@....com>,
        Russell King <linux@...linux.org.uk>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ARM: kasan: Only map modules if CONFIG_KASAN_VMALLOC=n

On Thu, Sep 1, 2022 at 10:42 AM Alexander Sverdlin
<alexander.sverdlin@...ia.com> wrote:

> >> -       create_mapping((void *)MODULES_VADDR, (void *)(PKMAP_BASE + PMD_SIZE));
> >> +       if (!IS_ENABLED(CONFIG_KASAN_VMALLOC) && IS_ENABLED(CONFIG_MODULES))
> >> +               create_mapping((void *)MODULES_VADDR, (void *)(MODULES_END));
> > So the way I understand it is that modules are first and foremost loaded into
> > the area MODULES_VADDR .. MODULES_END, and then after that is out,
> > they get loaded into VMALLOC. See arch/arm/kernel/module.c, module_alloc().
>
> yes, but both areas are managed by __vmalloc_node_range().

Owww!

> > If you do this, how are the addresses between MODULES_VADDR..MODULES_END
> > shadowed when using CONFIG_KASAN_VMALLOC?
>
> That's the thing, __vmalloc_node_range() doesn't differentiate between address
> ranges and tries first to recreate [already existing] shadow mapping, and then
> vfree() unconditionally frees the mapping and the page.
>
> vmalloc() KASAN handling is generic, module_alloc() implemented via vmalloc()
> is however ARM-specific. Even though we could teach vmalloc() about MODULES_VADDR
> and MODULES_END (and don't call kasan_ instrumentation on these), but, this is
> ARM-specifics that it's used for this range.

OK I get it. Maybe this warrants a comment in the code explaining the
above behaviour (also in commitlog) so nobody gets confused.

With that:
Reviewed-by: Linus Walleij <linus.walleij@...aro.org>

Yours.
Linus Walleij

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ