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
This commit is contained in:
Mark Johnston 2021-07-09 20:38:28 -04:00
parent b0dfc48684
commit 588c7a06df

View File

@ -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) \