├── .gitattributes ├── .gitignore ├── .mailmap ├── .travis.yml ├── CMakeLists.txt ├── CODING_STYLE.md ├── CONTRIBUTING.md ├── ChangeLog ├── LICENSE ├── README.md ├── TODO.md ├── cmake_uninstall.cmake.in ├── doc ├── DSGN_beh_act_dia.uml ├── DSGN_data_flow_dia.uml ├── DSGN_rst_style.yaml └── vltrace-DESIGN.md ├── man ├── CMakeLists.txt ├── README ├── default.man ├── generated │ └── vltrace.1 └── vltrace.1.md ├── src ├── CMakeLists.txt ├── attach_probes.c ├── attach_probes.h ├── bpf_ctx.c ├── bpf_ctx.h ├── cl_parser.c ├── cl_parser.h ├── config.h.in ├── ebpf │ ├── CMakeLists.txt │ ├── README │ ├── README_templates.txt │ ├── ebpf_file_set.c │ ├── ebpf_file_set.h │ ├── macro_const_string_mode.c │ ├── macro_full_string_mode.c │ ├── macro_pid_ff_disabled.c │ ├── macro_pid_ff_full.c │ ├── macro_pid_own.c │ ├── template_0_str.c │ ├── template_1_str-const.c │ ├── template_1_str-full.c │ ├── template_1_str-sl.c │ ├── template_2_str-const.c │ ├── template_2_str-full.c │ ├── template_2_str-ml.c │ ├── template_2_str-sl.c │ ├── template_3_str-const.c │ ├── template_3_str-full.c │ ├── template_3_str-ml.c │ ├── template_3_str-sl.c │ ├── template_exit.c │ ├── template_fork.c │ ├── template_tracepoints.c │ ├── trace.h │ └── trace_head.c ├── ebpf_syscalls.c ├── ebpf_syscalls.h ├── generate_ebpf.c ├── generate_ebpf.h ├── print_event_cb.c ├── print_event_cb.h ├── syscalls_numbers.h ├── txt.c ├── txt.h ├── utils.c ├── utils.h ├── vltrace.c └── vltrace.h ├── test ├── CMakeLists.txt ├── README ├── cut-0.log.match ├── cut-1-1.log.match ├── cut-1-13.log.match ├── cut-1-14.log.match ├── cut-1-15.log.match ├── cut-1-3.log.match ├── cut-1-5.log.match ├── cut-1-6.log.match ├── cut-10-15.log.match ├── cut-10.log.match ├── cut-11-15.log.match ├── cut-11.log.match ├── cut-12.log.match ├── cut-2-1.log.match ├── cut-2-13.log.match ├── cut-2-14.log.match ├── cut-2-15.log.match ├── cut-2-3.log.match ├── cut-2-5.log.match ├── cut-2-6.log.match ├── cut-2.log.match ├── cut-3-14.log.match ├── cut-3-15.log.match ├── cut-3-5.log.match ├── cut-3-6.log.match ├── cut-4-14.log.match ├── cut-4-15.log.match ├── cut-4-5.log.match ├── cut-4-6.log.match ├── cut-4.log.match ├── cut-5-15.log.match ├── cut-6-15.log.match ├── cut-7-15.log.match ├── cut-7.log.match ├── cut-8-15.log.match ├── cut-8.log.match ├── cut-9-15.log.match ├── cut-9.log.match ├── helper_functions.sh ├── match ├── test-match ├── test_syscalls.c └── utils │ ├── report-tests.sh │ ├── run-tests.sh │ ├── view-tests-short.sh │ └── view-tests.sh ├── tools ├── bench_sc │ └── bench_sc.c └── bin2txt │ ├── .gitignore │ ├── README.md │ ├── bin2txt.py │ ├── converter.py │ ├── exceptions.py │ ├── syscall.py │ ├── syscallinfo.py │ ├── syscalltable.py │ └── utils.py └── utils ├── README ├── check-kernel.sh ├── check_license ├── check-headers.sh ├── check-license.c └── file-exceptions.sh ├── check_whitespace ├── cstyle ├── docker ├── 0001-travis-fix-travisci_build_coverity_scan.sh.patch ├── build.sh ├── images │ ├── Dockerfile.fedora-25 │ ├── Dockerfile.ubuntu-16.04 │ ├── build-image.sh │ └── push-image.sh ├── pull-or-rebuild-image.sh ├── run-build-package.sh ├── run-build.sh └── run-coverity.sh ├── functions.sh ├── generate_headers.sh ├── md2man.sh └── verify_syscalls.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | *.jpg binary 3 | *.png binary 4 | *.gif binary 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | /build 3 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | Krzysztof Czuryło 2 | Lukasz Dorau 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: trusty 2 | sudo: required 3 | 4 | language: c 5 | 6 | env: 7 | matrix: 8 | - TYPE=normal OS=fedora OS_VER=25 PUSH_IMAGE=1 9 | - TYPE=normal OS=ubuntu OS_VER=16.04 PUSH_IMAGE=1 10 | - TYPE=coverity OS=ubuntu OS_VER=16.04 11 | 12 | before_install: 13 | - export GITHUB_REPO=pmem/vltrace 14 | - export DOCKER_REPO=pmem/vltrace 15 | - uname -r 16 | - sudo apt-get install -y linux-headers-$(uname -r) 17 | - sudo find /usr -name "syscalls_64.h" 2>/dev/null | grep -e 'generated' 18 | - export HOST_WORKDIR=`pwd` 19 | - cd utils/docker 20 | - ./pull-or-rebuild-image.sh 21 | - if [[ -f push_image_to_repo_flag ]]; then PUSH_THE_IMAGE=1; fi 22 | - rm -f push_image_to_repo_flag 23 | 24 | script: 25 | - ./build.sh 26 | 27 | after_success: 28 | - if [[ $PUSH_THE_IMAGE -eq 1 ]]; then images/push-image.sh $OS-$OS_VER; fi 29 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to vltrace 2 | 3 | Here you'll find instructions on how to contribute to vltrace. 4 | 5 | Your contributions are most welcome! You'll find it is best to begin 6 | with a conversation about your changes, rather than just writing a bunch 7 | of code and contributing it out of the blue. 8 | The only way to suggest new features, offer to add a feature, 9 | or just begin a dialog about the vltrace is: 10 | 11 | * Open an issue in GitHub 12 | 13 | **NOTE: If you do decide to implement code changes and contribute them, 14 | please make sure you agree your contribution can be made available 15 | under the [BSD-style License used for the vltrace] 16 | 17 | **NOTE: Submitting your changes also means that you certify the following:** 18 | 19 | ``` 20 | Developer's Certificate of Origin 1.1 21 | 22 | By making a contribution to this project, I certify that: 23 | 24 | (a) The contribution was created in whole or in part by me and I 25 | have the right to submit it under the open source license 26 | indicated in the file; or 27 | 28 | (b) The contribution is based upon previous work that, to the best 29 | of my knowledge, is covered under an appropriate open source 30 | license and I have the right under that license to submit that 31 | work with modifications, whether created in whole or in part 32 | by me, under the same open source license (unless I am 33 | permitted to submit under a different license), as indicated 34 | in the file; or 35 | 36 | (c) The contribution was provided directly to me by some other 37 | person who certified (a), (b) or (c) and I have not modified 38 | it. 39 | 40 | (d) I understand and agree that this project and the contribution 41 | are public and that a record of the contribution (including all 42 | personal information I submit with it, including my sign-off) is 43 | maintained indefinitely and may be redistributed consistent with 44 | this project or the open source license(s) involved. 45 | ``` 46 | 47 | In case of any doubt, the gatekeeper may ask you to certify the above in writing, 48 | i.e. via email or by including a `Signed-off-by:` line at the bottom 49 | of your commit comments. 50 | 51 | To improve tracking of who is the author of a contribution, we kindly ask you 52 | to use your real name (not an alias) when commiting your changes to the vltrace: 53 | ``` 54 | Author: Random J Developer 55 | ``` 56 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | Mon 5 Dec CET 2016 Vitalii Chernookyi 2 | Thu 16 Feb CET 2017 Lukasz Dorau 3 | 4 | * Version 0.1 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014-2017, Intel Corporation 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the 13 | distribution. 14 | 15 | * Neither the name of the copyright holder nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | 32 | Everything in this source tree is covered by the previous license 33 | with the following exceptions: 34 | 35 | * utils/cstyle (used only during development) licensed under CDDL. 36 | * cmake/cmake_uninstall.cmake.in licensed under Creative Commons. 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | vltrace: syscall tracer using eBPF 2 | ================================== 3 | 4 | [![Build Status](https://travis-ci.org/pmem/vltrace.svg)](https://travis-ci.org/pmem/vltrace) 5 | [![Coverity Scan Build Status](https://scan.coverity.com/projects/13758/badge.svg)](https://scan.coverity.com/projects/pmem-vltrace) 6 | 7 | ## ⚠️ Discontinuation of the project 8 | The **vltrace** project will no longer be maintained by Intel. 9 | - Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, 10 | or updates, to this project. 11 | - Intel no longer accepts patches to this project. 12 | - If you have an ongoing need to use this project, are interested in independently developing it, or would like to 13 | maintain patches for the open source software community, please create your own fork of this project. 14 | - You will find more information [here](https://pmem.io/blog/2022/11/update-on-pmdk-and-our-long-term-support-strategy/). 15 | 16 | ## Introduction 17 | 18 | This is the top-level README.md of vltrace. 19 | 20 | vltrace is a syscall tracing tool which utilizes eBPF - an efficient tracing feature of the Linux kernel. 21 | 22 | ## LICENSE 23 | 24 | Please see the file [LICENSE](https://github.com/pmem/vltrace/blob/master/LICENSE) 25 | for information on how this tool is licensed. 26 | 27 | ## DEPENDENCIES 28 | 29 | The vltrace depends on [libbcc](https://github.com/iovisor/bcc) library. 30 | The installation guide of libbcc can be found [here](https://github.com/iovisor/bcc/blob/master/INSTALL.md). 31 | 32 | ## SYSTEM REQUIREMENTS 33 | 34 | - kernel v4.7 or later [(to attach eBPF to tracepoints)](https://github.com/iovisor/bcc/blob/master/docs/kernel-versions.md) 35 | - kernel headers installed: 36 | - 'kernel-devel' package on RHEL, Fedora and CentOS or 37 | - 'linux-headers' package on Debian and Ubuntu 38 | - libbcc v0.4.0 39 | - CAP_SYS_ADMIN capability (required by the bpf() syscall) 40 | - mounted debugfs and tracefs 41 | 42 | ## CONTACTS 43 | 44 | If you read the [blog post](https://pmem.io/blog/2022/11/update-on-pmdk-and-our-long-term-support-strategy/) and still have some questions (especially about discontinuation of the project), please contact us using the dedicated e-mail: pmdk_support@intel.com. 45 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | # TODO 2 | 3 | 1. Performance improvement 4 | ============================ 5 | 6 | Currently we require a bit more than 1000 nsec for tracing a single syscall. 7 | It is not bad but there are at least a few places which could allow us to 8 | reduce this value maybe to 600 nsec. Every syscall itself currently requires 9 | a bit more than 100 nsec for entering and close to the same value for 10 | returning. So a bit more than 200 nsec together. 11 | 12 | 1.1 Extra poll() 13 | ----------------- 14 | 15 | _Currently libbcc does two poll() syscalls per iter. There is no reason for 16 | it and we should drop it. It will improve our time by about 200 nsec, but it 17 | is a libbcc bug. A backtrace for one of that poll() syscalls:_ 18 | 19 | ``` 20 | (gdb) bt 21 | #0 poll () at ../sysdeps/unix/syscall-template.S:84 22 | #1 0x00007f9c40a07566 in perf_reader_poll () from /usr/lib/x86_64-linux-gnu/libbcc.so.0 23 | #2 0x0000000000401a7b in kprobe_poll (b=, timeout=) at BPF.c:82 24 | #3 0x000000000040175d in main (argc=, argv=0x7fffe635c888) at snoop.c:228 25 | ``` 26 | 27 | GitHub issue: https://github.com/iovisor/bcc/issues/779 28 | 29 | 1.2 Output buffering 30 | -------------------- 31 | 32 | Optimization of this place is critical to achieve maximum possible log 33 | bandwidth. 34 | 35 | 36 | 2. Debugging 37 | ============= 38 | 39 | 2.1 Enable Valgrind 40 | -------------------- 41 | 42 | _Currently Valgrind fails with a message like:_ 43 | 44 | ``` 45 | --12470-- WARNING: unhandled amd64-linux syscall: 321 46 | ==12470== at 0x77F7C19: syscall (syscall.S:38) 47 | ==12470== by 0x5129133: bpf_create_map (in /usr/lib/x86_64-linux-gnu/libbcc.so.0.1.8) 48 | ==12470== by 0x5181809: ??? (in /usr/lib/x86_64-linux-gnu/libbcc.so.0.1.8) 49 | ==12470== by 0x51AE4A7: ??? (in /usr/lib/x86_64-linux-gnu/libbcc.so.0.1.8) 50 | ==12470== by 0x51835E6: ??? (in /usr/lib/x86_64-linux-gnu/libbcc.so.0.1.8) 51 | ==12470== by 0x522FE1C: ??? (in /usr/lib/x86_64-linux-gnu/libbcc.so.0.1.8) 52 | ==12470== by 0x53DCE85: ??? (in /usr/lib/x86_64-linux-gnu/libbcc.so.0.1.8) 53 | ==12470== by 0x520B9BD: ??? (in /usr/lib/x86_64-linux-gnu/libbcc.so.0.1.8) 54 | ==12470== by 0x51E0065: ??? (in /usr/lib/x86_64-linux-gnu/libbcc.so.0.1.8) 55 | ==12470== by 0x51751A4: ??? (in /usr/lib/x86_64-linux-gnu/libbcc.so.0.1.8) 56 | ==12470== by 0x51209B3: ebpf::BPFModule::load_cfile(std::__cxx11::basic_string, std::allocator > const&, bool, char const**, int) (in /usr/lib/x86_64-linux-gnu/libbcc.so.0.1.8) 57 | ==12470== by 0x51268FD: ebpf::BPFModule::load_string(std::__cxx11::basic_string, std::allocator > const&, char const**, int) (in /usr/lib/x86_64-linux-gnu/libbcc.so.0.1.8) 58 | --12470-- You may be able to write your own handler. 59 | --12470-- Read the file README_MISSING_SYSCALL_OR_IOCTL. 60 | --12470-- Nevertheless we consider this a bug. Please report 61 | --12470-- it at http://valgrind.org/support/bug_reports.html. 62 | ``` 63 | 64 | 65 | 3. Extra features 66 | ================== 67 | 68 | 3.1 Multi-process tracing 69 | -------------------------- 70 | 71 | It is not difficult to attach to multiple PIDs simultaneously. Maybe we should do 72 | it for parallel applications like apache, nginx and like. Most likelly we 73 | should simulate -p option from `man 1 strace`. 74 | 75 | 3.2 Attaching by name 76 | ---------------------- 77 | 78 | It is good to have the ability to attach to processes not only by PIDs 79 | but also by names. 80 | 81 | 3.3 Implement one more way to attach, using hack with seccomp 82 | -------------------------------------------------------------- 83 | 84 | It will improve the time of attaching and detaching. 85 | 86 | - https://github.com/iovisor/bcc/issues/786 87 | 88 | 89 | 4. Output logs 90 | ============================ 91 | 92 | 4.1 Binary log format: packet-counter field 93 | -------------------------------------------- 94 | 95 | We should think about writting 64-bit packet number before length 96 | of packet, because it will enlarge reliability of logs. But there is 97 | probability that counting packets will be very expensive, because we run 98 | in multi-threading environment. 99 | -------------------------------------------------------------------------------- /cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | # From: https://cmake.org/Wiki/CMake_FAQ 2 | 3 | if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 5 | endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 6 | 7 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 8 | string(REGEX REPLACE "\n" ";" files "${files}") 9 | foreach(file ${files}) 10 | message(STATUS "Uninstalling $ENV{DESTDIR}${file}") 11 | if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 12 | exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 13 | OUTPUT_VARIABLE rm_out 14 | RETURN_VALUE rm_retval 15 | ) 16 | if(NOT "${rm_retval}" STREQUAL 0) 17 | message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") 18 | endif(NOT "${rm_retval}" STREQUAL 0) 19 | else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 20 | message(STATUS "File $ENV{DESTDIR}${file} does not exist.") 21 | endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 22 | endforeach(file) 23 | -------------------------------------------------------------------------------- /doc/DSGN_beh_act_dia.uml: -------------------------------------------------------------------------------- 1 | @startuml 2 | scale 2.0 3 | start 4 | :Command Line Parsing; 5 | :Loading "command"; 6 | note right 7 | Optional 8 | end note 9 | :Generating eBPF source code; 10 | :Compiling eBPF source code; 11 | :Attaching eBPF handlers to syscalls using Kprobe and eBPF VM; 12 | :Starting "command"; 13 | note right 14 | Optional 15 | end note 16 | while (cont?) is (true) 17 | partition libbcc { 18 | :poll() - wait for events; 19 | } 20 | endwhile (false) 21 | stop 22 | @enduml 23 | -------------------------------------------------------------------------------- /doc/DSGN_data_flow_dia.uml: -------------------------------------------------------------------------------- 1 | @startuml 2 | skinparam componentStyle uml2 3 | scale 3.0 4 | package "User Space" { 5 | [Traced Application] as TA 6 | [Tracing Tool] as TT 7 | } 8 | cloud "Per-CPU Circular Buffers" as CB { 9 | () "CB #0" as CB1 10 | CB1 -left-> TT : events 11 | 12 | () "..." as CBx 13 | CBx -left-> TT : events 14 | 15 | () "CB #n" as CBn 16 | CBn -left-> TT : events 17 | } 18 | 19 | package "Kernel Space" { 20 | folder "SysCalls table" { 21 | () "SC #1" as SC1 22 | () "..." as SC2 23 | () "SC #x" as SCx 24 | () "..." as SC4 25 | () "SC #n" as SCn 26 | TA -down-> SCx : SysCall 27 | } 28 | '1 29 | [EBPF VM #1] as VM1 30 | SC1 -down-> VM1 : Kprobe 31 | VM1 -up-> CB : events 32 | 33 | [SC #1 Handler] as SCH1 34 | VM1 -down-> SCH1 : Kprobe 35 | 'x 36 | [EBPF VM #x] as VMx 37 | SCx -down-> VMx : Kprobe 38 | VMx -up-> CB : events 39 | 40 | [SC #x Handler] as SCHx 41 | VMx -down-> SCHx : Kprobe 42 | 'n 43 | [EBPF VM #n] as VMn 44 | SCn -down-> VMn : Kprobe 45 | VMn -up-> CB : events 46 | 47 | [SC #n Handler] as SCHn 48 | VMn -down-> SCHn : Kprobe 49 | } 50 | @enduml 51 | -------------------------------------------------------------------------------- /doc/vltrace-DESIGN.md: -------------------------------------------------------------------------------- 1 | % vltrace 2 | % **Fast syscall tracing** 3 | % Vitalii Chernookyi 4 | % Lukasz Dorau 5 | 6 | ****** 7 | 8 | Why we need a new tool ? 9 | ------------------------ 10 | 11 | - regular system tracing tools are slow 12 | - regular tools slow down traced application by few orders of magnitude 13 | - output of regular tools is human-oriented and is not well suited 14 | for automated processing 15 | - overcoming above problems in regular way require: 16 | 17 | - kernel hacking (sysdig) 18 | - special HW (Lauterbach). 19 | 20 | ****** 21 | 22 | Used technologies 23 | ------------------ 24 | 25 | - eBPF 26 | - Kprobe 27 | - Perf Event Circular Buffer 28 | - event-loop 29 | 30 | ****** 31 | 32 | Pros 33 | ----- 34 | 35 | - Used combination of technologies allow tool to be about one order 36 | of magnitude faster than regular system strace. 37 | - Consumes much less amount of CPU resources. 38 | - Output is designed to be suitable for processing with classical tools 39 | and technologies, like awk. 40 | - Can trace syscalls system-wide. 41 | - Can trace init (process with 'pid == 1'). Finally we have a proper 42 | tool for debugging systemd ;-) 43 | 44 | ****** 45 | 46 | Cons 47 | ----- 48 | 49 | - Limited functionality. 50 | - Slow attaching and detaching. 51 | - Asynchronity. If user does not provide enough system resources, it may 52 | lose some calls. This tool does not try to work-around it in any way. 53 | - Depends on modern kernel features. 54 | - Underlying eBPF technology is still in active development. Hangs and crashes 55 | may occur more often as for regular strace, especially on low-res systems. 56 | - Truncating of very long filenames (longer then ~STR_MAX bytes) to ~STR_MAX. 57 | Details: 58 | + https://github.com/iovisor/bcc/issues/900 59 | 60 | ****** 61 | 62 | Data Flow Diagram 63 | ----------------------------- 64 | 65 | ![DSGN_data_flow_dia.png](DSGN_data_flow_dia.png) 66 | 67 | ****** 68 | 69 | Behavioral Activity Diagram 70 | ---------------------------- 71 | 72 | ![DSGN_beh_act_dia.png](DSGN_beh_act_dia.png) 73 | 74 | ****** 75 | 76 | Conclusion 77 | ----------- 78 | 79 | - we reached performance more than 1000000 syscalls per second. 80 | - we introduce about 750 nanosec of penalty in each syscall. 81 | - there is space for future optimizations. 82 | -------------------------------------------------------------------------------- /man/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017, Intel Corporation 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 11 | # * Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in 13 | # the documentation and/or other materials provided with the 14 | # distribution. 15 | # 16 | # * Neither the name of the copyright holder nor the names of its 17 | # contributors may be used to endorse or promote products derived 18 | # from this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | find_program(PANDOC pandoc) 33 | if (NOT PANDOC) 34 | message(WARNING "pandoc not found") 35 | endif() 36 | 37 | add_custom_target(manpages) 38 | 39 | function(generate_manpage name) 40 | add_custom_command( 41 | OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/generated/${name} 42 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.md 43 | COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/generated/ 44 | COMMAND ${CMAKE_SOURCE_DIR}/utils/md2man.sh 45 | ${CMAKE_CURRENT_SOURCE_DIR}/${name}.md 46 | ${CMAKE_CURRENT_SOURCE_DIR}/default.man 47 | ${CMAKE_CURRENT_SOURCE_DIR}/generated/${name} 48 | ) 49 | add_custom_target(manpage-${name} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/generated/${name}) 50 | add_dependencies(manpages manpage-${name}) 51 | endfunction() 52 | 53 | generate_manpage(vltrace.1) 54 | 55 | if(PANDOC) 56 | set(DIR ${CMAKE_CURRENT_BINARY_DIR}) 57 | else() 58 | set(DIR ${CMAKE_CURRENT_SOURCE_DIR}) 59 | endif() 60 | 61 | install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/generated/vltrace.1 62 | DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 63 | CONFIGURATIONS Release RelWithDebInfo Debug None) 64 | -------------------------------------------------------------------------------- /man/README: -------------------------------------------------------------------------------- 1 | vltrace 2 | 3 | This is man/README. 4 | 5 | This directory contains the source file used to generate the man page. 6 | 7 | All files in the *generated* directory are automatically generated. 8 | **DO NOT MODIFY THE FILES IN THAT DIRECTORY**. All changes to the 9 | documentation are to be made by modifying the \*.md files in the main doc 10 | directory. 11 | 12 | To create more readable text files from the source, use: 13 | $ make 14 | An even more convenient way to read these is to use the "man" command to 15 | format them (includes bold, underline, etc. when run in a terminal window): 16 | $ man -l vltrace.1 17 | -------------------------------------------------------------------------------- /man/default.man: -------------------------------------------------------------------------------- 1 | $if(has-tables)$ 2 | .\"t 3 | $endif$ 4 | $if(pandoc-version)$ 5 | .\" Automatically generated by Pandoc $pandoc-version$ 6 | .\" 7 | $endif$ 8 | $if(adjusting)$ 9 | .ad $adjusting$ 10 | $endif$ 11 | .TH "$title$" "$section$" "$version$" "$date$" "$footer$" "$header$" 12 | $if(hyphenate)$ 13 | .hy 14 | $else$ 15 | .nh \" Turn off hyphenation by default. 16 | $endif$ 17 | $for(header-includes)$ 18 | $header-includes$ 19 | $endfor$ 20 | .\" Copyright 2016-$year$, Intel Corporation 21 | .\" 22 | .\" Redistribution and use in source and binary forms, with or without 23 | .\" modification, are permitted provided that the following conditions 24 | .\" are met: 25 | .\" 26 | .\" * Redistributions of source code must retain the above copyright 27 | .\" notice, this list of conditions and the following disclaimer. 28 | .\" 29 | .\" * Redistributions in binary form must reproduce the above copyright 30 | .\" notice, this list of conditions and the following disclaimer in 31 | .\" the documentation and/or other materials provided with the 32 | .\" distribution. 33 | .\" 34 | .\" * Neither the name of the copyright holder nor the names of its 35 | .\" contributors may be used to endorse or promote products derived 36 | .\" from this software without specific prior written permission. 37 | .\" 38 | .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 39 | .\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 40 | .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 41 | .\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 42 | .\" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 43 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 44 | .\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 45 | .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 46 | .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 47 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 48 | .\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 49 | $for(include-before)$ 50 | $include-before$ 51 | $endfor$ 52 | $body$ 53 | $for(include-after)$ 54 | $include-after$ 55 | $endfor$ 56 | $if(author)$ 57 | .SH AUTHORS 58 | $for(author)$$author$$sep$; $endfor$. 59 | $endif$ 60 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017, Intel Corporation 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 11 | # * Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in 13 | # the documentation and/or other materials provided with the 14 | # distribution. 15 | # 16 | # * Neither the name of the copyright holder nor the names of its 17 | # contributors may be used to endorse or promote products derived 18 | # from this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | project(vltrace C) 33 | 34 | include(CheckCSourceRuns) 35 | 36 | add_cstyle(src) 37 | 38 | find_package(PkgConfig) 39 | 40 | if(PKG_CONFIG_FOUND) 41 | pkg_check_modules(LIBBCC REQUIRED libbcc=0.4.0) 42 | else() 43 | find_package(LIBBCC 0.4.0 REQUIRED) 44 | endif() 45 | 46 | if(LIBBCC_FOUND) 47 | set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES} -lbcc") 48 | 49 | CHECK_C_SOURCE_RUNS(" 50 | #include 51 | #include 52 | #include 53 | int check_API(void) 54 | { 55 | /* check API of bpf_open_perf_buffer() */ 56 | perf_reader_raw_cb raw_cb; 57 | perf_reader_lost_cb lost_cb; 58 | void *cb_cookie; 59 | int pid, cpu, page_cnt; 60 | void *buff = bpf_open_perf_buffer(raw_cb, lost_cb, cb_cookie, 61 | pid, cpu, page_cnt); 62 | /* check API of bpf_prog_load() */ 63 | enum bpf_prog_type prog_type; 64 | const struct bpf_insn *insns; 65 | int insn_len; 66 | const char *license; 67 | unsigned kern_version; 68 | char *log_buf; 69 | unsigned log_buf_size; 70 | int fd = bpf_prog_load(prog_type, insns, insn_len, license, 71 | kern_version, log_buf, log_buf_size); 72 | return 0; 73 | } 74 | int main(void) 75 | { 76 | return 0; 77 | } 78 | " LIBBCC_RIGHT_VERSION) 79 | 80 | if(NOT LIBBCC_RIGHT_VERSION) 81 | message(FATAL_ERROR "libbcc v0.4.0 is required") 82 | endif() 83 | endif() 84 | 85 | add_c_flag(-D_GNU_SOURCE) 86 | add_c_flag(-Wextra) 87 | 88 | if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") 89 | # using Clang 90 | add_c_flag(-Wno-initializer-overrides) 91 | else() 92 | # using GCC 93 | add_c_flag(-Wno-override-init) 94 | endif() 95 | 96 | set(SOURCES 97 | vltrace.c 98 | txt.c 99 | cl_parser.c 100 | bpf_ctx.c 101 | utils.c 102 | attach_probes.c 103 | ebpf_syscalls.c 104 | generate_ebpf.c 105 | print_event_cb.c) 106 | 107 | include_directories(${PROJECT_BINARY_DIR}) 108 | include_directories(${PROJECT_BINARY_DIR}/..) 109 | include_directories(${LIBBCC_INCLUDE_DIRS}) 110 | 111 | link_directories(${LIBBCC_LIBRARY_DIRS}) 112 | 113 | add_executable(vltrace ${SOURCES}) 114 | 115 | add_subdirectory(ebpf) 116 | 117 | target_link_libraries(vltrace ebpf ${LIBBCC_LIBRARIES}) 118 | 119 | install(TARGETS vltrace 120 | CONFIGURATIONS Release RelWithDebInfo Debug None 121 | DESTINATION ${CMAKE_INSTALL_BINDIR} 122 | PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) 123 | -------------------------------------------------------------------------------- /src/attach_probes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * attach_probes.h -- attach_probes() function 35 | */ 36 | 37 | #ifndef ATTACH_PROBES_H 38 | #define ATTACH_PROBES_H 39 | 40 | #include 41 | 42 | #include "bpf_ctx.h" 43 | 44 | int attach_probes(struct bpf_ctx *b); 45 | 46 | #endif /* ATTACH_PROBES_H */ 47 | -------------------------------------------------------------------------------- /src/bpf_ctx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * bpf_ctx.h -- Key bpf_ctx structure and related functions 35 | */ 36 | 37 | #ifndef BPF_CTX_H 38 | #define BPF_CTX_H 39 | 40 | #include 41 | #include 42 | #include 43 | 44 | #include 45 | 46 | enum perf_reader_type_t { 47 | PERF_TYPE_NONE = 0, 48 | PERF_TYPE_KPROBE, 49 | PERF_TYPE_TRACEPOINT, 50 | PERF_TYPE_READER, 51 | }; 52 | 53 | /* This struct represent perf reader object */ 54 | struct bpf_pr { 55 | /* pointer to corresponding libbcc's perf reader object */ 56 | struct perf_reader *pr; 57 | 58 | /* type of perf reader attached */ 59 | enum perf_reader_type_t type; 60 | 61 | /* unique key associated with our perf reader */ 62 | char key[]; 63 | }; 64 | 65 | /* eBPF context */ 66 | struct bpf_ctx { 67 | /* A pointer to compiled ebpf code */ 68 | void *module; 69 | /* debug mode */ 70 | unsigned debug; 71 | /* A pointer to array of perf readers */ 72 | struct bpf_pr **pr_arr; 73 | /* A qty of perf readers in array above */ 74 | unsigned pr_arr_qty; 75 | }; 76 | 77 | int attach_callback_to_perf_output(struct bpf_ctx *sbcp, 78 | const char *perf_event, perf_reader_raw_cb callback); 79 | 80 | int load_fn_and_attach_to_kp(struct bpf_ctx *sbcp, 81 | const char *event, const char *fn_name, 82 | pid_t pid, unsigned cpu, int group_fd); 83 | 84 | int load_fn_and_attach_to_kretp(struct bpf_ctx *sbcp, 85 | const char *event, const char *fn_name, 86 | pid_t pid, unsigned cpu, int group_fd); 87 | 88 | int load_fn_and_attach_to_tp(struct bpf_ctx *sbcp, 89 | const char *tp_category, const char *tp_name, 90 | const char *fn_name, 91 | int pid, unsigned cpu, int group_fd); 92 | 93 | void detach_all(struct bpf_ctx *b); 94 | 95 | #endif /* BPF_CTX_H */ 96 | -------------------------------------------------------------------------------- /src/cl_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * cl_parser.h -- command-line parser for vltrace 35 | */ 36 | 37 | #ifndef CL_PARSER_H 38 | #define CL_PARSER_H 39 | 40 | #include "vltrace.h" 41 | 42 | int cl_parser(struct cl_options *const clo, 43 | const int argc, char *const argv[]); 44 | 45 | #endif /* CL_PARSER_H */ 46 | -------------------------------------------------------------------------------- /src/config.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * config.h -- vltrace configuration information 35 | */ 36 | 37 | 38 | #ifndef CONFIG_H 39 | #define CONFIG_H 40 | 41 | enum { 42 | VLTRACE_VERSION_MAJOR = @VERSION_MAJOR@, 43 | VLTRACE_VERSION_MINOR = @VERSION_MINOR@, 44 | VLTRACE_VERSION_PATCH = @VERSION_PATCH@, 45 | }; 46 | 47 | #endif /* CONFIG_H */ 48 | -------------------------------------------------------------------------------- /src/ebpf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017, Intel Corporation 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 11 | # * Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in 13 | # the documentation and/or other materials provided with the 14 | # distribution. 15 | # 16 | # * Neither the name of the copyright holder nor the names of its 17 | # contributors may be used to endorse or promote products derived 18 | # from this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | project(libebpf C) 33 | 34 | add_cstyle(ebpf) 35 | 36 | # eBPF sources 37 | set (BIN_SRCS 38 | trace.h 39 | trace_head.c 40 | template_0_str.c 41 | template_1_str-sl.c 42 | template_2_str-sl.c 43 | template_3_str-sl.c 44 | template_2_str-ml.c 45 | template_3_str-ml.c 46 | template_1_str-const.c 47 | template_2_str-const.c 48 | template_3_str-const.c 49 | template_1_str-full.c 50 | template_2_str-full.c 51 | template_3_str-full.c 52 | template_fork.c 53 | template_exit.c 54 | template_tracepoints.c 55 | macro_const_string_mode.c 56 | macro_full_string_mode.c 57 | macro_pid_own.c 58 | macro_pid_ff_disabled.c 59 | macro_pid_ff_full.c 60 | ) 61 | 62 | include_directories(${PROJECT_BINARY_DIR}) 63 | 64 | set(BIN_OBJS "") 65 | foreach(FILE_SRC ${BIN_SRCS}) 66 | get_filename_component(FILENAME ${FILE_SRC} NAME) 67 | get_filename_component(FILEPATH ${FILE_SRC} PATH) 68 | add_custom_command(OUTPUT 69 | ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${FILENAME}.o 70 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/${FILEPATH} 71 | COMMAND ${CMAKE_LINKER} -r -b binary 72 | -o ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${FILENAME}.o 73 | ${FILENAME}) 74 | list(APPEND BIN_OBJS 75 | ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${FILENAME}.o) 76 | endforeach(FILE_SRC) 77 | 78 | 79 | add_library(ebpf STATIC ${BIN_OBJS} ebpf_file_set.c) 80 | 81 | add_c_flag(-D_GNU_SOURCE) 82 | add_c_flag(-Wextra) 83 | -------------------------------------------------------------------------------- /src/ebpf/README: -------------------------------------------------------------------------------- 1 | This directory contains code which runs inside eBPF VM. 2 | -------------------------------------------------------------------------------- /src/ebpf/README_templates.txt: -------------------------------------------------------------------------------- 1 | Templates for Kprobes and Tracepoints hooks 2 | ------------------------------------------- 3 | 4 | In order to get a value of all arguments and the return code of a syscall, 5 | Kprobes and Tracepoints hooks are used. The hooks are generated from templates 6 | by replacing the constant string 'SYSCALL_NAME_filled_for_replace' 7 | with actual syscall name: 8 | - kprobe__SYSCALL_NAME_filled_for_replace - for Kprobes 9 | - kretprobe__SYSCALL_NAME_filled_for_replace - for Kretprobes 10 | 11 | There are only two hooks for Tracepoints: 12 | - tracepoint__sys_enter and 13 | - tracepoint__sys_exit. 14 | 15 | There are several types of templates depending on: 16 | 1) syscall type: 17 | - template_fork.c: - for fork(), vfork() and clone() syscalls, 18 | - template_exit.c: - for exit() and exit_group() syscalls. 19 | 2) number of string arguments: 20 | - template_0_str.c: - 0 string arguments, 21 | - template_1_str-*.c: - 1 string argument, 22 | - template_2_str-*.c: - 2 string arguments, 23 | - template_3_str-*.c: - 3 string arguments. 24 | 3) mode of reading string arguments: 25 | - template_?_str-sl.c: - single packet per each syscall (one packet 26 | contains all string arguments), 27 | - template_?_str-ml.c: - single packet per each string argument, 28 | - template_?_str-const.c: - constant number of packets per each string 29 | argument (the number is computed from 30 | the maximum length of a string argument 31 | and the size of the packet string buffer, 32 | - template_?_str-full.c: - variable number of packets per each string 33 | argument depending on the length of a string, 34 | but not greater than maximum number of packets 35 | computed like in the 'constant' case above. 36 | -------------------------------------------------------------------------------- /src/ebpf/macro_const_string_mode.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * macro_const_string_mode.c -- macro for reading string arguments 35 | * in 'full-string' mode with constant 36 | * number of packets 37 | */ 38 | 39 | /* BEGIN */ 40 | if (!error_bpf_read) { 41 | src += length; 42 | if (bpf_probe_read(dest, length, (void *)src) == 0) { 43 | events.perf_submit(ctx, &u.ev, _pad_size); 44 | } else { 45 | error_bpf_read = 1; 46 | } 47 | } 48 | /* END */ 49 | -------------------------------------------------------------------------------- /src/ebpf/macro_full_string_mode.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * macro_full_string_mode.c -- macro for reading string arguments 35 | * in 'full-string' mode 36 | */ 37 | 38 | /* BEGIN */ 39 | if (!end_bpf_read) { 40 | src += length - 1; /* bpf_probe_read_str is null-terminated */ 41 | if ((ret = bpf_probe_read_str(dest, length, 42 | (void *)src)) < length) { 43 | /* 44 | * String is completed and will be sent 45 | * in the last packet. 46 | */ 47 | end_bpf_read = 1; 48 | } else { 49 | events.perf_submit(ctx, &u.ev, _pad_size); 50 | } 51 | } 52 | /* END */ 53 | -------------------------------------------------------------------------------- /src/ebpf/macro_pid_ff_disabled.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * macro_pid_ff_disabled.c -- macro for checking PID in non-follow-fork mode 35 | */ 36 | 37 | { 38 | if ((pid_tid >> 32) != TRACED_PID) { 39 | return 0; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/ebpf/macro_pid_ff_full.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * macro_pid_ff_full.c -- macro for checking PID in full-follow-fork mode 35 | */ 36 | 37 | { 38 | uint64_t pid = (pid_tid >> 32); 39 | if (pid != TRACED_PID) { 40 | uint64_t *val = children_map.lookup(&pid); 41 | if (val == NULL) { 42 | return 0; 43 | } 44 | if (*val != 1) { 45 | return 0; 46 | } 47 | #ifdef TRACE_IN_SYS_EXIT 48 | /* 49 | * Valid only for exit() and exit_group(): 50 | * delete the PID from map, because the child exits 51 | */ 52 | children_map.delete(&pid); 53 | #endif 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/ebpf/macro_pid_own.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * macro_pid_own.c -- macro for checking PID in 'system-wide' tracing mode 35 | */ 36 | 37 | { 38 | if ((pid_tid >> 32) == MY_OWN_PID) { 39 | return 0; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/ebpf/template_0_str.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * template_0_str.c -- templates for syscalls with no string arguments, 35 | * see README_templates.txt for details 36 | */ 37 | 38 | /* 39 | * kprobe__SYSCALL_NAME_filled_for_replace -- SYSCALL_NAME_filled_for_replace() 40 | * entry handler 41 | */ 42 | int 43 | kprobe__SYSCALL_NAME_filled_for_replace(struct pt_regs *ctx) 44 | { 45 | struct data_entry_s ev; 46 | uint64_t pid_tid = bpf_get_current_pid_tgid(); 47 | 48 | PID_CHECK_HOOK 49 | 50 | ev.info_all = 0; 51 | ev.info.packet_type = E_KP_ENTRY; 52 | ev.size = offsetof(struct data_entry_s, aux_str); 53 | ev.start_ts_nsec = bpf_ktime_get_ns(); 54 | 55 | ev.sc_id = SYSCALL_NR; /* SysCall ID */ 56 | ev.pid_tid = pid_tid; 57 | 58 | ev.args[0] = PT_REGS_PARM1(ctx); 59 | ev.args[1] = PT_REGS_PARM2(ctx); 60 | ev.args[2] = PT_REGS_PARM3(ctx); 61 | ev.args[3] = PT_REGS_PARM4(ctx); 62 | ev.args[4] = PT_REGS_PARM5(ctx); 63 | ev.args[5] = PT_REGS_PARM6(ctx); 64 | 65 | events.perf_submit(ctx, &ev, offsetof(struct data_entry_s, aux_str)); 66 | 67 | return 0; 68 | }; 69 | 70 | /* 71 | * kretprobe__SYSCALL_NAME_filled_for_replace -- 72 | * SYSCALL_NAME_filled_for_replace() exit handler 73 | */ 74 | int 75 | kretprobe__SYSCALL_NAME_filled_for_replace(struct pt_regs *ctx) 76 | { 77 | struct data_exit_s ev; 78 | uint64_t pid_tid = bpf_get_current_pid_tgid(); 79 | 80 | PID_CHECK_HOOK 81 | 82 | ev.packet_type = E_KP_EXIT; 83 | ev.size = sizeof(ev); 84 | ev.pid_tid = pid_tid; 85 | ev.finish_ts_nsec = bpf_ktime_get_ns(); 86 | ev.sc_id = SYSCALL_NR; /* SysCall ID */ 87 | ev.ret = PT_REGS_RC(ctx); 88 | 89 | events.perf_submit(ctx, &ev, sizeof(ev)); 90 | 91 | return 0; 92 | } 93 | -------------------------------------------------------------------------------- /src/ebpf/template_1_str-sl.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * template_1_str-sl.c -- templates for syscalls with one string argument, 35 | * single-packet version, 36 | * see README_templates.txt for details 37 | */ 38 | 39 | /* 40 | * kprobe__SYSCALL_NAME_filled_for_replace -- SYSCALL_NAME_filled_for_replace() 41 | * entry handler 42 | */ 43 | int 44 | kprobe__SYSCALL_NAME_filled_for_replace(struct pt_regs *ctx) 45 | { 46 | uint64_t pid_tid = bpf_get_current_pid_tgid(); 47 | 48 | PID_CHECK_HOOK 49 | 50 | enum { _pad_size = offsetof(struct data_entry_s, aux_str) + BUF_SIZE }; 51 | union { 52 | struct data_entry_s ev; 53 | char _pad[_pad_size]; 54 | } u; 55 | 56 | u.ev.info_all = 0; 57 | u.ev.info.packet_type = E_KP_ENTRY; 58 | u.ev.size = _pad_size; 59 | u.ev.start_ts_nsec = bpf_ktime_get_ns(); 60 | 61 | u.ev.sc_id = SYSCALL_NR; /* SysCall ID */ 62 | u.ev.pid_tid = pid_tid; 63 | 64 | u.ev.args[0] = PT_REGS_PARM1(ctx); 65 | u.ev.args[1] = PT_REGS_PARM2(ctx); 66 | u.ev.args[2] = PT_REGS_PARM3(ctx); 67 | u.ev.args[3] = PT_REGS_PARM4(ctx); 68 | u.ev.args[4] = PT_REGS_PARM5(ctx); 69 | u.ev.args[5] = PT_REGS_PARM6(ctx); 70 | 71 | unsigned length = BUF_SIZE - 1; 72 | char *src = (char *)u.ev.args[STR1]; 73 | char *dest = (char *)&u.ev.aux_str; 74 | memset(dest, 0, BUF_SIZE); 75 | 76 | if (bpf_probe_read(dest, length, (void *)src)) { 77 | u.ev.info.bpf_read_error = 1; 78 | } 79 | 80 | events.perf_submit(ctx, &u.ev, _pad_size); 81 | 82 | return 0; 83 | }; 84 | 85 | /* 86 | * kretprobe__SYSCALL_NAME_filled_for_replace -- 87 | * SYSCALL_NAME_filled_for_replace() exit handler 88 | */ 89 | int 90 | kretprobe__SYSCALL_NAME_filled_for_replace(struct pt_regs *ctx) 91 | { 92 | struct data_exit_s ev; 93 | uint64_t pid_tid = bpf_get_current_pid_tgid(); 94 | 95 | PID_CHECK_HOOK 96 | 97 | ev.packet_type = E_KP_EXIT; 98 | ev.size = sizeof(ev); 99 | ev.pid_tid = pid_tid; 100 | ev.finish_ts_nsec = bpf_ktime_get_ns(); 101 | ev.sc_id = SYSCALL_NR; /* SysCall ID */ 102 | ev.ret = PT_REGS_RC(ctx); 103 | 104 | events.perf_submit(ctx, &ev, sizeof(ev)); 105 | 106 | return 0; 107 | } 108 | -------------------------------------------------------------------------------- /src/ebpf/template_2_str-ml.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * template_2_str-sl.c -- templates for syscalls with two string arguments, 35 | * multi-packet version, 36 | * see README_templates.txt for details 37 | */ 38 | 39 | /* 40 | * kprobe__SYSCALL_NAME_filled_for_replace -- SYSCALL_NAME_filled_for_replace() 41 | * entry handler 42 | */ 43 | int 44 | kprobe__SYSCALL_NAME_filled_for_replace(struct pt_regs *ctx) 45 | { 46 | uint64_t pid_tid = bpf_get_current_pid_tgid(); 47 | 48 | PID_CHECK_HOOK 49 | 50 | enum { _pad_size = offsetof(struct data_entry_s, aux_str) + BUF_SIZE }; 51 | union { 52 | struct data_entry_s ev; 53 | char _pad[_pad_size]; 54 | } u; 55 | 56 | u.ev.info_all = 0; 57 | u.ev.info.packet_type = E_KP_ENTRY; 58 | u.ev.size = _pad_size; 59 | u.ev.start_ts_nsec = bpf_ktime_get_ns(); 60 | 61 | u.ev.sc_id = SYSCALL_NR; /* SysCall ID */ 62 | u.ev.pid_tid = pid_tid; 63 | 64 | u.ev.args[0] = PT_REGS_PARM1(ctx); 65 | u.ev.args[1] = PT_REGS_PARM2(ctx); 66 | u.ev.args[2] = PT_REGS_PARM3(ctx); 67 | u.ev.args[3] = PT_REGS_PARM4(ctx); 68 | u.ev.args[4] = PT_REGS_PARM5(ctx); 69 | u.ev.args[5] = PT_REGS_PARM6(ctx); 70 | 71 | unsigned length = BUF_SIZE - 1; 72 | char *dest = (char *)&u.ev.aux_str; 73 | memset(dest, 0, BUF_SIZE); 74 | 75 | /* from the beginning to 1st string - contains 1st string */ 76 | u.ev.info.arg_first = FIRST_PACKET; 77 | u.ev.info.arg_last = STR1 + 1; 78 | 79 | char *src = (char *)u.ev.args[STR1]; 80 | if (bpf_probe_read(dest, length, (void *)src)) { 81 | u.ev.info.bpf_read_error = 1; 82 | } 83 | events.perf_submit(ctx, &u.ev, _pad_size); 84 | u.ev.info_all = 0; 85 | u.ev.info.packet_type = E_KP_ENTRY; 86 | 87 | /* from 1st string argument to the end - contains 2nd string */ 88 | u.ev.info.arg_first = STR1 + 1; 89 | u.ev.info.arg_last = LAST_PACKET; 90 | 91 | src = (char *)u.ev.args[STR2]; 92 | if (bpf_probe_read(dest, length, (void *)src)) { 93 | u.ev.info.bpf_read_error = 1; 94 | } 95 | events.perf_submit(ctx, &u.ev, _pad_size); 96 | 97 | return 0; 98 | }; 99 | 100 | /* 101 | * kretprobe__SYSCALL_NAME_filled_for_replace -- 102 | * SYSCALL_NAME_filled_for_replace() exit handler 103 | */ 104 | int 105 | kretprobe__SYSCALL_NAME_filled_for_replace(struct pt_regs *ctx) 106 | { 107 | struct data_exit_s ev; 108 | uint64_t pid_tid = bpf_get_current_pid_tgid(); 109 | 110 | PID_CHECK_HOOK 111 | 112 | ev.packet_type = E_KP_EXIT; 113 | ev.size = sizeof(ev); 114 | ev.pid_tid = pid_tid; 115 | ev.finish_ts_nsec = bpf_ktime_get_ns(); 116 | ev.sc_id = SYSCALL_NR; /* SysCall ID */ 117 | ev.ret = PT_REGS_RC(ctx); 118 | 119 | events.perf_submit(ctx, &ev, sizeof(ev)); 120 | 121 | return 0; 122 | } 123 | -------------------------------------------------------------------------------- /src/ebpf/template_2_str-sl.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * template_2_str-sl.c -- templates for syscalls with two string arguments, 35 | * single-packet version, 36 | * see README_templates.txt for details 37 | */ 38 | 39 | /* 40 | * kprobe__SYSCALL_NAME_filled_for_replace -- SYSCALL_NAME_filled_for_replace() 41 | * entry handler 42 | */ 43 | int 44 | kprobe__SYSCALL_NAME_filled_for_replace(struct pt_regs *ctx) 45 | { 46 | uint64_t pid_tid = bpf_get_current_pid_tgid(); 47 | 48 | PID_CHECK_HOOK 49 | 50 | enum { _pad_size = offsetof(struct data_entry_s, aux_str) + 51 | 2 * (BUF_SIZE / 2) }; 52 | union { 53 | struct data_entry_s ev; 54 | char _pad[_pad_size]; 55 | } u; 56 | 57 | u.ev.info_all = 0; 58 | u.ev.info.packet_type = E_KP_ENTRY; 59 | u.ev.size = _pad_size; 60 | u.ev.start_ts_nsec = bpf_ktime_get_ns(); 61 | 62 | u.ev.sc_id = SYSCALL_NR; /* SysCall ID */ 63 | u.ev.pid_tid = pid_tid; 64 | 65 | u.ev.args[0] = PT_REGS_PARM1(ctx); 66 | u.ev.args[1] = PT_REGS_PARM2(ctx); 67 | u.ev.args[2] = PT_REGS_PARM3(ctx); 68 | u.ev.args[3] = PT_REGS_PARM4(ctx); 69 | u.ev.args[4] = PT_REGS_PARM5(ctx); 70 | u.ev.args[5] = PT_REGS_PARM6(ctx); 71 | 72 | unsigned length = (BUF_SIZE / 2) - 1; 73 | char *dest = (char *)&u.ev.aux_str; 74 | memset(dest, 0, BUF_SIZE); 75 | 76 | char *src = (char *)u.ev.args[STR1]; 77 | if (bpf_probe_read(dest, length, (void *)src)) { 78 | u.ev.info.bpf_read_error = 1; 79 | } 80 | 81 | dest[length] = 0; /* make it null-terminated */ 82 | dest += length + 1; 83 | 84 | src = (char *)u.ev.args[STR2]; 85 | if (bpf_probe_read(dest, length, (void *)src)) { 86 | u.ev.info.bpf_read_error = 1; 87 | } 88 | 89 | dest[length] = 0; /* make it null-terminated */ 90 | events.perf_submit(ctx, &u.ev, _pad_size); 91 | 92 | return 0; 93 | }; 94 | 95 | /* 96 | * kretprobe__SYSCALL_NAME_filled_for_replace -- 97 | * SYSCALL_NAME_filled_for_replace() exit handler 98 | */ 99 | int 100 | kretprobe__SYSCALL_NAME_filled_for_replace(struct pt_regs *ctx) 101 | { 102 | struct data_exit_s ev; 103 | uint64_t pid_tid = bpf_get_current_pid_tgid(); 104 | 105 | PID_CHECK_HOOK 106 | 107 | ev.packet_type = E_KP_EXIT; 108 | ev.size = sizeof(ev); 109 | ev.pid_tid = pid_tid; 110 | ev.finish_ts_nsec = bpf_ktime_get_ns(); 111 | ev.sc_id = SYSCALL_NR; /* SysCall ID */ 112 | ev.ret = PT_REGS_RC(ctx); 113 | 114 | events.perf_submit(ctx, &ev, sizeof(ev)); 115 | 116 | return 0; 117 | } 118 | -------------------------------------------------------------------------------- /src/ebpf/template_3_str-sl.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * template_3_str-sl.c -- templates for syscalls with 3 string arguments, 35 | * single-packet version, 36 | * see README_templates.txt for details 37 | */ 38 | 39 | /* 40 | * kprobe__SYSCALL_NAME_filled_for_replace -- SYSCALL_NAME_filled_for_replace() 41 | * entry handler 42 | */ 43 | int 44 | kprobe__SYSCALL_NAME_filled_for_replace(struct pt_regs *ctx) 45 | { 46 | uint64_t pid_tid = bpf_get_current_pid_tgid(); 47 | 48 | PID_CHECK_HOOK 49 | 50 | enum { _pad_size = offsetof(struct data_entry_s, aux_str) + 51 | 3 * (BUF_SIZE / 3) }; 52 | union { 53 | struct data_entry_s ev; 54 | char _pad[_pad_size]; 55 | } u; 56 | 57 | u.ev.info_all = 0; 58 | u.ev.info.packet_type = E_KP_ENTRY; 59 | u.ev.size = _pad_size; 60 | u.ev.start_ts_nsec = bpf_ktime_get_ns(); 61 | 62 | u.ev.sc_id = SYSCALL_NR; /* SysCall ID */ 63 | u.ev.pid_tid = pid_tid; 64 | 65 | u.ev.args[0] = PT_REGS_PARM1(ctx); 66 | u.ev.args[1] = PT_REGS_PARM2(ctx); 67 | u.ev.args[2] = PT_REGS_PARM3(ctx); 68 | u.ev.args[3] = PT_REGS_PARM4(ctx); 69 | u.ev.args[4] = PT_REGS_PARM5(ctx); 70 | u.ev.args[5] = PT_REGS_PARM6(ctx); 71 | 72 | unsigned length = (BUF_SIZE / 3) - 1; 73 | char *dest = (char *)&u.ev.aux_str; 74 | memset(dest, 0, BUF_SIZE); 75 | 76 | char *src = (char *)u.ev.args[STR1]; 77 | if (bpf_probe_read(dest, length, (void *)src)) { 78 | u.ev.info.bpf_read_error = 1; 79 | } 80 | 81 | dest[length] = 0; /* make it null-terminated */ 82 | dest += length + 1; 83 | 84 | src = (char *)u.ev.args[STR2]; 85 | if (bpf_probe_read(dest, length, (void *)src)) { 86 | u.ev.info.bpf_read_error = 1; 87 | } 88 | 89 | dest[length] = 0; /* make it null-terminated */ 90 | dest += length + 1; 91 | 92 | src = (char *)u.ev.args[STR3]; 93 | if (bpf_probe_read(dest, length, (void *)src)) { 94 | u.ev.info.bpf_read_error = 1; 95 | } 96 | 97 | dest[length] = 0; /* make it null-terminated */ 98 | events.perf_submit(ctx, &u.ev, _pad_size); 99 | 100 | return 0; 101 | }; 102 | 103 | /* 104 | * kretprobe__SYSCALL_NAME_filled_for_replace -- 105 | * SYSCALL_NAME_filled_for_replace() exit handler 106 | */ 107 | int 108 | kretprobe__SYSCALL_NAME_filled_for_replace(struct pt_regs *ctx) 109 | { 110 | struct data_exit_s ev; 111 | uint64_t pid_tid = bpf_get_current_pid_tgid(); 112 | 113 | PID_CHECK_HOOK 114 | 115 | ev.packet_type = E_KP_EXIT; 116 | ev.size = sizeof(ev); 117 | ev.pid_tid = pid_tid; 118 | ev.finish_ts_nsec = bpf_ktime_get_ns(); 119 | ev.sc_id = SYSCALL_NR; /* SysCall ID */ 120 | ev.ret = PT_REGS_RC(ctx); 121 | 122 | events.perf_submit(ctx, &ev, sizeof(ev)); 123 | 124 | return 0; 125 | } 126 | -------------------------------------------------------------------------------- /src/ebpf/template_exit.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * template_exit.c -- templates for exit() and exit_group() syscalls 35 | * in full-follow-fork mode, 36 | * see README_templates.txt for details 37 | */ 38 | 39 | /* 40 | * kprobe__SYSCALL_NAME_filled_for_replace -- 41 | * SYSCALL_NAME_filled_for_replace() entry handler 42 | */ 43 | int 44 | kprobe__SYSCALL_NAME_filled_for_replace(struct pt_regs *ctx) 45 | { 46 | struct data_entry_s ev; 47 | uint64_t pid_tid = bpf_get_current_pid_tgid(); 48 | 49 | #define TRACE_IN_SYS_EXIT 1 50 | 51 | PID_CHECK_HOOK 52 | 53 | #undef TRACE_IN_SYS_EXIT 54 | 55 | ev.info_all = 0; 56 | ev.info.packet_type = E_KP_ENTRY; 57 | ev.size = offsetof(struct data_entry_s, aux_str); 58 | ev.start_ts_nsec = bpf_ktime_get_ns(); 59 | 60 | ev.sc_id = SYSCALL_NR; /* SysCall ID */ 61 | ev.pid_tid = pid_tid; 62 | 63 | ev.args[0] = PT_REGS_PARM1(ctx); 64 | ev.args[1] = PT_REGS_PARM2(ctx); 65 | ev.args[2] = PT_REGS_PARM3(ctx); 66 | ev.args[3] = PT_REGS_PARM4(ctx); 67 | ev.args[4] = PT_REGS_PARM5(ctx); 68 | ev.args[5] = PT_REGS_PARM6(ctx); 69 | 70 | events.perf_submit(ctx, &ev, offsetof(struct data_entry_s, aux_str)); 71 | 72 | return 0; 73 | }; 74 | 75 | /* 76 | * kretprobe__SYSCALL_NAME_filled_for_replace -- 77 | * SYSCALL_NAME_filled_for_replace() exit handler 78 | */ 79 | int 80 | kretprobe__SYSCALL_NAME_filled_for_replace(struct pt_regs *ctx) 81 | { 82 | struct data_exit_s ev; 83 | uint64_t pid_tid = bpf_get_current_pid_tgid(); 84 | 85 | PID_CHECK_HOOK 86 | 87 | ev.packet_type = E_KP_EXIT; 88 | ev.size = sizeof(ev); 89 | ev.pid_tid = pid_tid; 90 | ev.finish_ts_nsec = bpf_ktime_get_ns(); 91 | ev.sc_id = SYSCALL_NR; /* SysCall ID */ 92 | ev.ret = PT_REGS_RC(ctx); 93 | 94 | events.perf_submit(ctx, &ev, sizeof(ev)); 95 | 96 | return 0; 97 | } 98 | -------------------------------------------------------------------------------- /src/ebpf/template_fork.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * template_fork.c -- templates for: fork, vfork and clone syscalls 35 | * in full-follow-fork mode, 36 | * see README_templates.txt for details 37 | */ 38 | 39 | /* 40 | * kprobe__SYSCALL_NAME_filled_for_replace -- 41 | * SYSCALL_NAME_filled_for_replace() entry handler 42 | */ 43 | int 44 | kprobe__SYSCALL_NAME_filled_for_replace(struct pt_regs *ctx) 45 | { 46 | struct data_entry_s ev; 47 | uint64_t pid_tid = bpf_get_current_pid_tgid(); 48 | 49 | PID_CHECK_HOOK 50 | 51 | ev.info_all = 0; 52 | ev.info.packet_type = E_KP_ENTRY; 53 | ev.size = offsetof(struct data_entry_s, aux_str); 54 | ev.start_ts_nsec = bpf_ktime_get_ns(); 55 | 56 | ev.sc_id = SYSCALL_NR; /* SysCall ID */ 57 | ev.pid_tid = pid_tid; 58 | 59 | ev.args[0] = PT_REGS_PARM1(ctx); 60 | ev.args[1] = PT_REGS_PARM2(ctx); 61 | ev.args[2] = PT_REGS_PARM3(ctx); 62 | ev.args[3] = PT_REGS_PARM4(ctx); 63 | ev.args[4] = PT_REGS_PARM5(ctx); 64 | ev.args[5] = PT_REGS_PARM6(ctx); 65 | 66 | events.perf_submit(ctx, &ev, offsetof(struct data_entry_s, aux_str)); 67 | 68 | return 0; 69 | }; 70 | 71 | /* 72 | * kretprobe__SYSCALL_NAME_filled_for_replace -- 73 | * SYSCALL_NAME_filled_for_replace() exit handler 74 | */ 75 | int 76 | kretprobe__SYSCALL_NAME_filled_for_replace(struct pt_regs *ctx) 77 | { 78 | struct data_exit_s ev; 79 | uint64_t pid_tid = bpf_get_current_pid_tgid(); 80 | 81 | PID_CHECK_HOOK 82 | 83 | ev.packet_type = E_KP_EXIT; 84 | ev.size = sizeof(ev); 85 | ev.pid_tid = pid_tid; 86 | ev.finish_ts_nsec = bpf_ktime_get_ns(); 87 | ev.sc_id = SYSCALL_NR; /* SysCall ID */ 88 | ev.ret = PT_REGS_RC(ctx); 89 | 90 | if (ev.ret > 0) { 91 | uint64_t one = 1; 92 | children_map.update(&ev.ret, &one); 93 | } 94 | 95 | events.perf_submit(ctx, &ev, sizeof(ev)); 96 | 97 | return 0; 98 | } 99 | -------------------------------------------------------------------------------- /src/ebpf/template_tracepoints.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * template_tracepoints.c -- trace syscalls using tracepoints, 35 | * see README_templates.txt for details 36 | */ 37 | 38 | /* 39 | * tracepoint__sys_enter -- syscall's entry handler 40 | */ 41 | int 42 | tracepoint__sys_enter(struct tracepoint__raw_syscalls__sys_enter *args) 43 | { 44 | /* NOT IMPLEMENTED */ 45 | return 0; 46 | } 47 | 48 | /* 49 | * tracepoint__sys_exit -- syscall's exit handler 50 | */ 51 | int 52 | tracepoint__sys_exit(struct tracepoint__raw_syscalls__sys_exit *args) 53 | { 54 | struct data_exit_s tp; 55 | uint64_t pid_tid = bpf_get_current_pid_tgid(); 56 | 57 | PID_CHECK_HOOK 58 | 59 | tp.packet_type = E_TP_EXIT; 60 | tp.size = sizeof(tp); 61 | tp.pid_tid = pid_tid; 62 | tp.finish_ts_nsec = bpf_ktime_get_ns(); 63 | tp.sc_id = args->id; 64 | tp.ret = args->ret; 65 | 66 | if (tp.sc_id == __NR_clone || 67 | tp.sc_id == __NR_fork || 68 | tp.sc_id == __NR_vfork) { 69 | if (tp.ret > 0) { 70 | uint64_t one = 1; 71 | children_map.update(&tp.ret, &one); 72 | } 73 | } 74 | 75 | events.perf_submit(args, &tp, sizeof(tp)); 76 | 77 | return 0; 78 | } 79 | -------------------------------------------------------------------------------- /src/ebpf/trace.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * trace.h -- data exchange packet between packet filter and reader callback 35 | */ 36 | 37 | #ifndef VLTRACE_TRACE_H 38 | #define VLTRACE_TRACE_H 39 | 40 | #define MAX_STR_ARG 3 /* max number of supported string arguments */ 41 | 42 | #define FIRST_PACKET 0 /* this is the first packet for this syscall */ 43 | #define LAST_PACKET 7 /* this is the last packet for this syscall */ 44 | #define ARG_MASK (0b1111111100) /* arguments mask */ 45 | 46 | #define BUF_SIZE 384 /* size of buffer for string arguments */ 47 | #define STR_MAX_1 (BUF_SIZE - 2) 48 | #define STR_MAX_2 ((BUF_SIZE / 2) - 2) 49 | #define STR_MAX_3 ((BUF_SIZE / 3) - 2) 50 | 51 | #define E_MASK 0x03 /* enum data_packet_types mask */ 52 | 53 | /* types of data packets */ 54 | enum data_packet_types { 55 | E_KP_ENTRY = 0, /* entry of Kprobe */ 56 | E_KP_EXIT = 1, /* exit of Kprobe */ 57 | E_TP_ENTRY = 2, /* entry of Tracepoint */ 58 | E_TP_EXIT = 3, /* exit of Tracepoint */ 59 | }; 60 | 61 | struct data_entry_s { 62 | /* size of the packet */ 63 | uint32_t size; 64 | 65 | /* union containing information about the packet */ 66 | union { 67 | uint32_t info_all; 68 | struct { 69 | /* 70 | * bits 0-1: 71 | * type of data packet (enum data_packet_types) 72 | */ 73 | uint32_t packet_type : 2; 74 | 75 | /* 76 | * bits 2-4: 77 | * number of the first saved argument in the packet 78 | */ 79 | uint32_t arg_first : 3; 80 | 81 | /* 82 | * bits 5-7: 83 | * number of the last saved argument in the packet 84 | */ 85 | uint32_t arg_last : 3; 86 | 87 | /* 88 | * bit 8: 89 | * flag: syscall is not finished and will be continued 90 | * - next packets will be sent 91 | */ 92 | uint32_t will_be_cont : 1; 93 | 94 | /* 95 | * bit 9: 96 | * flag: syscall has not finished 97 | * and this is a continuation 98 | */ 99 | uint32_t is_cont : 1; 100 | 101 | /* 102 | * bit 10: 103 | * flag: bpf_probe_read error occurred 104 | */ 105 | uint32_t bpf_read_error : 1; 106 | } info; 107 | }; 108 | 109 | /* PID and TID */ 110 | uint64_t pid_tid; 111 | 112 | /* syscall's ID (number) */ 113 | uint64_t sc_id; 114 | 115 | /* timestamp */ 116 | uint64_t start_ts_nsec; 117 | 118 | /* arguments of the syscall */ 119 | int64_t args[6]; 120 | 121 | /* buffer for string arguments (of BUF_SIZE) */ 122 | char aux_str[1]; 123 | }; 124 | 125 | struct data_exit_s { 126 | /* size of the rest of data (except this field) */ 127 | uint32_t size; 128 | 129 | /* type of data packet (enum data_packet_types) */ 130 | uint32_t packet_type; 131 | 132 | /* PID and TID */ 133 | uint64_t pid_tid; 134 | 135 | /* syscall's ID (number) */ 136 | uint64_t sc_id; 137 | 138 | /* timestamp */ 139 | uint64_t finish_ts_nsec; 140 | 141 | /* return value */ 142 | int64_t ret; 143 | }; 144 | 145 | #endif /* VLTRACE_TRACE_H */ 146 | -------------------------------------------------------------------------------- /src/ebpf/trace_head.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * trace_head.c -- the head for generated eBPF code 35 | */ 36 | 37 | #include 38 | #include 39 | #include 40 | 41 | #include "trace.h" 42 | 43 | /* 44 | * It is an empty define. The "it_will_be_removed_" part of the string 45 | * is cut out when Args.n_str_packets == 2, in order to define the rest 46 | * as empty string in templates. 47 | */ 48 | #define READ_AND_SUBMIT_it_will_be_removed_N_MINUS_2_PACKETS 49 | 50 | /* The set of our children_pid */ 51 | BPF_HASH(children_map, uint64_t, uint64_t); 52 | 53 | BPF_PERF_OUTPUT(events); 54 | -------------------------------------------------------------------------------- /src/generate_ebpf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * generate_ebpf.h -- generate_ebpf() function 35 | */ 36 | 37 | #ifndef GENERATE_EBPF_H 38 | #define GENERATE_EBPF_H 39 | 40 | char *generate_ebpf(void); 41 | 42 | int apply_process_attach_code(char **const pbpf_str); 43 | void fprint_ebpf_code_with_debug_marks(FILE *f, const char *bpf_str); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/print_event_cb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * print_event_cb.h -- print_event_cb() function 35 | */ 36 | 37 | #ifndef PRINT_EVENT_CB_H 38 | #define PRINT_EVENT_CB_H 39 | 40 | #include 41 | 42 | #include 43 | 44 | #include "vltrace.h" 45 | 46 | typedef int (*print_header_t)(int argc, char *const argv[]); 47 | 48 | void init_printing_events(void); 49 | 50 | extern print_header_t Print_header[EOF_QTY + 1]; 51 | extern perf_reader_raw_cb Print_event_cb[EOF_QTY + 1]; 52 | 53 | enum out_format out_fmt_str2enum(const char *str); 54 | void choose_fnr_mode(const char *filename_length, 55 | enum fnr_mode *mode, unsigned *n_str_packets); 56 | 57 | #endif /* PRINT_EVENT_CB_H */ 58 | -------------------------------------------------------------------------------- /src/txt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * txt.h -- text messages 35 | */ 36 | 37 | #ifndef TXT_H 38 | #define TXT_H 39 | 40 | #include 41 | 42 | void fprint_help(FILE *f); 43 | 44 | #endif /* TXT_H */ 45 | -------------------------------------------------------------------------------- /src/utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * utils.h -- utility functions 35 | */ 36 | 37 | #ifndef UTILS_H 38 | #define UTILS_H 39 | 40 | #include 41 | #include 42 | 43 | #include "vltrace.h" 44 | 45 | #define INFO(str, ...) \ 46 | fprintf(stderr, str "\n", ##__VA_ARGS__); 47 | #define NOTICE(str, ...) \ 48 | fprintf(stderr, "Notice: " str "\n", ##__VA_ARGS__); 49 | 50 | #ifdef DEBUG 51 | 52 | #define ERROR(str, ...) \ 53 | fprintf(stderr, "ERROR(%s): " str "\n", __func__, ##__VA_ARGS__); 54 | #define WARNING(str, ...) \ 55 | fprintf(stderr, "WARNING(%s): " str "\n", __func__, ##__VA_ARGS__); 56 | #define DEBUG_NOTICE(str, ...) \ 57 | fprintf(stderr, "DEBUG Notice(%s): " str "\n", __func__, ##__VA_ARGS__); 58 | #define DEBUG_INFO(str, ...) \ 59 | fprintf(stderr, "DEBUG(%s): " str "\n", __func__, ##__VA_ARGS__); 60 | 61 | #else /* DEBUG */ 62 | 63 | #define ERROR(str, ...) \ 64 | fprintf(stderr, "ERROR: " str "\n", ##__VA_ARGS__); 65 | #define WARNING(str, ...) \ 66 | fprintf(stderr, "WARNING: " str "\n", ##__VA_ARGS__); 67 | #define DEBUG_NOTICE(str, ...) 68 | #define DEBUG_INFO(str, ...) 69 | 70 | #endif /* DEBUG */ 71 | 72 | char *load_file(const char *fn); 73 | char *load_file_no_cr(const char *const fn); 74 | char *load_pid_check_hook(enum ff_mode ff_mode); 75 | char *load_file_from_disk(const char *const fn); 76 | void check_bpf_jit_status(); 77 | 78 | typedef bool (*filter_f)(const char *line, ssize_t size); 79 | bool is_a_sc(const char *const line, const ssize_t size); 80 | void print_sc_list(filter_f filter); 81 | 82 | int str_replace_with_char(char *const text, const char *templt, const char c); 83 | int str_replace_all(char **text, const char *templt, const char *str); 84 | int str_replace_many(char **text, const char *templt, const char *str, int n); 85 | 86 | pid_t start_command(char *const argv[]); 87 | pid_t start_command_with_signals(int argc, char *const argv[]); 88 | 89 | void attach_signal_handlers(void); 90 | 91 | FILE *setup_output(void); 92 | 93 | #define AVAILABLE_FILTERS "/sys/kernel/debug/tracing/available_filter_functions" 94 | 95 | #endif /* UTILS_H */ 96 | -------------------------------------------------------------------------------- /src/vltrace.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * vltrace.h -- application-wide stuff 35 | */ 36 | 37 | #ifndef VLTRACE_H 38 | #define VLTRACE_H 39 | 40 | #include 41 | #include 42 | #include 43 | 44 | /* hardware architecture */ 45 | enum arch { 46 | ARCH_NONE = 0, 47 | ARCH_x86_64 = 1, 48 | }; 49 | 50 | /* vltrace output format */ 51 | enum out_format { 52 | EOF_TEXT = 0, 53 | EOF_BIN, 54 | 55 | EOF_QTY, /* Should be last */ 56 | }; 57 | 58 | /* follow fork modes */ 59 | enum ff_mode { 60 | E_FF_DISABLED = 0, 61 | E_FF_FULL, 62 | }; 63 | 64 | /* modes of reading string arguments */ 65 | enum fnr_mode { 66 | E_STR_FAST = 0, /* 1 packet per syscall */ 67 | E_STR_STR_MAX, /* 1 packet per string argument */ 68 | E_STR_FULL_CONST_N, /* always N packets per string argument */ 69 | E_STR_FULL, /* <=N packets per string argument */ 70 | }; 71 | 72 | /* 8 Megabytes should be something close to reasonable */ 73 | enum { OUT_BUF_SIZE = 8 * 1024 * 1024 }; 74 | 75 | /* 76 | * The default size of ring buffers in 4k pages. Must be a power of two. 77 | * The lowest possible value is 64. The compromise is 4096. 78 | */ 79 | enum { VLTRACE_READER_PAGE_CNT_DEFAULT = 4096 }; 80 | 81 | /* 82 | * This structure contains default and parsed values for command-line options 83 | */ 84 | struct cl_options { 85 | /* Mark output lines with timestamp */ 86 | bool timestamp; 87 | /* Print only failed syscalls */ 88 | bool failed; 89 | /* We have command to run on command line */ 90 | bool command; 91 | 92 | /* We run in debug mode */ 93 | unsigned debug; 94 | 95 | /* Pid of process to trace */ 96 | pid_t pid; 97 | 98 | /* The name of output log file */ 99 | const char *output_name; 100 | /* string constant with type of output log format */ 101 | const char *out_fmt_str; 102 | /* Field separator for hexadecimal logs */ 103 | char separator; 104 | /* Expression */ 105 | const char *expr; 106 | 107 | /* maximum number of perf readers */ 108 | unsigned pr_arr_max; 109 | /* follow-fork mode */ 110 | enum ff_mode ff_mode; 111 | 112 | /* filenames reading mode */ 113 | enum fnr_mode fnr_mode; 114 | 115 | /* number of packets per one string argument */ 116 | unsigned n_str_packets; 117 | 118 | /* size of output buffer passed to setvbuf() */ 119 | unsigned out_buf_size; 120 | 121 | /* directory containing updated ebpf templates */ 122 | const char *ebpf_src_dir; 123 | 124 | /* 125 | * The size of ring buffers in 4k pages. Must be a power of two. 126 | * The lowest possible value is 64. 127 | */ 128 | int strace_reader_page_cnt; 129 | 130 | /* do not print progress of detaching probes */ 131 | int do_not_print_progress; 132 | }; 133 | 134 | extern struct cl_options Args; 135 | extern int OutputError; 136 | extern int AbortTracing; 137 | extern pid_t PidToBeKilled; 138 | 139 | /* Output logfile */ 140 | extern FILE *OutputFile; 141 | /* Output logfile format */ 142 | extern enum out_format OutputFormat; 143 | 144 | #endif /* VLTRACE_H */ 145 | -------------------------------------------------------------------------------- /test/README: -------------------------------------------------------------------------------- 1 | This directory contains very basic functional tests of vltrace. 2 | 3 | 4 | ** REQUIREMENTS ** 5 | 6 | The tests require CAP_SYS_ADMIN capability so they have to be run as root 7 | or using the 'sudo' command. 8 | 9 | 10 | ** COMPILATION ** 11 | 12 | In order to run the tests you should first build the whole project running: 13 | 14 | $ make 15 | 16 | in the build directory. 17 | 18 | 19 | ** RUNNING THE TESTS ** 20 | 21 | You can start the tests in the silent way by running: 22 | 23 | $ sudo make test 24 | 25 | or in the verbose way using 'ctest' command: 26 | 27 | $ sudo ctest -V 28 | 29 | For all ctest's options see the ctest's documentation: 30 | 31 | https://cmake.org/cmake/help/latest/manual/ctest.1.html 32 | -------------------------------------------------------------------------------- /test/cut-0.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) $(XX) close 3 | $(XX) $(XX) ------------------ ------------------ open "/etc/fstab" 0x0000000000000000 $(XX) 4 | $(XX) $(XX) 0x0000000000000000 $(XX) open 5 | $(XX) $(XX) ------------------ ------------------ close $(XX) 6 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 close 7 | $(XX) $(XX) ------------------ ------------------ open "/tmp/tmp vltrace" 0x0000000000000042 $(XX) 8 | $(XX) $(XX) 0x0000000000000000 $(XX) open 9 | $(XX) $(XX) ------------------ ------------------ write $(XX) $(XX) 0x0000000000000100 10 | $(XX) $(XX) 0x0000000000000000 0x0000000000000100 write 11 | $(XX) $(XX) ------------------ ------------------ lseek $(XX) 0x0000000000000000 0x0000000000000000 12 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 lseek 13 | $(XX) $(XX) ------------------ ------------------ read $(XX) $(XX) 0x0000000000000100 14 | $(XX) $(XX) 0x0000000000000000 0x0000000000000100 read 15 | $(XX) $(XX) ------------------ ------------------ $(*)fstat $(XX) $(XX) 16 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)fstat 17 | $(XX) $(XX) ------------------ ------------------ close $(XX) 18 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 close 19 | $(XX) $(XX) ------------------ ------------------ unlink "/tmp/tmp vltrace" 20 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 unlink 21 | $(XX) $(XX) ------------------ ------------------ execve "/tmp/tmp vltrace" 0x0000000000123456 0x0000000000654321 22 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF execve 23 | $(XX) $(XX) ------------------ ------------------ $(*)stat "/etc/fstab" $(XX) 24 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)stat 25 | $(XX) $(XX) ------------------ ------------------ $(*)lstat "/etc/fstab" $(XX) 26 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)lstat 27 | $(XX) $(XX) ------------------ ------------------ $(*)uname $(XX) 28 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)uname 29 | $(XX) $(XX) ------------------ ------------------ getpid 30 | $(XX) $(XX) 0x0000000000000000 $(XX) getpid 31 | $(XX) $(XX) ------------------ ------------------ gettid 32 | $(XX) $(XX) 0x0000000000000000 $(XX) gettid 33 | $(XX) $(XX) ------------------ ------------------ write 0x0000000000000101 $(XX) 0x0000000000000001 34 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF write 35 | $(XX) $(XX) ------------------ ------------------ read 0x0000000000000102 $(XX) 0x0000000000000002 36 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF read 37 | $(XX) $(XX) ------------------ ------------------ lseek 0x0000000000000103 0x0000000000000003 0x0000000000000002 38 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF lseek 39 | $(XX) $(XX) ------------------ ------------------ $(*)fstat 0x0000000000000104 $(XX) 40 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF $(*)fstat 41 | $(XX) $(XX) ------------------ ------------------ futex 0x0000000000000001 0x0000000000000005 0x0000000000000003 0x0000000000000004 0x0000000000000005 0x0FFFFFFFFFFFFFFF 42 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF futex 43 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 44 | -------------------------------------------------------------------------------- /test/cut-1-1.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) $(XX) close 3 | $(XX) $(XX) ------------------ ------------------ open "/etc/fstab" 0x0000000000000000 $(XX) 4 | $(XX) $(XX) 0x0000000000000000 $(XX) open 5 | $(XX) $(XX) ------------------ ------------------ close $(XX) 6 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 close 7 | $(XX) $(XX) ------------------ ------------------ open "/tmp/tmp vltrace" 0x0000000000000042 $(XX) 8 | $(XX) $(XX) 0x0000000000000000 $(XX) open 9 | $(XX) $(XX) ------------------ ------------------ write $(XX) $(XX) 0x0000000000000100 10 | $(XX) $(XX) 0x0000000000000000 0x0000000000000100 write 11 | $(XX) $(XX) ------------------ ------------------ lseek $(XX) 0x0000000000000000 0x0000000000000000 12 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 lseek 13 | $(XX) $(XX) ------------------ ------------------ read $(XX) $(XX) 0x0000000000000100 14 | $(XX) $(XX) 0x0000000000000000 0x0000000000000100 read 15 | $(XX) $(XX) ------------------ ------------------ $(*)fstat $(XX) $(XX) 16 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)fstat 17 | $(XX) $(XX) ------------------ ------------------ close $(XX) 18 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 close 19 | $(XX) $(XX) ------------------ ------------------ unlink "/tmp/tmp vltrace" 20 | $(XX) $(XX) $(XX) $(XX) unlink 21 | $(XX) $(XX) ------------------ ------------------ execve "/tmp/tmp vltrace" 0x0000000000123456 0x0000000000654321 22 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF execve 23 | $(XX) $(XX) ------------------ ------------------ $(*)stat "/etc/fstab" $(XX) 24 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)stat 25 | $(XX) $(XX) ------------------ ------------------ $(*)lstat "/etc/fstab" $(XX) 26 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)lstat 27 | $(XX) $(XX) ------------------ ------------------ $(*)uname $(XX) 28 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)uname 29 | $(XX) $(XX) ------------------ ------------------ getpid 30 | $(XX) $(XX) 0x0000000000000000 $(XX) getpid 31 | $(XX) $(XX) ------------------ ------------------ gettid 32 | $(XX) $(XX) 0x0000000000000000 $(XX) gettid 33 | $(XX) $(XX) ------------------ ------------------ write 0x0000000000000101 $(XX) 0x0000000000000001 34 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF write 35 | $(XX) $(XX) ------------------ ------------------ read 0x0000000000000102 $(XX) 0x0000000000000002 36 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF read 37 | $(XX) $(XX) ------------------ ------------------ lseek 0x0000000000000103 0x0000000000000003 0x0000000000000002 38 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF lseek 39 | $(XX) $(XX) ------------------ ------------------ $(*)fstat 0x0000000000000104 $(XX) 40 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF $(*)fstat 41 | $(XX) $(XX) ------------------ ------------------ futex 0x0000000000000001 0x0000000000000005 0x0000000000000003 0x0000000000000004 0x0000000000000005 0x0FFFFFFFFFFFFFFF 42 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF futex 43 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 44 | -------------------------------------------------------------------------------- /test/cut-1-5.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) $(XX) close 3 | $(XX) $(XX) ------------------ ------------------ open "/etc/fstab" 0x0000000000000000 $(XX) 4 | $(XX) $(XX) 0x0000000000000000 $(XX) open 5 | $(XX) $(XX) ------------------ ------------------ close $(XX) 6 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 close 7 | $(XX) $(XX) ------------------ ------------------ open "/tmp/tmp vltrace" 0x0000000000000042 $(XX) 8 | $(XX) $(XX) $(XX) $(XX) open 9 | $(XX) $(XX) ------------------ ------------------ write $(XX) $(XX) 0x0000000000000100 10 | $(XX) $(XX) $(XX) $(XX) write 11 | $(XX) $(XX) ------------------ ------------------ lseek $(XX) 0x0000000000000000 0x0000000000000000 12 | $(XX) $(XX) $(XX) $(XX) lseek 13 | $(XX) $(XX) ------------------ ------------------ read $(XX) $(XX) 0x0000000000000100 14 | $(XX) $(XX) $(XX) $(XX) read 15 | $(XX) $(XX) ------------------ ------------------ $(*)fstat $(XX) $(XX) 16 | $(XX) $(XX) $(XX) $(XX) $(*)fstat 17 | $(XX) $(XX) ------------------ ------------------ close $(XX) 18 | $(XX) $(XX) $(XX) $(XX) close 19 | $(XX) $(XX) ------------------ ------------------ unlink "/tmp/tmp vltrace" 20 | $(XX) $(XX) $(XX) $(XX) unlink 21 | $(XX) $(XX) ------------------ ------------------ execve "/tmp/tmp vltrace" 0x0000000000123456 0x0000000000654321 22 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF execve 23 | $(XX) $(XX) ------------------ ------------------ $(*)stat "/etc/fstab" $(XX) 24 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)stat 25 | $(XX) $(XX) ------------------ ------------------ $(*)lstat "/etc/fstab" $(XX) 26 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)lstat 27 | $(XX) $(XX) ------------------ ------------------ $(*)uname $(XX) 28 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)uname 29 | $(XX) $(XX) ------------------ ------------------ getpid 30 | $(XX) $(XX) 0x0000000000000000 $(XX) getpid 31 | $(XX) $(XX) ------------------ ------------------ gettid 32 | $(XX) $(XX) 0x0000000000000000 $(XX) gettid 33 | $(XX) $(XX) ------------------ ------------------ write 0x0000000000000101 $(XX) 0x0000000000000001 34 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF write 35 | $(XX) $(XX) ------------------ ------------------ read 0x0000000000000102 $(XX) 0x0000000000000002 36 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF read 37 | $(XX) $(XX) ------------------ ------------------ lseek 0x0000000000000103 0x0000000000000003 0x0000000000000002 38 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF lseek 39 | $(XX) $(XX) ------------------ ------------------ $(*)fstat 0x0000000000000104 $(XX) 40 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF $(*)fstat 41 | $(XX) $(XX) ------------------ ------------------ futex 0x0000000000000001 0x0000000000000005 0x0000000000000003 0x0000000000000004 0x0000000000000005 0x0FFFFFFFFFFFFFFF 42 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF futex 43 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 44 | -------------------------------------------------------------------------------- /test/cut-10-15.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) $(XX) close 3 | $(XX) $(XX) ------------------ ------------------ open "START 111 1234567890 111 END" 0x0000000000000102 0x0000000000000103 4 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF open 5 | $(XX) $(XX) ------------------ ------------------ openat 0x0000000000000101 "START 222 1234567890 222 END" 0x0000000000000103 0x0000000000000104 6 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF openat 7 | $(XX) $(XX) ------------------ ------------------ rename "START 111 1234567890 111 END" "START 222 1234567890 222 END" 8 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF rename 9 | $(XX) $(XX) ------------------ ------------------ llistxattr "START 222 1234567890 222 END" $(XX) 0x0000000000000103 10 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF llistxattr 11 | $(XX) $(XX) ------------------ ------------------ symlinkat "START 111 1234567890 111 END" 0x0000000000000102 "START 222 1234567890 222 END" 12 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF symlinkat 13 | $(XX) $(XX) ------------------ ------------------ renameat 0x0000000000000101 "START 111 1234567890 111 END" 0x0000000000000103 "START 222 1234567890 222 END" 14 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF renameat 15 | $(XX) $(XX) ------------------ ------------------ mount "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000101 0x0000000000000102 16 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF mount 17 | $(XX) $(XX) ------------------ ------------------ request_key "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000104 18 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF request_key 19 | $(XX) $(XX) ------------------ ------------------ init_module 0x0000000000000101 0x0000000000000102 "START 111 1234567890 111 END" 20 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF init_module 21 | $(XX) $(XX) ------------------ ------------------ kexec_file_load 0x0000000000000101 0x0000000000000102 0x0000000000000103 "START 222 1234567890 222 END" 0x0000000000000105 22 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF kexec_file_load 23 | $(XX) $(XX) ------------------ ------------------ fanotify_mark 0x0000000000000101 0x0000000000000102 0x0000000000000103 0x0000000000000104 "START 111 1234567890 111 END" 24 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF fanotify_mark 25 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 26 | -------------------------------------------------------------------------------- /test/cut-11-15.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) $(XX) close 3 | $(XX) $(XX) ------------------ ------------------ open "START 111 1234567890 111 END" 0x0000000000000102 0x0000000000000103 4 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF open 5 | $(XX) $(XX) ------------------ ------------------ openat 0x0000000000000101 "START 222 1234567890 222 END" 0x0000000000000103 0x0000000000000104 6 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF openat 7 | $(XX) $(XX) ------------------ ------------------ rename "START 111 1234567890 111 END" "START 222 1234567890 222 END" 8 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF rename 9 | $(XX) $(XX) ------------------ ------------------ llistxattr "START 222 1234567890 222 END" $(XX) 0x0000000000000103 10 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF llistxattr 11 | $(XX) $(XX) ------------------ ------------------ symlinkat "START 111 1234567890 111 END" 0x0000000000000102 "START 222 1234567890 222 END" 12 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF symlinkat 13 | $(XX) $(XX) ------------------ ------------------ renameat 0x0000000000000101 "START 111 1234567890 111 END" 0x0000000000000103 "START 222 1234567890 222 END" 14 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF renameat 15 | $(XX) $(XX) ------------------ ------------------ mount "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000101 0x0000000000000102 16 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF mount 17 | $(XX) $(XX) ------------------ ------------------ request_key "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000104 18 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF request_key 19 | $(XX) $(XX) ------------------ ------------------ init_module 0x0000000000000101 0x0000000000000102 "START 111 1234567890 111 END" 20 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF init_module 21 | $(XX) $(XX) ------------------ ------------------ kexec_file_load 0x0000000000000101 0x0000000000000102 0x0000000000000103 "START 222 1234567890 222 END" 0x0000000000000105 22 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF kexec_file_load 23 | $(XX) $(XX) ------------------ ------------------ fanotify_mark 0x0000000000000101 0x0000000000000102 0x0000000000000103 0x0000000000000104 "START 111 1234567890 111 END" 24 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF fanotify_mark 25 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 26 | -------------------------------------------------------------------------------- /test/cut-2-1.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) $(XX) close 3 | $(XX) $(XX) ------------------ ------------------ open "/etc/fstab" 0x0000000000000000 $(XX) 4 | $(XX) $(XX) 0x0000000000000000 $(XX) open 5 | $(XX) $(XX) ------------------ ------------------ close $(XX) 6 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 close 7 | $(XX) $(XX) ------------------ ------------------ open "/tmp/tmp vltrace" 0x0000000000000042 $(XX) 8 | $(XX) $(XX) 0x0000000000000000 $(XX) open 9 | $(XX) $(XX) ------------------ ------------------ write $(XX) $(XX) 0x0000000000000100 10 | $(XX) $(XX) 0x0000000000000000 0x0000000000000100 write 11 | $(XX) $(XX) ------------------ ------------------ lseek $(XX) 0x0000000000000000 0x0000000000000000 12 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 lseek 13 | $(XX) $(XX) ------------------ ------------------ read $(XX) $(XX) 0x0000000000000100 14 | $(XX) $(XX) 0x0000000000000000 0x0000000000000100 read 15 | $(XX) $(XX) ------------------ ------------------ $(*)fstat $(XX) $(XX) 16 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)fstat 17 | $(XX) $(XX) ------------------ ------------------ close $(XX) 18 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 close 19 | $(XX) $(XX) ------------------ ------------------ unlink "/tmp/tmp vltrace" 20 | $(XX) $(XX) $(XX) $(XX) unlink 21 | $(XX) $(XX) ------------------ ------------------ execve "/tmp/tmp vltrace" 0x0000000000123456 0x0000000000654321 22 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF execve 23 | $(XX) $(XX) ------------------ ------------------ $(*)stat "/etc/fstab" $(XX) 24 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)stat 25 | $(XX) $(XX) ------------------ ------------------ $(*)lstat "/etc/fstab" $(XX) 26 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)lstat 27 | $(XX) $(XX) ------------------ ------------------ $(*)uname $(XX) 28 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)uname 29 | $(XX) $(XX) ------------------ ------------------ getpid 30 | $(XX) $(XX) 0x0000000000000000 $(XX) getpid 31 | $(XX) $(XX) ------------------ ------------------ gettid 32 | $(XX) $(XX) 0x0000000000000000 $(XX) gettid 33 | $(XX) $(XX) ------------------ ------------------ write 0x0000000000000101 $(XX) 0x0000000000000001 34 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF write 35 | $(XX) $(XX) ------------------ ------------------ read 0x0000000000000102 $(XX) 0x0000000000000002 36 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF read 37 | $(XX) $(XX) ------------------ ------------------ lseek 0x0000000000000103 0x0000000000000003 0x0000000000000002 38 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF lseek 39 | $(XX) $(XX) ------------------ ------------------ $(*)fstat 0x0000000000000104 $(XX) 40 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF $(*)fstat 41 | $(XX) $(XX) ------------------ ------------------ futex 0x0000000000000001 0x0000000000000005 0x0000000000000003 0x0000000000000004 0x0000000000000005 0x0FFFFFFFFFFFFFFF 42 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF futex 43 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 44 | -------------------------------------------------------------------------------- /test/cut-2-15.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) $(XX) close 3 | $(XX) $(XX) ------------------ ------------------ open "START 111 1234567890 111 END" 0x0000000000000102 0x0000000000000103 4 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF open 5 | $(XX) $(XX) ------------------ ------------------ openat 0x0000000000000101 "START 222 1234567890 222 END" 0x0000000000000103 0x0000000000000104 6 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF openat 7 | $(XX) $(XX) ------------------ ------------------ rename "START 111 1234567890 111 END" "START 222 1234567890 222 END" 8 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF rename 9 | $(XX) $(XX) ------------------ ------------------ llistxattr "START 222 1234567890 222 END" $(XX) 0x0000000000000103 10 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF llistxattr 11 | $(XX) $(XX) ------------------ ------------------ symlinkat "START 111 1234567890 111 END" 0x0000000000000102 "START 222 1234567890 222 END" 12 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF symlinkat 13 | $(XX) $(XX) ------------------ ------------------ renameat 0x0000000000000101 "START 111 1234567890 111 END" 0x0000000000000103 "START 222 1234567890 222 END" 14 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF renameat 15 | $(XX) $(XX) ------------------ ------------------ mount "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000101 0x0000000000000102 16 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF mount 17 | $(XX) $(XX) ------------------ ------------------ request_key "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000104 18 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF request_key 19 | $(XX) $(XX) ------------------ ------------------ init_module 0x0000000000000101 0x0000000000000102 "START 111 1234567890 111 END" 20 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF init_module 21 | $(XX) $(XX) ------------------ ------------------ kexec_file_load 0x0000000000000101 0x0000000000000102 0x0000000000000103 "START 222 1234567890 222 END" 0x0000000000000105 22 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF kexec_file_load 23 | $(XX) $(XX) ------------------ ------------------ fanotify_mark 0x0000000000000101 0x0000000000000102 0x0000000000000103 0x0000000000000104 "START 111 1234567890 111 END" 24 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF fanotify_mark 25 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 26 | -------------------------------------------------------------------------------- /test/cut-2-5.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) $(XX) close 3 | $(XX) $(XX) ------------------ ------------------ open "/etc/fstab" 0x0000000000000000 $(XX) 4 | $(XX) $(XX) 0x0000000000000000 $(XX) open 5 | $(XX) $(XX) ------------------ ------------------ close $(XX) 6 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 close 7 | $(XX) $(XX) ------------------ ------------------ open "/tmp/tmp vltrace" 0x0000000000000042 $(XX) 8 | $(XX) $(XX) $(XX) $(XX) open 9 | $(XX) $(XX) ------------------ ------------------ write $(XX) $(XX) 0x0000000000000100 10 | $(XX) $(XX) $(XX) $(XX) write 11 | $(XX) $(XX) ------------------ ------------------ lseek $(XX) 0x0000000000000000 0x0000000000000000 12 | $(XX) $(XX) $(XX) $(XX) lseek 13 | $(XX) $(XX) ------------------ ------------------ read $(XX) $(XX) 0x0000000000000100 14 | $(XX) $(XX) $(XX) $(XX) read 15 | $(XX) $(XX) ------------------ ------------------ $(*)fstat $(XX) $(XX) 16 | $(XX) $(XX) $(XX) $(XX) $(*)fstat 17 | $(XX) $(XX) ------------------ ------------------ close $(XX) 18 | $(XX) $(XX) $(XX) $(XX) close 19 | $(XX) $(XX) ------------------ ------------------ unlink "/tmp/tmp vltrace" 20 | $(XX) $(XX) $(XX) $(XX) unlink 21 | $(XX) $(XX) ------------------ ------------------ execve "/tmp/tmp vltrace" 0x0000000000123456 0x0000000000654321 22 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF execve 23 | $(XX) $(XX) ------------------ ------------------ $(*)stat "/etc/fstab" $(XX) 24 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)stat 25 | $(XX) $(XX) ------------------ ------------------ $(*)lstat "/etc/fstab" $(XX) 26 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)lstat 27 | $(XX) $(XX) ------------------ ------------------ $(*)uname $(XX) 28 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)uname 29 | $(XX) $(XX) ------------------ ------------------ getpid 30 | $(XX) $(XX) 0x0000000000000000 $(XX) getpid 31 | $(XX) $(XX) ------------------ ------------------ gettid 32 | $(XX) $(XX) 0x0000000000000000 $(XX) gettid 33 | $(XX) $(XX) ------------------ ------------------ write 0x0000000000000101 $(XX) 0x0000000000000001 34 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF write 35 | $(XX) $(XX) ------------------ ------------------ read 0x0000000000000102 $(XX) 0x0000000000000002 36 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF read 37 | $(XX) $(XX) ------------------ ------------------ lseek 0x0000000000000103 0x0000000000000003 0x0000000000000002 38 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF lseek 39 | $(XX) $(XX) ------------------ ------------------ $(*)fstat 0x0000000000000104 $(XX) 40 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF $(*)fstat 41 | $(XX) $(XX) ------------------ ------------------ futex 0x0000000000000001 0x0000000000000005 0x0000000000000003 0x0000000000000004 0x0000000000000005 0x0FFFFFFFFFFFFFFF 42 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF futex 43 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 44 | -------------------------------------------------------------------------------- /test/cut-3-15.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) $(XX) close 3 | $(XX) $(XX) ------------------ ------------------ open "START 111 1234567890 111 END" 0x0000000000000102 0x0000000000000103 4 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF open 5 | $(XX) $(XX) ------------------ ------------------ openat 0x0000000000000101 "START 222 1234567890 222 END" 0x0000000000000103 0x0000000000000104 6 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF openat 7 | $(XX) $(XX) ------------------ ------------------ rename "START 111 1234567890 111 END" "START 222 1234567890 222 END" 8 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF rename 9 | $(XX) $(XX) ------------------ ------------------ llistxattr "START 222 1234567890 222 END" $(XX) 0x0000000000000103 10 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF llistxattr 11 | $(XX) $(XX) ------------------ ------------------ symlinkat "START 111 1234567890 111 END" 0x0000000000000102 "START 222 1234567890 222 END" 12 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF symlinkat 13 | $(XX) $(XX) ------------------ ------------------ renameat 0x0000000000000101 "START 111 1234567890 111 END" 0x0000000000000103 "START 222 1234567890 222 END" 14 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF renameat 15 | $(XX) $(XX) ------------------ ------------------ mount "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000101 0x0000000000000102 16 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF mount 17 | $(XX) $(XX) ------------------ ------------------ request_key "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000104 18 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF request_key 19 | $(XX) $(XX) ------------------ ------------------ init_module 0x0000000000000101 0x0000000000000102 "START 111 1234567890 111 END" 20 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF init_module 21 | $(XX) $(XX) ------------------ ------------------ kexec_file_load 0x0000000000000101 0x0000000000000102 0x0000000000000103 "START 222 1234567890 222 END" 0x0000000000000105 22 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF kexec_file_load 23 | $(XX) $(XX) ------------------ ------------------ fanotify_mark 0x0000000000000101 0x0000000000000102 0x0000000000000103 0x0000000000000104 "START 111 1234567890 111 END" 24 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF fanotify_mark 25 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 26 | -------------------------------------------------------------------------------- /test/cut-3-5.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) $(XX) close 3 | $(XX) $(XX) ------------------ ------------------ open "/etc/fstab" 0x0000000000000000 $(XX) 4 | $(XX) $(XX) 0x0000000000000000 $(XX) open 5 | $(XX) $(XX) ------------------ ------------------ close $(XX) 6 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 close 7 | $(XX) $(XX) ------------------ ------------------ open "/tmp/tmp vltrace" 0x0000000000000042 $(XX) 8 | $(XX) $(XX) $(XX) $(XX) open 9 | $(XX) $(XX) ------------------ ------------------ write $(XX) $(XX) 0x0000000000000100 10 | $(XX) $(XX) $(XX) $(XX) write 11 | $(XX) $(XX) ------------------ ------------------ lseek $(XX) 0x0000000000000000 0x0000000000000000 12 | $(XX) $(XX) $(XX) $(XX) lseek 13 | $(XX) $(XX) ------------------ ------------------ read $(XX) $(XX) 0x0000000000000100 14 | $(XX) $(XX) $(XX) $(XX) read 15 | $(XX) $(XX) ------------------ ------------------ $(*)fstat $(XX) $(XX) 16 | $(XX) $(XX) $(XX) $(XX) $(*)fstat 17 | $(XX) $(XX) ------------------ ------------------ close $(XX) 18 | $(XX) $(XX) $(XX) $(XX) close 19 | $(XX) $(XX) ------------------ ------------------ unlink "/tmp/tmp vltrace" 20 | $(XX) $(XX) $(XX) $(XX) unlink 21 | $(XX) $(XX) ------------------ ------------------ execve "/tmp/tmp vltrace" 0x0000000000123456 0x0000000000654321 22 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF execve 23 | $(XX) $(XX) ------------------ ------------------ $(*)stat "/etc/fstab" $(XX) 24 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)stat 25 | $(XX) $(XX) ------------------ ------------------ $(*)lstat "/etc/fstab" $(XX) 26 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)lstat 27 | $(XX) $(XX) ------------------ ------------------ $(*)uname $(XX) 28 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)uname 29 | $(XX) $(XX) ------------------ ------------------ getpid 30 | $(XX) $(XX) 0x0000000000000000 $(XX) getpid 31 | $(XX) $(XX) ------------------ ------------------ gettid 32 | $(XX) $(XX) 0x0000000000000000 $(XX) gettid 33 | $(XX) $(XX) ------------------ ------------------ write 0x0000000000000101 $(XX) 0x0000000000000001 34 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF write 35 | $(XX) $(XX) ------------------ ------------------ read 0x0000000000000102 $(XX) 0x0000000000000002 36 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF read 37 | $(XX) $(XX) ------------------ ------------------ lseek 0x0000000000000103 0x0000000000000003 0x0000000000000002 38 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF lseek 39 | $(XX) $(XX) ------------------ ------------------ $(*)fstat 0x0000000000000104 $(XX) 40 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF $(*)fstat 41 | $(XX) $(XX) ------------------ ------------------ futex 0x0000000000000001 0x0000000000000005 0x0000000000000003 0x0000000000000004 0x0000000000000005 0x0FFFFFFFFFFFFFFF 42 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF futex 43 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 44 | -------------------------------------------------------------------------------- /test/cut-4-15.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) $(XX) close 3 | $(XX) $(XX) ------------------ ------------------ open "START 111 1234567890 111 END" 0x0000000000000102 0x0000000000000103 4 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF open 5 | $(XX) $(XX) ------------------ ------------------ openat 0x0000000000000101 "START 222 1234567890 222 END" 0x0000000000000103 0x0000000000000104 6 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF openat 7 | $(XX) $(XX) ------------------ ------------------ rename "START 111 1234567890 111 END" "START 222 1234567890 222 END" 8 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF rename 9 | $(XX) $(XX) ------------------ ------------------ llistxattr "START 222 1234567890 222 END" $(XX) 0x0000000000000103 10 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF llistxattr 11 | $(XX) $(XX) ------------------ ------------------ symlinkat "START 111 1234567890 111 END" 0x0000000000000102 "START 222 1234567890 222 END" 12 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF symlinkat 13 | $(XX) $(XX) ------------------ ------------------ renameat 0x0000000000000101 "START 111 1234567890 111 END" 0x0000000000000103 "START 222 1234567890 222 END" 14 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF renameat 15 | $(XX) $(XX) ------------------ ------------------ mount "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000101 0x0000000000000102 16 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF mount 17 | $(XX) $(XX) ------------------ ------------------ request_key "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000104 18 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF request_key 19 | $(XX) $(XX) ------------------ ------------------ init_module 0x0000000000000101 0x0000000000000102 "START 111 1234567890 111 END" 20 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF init_module 21 | $(XX) $(XX) ------------------ ------------------ kexec_file_load 0x0000000000000101 0x0000000000000102 0x0000000000000103 "START 222 1234567890 222 END" 0x0000000000000105 22 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF kexec_file_load 23 | $(XX) $(XX) ------------------ ------------------ fanotify_mark 0x0000000000000101 0x0000000000000102 0x0000000000000103 0x0000000000000104 "START 111 1234567890 111 END" 24 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF fanotify_mark 25 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 26 | -------------------------------------------------------------------------------- /test/cut-4-5.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) $(XX) close 3 | $(XX) $(XX) ------------------ ------------------ open "/etc/fstab" 0x0000000000000000 $(XX) 4 | $(XX) $(XX) 0x0000000000000000 $(XX) open 5 | $(XX) $(XX) ------------------ ------------------ close $(XX) 6 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 close 7 | $(XX) $(XX) ------------------ ------------------ open "/tmp/tmp vltrace" 0x0000000000000042 $(XX) 8 | $(XX) $(XX) $(XX) $(XX) open 9 | $(XX) $(XX) ------------------ ------------------ write $(XX) $(XX) 0x0000000000000100 10 | $(XX) $(XX) $(XX) $(XX) write 11 | $(XX) $(XX) ------------------ ------------------ lseek $(XX) 0x0000000000000000 0x0000000000000000 12 | $(XX) $(XX) $(XX) $(XX) lseek 13 | $(XX) $(XX) ------------------ ------------------ read $(XX) $(XX) 0x0000000000000100 14 | $(XX) $(XX) $(XX) $(XX) read 15 | $(XX) $(XX) ------------------ ------------------ $(*)fstat $(XX) $(XX) 16 | $(XX) $(XX) $(XX) $(XX) $(*)fstat 17 | $(XX) $(XX) ------------------ ------------------ close $(XX) 18 | $(XX) $(XX) $(XX) $(XX) close 19 | $(XX) $(XX) ------------------ ------------------ unlink "/tmp/tmp vltrace" 20 | $(XX) $(XX) $(XX) $(XX) unlink 21 | $(XX) $(XX) ------------------ ------------------ execve "/tmp/tmp vltrace" 0x0000000000123456 0x0000000000654321 22 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF execve 23 | $(XX) $(XX) ------------------ ------------------ $(*)stat "/etc/fstab" $(XX) 24 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)stat 25 | $(XX) $(XX) ------------------ ------------------ $(*)lstat "/etc/fstab" $(XX) 26 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)lstat 27 | $(XX) $(XX) ------------------ ------------------ $(*)uname $(XX) 28 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*)uname 29 | $(XX) $(XX) ------------------ ------------------ getpid 30 | $(XX) $(XX) 0x0000000000000000 $(XX) getpid 31 | $(XX) $(XX) ------------------ ------------------ gettid 32 | $(XX) $(XX) 0x0000000000000000 $(XX) gettid 33 | $(XX) $(XX) ------------------ ------------------ write 0x0000000000000101 $(XX) 0x0000000000000001 34 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF write 35 | $(XX) $(XX) ------------------ ------------------ read 0x0000000000000102 $(XX) 0x0000000000000002 36 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF read 37 | $(XX) $(XX) ------------------ ------------------ lseek 0x0000000000000103 0x0000000000000003 0x0000000000000002 38 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF lseek 39 | $(XX) $(XX) ------------------ ------------------ $(*)fstat 0x0000000000000104 $(XX) 40 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF $(*)fstat 41 | $(XX) $(XX) ------------------ ------------------ futex 0x0000000000000001 0x0000000000000005 0x0000000000000003 0x0000000000000004 0x0000000000000005 0x0FFFFFFFFFFFFFFF 42 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF futex 43 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 44 | -------------------------------------------------------------------------------- /test/cut-4.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF close 3 | $(XX) $(XX) ------------------ ------------------ open "111 non exist" 0x0000000000000101 0x0000000000000102 4 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF open 5 | $(XX) $(XX) ------------------ ------------------ close 0x0000000000000101 6 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF close 7 | $(XX) $(XX) ------------------ ------------------ vfork 8 | $(XX) $(XX) 0x0000000000000000 $(XX) vfork 9 | $(XX) $(XX) ------------------ ------------------ open "222 non exist" 0x0000000000000102 0x0000000000000103 10 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF open 11 | $(XX) $(XX) ------------------ ------------------ close 0x0000000000000102 12 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF close 13 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 14 | -------------------------------------------------------------------------------- /test/cut-5-15.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) $(XX) close 3 | $(XX) $(XX) ------------------ ------------------ open "START 111 1234567890 111 END" 0x0000000000000102 0x0000000000000103 4 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF open 5 | $(XX) $(XX) ------------------ ------------------ openat 0x0000000000000101 "START 222 1234567890 222 END" 0x0000000000000103 0x0000000000000104 6 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF openat 7 | $(XX) $(XX) ------------------ ------------------ rename "START 111 1234567890 111 END" "START 222 1234567890 222 END" 8 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF rename 9 | $(XX) $(XX) ------------------ ------------------ llistxattr "START 222 1234567890 222 END" $(XX) 0x0000000000000103 10 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF llistxattr 11 | $(XX) $(XX) ------------------ ------------------ symlinkat "START 111 1234567890 111 END" 0x0000000000000102 "START 222 1234567890 222 END" 12 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF symlinkat 13 | $(XX) $(XX) ------------------ ------------------ renameat 0x0000000000000101 "START 111 1234567890 111 END" 0x0000000000000103 "START 222 1234567890 222 END" 14 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF renameat 15 | $(XX) $(XX) ------------------ ------------------ mount "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000101 0x0000000000000102 16 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF mount 17 | $(XX) $(XX) ------------------ ------------------ request_key "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000104 18 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF request_key 19 | $(XX) $(XX) ------------------ ------------------ init_module 0x0000000000000101 0x0000000000000102 "START 111 1234567890 111 END" 20 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF init_module 21 | $(XX) $(XX) ------------------ ------------------ kexec_file_load 0x0000000000000101 0x0000000000000102 0x0000000000000103 "START 222 1234567890 222 END" 0x0000000000000105 22 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF kexec_file_load 23 | $(XX) $(XX) ------------------ ------------------ fanotify_mark 0x0000000000000101 0x0000000000000102 0x0000000000000103 0x0000000000000104 "START 111 1234567890 111 END" 24 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF fanotify_mark 25 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 26 | -------------------------------------------------------------------------------- /test/cut-6-15.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) $(XX) close 3 | $(XX) $(XX) ------------------ ------------------ open "START 111 1234567890 111 END" 0x0000000000000102 0x0000000000000103 4 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF open 5 | $(XX) $(XX) ------------------ ------------------ openat 0x0000000000000101 "START 222 1234567890 222 END" 0x0000000000000103 0x0000000000000104 6 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF openat 7 | $(XX) $(XX) ------------------ ------------------ rename "START 111 1234567890 111 END" "START 222 1234567890 222 END" 8 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF rename 9 | $(XX) $(XX) ------------------ ------------------ llistxattr "START 222 1234567890 222 END" $(XX) 0x0000000000000103 10 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF llistxattr 11 | $(XX) $(XX) ------------------ ------------------ symlinkat "START 111 1234567890 111 END" 0x0000000000000102 "START 222 1234567890 222 END" 12 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF symlinkat 13 | $(XX) $(XX) ------------------ ------------------ renameat 0x0000000000000101 "START 111 1234567890 111 END" 0x0000000000000103 "START 222 1234567890 222 END" 14 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF renameat 15 | $(XX) $(XX) ------------------ ------------------ mount "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000101 0x0000000000000102 16 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF mount 17 | $(XX) $(XX) ------------------ ------------------ request_key "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000104 18 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF request_key 19 | $(XX) $(XX) ------------------ ------------------ init_module 0x0000000000000101 0x0000000000000102 "START 111 1234567890 111 END" 20 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF init_module 21 | $(XX) $(XX) ------------------ ------------------ kexec_file_load 0x0000000000000101 0x0000000000000102 0x0000000000000103 "START 222 1234567890 222 END" 0x0000000000000105 22 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF kexec_file_load 23 | $(XX) $(XX) ------------------ ------------------ fanotify_mark 0x0000000000000101 0x0000000000000102 0x0000000000000103 0x0000000000000104 "START 111 1234567890 111 END" 24 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF fanotify_mark 25 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 26 | -------------------------------------------------------------------------------- /test/cut-7-15.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) $(XX) close 3 | $(XX) $(XX) ------------------ ------------------ open "START 111 1234567890 111 END" 0x0000000000000102 0x0000000000000103 4 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF open 5 | $(XX) $(XX) ------------------ ------------------ openat 0x0000000000000101 "START 222 1234567890 222 END" 0x0000000000000103 0x0000000000000104 6 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF openat 7 | $(XX) $(XX) ------------------ ------------------ rename "START 111 1234567890 111 END" "START 222 1234567890 222 END" 8 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF rename 9 | $(XX) $(XX) ------------------ ------------------ llistxattr "START 222 1234567890 222 END" $(XX) 0x0000000000000103 10 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF llistxattr 11 | $(XX) $(XX) ------------------ ------------------ symlinkat "START 111 1234567890 111 END" 0x0000000000000102 "START 222 1234567890 222 END" 12 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF symlinkat 13 | $(XX) $(XX) ------------------ ------------------ renameat 0x0000000000000101 "START 111 1234567890 111 END" 0x0000000000000103 "START 222 1234567890 222 END" 14 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF renameat 15 | $(XX) $(XX) ------------------ ------------------ mount "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000101 0x0000000000000102 16 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF mount 17 | $(XX) $(XX) ------------------ ------------------ request_key "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000104 18 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF request_key 19 | $(XX) $(XX) ------------------ ------------------ init_module 0x0000000000000101 0x0000000000000102 "START 111 1234567890 111 END" 20 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF init_module 21 | $(XX) $(XX) ------------------ ------------------ kexec_file_load 0x0000000000000101 0x0000000000000102 0x0000000000000103 "START 222 1234567890 222 END" 0x0000000000000105 22 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF kexec_file_load 23 | $(XX) $(XX) ------------------ ------------------ fanotify_mark 0x0000000000000101 0x0000000000000102 0x0000000000000103 0x0000000000000104 "START 111 1234567890 111 END" 24 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF fanotify_mark 25 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 26 | -------------------------------------------------------------------------------- /test/cut-7.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF close 3 | $(XX) $(XX) ------------------ ------------------ rt_sigaction 0x000000000000000A $(XX) 0x0000000000000000 0x0000000000000008 4 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 rt_sigaction 5 | $(OPT)$(XX) $(XX) ------------------ ------------------ rt_sigprocmask 0x0000000000000000 $(XX) $(XX) 0x0000000000000008 6 | $(OPT)$(XX) $(XX) 0x0000000000000000 0x0000000000000000 rt_sigprocmask 7 | $(OPT)$(XX) $(XX) ------------------ ------------------ getpid 8 | $(OPT)$(XX) $(XX) 0x0000000000000000 $(XX) getpid 9 | $(OPT)$(XX) $(XX) ------------------ ------------------ gettid 10 | $(OPT)$(XX) $(XX) 0x0000000000000000 $(XX) gettid 11 | $(XX) $(XX) ------------------ ------------------ tgkill $(XX) $(XX) 0x000000000000000A 12 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 tgkill 13 | $(OPT)$(XX) $(XX) ------------------ ------------------ rt_sigprocmask 0x0000000000000002 $(XX) $(XX) 0x0000000000000008 14 | $(OPT)$(XX) $(XX) 0x0000000000000000 0x0000000000000000 rt_sigprocmask 15 | $(XX) $(XX) ------------------ ------------------ rt_sigreturn 0x000000000000000A $(*) 16 | $(XX) $(XX) 0x0000000000000000 0x0000000000000000 $(*) 17 | $(OPT)$(XX) $(XX) ------------------ ------------------ nanosleep $(XX) $(XX) 18 | $(OPT)$(XX) $(XX) $(XX) $(XX) nanosleep 19 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 20 | -------------------------------------------------------------------------------- /test/cut-8-15.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) $(XX) close 3 | $(XX) $(XX) ------------------ ------------------ open "START 111 1234567890 111 END" 0x0000000000000102 0x0000000000000103 4 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF open 5 | $(XX) $(XX) ------------------ ------------------ openat 0x0000000000000101 "START 222 1234567890 222 END" 0x0000000000000103 0x0000000000000104 6 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF openat 7 | $(XX) $(XX) ------------------ ------------------ rename "START 111 1234567890 111 END" "START 222 1234567890 222 END" 8 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF rename 9 | $(XX) $(XX) ------------------ ------------------ llistxattr "START 222 1234567890 222 END" $(XX) 0x0000000000000103 10 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF llistxattr 11 | $(XX) $(XX) ------------------ ------------------ symlinkat "START 111 1234567890 111 END" 0x0000000000000102 "START 222 1234567890 222 END" 12 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF symlinkat 13 | $(XX) $(XX) ------------------ ------------------ renameat 0x0000000000000101 "START 111 1234567890 111 END" 0x0000000000000103 "START 222 1234567890 222 END" 14 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF renameat 15 | $(XX) $(XX) ------------------ ------------------ mount "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000101 0x0000000000000102 16 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF mount 17 | $(XX) $(XX) ------------------ ------------------ request_key "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000104 18 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF request_key 19 | $(XX) $(XX) ------------------ ------------------ init_module 0x0000000000000101 0x0000000000000102 "START 111 1234567890 111 END" 20 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF init_module 21 | $(XX) $(XX) ------------------ ------------------ kexec_file_load 0x0000000000000101 0x0000000000000102 0x0000000000000103 "START 222 1234567890 222 END" 0x0000000000000105 22 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF kexec_file_load 23 | $(XX) $(XX) ------------------ ------------------ fanotify_mark 0x0000000000000101 0x0000000000000102 0x0000000000000103 0x0000000000000104 "START 111 1234567890 111 END" 24 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF fanotify_mark 25 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 26 | -------------------------------------------------------------------------------- /test/cut-8.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) $(XX) close 3 | $(XX) $(XX) ------------------ ------------------ open "START 111 1234567890 111 END" 0x0000000000000102 0x0000000000000103 4 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF open 5 | $(XX) $(XX) ------------------ ------------------ openat 0x0000000000000101 "START 222 1234567890 222 END" 0x0000000000000103 0x0000000000000104 6 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF openat 7 | $(XX) $(XX) ------------------ ------------------ rename "START 111 1234567890 111 END" "START 222 1234567890 222 END" 8 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF rename 9 | $(XX) $(XX) ------------------ ------------------ llistxattr "START 222 1234567890 222 END" $(XX) 0x0000000000000103 10 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF llistxattr 11 | $(XX) $(XX) ------------------ ------------------ symlinkat "START 111 1234567890 111 END" 0x0000000000000102 "START 222 1234567890 222 END" 12 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF symlinkat 13 | $(XX) $(XX) ------------------ ------------------ renameat 0x0000000000000101 "START 111 1234567890 111 END" 0x0000000000000103 "START 222 1234567890 222 END" 14 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF renameat 15 | $(XX) $(XX) ------------------ ------------------ mount "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000101 0x0000000000000102 16 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF mount 17 | $(XX) $(XX) ------------------ ------------------ request_key "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000104 18 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF request_key 19 | $(XX) $(XX) ------------------ ------------------ init_module 0x0000000000000101 0x0000000000000102 "START 111 1234567890 111 END" 20 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF init_module 21 | $(XX) $(XX) ------------------ ------------------ kexec_file_load 0x0000000000000101 0x0000000000000102 0x0000000000000103 "START 222 1234567890 222 END" 0x0000000000000105 22 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF kexec_file_load 23 | $(XX) $(XX) ------------------ ------------------ fanotify_mark 0x0000000000000101 0x0000000000000102 0x0000000000000103 0x0000000000000104 "START 111 1234567890 111 END" 24 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF fanotify_mark 25 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 26 | -------------------------------------------------------------------------------- /test/cut-9-15.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) $(XX) close 3 | $(XX) $(XX) ------------------ ------------------ open "START 111 1234567890 111 END" 0x0000000000000102 0x0000000000000103 4 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF open 5 | $(XX) $(XX) ------------------ ------------------ openat 0x0000000000000101 "START 222 1234567890 222 END" 0x0000000000000103 0x0000000000000104 6 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF openat 7 | $(XX) $(XX) ------------------ ------------------ rename "START 111 1234567890 111 END" "START 222 1234567890 222 END" 8 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF rename 9 | $(XX) $(XX) ------------------ ------------------ llistxattr "START 222 1234567890 222 END" $(XX) 0x0000000000000103 10 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF llistxattr 11 | $(XX) $(XX) ------------------ ------------------ symlinkat "START 111 1234567890 111 END" 0x0000000000000102 "START 222 1234567890 222 END" 12 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF symlinkat 13 | $(XX) $(XX) ------------------ ------------------ renameat 0x0000000000000101 "START 111 1234567890 111 END" 0x0000000000000103 "START 222 1234567890 222 END" 14 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF renameat 15 | $(XX) $(XX) ------------------ ------------------ mount "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000101 0x0000000000000102 16 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF mount 17 | $(XX) $(XX) ------------------ ------------------ request_key "START 111 1234567890 111 END" "START 222 1234567890 222 END" "START 333 1234567890 333 END" 0x0000000000000104 18 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF request_key 19 | $(XX) $(XX) ------------------ ------------------ init_module 0x0000000000000101 0x0000000000000102 "START 111 1234567890 111 END" 20 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF init_module 21 | $(XX) $(XX) ------------------ ------------------ kexec_file_load 0x0000000000000101 0x0000000000000102 0x0000000000000103 "START 222 1234567890 222 END" 0x0000000000000105 22 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF kexec_file_load 23 | $(XX) $(XX) ------------------ ------------------ fanotify_mark 0x0000000000000101 0x0000000000000102 0x0000000000000103 0x0000000000000104 "START 111 1234567890 111 END" 24 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF fanotify_mark 25 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 26 | -------------------------------------------------------------------------------- /test/cut-9.log.match: -------------------------------------------------------------------------------- 1 | $(XX) $(XX) ------------------ ------------------ close 0x0000000012345678 2 | $(XX) $(XX) $(XX) $(XX) close 3 | $(XX) $(XX) ------------------ ------------------ open "START 111 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 111 END" 0x0000000000000102 0x0000000000000103 4 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF open 5 | $(XX) $(XX) ------------------ ------------------ openat 0x0000000000000101 "START 222 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 222 END" 0x0000000000000103 0x0000000000000104 6 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF openat 7 | $(XX) $(XX) ------------------ ------------------ rename "START 111 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 111 END" "START 222 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 222 END" 8 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF rename 9 | $(XX) $(XX) ------------------ ------------------ llistxattr "START 222 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 222 END" $(XX) 0x0000000000000103 10 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF llistxattr 11 | $(XX) $(XX) ------------------ ------------------ symlinkat "START 111 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 111 END" 0x0000000000000102 "START 222 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 222 END" 12 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF symlinkat 13 | $(XX) $(XX) ------------------ ------------------ renameat 0x0000000000000101 "START 111 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 111 END" 0x0000000000000103 "START 222 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 222 END" 14 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF renameat 15 | $(XX) $(XX) ------------------ ------------------ mount "START 111 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 111 END" "START 222 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 222 END" "START 333 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 333 END" 0x0000000000000101 0x0000000000000102 16 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF mount 17 | $(XX) $(XX) ------------------ ------------------ request_key "START 111 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 111 END" "START 222 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 222 END" "START 333 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 333 END" 0x0000000000000104 18 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF request_key 19 | $(XX) $(XX) ------------------ ------------------ init_module 0x0000000000000101 0x0000000000000102 "START 111 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 111 END" 20 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF init_module 21 | $(XX) $(XX) ------------------ ------------------ kexec_file_load 0x0000000000000101 0x0000000000000102 0x0000000000000103 "START 222 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 222 END" 0x0000000000000105 22 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF kexec_file_load 23 | $(XX) $(XX) ------------------ ------------------ fanotify_mark 0x0000000000000101 0x0000000000000102 0x0000000000000103 0x0000000000000104 "START 111 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 111 END" 24 | $(XX) $(XX) $(XX) 0xFFFFFFFFFFFFFFFF fanotify_mark 25 | $(XX) $(XX) ------------------ ------------------ close 0x0000000087654321 26 | -------------------------------------------------------------------------------- /test/utils/report-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2017, Intel Corporation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in 14 | # the documentation and/or other materials provided with the 15 | # distribution. 16 | # 17 | # * Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived 19 | # from this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | # 35 | # test/utils/report-tests.sh -- generate test report 36 | # 37 | # Usage: report-tests.sh ])> 38 | # or: report-tests.sh [] 39 | # 40 | 41 | [ "$1" != "" ] && [ -f $1 ] \ 42 | && OUTPUT="cat $1" \ 43 | || OUTPUT="$(dirname $0)/view-tests.sh long $1" 44 | 45 | echo 46 | ERR=$($OUTPUT | grep '%' | cut -f3 | cut -d" " -f1 | sort | uniq) 47 | if [ "$ERR" != "" ]; then 48 | for e in $ERR; do 49 | case $e in 50 | missed-entry-syscall:) 51 | SC=$($OUTPUT | grep "$e" | cut -f3 | cut -d" " -f2 | sort | uniq) 52 | for s in $SC; do 53 | echo "- missed ENTRY probe of syscall: $s" 54 | $OUTPUT | grep "$e $s " | sed "s/\t$e $s\t/\t\t/g" 55 | echo 56 | done 57 | ;; 58 | missed-exit-syscall:) 59 | SC=$($OUTPUT | grep "$e" | cut -f3 | cut -d" " -f2 | sort | uniq) 60 | for s in $SC; do 61 | echo "- missed EXIT probe of syscall: $s" 62 | $OUTPUT | grep "$e $s " | sed "s/\t$e $s\t/\t\t/g" 63 | echo 64 | done 65 | ;; 66 | wrong-arguments:) 67 | SC=$($OUTPUT | grep "$e" | cut -f3 | cut -d" " -f2 | sort | uniq) 68 | for s in $SC; do 69 | echo "- wrong arguments: $s" 70 | $OUTPUT | grep "$e $s " | sed "s/\t$e $s\t/\t\t/g" 71 | echo 72 | done 73 | ;; 74 | missing-output) 75 | echo "- missing output - follow-fork did not follow (no output of at least one process):" 76 | $OUTPUT | grep "$e" | sed "s/\t$e\t/\t\t/g" 77 | ;; 78 | truncated-output) 79 | echo "- truncated output - follow-fork stopped following:" 80 | $OUTPUT | grep "$e" | sed "s/\t$e\t/\t\t/g" 81 | ;; 82 | unexpected-output) 83 | echo "- unexpected output:" 84 | $OUTPUT | grep "$e" | sed "s/\t$e\t/\t\t/g" 85 | ;; 86 | bpf_probe_read-error:) 87 | SC=$($OUTPUT | grep "$e" | cut -f3 | cut -d" " -f2 | sort | uniq) 88 | for s in $SC; do 89 | echo "- bpf_probe_read error: $s" 90 | $OUTPUT | grep "$e $s " | sed "s/\t$e $s\t/\t\t/g" 91 | echo 92 | done 93 | ;; 94 | *) 95 | echo "Unsupported event: $e" 96 | ;; 97 | esac 98 | echo 99 | done 100 | fi 101 | exit 102 | -------------------------------------------------------------------------------- /test/utils/run-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2017, Intel Corporation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in 14 | # the documentation and/or other materials provided with the 15 | # distribution. 16 | # 17 | # * Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived 19 | # from this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | # 35 | # test/utils/run-tests.sh -- run ctests for vltrace 36 | # 37 | 38 | TEMP_FILE=$(mktemp) 39 | 40 | MAX=$1 41 | if [ "$MAX" == "" ]; then 42 | echo "Usage: $0 " 43 | echo " e.g. $0 10 1 2 3 - runs tests (1,2,3) ten (10) times" 44 | exit 1 45 | else 46 | shift 47 | fi 48 | 49 | TESTS=$* 50 | if [ "$TESTS" == "" ]; then 51 | TOTAL=$(ctest -N | tail -n1 | cut -d' ' -f3) 52 | TESTS=$(seq -s' ' $TOTAL) 53 | fi 54 | 55 | echo 56 | echo "Number of iterations: $MAX" 57 | echo "Tests to run: $TESTS" 58 | echo 59 | 60 | N=1 61 | while [ $N -le $MAX ]; do 62 | echo "--- ITERATION #$N ---" 63 | for n in $TESTS; do 64 | if [ "$RUN_TEST_EXIT_ON_ERROR" != "1" ]; then 65 | echo "--- TEST #$N ---" >> log${n}.txt 66 | ctest -V -I ${n},${n} 2>&1 | tee -a log${n}.txt 67 | else 68 | echo > $TEMP_FILE 69 | tailf $TEMP_FILE & 70 | echo >> $TEMP_FILE 71 | echo "--- TEST #$n ---" >> $TEMP_FILE 72 | ctest -V -I ${n},${n} >> $TEMP_FILE 2>&1 73 | RV=$? 74 | cat $TEMP_FILE >> log${n}.txt 75 | rm -f $TEMP_FILE 76 | [ $RV -ne 0 ] && exit 1 77 | fi 78 | done 79 | N=$(($N + 1)) 80 | done 81 | 82 | rm -f $TEMP_FILE 83 | -------------------------------------------------------------------------------- /test/utils/view-tests-short.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2017, Intel Corporation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in 14 | # the documentation and/or other materials provided with the 15 | # distribution. 16 | # 17 | # * Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived 19 | # from this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | # 34 | # test/utils/view-tests-short.sh -- view results of ctests for vltrace 35 | # in short form 36 | # 37 | # Usage: view-tests-short.sh [long] [] 38 | # 39 | 40 | [ "$1" == "long" ] && LONG=1 && shift || LONG=0 41 | [ "$1" != "" ] && MIN=$1 || MIN=1 42 | 43 | MAX=$(ls -1 log* | cut -c4- | cut -d'.' -f1 | sort -n | tail -n1) 44 | TESTS=$(seq -s' ' $MAX) 45 | 46 | for n in $TESTS; do 47 | [ ! -f ./log${n}.txt ] && continue 48 | [ $n -lt 10 ] \ 49 | && echo -n "TEST $n" \ 50 | || echo -n "TEST $n" 51 | NAME=$(cat ./log${n}.txt | grep Start | head -n1 | cut -d" " -f7) 52 | P=$(cat ./log${n}.txt | grep Passed | wc -l) 53 | F=$(cat ./log${n}.txt | grep "\*\*\*Failed" | wc -l) 54 | A=$(($P + $F)) 55 | echo " All $A Passed $P Failed $F ($NAME)" 56 | done 57 | -------------------------------------------------------------------------------- /tools/bench_sc/bench_sc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2017, Intel Corporation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * * Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | /* 34 | * bench_sc.c -- testing benchmark for vltrace. This simple benchmark 35 | * allow us to measure and compare different tracing tools. 36 | */ 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #include 46 | #include 47 | #include 48 | 49 | typedef void (*tx_t)(); 50 | 51 | /* 52 | * open_close -- tested usecase itself 53 | */ 54 | static void 55 | open_close() 56 | { 57 | int fd; 58 | int x; 59 | 60 | fd = open("/dev/null", O_RDONLY); 61 | if (fd == -1) { 62 | perror("open"); 63 | exit(-1); 64 | } 65 | x = read(fd, &x, sizeof(x)); 66 | x = write(fd, &x, sizeof(x)); 67 | (void) close(fd); 68 | } 69 | 70 | /* 71 | * loop_tx -- run and measure tested usecase 72 | */ 73 | static void 74 | loop_tx(char *name, tx_t tx_f, uint64_t qty, FILE *f) 75 | { 76 | uint64_t i, tu_start, tu_end, delta; 77 | struct timeval tv_start, tv_end; 78 | 79 | if (qty == 0) 80 | return; 81 | 82 | gettimeofday(&tv_start, NULL); 83 | 84 | for (i = 0; i < qty; i++) 85 | tx_f(); 86 | 87 | gettimeofday(&tv_end, NULL); 88 | 89 | if (f == NULL) 90 | return; 91 | 92 | tu_start = tv_start.tv_sec * 1000000 + tv_start.tv_usec; 93 | tu_end = tv_end.tv_sec * 1000000 + tv_end.tv_usec; 94 | 95 | delta = (tu_end - tu_start); 96 | delta *= 1000; 97 | 98 | fprintf(stderr, "%s: iteration time: %ld nsec\n", name, delta / qty); 99 | } 100 | 101 | int 102 | main(int argc, char *argv[]) 103 | { 104 | uint64_t iters_qty; 105 | 106 | if (argc != 2) { 107 | printf("Usage: %s \n", argv[0]); 108 | printf("\t must be greater than 0\n"); 109 | return 1; 110 | } 111 | 112 | iters_qty = atol(argv[1]); 113 | if (iters_qty == 0) { 114 | printf("Error: number of iterations must be greater than 0\n"); 115 | return 1; 116 | } 117 | 118 | /* WARM-UP */ 119 | loop_tx("open_read_write_close", 120 | open_close, iters_qty / 10, NULL); 121 | loop_tx(">>> open_read_write_close ", 122 | open_close, iters_qty, stderr); 123 | 124 | return 0; 125 | } 126 | -------------------------------------------------------------------------------- /tools/bin2txt/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | __pycache__ 3 | -------------------------------------------------------------------------------- /tools/bin2txt/README.md: -------------------------------------------------------------------------------- 1 | bin2txt converter 2 | ================= 3 | 4 | bin2txt converts vltrace logs from binary to text format. 5 | 6 | bin2txt as a converter is a part of pmemfile's analyzing tool (antool), 7 | so the following files: 8 | 9 | - converter.py 10 | - exceptions.py 11 | - syscallinfo.py 12 | - syscall.py 13 | - syscalltable.py 14 | - utils.py 15 | 16 | should be kept in sync in these two projects: 17 | 18 | 1) https://github.com/pmem/vltrace/tree/master/tools/bin2txt 19 | 2) https://github.com/pmem/pmemfile/tree/master/src/tools/antool 20 | 21 | 22 | ### CONTACTS ### 23 | 24 | For more information about this tool contact: 25 | 26 | - Lukasz Dorau (lukasz.dorau at intel.com) 27 | 28 | or create an issue [here](https://github.com/pmem/vltrace/issues). 29 | -------------------------------------------------------------------------------- /tools/bin2txt/bin2txt.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | # Copyright 2017, Intel Corporation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in 14 | # the documentation and/or other materials provided with the 15 | # distribution. 16 | # 17 | # * Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived 19 | # from this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | # bin2txt.py -- converts vltrace logs from binary to text format 34 | 35 | import argparse 36 | from converter import * 37 | 38 | 39 | ######################################################################################################################## 40 | # main 41 | ######################################################################################################################## 42 | 43 | def main(): 44 | parser = argparse.ArgumentParser( 45 | description="Converter - converts vltrace logs from binary to text format") 46 | 47 | parser.add_argument("-b", "--binlog", required=True, help="path to a vltrace log in binary format") 48 | 49 | parser.add_argument("-m", "--max-packets", required=False, 50 | help="maximum number of packets to be read from the vltrace binary log") 51 | 52 | parser.add_argument("-o", "--output", required=False, help="file to save analysis output") 53 | 54 | parser.add_argument("-s", "--script", action='store_true', required=False, 55 | help="script mode - print only the most important information (eg. no info about progress)") 56 | parser.add_argument("-v", "--verbose", action='count', required=False, 57 | help="verbose mode (-v: verbose, -vv: very verbose)") 58 | parser.add_argument("-d", "--debug", action='store_true', required=False, help="debug mode") 59 | parser.add_argument("-f", "--offline", action='store_true', required=False, 60 | help="offline mode (first all packets are read, then sorted by time and finally printed out," 61 | "while in the default 'online' mode packets are printed out as they come)") 62 | 63 | args = parser.parse_args() 64 | 65 | if args.verbose: 66 | verbose = args.verbose 67 | else: 68 | verbose = 0 69 | 70 | conv = Converter(args.output, args.max_packets, args.offline, args.script, args.debug, verbose) 71 | 72 | conv.read_and_parse_data(args.binlog) 73 | 74 | if args.offline: 75 | conv.print_log() 76 | 77 | if args.debug: 78 | conv.print_other_lists() 79 | 80 | 81 | if __name__ == "__main__": # pragma: no cover 82 | main() 83 | -------------------------------------------------------------------------------- /tools/bin2txt/exceptions.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | # Copyright 2017, Intel Corporation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in 14 | # the documentation and/or other materials provided with the 15 | # distribution. 16 | # 17 | # * Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived 19 | # from this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | 34 | class EndOfFile(Exception): 35 | def __init__(self): 36 | Exception.__init__(self) 37 | 38 | 39 | class CriticalError(Exception): 40 | def __init__(self, string): 41 | self.message = string 42 | -------------------------------------------------------------------------------- /tools/bin2txt/syscallinfo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | # Copyright 2017, Intel Corporation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in 14 | # the documentation and/or other materials provided with the 15 | # distribution. 16 | # 17 | # * Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived 19 | # from this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | EM_str_1 = 1 << 0 # syscall has string as 1. argument 34 | EM_str_2 = 1 << 1 # syscall has string as 2. argument 35 | EM_str_3 = 1 << 2 # syscall has string as 3. argument 36 | EM_str_4 = 1 << 3 # syscall has string as 4. argument 37 | EM_str_5 = 1 << 4 # syscall has string as 5. argument 38 | EM_str_6 = 1 << 5 # syscall has string as 6. argument 39 | 40 | EM_fd_1 = 1 << 6 # syscall has fd as a 1. arg 41 | EM_fd_2 = 1 << 7 # syscall has fd as a 2. arg 42 | EM_fd_3 = 1 << 8 # syscall has fd as a 3. arg 43 | EM_fd_4 = 1 << 9 # syscall has fd as a 4. arg 44 | EM_fd_5 = 1 << 10 # syscall has fd as a 5. arg 45 | EM_fd_6 = 1 << 11 # syscall has fd as a 6. arg 46 | 47 | EM_path_1 = 1 << 12 # syscall has path as 1. arg 48 | EM_path_2 = 1 << 13 # syscall has path as 2. arg 49 | EM_path_3 = 1 << 14 # syscall has path as 3. arg 50 | EM_path_4 = 1 << 15 # syscall has path as 4. arg 51 | EM_path_5 = 1 << 16 # syscall has path as 5. arg 52 | EM_path_6 = 1 << 17 # syscall has path as 6. arg 53 | 54 | EM_fileat = 1 << 18 # '*at' type syscall (dirfd + path) 55 | EM_fileat2 = 1 << 19 # double '*at' type syscall (dirfd + path) 56 | EM_rfd = 1 << 21 # syscall returns a file descriptor 57 | 58 | EM_aep_arg_4 = 1 << 25 # AT_EMPTY_PATH can be at the 4th argument (fstatat and newfstatat) 59 | EM_aep_arg_5 = 1 << 26 # AT_EMPTY_PATH can be at the 5th argument (linkat and fchownat) 60 | 61 | EM_fd_from_path = EM_rfd | EM_path_1 62 | EM_fd_from_fd = EM_rfd | EM_fd_1 63 | EM_fd_from_dirfd_path = EM_rfd | EM_fd_1 | EM_path_2 64 | 65 | EM_isfileat = EM_fd_1 | EM_path_2 | EM_fileat 66 | EM_isfileat2 = EM_fd_3 | EM_path_4 | EM_fileat2 67 | 68 | EM_str_all = EM_str_1 | EM_str_2 | EM_str_3 | EM_str_4 | EM_str_5 | EM_str_6 69 | EM_path_all = EM_path_1 | EM_path_2 | EM_path_3 | EM_path_4 | EM_path_5 | EM_path_6 70 | EM_fd_all = EM_fd_1 | EM_fd_2 | EM_fd_3 | EM_fd_4 | EM_fd_5 | EM_fd_6 71 | 72 | Arg_is_str = [EM_str_1, EM_str_2, EM_str_3, EM_str_4, EM_str_5, EM_str_6] 73 | Arg_is_path = [EM_path_1, EM_path_2, EM_path_3, EM_path_4, EM_path_5, EM_path_6] 74 | Arg_is_fd = [EM_fd_1, EM_fd_2, EM_fd_3, EM_fd_4, EM_fd_5, EM_fd_6] 75 | 76 | 77 | class SyscallInfo: 78 | def __init__(self, name, mask, nargs, nstrargs): 79 | self.name = name 80 | self.mask = mask 81 | self.nargs = nargs 82 | self.nstrargs = nstrargs 83 | 84 | #################################################################################################################### 85 | def is_mask(self, mask): 86 | return (self.mask & mask) == mask 87 | 88 | #################################################################################################################### 89 | def has_mask(self, mask): 90 | return self.mask & mask 91 | -------------------------------------------------------------------------------- /tools/bin2txt/utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | # Copyright 2017, Intel Corporation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in 14 | # the documentation and/or other materials provided with the 15 | # distribution. 16 | # 17 | # * Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived 19 | # from this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | import struct 34 | import inspect 35 | 36 | from sys import stderr 37 | from exceptions import * 38 | 39 | 40 | ######################################################################################################################## 41 | # assert_msg -- custom assert function 42 | ######################################################################################################################## 43 | def assert_msg(cond, message): 44 | if cond: 45 | return 46 | 47 | frame_record = inspect.stack()[1] 48 | frame = frame_record[0] 49 | info = inspect.getframeinfo(frame) 50 | print("CRITICAL:{0:s}:{1:d}:{2:s}(): {3:s}".format(info.filename, info.lineno, info.function, message), file=stderr) 51 | 52 | raise CriticalError(message) 53 | 54 | 55 | #################################################################################################################### 56 | # open_file -- open file with error handling 57 | #################################################################################################################### 58 | def open_file(path, flags): 59 | try: 60 | fh = open(path, flags) 61 | except FileNotFoundError: 62 | print("ERROR: file not found: {0:s}".format(path), file=stderr) 63 | exit(-1) 64 | except: # pragma: no cover 65 | print("ERROR: unexpected error", file=stderr) 66 | raise 67 | # noinspection PyUnboundLocalVariable 68 | return fh 69 | 70 | 71 | #################################################################################################################### 72 | # read_bdata - read binary data from file 73 | #################################################################################################################### 74 | def read_bdata(fh, size): 75 | assert_msg(size >= 0, "attempt to read data of negative size, input file may be corrupted") 76 | bdata = fh.read(size) 77 | length = len(bdata) 78 | if length == 0: 79 | raise EndOfFile() 80 | assert_msg(length == size, "input file is truncated") 81 | return bdata 82 | 83 | 84 | #################################################################################################################### 85 | # read_fmt_data -- read formatted data from file fh 86 | #################################################################################################################### 87 | def read_fmt_data(fh, fmt): 88 | size = struct.calcsize(fmt) 89 | bdata = read_bdata(fh, size) 90 | return struct.unpack(fmt, bdata) 91 | -------------------------------------------------------------------------------- /utils/README: -------------------------------------------------------------------------------- 1 | This is utils/README. 2 | 3 | The scripts found here are used during vltrace development. 4 | -------------------------------------------------------------------------------- /utils/check-kernel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # 3 | # Copyright 2017, Intel Corporation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in 14 | # the documentation and/or other materials provided with the 15 | # distribution. 16 | # 17 | # * Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived 19 | # from this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | # 34 | # check-kernel.sh - check kernel version 35 | # 36 | 37 | source utils/functions.sh 38 | 39 | V_REQUIRED=$1 40 | if [ "$V_REQUIRED" = "" ]; then 41 | echo "Usage: $0 " >&2 42 | exit 1 43 | fi 44 | 45 | V_ACTUAL=$(uname -r) 46 | REQUIRED=$(format_kernel_version $V_REQUIRED) 47 | ACTUAL=$(format_kernel_version $V_ACTUAL) 48 | 49 | SKIP_MESSAGE="Warning: skipping tests (kernel is too old: required >= $V_REQUIRED, actual = $V_ACTUAL)" 50 | 51 | if [ $ACTUAL -lt $REQUIRED ]; then 52 | echo $SKIP_MESSAGE >&2 53 | exit 1 54 | fi 55 | -------------------------------------------------------------------------------- /utils/check_license/file-exceptions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # 3 | # Copyright 2016-2017, Intel Corporation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in 14 | # the documentation and/or other materials provided with the 15 | # distribution. 16 | # 17 | # * Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived 19 | # from this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | # empty file 35 | -------------------------------------------------------------------------------- /utils/docker/0001-travis-fix-travisci_build_coverity_scan.sh.patch: -------------------------------------------------------------------------------- 1 | From b5179dc4822eaab192361da05aa95d98f523960f Mon Sep 17 00:00:00 2001 2 | From: Lukasz Dorau 3 | Date: Mon, 7 May 2018 12:05:40 +0200 4 | Subject: [PATCH] travis: fix travisci_build_coverity_scan.sh 5 | 6 | --- 7 | travisci_build_coverity_scan.sh | 4 ++-- 8 | 1 file changed, 2 insertions(+), 2 deletions(-) 9 | 10 | diff --git a/travisci_build_coverity_scan.sh b/travisci_build_coverity_scan.sh 11 | index ad9d4afcf..562b08bcc 100644 12 | --- a/travisci_build_coverity_scan.sh 13 | +++ b/travisci_build_coverity_scan.sh 14 | @@ -92,8 +92,8 @@ response=$(curl \ 15 | --form description="Travis CI build" \ 16 | $UPLOAD_URL) 17 | status_code=$(echo "$response" | sed -n '$p') 18 | -if [ "$status_code" != "201" ]; then 19 | +if [ "$status_code" != "200" ]; then 20 | TEXT=$(echo "$response" | sed '$d') 21 | - echo -e "\033[33;1mCoverity Scan upload failed: $TEXT.\033[0m" 22 | + echo -e "\033[33;1mCoverity Scan upload failed: $response.\033[0m" 23 | exit 1 24 | fi 25 | -- 26 | 2.13.6 27 | 28 | -------------------------------------------------------------------------------- /utils/docker/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | # 3 | # Copyright 2016-2017, Intel Corporation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in 14 | # the documentation and/or other materials provided with the 15 | # distribution. 16 | # 17 | # * Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived 19 | # from this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | # 34 | # build.sh - runs a Docker container from a Docker image with environment 35 | # prepared for building this project. 36 | # 37 | 38 | if [[ -z "$OS" || -z "$OS_VER" ]]; then 39 | echo "ERROR: The variables OS and OS_VER have to be set properly " \ 40 | "(eg. OS=ubuntu, OS_VER=16.04)." 41 | exit 1 42 | fi 43 | 44 | if [[ -z "$HOST_WORKDIR" ]]; then 45 | echo "ERROR: The variable HOST_WORKDIR has to contain a path to " \ 46 | "the root of this project on the host machine" 47 | exit 1 48 | fi 49 | 50 | imageName=${DOCKER_REPO}:${OS}-${OS_VER} 51 | containerName=vltrace-${OS}-${OS_VER} 52 | chmod -R a+w $HOST_WORKDIR 53 | 54 | if [[ "$TRAVIS_EVENT_TYPE" == "cron" || "$TRAVIS_BRANCH" == "coverity_scan" ]]; then 55 | if [[ $TYPE != coverity ]]; then 56 | echo "Skipping non-Coverity job for cron/Coverity build" 57 | exit 0 58 | fi 59 | else 60 | if [[ $TYPE = "coverity" ]]; then 61 | echo "Skipping Coverity job for non cron/Coverity build" 62 | exit 0 63 | fi 64 | fi 65 | 66 | case $TYPE in 67 | normal) 68 | command="./run-build.sh"; 69 | ;; 70 | coverity) 71 | command="./run-coverity.sh"; 72 | ;; 73 | esac 74 | 75 | if [ -n "$DNS_SERVER" ]; then DNS_SETTING=" --dns=$DNS_SERVER "; fi 76 | 77 | WORKDIR=/vltrace 78 | 79 | # Run a container with 80 | # - environment variables set (--env) 81 | # - host directory containing vltrace source mounted (-v) 82 | # - working directory set (-w) 83 | sudo docker run --rm --privileged=true --name=$containerName -ti \ 84 | $DNS_SETTING \ 85 | --env http_proxy=$http_proxy \ 86 | --env https_proxy=$https_proxy \ 87 | --env COMPILER=$COMPILER \ 88 | --env WORKDIR=$WORKDIR \ 89 | --env TRAVIS=$TRAVIS \ 90 | --env TRAVIS_COMMIT_RANGE=$TRAVIS_COMMIT_RANGE \ 91 | --env TRAVIS_COMMIT=$TRAVIS_COMMIT \ 92 | --env TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG \ 93 | --env TRAVIS_BRANCH=$TRAVIS_BRANCH \ 94 | --env TRAVIS_EVENT_TYPE=$TRAVIS_EVENT_TYPE \ 95 | --env COVERITY_SCAN_TOKEN=$COVERITY_SCAN_TOKEN \ 96 | --env COVERITY_SCAN_NOTIFICATION_EMAIL=$COVERITY_SCAN_NOTIFICATION_EMAIL \ 97 | -v /usr/src:/usr/src \ 98 | -v /lib/modules:/lib/modules \ 99 | -v $HOST_WORKDIR:$WORKDIR \ 100 | -w $WORKDIR/utils/docker \ 101 | $imageName $command 102 | -------------------------------------------------------------------------------- /utils/docker/images/Dockerfile.fedora-25: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2016-2017, Intel Corporation 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 11 | # * Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in 13 | # the documentation and/or other materials provided with the 14 | # distribution. 15 | # 16 | # * Neither the name of the copyright holder nor the names of its 17 | # contributors may be used to endorse or promote products derived 18 | # from this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | # 33 | # Dockerfile - a 'recipe' for Docker to build an image of fedora-based 34 | # environment for building vltrace 35 | # 36 | 37 | # Pull base image 38 | FROM fedora:25 39 | MAINTAINER lukasz.dorau@intel.com 40 | 41 | # Install basic tools 42 | RUN echo -e '[iovisor]\nbaseurl=https://repo.iovisor.org/yum/main/f25/$basearch\nenabled=1\ngpgcheck=0' \ 43 | | tee /etc/yum.repos.d/iovisor.repo 44 | RUN dnf install -y \ 45 | clang \ 46 | cmake \ 47 | gcc \ 48 | git \ 49 | make \ 50 | pandoc \ 51 | rpm-build \ 52 | passwd \ 53 | sudo \ 54 | which \ 55 | whois 56 | 57 | RUN dnf install -y kernel-devel 58 | RUN dnf install -y bcc-tools-0.4.0-1 59 | 60 | # Add user 61 | ENV USER user 62 | ENV USERPASS pass 63 | RUN useradd -m $USER 64 | RUN echo $USERPASS | passwd $USER --stdin 65 | RUN gpasswd wheel -a $USER 66 | RUN echo "$USER ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers 67 | 68 | USER $USER 69 | 70 | # Set required environment variables 71 | ENV OS fedora 72 | ENV OS_VER 25 73 | ENV PACKAGE_MANAGER rpm 74 | ENV NOTTY 1 75 | -------------------------------------------------------------------------------- /utils/docker/images/Dockerfile.ubuntu-16.04: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2016-2017, Intel Corporation 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # 8 | # * Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 11 | # * Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in 13 | # the documentation and/or other materials provided with the 14 | # distribution. 15 | # 16 | # * Neither the name of the copyright holder nor the names of its 17 | # contributors may be used to endorse or promote products derived 18 | # from this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | # 33 | # Dockerfile - a 'recipe' for Docker to build an image of ubuntu-based 34 | # environment for building vltrace 35 | # 36 | 37 | # Pull base image 38 | FROM ubuntu:16.04 39 | MAINTAINER lukasz.dorau@intel.com 40 | 41 | # Update the Apt cache and install basic tools 42 | RUN apt-get update && apt-get install -y apt-transport-https apt-utils 43 | RUN apt-get update && apt-get install -y \ 44 | clang \ 45 | cmake \ 46 | curl \ 47 | debhelper \ 48 | devscripts \ 49 | git \ 50 | pandoc \ 51 | pkg-config \ 52 | ruby \ 53 | sudo \ 54 | wget \ 55 | whois 56 | 57 | RUN apt-get install -y linux-headers-4.8.0-46-generic 58 | 59 | RUN echo "deb [trusted=yes] https://repo.iovisor.org/apt/xenial xenial main" \ 60 | | tee /etc/apt/sources.list.d/iovisor.list 61 | RUN apt-get update && apt-get install -y bcc-tools=0.4.0-* 62 | 63 | # Add user 64 | ENV USER user 65 | ENV USERPASS pass 66 | RUN useradd -m $USER -g sudo -p `mkpasswd $USERPASS` 67 | RUN echo "$USER ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers 68 | 69 | USER $USER 70 | 71 | # Set required environment variables 72 | ENV OS ubuntu 73 | ENV OS_VER 16.04 74 | ENV PACKAGE_MANAGER deb 75 | ENV NOTTY 1 76 | -------------------------------------------------------------------------------- /utils/docker/images/build-image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | # 3 | # Copyright 2016-2017, Intel Corporation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in 14 | # the documentation and/or other materials provided with the 15 | # distribution. 16 | # 17 | # * Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived 19 | # from this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | # 34 | # build-image.sh 35 | # - prepares a Docker image with -based 36 | # environment for building vltrace project, 37 | # according to the Dockerfile. file 38 | # located in the same directory. 39 | # 40 | # The script can be run locally. 41 | # 42 | 43 | function usage { 44 | echo "Usage:" 45 | echo " build-image.sh " 46 | echo "where , for example, can be 'ubuntu-16.04', provided " \ 47 | "a Dockerfile named 'Dockerfile.ubuntu-16.04' exists in the " \ 48 | "current directory." 49 | } 50 | 51 | # Check if the first argument is nonempty 52 | if [ -z "$1" -o -z "$2" ]; then 53 | usage 54 | exit 1 55 | fi 56 | 57 | # Check if the file Dockerfile.OS-VER exists 58 | if [[ ! -f "Dockerfile.$2" ]]; then 59 | echo "ERROR: wrong argument." 60 | usage 61 | exit 1 62 | fi 63 | 64 | # Build a Docker image tagged with ${DOCKER_REPO}:OS-VER 65 | docker build -t $1:$2 \ 66 | --build-arg http_proxy=$http_proxy \ 67 | --build-arg https_proxy=$https_proxy \ 68 | -f Dockerfile.$2 . 69 | -------------------------------------------------------------------------------- /utils/docker/images/push-image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # 3 | # Copyright 2016-2017, Intel Corporation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in 14 | # the documentation and/or other materials provided with the 15 | # distribution. 16 | # 17 | # * Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived 19 | # from this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | # 34 | # push-image.sh - pushes the Docker image tagged with OS-VER 35 | # to the Docker Hub 36 | # 37 | # The script utilizes $DOCKER_USER and $DOCKER_PASSWORD variables to log in to 38 | # Docker Hub. The variables can be set in the Travis project's configuration 39 | # for automated builds. 40 | # 41 | 42 | function usage { 43 | echo "Usage:" 44 | echo " push-image.sh " 45 | echo "where , for example, can be 'ubuntu-16.04', provided " \ 46 | "a Docker image tagged with ${DOCKER_REPO}:ubuntu-16.04 exists " \ 47 | "locally." 48 | } 49 | 50 | # Check if the first argument is nonempty 51 | if [[ -z "$1" ]]; then 52 | usage 53 | exit 1 54 | fi 55 | 56 | # Check if the image tagged with ${DOCKER_REPO}:OS-VER exists locally 57 | if [[ ! $(docker images -a | awk -v pattern="^${DOCKER_REPO}:$1\$" \ 58 | '$1":"$2 ~ pattern') ]] 59 | then 60 | echo "ERROR: wrong argument." 61 | usage 62 | exit 1 63 | fi 64 | 65 | # Log in to the Docker Hub 66 | docker login -u="${DOCKER_USER}" -p="${DOCKER_PASSWORD}" 67 | 68 | # Push the image to the repository 69 | docker push ${DOCKER_REPO}:$1 70 | -------------------------------------------------------------------------------- /utils/docker/run-build-package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | # 3 | # Copyright 2016-2017, Intel Corporation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in 14 | # the documentation and/or other materials provided with the 15 | # distribution. 16 | # 17 | # * Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived 19 | # from this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | # 34 | # run-build-package.sh - is called inside a Docker container; 35 | # starts a build of vltrace 36 | # 37 | 38 | # Build all and run tests 39 | cd $WORKDIR 40 | ./utils/build-${PACKAGE_MANAGER}.sh 41 | -------------------------------------------------------------------------------- /utils/docker/run-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # 3 | # Copyright 2016-2017, Intel Corporation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in 14 | # the documentation and/or other materials provided with the 15 | # distribution. 16 | # 17 | # * Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived 19 | # from this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | # 34 | # run-build.sh - is called inside a Docker container, starts a build of vltrace 35 | # 36 | 37 | VLTRACE_MINIMUM_KERNEL_VERSION="4.7" 38 | 39 | source ../functions.sh 40 | 41 | ACTUAL_KERNEL_VERSION=$(uname -r) 42 | REQ_KV=$(format_kernel_version $VLTRACE_MINIMUM_KERNEL_VERSION) 43 | ACT_KV=$(format_kernel_version $ACTUAL_KERNEL_VERSION) 44 | 45 | echo 46 | echo 47 | 48 | # temporary workaround for Travis issue with mounting permissions 49 | ME=$(whoami) 50 | sudo chown -R $ME $WORKDIR 51 | 52 | # Build all and run tests 53 | cd $WORKDIR 54 | if [ -n "$COMPILER" ]; then 55 | export CC=$COMPILER 56 | fi 57 | 58 | for release in Debug Release; do 59 | 60 | mkdir build 61 | cd build 62 | 63 | echo "$ cmake .. -DCMAKE_INSTALL_PREFIX=/tmp/vltrace -DDEVELOPER_MODE=ON -DCMAKE_BUILD_TYPE=$release" 64 | cmake .. -DCMAKE_INSTALL_PREFIX=/tmp/vltrace -DDEVELOPER_MODE=ON -DCMAKE_BUILD_TYPE=$release 65 | echo 66 | 67 | echo "$ make" 68 | make 69 | echo 70 | 71 | # check if debugfs and tracefs are mounted 72 | set +e 73 | mount | grep -e "debugfs" >/dev/null 74 | if [ $? -ne 0 ]; then 75 | sudo mount -t debugfs debugfs /sys/kernel/debug 76 | if [ $? -eq 0 ]; then 77 | echo "Mounted: $(mount | grep -e 'debugfs')" 78 | echo 79 | else 80 | echo "Error: required mounted debugfs" >&2 && exit 1 81 | fi 82 | fi 83 | mount | grep -e "tracefs" >/dev/null 84 | if [ $? -ne 0 ]; then 85 | sudo mount -t tracefs tracefs /sys/kernel/debug/tracing 86 | if [ $? -eq 0 ]; then 87 | echo "Mounted: $(mount | grep -e 'tracefs')" 88 | echo 89 | else 90 | echo "Error: required mounted tracefs" >&2 && exit 1 91 | fi 92 | fi 93 | set -e 94 | 95 | if [ $ACT_KV -ge $REQ_KV ]; then 96 | echo "$ ctest -V" 97 | ctest -V 98 | elif [ $ACT_KV -ge 404 ]; then 99 | echo "Notice: running basic tests available for kernels >= 4.4" 100 | echo 101 | 102 | # create /run/lock directory, because it may not exist 103 | sudo mkdir -p /run/lock 104 | 105 | VLTRACE="ulimit -l 10240 && ulimit -n 10240 && src/vltrace -t --expr kp-all" 106 | DATE=$(which date) 107 | 108 | echo "$ sudo bash -c \"$VLTRACE $DATE\"" 109 | sudo bash -c "$VLTRACE -s 126 $DATE" 110 | else 111 | echo "Notice: skipping tests (too old kernel: "\ 112 | "required >= $VLTRACE_MINIMUM_KERNEL_VERSION, "\ 113 | "actual = $ACTUAL_KERNEL_VERSION)" 114 | fi 115 | 116 | echo 117 | echo "$ make install" 118 | make install 119 | echo 120 | 121 | echo "$ make uninstall" 122 | make uninstall 123 | echo 124 | 125 | cd .. 126 | rm -rf build 127 | done 128 | -------------------------------------------------------------------------------- /utils/docker/run-coverity.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | # 3 | # Copyright 2017, Intel Corporation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in 14 | # the documentation and/or other materials provided with the 15 | # distribution. 16 | # 17 | # * Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived 19 | # from this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | # 34 | # run-coverity.sh - runs the Coverity scan build 35 | # 36 | 37 | cd $WORKDIR 38 | 39 | mkdir build 40 | cd build 41 | cmake .. -DCMAKE_BUILD_TYPE=Debug 42 | 43 | export COVERITY_SCAN_PROJECT_NAME="pmem/vltrace" 44 | [[ "$TRAVIS_EVENT_TYPE" == "cron" ]] \ 45 | && export COVERITY_SCAN_BRANCH_PATTERN="master" \ 46 | || export COVERITY_SCAN_BRANCH_PATTERN="coverity_scan" 47 | export COVERITY_SCAN_BUILD_COMMAND="make" 48 | 49 | # Run the Coverity scan 50 | 51 | # XXX: Patch the Coverity script. 52 | # Recently, this script regularly exits with an error, even though 53 | # the build is successfully submitted. Probably because the status code 54 | # is missing in response, or it's not 201. 55 | # Changes: 56 | # 1) change the expected status code to 200 and 57 | # 2) print the full response string. 58 | # 59 | # This change should be reverted when the Coverity script is fixed. 60 | # 61 | # The previous version was: 62 | # curl -s https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh | bash 63 | 64 | wget https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh 65 | patch < ../utils/docker/0001-travis-fix-travisci_build_coverity_scan.sh.patch 66 | bash ./travisci_build_coverity_scan.sh 67 | 68 | # print out the Coverity log if it exists 69 | COVERITY_LOG=/vltrace/build/cov-int/scm_log.txt 70 | if [ -f $COVERITY_LOG ]; then 71 | echo "----------------------- COVERITY LOG -----------------------" 72 | cat $COVERITY_LOG 73 | fi 74 | -------------------------------------------------------------------------------- /utils/functions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # 3 | # Copyright 2017, Intel Corporation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in 14 | # the documentation and/or other materials provided with the 15 | # distribution. 16 | # 17 | # * Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived 19 | # from this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | # 34 | # utils/functions.sh - helper functions 35 | # 36 | 37 | # 38 | # format_kernel_version -- format kernel version, e.g.: v3.13 => 313 39 | # 40 | function format_kernel_version() 41 | { 42 | local VER=$1 43 | local N1=$(echo $VER | cut -d'.' -f1) 44 | local N2=$(echo $VER | cut -d'.' -f2) 45 | echo $((100 * N1 + N2)) 46 | } 47 | -------------------------------------------------------------------------------- /utils/md2man.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # 3 | # Copyright 2016-2017, Intel Corporation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in 14 | # the documentation and/or other materials provided with the 15 | # distribution. 16 | # 17 | # * Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived 19 | # from this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | # 35 | # md2man.sh -- convert markdown to groff man pages 36 | # 37 | # usage: md2man.sh file template outfile 38 | # 39 | # This script converts markdown file into groff man page using pandoc. 40 | # It performs some pre- and post-processing for better results: 41 | # - parse input file for YAML metadata block and read man page title, 42 | # section and version 43 | # - cut-off metadata block and license 44 | # - unindent code blocks 45 | # 46 | 47 | set -o pipefail 48 | 49 | filename=$1 50 | template=$2 51 | outfile=$3 52 | title=`sed -n 's/^title:\ *\([a-z-]*\).*$/\1/p' $filename` 53 | section=`sed -n 's/^title:.*(\([0-9]\)).*$/\1/p' $filename` 54 | version=`sed -n 's/^date:\ *\(.*\)$/\1/p' $filename` 55 | 56 | cat $filename | sed -n -e '/# NAME #/,$p' |\ 57 | pandoc -s -t man -o $outfile --template=$template \ 58 | -V title=$title -V section=$section \ 59 | -V description='"NVM Library"' -V version="$version" \ 60 | -V year=$(date +"%Y") |\ 61 | sed '/^\.IP/{ 62 | N 63 | /\n\.nf/{ 64 | s/IP/PP/ 65 | } 66 | }' 67 | -------------------------------------------------------------------------------- /utils/verify_syscalls.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2017, Intel Corporation 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in 14 | # the documentation and/or other materials provided with the 15 | # distribution. 16 | # 17 | # * Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived 19 | # from this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | # 35 | # utils/verify_syscalls.sh -- check if all syscalls are included in src/syscalls_numbers.h 36 | # 37 | 38 | SYSCALLS="src/syscalls_numbers.h" 39 | SC_IN_TABLE=$(mktemp) 40 | 41 | grep -e "EBPF_SYSCALL" src/ebpf_syscalls.c | grep -e "__NR_" | cut -d"(" -f2 | cut -d"," -f1 > $SC_IN_TABLE 42 | 43 | N1=$(cat $SC_IN_TABLE | wc -l) 44 | N2=$(cat $SC_IN_TABLE | sort | uniq | wc -l) 45 | 46 | [ $N1 -ne $N2 ] && echo "Error: doubled syscall number" && exit 1 47 | 48 | MISSING=0 49 | for sc in $(cat $SC_IN_TABLE); do 50 | grep -e "$sc" $SYSCALLS > /dev/null 51 | [ $? -ne 0 ] && echo "Syscall missing in $SYSCALLS: $sc" && MISSING=1 52 | done 53 | 54 | [ $MISSING -eq 0 ] && echo "Check passed (all syscalls are included in $SYSCALLS)" 55 | 56 | rm -f $SC_IN_TABLE 57 | --------------------------------------------------------------------------------