The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=588c7a06dffbc74b281dacbdd854437b0815e501

commit 588c7a06dffbc74b281dacbdd854437b0815e501
Author:     Mark Johnston <[email protected]>
AuthorDate: 2021-07-10 00:38:28 +0000
Commit:     Mark Johnston <[email protected]>
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)                                  \
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to