[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240614131856.754-1-hdanton@sina.com>
Date: Fri, 14 Jun 2024 21:18:56 +0800
From: Hillf Danton <hdanton@...a.com>
To: linux-mm@...ck.org
Cc: Hugh Dickins <hughd@...gle.com>,
Matthew Wilcox <willy@...radead.org>,
Johannes Weiner <hannes@...xchg.org>,
Jan Kara <jack@...e.cz>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org,
syzbot+d79afb004be235636ee8@...kaller.appspotmail.com,
Hillf Danton <hdanton@...a.com>
Subject: [RFC PATCH] mm: truncate: flush lru cache for evicted inode
Flush lru cache to avoid folio->mapping uaf in case of inode teardown.
Reported-and-tested-by: syzbot+d79afb004be235636ee8@...kaller.appspotmail.com
Signed-off-by: Hillf Danton <hdanton@...a.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);
--
Powered by blists - more mailing lists