Re: Instruction-level dynamic tracing

From: Lorenzo Salvadore <phascolarctos_at_protonmail.ch>
Date: Sat, 01 Oct 2022 17:34:45 UTC
------- Original Message -------
On Saturday, October 1st, 2022 at 18:00, Christos Margiolis <christos@freebsd.org> wrote:


> 
> 
> Hello,
> 
> Me and markj@ implemented a new DTrace provider (kinst) that allows for
> arbitrary kernel instruction tracing. The provider is currently
> implemented only for amd64, but we plan to port it to other
> architectures in the future as well.
> 
> kinst probes take the form of:
> 
> kinst:<module>:<function>:<offset>
> 
> 
> where "function" is the kernel function to be traced, and "offset" is
> the offset to a specific instruction. This offset can be obtained from
> the function's disassembly using kgdb.
> 
> For example, if I want to trace the second instruction in
> amd64_syscall(), I first need to figure out the offset to the
> second instruction:
> 
> # kgdb
> (kgdb) disas /r amd64_syscall
> Dump of assembler code for function amd64_syscall:
> 0xffffffff809256c0 <+0>: 55 push %rbp
> 
> 0xffffffff809256c1 <+1>: 48 89 e5 mov %rsp,%rbp
> 
> 0xffffffff809256c4 <+4>: 41 57 push %r15
> 
> 
> The offset is 1. To trace it:
> 
> # dtrace -n 'kinst::amd64_syscall:1'
> 
> Final code review: https://reviews.freebsd.org/D36851
> Any review of the code would be appreciated.

The project seems very interesting. Have you considered sharing it through
quarterly status reports? Quarterly status reports can help increasing the
visibility of your work and thus you might get more reviewing for your code.

Technically the deadline for submitting 2022q3 reports was yesterday, but
as a member of the quarterly team I can tell you that we can wait for you
if you want to submit a report: just tell us that it is coming and we will
wait.

Here you can find details on how to submit a report:
https://github.com/freebsd/freebsd-quarterly

As for the text of your report, I think the text of your mail is already
good as a first draft for starting the report reviewing process.

Cheers,

Lorenzo Salvadore