From: Matthew Wilcox <willy@infradead.org>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Li Qiong <liqiong@nfschina.com>,
Christoph Lameter <cl@gentwo.org>,
David Rientjes <rientjes@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Harry Yoo <harry.yoo@oracle.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2] mm: slub: avoid deref of free pointer in sanity checks if object is invalid
Date: Fri, 25 Jul 2025 20:22:05 +0100 [thread overview]
Message-ID: <aIPZXSnkDF5r-PR5@casper.infradead.org> (raw)
In-Reply-To: <aIO6m2C8K4SrJ6mp@casper.infradead.org>
On Fri, Jul 25, 2025 at 06:10:51PM +0100, Matthew Wilcox wrote:
> On Fri, Jul 25, 2025 at 06:47:01PM +0200, Vlastimil Babka wrote:
> > On 7/25/25 08:49, Li Qiong wrote:
> > > For debugging, object_err() prints free pointer of the object.
> > > However, if check_valid_pointer() returns false for a object,
> > > dereferncing `object + s->offset` can lead to a crash. Therefore,
> > > print the object's address in such cases.
>
> I don't know where this patch came from (was it cc'd to linux-mm? i
> don't see it)
I've spent some more time thinking about this and I now believe that
there are several calls to object_err() that can be passed a bad
pointer:
freelist_corrupted()
check_object()
on_freelist()
alloc_consistency_checks()
free_consistency_checks()
so I think this line of attack is inappropriate. Instead, I think we
need to make object_err() resilient against wild pointers. Specifically,
avoid doing risky things in print_trailer() if object is not within slab.
next prev parent reply other threads:[~2025-07-25 19:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-25 2:48 [PATCH] mm: slub: fix dereference invalid pointer in alloc_consistency_checks Li Qiong
2025-07-25 4:01 ` Harry Yoo
2025-07-25 5:46 ` liqiong
2025-07-25 6:49 ` [PATCH v2] mm: slub: avoid deref of free pointer in sanity checks if object is invalid Li Qiong
2025-07-25 16:47 ` Vlastimil Babka
2025-07-25 17:10 ` Matthew Wilcox
2025-07-25 19:22 ` Matthew Wilcox [this message]
2025-07-25 22:49 ` Harry Yoo
2025-07-25 19:55 ` Harry Yoo
2025-07-25 23:00 ` Harry Yoo
2025-07-28 2:06 ` liqiong
2025-07-28 3:29 ` Matthew Wilcox
2025-07-28 5:24 ` Harry Yoo
2025-07-28 9:08 ` liqiong
2025-07-28 13:38 ` Harry Yoo
2025-07-28 8:52 ` Vlastimil Babka
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=aIPZXSnkDF5r-PR5@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=cl@gentwo.org \
--cc=harry.yoo@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liqiong@nfschina.com \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=stable@vger.kernel.org \
--cc=vbabka@suse.cz \
/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;
as well as URLs for NNTP newsgroup(s).