forked from bpftrace/bpftrace
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Previously, all strings needed to be stored on the stack. Given that BPF has a 512B stack limit, this put serious limits on strings. In practice, it was limited to about 200B. This commit raises the limit much higher to around 1024. The new limit we hit is from the LLVM memset() builtin. It only supports up to 1K. To go above this, we need to create our own memset() routine in BPF. This is quite easy to do and will be attempted in a later commit. The way big strings work is by assigning each str() call in the script a unique ID. Then we create a percpu array map such that for each CPU, there is a percpu entry that can accomodate each str() callsite. This makes it so scripts can keep as many strings "on the stack" as they'd like, with the tradeoff being the amount of memory we need to preallocate. As long as the kernel never allows BPF programs to nest (eg execute prog A while prog A is already on the call stack), this approach is robust to self-corruption. This closes bpftrace#305.
- Loading branch information
Showing
9 changed files
with
59 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters