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: <CANpmjNO0T-sooJYs2ZCAzFUs6NVkV7iacY=hzB0JtGAyKhEmzw@mail.gmail.com>
Date: Fri, 14 Jun 2024 16:28:48 +0200
From: Marco Elver <elver@...gle.com>
To: andrey.konovalov@...ux.dev
Cc: Andrew Morton <akpm@...ux-foundation.org>, Andrey Konovalov <andreyknvl@...il.com>, 
	Alexander Potapenko <glider@...gle.com>, Dmitry Vyukov <dvyukov@...gle.com>, 
	Andrey Ryabinin <ryabinin.a.a@...il.com>, kasan-dev@...glegroups.com, linux-mm@...ck.org, 
	Brad Spengler <spender@...ecurity.net>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kasan: fix bad call to unpoison_slab_object

On Fri, 14 Jun 2024 at 16:16, <andrey.konovalov@...ux.dev> wrote:
>
> From: Andrey Konovalov <andreyknvl@...il.com>
>
> Commit 29d7355a9d05 ("kasan: save alloc stack traces for mempool") messed
> up one of the calls to unpoison_slab_object: the last two arguments are
> supposed to be GFP flags and whether to init the object memory.
>
> Fix the call.
>
> Without this fix, unpoison_slab_object provides the object's size as
> GFP flags to unpoison_slab_object, which can cause LOCKDEP reports
> (and probably other issues).
>
> Fixes: 29d7355a9d05 ("kasan: save alloc stack traces for mempool")
> Reported-by: Brad Spengler <spender@...ecurity.net>
> Signed-off-by: Andrey Konovalov <andreyknvl@...il.com>

Oof.

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

mm needs explicit Cc: stable, right? If so, we better add Cc: stable as well.

> ---
>  mm/kasan/common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/kasan/common.c b/mm/kasan/common.c
> index e7c9a4dc89f8..85e7c6b4575c 100644
> --- a/mm/kasan/common.c
> +++ b/mm/kasan/common.c
> @@ -532,7 +532,7 @@ void __kasan_mempool_unpoison_object(void *ptr, size_t size, unsigned long ip)
>                 return;
>
>         /* Unpoison the object and save alloc info for non-kmalloc() allocations. */
> -       unpoison_slab_object(slab->slab_cache, ptr, size, flags);
> +       unpoison_slab_object(slab->slab_cache, ptr, flags, false);
>
>         /* Poison the redzone and save alloc info for kmalloc() allocations. */
>         if (is_kmalloc_cache(slab->slab_cache))
> --
> 2.25.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ