Still happy with this. I'll rebase the riscv fixes on top of this once it gets committed and push them as wel.
- Queries
- All Stories
- Search
- Advanced Search
- Transactions
- Transaction Logs
Advanced Search
Jan 10 2021
Candidate commit message (will update Reviewed by notes as needed):
Updates to candidate commit message.
- Since non-aarch64 haven't required a memcpy() exclusion in the past, don't exclude it now.
Various fixes to the DTrace FBT provider on FreeBSD/arm64:
Jan 4 2021
Jan 1 2021
Dec 27 2020
Dec 26 2020
Dec 24 2020
Feb 5 2020
LGTM
Nov 18 2019
Nov 17 2019
Actually initialize uses_funcdesc properly.
Nov 16 2019
May 20 2019
Aug 6 2018
Aug 4 2018
May 12 2018
May 9 2018
Given the simplicity of this unwinding code, I think it's reasonable to just keep it inline like we do on amd64. DTrace reimplements quite a lot of "standard" code for the same reason as we do here.
May 8 2018
Preemptively remove a redundant check for INKERNEL(fp).
In D15359#323676, @andrew wrote:Why not just exclude it in fbt_provide_module_function? I'd prefer we keep the unwinding code together, maybe with a comment that it may be called from such a context.
Why not just exclude it in fbt_provide_module_function? I'd prefer we keep the unwinding code together, maybe with a comment that it may be called from such a context.
In D15359#323666, @markj wrote:however, in the future a patch that enabled instrumentation of inlined functions could accidentally break DTrace on aarch64.
Was the problem found while working on such a patch? :)
however, in the future a patch that enabled instrumentation of inlined functions could accidentally break DTrace on aarch64.
Ok for me, also tested on pine64
Apr 27 2018
Apr 13 2018
Apr 12 2018
I think this should be fine. Can always be tweaked later.
Is this good to land? Thanks!
Mar 28 2018
Seems ok to me.
Should I make any more changes for this to land? As an aside note: I've tried to make the interface as simple as possible to use with the args[0-2] being consistent.
Mar 18 2018
Adding Tycho to this.
Mar 11 2018
Jan 12 2018
Thanks. I'll commit this later tonight.
Address the comments by markj@ and add tests in safety/ for jailname and jid.
Looks ok to me, thanks. Did you end up writing test cases for safety/ as we discussed on IRC?
After you explained that zonename is for compatibility, making it easier to port scripts from Solaris, this seems like a good change. Thank you for you hard work. Cheers!
Update the diff to add more context. No actual code was changed.
In D13877#290934, @dteske wrote:In D13877#290818, @domagoj.stolfa_gmail.com wrote:In D13877#290812, @dteske wrote:Tracing on a per-jail basis using a predicate was already possible (example below):
someprobe /curthread->td_proc->p_ucred->cr_prison->pr_id == $1/ { /* some actions */ }That's true, however, this exposes a stable interface that people can use without following pointers in the D script and instead simply calling into a builtin variable. I'd imagine this is the same reason why you would want to have execname, errno, uid, gid and others, as they can also be accessible via other, more primitive builtins.
Don't get me wrong, I like the analog to Solaris's zonename and thus think jailname and jid are good additions.
I just wanted to point out that curthread already gives us access to far more details than the few given at the top-level.
Programs like "dwatch" (reviews.freebsd.org/D10006) make it possible to access not-only curthread details but the details of the parent, grandparent, and ancestor process(es), and thus the ability to trace a jail is neither novel nor unique.
If you're ever looking for inspiration on other top-level variables that might be nice-to-haves without having to crawl curthread->td_proc (as dwatch does), give dwatch a trial run.
I just noticed that the ifdef for solaris was removed, resulting in the declaration of zonename. Was this intentional, and if-so, why?
In D13877#290818, @domagoj.stolfa_gmail.com wrote:In D13877#290812, @dteske wrote:Tracing on a per-jail basis using a predicate was already possible (example below):
someprobe /curthread->td_proc->p_ucred->cr_prison->pr_id == $1/ { /* some actions */ }That's true, however, this exposes a stable interface that people can use without following pointers in the D script and instead simply calling into a builtin variable. I'd imagine this is the same reason why you would want to have execname, errno, uid, gid and others, as they can also be accessible via other, more primitive builtins.
Jan 11 2018
In D13877#290812, @dteske wrote:Tracing on a per-jail basis using a predicate was already possible (example below):
someprobe /curthread->td_proc->p_ucred->cr_prison->pr_id == $1/ { /* some actions */ }
Tracing on a per-jail basis using a predicate was already possible (example below):
Mar 27 2017
Feb 23 2017
Perfect :)
By my opinion, kernel should call dtrace_trap_func () only in unresolvable kernel trap case, as alternative to panic.
Something like: oups, dtrace probe causes panic, recovery me.
Confirmed that calling dtrace_trap_func from abort_fatal() is correct (my mistake).
In D9701#201579, @meloun-miracle-cz wrote:In my example a malformed script results in a memory access to 0x02. The resulting translation fault brings the system down. This should not happen.
Yes, due to missing FAULT_TRAN_L[1][2]: case in dtrace_trap().
dtrace_trap() tests whether the system is in probe context, by checking the flag cpu_core[curcpu].cpuc_dtrace_flags & CPU_DTRACE_NOFAULT. If this is set the translation fault should not be handled by the normal code path, instead the DTrace error probe should fire and the DTrace script resume processing.
In the original code dtrace_trap() was called from abort_fatal(). abort_fatal() is never called for translation faults (or alignment faults). It would be possible to populate the aborts array with handlers that call dtrace_trap() infor L1 and L2 translation faults and alignment faults, but I think that this is a bit messy.
I don't agree here. All fatal traps ends in abort_fatal(), including all translation or alignment faults.
Kernel mode FAULT_TRAN_L[1][2] traps calls abort_fatal() at line 501.Other architectures handling dtrace_trap() immediately on entering the trap handler (I'll expand on this point when replying to the other comment).
But other architectures doesn't emulates access or modify bits in SW. In peaks, quadcore ARM can easily get over 100k/sec of traps, filtered down (by pmap_fault()) to 3~5 k of 'real' ones.
But again, are you're really sure that calling dtrace probe for trap caused by swapped out page(for example) and thus fully covered by vm_fault() is right one?
In other words, can dtrace probe handle these 'false alarms' ?
In my opinion no, at least not on ARM.In any case, I haven't a single problem if you put dtrace hook anywhere behind the line 352.
In my example a malformed script results in a memory access to 0x02. The resulting translation fault brings the system down. This should not happen.
Yes, due to missing FAULT_TRAN_L[1][2]: case in dtrace_trap().
In D9701#201533, @meloun-miracle-cz wrote:Can you be, please, little more specific for
"abort_handler - didn't call the dtrace_trap() function early enough to handle faults caused by DTrace " ?Which faults are not handled if KDTRACE_HOOKS is on original location?
I'm only curious here, and my knowledge of DTRACE are very limited. But are you sure that DTRACE wants to see faults, possibly handled by vm_fault()? Or by pcb_onfault()... ?
Can you be, please, little more specific for
"abort_handler - didn't call the dtrace_trap() function early enough to handle faults caused by DTrace " ?
Feb 21 2017
Feb 18 2017
Feb 3 2017
Feb 2 2017
Feb 1 2017
Jan 13 2017
Review comments addressed.
Jan 6 2017
This seems fine to me - aside from the licensing, my comments are all style nits.
Jan 5 2017
Oct 3 2016
Aug 7 2016
Jul 28 2016
Jan 27 2016
Jul 25 2015
This was committed.
This was committed.
Jul 19 2015
Jul 7 2015
Jul 5 2015
- Fix the !KDTRACE_HOOKS build.
- Fix the !KDTRACE_HOOKS build.
Jun 30 2015
Fixed in r284964