From nobody Sat Nov 23 02:37:32 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 4XwGN11Q9pz5dmMx for ; Sat, 23 Nov 2024 02:37:37 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qv1-xf32.google.com (mail-qv1-xf32.google.com [IPv6:2607:f8b0:4864:20::f32]) (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 4XwGN05hXVz46Vx; Sat, 23 Nov 2024 02:37:36 +0000 (UTC) (envelope-from markjdb@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-qv1-xf32.google.com with SMTP id 6a1803df08f44-6d40d77aa97so19094416d6.1; Fri, 22 Nov 2024 18:37:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732329456; x=1732934256; darn=freebsd.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:sender :from:to:cc:subject:date:message-id:reply-to; bh=o1rup4zbYwtH6MgmiQvQMbOwumWdkYEVZAJxhiN6cVQ=; b=jq/CAOvGPw029i6SD5vFpvpqT5jlEcXsmZ85c57tMy/pgGTpxumJQzWIc3WmR7KTqv ua6QET6Me0SNkQzd4uN0Exg+m05wksLbAkrrvQgE0B2pC2dg5Mcl1VIpHdIAoujOMBHo p8gj/WKCDluy4EnIUC0xmf0mfqJinvgkCOQnLqsvdBdSfMFwrOkxU42bhiiFb9gGUxor 5grAYSHM/5MtTJtcC0FBLEydFRIsUKyfkj4ZKtBMgMv6663ufsEsKVBZW7um1fCsBuxb ZXEXoW/aM5MM9eR4M6xVSqKX2xuYwfk2OhkebeJDqBc9K8OCPGcb1uxNoFwU8+yMWr2w K7eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732329456; x=1732934256; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=o1rup4zbYwtH6MgmiQvQMbOwumWdkYEVZAJxhiN6cVQ=; b=NxhD+YG4xkc5GxmMfuSthQdNLGPvLOMdKonzNZ8AoIEaPhz4NK0dIr9E9Zauo9snp7 c5L8ZnILgIRRFnXQ2b9MqX1swfMEo5VOKIz8mcbOiLI5xl7fzvsZkDeXncRM0lK+++Sd i0OyYTcOstZwQvoPlwZEWTPN1s3ZIWcoxEphcqIiAZ/PRg3hLYXel0AqY2wtBE13Hs5c Wz86+T0C/aPwwbN3wbZoWRxF8agdWbE60lIDIYSXES9UxdHZc6UDlVQRQC3mqbRpmdHh nap94aMCX1RoNpHd32LsJ3HEL9Q+pc1irFZYtIs4ddbsKAbAcnj2KU2RQXzStmz038qu tAGQ== X-Forwarded-Encrypted: i=1; AJvYcCXJCVSqfNthKlfuafLsKzXMeVuSG6qzMhePBB+AsusRqoL2dXHrNU9sO8D/3FHYhexXsdwhvZZGcUnCKYiEGs8=@freebsd.org X-Gm-Message-State: AOJu0YzjQkLZ5G9MFsOUyTeUTR8VBenUo+AQC7/52KvOC5VraziiUSof PdtgfDAEEdymstycw+bpMWj0pUXkabaDa0hINj+GwOv4/v7vaSR7+CfTew== X-Gm-Gg: ASbGnctOgDaKXTUp7eMAiXtKEg4RrKci31mvmg3r7tsJJ9eUz012Mcb8k5TpNBtrnYy K1Ba44i8cb7iZ0YvsNiSa/AtTOaMBkF569NIFIjUyYHROzgLKiVOADJsWcCI8qcxiu1lvD++Nsn MaB1be/x3JzyNMa7thnmEnDOJBwosbMMUZ9HxSnvLRIJds7lfGKQV3uJbYpnRvPDX5EuS2vT1/r olvePQEiObbqcqO1jJ4qZHTifD8BCHksCC17DFQe8YHtaRRvMsx/HNKSOv5YpwX X-Google-Smtp-Source: AGHT+IHPbzCDVs2BTkn8FldGmFYsjKZduTQwSZ8f1hO7YfZEu0AhwelRPSzD2hT5zkIQ6sdel/NSkg== X-Received: by 2002:a05:6214:29c3:b0:6d4:215d:91c3 with SMTP id 6a1803df08f44-6d450eaf8c1mr89452646d6.28.1732329455846; Fri, 22 Nov 2024 18:37:35 -0800 (PST) Received: from nuc (192-0-220-237.cpe.teksavvy.com. [192.0.220.237]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b51415286esm145256885a.101.2024.11.22.18.37.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 18:37:34 -0800 (PST) Date: Fri, 22 Nov 2024 21:37:32 -0500 From: Mark Johnston To: alan somers Cc: Alan Somers , FreeBSD Hackers Subject: Re: KMSAN and dtrace Message-ID: References: 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 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4XwGN05hXVz46Vx X-Spamd-Bar: ---- On Fri, Nov 22, 2024 at 01:58:39PM -0700, alan somers wrote: > On Fri, Nov 22, 2024 at 7:47 AM Alan Somers wrote: > > > > On Fri, Nov 22, 2024 at 7:07 AM 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=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