Date: Wed, 31 Oct 2018 14:46:43 -0400 From: Mark Johnston <markj@freebsd.org> To: Andreas Longwitz <longwitz@incore.de> Cc: "freebsd-dtrace@freebsd.org" <freebsd-dtrace@freebsd.org> Subject: Re: Why my DTrace script does not work after installing a new kernel without reboot Message-ID: <20181031184643.GA1686@spy> In-Reply-To: <5BD9F001.9090603@incore.de> References: <5BD4E965.9040006@incore.de> <20181027225339.GA4191@spy> <5BD9F001.9090603@incore.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Oct 31, 2018 at 07:10:09PM +0100, Andreas Longwitz wrote: > In the meantime I found the answer to my question. > > > Does your patch change the layout of the timeout structure? If so, the > > problem is that dtrace(1) is using the CTF from kern.bootfile, but that > > doesn't match the layout of the structures used by the running kernel. > > dtrace() gets the CTF of the kernel and kernel modules from the > pathbames returned by kldstat(2). In my case they all start with > '/boot/kernel/' because the kernel was loaded from that place. This can > be veryfied with 'kldstat -v'. The output does not change after buildung > a new kernel and the kernel itself does nit use the variable > kern.bootfile. I see, thanks for digging into it. I suspect that the real solution is to ensure that CTF files are mapped into the kernel's address space when an object is loaded, and provide an interface for userland to fetch CTF files for the running kernel. We've talked about doing this before, but I'm a bit unhappy about the extra memory consumption; the compressed CTF file for the kernel's file alone on my laptop is slightly under 1MB in size. Maybe that's not worth worrying about. Note that the same bug exists today in the kernel: link_elf_ctf_get() fetches a CTF file using the path cached in the KLD structure, i.e., the path exported by kldstat -v. At present, the kernel only uses CTF to fill out type info when creating FBT probes, so it's not a major problem.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20181031184643.GA1686>