]> www.infradead.org Git - users/jedix/linux-maple.git/commit
dtrace: comtinuing the FBT implementation and fixes
authorKris Van Hees <kris.van.hees@oracle.com>
Wed, 1 Mar 2017 04:37:11 +0000 (23:37 -0500)
committerKris Van Hees <kris.van.hees@oracle.com>
Wed, 8 Mar 2017 20:21:28 +0000 (15:21 -0500)
commit6bd26f8d9d2acb7b1a5153f4168cf0e923b5d3b1
treee0fe8b7a55a22f11f266a726b677ccd1e6707c34
parentd35f166d01a32ae3579b9c44b6cb62bdff0b257b
dtrace: comtinuing the FBT implementation and fixes

This commit continues the implementation of Function Boundary Tracing
(FBT) and fixes various problems with the original implementation and
other things in DTrace that it caused to break.  It is done as a single
commit due to the intertwined nature of the code it touches.

1. We were only handling unaligned memory access traps as part of the
   NOFAULT access protection.  This commit adds handling data and
   instruction access trap handling.

2. When an OOPS takes place, we now add output about whether we are
   in DTrace probe context and what the last probe was that was being
   processed (if any).  That last data item isn't guaranteed to always
   have a valid value.  But it is helpful.

3. New ustack stack walker implementation (moved from module to kernel
   for consistency and because we need access to low level structures
   like the page tables) for both x86 and sparc.  The new code avoids
   any locking or sleeping.  The new user stack walker is accessed as
   as sub-function of dtrace_stacktrace(), selected using the flags
   field of stacktrace_state_t.

4. We added a new field to the dtrace_psinfo_t structure (ustack) to
   hold the bottom address of the stack.  This is needed in the stack
   walker (specifically for x86) to know when we have reached the end
   of the stack.  It is initialized from copy_process (in DTrace
   specific code) when stack_start is passed as parameter to clone.
   It is also set from dtrace_psinfo_alloc() (which is generally called
   from performing an exec), and there it gets its value from the
   mm->start_stack value.

5. The FBT black lists have been updated with functions that may be
   invoked during probe processing.  In addition, for x86_64 we added
   explicit filter out of functions that start with insn_* or inat_*
   because they are used for instruction analysis during probe
   processing.

6. On sparc64, per-cpu data gets access by means of a global register
   that holds the base address for this memory area.  Some assembler
   code clobbers that register in some cases, so it is not safe to
   depend on this in probe context.  Instead, we explicitly access
   the data based on the smp_processor_id().

7. We added a new CPU DTTrace flag (CPU_DTRACE_PROBE_CTX) to flag that
   we are processing in DTrace probe context.  It is primarily used
   to detect attempts of re-entry into dtrace_probe().

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Acked-by: Nick Alcock <nick.alcock@oracle.com>
Orabug: 21220305
Orabug: 24829326
12 files changed:
arch/sparc/include/asm/dtrace_util.h
arch/sparc/kernel/dtrace_util.c
arch/sparc/kernel/fbt_blacklist.h
arch/x86/include/asm/dtrace_util.h
arch/x86/kernel/dtrace_fbt.c
arch/x86/kernel/dtrace_util.c
arch/x86/kernel/fbt_blacklist.h
include/linux/dtrace_cpu_defines.h
include/linux/dtrace_os.h
include/linux/dtrace_psinfo.h
kernel/dtrace/dtrace_os.c
kernel/fork.c