mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Christoph Lameter (Ampere)" <cl@gentwo.org>
To: "yuan.gao" <yuan.gao@ucloud.cn>
Cc: penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com,
	 akpm@linux-foundation.org, vbabka@suse.cz,
	roman.gushchin@linux.dev,  42.hyeyoo@gmail.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] mm/slub: Avoid list corruption when removing a slab from the full list
Date: Fri, 11 Oct 2024 11:07:44 -0700 (PDT)	[thread overview]
Message-ID: <c7b03b1e-e000-279d-f845-5808653ac3bf@gentwo.org> (raw)
In-Reply-To: <20241011102020.58087-1-yuan.gao@ucloud.cn>

On Fri, 11 Oct 2024, yuan.gao wrote:

> When an object belonging to the slab got freed later, the remove_full()
> function is called. Because the slab is neither on the partial list nor
> on the full list, it eventually lead to a list corruption.

We detect list poison....

> diff --git a/mm/slab.h b/mm/slab.h
> index 6c6fe6d630ce..7681e71d9a13 100644
> --- a/mm/slab.h
> +++ b/mm/slab.h
> @@ -73,6 +73,10 @@ struct slab {
>  						struct {
>  							unsigned inuse:16;
>  							unsigned objects:15;
> +							/*
> +							 * Reuse frozen bit for slab with debug enabled:

"If slab debugging is enabled then the frozen bit can bereused to
 indicate that the slab was corrupted"

> index 5b832512044e..b9265e9f11aa 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -1423,6 +1423,11 @@ static int check_slab(struct kmem_cache *s, struct slab *slab)
>  			slab->inuse, slab->objects);
>  		return 0;
>  	}
> +	if (slab->frozen) {
> +		slab_err(s, slab, "Corrupted slab");


"Slab folio disabled due to metadata corruption" ?


> @@ -2744,7 +2750,10 @@ static void *alloc_single_from_partial(struct kmem_cache *s,
>  	slab->inuse++;
>
>  	if (!alloc_debug_processing(s, slab, object, orig_size)) {
> -		remove_partial(n, slab);
> +		if (folio_test_slab(slab_folio(slab))) {


Does folio_test_slab test for the frozen bit??


  reply	other threads:[~2024-10-11 18:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-11 10:20 yuan.gao
2024-10-11 18:07 ` Christoph Lameter (Ampere) [this message]
2024-10-12  4:04   ` yuan.gao
2024-10-13 20:46     ` David Rientjes
2024-10-14 14:55       ` Vlastimil Babka
2024-10-14 16:47         ` Christoph Lameter (Ampere)
2024-10-15  8:56           ` Vlastimil Babka
2024-10-15 16:38             ` Christoph Lameter (Ampere)

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=c7b03b1e-e000-279d-f845-5808653ac3bf@gentwo.org \
    --to=cl@gentwo.org \
    --cc=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=vbabka@suse.cz \
    --cc=yuan.gao@ucloud.cn \
    /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®