Re: KMSAN and dtrace

From: Mark Johnston <markj_at_freebsd.org>
Date: Fri, 22 Nov 2024 14:07:22 UTC
On Thu, Nov 21, 2024 at 04:06:53PM -0700, Alan Somers wrote:
> Would it be possible to make dtrace with with KMSAN?  It would
> certainly make my life easier.  As it is, every time I try to kldload
> traceall, whether from the command line or in the loader, my VM
> infinite loops printing alerts like this:
> 
> MSan: Uninitialized stack memory from isize64+0x2e
> #0 0xffffffff833d8f10 at __msan_warning+0x140
> #1 0xffffffff86ec9c03 at dtrace_disp_opnd+0xd3
> #2 0xffffffff86ebe552 at dtrace_disx86+0xc602
> #3 0xffffffff86eca98e at dtrace_instr_size+0xee
> #4 0xffffffff86d5ec27 at fbt_provide_module_function+0x957
> #5 0xffffffff83303eff at link_elf_each_function_nameval+0x56f
> #6 0xffffffff86d56cb3 at fbt_provide_module+0x423
> #7 0xffffffff86d56871 at fbt_linker_file_cb+0x41
> #8 0xffffffff830d9f5c at linker_file_foreach+0xdc
> #9 0xffffffff830d63dd at linker_load_module+0x413d
> #10 0xffffffff830e6116 at linker_load_dependencies+0x1136
> #11 0xffffffff853b70b8 at link_elf_load_file+0x65c8
> #12 0xffffffff830d542e at linker_load_module+0x318e
> #13 0xffffffff830e0611 at kern_kldload+0x5d1
> #14 0xffffffff830e0d74 at sys_kldload+0x1a4
> #15 0xffffffff84fe56f6 at amd64_syscall+0x706
> #16 0xffffffff84f0ef4b at fast_syscall_common+0xf8
> 

Here you go:

https://cgit.freebsd.org/src/commit/?id=418d8f0dc269b314bba51de63869b20da1d9a76e
https://cgit.freebsd.org/src/commit/?id=cc3da1955c16df5eb0019e0fef810696b035b7cf

This one might also be important if your test system is low on RAM,
since the KMSAN shadow map gobbles up quite a lot of memory:

https://cgit.freebsd.org/src/commit/?id=5d12db2dafece9f6a0453c4a45c4abed6b1e15ec

I haven't yet tried running through the full test suite, but this was
enough to load dtracell (quite slow under KMSAN) and run some simple
scripts.