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]
Message-ID: <1433144296-74992-1-git-send-email-wangnan0@huawei.com>
Date:	Mon, 1 Jun 2015 07:37:46 +0000
From:	Wang Nan <wangnan0@...wei.com>
To:	<namhyung@...nel.org>, <alexei.starovoitov@...il.com>,
	<masami.hiramatsu.pt@...achi.com>, <acme@...nel.org>,
	<paulus@...ba.org>, <a.p.zijlstra@...llo.nl>, <mingo@...hat.com>,
	<jolsa@...nel.org>, <dsahern@...il.com>, <daniel@...earbox.net>,
	<brendan.d.gregg@...il.com>
CC:	<lizefan@...wei.com>, <hekuang@...wei.com>, <xiakaixu@...wei.com>,
	<linux-kernel@...r.kernel.org>, <pi3orama@....com>
Subject: [RFC PATCH v5 00/30] perf tools: filtering events using eBPF programs

This is the 5th version of patch series which tries to introduce eBPF
programs to perf. It enables 'perf record' to filter events using eBPF
programs like:

 # perf record --event bpf-file.o sleep 1

Events are selected and filtered according to definitions in bpf-file.o.

Compare with previous v4 patch (can be found from:
http://lkml.org/lkml/2015/5/27/56), this series does following
improvements:

 1. Rebased on tip/perf/core (5c9b9bc).

 2. Length of 'version' section should be equal to sizeof(u32).

 3. Add new directories and header files into perf MAINFEST file to
    make 'make perf-targz-src-pkg' collects enough files.

 4. Add NO_LIBBPF compiling option to perf's Makefile.

    In previous version, perf decides whether to build libbpf based on
    existance of libelf. However, further patches may make libbpf to
    depend on more libraries, like LLVM. In v5, building flag of libbpf
    is separated from NO_LINELF. Corresponding testing targets are also
    added.
 
 5. Check BPF API before building libbpf.

    A new feature check is added into tools/build/features to check
    compatibility of BPF API to avoid compiling error if 'kern_version'
    not exist.

 6. Release resource after loading. See discussion in
    https://lkml.org/lkml/2015/5/27/33 .

 7. When trying to attach eBPF programs to inline functions, for
    example, dst_output_sk(), v4 only attaches the first point. This
    series solves this problem in 26/30 and 27/30, by bringing
    information in probe_trace_event to perf_probe_event and add events
    based on probe_trace_event.

 8. Coding style improvements.

 9. Pass 'make build-test' checking.

Patch 'perf probe: Fix segfault when glob matching function without
debuginfo' (lkml.org/lkml/2015/5/29/168) is required for testing.

 Patch 1/30 - 2/30 extract some headers to tools/include for compiling.

 Patch 3/30 add a feature check to check version of eBPF API.

 Patch 4/30 - 22/30 introduce libbpf, which first parse eBPF object
   files then load maps and programs into kernel.

 Patch 23-30 - 30/30 are perf side modifications, introducing
   new syntax: '--event [.*].(o|bpf)' to enable passing eBPF object
   files to 'perf record', create probing points and attach programs
   to those points.

Wang Nan (30):
  perf tools: Move linux/kernel.h to tools/include
  perf tools: Move linux/{list.h,poison.h} to tools/include
  tools build: Add feature check for eBPF API
  bpf tools: Introduce 'bpf' library to tools
  bpf tools: Allow caller to set printing function
  bpf tools: Open eBPF object file and do basic validation
  bpf tools: Check endianess and make libbpf fail early
  bpf tools: Iterate over ELF sections to collect information
  bpf tools: Collect version and license from ELF sections
  bpf tools: Collect map definitions from 'maps' section
  bpf tools: Collect symbol table from SHT_SYMTAB section
  bpf tools: Collect eBPF programs from their own sections
  bpf tools: Collect relocation sections from SHT_REL sections
  bpf tools: Record map accessing instructions for each program
  bpf tools: Add bpf.c/h for common bpf operations
  bpf tools: Create eBPF maps defined in an object file
  bpf tools: Relocate eBPF programs
  bpf tools: Introduce bpf_load_program() to bpf.c
  bpf tools: Load eBPF programs in object files into kernel
  bpf tools: Introduce accessors for struct bpf_program
  bpf tools: Introduce accessors for struct bpf_object
  bpf tools: Link all bpf objects onto a list
  perf tools: Make perf depend on libbpf
  perf record: Enable passing bpf object file to --event
  perf tools: Parse probe points of eBPF programs during preparation
  perf probe: Attach trace_probe_event with perf_probe_event
  perf record: Probe at kprobe points
  perf record: Load all eBPF object into kernel
  perf tools: Add bpf_fd field to evsel and config it
  perf tools: Attach eBPF program to perf event

 tools/build/Makefile.feature                 |   6 +-
 tools/build/feature/Makefile                 |   6 +-
 tools/build/feature/test-bpf.c               |  18 +
 tools/{perf/util => }/include/linux/kernel.h |   0
 tools/{perf/util => }/include/linux/list.h   |   6 +-
 tools/include/linux/poison.h                 |   1 +
 tools/lib/bpf/.gitignore                     |   2 +
 tools/lib/bpf/Build                          |   1 +
 tools/lib/bpf/Makefile                       | 195 ++++++
 tools/lib/bpf/bpf.c                          |  84 +++
 tools/lib/bpf/bpf.h                          |  23 +
 tools/lib/bpf/libbpf.c                       | 993 +++++++++++++++++++++++++++
 tools/lib/bpf/libbpf.h                       |  83 +++
 tools/perf/MANIFEST                          |   6 +
 tools/perf/Makefile.perf                     |  23 +-
 tools/perf/builtin-probe.c                   |   2 +-
 tools/perf/builtin-record.c                  |  32 +-
 tools/perf/config/Makefile                   |   8 +
 tools/perf/tests/make                        |   4 +-
 tools/perf/util/Build                        |   1 +
 tools/perf/util/bpf-loader.c                 | 283 ++++++++
 tools/perf/util/bpf-loader.h                 |  45 ++
 tools/perf/util/debug.c                      |   5 +
 tools/perf/util/debug.h                      |   1 +
 tools/perf/util/evlist.c                     |  51 ++
 tools/perf/util/evlist.h                     |   1 +
 tools/perf/util/evsel.c                      |  17 +
 tools/perf/util/evsel.h                      |   1 +
 tools/perf/util/include/linux/poison.h       |   1 -
 tools/perf/util/parse-events.c               |  16 +
 tools/perf/util/parse-events.h               |   2 +
 tools/perf/util/parse-events.l               |   3 +
 tools/perf/util/parse-events.y               |  18 +-
 tools/perf/util/probe-event.c                |  57 +-
 tools/perf/util/probe-event.h                |   5 +-
 35 files changed, 1958 insertions(+), 42 deletions(-)
 create mode 100644 tools/build/feature/test-bpf.c
 rename tools/{perf/util => }/include/linux/kernel.h (100%)
 rename tools/{perf/util => }/include/linux/list.h (90%)
 create mode 100644 tools/include/linux/poison.h
 create mode 100644 tools/lib/bpf/.gitignore
 create mode 100644 tools/lib/bpf/Build
 create mode 100644 tools/lib/bpf/Makefile
 create mode 100644 tools/lib/bpf/bpf.c
 create mode 100644 tools/lib/bpf/bpf.h
 create mode 100644 tools/lib/bpf/libbpf.c
 create mode 100644 tools/lib/bpf/libbpf.h
 create mode 100644 tools/perf/util/bpf-loader.c
 create mode 100644 tools/perf/util/bpf-loader.h
 delete mode 100644 tools/perf/util/include/linux/poison.h

-- 
1.8.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ