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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 28 Jun 2022 14:10:18 +0200
From:   Marco Elver <elver@...gle.com>
To:     yee.lee@...iatek.com
Cc:     linux-kernel@...r.kernel.org, catalin.marinas@....com,
        Alexander Potapenko <glider@...gle.com>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Matthias Brugger <matthias.bgg@...il.com>,
        "open list:KFENCE" <kasan-dev@...glegroups.com>,
        "open list:MEMORY MANAGEMENT" <linux-mm@...ck.org>,
        "moderated list:ARM/Mediatek SoC support" 
        <linux-arm-kernel@...ts.infradead.org>,
        "moderated list:ARM/Mediatek SoC support" 
        <linux-mediatek@...ts.infradead.org>
Subject: Re: [PATCH v2 1/1] mm: kfence: apply kmemleak_ignore_phys on early
 allocated pool

On Tue, 28 Jun 2022 at 13:37, yee.lee via kasan-dev
<kasan-dev@...glegroups.com> wrote:
>
> From: Yee Lee <yee.lee@...iatek.com>
>
> This patch solves two issues.
>
> (1) The pool allocated by memblock needs to unregister from
> kmemleak scanning. Apply kmemleak_ignore_phys to replace the
> original kmemleak_free as its address now is stored in the phys tree.
>
> (2) The pool late allocated by page-alloc doesn't need to unregister.
> Move out the freeing operation from its call path.
>
> Suggested-by: Catalin Marinas <catalin.marinas@....com>
> Suggested-by: Marco Elver <elver@...gle.com>
> Signed-off-by: Yee Lee <yee.lee@...iatek.com>

Reviewed-by: Marco Elver <elver@...gle.com>

Does this want a Fixes tag?

> ---
>  mm/kfence/core.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/mm/kfence/core.c b/mm/kfence/core.c
> index 4e7cd4c8e687..32a4a75e820c 100644
> --- a/mm/kfence/core.c
> +++ b/mm/kfence/core.c
> @@ -600,14 +600,6 @@ static unsigned long kfence_init_pool(void)
>                 addr += 2 * PAGE_SIZE;
>         }
>
> -       /*
> -        * The pool is live and will never be deallocated from this point on.
> -        * Remove the pool object from the kmemleak object tree, as it would
> -        * otherwise overlap with allocations returned by kfence_alloc(), which
> -        * are registered with kmemleak through the slab post-alloc hook.
> -        */
> -       kmemleak_free(__kfence_pool);
> -
>         return 0;
>  }
>
> @@ -620,8 +612,16 @@ static bool __init kfence_init_pool_early(void)
>
>         addr = kfence_init_pool();
>
> -       if (!addr)
> +       if (!addr) {
> +               /*
> +                * The pool is live and will never be deallocated from this point on.
> +                * Ignore the pool object from the kmemleak phys object tree, as it would
> +                * otherwise overlap with allocations returned by kfence_alloc(), which
> +                * are registered with kmemleak through the slab post-alloc hook.
> +                */
> +               kmemleak_ignore_phys(__pa(__kfence_pool));
>                 return true;
> +       }
>
>         /*
>          * Only release unprotected pages, and do not try to go back and change
> --
> 2.18.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ