From nobody Fri Nov 22 20:58:39 2024 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Xw6sB5PCXz5dMX0 for ; Fri, 22 Nov 2024 20:58:54 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xw6sB3gC8z4ZbZ; Fri, 22 Nov 2024 20:58:54 +0000 (UTC) (envelope-from asomers@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5cfe5da1251so3091808a12.1; Fri, 22 Nov 2024 12:58:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732309131; x=1732913931; darn=freebsd.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=shChSQucrtkvr+pbrOhSvWqz8sdtoH+lOOerT9sR3mc=; b=D7ILAa9RTo09G+ozR9njij2736HP3b+07H12mK81+IqUb/1ZMwiHnzpfRJ8yLnxNdN bGSekNudlZ7+eU6LvVRekkpg/xwLcMgSmyU5JvhPyBfl1XXcK/+4J9bcp6uZvCcli5bK Ue6aOKQIl8l20r6iuIlPOGlTvgReyrNzh52swLeWmAsSoR67gpAWgJJxXUmQ6FEiAJn/ 3OhryBzscl5ESzXYL7Ur0NK12guebxVhGGcOtNTqiNbFblO5fT9/aWilF9kDQjM7xcWy h/UzmgiCTdlHaRobpykwAjO94VQTsuhj7qo0gRLn03NjmcRk6L2BptZ4/ePSzAhty+wK wEVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732309131; x=1732913931; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=shChSQucrtkvr+pbrOhSvWqz8sdtoH+lOOerT9sR3mc=; b=t8YHGWkaBNSTX1TiSlZLEFSprSxJ+llhvam8LY1VWjBeOmNxgrCShZqDnv6r+mefs2 R3c6MX4v3Z3VYysFC4HXmtgcR8sHwTzH66EpaFlMA82oXwiFSDT/78k/grSTBUBPyTrP J1cU9tpqpNxmDAlKOBf740kR4+wVnwv7dFXTM5UDpVTTSWOFSA3Rt/NIMQuHA+Qhk9xr uWbJOAf7lRgDvSe7JPDtKQ91b297A05eBvq1b8HG0sjrNme8ZnT3Ve2hmOmj9kYX0cYL 0HOuOaSKfYwchvORiODr4OyHMTDL5kiLUdiKgJ8nktoB5YRD6phURBg5Q6oMyvX3FiwR LtXg== X-Forwarded-Encrypted: i=1; AJvYcCWxmacb6AkXG4fzv+vuqUwlj1hsFDGjueP05u6foI1IE8vJn617+yRlPeKrXjdJ4Z0Yol238Eo07lq4dQi1cCA=@freebsd.org X-Gm-Message-State: AOJu0YwMa2GR/NegfN2DHHyu/KpefIHzKePt0OfobuPpTGFo1E5dJt3c 5f4kT4nMgDX24Y+uPZAnmxduXQW/KDFYl4SVbX/6aXTPfm4v2gUna/t/5ikiD9eSHvb8YGMYhMb WufMzQoQE76N4H7GZDZGKrCJmpkSLZl5h X-Gm-Gg: ASbGncufvH5lyKDNi2ia3/O7DBieab+3FfMbi501PPoEcDtZLHumpC4RVCT1GESG6OC bSVuejt1B1gCWYPdXMNC4GeryqkeeurA= X-Google-Smtp-Source: AGHT+IEP0Ha9bf9dOEiceSRSym4emaxORoLWNoiLuUfMvHnDauYqca2/kZKBMWQKjolMP/xm61X/ntFfe9Go8iUqPPA= X-Received: by 2002:a05:6402:42cb:b0:5cf:cfa8:d6bd with SMTP id 4fb4d7f45d1cf-5d0207995b0mr3629810a12.25.1732309131384; Fri, 22 Nov 2024 12:58:51 -0800 (PST) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org MIME-Version: 1.0 References: In-Reply-To: From: alan somers Date: Fri, 22 Nov 2024 13:58:39 -0700 Message-ID: Subject: Re: KMSAN and dtrace To: Alan Somers Cc: Mark Johnston , FreeBSD Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Queue-Id: 4Xw6sB3gC8z4ZbZ X-Spamd-Bar: ---- On Fri, Nov 22, 2024 at 7:47=E2=80=AFAM Alan Somers w= rote: > > On Fri, Nov 22, 2024 at 7:07=E2=80=AFAM Mark Johnston = 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=3D418d8f0dc269b314bba51de63869b= 20da1d9a76e > > https://cgit.freebsd.org/src/commit/?id=3Dcc3da1955c16df5eb0019e0fef810= 696b035b7cf > > > > 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=3D5d12db2dafece9f6a0453c4a45c4a= bed6b1e15ec > > > > 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()] =3D count();}' triggers warnings like this: 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