[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241017005105.3047458-1-jeffxu@chromium.org>
Date: Thu, 17 Oct 2024 00:51:03 +0000
From: jeffxu@...omium.org
To: akpm@...ux-foundation.org,
keescook@...omium.org,
torvalds@...ux-foundation.org,
usama.anjum@...labora.com,
corbet@....net,
Liam.Howlett@...cle.com,
lorenzo.stoakes@...cle.com
Cc: jeffxu@...gle.com,
jorgelo@...omium.org,
groeck@...omium.org,
linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org,
linux-mm@...ck.org,
jannh@...gle.com,
sroettger@...gle.com,
pedro.falcato@...il.com,
linux-hardening@...r.kernel.org,
willy@...radead.org,
gregkh@...uxfoundation.org,
deraadt@...nbsd.org,
surenb@...gle.com,
merimus@...gle.com,
rdunlap@...radead.org
Subject: [PATCH v1 0/2] mseal: fixing madvise for file-backed mapping and PROT_NONE
From: Jeff Xu <jeffxu@...gle.com>
Two fixes for madvise(MADV_DONTNEED) when sealed.
For PROT_NONE mappings, the previous blocking of
madvise(MADV_DONTNEED) is unnecessary. As PROT_NONE already prohibits
memory access, madvise(MADV_DONTNEED) should be allowed to proceed in
order to free the page.
For file-backed, private, read-only memory mappings, we previously did
not block the madvise(MADV_DONTNEED). This was based on
the assumption that the memory's content, being file-backed, could be
retrieved from the file if accessed again. However, this assumption
failed to consider scenarios where a mapping is initially created as
read-write, modified, and subsequently changed to read-only. The newly
introduced VM_WASWRITE flag addresses this oversight.
Jeff Xu (2):
mseal: Two fixes for madvise(MADV_DONTNEED) when sealed
selftest/mseal: Add tests for madvise
include/linux/mm.h | 2 +
mm/mprotect.c | 3 +
mm/mseal.c | 42 +++++++--
tools/testing/selftests/mm/mseal_test.c | 118 +++++++++++++++++++++++-
4 files changed, 157 insertions(+), 8 deletions(-)
--
2.47.0.rc1.288.g06298d1525-goog
Powered by blists - more mailing lists