From: Matthew Wilcox <willy@infradead.org>
To: Hillf Danton <hdanton@sina.com>
Cc: linux-mm@kvack.org, Hugh Dickins <hughd@google.com>,
Johannes Weiner <hannes@cmpxchg.org>, Jan Kara <jack@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
syzbot+d79afb004be235636ee8@syzkaller.appspotmail.com
Subject: Re: [RFC PATCH] mm: truncate: flush lru cache for evicted inode
Date: Fri, 14 Jun 2024 14:42:20 +0100 [thread overview]
Message-ID: <ZmxIvIJ3YSZDwbPW@casper.infradead.org> (raw)
In-Reply-To: <20240614131856.754-1-hdanton@sina.com>
On Fri, Jun 14, 2024 at 09:18:56PM +0800, Hillf Danton wrote:
> Flush lru cache to avoid folio->mapping uaf in case of inode teardown.
What? inodes are supposed to have all their folios removed before
being freed. Part of removing a folio sets the folio->mapping to NULL.
Where is the report?
> Reported-and-tested-by: syzbot+d79afb004be235636ee8@syzkaller.appspotmail.com
> Signed-off-by: Hillf Danton <hdanton@sina.com>
> ---
> Post for comments because lru_add_drain_all() is too haevy a hammer.
>
> --- x/mm/truncate.c
> +++ y/mm/truncate.c
> @@ -419,6 +419,9 @@ void truncate_inode_pages_range(struct a
> truncate_folio_batch_exceptionals(mapping, &fbatch, indices);
> folio_batch_release(&fbatch);
> }
> +
> + if (mapping_exiting(mapping))
> + lru_add_drain_all();
> }
> EXPORT_SYMBOL(truncate_inode_pages_range);
>
> --
next prev parent reply other threads:[~2024-06-14 13:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-14 13:18 Hillf Danton
2024-06-14 13:42 ` Matthew Wilcox [this message]
2024-06-14 23:59 ` Hillf Danton
2024-06-15 20:44 ` Matthew Wilcox
2024-06-15 23:52 ` Hillf Danton
2024-06-16 0:10 ` [syzbot] [nilfs?] [mm?] KASAN: slab-use-after-free Read in lru_add_fn syzbot
2024-06-16 2:39 ` [RFC PATCH] mm: truncate: flush lru cache for evicted inode Hillf Danton
2024-06-16 3:06 ` [syzbot] [nilfs?] [mm?] KASAN: slab-use-after-free Read in lru_add_fn syzbot
2024-06-17 7:57 ` [RFC PATCH] mm: truncate: flush lru cache for evicted inode Jan Kara
2024-06-17 11:24 ` Ryusuke Konishi
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=ZmxIvIJ3YSZDwbPW@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=hdanton@sina.com \
--cc=hughd@google.com \
--cc=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=syzbot+d79afb004be235636ee8@syzkaller.appspotmail.com \
/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