git: 588c7a06dffb - main - KASAN: Implement __asan_unregister_globals()
Mark Johnston
markj at FreeBSD.org
Sat Jul 10 00:48:14 UTC 2021
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=588c7a06dffbc74b281dacbdd854437b0815e501
commit 588c7a06dffbc74b281dacbdd854437b0815e501
Author: Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-07-10 00:38:28 +0000
Commit: Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-07-10 00:38:50 +0000
KASAN: Implement __asan_unregister_globals()
It will be called during KLD unload to unpoison the redzones following
global variables. Otherwise, virtual address ranges previously used for
a KLD may be left tainted, triggering false positives when they are
recycled.
Reported by: pho
Sponsored by: The FreeBSD Foundation
---
sys/kern/subr_asan.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c
index b812f7bca465..07f7b44d08d7 100644
--- a/sys/kern/subr_asan.c
+++ b/sys/kern/subr_asan.c
@@ -948,7 +948,12 @@ __asan_register_globals(struct __asan_global *globals, size_t n)
void
__asan_unregister_globals(struct __asan_global *globals, size_t n)
{
- /* never called */
+ size_t i;
+
+ for (i = 0; i < n; i++) {
+ kasan_mark(globals[i].beg, globals[i].size_with_redzone,
+ globals[i].size_with_redzone, 0);
+ }
}
#define ASAN_LOAD_STORE(size) \
More information about the dev-commits-src-all
mailing list