-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create copyright #8
Commits on May 21, 2020
-
Configuration menu - View commit details
-
Copy full SHA for 21f9751 - Browse repository at this point
Copy the full SHA 21f9751View commit details
Commits on Aug 7, 2020
-
NFC: Use a struct for usdt_probe_entry instead of a tuple
Non functional change. Tuples become hard to read after you get enough entries.
Configuration menu - View commit details
-
Copy full SHA for 2637923 - Browse repository at this point
Copy the full SHA 2637923View commit details -
NFC: Hoist inner probe codegen to helper function
We had two codepaths with almost duplicate code. This commit factors out the common code.
Configuration menu - View commit details
-
Copy full SHA for b42aafc - Browse repository at this point
Copy the full SHA b42aafcView commit details -
NFC: Remove unnecessary variable and const-ify loop variable
Non functional change. Just some small code cleanup.
Configuration menu - View commit details
-
Copy full SHA for 5d1606c - Browse repository at this point
Copy the full SHA 5d1606cView commit details -
Attach to duplicated USDT markers
This commit adds support for duplicated USDT markers. Duplication in this context means identical provider and name. See the later runtime test for an example of how this can occur. With this commit, bpftrace will generate separate programs for each duplicated marker. We need to generate separate programs because the location of the usdt arguments may not be the same in each call site. The later runtime test does not reproduce this behavior but I've observed this happening in production before.
Configuration menu - View commit details
-
Copy full SHA for b8c4eb6 - Browse repository at this point
Copy the full SHA b8c4eb6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 90bc9f6 - Browse repository at this point
Copy the full SHA 90bc9f6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8bf11d5 - Browse repository at this point
Copy the full SHA 8bf11d5View commit details -
Configuration menu - View commit details
-
Copy full SHA for e5504f5 - Browse repository at this point
Copy the full SHA e5504f5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1637343 - Browse repository at this point
Copy the full SHA 1637343View commit details -
This commit sets up all the scaffolding for actual implementation.
Configuration menu - View commit details
-
Copy full SHA for 82e36a8 - Browse repository at this point
Copy the full SHA 82e36a8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 140b9f0 - Browse repository at this point
Copy the full SHA 140b9f0View commit details -
This helper is used to determine if a memcpy is necessary or if a simple load will work.
Configuration menu - View commit details
-
Copy full SHA for 5c53aad - Browse repository at this point
Copy the full SHA 5c53aadView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8997514 - Browse repository at this point
Copy the full SHA 8997514View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4c1e649 - Browse repository at this point
Copy the full SHA 4c1e649View commit details -
Improve error message for non-tuple field access
Before: ``` stdin:1:9-16: ERROR: Can not access field '' on expression of type 'int64' BEGIN { (1+2).2 } ~~~~~~~ ``` After: ``` stdin:1:9-16: ERROR: Can not access index 2 on expression of type 'int64' BEGIN { (1+2).2 } ~~~~~~~ ```
Configuration menu - View commit details
-
Copy full SHA for 2a5ee22 - Browse repository at this point
Copy the full SHA 2a5ee22View commit details -
Configuration menu - View commit details
-
Copy full SHA for b37e7d6 - Browse repository at this point
Copy the full SHA b37e7d6View commit details -
This commit implements codegen for tuple creation and tuple indexing. Note that tuples are allocated on the stack because we can't really contain aggregate types in registers.
Configuration menu - View commit details
-
Copy full SHA for 468140e - Browse repository at this point
Copy the full SHA 468140eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6b3c52c - Browse repository at this point
Copy the full SHA 6b3c52cView commit details -
NFC: Refactor map_value_to_str
Have `map_value_to_str` take a SizedType instead of an `IMap` reference so we can later reuse this method to print tuple elements.
Configuration menu - View commit details
-
Copy full SHA for b7d0cb1 - Browse repository at this point
Copy the full SHA b7d0cb1View commit details -
Support for both text and json output
Configuration menu - View commit details
-
Copy full SHA for c172da4 - Browse repository at this point
Copy the full SHA c172da4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1da5ef3 - Browse repository at this point
Copy the full SHA 1da5ef3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 456712f - Browse repository at this point
Copy the full SHA 456712fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0c6b2be - Browse repository at this point
Copy the full SHA 0c6b2beView commit details -
tests: Fix embedded build tests
Forgot to add checks for <sys/sdt.h> headers.
Configuration menu - View commit details
-
Copy full SHA for 3867573 - Browse repository at this point
Copy the full SHA 3867573View commit details -
Configuration menu - View commit details
-
Copy full SHA for 364354d - Browse repository at this point
Copy the full SHA 364354dView commit details -
Arrays used the `size`, `elem_type` and `pointee_size` fields to store array type information. This is confusing as `pointee_size` indicates a pointer and also incomplete as an array of pointers cannot be stored without losing pointee size information. This fixes that by storing the complete type (`SizedType *`) instead of just a few fields.
Configuration menu - View commit details
-
Copy full SHA for cd9e9bf - Browse repository at this point
Copy the full SHA cd9e9bfView commit details -
Use "bpftrace" instead of '"bpftrace"'. Previously this causes build error if included header files use KBUILD_MODNAME.
Configuration menu - View commit details
-
Copy full SHA for 18d747f - Browse repository at this point
Copy the full SHA 18d747fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9d61934 - Browse repository at this point
Copy the full SHA 9d61934View commit details -
Split a long function and call functions only when necessary
Configuration menu - View commit details
-
Copy full SHA for 02cad8b - Browse repository at this point
Copy the full SHA 02cad8bView commit details -
BTF::c_def() now accepts enum name, such as "enum bpf_prog_type"
Configuration menu - View commit details
-
Copy full SHA for 6edfc26 - Browse repository at this point
Copy the full SHA 6edfc26View commit details -
Support listing struct/union/enum definitions using BTF
'-l' option now can take struct/union/enum name and dump its definition using BTF. For example: ``` % sudo ./src/bpftrace -l "enum bpf*" enum bpf_access_type enum bpf_adj_room_mode enum bpf_arg_type enum bpf_attach_type enum bpf_cgroup_storage_type [...] ``` and ``` % sudo ./src/bpftrace -lv "struct path" BTF: using data from /sys/kernel/btf/vmlinux struct path { struct vfsmount *mnt; struct dentry *dentry; }; ```
Configuration menu - View commit details
-
Copy full SHA for 7048fff - Browse repository at this point
Copy the full SHA 7048fffView commit details -
Configuration menu - View commit details
-
Copy full SHA for f54f36c - Browse repository at this point
Copy the full SHA f54f36cView commit details -
List only usdt and uprobe when a pid is given
Now `bpftrace -l -p 11234` only lists uprobe and usdt probes. `bpftrace -l "k:*" -p 11234` lists kprobe, which is the same as before.
Configuration menu - View commit details
-
Copy full SHA for c938117 - Browse repository at this point
Copy the full SHA c938117View commit details -
We haven't seen any OOM issues in a while so I suspect either our type fixes in bpftrace or upstream llvm changes have resolved the issue. This closes #1355.
Configuration menu - View commit details
-
Copy full SHA for bb6a7f7 - Browse repository at this point
Copy the full SHA bb6a7f7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 48979d4 - Browse repository at this point
Copy the full SHA 48979d4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2f88730 - Browse repository at this point
Copy the full SHA 2f88730View commit details -
Configuration menu - View commit details
-
Copy full SHA for aa729e6 - Browse repository at this point
Copy the full SHA aa729e6View commit details -
GetElementTy() returns a pointer so we need to deref. We don't expect GetElementTy() to return null b/c an array type should have the element type set.
Configuration menu - View commit details
-
Copy full SHA for 0fc46d5 - Browse repository at this point
Copy the full SHA 0fc46d5View commit details -
Add libbpf build info into --info
Helps with debugging things on the issue tracker.
Configuration menu - View commit details
-
Copy full SHA for 3e08a1d - Browse repository at this point
Copy the full SHA 3e08a1dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7f19a09 - Browse repository at this point
Copy the full SHA 7f19a09View commit details -
Not sure how it used to compile. Magic, I guess.
Configuration menu - View commit details
-
Copy full SHA for 5f2e4e3 - Browse repository at this point
Copy the full SHA 5f2e4e3View commit details -
Fix calling ntop on tracepoint args
Commit f05b4cd ("Introduce Type::ctx") introduced a `ctx` type for values that come from the bpf prog context. This subtly broke ntop() because ntop was not yet aware of Type::ctx. Fix this by relaxing semantic analyser check to include Type::ctx. Similarly relax for codegen.
Configuration menu - View commit details
-
Copy full SHA for 85b9bf5 - Browse repository at this point
Copy the full SHA 85b9bf5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8cbd4d9 - Browse repository at this point
Copy the full SHA 8cbd4d9View commit details -
CI: Fix IRC notification on build failure
I think to prevent job `irc` from being skipped you need to specify the dependency. See https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idneeds
Configuration menu - View commit details
-
Copy full SHA for e0eaa54 - Browse repository at this point
Copy the full SHA e0eaa54View commit details -
CI: Don't use TLS for irc notifications
I think TLS support from notify-irc is kinda broken.
Configuration menu - View commit details
-
Copy full SHA for 911ed78 - Browse repository at this point
Copy the full SHA 911ed78View commit details -
NFC: Move usdt helper routines out of utils
This commit just cut and pastes code around. It's nicer to have small, orthogonal modules.
Configuration menu - View commit details
-
Copy full SHA for 3155952 - Browse repository at this point
Copy the full SHA 3155952View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1d9b4ee - Browse repository at this point
Copy the full SHA 1d9b4eeView commit details -
NFC: Remove unused method and privatize internal methods
Keeping unused code around is asking for bit rot and bugs. Also hide some methods that are used for internal caching.
Configuration menu - View commit details
-
Copy full SHA for b090f93 - Browse repository at this point
Copy the full SHA b090f93View commit details -
USDTHelper caching logic was previously incorrect. It would mark the cache as loaded if any pid or path was processed. This would cause scripts that place usdt probes on different binaries to silently fail (because a default usdt_probe_entry would be returned). This commit breaks up the cache by pid or by path. Also switch usdt_provider_cache to an unordered_map b/c we don't need ordering and unordered data structures are faster. Next commit will get rid of the silent failure behavior.
Configuration menu - View commit details
-
Copy full SHA for 083895f - Browse repository at this point
Copy the full SHA 083895fView commit details -
usdt: Return optional in find()
It's good to have an error reporting mechanism. Returning a default value caused a lot of headache when trying to debug usdt lookup failures that were fixed in the previous commit.
Configuration menu - View commit details
-
Copy full SHA for ed07edd - Browse repository at this point
Copy the full SHA ed07eddView commit details -
Configuration menu - View commit details
-
Copy full SHA for ebc2a8a - Browse repository at this point
Copy the full SHA ebc2a8aView commit details -
Configuration menu - View commit details
-
Copy full SHA for ac515db - Browse repository at this point
Copy the full SHA ac515dbView commit details -
Improve missing usdt error message
Before: $ sudo ./build/src/bpftrace -e 'usdt:/usr/bin/python3:python:asdf { 1 }' terminate called after throwing an instance of 'std::runtime_error' what(): Failed to find usdt probe: usdt:/usr/bin/python3:python:asdf [1] 865191 abort sudo ./build/src/bpftrace -e After: $ sudo ./build/src/bpftrace -e 'usdt:/usr/bin/python3:python:asdf { 1 }' Failed to compile: Failed to find usdt probe: usdt:/usr/bin/python3:python:asdf
Configuration menu - View commit details
-
Copy full SHA for f91f4ba - Browse repository at this point
Copy the full SHA f91f4baView commit details -
Syscall generator, for issue#1334 (#1376)
This patch aims to replace the external tools which are used in runtime tests to trigger syscalls. It can generate sys_nanosleep, sys_open, sys_openat, sys_read and sys_execve. There are two reasons why it is important not to rely on external tools to trigger syscalls. The first is that some tools are not always available on some systems. And the other is that, the tools don't essentially work to generate certain syscalls. It would be more portable if we can have an program working to provide these syscalls.
Configuration menu - View commit details
-
Copy full SHA for f24a0d1 - Browse repository at this point
Copy the full SHA f24a0d1View commit details -
syncsnoop: trace sync_file_range2 when needed
Some architecture like ppc64, don't use sync_file_range but sync_file_range2. We can use a wildcard to get them both cover. Fixes the following error: $ /usr/share/bpftrace/tools/syncsnoop.bt Attaching 7 probes... open(/sys/kernel/debug/tracing/events/syscalls/sys_enter_sync_file_range/id): No such file or directory Error attaching probe: tracepoint:syscalls:sys_enter_sync_file_range
Configuration menu - View commit details
-
Copy full SHA for b97325d - Browse repository at this point
Copy the full SHA b97325dView commit details -
man: fix quotes in bpftrace manual
The bpftrace man page uses the escape \' to presumably print quote, but this troff escape is meant to print an acute accent. Beside making the man page look strange, it also prevents copy-pasting examples.
Configuration menu - View commit details
-
Copy full SHA for 9caf00b - Browse repository at this point
Copy the full SHA 9caf00bView commit details -
This prevents curl from spamming the terminal.
Configuration menu - View commit details
-
Copy full SHA for adb05a3 - Browse repository at this point
Copy the full SHA adb05a3View commit details -
Add time units for
interval
probe (#1377)This patch adds support for new time units us and hz for probe interval. Such changes make the time units of interval consistent with those of profile. This closes #1335 .
Configuration menu - View commit details
-
Copy full SHA for 19f1b49 - Browse repository at this point
Copy the full SHA 19f1b49View commit details -
usdt: Decrement usdt semaphore value during probe detach
Before, I think we were intentionally leaking the bcc usdt context so that usdt semaphore values would not go back to zero. Reason is that bcc_usdt_close() decrements usdt semaphore value. However, this causes issues if we don't eventually decrement the counter as the tracee will forever be on more expensive code paths. This commit defers semaphore decrement until probe is detached.
Configuration menu - View commit details
-
Copy full SHA for e40bcec - Browse repository at this point
Copy the full SHA e40bcecView commit details -
usdt: Use new usdt_addsem_probe* helpers
While debugging a high memory consumption issue, I noticed that a USDT::Context object can take ~10M per instance [0]. Along with the new --usdt-file-activation, bpftrace can potentially hold onto many dozens of USDT:Context instances, causing memory issues. This patch makes use of the new bcc usdt semaphore helpers ( iovisor/bcc#2953 ) to avoid holding onto USDT::Context instances for the lifetime of the tracing session. The new algorithm is: 1. create a USDT::Context 2. increment the semaphore count for the probe we care about 3. destroy the USDT::Context 4. repeat 1-3 for all probes we want to attach to 5. do our tracing 6. create a USDT::Context for the probe we care about 7. decrement the semaphore count 8. destroy the USDT::Context 9. repeat 6-8 for all the probes we're attached to This approach also has the benefit of 1 USDT::Context instance being alive at a time which can help keep memory high watermark low. [0]: Through gdb single stepping and /proc/pid/status. Exact process is not described here b/c memory usage probably varies based on tracee binary.
Configuration menu - View commit details
-
Copy full SHA for cb3a0d0 - Browse repository at this point
Copy the full SHA cb3a0d0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5f9058e - Browse repository at this point
Copy the full SHA 5f9058eView commit details -
Configuration menu - View commit details
-
Copy full SHA for dac0759 - Browse repository at this point
Copy the full SHA dac0759View commit details -
Only emit hist & lhist functions when they're used
These two functions add a lot of noise in the "before optimized" output, which is annoying when debugging.
Configuration menu - View commit details
-
Copy full SHA for 5290f41 - Browse repository at this point
Copy the full SHA 5290f41View commit details -
Configuration menu - View commit details
-
Copy full SHA for 562067b - Browse repository at this point
Copy the full SHA 562067bView commit details -
Remove registers that are not in struct pt_regs (x86-64)
cf. [x86-64 struct pt_regs](https://github.com/torvalds/linux/blob/master/arch/x86/include/uapi/asm/ptrace.h). Fixes the following errors. ``` % ./src/bpftrace -e 'k:f { printf("%d\n", reg("fs_base")); }' Attaching 1 probe... Error loading program: kprobe:f (try -v) ``` ``` % sudo ./src/bpftrace -e 'i:s:1 { printf("%d, %d\n", reg("fs_base"), ctx->sample_period); }' Attaching 1 probe... 1000000000, 1000000000 ^C ```
Configuration menu - View commit details
-
Copy full SHA for f3077b8 - Browse repository at this point
Copy the full SHA f3077b8View commit details -
Configuration menu - View commit details
-
Copy full SHA for b1c5018 - Browse repository at this point
Copy the full SHA b1c5018View commit details -
Display LLVM version when running CMake
Example: ``` % cmake .. [...] -- Found LLVM 10.0.1: /usr/lib/llvm-10/lib/cmake/llvm ```
Configuration menu - View commit details
-
Copy full SHA for d41692b - Browse repository at this point
Copy the full SHA d41692bView commit details -
Support non-map print() (#1381)
This implements non-map prints as described in #356. Note that non-map print()s are synchronous, meaning they do not work the same as map print()s. I think this is a pretty nice feature. Example: ``` # bpftrace -e 'BEGIN { $t = (1, "string"); print(123); print($t); print(comm) }' Attaching 1 probe... 123 (1, string) bpftrace ^C ``` We have a growing number of types in the type system so I may have missed a corner case somewhere. I think I got most of it right, though. This closes #356.
Configuration menu - View commit details
-
Copy full SHA for 8cce6bf - Browse repository at this point
Copy the full SHA 8cce6bfView commit details -
Configuration menu - View commit details
-
Copy full SHA for c71c84a - Browse repository at this point
Copy the full SHA c71c84aView commit details -
bpftrace: Fix cpid for Big endian
Issue: - cpid is written to higher 32 bits in BE - bpftrace -v -e 'BEGIN { printf("%d", cpid); }' Bytecode: 0: (bf) r6 = r1 1: (b7) r1 = 0 2: (7b) *(u64 *)(r10 -8) = r1 last_idx 2 first_idx 0 regs=2 stack=0 before 1: (b7) r1 = 0 3: (b7) r2 = 122768 4: (63) *(u32 *)(r10 -8) = r2 <----- 5: (7b) *(u64 *)(r10 -16) = r1 (...) Fix: - Promote it to 64 bits. Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Configuration menu - View commit details
-
Copy full SHA for b79dc61 - Browse repository at this point
Copy the full SHA b79dc61View commit details -
bpftrace: Fix buf builtin for Big endian
Issue: - Length is not interpreted properly in buf builtin for BE. - Format of buf: (length: 1 byte | buf: char *), Also see resolve_buf(). bpftrace -v -e 'kprobe:__sys_sendto { printf("hello: %r", buf((arg1), 4)); exit(); }' Bytecode: 0: (bf) r6 = r1 1: (b7) r1 = 0 2: (7b) *(u64 *)(r10 -24) = r1 last_idx 2 first_idx 0 regs=2 stack=0 before 1: (b7) r1 = 0 3: (7b) *(u64 *)(r10 -16) = r1 4: (b7) r1 = 4 5: (7b) *(u64 *)(r10 -8) = r1 <--- Intepreted size as 8 bytes 6: (79) r3 = *(u64 *)(r6 +104) 7: (bf) r1 = r10 8: (07) r1 += -7 9: (b7) r2 = 4 10: (85) call bpf_probe_read#4 last_idx 10 first_idx 0 regs=4 stack=0 before 9: (b7) r2 = 4 11: (61) r1 = *(u32 *)(r10 -8) <---- Here size + some bytes of buf is interpreted as zero for BE 12: (63) *(u32 *)(r10 -16) = r1 13: (71) r1 = *(u8 *)(r10 -4) 14: (73) *(u8 *)(r10 -12) = r1 15: (18) r7 = 0xffff9eac33c9f800 17: (85) call bpf_get_smp_processor_id#8 18: (bf) r4 = r10 19: (07) r4 += -24 20: (bf) r1 = r6 21: (bf) r2 = r7 22: (bf) r3 = r0 23: (b7) r5 = 16 24: (85) call bpf_perf_event_output (...) Fix: - Fix it by casting length of buf to 1 byte. Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Configuration menu - View commit details
-
Copy full SHA for 3431339 - Browse repository at this point
Copy the full SHA 3431339View commit details -
bpftrace: Fix ntop builtin for BE
Issue: - ./bpftrace -e '#include <linux/socket.h> BEGIN { @=ntop(AF_INET, 0x0100007f);}' @: ntop() got unsupported AF type: 0 Fix: - aftype size is 64 bits in codegen. Hence cast aftype to 64bit Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Configuration menu - View commit details
-
Copy full SHA for 1280bbc - Browse repository at this point
Copy the full SHA 1280bbcView commit details -
bpftrace: Fix unop deref for Big endian
Issue: - 32 bit unop deferences does not work for Big endian - Example: bpftrace -v -e 'uprobe:testprogs/uprobe_test:function1 { printf("0x%lx -- 0x%lx\n", *uaddr("GLOBAL_A"), *uaddr("GLOBAL_C")); }' fails. Fix: - Promote the expr in codegen to 64 bit. Integer types are already promoted to 64bits. Hence casting performed in get_arg_values() and codegen matches. Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Configuration menu - View commit details
-
Copy full SHA for 7f82c8d - Browse repository at this point
Copy the full SHA 7f82c8dView commit details -
bpftrace: Fix FieldAccess deref for Big endian
Issue: - 32 bit dereferences fails for Big endian - Example: bpftrace -v -e 'tracepoint:random:urandom_read { $i = args->got_bits; printf("bits: %d\n", $i); if ($i == 24) { exit() } }' - Example: bpftrace -v -e 'struct Foo { int a; char b[10]; } uprobe:testprogs/uprobe_test:function2 { $foo = (struct Foo *)arg0; $foo2 = (struct Foo *)arg1; printf("%d\n", $foo->a) }' fails Fix: - Promote Fieldaccess expr_ for these cases to 64 bit. Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Configuration menu - View commit details
-
Copy full SHA for 08e52f9 - Browse repository at this point
Copy the full SHA 08e52f9View commit details -
bpftrace: Fix Arrayaccess in Big endian
Issue: bpftrace -v -e 'struct MyStruct { int y[4]; } uprobe:./testprogs/array_access:test_struct { $s = (struct MyStruct *) arg0; $x = $s->y[0]; printf("Result: %d\n", $x); exit(); }' fails Bytecode: 0: (bf) r6 = r1 1: (79) r3 = *(u64 *)(r6 +40) 2: (bf) r1 = r10 3: (07) r1 += -16 4: (b7) r2 = 4 <--- Read four bytes (field.type.size is 4) 5: (85) call bpf_probe_read#112 last_idx 5 first_idx 0 regs=4 stack=0 before 4: (b7) r2 = 4 6: (b7) r1 = 0 7: (7b) *(u64 *)(r10 -8) = r1 last_idx 7 first_idx 0 regs=2 stack=0 before 6: (b7) r1 = 0 8: (61) r2 = *(u32 *)(r10 -16) <--- Reads the topmost bytes in BE. which is zero. 9: (63) *(u32 *)(r10 -8) = r2 (...) Fix: - Promote the ArrayAccess to 64 bit. Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Configuration menu - View commit details
-
Copy full SHA for d208b71 - Browse repository at this point
Copy the full SHA d208b71View commit details -
bpftrace: Fix tests intptrcast for s390x
Issue: The first sarg value should be 0xfed. Only five reg args for s390x. Fix: Fix this in intptrcast tests Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Configuration menu - View commit details
-
Copy full SHA for d9418b3 - Browse repository at this point
Copy the full SHA d9418b3View commit details -
Enable ternary operators to evaluate builtin calls
Currently, the ternary operator can only works to evaluate strings and integers. This tries to include builtin calls: ``` # bpftrace -e 'BEGIN { pid > 10000 ? printf("%s %d\n", comm, pid) : exit(); }' ``` Although if-else statement can serve the purpose, using ternary can be more concise especially when users run bpftrace in comand line. In bpftrace, builtin calls have `none` types so it makes sense for the ternary operator to support them. Resolves #1333.
Configuration menu - View commit details
-
Copy full SHA for 94f4aa8 - Browse repository at this point
Copy the full SHA 94f4aa8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6794c9b - Browse repository at this point
Copy the full SHA 6794c9bView commit details -
Use llvm-as to validate generated IR
llvm-as emits warnings when the IR has typing issues: ``` error: '%2' defined with type 'i8*' call void @llvm.lifetime.start.p0i8(i64 -1, i64* nonnull %2) ``` We can use this to validate that the IR we generate is valid and avoid regressions (like the OOM error). As the codegen reference output is LLVM 7 based this is currently only enabled for LLVM 7. Testing the version specific things is not necessary as we don't have any version specific logic in the codegen. The tests that do not pass are ignored. Eventually we shouldn't have to ignore any of them. Adding new entries to this list should be avoided, unless the test overlaps with something currently on the list. builtin_func_1.ll builtin_func_uprobe_2.ll call_buf_implicit_size.ll call_buf_size_literal.ll call_buf_size_nonliteral.ll call_print_non_map.ll call_printf.ll if_else_printf.ll if_nested_printf.ll if_printf.ll Related to #1091
Configuration menu - View commit details
-
Copy full SHA for 4204215 - Browse repository at this point
Copy the full SHA 4204215View commit details -
NFC: Use higher level find_wildcard_matches API
Does the same thing and less code to maintain.
Configuration menu - View commit details
-
Copy full SHA for 8e250c0 - Browse repository at this point
Copy the full SHA 8e250c0View commit details -
NFC: Hide lower level
find_wildcard_matches
helperThis helper makes a lot of assumptions about the input and probably shouldn't be a public API if we can help it. Also rename the lower level helper b/c it doesn't look like function overloading works correctly with class member and non-class member.
Configuration menu - View commit details
-
Copy full SHA for d6b30a9 - Browse repository at this point
Copy the full SHA d6b30a9View commit details -
Ignore trailing kernel module annotation
Before, `find_wildcard_matches` would choke on lines in available_filter_functions like: ehci_disable_ASE [ehci_hcd] This patch has k[ret]probes ignore the module annotation. This closes #1036 .
Configuration menu - View commit details
-
Copy full SHA for 9ecdf82 - Browse repository at this point
Copy the full SHA 9ecdf82View commit details -
Configuration menu - View commit details
-
Copy full SHA for 510b3aa - Browse repository at this point
Copy the full SHA 510b3aaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 40615f6 - Browse repository at this point
Copy the full SHA 40615f6View commit details -
Enable printf, cat, system to have more args
This enables printf, cat and system to have more than 7 arguments. It can be more user-friendly to allow any reasonable number of arguments for these builtin calls which use formatted strings. Resolves #1336.
Configuration menu - View commit details
-
Copy full SHA for 891b0a8 - Browse repository at this point
Copy the full SHA 891b0a8View commit details -
Remove redundant codes in print_maps
print_map will do the same type checkings again.
Configuration menu - View commit details
-
Copy full SHA for 3aa563d - Browse repository at this point
Copy the full SHA 3aa563dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 46830a3 - Browse repository at this point
Copy the full SHA 46830a3View commit details -
Currently
printf
does not allow string format specifiers to be dire……ctly followed by any alphabetic characters since it would take all the following letters as part of the specifiers. As an example: ``` bpftrace -e 'BEGIN { @start = nsecs; } i:s:1 { printf("Elapsed: %ds\n", (nsecs - @start)/1000000000); }' stdin:1:35-95: ERROR: printf: Unknown format string token: %ds BEGIN { @start = nsecs; } i:s:1 { printf("Elapsed: %ds\n", (nsecs - @start)/1000000000); } ``` I think it's good to fix it since I could not think of any obvious downsides. This works to address this issue by changing the way `printf` parse the format strings. It would also affect `cat` and `system` as well. With this PR: ``` bpftrace -e 'BEGIN { @start = nsecs; } i:s:1 { printf("Elapsed: %ds\n", (nsecs - @start)/1000000000); }' Attaching 2 probes... Elapsed: 1s Elapsed: 2s Elapsed: 3s Elapsed: 4s Elapsed: 5s ^C @start: 2976003477708 ```
Configuration menu - View commit details
-
Copy full SHA for b563c97 - Browse repository at this point
Copy the full SHA b563c97View commit details -
changelog: pr was merged after 0.11 release
This PR has been merged right after the 0.11 release so it shouldn't be in the 0.11 release.
Configuration menu - View commit details
-
Copy full SHA for 2dd186c - Browse repository at this point
Copy the full SHA 2dd186cView commit details -
Configuration menu - View commit details
-
Copy full SHA for fef4b4a - Browse repository at this point
Copy the full SHA fef4b4aView commit details -
Mark btf as depending on libbpf in --info
The implicit dependency is confusing for users who somehow have a bpftrace built without libbpf. This closes #1422 .
Configuration menu - View commit details
-
Copy full SHA for 7aea83c - Browse repository at this point
Copy the full SHA 7aea83cView commit details -
Generate vfs_read for some runtime tests
Some runtime tests in builtin and probe expect the system to generate vfs_read events for them, which in some cases might cause timeout error. This commit explicitly generates the event for the tests with testprog/syscall.
Configuration menu - View commit details
-
Copy full SHA for 9f374bf - Browse repository at this point
Copy the full SHA 9f374bfView commit details -
Configuration menu - View commit details
-
Copy full SHA for d076477 - Browse repository at this point
Copy the full SHA d076477View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2669342 - Browse repository at this point
Copy the full SHA 2669342View commit details -
Add runtime support for strftime()
This introduces a new builtin function `strftime`. This function makes it possible to print the current time with `printf`: ``` bpftrace -e 'i:s:1 { printf("%s\n", strftime("%H:%M:%S", nsecs)); }' ``` Although `time` can print current time on its own, printing timestamp with `printf` can produce more concise and more readable output. Resolves #1337 .
Configuration menu - View commit details
-
Copy full SHA for 737abe7 - Browse repository at this point
Copy the full SHA 737abe7View commit details -
Configuration menu - View commit details
-
Copy full SHA for f96cf17 - Browse repository at this point
Copy the full SHA f96cf17View commit details -
tests: do not run optimize pass on codegen tests
Currently we test codegen after optimization. this has 2 issues: We don't actually test the code we generate, we test what LLVM does to it. This makes harder to relate a change in the codegen to a change in the LLVM output. We have to maintain more version specific codegen files as we cannot rewrite big changes the optimizer has done. Fixes: #1368
Configuration menu - View commit details
-
Copy full SHA for ae93bb1 - Browse repository at this point
Copy the full SHA ae93bb1View commit details -
codegen: fix argument reordering issue
When building with clang a few codegen tests fail due to argument reordering. This normally doesn't show up as the optimizer step fixes that, but as we're now testing before optimization it get's in our way. This means that a "complex" call like: ``` b_.CreateUDiv(b_.CreateSub(b_.CreateLoad(value_alloc), b_.CreateLoad(min_alloc)), b_.CreateLoad(step_alloc)) ``` Will have to be split into: ``` Value *step = b_.CreateLoad(step_alloc); Value *min = b_.CreateLoad(min_alloc); Value *val = b_.CreateLoad(value_alloc); Value *div3 = b_.CreateUDiv(b_.CreateSub(val, min), step); ``` To ensure that all arguments are always evaluated in the same order.
Configuration menu - View commit details
-
Copy full SHA for 8d83996 - Browse repository at this point
Copy the full SHA 8d83996View commit details -
tests: Avoid validating broken codegen output
The move to unoptimized codegen uncovered more type issues that we have to fix. Fixing those now will blow up this PR even more and make it hard to review so lets just ignore them for now.
Configuration menu - View commit details
-
Copy full SHA for 5f28f1a - Browse repository at this point
Copy the full SHA 5f28f1aView commit details -
codegen: Add helper for managing expr_deleter_
This helps make it harder to forget to run expr_deleter_. In general this is also better because the piece of code most likely to know if it's OK to end the lifetime of an alloca is where the alloca was created.
Configuration menu - View commit details
-
Copy full SHA for b7fbe54 - Browse repository at this point
Copy the full SHA b7fbe54View commit details -
codegen: Use new accept() helper
This commit updates all sites where manual CreateLifetimeEnd(expr_) was being called.
Configuration menu - View commit details
-
Copy full SHA for 4a34d07 - Browse repository at this point
Copy the full SHA 4a34d07View commit details -
codegen: End CreateAllocaBpf() lifetimes
This commit cleans up the unmatched CreateAllocaBpf()s due to the alloca'd values being returned through `expr_`.
Configuration menu - View commit details
-
Copy full SHA for 17541e5 - Browse repository at this point
Copy the full SHA 17541e5View commit details -
codegen: Update all callsites to use safer accept()
This commit also includes some lifetime annotation changes. Overall the lifetimes should be more accurate.
Configuration menu - View commit details
-
Copy full SHA for e33ef05 - Browse repository at this point
Copy the full SHA e33ef05View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4932465 - Browse repository at this point
Copy the full SHA 4932465View commit details -
Add feature specific runtime testcase support
This adds `REQUIRES_FEATURE` field for a runtime test script. This allows a feature specific testcase without manually writing `REQUIRES bpftrace --info | grep xxxx`. The current supported features are "loop" and "btf".
Configuration menu - View commit details
-
Copy full SHA for 622ea0f - Browse repository at this point
Copy the full SHA 622ea0fView commit details -
Rename FieldAnalyser::builtin_args_ to FieldAnalyser::has_builtin_args_
More bools are comming so it's convenient they follow same name pattern. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Configuration menu - View commit details
-
Copy full SHA for 50dbd18 - Browse repository at this point
Copy the full SHA 50dbd18View commit details -
Add error display support to FieldAnalyser class
Adding error and warning functions to emit error with location and allow to fail from FieldAnalyser class with some nice output. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Configuration menu - View commit details
-
Copy full SHA for ba05558 - Browse repository at this point
Copy the full SHA ba05558View commit details -
Add kfunc argument checks for multiple attach points
Currently we allow to attach multiple attach points for a single probe code which uses args->X. If arguments of all the functions are not the same, bad things will happen ;-) Adding the arguments check for multiple attach points and failing only if arguments are used in the code. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Configuration menu - View commit details
-
Copy full SHA for 15fb4c1 - Browse repository at this point
Copy the full SHA 15fb4c1View commit details -
Add test for multiple kfunc attachpoints
Adding automated tests for multiple kfunc attachpoints. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Configuration menu - View commit details
-
Copy full SHA for 5439d7c - Browse repository at this point
Copy the full SHA 5439d7cView commit details -
Factor BTF::get_kfuncs from BTF::display_funcs
New get_funcs function will be used in wildcard matching later in following changes. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Configuration menu - View commit details
-
Copy full SHA for 5a801d2 - Browse repository at this point
Copy the full SHA 5a801d2View commit details -
Add wildcard support for kfunc probe types
Adding wildcard support for kfunc probe types. It's now possible to use following probes: # bpftrace -e 'kfunc:ksys_* { @[comm, probe] = kstack; }' Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Configuration menu - View commit details
-
Copy full SHA for db71026 - Browse repository at this point
Copy the full SHA db71026View commit details -
codegen: add option to emit elf file
While debugging it is sometimes useful to see the BPF created by LLVM. Currently the only way to do that is to use bpftool to dump the program after it has been loaded into the kernel, which is quite a lot of hassle. This adds a simple pass that emits an elf file. This pass can (currently) only be called after the optimization pass as that does some setup. To prevent some programmer errors I've added some assert() to make sure all passes are called in the correct order. LLVM 6 doesn't support the raw_fd_ostream API so that uses the svector based one, that part is basically a copy of `tools/perf/util/c++/clang.cpp` in the linux kernel. This new flag hasn't been documented as I don't want to expose it to users.
Configuration menu - View commit details
-
Copy full SHA for e9d8685 - Browse repository at this point
Copy the full SHA e9d8685View commit details -
testing: add script to compare BPF between versions
This uses the ELF output option to compare the generated BPF between two versions.
Configuration menu - View commit details
-
Copy full SHA for c736335 - Browse repository at this point
Copy the full SHA c736335View commit details -
Enable top&div args for printing avg() maps
The top and div arguments of `print()` currently does not work for avg maps because it wasn't implemented. It makes sense to have them supported. Resolves #1385.
Configuration menu - View commit details
-
Copy full SHA for 5555d5b - Browse repository at this point
Copy the full SHA 5555d5bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 837b6b9 - Browse repository at this point
Copy the full SHA 837b6b9View commit details -
codegen: avoid accidental checking of LLVM bytecode
These get created when running `llvm-as`
Configuration menu - View commit details
-
Copy full SHA for 3fc5970 - Browse repository at this point
Copy the full SHA 3fc5970View commit details -
codegen: cast buf len to correct size before store
A store needs both types to be of the same size so we have to cast it to match the size of the struct element.
Configuration menu - View commit details
-
Copy full SHA for 84d81b1 - Browse repository at this point
Copy the full SHA 84d81b1View commit details -
codegen: resize probe_read size arg
The function expect an i32 so lets give it that. As shrinking an i64 to i32 might potentially be an issue a check was added for it, these should be fix in the codegen.
Configuration menu - View commit details
-
Copy full SHA for 569e45f - Browse repository at this point
Copy the full SHA 569e45fView commit details -
codegen: ensure equal types for store in print()
As we know that the array is properly sized it is safe to cast types. This adds an additional codegen test too that uses the `memcpy` code path.
Configuration menu - View commit details
-
Copy full SHA for 2339a71 - Browse repository at this point
Copy the full SHA 2339a71View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5333695 - Browse repository at this point
Copy the full SHA 5333695View commit details -
Add a semantic warning for printing stats maps with top/div args
Both `top` and `div` are ambiguous when printing stats maps. `top` does not specify which statistic it's based on and it would cause confusion to define a default behavior for it. As for `div`, it would also somehow be strange: if use `div` on all three statistics, then the output does not have avg * count == sum anymore; if only on sum and avg, it might be misleading.
Configuration menu - View commit details
-
Copy full SHA for 8286878 - Browse repository at this point
Copy the full SHA 8286878View commit details -
Configuration menu - View commit details
-
Copy full SHA for 98a5e99 - Browse repository at this point
Copy the full SHA 98a5e99View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7eabf26 - Browse repository at this point
Copy the full SHA 7eabf26View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0e4129a - Browse repository at this point
Copy the full SHA 0e4129aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 442cd64 - Browse repository at this point
Copy the full SHA 442cd64View commit details -
Configuration menu - View commit details
-
Copy full SHA for 280688c - Browse repository at this point
Copy the full SHA 280688cView commit details -
Ensure symbols are exported for bpftrace executable
bpftrace executable needs to lookup `BEGIN_trigger` and `END_trigger` symbols. Since the bump of the minimal versin of CMake in 1a1a4a9, these symbols are stripped from bpftrace: the executable is built without the `-rdynamic` option and the symbol is not present anymore (tested with GCC 10). To restore this compile option, we can instruct CMake to export symbols for bpftrace executable. Also, see #954.
Configuration menu - View commit details
-
Copy full SHA for 0b1c22c - Browse repository at this point
Copy the full SHA 0b1c22cView commit details -
Use `err_` instead of `out_` so that we can check whether errors occur later by checking the length of `err_`. Also fix tests to prevent an error message from being printed to stderr.
Configuration menu - View commit details
-
Copy full SHA for e3a2362 - Browse repository at this point
Copy the full SHA e3a2362View commit details -
Fix: print() no output when used on hist() maps with large top args
Currently, using `print` with a large `top` arg (any number larger than number of map keys) on `hist` maps would result in a negative overflow bug, which will make `print` fail to produce any output. This patch resolves this issue.
Configuration menu - View commit details
-
Copy full SHA for 41ad2e8 - Browse repository at this point
Copy the full SHA 41ad2e8View commit details -
btf: tracepoint: Prefer BTF data if available
Before, if a tracepoint argument was accessed, bpftrace would prefer using headers instead of BTF. This causes some friction for users/hosts that don't have headers installed. They would have to pass in --btf to override the default headers behavior. This commit makes BTF the default if it's available. Now, users don't need to pass in --btf.
Configuration menu - View commit details
-
Copy full SHA for afc80bc - Browse repository at this point
Copy the full SHA afc80bcView commit details -
Fix PR #1416: unsigned int overflow bug and unstable tests
The merged PR which enables `top` and `div` args of `print` for `avg` maps has two issues that need addressing: 1. It came with subtractions of unsigned integers which can easily cause negative overflows. 2. The runtime tests it came with are somehow unstable and fails randomly. This patch brings more straightforward tests.
Configuration menu - View commit details
-
Copy full SHA for 9b0dcce - Browse repository at this point
Copy the full SHA 9b0dcceView commit details -
Revert "Ensure symbols are exported for bpftrace executable"
This reverts commit 38f1c69. It was breaking the embedded builds.
Configuration menu - View commit details
-
Copy full SHA for d56909e - Browse repository at this point
Copy the full SHA d56909eView commit details -
The embedded build / test takes a while to run but it's probably better than having master randomly break. Every time that breaks it takes at least a couple days to get a fix up.
Configuration menu - View commit details
-
Copy full SHA for 83a9619 - Browse repository at this point
Copy the full SHA 83a9619View commit details -
This introduces a stream-style logging infrastructure. It supports the basic functionalities for now and can be extended with future PRs. There are several benefits for including it in bpftrace: - It would be more convinient for developers to keep track of inner status of bpftrace and debug. - It can help to print consistent error/warning messages. - Future work will offer users the option to toggle on/off certain messages. Related to #1411
Configuration menu - View commit details
-
Copy full SHA for c9d24c6 - Browse repository at this point
Copy the full SHA c9d24c6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 468bcf3 - Browse repository at this point
Copy the full SHA 468bcf3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 47aa1ea - Browse repository at this point
Copy the full SHA 47aa1eaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4bf92f5 - Browse repository at this point
Copy the full SHA 4bf92f5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0885b81 - Browse repository at this point
Copy the full SHA 0885b81View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9273666 - Browse repository at this point
Copy the full SHA 9273666View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2d93cf6 - Browse repository at this point
Copy the full SHA 2d93cf6View commit details -
Stop runtime tests if the parser error occurs
Currently, the runtime tests will continue even if there is a parser error. Fix this by calling exit(1) if the parser error occurs.
Configuration menu - View commit details
-
Copy full SHA for af085fd - Browse repository at this point
Copy the full SHA af085fdView commit details -
Filter out non-traceable kfunc symbols
The list of available kfunc symbols is taken from the BTF data, however, it should not include non-traceable functions (those that are not listed in /sys/kernel/debug/tracing/available_filter_functions) as tracing of these may fail or be unstable. These are usually inlined functions or functions marked as "notrace". Resolves iovisor#1366.
Configuration menu - View commit details
-
Copy full SHA for 659a2a5 - Browse repository at this point
Copy the full SHA 659a2a5View commit details -
Filter out kfunc symbols having too many params
Currently, when creating a BPF trampoline (in function arch_prepare_bpf_trampoline), kernel only supports saving arguments of the probed function that are passed in registers (at least for x86, which is now the only architecture that has BPF trampolines). If the function has more arguments, it is not attached, causing bpftrace to fail. This patch disables tracing of functions that have more arguments than the number passed in registers for the current architecture.
Configuration menu - View commit details
-
Copy full SHA for b4acbb3 - Browse repository at this point
Copy the full SHA b4acbb3View commit details -
Improve error messages for kfunc
Most of the errors for kfunc (non-existing or non-traceable function etc.) occur when resolving kfunc arguments. Instead of printing a generic "resolving kfunc arguments failed", print a better message that could help the user to identify the problem.
Configuration menu - View commit details
-
Copy full SHA for 7f6d596 - Browse repository at this point
Copy the full SHA 7f6d596View commit details -
We regressed on array indexing because the CreateArray() helper forgot to set pointee_size. This caused all array indexes to silently index to index 0.
Configuration menu - View commit details
-
Copy full SHA for beaa7cd - Browse repository at this point
Copy the full SHA beaa7cdView commit details