Hello,
I am developing a kernel extenstion and I want to load it with kernel sanitizers in order to find potential bugs.
After downloading the Debug Kit for MacOS 10.13.5 (17F77) and changing the boot-args to load the kernel.kasan build, I am not able to get the kext compiled in xcode with asan support (Edit Schema -> Diagnostic -> Address Sanitizer) loaded.
Although I can successfully load com.apple.kpi.kasan (from System.kext), when loading my kext I get the following errors:
(kernel) kxld[com.test.kext]: The following symbols are unresolved for this kext:
(kernel) kxld[com.test.kext]: ___asan_after_dynamic_init
(kernel) kxld[com.test.kext]: ___asan_before_dynamic_init
(kernel) kxld[com.test.kext]: ___asan_init
(kernel) kxld[com.test.kext]: ___asan_memcpy
(kernel) kxld[com.test.kext]: ___asan_memset
(kernel) kxld[com.test.kext]: ___asan_option_detect_stack_use_after_return
(kernel) kxld[com.test.kext]: ___asan_register_image_globals
(kernel) kxld[com.test.kext]: ___asan_report_load1
(kernel) kxld[com.test.kext]: ___asan_report_load2
(kernel) kxld[com.test.kext]: ___asan_report_load4
(kernel) kxld[com.test.kext]: ___asan_report_load8
(kernel) kxld[com.test.kext]: ___asan_report_load_n
(kernel) kxld[com.test.kext]: ___asan_report_store1
(kernel) kxld[com.test.kext]: ___asan_report_store2
(kernel) kxld[com.test.kext]: ___asan_report_store4
(kernel) kxld[com.test.kext]: ___asan_report_store8
(kernel) kxld[com.test.kext]: ___asan_report_store_n
(kernel) kxld[com.test.kext]: ___asan_set_shadow_00
(kernel) kxld[com.test.kext]: ___asan_set_shadow_f5
(kernel) kxld[com.test.kext]: ___asan_set_shadow_f8
(kernel) kxld[com.test.kext]: ___asan_stack_free_5
(kernel) kxld[com.test.kext]: ___asan_stack_malloc_0
(kernel) kxld[com.test.kext]: ___asan_stack_malloc_1
(kernel) kxld[com.test.kext]: ___asan_stack_malloc_2
(kernel) kxld[com.test.kext]: ___asan_stack_malloc_3
(kernel) kxld[com.test.kext]: ___asan_stack_malloc_5
(kernel) kxld[com.test.kext]: ___asan_unregister_image_globals
(kernel) kxld[com.test.kext]: ___asan_version_mismatch_check_apple_902
(kernel) Can't load kext com.test.kext - link failed.
mini-mac:Debug user$ uname -a
Darwin mini-mac.local 17.6.0 Darwin Kernel Version 17.6.0: Tue May 8 15:22:16 PDT 2018;
root:xnu_kasan-4570.61.1~1/KASAN_X86_64 x86_64
Is it possible to force my kext resolve these symbols or another way to use AddressSanitizers on kernel extensions?