mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC PATCH] mm: truncate: flush lru cache for evicted inode
@ 2024-06-14 13:18 Hillf Danton
  2024-06-14 13:42 ` Matthew Wilcox
  0 siblings, 1 reply; 14+ messages in thread
From: Hillf Danton @ 2024-06-14 13:18 UTC (permalink / raw)
  To: linux-mm
  Cc: Hugh Dickins, Matthew Wilcox, Johannes Weiner, Jan Kara,
	Andrew Morton, linux-kernel, syzbot+d79afb004be235636ee8,
	Hillf Danton

Flush lru cache to avoid folio->mapping uaf in case of inode teardown.

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);
 
--

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-06-23  5:11 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-14 13:18 [RFC PATCH] mm: truncate: flush lru cache for evicted inode Hillf Danton
2024-06-14 13:42 ` Matthew Wilcox
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-23  5:11           ` [PATCH 0/3] nilfs2: fix potential issues related to reserved inodes Ryusuke Konishi
2024-06-23  5:11             ` [PATCH 1/3] nilfs2: fix inode number range checks Ryusuke Konishi
2024-06-23  5:11             ` [PATCH 2/3] nilfs2: add missing check for inode numbers on directory entries Ryusuke Konishi
2024-06-23  5:11             ` [PATCH 3/3] nilfs2: fix incorrect inode allocation from reserved inodes Ryusuke Konishi
2024-06-17  7:57         ` [RFC PATCH] mm: truncate: flush lru cache for evicted inode Jan Kara
2024-06-17 11:24           ` Ryusuke Konishi

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®