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]
Message-ID: <89553e3b-48a2-4867-a082-5a530620c427@gmail.com>
Date: Tue, 20 May 2025 15:01:48 +0100
From: Usama Arif <usamaarif642@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>, surenb@...gle.com
Cc: hannes@...xchg.org, shakeel.butt@...ux.dev, vlad.wing@...il.com,
 linux-mm@...ck.org, kent.overstreet@...ux.dev, linux-kernel@...r.kernel.org,
 kernel-team@...a.com
Subject: Re: [PATCH 1/2] mm: slub: allocate slab object extensions
 non-contiguously



On 20/05/2025 13:25, Usama Arif wrote:
> When memory allocation profiling is running on memory bound services,
> allocations greater than order 0 for slab object extensions can fail,
> for e.g. zs_handle zswap slab which will be 512 objsperslab x 16 bytes
> per slabobj_ext (order 1 allocation). Use kvcalloc to improve chances
> of the allocation being successful.
> 
> Signed-off-by: Usama Arif <usamaarif642@...il.com>
> Reported-by: Vlad Poenaru <vlad.wing@...il.com>
> Closes: https://lore.kernel.org/all/17fab2d6-5a74-4573-bcc3-b75951508f0a@gmail.com/
> ---
>  mm/slub.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index dc9e729e1d26..bf43c403ead2 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -1989,7 +1989,7 @@ int alloc_slab_obj_exts(struct slab *slab, struct kmem_cache *s,
>  	gfp &= ~OBJCGS_CLEAR_MASK;
>  	/* Prevent recursive extension vector allocation */
>  	gfp |= __GFP_NO_OBJ_EXT;
> -	vec = kcalloc_node(objects, sizeof(struct slabobj_ext), gfp,
> +	vec = kvcalloc_node(objects, sizeof(struct slabobj_ext), gfp,
>  			   slab_nid(slab));
>  	if (!vec) {
>  		/* Mark vectors which failed to allocate */

I forgot the freeing part, This will need the below fixlet as well.
I will add it to the next revision if there is another one,
otherwise it can be folded into this one. Thanks!


commit fa48eab7faddfdb94faa80a1575ac1840919071e (HEAD -> prctl_huge_v3)
Author: Usama Arif <usamaarif642@...il.com>
Date:   Tue May 20 14:58:10 2025 +0100

    mm: slub: change slab_obj_exts freeing to kvfree
    
    This is to match the kvmalloc.
    
    Signed-off-by: Usama Arif <usamaarif642@...il.com>

diff --git a/mm/slub.c b/mm/slub.c
index 97cb3d9e8d00..2245e8d8fffb 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2045,7 +2045,7 @@ static noinline void free_slab_obj_exts(struct slab *slab)
         * the extension for obj_exts is expected to be NULL.
         */
        mark_objexts_empty(obj_exts);
-       kfree(obj_exts);
+       kvfree(obj_exts);
        slab->obj_exts = 0;
 }
 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ