Re: KMSAN and dtrace
- In reply to: alan somers : "Re: KMSAN and dtrace"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 23 Nov 2024 02:37:32 UTC
On Fri, Nov 22, 2024 at 01:58:39PM -0700, alan somers wrote: > On Fri, Nov 22, 2024 at 7:47 AM Alan Somers <asomers@freebsd.org> wrote: > > > > On Fri, Nov 22, 2024 at 7:07 AM Mark Johnston <markj@freebsd.org> wrote: > > > > > > 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. > > > > Wow, thanks! I'll try it out later today. > > It works now. I can load the module and do some probes. Other > probes, though, still trigger warnings. For instance, > 'fbt:zfs:zio_data_buf_alloc:entry {@z[stack()] = count();}' triggers > warnings like this: I believe this is resolved by commit fdeb273d49bf2fa2544d3c98114859db10385550. > MSan: Uninitialized stack memory in copyout():arg1, offset 24/368, > addr 0xfffffe00b68ae018, from w_stillcold+0x28 > #0 0xffffffff8340009c at kmsan_report_hook+0x15c > #1 0xffffffff833dbc61 at kmsan_copyout+0x1f1 > #2 0xffffffff87e800f0 at dtrace_ioctl+0x4420 > #3 0xffffffff8297795f at devfs_ioctl+0x3ef > #4 0xffffffff8547c277 at VOP_IOCTL_APV+0x107 > #5 0xffffffff8381f974 at vn_ioctl+0x7a4 > #6 0xffffffff8297a0f6 at devfs_ioctl_f+0x186 > #7 0xffffffff834f3c2b at kern_ioctl+0xc5b > #8 0xffffffff834f2dc0 at sys_ioctl+0x580 > #9 0xffffffff84fe7836 at amd64_syscall+0x706 > #10 0xffffffff84f1128b at fast_syscall_common+0xf8