lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 26 Jun 2016 11:20:52 +0000
From:	He Kuang <hekuang@...wei.com>
To:	<acme@...nel.org>, <peterz@...radead.org>, <mingo@...hat.com>,
	<jolsa@...hat.com>, <brendan.d.gregg@...il.com>, <ast@...nel.org>,
	<alexander.shishkin@...ux.intel.com>, <wangnan0@...wei.com>,
	<hekuang@...wei.com>
CC:	<linux-kernel@...r.kernel.org>
Subject: [RFC PATCH v2 00/26] perf tools: Support uBPF script

This patchset is based on Wang Nan's v1:
     http://thread.gmane.org/gmane.linux.kernel/2203717/focus=2203707

""" 
  This patch set allows to perf invoke some user space BPF scripts on
  some point. uBPF scripts and kernel BPF scripts reside in one BPF
  object.  They communicate with each other with BPF maps. uBPF
  scripts can invoke helper functions provided by perf.
  
  At least following new features can be achieved based on uBPF
  support:
  
   1) Report statistical result:

      Like DTrace, perf print statistical report before quit. No need
      to extract data using 'perf report'. Statistical method is
      controled by user.
  
   2) Control perf's behavior:

      Dynamically adjust period of different events. Policy is defined
      by user.
"""

and modified by following the reviewers' suggestions.

v1-v2:

  - Split bpf vm part out of kernel/bpf/core.c and link to it instead
    of using ubpf library(Suggested by Alexei Starovoitov). And add
    runtime bounds check just like ubpf library does.
    
  - Introduce bpf_engine(engine-kbpf, engine-ubpf) operations and
    getting rid of the complicate macros(Suggested by Arnaldo).

  - Use void pointer to reference kbpf/ubpf entries.(Suggested by
    Arnaldo)

The test case in the v1 cover letter still works but there's a slight
problem which should be pointed out to clarify the usage of ubpf
function arguments.

-int perf_record_end(int samples)
+struct perf_record_end_ctx {
+       int samples;
+       int dummy;
+};
+int perf_record_end(struct perf_record_end_ctx *ctx)

And the argument 'samples' should be referenced as 'ctx->samples'.

Thank you.

He Kuang (17):
  bpf: extract jmp and default handler and introduce UBPF_BUILD flag
  tools include: Add (atomic|atomic64)_add implementation from the
    kernel sources
  perf bpf: Implement empty instruction handler and build bpf-vm
  perf bpf: Remove unused code in libbpf
  perf bpf: Store arbitrary entries instread fd array in bpf_program
  perf bpf: Add libbpf-internal.h header file
  perf bpf: Add abstraction for bpf program methods
  perf bpf: Add -Wextra to cflags for more warnings and fix them
  perf bpf: Introduce the entity and engine for userspace bpf
  perf bpf: Add method for fetching nth ubpf vm
  perf bpf: Add methods to set/check ubpf engine for bpf programs
  perf bpf: Add ubpf helper function slots and set/get methods
  bpf: Support bpf load/store boundary check for ubpf
  perf bpf: Implement boundary check code in ubpf
  perf record: Add uBPF hooks at beginning and end of perf record
  perf bpf: Fillup bpf jmp_call handler
  perf bpf: Implement run_ubpf_program

Wang Nan (9):
  tools include: Adopt byte ordering macros from byteorder/generic.h
  tools include: Fix wrong macro definitions for cpu_to_le* for big
    endian
  bpf: split __bpf_prog_run code into new file
  tools include: Sync math64.h and div64.h
  perf bpf: Add map related BPF helper
  perf bpf: Add UBPF flags and makefile options
  perf tools: Register basic uBPF helpers
  perf bpf: Accept uBPF programs
  perf tests: Add uBPF test case

 include/linux/filter.h                             |   1 +
 kernel/bpf/Makefile                                |   2 +-
 kernel/bpf/core.c                                  | 487 -------------------
 kernel/bpf/vm.c                                    | 517 +++++++++++++++++++++
 tools/arch/x86/include/asm/atomic.h                |  28 ++
 tools/include/asm-generic/atomic-gcc.h             |  10 +
 tools/include/asm-generic/div64.h                  | 234 ++++++++++
 tools/include/linux/byteorder/generic.h            |  48 ++
 tools/include/linux/kernel.h                       |   7 +-
 tools/include/linux/math64.h                       | 247 ++++++++++
 tools/include/linux/types.h                        |   4 +
 tools/lib/bpf/Build                                |   2 +
 tools/lib/bpf/Makefile                             |   6 +-
 tools/lib/bpf/bpf.c                                |  24 +
 tools/lib/bpf/bpf.h                                |   2 +
 tools/lib/bpf/engine-kbpf.c                        | 131 ++++++
 tools/lib/bpf/engine-ubpf.c                        | 134 ++++++
 tools/lib/bpf/libbpf-internal.h                    |  76 +++
 tools/lib/bpf/libbpf.c                             | 216 ++-------
 tools/lib/bpf/libbpf.h                             |  43 +-
 tools/perf/MANIFEST                                |   3 +
 tools/perf/Makefile.perf                           |   2 +
 tools/perf/builtin-record.c                        |   4 +
 tools/perf/config/Makefile                         |   4 +
 tools/perf/perf.c                                  |   3 +
 tools/perf/tests/Build                             |   8 +
 tools/perf/tests/bpf-script-test-ubpf.c            |  88 ++++
 tools/perf/tests/bpf.c                             |  78 +++-
 tools/perf/tests/llvm.c                            |   4 +
 tools/perf/tests/llvm.h                            |   2 +
 tools/perf/util/Build                              |   3 +
 tools/perf/util/bpf-loader.c                       |  23 +-
 tools/perf/util/bpf-vm.c                           |  89 ++++
 tools/perf/util/bpf-vm.h                           |   8 +
 tools/perf/util/intel-bts.c                        |   5 -
 .../util/intel-pt-decoder/intel-pt-pkt-decoder.c   |   7 +-
 tools/perf/util/ubpf-helpers-list.h                |  11 +
 tools/perf/util/ubpf-helpers.c                     |  73 +++
 tools/perf/util/ubpf-helpers.h                     |  21 +
 tools/perf/util/ubpf-hooks-list.h                  |  34 ++
 tools/perf/util/ubpf-hooks.c                       |  81 ++++
 tools/perf/util/ubpf-hooks.h                       |  41 ++
 42 files changed, 2126 insertions(+), 685 deletions(-)
 create mode 100644 kernel/bpf/vm.c
 create mode 100644 tools/include/asm-generic/div64.h
 create mode 100644 tools/include/linux/byteorder/generic.h
 create mode 100644 tools/include/linux/math64.h
 create mode 100644 tools/lib/bpf/engine-kbpf.c
 create mode 100644 tools/lib/bpf/engine-ubpf.c
 create mode 100644 tools/lib/bpf/libbpf-internal.h
 create mode 100644 tools/perf/tests/bpf-script-test-ubpf.c
 create mode 100644 tools/perf/util/bpf-vm.c
 create mode 100644 tools/perf/util/bpf-vm.h
 create mode 100644 tools/perf/util/ubpf-helpers-list.h
 create mode 100644 tools/perf/util/ubpf-helpers.c
 create mode 100644 tools/perf/util/ubpf-helpers.h
 create mode 100644 tools/perf/util/ubpf-hooks-list.h
 create mode 100644 tools/perf/util/ubpf-hooks.c
 create mode 100644 tools/perf/util/ubpf-hooks.h

-- 
1.8.5.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ