From: Marco Elver <elver@google.com>
To: elver@google.com, akpm@linux-foundation.org
Cc: glider@google.com, dvyukov@google.com, andreyknvl@google.com,
jannh@google.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, kasan-dev@googlegroups.com
Subject: [PATCH mm] kfence: zero guard page after out-of-bounds access
Date: Fri, 12 Mar 2021 13:16:53 +0100 [thread overview]
Message-ID: <20210312121653.348518-1-elver@google.com> (raw)
After an out-of-bounds accesses, zero the guard page before
re-protecting in kfence_guarded_free(). On one hand this helps make the
failure mode of subsequent out-of-bounds accesses more deterministic,
but could also prevent certain information leaks.
Signed-off-by: Marco Elver <elver@google.com>
---
mm/kfence/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/mm/kfence/core.c b/mm/kfence/core.c
index 3b8ec938470a..f7106f28443d 100644
--- a/mm/kfence/core.c
+++ b/mm/kfence/core.c
@@ -371,6 +371,7 @@ static void kfence_guarded_free(void *addr, struct kfence_metadata *meta, bool z
/* Restore page protection if there was an OOB access. */
if (meta->unprotected_page) {
+ memzero_explicit((void *)ALIGN_DOWN(meta->unprotected_page, PAGE_SIZE), PAGE_SIZE);
kfence_protect(meta->unprotected_page);
meta->unprotected_page = 0;
}
--
2.31.0.rc2.261.g7f71774620-goog
next reply other threads:[~2021-03-12 12:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-12 12:16 Marco Elver [this message]
2021-03-12 13:11 ` [PATCH mm] kfence: zero guard page after out-of-bounds access Alexander Potapenko
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=20210312121653.348518-1-elver@google.com \
--to=elver@google.com \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@google.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=jannh@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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).