Skip to contentSkip to conversation

perf updates for v3.16, #2

GIT PULL Ingo Molnar 1 participant 1 message Jun 12, 2014

Subsystems (20)
Documentation Arm (32-bit) x86 VFS +16 more subsystems
lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest perf-core-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-core-for-linus

# HEAD: 82b897782d10fcc4930c9d4a15b175348fdd2871 perf: Differentiate exec() and non-exec() comm events

A second round of perf updates:

- wide reaching kprobes sanitization and robustization, with the hope of fixing all 'probe this function crashes the kernel' bugs, by Masami Hiramatsu.

- uprobes updates from Oleg Nesterov: tmpfs support, corner case fixes and robustization work.

- perf tooling updates and fixes from Jiri Olsa, Namhyung Ki, Arnaldo et al:

* Add support to accumulate hist periods (Namhyung Kim)
* various fixes, refactorings and enhancements

Thanks,

Ingo

------------------>
Adrian Hunter (1):
perf: Differentiate exec() and non-exec() comm events

Alexander Yarygin (3):
perf tools: Parse tracepoints with '-' in system name perf tests: Add numeric identifier to evlist_test perf tests: Add a test of kvm-390: trace event

Anshuman Khandual (4):
perf: Add new conditional branch filter 'PERF_SAMPLE_BRANCH_COND' perf/tool: Add conditional branch filter 'cond' to perf record perf/x86: Add conditional branch filtering support perf/documentation: Add description for conditional branch filter

Arnaldo Carvalho de Melo (4):
perf tools: Allocate thread map_groups's dynamically
perf tools: Reference count map_groups objects
perf trace: Warn the user when not available
perf tools: Add warning when disabling perl scripting support due to missing devel files

Borislav Petkov (4):
perf tools: Move u64_swap union
tools: Unify export.h
tools: Consolidate types.h perf/events/core: Drop unused variable after cleanup

Cody P Schafer (1):
perf tools: Allow overriding sysfs and proc finding with env var

Denys Vlasenko (3):
uprobes/x86: Refuse to attach uprobe to "word-sized" branch insns uprobes/x86: Simplify rip-relative handling uprobes/x86: Fix scratch register selection for rip-relative fixups

Don Zickus (4):
perf tools: Allow ability to map cpus to nodes easily perf tools: Use cpu/possible instead of cpu/kernel_max perf kmem: Utilize the new generic cpunode_map
perf callchain: Add generic report parse callchain callback function

Dongsheng (3):
perf tools: Add missing event for perf sched record.
perf tools: Adapt the TASK_STATE_TO_CHAR_STR to new value in kernel space. perf tools: Clarify the output of perf sched map.

Dongsheng Yang (2):
perf sched: Remove nr_state_machine_bugs in perf latency perf sched: Cleanup, remove unused variables in map_switch_event()

Jean Pihet (5):
perf tools ARM64: Wire up perf_regs and unwind support perf tools: Consolidate types.h for ARM and ARM64 perf tests: Introduce perf_regs_load function on ARM perf tests: Add dwarf unwind test on ARM
perf tools: Add libdw DWARF post unwind support for ARM

Jianyu Zhan (1):
perf tools: Fix 'make help' message error

Jiri Olsa (17):
perf tools: Fix pmu object compilation error
perf tests: Add thread maps lookup automated tests perf tools: Share map_groups among threads of the same group perf tests: Add map groups sharing with thread object test perf tools: Remove MAX_COUNTERS define from perf.h perf tools: Remove unlikely define from perf.h
perf tools: Remove min define from perf.h
perf tools: Remove asmlinkage define from perf.h perf tools: Remove PR_TASK_PERF_EVENTS_* from perf.h perf tools: Move sample data structures from perf.h perf tools: Move perf_call_graph_mode enum from perf.h perf tools: Move syscall and arch specific defines from perf.h perf tools: Move sys_perf_event_open function from perf.h perf tools: Move ACCESS_ONCE from perf.h header perf tools: Remove elide setup for SORT_MODE__MEMORY mode perf tools: Move elide bool into perf_hpp_fmt struct perf record: Fix poll return value propagation

Masami Hiramatsu (18):
kprobes/x86: Allow to handle reentered kprobe on single-stepping
kprobes: Prohibit probing on .entry.text code
kprobes: Introduce NOKPROBE_SYMBOL() macro to maintain kprobes blacklist kprobes, x86: Prohibit probing on debug_stack_*()
kprobes, x86: Prohibit probing on native_set_debugreg()/load_idt() kprobes, x86: Prohibit probing on thunk functions and restore kprobes/x86: Call exception handlers directly from do_int3/do_debug kprobes, x86: Call exception_enter after kprobes handled kprobes/x86: Allow probe on some kprobe preparation functions
kprobes: Allow probe on some kprobe functions
kprobes, ftrace: Allow probing on some functions
kprobes, x86: Allow kprobes on text_poke/hw_breakpoint kprobes, x86: Use NOKPROBE_SYMBOL() instead of __kprobes annotation
kprobes: Use NOKPROBE_SYMBOL macro instead of __kprobes kprobes, ftrace: Use NOKPROBE_SYMBOL macro in ftrace kprobes, notifier: Use NOKPROBE_SYMBOL macro in notifier kprobes, sched: Use NOKPROBE_SYMBOL macro in sched
kprobes: Show blacklist entries via debugfs

Masanari Iida (1):
perf session: Fix possible null pointer dereference in session.c

Michael Lentine (2):
perf tools: Add cat as fallback pager
perf tools: Add automatic remapping of Android libraries

Namhyung Kim (71):
perf hists: Add support for showing relative percentage
perf report: Add --percentage option
perf top: Add --percentage option
perf diff: Add --percentage option
perf tools: Add hist.percentage config option
perf ui/tui: Add 'F' hotkey to toggle percentage output
perf tools: Show absolute percentage by default
perf report: Count number of entries separately
perf hists: Rename hists__inc_stats()
perf hists: Move column length calculation out of hists__inc_stats() perf hists: Add a couple of hists stat helper functions
perf hists: Collapse expanded callchains after filter is applied perf tools: Account entry stats when it's added to the output tree perf hists: Add missing update on filtered stats in hists__decay_entries() perf ui/tui: Fix off-by-one in hist_browser__update_nr_entries() perf ui/tui: Rename hist_browser__update_nr_entries()
perf top/tui: Update nr_entries properly after a filter is applied perf hists/tui: Count callchain rows separately
perf tests: Factor out fake_setup_machine()
perf tests: Add a test case for hists filtering
perf tools: Handle EINTR error for readn/writen
perf record: Propagate exit status of a command line workload perf tools: Get rid of on_exit() feature test
perf tools: Use tid for finding thread
perf tools: Add ->cmp(), ->collapse() and ->sort() to perf_hpp_fmt perf tools: Convert sort entries to hpp formats
perf tools: Use hpp formats to sort hist entries
perf tools: Support event grouping in hpp ->sort()
perf tools: Use hpp formats to sort final output
perf tools: Consolidate output field handling to hpp format routines perf ui: Get rid of callback from __hpp__fmt()
perf tools: Allow hpp fields to be sort keys
perf tools: Consolidate management of default sort orders perf tools: Call perf_hpp__init() before setting up GUI browsers perf report: Add -F option to specify output fields
perf tools: Add ->sort() member to struct sort_entry
perf report/tui: Fix a bug when --fields/sort is given
perf top: Add --fields option to specify output fields
perf tools: Skip elided sort entries
perf hists: Reset width of output fields with header length perf tools: Get rid of obsolete hist_entry__sort_list
perf tools: Introduce reset_output_field()
perf tests: Factor out print_hists_*()
perf tests: Add a testcase for histogram output sorting
perf tools: Introduce hists__inc_nr_samples()
perf tools: Introduce struct hist_entry_iter
perf hists: Add support for accumulated stat of hist entry perf hists: Check if accumulated when adding a hist entry perf hists: Accumulate hist entry stat based on the callchain perf tools: Update cpumode for each cumulative entry
perf report: Cache cumulative callchains
perf callchain: Add callchain_cursor_snapshot()
perf tools: Save callchain info for each cumulative entry perf ui/hist: Add support to accumulated hist stat
perf ui/browser: Add support to accumulated hist stat
perf ui/gtk: Add support to accumulated hist stat
perf tools: Apply percent-limit to cumulative percentage
perf tools: Add more hpp helper functions
perf report: Add --children option
perf report: Add report.children config option
perf tools: Do not auto-remove Children column if --fields given perf tools: Add callback function to hist_entry_iter
perf top: Convert to hist_entry_iter
perf top: Add --children option
perf top: Add top.children config option
perf tools: Enable --children option by default
perf ui/stdio: Fix invalid percentage value of cumulated hist entries perf ui/gtk: Fix callchain display
perf tools: Reset output/sort order to default
perf tests: Define and use symbolic names for fake symbols perf tests: Add a test case for cumulating callchains

Oleg Nesterov (48):
uprobes: Kill UPROBE_SKIP_SSTEP and can_skip_sstep()
uprobes/x86: Fold prepare_fixups() into arch_uprobe_analyze_insn()
uprobes/x86: Kill the "ia32_compat" check in handle_riprel_insn(), remove "mm" arg uprobes/x86: Gather "riprel" functions together
uprobes/x86: move the UPROBE_FIX_{RIP,IP,CALL} code at the end of pre/post hooks uprobes/x86: Introduce uprobe_xol_ops and arch_uprobe->ops
uprobes/x86: Conditionalize the usage of handle_riprel_insn()
uprobes/x86: Send SIGILL if arch_uprobe_post_xol() fails
uprobes/x86: Teach arch_uprobe_post_xol() to restart if possible
uprobes/x86: Introduce sizeof_long(), cleanup adjust_ret_addr() and arch_uretprobe_hijack_return_addr() uprobes/x86: Emulate unconditional relative jmp's
uprobes/x86: Emulate nop's using ops->emulate()
uprobes/x86: Emulate relative call's
uprobes/x86: Emulate relative conditional "short" jmp's
uprobes/x86: Emulate relative conditional "near" jmp's
uprobes/x86: Add uprobe_init_insn(), kill validate_insn_{32,64}bits()
uprobes/x86: Add is_64bit_mm(), kill validate_insn_bits()
uprobes/x86: Shift "insn_complete" from branch_setup_xol_ops() to uprobe_init_insn() uprobes/x86: Make good_insns_* depend on CONFIG_X86_*
uprobes/x86: Fix is_64bit_mm() with CONFIG_X86_X32
uprobes/x86: Don't change the task's state if ->pre_xol() fails
uprobes/x86: Introduce uprobe_xol_ops->abort() and default_abort_op()
uprobes/x86: Don't use arch_uprobe_abort_xol() in arch_uprobe_post_xol()
uprobes/x86: Move UPROBE_FIX_SETF logic from arch_uprobe_post_xol() to default_post_xol_op() uprobes/x86: Move default_xol_ops's data into arch_uprobe->def
uprobes/x86: Cleanup the usage of arch_uprobe->def.fixups, make it u8
uprobes/x86: Introduce push_ret_address()
uprobes/x86: Kill adjust_ret_addr(), simplify UPROBE_FIX_CALL logic
uprobes/x86: Cleanup the usage of UPROBE_FIX_IP/UPROBE_FIX_CALL
uprobes/x86: Rename *riprel* helpers to make the naming consistent
uprobes/x86: Kill the "autask" arg of riprel_pre_xol()
uprobes/x86: Simplify riprel_{pre,post}_xol() and make them similar
uprobes/tracing: Make uprobe_perf_close() visible to uprobe_perf_open() uprobes/tracing: Fix uprobe_perf_open() on uprobe_apply() failure
uprobes: Refuse to insert a probe into MAP_SHARED vma
uprobes: Add mem_cgroup_charge_anon() into uprobe_write_opcode()
x86/traps: Make math_error() static
x86/traps: Use SEND_SIG_PRIV instead of force_sig()
x86/traps: Introduce do_error_trap()
x86/traps: Introduce fill_trap_info(), simplify DO_ERROR_INFO()
x86/traps: Shift fill_trap_info() from DO_ERROR_INFO() to do_error_trap()
x86/traps: Kill DO_ERROR_INFO()
uprobes/x86: Fix the wrong ->si_addr when xol triggers a trap
uprobes: Shift ->readpage check from __copy_insn() to uprobe_register()
uprobes: Teach copy_insn() to support tmpfs
uprobes: Shift ->readpage check from __copy_insn() to uprobe_register()
uprobes: Teach copy_insn() to support tmpfs
uprobes/x86: Rename arch_uprobe->def to ->defparam, minor comment updates

Peter Zijlstra (9):
perf: Ensure consistent inherit state in groups
perf: Always destroy groups on exit
perf: Validate locking assumption
perf: Rework free paths
perf: Simplify perf_event_exit_task_context() perf tools: Remove usage of trace_sched_wakeup(.success)
perf: Fix perf_event_open(.flags) test
perf: Fix use after free in perf_remove_from_context()
perf: Fix perf_event_comm() vs. exec() assumption

Ramkumar Ramachandra (4):
perf kmem: Introduce --list-cmds for use by scripts perf mem: Introduce --list-cmds for use by scripts perf lock: Introduce --list-cmds for use by scripts perf sched: Introduce --list-cmds for use by scripts

Sebastian Andrzej Siewior (1):
perf tools: Consider header files outside perf directory in tags target

Stephane Eranian (1):
fix Haswell precise store data source encoding

Vince Weaver (3):
perf: Disable sampled events if no PMU interrupt perf/ARM: Use common PMU interrupt disabled code perf/x86: Use common PMU interrupt disabled code

Vineet Gupta (1):
kprobes: Ensure blacklist data is aligned

Yan, Zheng (3):
perf: Allow building PMU drivers as modules
hrtimer: Export __hrtimer_start_range_ns()
perf/x86: Export perf_assign_events()

zhangdianfang (1):

      perf tools: Fix "==" into "=" in ui_browser__warning assignment
 Documentation/kprobes.txt                          |  16 +-
 arch/arm/kernel/perf_event.c                       |   2 +-
 arch/arm/kernel/perf_event_cpu.c                   |   8 +-
 arch/x86/include/asm/asm.h                         |   7 +
 arch/x86/include/asm/kprobes.h                     |   2 +
 arch/x86/include/asm/traps.h                       |   3 +-
 arch/x86/include/asm/uprobes.h                     |  20 +-
 arch/x86/kernel/alternative.c                      |   3 +-
 arch/x86/kernel/apic/hw_nmi.c                      |   3 +-
 arch/x86/kernel/cpu/common.c                       |   4 +
 arch/x86/kernel/cpu/perf_event.c                   |  22 +-
 arch/x86/kernel/cpu/perf_event_amd_ibs.c           |   3 +-
 arch/x86/kernel/cpu/perf_event_intel_ds.c          |  22 +-
 arch/x86/kernel/cpu/perf_event_intel_lbr.c         |   5 +
 arch/x86/kernel/dumpstack.c                        |   9 +-
 arch/x86/kernel/entry_32.S                         |  33 -
 arch/x86/kernel/entry_64.S                         |  20 -
 arch/x86/kernel/hw_breakpoint.c                    |   5 +-
 arch/x86/kernel/kprobes/core.c                     | 128 ++--
 arch/x86/kernel/kprobes/ftrace.c                   |  17 +-
 arch/x86/kernel/kprobes/opt.c                      |  32 +-
 arch/x86/kernel/kvm.c                              |   4 +-
 arch/x86/kernel/nmi.c                              |  18 +-
 arch/x86/kernel/paravirt.c                         |   6 +
 arch/x86/kernel/process_64.c                       |   7 +-
 arch/x86/kernel/traps.c                            | 145 ++--
 arch/x86/kernel/uprobes.c                          | 842 +++++++++++++--------
 arch/x86/lib/thunk_32.S                            |   3 +-
 arch/x86/lib/thunk_64.S                            |   3 +
 arch/x86/mm/fault.c                                |  29 +-
 fs/exec.c                                          |   7 +-
 include/asm-generic/vmlinux.lds.h                  |  10 +
 include/linux/compiler.h                           |   2 +
 include/linux/kprobes.h                            |  21 +-
 include/linux/perf_event.h                         |  19 +-
 include/linux/sched.h                              |   6 +-
 include/linux/uprobes.h                            |   4 +
 include/uapi/linux/perf_event.h                    |  20 +-
 kernel/events/core.c                               | 156 ++--
 kernel/events/uprobes.c                            |  83 +-
 kernel/hrtimer.c                                   |   1 +
 kernel/kprobes.c                                   | 392 ++++++----
 kernel/notifier.c                                  |  22 +-
 kernel/sched/core.c                                |   7 +-
 kernel/trace/trace_event_perf.c                    |   5 +-
 kernel/trace/trace_kprobe.c                        |  71 +-
 kernel/trace/trace_probe.c                         |  65 +-
 kernel/trace/trace_probe.h                         |  15 +-
 kernel/trace/trace_uprobe.c                        |  66 +-
 tools/include/linux/compiler.h                     |   2 +
 tools/{virtio => include}/linux/export.h           |   5 +
 .../lockdep/uinclude => include}/linux/types.h     |  29 +-
 tools/lib/api/fs/fs.c                              |  43 +-
 tools/lib/lockdep/Makefile                         |   2 +-
 tools/lib/lockdep/uinclude/linux/export.h          |   7 -
 tools/perf/Documentation/perf-diff.txt             |  26 +-
 tools/perf/Documentation/perf-record.txt           |   3 +-
 tools/perf/Documentation/perf-report.txt           |  48 +-
 tools/perf/Documentation/perf-top.txt              |  38 +-
 tools/perf/MANIFEST                                |   2 +
 tools/perf/Makefile.perf                           |  26 +-
 tools/perf/arch/arm/Makefile                       |   7 +
 tools/perf/arch/arm/include/perf_regs.h            |   7 +-
 tools/perf/arch/arm/tests/dwarf-unwind.c           |  60 ++
 tools/perf/arch/arm/tests/regs_load.S              |  58 ++
 tools/perf/arch/arm/util/unwind-libdw.c            |  36 +
 tools/perf/arch/arm64/Makefile                     |   7 +
 tools/perf/arch/arm64/include/perf_regs.h          |  88 +++
 tools/perf/arch/arm64/util/dwarf-regs.c            |  80 ++
 tools/perf/arch/arm64/util/unwind-libunwind.c      |  82 ++
 tools/perf/arch/x86/include/perf_regs.h            |   2 +-
 tools/perf/arch/x86/tests/dwarf-unwind.c           |   2 +-
 tools/perf/arch/x86/util/tsc.c                     |   2 +-
 tools/perf/arch/x86/util/tsc.h                     |   2 +-
 tools/perf/builtin-annotate.c                      |   8 +-
 tools/perf/builtin-diff.c                          |  52 +-
 tools/perf/builtin-inject.c                        |   2 +-
 tools/perf/builtin-kmem.c                          |  88 +--
 tools/perf/builtin-lock.c                          |  10 +-
 tools/perf/builtin-mem.c                           |  15 +-
 tools/perf/builtin-record.c                        | 163 ++--
 tools/perf/builtin-report.c                        | 372 +++------
 tools/perf/builtin-sched.c                         |  82 +-
 tools/perf/builtin-top.c                           | 112 +--
 tools/perf/config/Makefile                         |  23 +-
 tools/perf/config/feature-checks/Makefile          |   4 -
 tools/perf/config/feature-checks/test-all.c        |   5 -
 tools/perf/config/feature-checks/test-on-exit.c    |  16 -
 tools/perf/perf-completion.sh                      |   4 +-
 tools/perf/perf-sys.h                              | 190 +++++
 tools/perf/perf.c                                  |   8 +-
 tools/perf/perf.h                                  | 248 +-----
 tools/perf/tests/attr.c                            |   7 -
 tools/perf/tests/builtin-test.c                    |  22 +-
 tools/perf/tests/code-reading.c                    |   5 +-
 tools/perf/tests/dso-data.c                        |   2 +-
 tools/perf/tests/dwarf-unwind.c                    |   2 +-
 tools/perf/tests/evsel-tp-sched.c                  |   3 -
 tools/perf/tests/hists_common.c                    | 209 +++++
 tools/perf/tests/hists_common.h                    |  75 ++
 tools/perf/tests/hists_cumulate.c                  | 726 ++++++++++++++++++
 tools/perf/tests/hists_filter.c                    | 289 +++++++
 tools/perf/tests/hists_link.c                      | 209 +----
 tools/perf/tests/hists_output.c                    | 621 +++++++++++++++
 tools/perf/tests/keep-tracking.c                   |   2 +-
 tools/perf/tests/mmap-thread-lookup.c              | 233 ++++++
 tools/perf/tests/parse-events.c                    | 142 ++--
 tools/perf/tests/parse-no-sample-id-all.c          |   2 +-
 tools/perf/tests/perf-time-to-tsc.c                |   3 +-
 tools/perf/tests/rdpmc.c                           |   2 +-
 tools/perf/tests/sample-parsing.c                  |   2 +-
 tools/perf/tests/tests.h                           |   7 +-
 tools/perf/tests/thread-mg-share.c                 |  90 +++
 tools/perf/ui/browser.c                            |   2 +-
 tools/perf/ui/browser.h                            |   4 +-
 tools/perf/ui/browsers/hists.c                     | 270 ++++---
 tools/perf/ui/gtk/hists.c                          |  77 +-
 tools/perf/ui/hist.c                               | 371 +++++++--
 tools/perf/ui/progress.h                           |   2 +-
 tools/perf/ui/setup.c                              |   2 -
 tools/perf/ui/stdio/hist.c                         |  89 +--
 tools/perf/util/annotate.h                         |   2 +-
 tools/perf/util/build-id.c                         |   2 +-
 tools/perf/util/build-id.h                         |   2 +-
 tools/perf/util/callchain.c                        | 123 ++-
 tools/perf/util/callchain.h                        |  19 +
 tools/perf/util/config.c                           |   4 +
 tools/perf/util/cpumap.c                           | 160 ++++
 tools/perf/util/cpumap.h                           |  35 +
 tools/perf/util/dso.h                              |   2 +-
 tools/perf/util/event.c                            |   4 +-
 tools/perf/util/event.h                            |  24 +
 tools/perf/util/evsel.h                            |   9 +-
 tools/perf/util/header.h                           |   4 +-
 tools/perf/util/hist.c                             | 668 +++++++++++++---
 tools/perf/util/hist.h                             | 101 ++-
 tools/perf/util/include/linux/bitmap.h             |   3 +
 tools/perf/util/include/linux/export.h             |   6 -
 tools/perf/util/include/linux/list.h               |   1 +
 tools/perf/util/include/linux/types.h              |  29 -
 tools/perf/util/machine.c                          |  11 +
 tools/perf/util/map.c                              | 118 ++-
 tools/perf/util/map.h                              |  14 +-
 tools/perf/util/pager.c                            |  12 +-
 tools/perf/util/parse-events.h                     |   3 +-
 tools/perf/util/parse-events.y                     |  14 +-
 tools/perf/util/perf_regs.h                        |   2 +-
 tools/perf/util/pmu.c                              |   6 +-
 tools/perf/util/pmu.h                              |   2 +-
 tools/perf/util/session.c                          |   5 +-
 tools/perf/util/sort.c                             | 523 +++++++++++--
 tools/perf/util/sort.h                             |  26 +-
 tools/perf/util/stat.h                             |   2 +-
 tools/perf/util/svghelper.c                        |   2 +-
 tools/perf/util/svghelper.h                        |   2 +-
 tools/perf/util/symbol.c                           |  11 +-
 tools/perf/util/symbol.h                           |   5 +-
 tools/perf/util/thread.c                           |  52 +-
 tools/perf/util/thread.h                           |   3 +-
 tools/perf/util/top.h                              |   2 +-
 tools/perf/util/types.h                            |  24 -
 tools/perf/util/unwind-libdw.c                     |   2 +-
 tools/perf/util/unwind.h                           |   2 +-
 tools/perf/util/util.c                             |   2 +
 tools/perf/util/util.h                             |   2 +-
 tools/perf/util/values.h                           |   2 +-
 tools/virtio/Makefile                              |   2 +-
 tools/virtio/linux/kernel.h                        |   7 -
 tools/virtio/linux/types.h                         |  28 -
 169 files changed, 7342 insertions(+), 2671 deletions(-)
 rename tools/{virtio => include}/linux/export.h (70%)
 rename tools/{lib/lockdep/uinclude => include}/linux/types.h (63%)
 delete mode 100644 tools/lib/lockdep/uinclude/linux/export.h
 create mode 100644 tools/perf/arch/arm/tests/dwarf-unwind.c
 create mode 100644 tools/perf/arch/arm/tests/regs_load.S
 create mode 100644 tools/perf/arch/arm/util/unwind-libdw.c
 create mode 100644 tools/perf/arch/arm64/Makefile
 create mode 100644 tools/perf/arch/arm64/include/perf_regs.h
 create mode 100644 tools/perf/arch/arm64/util/dwarf-regs.c
 create mode 100644 tools/perf/arch/arm64/util/unwind-libunwind.c
 delete mode 100644 tools/perf/config/feature-checks/test-on-exit.c
 create mode 100644 tools/perf/perf-sys.h
 create mode 100644 tools/perf/tests/hists_common.c
 create mode 100644 tools/perf/tests/hists_common.h
 create mode 100644 tools/perf/tests/hists_cumulate.c
 create mode 100644 tools/perf/tests/hists_filter.c
 create mode 100644 tools/perf/tests/hists_output.c
 create mode 100644 tools/perf/tests/mmap-thread-lookup.c
 create mode 100644 tools/perf/tests/thread-mg-share.c
 delete mode 100644 tools/perf/util/include/linux/export.h
 delete mode 100644 tools/perf/util/include/linux/types.h
 delete mode 100644 tools/perf/util/types.h
 delete mode 100644 tools/virtio/linux/types.h
Documentation/kprobes.txt +15 -1
index 0cfb00f..4bbeca8 100644
@@ -22,8 +22,9 @@ Appendix B: The kprobes sysctl interface
 
 Kprobes enables you to dynamically break into any kernel routine and
 collect debugging and performance information non-disruptively. You
-can trap at almost any kernel code address, specifying a handler
+can trap at almost any kernel code address(*), specifying a handler
 routine to be invoked when the breakpoint is hit.
+(*: some parts of the kernel code can not be trapped, see 1.5 Blacklist)
 
 There are currently three types of probes: kprobes, jprobes, and
 kretprobes (also called return probes).  A kprobe can be inserted
@@ -273,6 +274,19 @@ using one of the following techniques:
  or
 - Execute 'sysctl -w debug.kprobes_optimization=n'
 
+1.5 Blacklist
+
+Kprobes can probe most of the kernel except itself. This means
+that there are some functions where kprobes cannot probe. Probing
+(trapping) such functions can cause a recursive trap (e.g. double
+fault) or the nested probe handler may never be called.
+Kprobes manages such functions as a blacklist.
+If you want to add a function into the blacklist, you just need
+to (1) include linux/kprobes.h and (2) use NOKPROBE_SYMBOL() macro
+to specify a blacklisted function.
+Kprobes checks the given probe address against the blacklist and
+rejects registering it, if the given address is in the blacklist.
+
 2. Architectures Supported
 
 Kprobes, jprobes, and return probes are implemented on the following
arch/arm/kernel/perf_event.c +1 -1
index a6bc431..4238bcb 100644
@@ -410,7 +410,7 @@ __hw_perf_event_init(struct perf_event *event)
 	 */
 	hwc->config_base	    |= (unsigned long)mapping;
 
-	if (!hwc->sample_period) {
+	if (!is_sampling_event(event)) {
 		/*
 		 * For non-sampling runs, limit the sample_period to half
 		 * of the counter width. That way, the new counter value
arch/arm/kernel/perf_event_cpu.c +6 -2
index 51798d7..bbdbffd 100644
@@ -126,8 +126,8 @@ static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, irq_handler_t handler)
 
 	irqs = min(pmu_device->num_resources, num_possible_cpus());
 	if (irqs < 1) {
-		pr_err("no irqs for PMUs defined\n");
-		return -ENODEV;
+		printk_once("perf/ARM: No irqs for PMU defined, sampling events not supported\n");
+		return 0;
 	}
 
 	irq = platform_get_irq(pmu_device, 0);
@@ -191,6 +191,10 @@ static void cpu_pmu_init(struct arm_pmu *cpu_pmu)
 	/* Ensure the PMU has sane values out of reset. */
 	if (cpu_pmu->reset)
 		on_each_cpu(cpu_pmu->reset, cpu_pmu, 1);
+
+	/* If no interrupts available, set the corresponding capability flag */
+	if (!platform_get_irq(cpu_pmu->plat_device, 0))
+		cpu_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
 }
 
 /*
arch/x86/include/asm/asm.h +7 -0
index 4582e8e..7730c1c 100644
@@ -57,6 +57,12 @@
 	.long (from) - . ;					\
 	.long (to) - . + 0x7ffffff0 ;				\
 	.popsection
+
+# define _ASM_NOKPROBE(entry)					\
+	.pushsection "_kprobe_blacklist","aw" ;			\
+	_ASM_ALIGN ;						\
+	_ASM_PTR (entry);					\
+	.popsection
 #else
 # define _ASM_EXTABLE(from,to)					\
 	" .pushsection \"__ex_table\",\"a\"\n"			\
@@ -71,6 +77,7 @@
 	" .long (" #from ") - .\n"				\
 	" .long (" #to ") - . + 0x7ffffff0\n"			\
 	" .popsection\n"
+/* For C file, we already have NOKPROBE_SYMBOL macro */
 #endif
 
 #endif /* _ASM_X86_ASM_H */
arch/x86/include/asm/kprobes.h +2 -0
index 9454c16..53cdfb2 100644
@@ -116,4 +116,6 @@ struct kprobe_ctlblk {
 extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
 extern int kprobe_exceptions_notify(struct notifier_block *self,
 				    unsigned long val, void *data);
+extern int kprobe_int3_handler(struct pt_regs *regs);
+extern int kprobe_debug_handler(struct pt_regs *regs);
 #endif /* _ASM_X86_KPROBES_H */
arch/x86/include/asm/traps.h +1 -2
index 58d66fe..cf69d05 100644
@@ -68,7 +68,7 @@ dotraplinkage void do_segment_not_present(struct pt_regs *, long);
 dotraplinkage void do_stack_segment(struct pt_regs *, long);
 #ifdef CONFIG_X86_64
 dotraplinkage void do_double_fault(struct pt_regs *, long);
-asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *);
+asmlinkage struct pt_regs *sync_regs(struct pt_regs *);
 #endif
 dotraplinkage void do_general_protection(struct pt_regs *, long);
 dotraplinkage void do_page_fault(struct pt_regs *, unsigned long);
@@ -98,7 +98,6 @@ static inline int get_si_code(unsigned long condition)
 
 extern int panic_on_unrecovered_nmi;
 
-void math_error(struct pt_regs *, int, int);
 void math_emulate(struct math_emu_info *);
 #ifndef CONFIG_X86_32
 asmlinkage void smp_thermal_interrupt(void);
arch/x86/include/asm/uprobes.h +16 -4
index 3087ea9..74f4c2f 100644
@@ -33,15 +33,27 @@ typedef u8 uprobe_opcode_t;
 #define UPROBE_SWBP_INSN		0xcc
 #define UPROBE_SWBP_INSN_SIZE		   1
 
+struct uprobe_xol_ops;
+
 struct arch_uprobe {
-	u16				fixups;
 	union {
 		u8			insn[MAX_UINSN_BYTES];
 		u8			ixol[MAX_UINSN_BYTES];
 	};
-#ifdef CONFIG_X86_64
-	unsigned long			rip_rela_target_address;
-#endif
+
+	const struct uprobe_xol_ops	*ops;
+
+	union {
+		struct {
+			s32	offs;
+			u8	ilen;
+			u8	opc1;
+		}			branch;
+		struct {
+			u8	fixups;
+			u8	ilen;
+		} 			defparam;
+	};
 };
 
 struct arch_uprobe_task {
arch/x86/kernel/alternative.c +1 -2
index df94598..703130f 100644
@@ -5,7 +5,6 @@
 #include <linux/mutex.h>
 #include <linux/list.h>
 #include <linux/stringify.h>
-#include <linux/kprobes.h>
 #include <linux/mm.h>
 #include <linux/vmalloc.h>
 #include <linux/memory.h>
@@ -551,7 +550,7 @@ void *__init_or_module text_poke_early(void *addr, const void *opcode,
  *
  * Note: Must be called under text_mutex.
  */
-void *__kprobes text_poke(void *addr, const void *opcode, size_t len)
+void *text_poke(void *addr, const void *opcode, size_t len)
 {
 	unsigned long flags;
 	char *vaddr;
arch/x86/kernel/apic/hw_nmi.c +2 -1
index a698d71..73eb5b3 100644
@@ -60,7 +60,7 @@ void arch_trigger_all_cpu_backtrace(void)
 	smp_mb__after_clear_bit();
 }
 
-static int __kprobes
+static int
 arch_trigger_all_cpu_backtrace_handler(unsigned int cmd, struct pt_regs *regs)
 {
 	int cpu;
@@ -80,6 +80,7 @@ arch_trigger_all_cpu_backtrace_handler(unsigned int cmd, struct pt_regs *regs)
 
 	return NMI_DONE;
 }
+NOKPROBE_SYMBOL(arch_trigger_all_cpu_backtrace_handler);
 
 static int __init register_trigger_all_cpu_backtrace(void)
 {
arch/x86/kernel/cpu/common.c +4 -0
index a135239..5af696d 100644
@@ -8,6 +8,7 @@
 #include <linux/delay.h>
 #include <linux/sched.h>
 #include <linux/init.h>
+#include <linux/kprobes.h>
 #include <linux/kgdb.h>
 #include <linux/smp.h>
 #include <linux/io.h>
@@ -1160,6 +1161,7 @@ int is_debug_stack(unsigned long addr)
 		(addr <= __get_cpu_var(debug_stack_addr) &&
 		 addr > (__get_cpu_var(debug_stack_addr) - DEBUG_STKSZ));
 }
+NOKPROBE_SYMBOL(is_debug_stack);
 
 DEFINE_PER_CPU(u32, debug_idt_ctr);
 
@@ -1168,6 +1170,7 @@ void debug_stack_set_zero(void)
 	this_cpu_inc(debug_idt_ctr);
 	load_current_idt();
 }
+NOKPROBE_SYMBOL(debug_stack_set_zero);
 
 void debug_stack_reset(void)
 {
@@ -1176,6 +1179,7 @@ void debug_stack_reset(void)
 	if (this_cpu_dec_return(debug_idt_ctr) == 0)
 		load_current_idt();
 }
+NOKPROBE_SYMBOL(debug_stack_reset);
 
 #else	/* CONFIG_X86_64 */
 
arch/x86/kernel/cpu/perf_event.c +12 -10
index ae407f7..2bdfbff 100644
@@ -303,15 +303,6 @@ int x86_setup_perfctr(struct perf_event *event)
 		hwc->sample_period = x86_pmu.max_period;
 		hwc->last_period = hwc->sample_period;
 		local64_set(&hwc->period_left, hwc->sample_period);
-	} else {
-		/*
-		 * If we have a PMU initialized but no APIC
-		 * interrupts, we cannot sample hardware
-		 * events (user-space has to fall back and
-		 * sample via a hrtimer based software event):
-		 */
-		if (!x86_pmu.apic)
-			return -EOPNOTSUPP;
 	}
 
 	if (attr->type == PERF_TYPE_RAW)
@@ -721,6 +712,7 @@ int perf_assign_events(struct perf_event **events, int n,
 
 	return sched.state.unassigned;
 }
+EXPORT_SYMBOL_GPL(perf_assign_events);
 
 int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign)
 {
@@ -1292,7 +1284,7 @@ void perf_events_lapic_init(void)
 	apic_write(APIC_LVTPC, APIC_DM_NMI);
 }
 
-static int __kprobes
+static int
 perf_event_nmi_handler(unsigned int cmd, struct pt_regs *regs)
 {
 	u64 start_clock;
@@ -1310,6 +1302,7 @@ perf_event_nmi_handler(unsigned int cmd, struct pt_regs *regs)
 
 	return ret;
 }
+NOKPROBE_SYMBOL(perf_event_nmi_handler);
 
 struct event_constraint emptyconstraint;
 struct event_constraint unconstrained;
@@ -1365,6 +1358,15 @@ static void __init pmu_check_apic(void)
 	x86_pmu.apic = 0;
 	pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n");
 	pr_info("no hardware sampling interrupt available.\n");
+
+	/*
+	 * If we have a PMU initialized but no APIC
+	 * interrupts, we cannot sample hardware
+	 * events (user-space has to fall back and
+	 * sample via a hrtimer based software event):
+	 */
+	pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
+
 }
 
 static struct attribute_group x86_pmu_format_group = {
arch/x86/kernel/cpu/perf_event_amd_ibs.c +2 -1
index 4c36bbe..cbb1be3e 100644
@@ -593,7 +593,7 @@ out:
 	return 1;
 }
 
-static int __kprobes
+static int
 perf_ibs_nmi_handler(unsigned int cmd, struct pt_regs *regs)
 {
 	int handled = 0;
@@ -606,6 +606,7 @@ perf_ibs_nmi_handler(unsigned int cmd, struct pt_regs *regs)
 
 	return handled;
 }
+NOKPROBE_SYMBOL(perf_ibs_nmi_handler);
 
 static __init int perf_ibs_pmu_init(struct perf_ibs *perf_ibs, char *name)
 {
arch/x86/kernel/cpu/perf_event_intel_ds.c +19 -3
index ae96cfa..980970c 100644
@@ -108,15 +108,31 @@ static u64 precise_store_data(u64 status)
 	return val;
 }
 
-static u64 precise_store_data_hsw(u64 status)
+static u64 precise_store_data_hsw(struct perf_event *event, u64 status)
 {
 	union perf_mem_data_src dse;
+	u64 cfg = event->hw.config & INTEL_ARCH_EVENT_MASK;
 
 	dse.val = 0;
 	dse.mem_op = PERF_MEM_OP_STORE;
 	dse.mem_lvl = PERF_MEM_LVL_NA;
+
+	/*
+	 * L1 info only valid for following events:
+	 *
+	 * MEM_UOPS_RETIRED.STLB_MISS_STORES
+	 * MEM_UOPS_RETIRED.LOCK_STORES
+	 * MEM_UOPS_RETIRED.SPLIT_STORES
+	 * MEM_UOPS_RETIRED.ALL_STORES
+	 */
+	if (cfg != 0x12d0 && cfg != 0x22d0 && cfg != 0x42d0 && cfg != 0x82d0)
+		return dse.mem_lvl;
+
 	if (status & 1)
-		dse.mem_lvl = PERF_MEM_LVL_L1;
+		dse.mem_lvl = PERF_MEM_LVL_L1 | PERF_MEM_LVL_HIT;
+	else
+		dse.mem_lvl = PERF_MEM_LVL_L1 | PERF_MEM_LVL_MISS;
+
 	/* Nothing else supported. Sorry. */
 	return dse.val;
 }
@@ -887,7 +903,7 @@ static void __intel_pmu_pebs_event(struct perf_event *event,
 				data.data_src.val = load_latency_data(pebs->dse);
 			else if (event->hw.flags & PERF_X86_EVENT_PEBS_ST_HSW)
 				data.data_src.val =
-					precise_store_data_hsw(pebs->dse);
+					precise_store_data_hsw(event, pebs->dse);
 			else
 				data.data_src.val = precise_store_data(pebs->dse);
 		}
arch/x86/kernel/cpu/perf_event_intel_lbr.c +5 -0
index d82d155..9dd2459 100644
@@ -384,6 +384,9 @@ static void intel_pmu_setup_sw_lbr_filter(struct perf_event *event)
 	if (br_type & PERF_SAMPLE_BRANCH_NO_TX)
 		mask |= X86_BR_NO_TX;
 
+	if (br_type & PERF_SAMPLE_BRANCH_COND)
+		mask |= X86_BR_JCC;
+
 	/*
 	 * stash actual user request into reg, it may
 	 * be used by fixup code for some CPU
@@ -678,6 +681,7 @@ static const int nhm_lbr_sel_map[PERF_SAMPLE_BRANCH_MAX] = {
 	 * NHM/WSM erratum: must include IND_JMP to capture IND_CALL
 	 */
 	[PERF_SAMPLE_BRANCH_IND_CALL] = LBR_IND_CALL | LBR_IND_JMP,
+	[PERF_SAMPLE_BRANCH_COND]     = LBR_JCC,
 };
 
 static const int snb_lbr_sel_map[PERF_SAMPLE_BRANCH_MAX] = {
@@ -689,6 +693,7 @@ static const int snb_lbr_sel_map[PERF_SAMPLE_BRANCH_MAX] = {
 	[PERF_SAMPLE_BRANCH_ANY_CALL]	= LBR_REL_CALL | LBR_IND_CALL
 					| LBR_FAR,
 	[PERF_SAMPLE_BRANCH_IND_CALL]	= LBR_IND_CALL,
+	[PERF_SAMPLE_BRANCH_COND]       = LBR_JCC,
 };
 
 /* core */
arch/x86/kernel/dumpstack.c +6 -3
index d9c12d3..b74ebc7 100644
@@ -200,7 +200,7 @@ static arch_spinlock_t die_lock = __ARCH_SPIN_LOCK_UNLOCKED;
 static int die_owner = -1;
 static unsigned int die_nest_count;
 
-unsigned __kprobes long oops_begin(void)
+unsigned long oops_begin(void)
 {
 	int cpu;
 	unsigned long flags;
@@ -223,8 +223,9 @@ unsigned __kprobes long oops_begin(void)
 	return flags;
 }
 EXPORT_SYMBOL_GPL(oops_begin);
+NOKPROBE_SYMBOL(oops_begin);
 
-void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, int signr)
+void oops_end(unsigned long flags, struct pt_regs *regs, int signr)
 {
 	if (regs && kexec_should_crash(current))
 		crash_kexec(regs);
@@ -247,8 +248,9 @@ void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, int signr)
 		panic("Fatal exception");
 	do_exit(signr);
 }
+NOKPROBE_SYMBOL(oops_end);
 
-int __kprobes __die(const char *str, struct pt_regs *regs, long err)
+int __die(const char *str, struct pt_regs *regs, long err)
 {
 #ifdef CONFIG_X86_32
 	unsigned short ss;
@@ -291,6 +293,7 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err)
 #endif
 	return 0;
 }
+NOKPROBE_SYMBOL(__die);
 
 /*
  * This is gone through when something in the kernel has done something bad
arch/x86/kernel/entry_32.S +0 -33
index a2a4f46..0ca5bf1 100644
@@ -315,10 +315,6 @@ ENTRY(ret_from_kernel_thread)
 ENDPROC(ret_from_kernel_thread)
 
 /*
- * Interrupt exit functions should be protected against kprobes
- */
-	.pushsection .kprobes.text, "ax"
-/*
  * Return to user mode is not as complex as all this looks,
  * but we want the default path for a system call return to
  * go as quickly as possible which is why some of this is
@@ -372,10 +368,6 @@ need_resched:
 END(resume_kernel)
 #endif
 	CFI_ENDPROC
-/*
- * End of kprobes section
- */
-	.popsection
 
 /* SYSENTER_RETURN points to after the "sysenter" instruction in
    the vsyscall page.  See vsyscall-sysentry.S, which defines the symbol.  */
@@ -495,10 +487,6 @@ sysexit_audit:
 	PTGS_TO_GS_EX
 ENDPROC(ia32_sysenter_target)
 
-/*
- * syscall stub including irq exit should be protected against kprobes
- */
-	.pushsection .kprobes.text, "ax"
 	# system call handler stub
 ENTRY(system_call)
 	RING0_INT_FRAME			# can't unwind into user space anyway
@@ -691,10 +679,6 @@ syscall_badsys:
 	jmp resume_userspace
 END(syscall_badsys)
 	CFI_ENDPROC
-/*
- * End of kprobes section
- */
-	.popsection
 
 .macro FIXUP_ESPFIX_STACK
 /*
@@ -781,10 +765,6 @@ common_interrupt:
 ENDPROC(common_interrupt)
 	CFI_ENDPROC
 
-/*
- *  Irq entries should be protected against kprobes
- */
-	.pushsection .kprobes.text, "ax"
 #define BUILD_INTERRUPT3(name, nr, fn)	\
 ENTRY(name)				\
 	RING0_INT_FRAME;		\
@@ -961,10 +941,6 @@ ENTRY(spurious_interrupt_bug)
 	jmp error_code
 	CFI_ENDPROC
 END(spurious_interrupt_bug)
-/*
- * End of kprobes section
- */
-	.popsection
 
 #ifdef CONFIG_XEN
 /* Xen doesn't set %esp to be precisely what the normal sysenter
@@ -1239,11 +1215,6 @@ return_to_handler:
 	jmp *%ecx
 #endif
 
-/*
- * Some functions should be protected against kprobes
- */
-	.pushsection .kprobes.text, "ax"
-
 #ifdef CONFIG_TRACING
 ENTRY(trace_page_fault)
 	RING0_EC_FRAME
@@ -1453,7 +1424,3 @@ ENTRY(async_page_fault)
 END(async_page_fault)
 #endif
 
-/*
- * End of kprobes section
- */
-	.popsection
arch/x86/kernel/entry_64.S +0 -20
index 1e96c36..43bb389 100644
@@ -487,8 +487,6 @@ ENDPROC(native_usergs_sysret64)
 	TRACE_IRQS_OFF
 	.endm
 
-/* save complete stack frame */
-	.pushsection .kprobes.text, "ax"
 ENTRY(save_paranoid)
 	XCPT_FRAME 1 RDI+8
 	cld
@@ -517,7 +515,6 @@ ENTRY(save_paranoid)
 1:	ret
 	CFI_ENDPROC
 END(save_paranoid)
-	.popsection
 
 /*
  * A newly forked process directly context switches into this address.
@@ -975,10 +972,6 @@ END(interrupt)
 	call \func
 	.endm
 
-/*
- * Interrupt entry/exit should be protected against kprobes
- */
-	.pushsection .kprobes.text, "ax"
 	/*
 	 * The interrupt stubs push (~vector+0x80) onto the stack and
 	 * then jump to common_interrupt.
@@ -1113,10 +1106,6 @@ ENTRY(retint_kernel)
 
 	CFI_ENDPROC
 END(common_interrupt)
-/*
- * End of kprobes section
- */
-       .popsection
 
 /*
  * APIC interrupts.
@@ -1477,11 +1466,6 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
 	hyperv_callback_vector hyperv_vector_handler
 #endif /* CONFIG_HYPERV */
 
-/*
- * Some functions should be protected against kprobes
- */
-	.pushsection .kprobes.text, "ax"
-
 paranoidzeroentry_ist debug do_debug DEBUG_STACK
 paranoidzeroentry_ist int3 do_int3 DEBUG_STACK
 paranoiderrorentry stack_segment do_stack_segment
@@ -1898,7 +1882,3 @@ ENTRY(ignore_sysret)
 	CFI_ENDPROC
 END(ignore_sysret)
 
-/*
- * End of kprobes section
- */
-	.popsection
arch/x86/kernel/hw_breakpoint.c +2 -3
index a67b47c..5f9cf20 100644
@@ -32,7 +32,6 @@
 #include <linux/irqflags.h>
 #include <linux/notifier.h>
 #include <linux/kallsyms.h>
-#include <linux/kprobes.h>
 #include <linux/percpu.h>
 #include <linux/kdebug.h>
 #include <linux/kernel.h>
@@ -424,7 +423,7 @@ EXPORT_SYMBOL_GPL(hw_breakpoint_restore);
  * NOTIFY_STOP returned for all other cases
  *
  */
-static int __kprobes hw_breakpoint_handler(struct die_args *args)
+static int hw_breakpoint_handler(struct die_args *args)
 {
 	int i, cpu, rc = NOTIFY_STOP;
 	struct perf_event *bp;
@@ -511,7 +510,7 @@ static int __kprobes hw_breakpoint_handler(struct die_args *args)
 /*
  * Handle debug exception notifications.
  */
-int __kprobes hw_breakpoint_exceptions_notify(
+int hw_breakpoint_exceptions_notify(
 		struct notifier_block *unused, unsigned long val, void *data)
 {
 	if (val != DIE_DEBUG)
arch/x86/kernel/kprobes/core.c +70 -58

383 lines not on this page · raw message

arch/x86/kernel/kprobes/ftrace.c +10 -7
index 23ef5c5..717b02a 100644
@@ -25,8 +25,9 @@
 
 #include "common.h"
 
-static int __skip_singlestep(struct kprobe *p, struct pt_regs *regs,
-			     struct kprobe_ctlblk *kcb)
+static nokprobe_inline
+int __skip_singlestep(struct kprobe *p, struct pt_regs *regs,
+		      struct kprobe_ctlblk *kcb)
 {
 	/*
 	 * Emulate singlestep (and also recover regs->ip)
@@ -41,18 +42,19 @@ static int __skip_singlestep(struct kprobe *p, struct pt_regs *regs,
 	return 1;
 }
 
-int __kprobes skip_singlestep(struct kprobe *p, struct pt_regs *regs,
-			      struct kprobe_ctlblk *kcb)
+int skip_singlestep(struct kprobe *p, struct pt_regs *regs,
+		    struct kprobe_ctlblk *kcb)
 {
 	if (kprobe_ftrace(p))
 		return __skip_singlestep(p, regs, kcb);
 	else
 		return 0;
 }
+NOKPROBE_SYMBOL(skip_singlestep);
 
 /* Ftrace callback handler for kprobes */
-void __kprobes kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
-				     struct ftrace_ops *ops, struct pt_regs *regs)
+void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
+			   struct ftrace_ops *ops, struct pt_regs *regs)
 {
 	struct kprobe *p;
 	struct kprobe_ctlblk *kcb;
@@ -84,8 +86,9 @@ void __kprobes kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
 end:
 	local_irq_restore(flags);
 }
+NOKPROBE_SYMBOL(kprobe_ftrace_handler);
 
-int __kprobes arch_prepare_kprobe_ftrace(struct kprobe *p)
+int arch_prepare_kprobe_ftrace(struct kprobe *p)
 {
 	p->ainsn.insn = NULL;
 	p->ainsn.boostable = -1;
arch/x86/kernel/kprobes/opt.c +17 -15
index 898160b..f304773 100644
@@ -77,7 +77,7 @@ found:
 }
 
 /* Insert a move instruction which sets a pointer to eax/rdi (1st arg). */
-static void __kprobes synthesize_set_arg1(kprobe_opcode_t *addr, unsigned long val)
+static void synthesize_set_arg1(kprobe_opcode_t *addr, unsigned long val)
 {
 #ifdef CONFIG_X86_64
 	*addr++ = 0x48;
@@ -138,7 +138,8 @@ asm (
 #define INT3_SIZE sizeof(kprobe_opcode_t)
 
 /* Optimized kprobe call back function: called from optinsn */
-static void __kprobes optimized_callback(struct optimized_kprobe *op, struct pt_regs *regs)
+static void
+optimized_callback(struct optimized_kprobe *op, struct pt_regs *regs)
 {
 	struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
 	unsigned long flags;
@@ -168,8 +169,9 @@ static void __kprobes optimized_callback(struct optimized_kprobe *op, struct pt_
 	}
 	local_irq_restore(flags);
 }
+NOKPROBE_SYMBOL(optimized_callback);
 
-static int __kprobes copy_optimized_instructions(u8 *dest, u8 *src)
+static int copy_optimized_instructions(u8 *dest, u8 *src)
 {
 	int len = 0, ret;
 
@@ -189,7 +191,7 @@ static int __kprobes copy_optimized_instructions(u8 *dest, u8 *src)
 }
 
 /* Check whether insn is indirect jump */
-static int __kprobes insn_is_indirect_jump(struct insn *insn)
+static int insn_is_indirect_jump(struct insn *insn)
 {
 	return ((insn->opcode.bytes[0] == 0xff &&
 		(X86_MODRM_REG(insn->modrm.value) & 6) == 4) || /* Jump */
@@ -224,7 +226,7 @@ static int insn_jump_into_range(struct insn *insn, unsigned long start, int len)
 }
 
 /* Decode whole function to ensure any instructions don't jump into target */
-static int __kprobes can_optimize(unsigned long paddr)
+static int can_optimize(unsigned long paddr)
 {
 	unsigned long addr, size = 0, offset = 0;
 	struct insn insn;
@@ -275,7 +277,7 @@ static int __kprobes can_optimize(unsigned long paddr)
 }
 
 /* Check optimized_kprobe can actually be optimized. */
-int __kprobes arch_check_optimized_kprobe(struct optimized_kprobe *op)
+int arch_check_optimized_kprobe(struct optimized_kprobe *op)
 {
 	int i;
 	struct kprobe *p;
@@ -290,15 +292,15 @@ int __kprobes arch_check_optimized_kprobe(struct optimized_kprobe *op)
 }
 
 /* Check the addr is within the optimized instructions. */
-int __kprobes
-arch_within_optimized_kprobe(struct optimized_kprobe *op, unsigned long addr)
+int arch_within_optimized_kprobe(struct optimized_kprobe *op,
+				 unsigned long addr)
 {
 	return ((unsigned long)op->kp.addr <= addr &&
 		(unsigned long)op->kp.addr + op->optinsn.size > addr);
 }
 
 /* Free optimized instruction slot */
-static __kprobes
+static
 void __arch_remove_optimized_kprobe(struct optimized_kprobe *op, int dirty)
 {
 	if (op->optinsn.insn) {
@@ -308,7 +310,7 @@ void __arch_remove_optimized_kprobe(struct optimized_kprobe *op, int dirty)
 	}
 }
 
-void __kprobes arch_remove_optimized_kprobe(struct optimized_kprobe *op)
+void arch_remove_optimized_kprobe(struct optimized_kprobe *op)
 {
 	__arch_remove_optimized_kprobe(op, 1);
 }
@@ -318,7 +320,7 @@ void __kprobes arch_remove_optimized_kprobe(struct optimized_kprobe *op)
  * Target instructions MUST be relocatable (checked inside)
  * This is called when new aggr(opt)probe is allocated or reused.
  */
-int __kprobes arch_prepare_optimized_kprobe(struct optimized_kprobe *op)
+int arch_prepare_optimized_kprobe(struct optimized_kprobe *op)
 {
 	u8 *buf;
 	int ret;
@@ -372,7 +374,7 @@ int __kprobes arch_prepare_optimized_kprobe(struct optimized_kprobe *op)
  * Replace breakpoints (int3) with relative jumps.
  * Caller must call with locking kprobe_mutex and text_mutex.
  */
-void __kprobes arch_optimize_kprobes(struct list_head *oplist)
+void arch_optimize_kprobes(struct list_head *oplist)
 {
 	struct optimized_kprobe *op, *tmp;
 	u8 insn_buf[RELATIVEJUMP_SIZE];
@@ -398,7 +400,7 @@ void __kprobes arch_optimize_kprobes(struct list_head *oplist)
 }
 
 /* Replace a relative jump with a breakpoint (int3).  */
-void __kprobes arch_unoptimize_kprobe(struct optimized_kprobe *op)
+void arch_unoptimize_kprobe(struct optimized_kprobe *op)
 {
 	u8 insn_buf[RELATIVEJUMP_SIZE];
 
@@ -424,8 +426,7 @@ extern void arch_unoptimize_kprobes(struct list_head *oplist,
 	}
 }
 
-int  __kprobes
-setup_detour_execution(struct kprobe *p, struct pt_regs *regs, int reenter)
+int setup_detour_execution(struct kprobe *p, struct pt_regs *regs, int reenter)
 {
 	struct optimized_kprobe *op;
 
@@ -441,3 +442,4 @@ setup_detour_execution(struct kprobe *p, struct pt_regs *regs, int reenter)
 	}
 	return 0;
 }
+NOKPROBE_SYMBOL(setup_detour_execution);
arch/x86/kernel/kvm.c +3 -1
index 0331cb3..d81abcb 100644
@@ -251,8 +251,9 @@ u32 kvm_read_and_reset_pf_reason(void)
 	return reason;
 }
 EXPORT_SYMBOL_GPL(kvm_read_and_reset_pf_reason);
+NOKPROBE_SYMBOL(kvm_read_and_reset_pf_reason);
 
-dotraplinkage void __kprobes
+dotraplinkage void
 do_async_page_fault(struct pt_regs *regs, unsigned long error_code)
 {
 	enum ctx_state prev_state;
@@ -276,6 +277,7 @@ do_async_page_fault(struct pt_regs *regs, unsigned long error_code)
 		break;
 	}
 }
+NOKPROBE_SYMBOL(do_async_page_fault);
 
 static void __init paravirt_ops_setup(void)
 {
arch/x86/kernel/nmi.c +12 -6
index b4872b9..c3e985d 100644
@@ -110,7 +110,7 @@ static void nmi_max_handler(struct irq_work *w)
 		a->handler, whole_msecs, decimal_msecs);
 }
 
-static int __kprobes nmi_handle(unsigned int type, struct pt_regs *regs, bool b2b)
+static int nmi_handle(unsigned int type, struct pt_regs *regs, bool b2b)
 {
 	struct nmi_desc *desc = nmi_to_desc(type);
 	struct nmiaction *a;
@@ -146,6 +146,7 @@ static int __kprobes nmi_handle(unsigned int type, struct pt_regs *regs, bool b2
 	/* return total number of NMI events handled */
 	return handled;
 }
+NOKPROBE_SYMBOL(nmi_handle);
 
 int __register_nmi_handler(unsigned int type, struct nmiaction *action)
 {
@@ -208,7 +209,7 @@ void unregister_nmi_handler(unsigned int type, const char *name)
 }
 EXPORT_SYMBOL_GPL(unregister_nmi_handler);
 
-static __kprobes void
+static void
 pci_serr_error(unsigned char reason, struct pt_regs *regs)
 {
 	/* check to see if anyone registered against these types of errors */
@@ -238,8 +239,9 @@ pci_serr_error(unsigned char reason, struct pt_regs *regs)
 	reason = (reason & NMI_REASON_CLEAR_MASK) | NMI_REASON_CLEAR_SERR;
 	outb(reason, NMI_REASON_PORT);
 }
+NOKPROBE_SYMBOL(pci_serr_error);
 
-static __kprobes void
+static void
 io_check_error(unsigned char reason, struct pt_regs *regs)
 {
 	unsigned long i;
@@ -269,8 +271,9 @@ io_check_error(unsigned char reason, struct pt_regs *regs)
 	reason &= ~NMI_REASON_CLEAR_IOCHK;
 	outb(reason, NMI_REASON_PORT);
 }
+NOKPROBE_SYMBOL(io_check_error);
 
-static __kprobes void
+static void
 unknown_nmi_error(unsigned char reason, struct pt_regs *regs)
 {
 	int handled;
@@ -298,11 +301,12 @@ unknown_nmi_error(unsigned char reason, struct pt_regs *regs)
 
 	pr_emerg("Dazed and confused, but trying to continue\n");
 }
+NOKPROBE_SYMBOL(unknown_nmi_error);
 
 static DEFINE_PER_CPU(bool, swallow_nmi);
 static DEFINE_PER_CPU(unsigned long, last_nmi_rip);
 
-static __kprobes void default_do_nmi(struct pt_regs *regs)
+static void default_do_nmi(struct pt_regs *regs)
 {
 	unsigned char reason = 0;
 	int handled;
@@ -401,6 +405,7 @@ static __kprobes void default_do_nmi(struct pt_regs *regs)
 	else
 		unknown_nmi_error(reason, regs);
 }
+NOKPROBE_SYMBOL(default_do_nmi);
 
 /*
  * NMIs can hit breakpoints which will cause it to lose its
@@ -520,7 +525,7 @@ static inline void nmi_nesting_postprocess(void)
 }
 #endif
 
-dotraplinkage notrace __kprobes void
+dotraplinkage notrace void
 do_nmi(struct pt_regs *regs, long error_code)
 {
 	nmi_nesting_preprocess(regs);
@@ -537,6 +542,7 @@ do_nmi(struct pt_regs *regs, long error_code)
 	/* On i386, may loop back to preprocess */
 	nmi_nesting_postprocess();
 }
+NOKPROBE_SYMBOL(do_nmi);
 
 void stop_nmi(void)
 {
arch/x86/kernel/paravirt.c +6 -0
index 1b10af8..548d25f 100644
@@ -23,6 +23,7 @@
 #include <linux/efi.h>
 #include <linux/bcd.h>
 #include <linux/highmem.h>
+#include <linux/kprobes.h>
 
 #include <asm/bug.h>
 #include <asm/paravirt.h>
@@ -389,6 +390,11 @@ __visible struct pv_cpu_ops pv_cpu_ops = {
 	.end_context_switch = paravirt_nop,
 };
 
+/* At this point, native_get/set_debugreg has real function entries */
+NOKPROBE_SYMBOL(native_get_debugreg);
+NOKPROBE_SYMBOL(native_set_debugreg);
+NOKPROBE_SYMBOL(native_load_idt);
+
 struct pv_apic_ops pv_apic_ops = {
 #ifdef CONFIG_X86_LOCAL_APIC
 	.startup_ipi_hook = paravirt_nop,
arch/x86/kernel/process_64.c +4 -3
index 898d077..ca5b02d 100644
@@ -413,12 +413,11 @@ void set_personality_ia32(bool x32)
 	set_thread_flag(TIF_ADDR32);
 
 	/* Mark the associated mm as containing 32-bit tasks. */
-	if (current->mm)
-		current->mm->context.ia32_compat = 1;
-
 	if (x32) {
 		clear_thread_flag(TIF_IA32);
 		set_thread_flag(TIF_X32);
+		if (current->mm)
+			current->mm->context.ia32_compat = TIF_X32;
 		current->personality &= ~READ_IMPLIES_EXEC;
 		/* is_compat_task() uses the presence of the x32
 		   syscall bit flag to determine compat status */
@@ -426,6 +425,8 @@ void set_personality_ia32(bool x32)
 	} else {
 		set_thread_flag(TIF_IA32);
 		clear_thread_flag(TIF_X32);
+		if (current->mm)
+			current->mm->context.ia32_compat = TIF_IA32;
 		current->personality |= force_personality32;
 		/* Prepare the first "return" to user space */
 		current_thread_info()->status |= TS_COMPAT;
arch/x86/kernel/traps.c +87 -58

280 lines not on this page · raw message

arch/x86/kernel/uprobes.c +521 -321

1,047 lines not on this page · raw message

arch/x86/lib/thunk_32.S +2 -1
index 2930ae0..28f85c91 100644
@@ -4,8 +4,8 @@
  *  (inspired by Andi Kleen's thunk_64.S)
  * Subject to the GNU public license, v.2. No warranty of any kind.
  */
-
 	#include <linux/linkage.h>
+	#include <asm/asm.h>
 
 #ifdef CONFIG_TRACE_IRQFLAGS
 	/* put return address in eax (arg1) */
@@ -22,6 +22,7 @@
 	popl %ecx
 	popl %eax
 	ret
+	_ASM_NOKPROBE(\name)
 	.endm
 
 	thunk_ra trace_hardirqs_on_thunk,trace_hardirqs_on_caller
arch/x86/lib/thunk_64.S +3 -0
index a63efd6..92d9fea 100644
@@ -8,6 +8,7 @@
 #include <linux/linkage.h>
 #include <asm/dwarf2.h>
 #include <asm/calling.h>
+#include <asm/asm.h>
 
 	/* rdi:	arg1 ... normal C conventions. rax is saved/restored. */
 	.macro THUNK name, func, put_ret_addr_in_rdi=0
@@ -25,6 +26,7 @@
 	call \func
 	jmp  restore
 	CFI_ENDPROC
+	_ASM_NOKPROBE(\name)
 	.endm
 
 #ifdef CONFIG_TRACE_IRQFLAGS
@@ -43,3 +45,4 @@ restore:
 	RESTORE_ARGS
 	ret
 	CFI_ENDPROC
+	_ASM_NOKPROBE(restore)
arch/x86/mm/fault.c +18 -11
index 8e57229..f83bd0d 100644
@@ -8,7 +8,7 @@
 #include <linux/kdebug.h>		/* oops_begin/end, ...		*/
 #include <linux/module.h>		/* search_exception_table	*/
 #include <linux/bootmem.h>		/* max_low_pfn			*/
-#include <linux/kprobes.h>		/* __kprobes, ...		*/
+#include <linux/kprobes.h>		/* NOKPROBE_SYMBOL, ...		*/
 #include <linux/mmiotrace.h>		/* kmmio_handler, ...		*/
 #include <linux/perf_event.h>		/* perf_sw_event		*/
 #include <linux/hugetlb.h>		/* hstate_index_to_shift	*/
@@ -45,7 +45,7 @@ enum x86_pf_error_code {
  * Returns 0 if mmiotrace is disabled, or if the fault is not
  * handled by mmiotrace:
  */
-static inline int __kprobes
+static nokprobe_inline int
 kmmio_fault(struct pt_regs *regs, unsigned long addr)
 {
 	if (unlikely(is_kmmio_active()))
@@ -54,7 +54,7 @@ kmmio_fault(struct pt_regs *regs, unsigned long addr)
 	return 0;
 }
 
-static inline int __kprobes kprobes_fault(struct pt_regs *regs)
+static nokprobe_inline int kprobes_fault(struct pt_regs *regs)
 {
 	int ret = 0;
 
@@ -261,7 +261,7 @@ void vmalloc_sync_all(void)
  *
  *   Handle a fault on the vmalloc or module mapping area
  */
-static noinline __kprobes int vmalloc_fault(unsigned long address)
+static noinline int vmalloc_fault(unsigned long address)
 {
 	unsigned long pgd_paddr;
 	pmd_t *pmd_k;
@@ -291,6 +291,7 @@ static noinline __kprobes int vmalloc_fault(unsigned long address)
 
 	return 0;
 }
+NOKPROBE_SYMBOL(vmalloc_fault);
 
 /*
  * Did it hit the DOS screen memory VA from vm86 mode?
@@ -358,7 +359,7 @@ void vmalloc_sync_all(void)
  *
  * This assumes no large pages in there.
  */
-static noinline __kprobes int vmalloc_fault(unsigned long address)
+static noinline int vmalloc_fault(unsigned long address)
 {
 	pgd_t *pgd, *pgd_ref;
 	pud_t *pud, *pud_ref;
@@ -425,6 +426,7 @@ static noinline __kprobes int vmalloc_fault(unsigned long address)
 
 	return 0;
 }
+NOKPROBE_SYMBOL(vmalloc_fault);
 
 #ifdef CONFIG_CPU_SUP_AMD
 static const char errata93_warning[] =
@@ -927,7 +929,7 @@ static int spurious_fault_check(unsigned long error_code, pte_t *pte)
  * There are no security implications to leaving a stale TLB when
  * increasing the permissions on a page.
  */
-static noinline __kprobes int
+static noinline int
 spurious_fault(unsigned long error_code, unsigned long address)
 {
 	pgd_t *pgd;
@@ -975,6 +977,7 @@ spurious_fault(unsigned long error_code, unsigned long address)
 
 	return ret;
 }
+NOKPROBE_SYMBOL(spurious_fault);
 
 int show_unhandled_signals = 1;
 
@@ -1030,7 +1033,7 @@ static inline bool smap_violation(int error_code, struct pt_regs *regs)
  * {,trace_}do_page_fault() have notrace on. Having this an actual function
  * guarantees there's a function trace entry.
  */
-static void __kprobes noinline
+static noinline void
 __do_page_fault(struct pt_regs *regs, unsigned long error_code,
 		unsigned long address)
 {
@@ -1253,8 +1256,9 @@ good_area:
 
 	up_read(&mm->mmap_sem);
 }
+NOKPROBE_SYMBOL(__do_page_fault);
 
-dotraplinkage void __kprobes notrace
+dotraplinkage void notrace
 do_page_fault(struct pt_regs *regs, unsigned long error_code)
 {
 	unsigned long address = read_cr2(); /* Get the faulting address */
@@ -1272,10 +1276,12 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code)
 	__do_page_fault(regs, error_code, address);
 	exception_exit(prev_state);
 }
+NOKPROBE_SYMBOL(do_page_fault);
 
 #ifdef CONFIG_TRACING
-static void trace_page_fault_entries(unsigned long address, struct pt_regs *regs,
-				     unsigned long error_code)
+static nokprobe_inline void
+trace_page_fault_entries(unsigned long address, struct pt_regs *regs,
+			 unsigned long error_code)
 {
 	if (user_mode(regs))
 		trace_page_fault_user(address, regs, error_code);
@@ -1283,7 +1289,7 @@ static void trace_page_fault_entries(unsigned long address, struct pt_regs *regs
 		trace_page_fault_kernel(address, regs, error_code);
 }
 
-dotraplinkage void __kprobes notrace
+dotraplinkage void notrace
 trace_do_page_fault(struct pt_regs *regs, unsigned long error_code)
 {
 	/*
@@ -1300,4 +1306,5 @@ trace_do_page_fault(struct pt_regs *regs, unsigned long error_code)
 	__do_page_fault(regs, error_code, address);
 	exception_exit(prev_state);
 }
+NOKPROBE_SYMBOL(trace_do_page_fault);
 #endif /* CONFIG_TRACING */
fs/exec.c +4 -3
index 238b7aa..a3d33fe 100644
@@ -1046,13 +1046,13 @@ EXPORT_SYMBOL_GPL(get_task_comm);
  * so that a new one can be started
  */
 
-void set_task_comm(struct task_struct *tsk, const char *buf)
+void __set_task_comm(struct task_struct *tsk, const char *buf, bool exec)
 {
 	task_lock(tsk);
 	trace_task_rename(tsk, buf);
 	strlcpy(tsk->comm, buf, sizeof(tsk->comm));
 	task_unlock(tsk);
-	perf_event_comm(tsk);
+	perf_event_comm(tsk, exec);
 }
 
 int flush_old_exec(struct linux_binprm * bprm)
@@ -1110,7 +1110,8 @@ void setup_new_exec(struct linux_binprm * bprm)
 	else
 		set_dumpable(current->mm, suid_dumpable);
 
-	set_task_comm(current, kbasename(bprm->filename));
+	perf_event_exec();
+	__set_task_comm(current, kbasename(bprm->filename), true);
 
 	/* Set the new mm task size. We have to do that late because it may
 	 * depend on TIF_32BIT which is only updated in flush_thread() on
include/asm-generic/vmlinux.lds.h +10 -0
index 146e4ff..8e0204a 100644
@@ -109,6 +109,15 @@
 #define BRANCH_PROFILE()
 #endif
 
+#ifdef CONFIG_KPROBES
+#define KPROBE_BLACKLIST()	. = ALIGN(8);				      \
+				VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \
+				*(_kprobe_blacklist)			      \
+				VMLINUX_SYMBOL(__stop_kprobe_blacklist) = .;
+#else
+#define KPROBE_BLACKLIST()
+#endif
+
 #ifdef CONFIG_EVENT_TRACING
 #define FTRACE_EVENTS()	. = ALIGN(8);					\
 			VMLINUX_SYMBOL(__start_ftrace_events) = .;	\
@@ -507,6 +516,7 @@
 	*(.init.rodata)							\
 	FTRACE_EVENTS()							\
 	TRACE_SYSCALLS()						\
+	KPROBE_BLACKLIST()						\
 	MEM_DISCARD(init.rodata)					\
 	CLK_OF_TABLES()							\
 	RESERVEDMEM_OF_TABLES()						\
include/linux/compiler.h +2 -0
index ee7239e..0300c0f 100644
@@ -374,7 +374,9 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
 /* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */
 #ifdef CONFIG_KPROBES
 # define __kprobes	__attribute__((__section__(".kprobes.text")))
+# define nokprobe_inline	__always_inline
 #else
 # define __kprobes
+# define nokprobe_inline	inline
 #endif
 #endif /* __LINUX_COMPILER_H */
include/linux/kprobes.h +18 -3
index 925eaf2..e059507 100644
@@ -205,10 +205,10 @@ struct kretprobe_blackpoint {
 	void *addr;
 };
 
-struct kprobe_blackpoint {
-	const char *name;
+struct kprobe_blacklist_entry {
+	struct list_head list;
 	unsigned long start_addr;
-	unsigned long range;
+	unsigned long end_addr;
 };
 
 #ifdef CONFIG_KPROBES
@@ -265,6 +265,7 @@ extern void arch_disarm_kprobe(struct kprobe *p);
 extern int arch_init_kprobes(void);
 extern void show_registers(struct pt_regs *regs);
 extern void kprobes_inc_nmissed_count(struct kprobe *p);
+extern bool arch_within_kprobe_blacklist(unsigned long addr);
 
 struct kprobe_insn_cache {
 	struct mutex mutex;
@@ -476,4 +477,18 @@ static inline int enable_jprobe(struct jprobe *jp)
 	return enable_kprobe(&jp->kp);
 }
 
+#ifdef CONFIG_KPROBES
+/*
+ * Blacklist ganerating macro. Specify functions which is not probed
+ * by using this macro.
+ */
+#define __NOKPROBE_SYMBOL(fname)			\
+static unsigned long __used				\
+	__attribute__((section("_kprobe_blacklist")))	\
+	_kbl_addr_##fname = (unsigned long)fname;
+#define NOKPROBE_SYMBOL(fname)	__NOKPROBE_SYMBOL(fname)
+#else
+#define NOKPROBE_SYMBOL(fname)
+#endif
+
 #endif /* _LINUX_KPROBES_H */
include/linux/perf_event.h +16 -3
index 3ef6ea1..707617a 100644
@@ -167,16 +167,27 @@ struct perf_event;
 #define PERF_EVENT_TXN 0x1
 
 /**
+ * pmu::capabilities flags
+ */
+#define PERF_PMU_CAP_NO_INTERRUPT		0x01
+
+/**
  * struct pmu - generic performance monitoring unit
  */
 struct pmu {
 	struct list_head		entry;
 
+	struct module			*module;
 	struct device			*dev;
 	const struct attribute_group	**attr_groups;
 	const char			*name;
 	int				type;
 
+	/*
+	 * various common per-pmu feature flags
+	 */
+	int				capabilities;
+
 	int * __percpu			pmu_disable_count;
 	struct perf_cpu_context * __percpu pmu_cpu_context;
 	int				task_ctx_nr;
@@ -695,7 +706,8 @@ extern struct perf_guest_info_callbacks *perf_guest_cbs;
 extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
 extern int perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
 
-extern void perf_event_comm(struct task_struct *tsk);
+extern void perf_event_exec(void);
+extern void perf_event_comm(struct task_struct *tsk, bool exec);
 extern void perf_event_fork(struct task_struct *tsk);
 
 /* Callchains */
@@ -772,7 +784,7 @@ extern void perf_event_enable(struct perf_event *event);
 extern void perf_event_disable(struct perf_event *event);
 extern int __perf_event_disable(void *info);
 extern void perf_event_task_tick(void);
-#else
+#else /* !CONFIG_PERF_EVENTS: */
 static inline void
 perf_event_task_sched_in(struct task_struct *prev,
 			 struct task_struct *task)			{ }
@@ -802,7 +814,8 @@ static inline int perf_unregister_guest_info_callbacks
 (struct perf_guest_info_callbacks *callbacks)				{ return 0; }
 
 static inline void perf_event_mmap(struct vm_area_struct *vma)		{ }
-static inline void perf_event_comm(struct task_struct *tsk)		{ }
+static inline void perf_event_exec(void)				{ }
+static inline void perf_event_comm(struct task_struct *tsk, bool exec)	{ }
 static inline void perf_event_fork(struct task_struct *tsk)		{ }
 static inline void perf_event_init(void)				{ }
 static inline int  perf_swevent_get_recursion_context(void)		{ return -1; }
include/linux/sched.h +5 -1
index 221b2bd..ad86e1d 100644
@@ -2379,7 +2379,11 @@ extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, i
 struct task_struct *fork_idle(int);
 extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
 
-extern void set_task_comm(struct task_struct *tsk, const char *from);
+extern void __set_task_comm(struct task_struct *tsk, const char *from, bool exec);
+static inline void set_task_comm(struct task_struct *tsk, const char *from)
+{
+	__set_task_comm(tsk, from, false);
+}
 extern char *get_task_comm(char *to, struct task_struct *tsk);
 
 #ifdef CONFIG_SMP
include/linux/uprobes.h +4 -0
index edff2b9..88c3b7e 100644
@@ -102,6 +102,7 @@ extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, u
 extern bool __weak is_swbp_insn(uprobe_opcode_t *insn);
 extern bool __weak is_trap_insn(uprobe_opcode_t *insn);
 extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs);
+extern unsigned long uprobe_get_trap_addr(struct pt_regs *regs);
 extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t);
 extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
 extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool);
@@ -130,6 +131,9 @@ extern bool __weak arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *r
 #else /* !CONFIG_UPROBES */
 struct uprobes_state {
 };
+
+#define uprobe_get_trap_addr(regs)	instruction_pointer(regs)
+
 static inline int
 uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)
 {
include/uapi/linux/perf_event.h +13 -7
index 853bc1c..5312fae 100644
@@ -163,8 +163,9 @@ enum perf_branch_sample_type {
 	PERF_SAMPLE_BRANCH_ABORT_TX	= 1U << 7, /* transaction aborts */
 	PERF_SAMPLE_BRANCH_IN_TX	= 1U << 8, /* in transaction */
 	PERF_SAMPLE_BRANCH_NO_TX	= 1U << 9, /* not in transaction */
+	PERF_SAMPLE_BRANCH_COND		= 1U << 10, /* conditional branches */
 
-	PERF_SAMPLE_BRANCH_MAX		= 1U << 10, /* non-ABI */
+	PERF_SAMPLE_BRANCH_MAX		= 1U << 11, /* non-ABI */
 };
 
 #define PERF_SAMPLE_BRANCH_PLM_ALL \
@@ -301,8 +302,8 @@ struct perf_event_attr {
 				exclude_callchain_kernel : 1, /* exclude kernel callchains */
 				exclude_callchain_user   : 1, /* exclude user callchains */
 				mmap2          :  1, /* include mmap with inode data     */
-
-				__reserved_1   : 40;
+				comm_exec      :  1, /* flag comm events that are due to an exec */
+				__reserved_1   : 39;
 
 	union {
 		__u32		wakeup_events;	  /* wakeup every n events */
@@ -501,7 +502,12 @@ struct perf_event_mmap_page {
 #define PERF_RECORD_MISC_GUEST_KERNEL		(4 << 0)
 #define PERF_RECORD_MISC_GUEST_USER		(5 << 0)
 
+/*
+ * PERF_RECORD_MISC_MMAP_DATA and PERF_RECORD_MISC_COMM_EXEC are used on
+ * different events so can reuse the same bit position.
+ */
 #define PERF_RECORD_MISC_MMAP_DATA		(1 << 13)
+#define PERF_RECORD_MISC_COMM_EXEC		(1 << 13)
 /*
  * Indicates that the content of PERF_SAMPLE_IP points to
  * the actual instruction that triggered the event. See also
@@ -722,10 +728,10 @@ enum perf_callchain_context {
 	PERF_CONTEXT_MAX		= (__u64)-4095,
 };
 
-#define PERF_FLAG_FD_NO_GROUP		(1U << 0)
-#define PERF_FLAG_FD_OUTPUT		(1U << 1)
-#define PERF_FLAG_PID_CGROUP		(1U << 2) /* pid=cgroup id, per-cpu mode only */
-#define PERF_FLAG_FD_CLOEXEC		(1U << 3) /* O_CLOEXEC */
+#define PERF_FLAG_FD_NO_GROUP		(1UL << 0)
+#define PERF_FLAG_FD_OUTPUT		(1UL << 1)
+#define PERF_FLAG_PID_CGROUP		(1UL << 2) /* pid=cgroup id, per-cpu mode only */
+#define PERF_FLAG_FD_CLOEXEC		(1UL << 3) /* O_CLOEXEC */
 
 union perf_mem_data_src {
 	__u64 val;
kernel/events/core.c +95 -61

123 lines not on this page · raw message

kernel/events/uprobes.c +42 -41

83 lines not on this page · raw message

kernel/hrtimer.c +1 -0
index e0501fe..3ab2899 100644

Lines of this file are not shown. View the raw message.

kernel/kprobes.c +229 -163

392 lines not on this page · raw message

kernel/notifier.c +13 -9
index db4c8b0..4803da6 100644

Lines of this file are not shown. View the raw message.

kernel/sched/core.c +5 -2
index 0a72516..a8c0fde 100644

Lines of this file are not shown. View the raw message.

kernel/trace/trace_event_perf.c +3 -2
index c894614..5d12bb4 100644

Lines of this file are not shown. View the raw message.

kernel/trace/trace_kprobe.c +41 -30

71 lines not on this page · raw message

kernel/trace/trace_probe.c +35 -30

65 lines not on this page · raw message

kernel/trace/trace_probe.h +7 -8
index fb1ab5d..4f815fb 100644

Lines of this file are not shown. View the raw message.

kernel/trace/trace_uprobe.c +35 -31

66 lines not on this page · raw message

tools/include/linux/compiler.h +2 -0
index fbc6665..88461f0 100644

Lines of this file are not shown. View the raw message.

tools/include/linux/export.h renamed from tools/virtio/linux/export.h +5 -0
similarity index 70%
rename from tools/virtio/linux/export.h
rename to tools/include/linux/export.h
index 7311d32..d07e586 100644

Lines of this file are not shown. View the raw message.

tools/include/linux/types.h renamed from tools/lib/lockdep/uinclude/linux/types.h +23 -6
similarity index 63%
rename from tools/lib/lockdep/uinclude/linux/types.h
rename to tools/include/linux/types.h
index 929938f..b5cf25e 100644

Lines of this file are not shown. View the raw message.

tools/lib/api/fs/fs.c +42 -1

43 lines not on this page · raw message

tools/lib/lockdep/Makefile +1 -1
index bba2f52..52f9279 100644

Lines of this file are not shown. View the raw message.

tools/lib/lockdep/uinclude/linux/export.h deleted +0 -7
deleted file mode 100644
index 6bdf349..0000000

Lines of this file are not shown. View the raw message.

tools/perf/Documentation/perf-diff.txt +21 -5
index fdfceee..b3b8aba 100644

Lines of this file are not shown. View the raw message.

tools/perf/Documentation/perf-record.txt +2 -1
index c71b0f3..d460049 100644

Lines of this file are not shown. View the raw message.

tools/perf/Documentation/perf-report.txt +42 -6

48 lines not on this page · raw message

tools/perf/Documentation/perf-top.txt +33 -5
index 976b00c..180ae02 100644

Lines of this file are not shown. View the raw message.

tools/perf/MANIFEST +2 -0
index c0c87c8..45da209 100644

Lines of this file are not shown. View the raw message.

tools/perf/Makefile.perf +17 -9
index 895edd3..ae20edf 100644

Lines of this file are not shown. View the raw message.

tools/perf/arch/arm/Makefile +7 -0
index 67e9b3d..09d6215 100644

Lines of this file are not shown. View the raw message.

tools/perf/arch/arm/include/perf_regs.h +6 -1
index 2a1cfde..f619c9c 100644

Lines of this file are not shown. View the raw message.

tools/perf/arch/arm/tests/dwarf-unwind.c new file +60 -0

60 lines not on this page · raw message

tools/perf/arch/arm/tests/regs_load.S new file +58 -0

58 lines not on this page · raw message

tools/perf/arch/arm/util/unwind-libdw.c new file +36 -0
new file mode 100644
index 0000000..b4176c6

Lines of this file are not shown. View the raw message.

tools/perf/arch/arm64/Makefile new file +7 -0
new file mode 100644
index 0000000..67e9b3d

Lines of this file are not shown. View the raw message.

tools/perf/arch/arm64/include/perf_regs.h new file +88 -0

88 lines not on this page · raw message

tools/perf/arch/arm64/util/dwarf-regs.c new file +80 -0

80 lines not on this page · raw message

tools/perf/arch/arm64/util/unwind-libunwind.c new file +82 -0

82 lines not on this page · raw message

tools/perf/arch/x86/include/perf_regs.h +1 -1
index fc819ca..7df517a 100644

Lines of this file are not shown. View the raw message.

tools/perf/arch/x86/tests/dwarf-unwind.c +1 -1
index 83bc238..9f89f89 100644

Lines of this file are not shown. View the raw message.

tools/perf/arch/x86/util/tsc.c +1 -1
index b2519e4..40021fa 100644

Lines of this file are not shown. View the raw message.

tools/perf/arch/x86/util/tsc.h +1 -1
index a24dec8..2affe03 100644

Lines of this file are not shown. View the raw message.

tools/perf/builtin-annotate.c +4 -4
index 0da603b..1ec429f 100644

Lines of this file are not shown. View the raw message.

tools/perf/builtin-diff.c +37 -15

52 lines not on this page · raw message

tools/perf/builtin-inject.c +1 -1
index 3a73875..6a3af00 100644

Lines of this file are not shown. View the raw message.

tools/perf/builtin-kmem.c +9 -79

88 lines not on this page · raw message

tools/perf/builtin-lock.c +6 -4
index c852c7a..6148afc 100644

Lines of this file are not shown. View the raw message.

tools/perf/builtin-mem.c +8 -7
index 2e3ade69..4a1a6c9 100644

Lines of this file are not shown. View the raw message.

tools/perf/builtin-record.c +65 -98

163 lines not on this page · raw message

tools/perf/builtin-report.c +105 -267

372 lines not on this page · raw message

tools/perf/builtin-sched.c +40 -42

82 lines not on this page · raw message

tools/perf/builtin-top.c +67 -45

112 lines not on this page · raw message

tools/perf/config/Makefile +11 -12
index 802cf54..4f100b5 100644

Lines of this file are not shown. View the raw message.

tools/perf/config/feature-checks/Makefile +0 -4
index 2da103c..64c84e5 100644

Lines of this file are not shown. View the raw message.

tools/perf/config/feature-checks/test-all.c +0 -5
index fc37eb3..fe5c1e5 100644

Lines of this file are not shown. View the raw message.

tools/perf/config/feature-checks/test-on-exit.c deleted +0 -16
deleted file mode 100644
index 8e88b16..0000000

Lines of this file are not shown. View the raw message.

tools/perf/perf-completion.sh +2 -2
index ae3a576..3356984 100644

Lines of this file are not shown. View the raw message.

tools/perf/perf-sys.h new file +190 -0

190 lines not on this page · raw message

tools/perf/perf.c +6 -2
index 431798a..78f7b92 100644

Lines of this file are not shown. View the raw message.

tools/perf/perf.h +9 -239

248 lines not on this page · raw message

tools/perf/tests/attr.c +0 -7
index 00218f5..2dfc9ad 100644

Lines of this file are not shown. View the raw message.

tools/perf/tests/builtin-test.c +21 -1
index b11bf8a..802e3cd 100644

Lines of this file are not shown. View the raw message.

tools/perf/tests/code-reading.c +2 -3
index bfb1869..67f2d63 100644

Lines of this file are not shown. View the raw message.

tools/perf/tests/dso-data.c +1 -1
index 9cc81a3..3e6cb17 100644

Lines of this file are not shown. View the raw message.

tools/perf/tests/dwarf-unwind.c +1 -1
index c059ee8..108f0cd 100644

Lines of this file are not shown. View the raw message.

tools/perf/tests/evsel-tp-sched.c +0 -3
index 4774f7f..35d7fdb 100644

Lines of this file are not shown. View the raw message.

tools/perf/tests/hists_common.c new file +209 -0

209 lines not on this page · raw message

tools/perf/tests/hists_common.h new file +75 -0

75 lines not on this page · raw message

tools/perf/tests/hists_cumulate.c new file +726 -0

726 lines not on this page · raw message

tools/perf/tests/hists_filter.c new file +289 -0

289 lines not on this page · raw message

tools/perf/tests/hists_link.c +24 -185

209 lines not on this page · raw message

tools/perf/tests/hists_output.c new file +621 -0

621 lines not on this page · raw message

tools/perf/tests/keep-tracking.c +1 -1
index 497957f..7a5ab7b 100644

Lines of this file are not shown. View the raw message.

tools/perf/tests/mmap-thread-lookup.c new file +233 -0

233 lines not on this page · raw message

tools/perf/tests/parse-events.c +97 -45

142 lines not on this page · raw message

tools/perf/tests/parse-no-sample-id-all.c +1 -1
index e117b6c..905019f 100644

Lines of this file are not shown. View the raw message.

tools/perf/tests/perf-time-to-tsc.c +1 -2
index 47146d3..3b7cd4d 100644

Lines of this file are not shown. View the raw message.

tools/perf/tests/rdpmc.c +1 -1
index 46649c2..e59143f 100644

Lines of this file are not shown. View the raw message.

tools/perf/tests/sample-parsing.c +1 -1
index 0014d3c..7ae8d17 100644

Lines of this file are not shown. View the raw message.

tools/perf/tests/tests.h +6 -1
index a24795c..022bb68 100644

Lines of this file are not shown. View the raw message.

tools/perf/tests/thread-mg-share.c new file +90 -0

90 lines not on this page · raw message

tools/perf/ui/browser.c +1 -1
index d11541d..3ccf6e1 100644

Lines of this file are not shown. View the raw message.

tools/perf/ui/browser.h +1 -3
index 118cca2..03d4d62 100644

Lines of this file are not shown. View the raw message.

tools/perf/ui/browsers/hists.c +162 -108

270 lines not on this page · raw message

tools/perf/ui/gtk/hists.c +36 -41

77 lines not on this page · raw message

tools/perf/ui/hist.c +324 -47

371 lines not on this page · raw message

tools/perf/ui/progress.h +1 -1
index 29ec8ef..f34f89e 100644

Lines of this file are not shown. View the raw message.

tools/perf/ui/setup.c +0 -2
index 5df5140..ba51fa8 100644

Lines of this file are not shown. View the raw message.

tools/perf/ui/stdio/hist.c +36 -53

89 lines not on this page · raw message

tools/perf/util/annotate.h +1 -1
index 56ad4f5..112d6e2 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/build-id.c +1 -1
index 6baabe6..a904a4c 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/build-id.h +1 -1
index 845ef86..ae39256 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/callchain.c +122 -1

123 lines not on this page · raw message

tools/perf/util/callchain.h +19 -0
index 8ad97e9..8f84423 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/config.c +4 -0
index 3e0fdd3..24519e1 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/cpumap.c +160 -0

160 lines not on this page · raw message

tools/perf/util/cpumap.h +35 -0
index b123bb9..61a6548 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/dso.h +1 -1
index ab06f1c..38efe95 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/event.c +2 -2
index 9d12aa6..65795b8 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/event.h +24 -0
index 38457d4..d970232 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/evsel.h +7 -2
index 0c9926c..a52e9a5 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/header.h +2 -2
index a2d047b..d08cfe4 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/hist.c +573 -95

668 lines not on this page · raw message

tools/perf/util/hist.h +97 -4

101 lines not on this page · raw message

tools/perf/util/include/linux/bitmap.h +3 -0
index bb162e4..01ffd12 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/include/linux/export.h deleted +0 -6
deleted file mode 100644
index b43e2dc..0000000

Lines of this file are not shown. View the raw message.

tools/perf/util/include/linux/list.h +1 -0
index bfe0a2a..76ddbc7 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/include/linux/types.h deleted +0 -29
deleted file mode 100644
index eb46478..0000000

Lines of this file are not shown. View the raw message.

tools/perf/util/machine.c +11 -0
index 27c2a5e..7409ac8 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/map.c +117 -1

118 lines not on this page · raw message

tools/perf/util/map.h +13 -1
index f00f058..ae2d451 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/pager.c +6 -6
index 3322b84..31ee02d 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/parse-events.h +1 -2
index f1cb4c4..df094b4 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/parse-events.y +13 -1
index 4eb67ec..0bc87ba 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/perf_regs.h +1 -1
index d6e8b6a..79c78f7 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/pmu.c +3 -3
index 00a7dcb..7a811eb 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/pmu.h +1 -1
index 8b64125..c14a543 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/session.c +3 -2
index 55960f2..64a186e 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/sort.c +462 -61

523 lines not on this page · raw message

tools/perf/util/sort.h +24 -2
index 43e5ff4..5bf0098 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/stat.h +1 -1
index ae8ccd7..5667fc3 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/svghelper.c +1 -1
index 43262b8..6a0a13d 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/svghelper.h +1 -1
index f7b4d6e..e3aff53 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/symbol.c +6 -5
index 95e2497..7b9096f 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/symbol.h +4 -1
index 501e4e7..615c752 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/thread.c +40 -12

52 lines not on this page · raw message

tools/perf/util/thread.h +2 -1
index 9b29f08..3c0c272 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/top.h +1 -1
index dab14d0..f92c37a 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/types.h deleted +0 -24
deleted file mode 100644
index c51fa6b..0000000

Lines of this file are not shown. View the raw message.

tools/perf/util/unwind-libdw.c +1 -1
index 67db73e..5ec80a5 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/unwind.h +1 -1
index b031316..f030612 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/util.c +2 -0
index 9f66549..7fff6be 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/util.h +1 -1
index 6995d66..b03da44 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/values.h +1 -1
index 2fa967e..b21a80c 100644

Lines of this file are not shown. View the raw message.

tools/virtio/Makefile +1 -1
index 3187c62..9325f46 100644

Lines of this file are not shown. View the raw message.

tools/virtio/linux/kernel.h +0 -7
index fba7059..1e8ce69 100644

Lines of this file are not shown. View the raw message.

tools/virtio/linux/types.h deleted +0 -28
deleted file mode 100644
index f8ebb9a..0000000

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.