git: 224a01a34245 - stable/13 - KASAN: Implement __asan_unregister_globals()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 01 Nov 2021 14:33:14 UTC
The branch stable/13 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=224a01a34245a65ac3a40380d3e88559dc0ac9aa
commit 224a01a34245a65ac3a40380d3e88559dc0ac9aa
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-07-10 00:38:28 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-11-01 14:07:13 +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
(cherry picked from commit 588c7a06dffbc74b281dacbdd854437b0815e501)
---
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 d0478899e8c7..d3638ffb5dde 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) \