Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unsafe-mode and make default execution mode safe-mode
bpftrace as an tracing language should try to remain as safe as possible. That is to say, anything that can cause side effects on a system should be used with care. Similar to the concept of unsafe code in rust, we introduce an unsafe (`-u`, `--unsafe`) mode to bpftrace. Currently, `system()` is the only builtin function marked as unsafe. If/when more unsafe builtins get added, we can adjust the list accordingly. This patch also moves bpftrace to safe by default. Note: this is an API breaking change. Test Plan: ``` $ sudo ./build/src/bpftrace -e 'interval:s:5 { system("ls"); }' system() is an unsafe function being used in safe mode $ sudo ./build/src/bpftrace -e 'interval:s:1 { system("ls"); }' --unsafe Attaching 1 probe... build build-debug build-debug.sh build-docker-image.sh build-release build-release.sh build.sh CHANGELOG.md cmake CMakeLists.txt CONTRIBUTING-TOOLS.md docker docs images INSTALL.md LICENSE man README.md resources scripts src tests tools build build-debug build-debug.sh build-docker-image.sh build-release build-release.sh build.sh CHANGELOG.md cmake CMakeLists.txt CONTRIBUTING-TOOLS.md docker docs images INSTALL.md LICENSE man README.md resources scripts src tests tools ^C $ sudo ./build/src/bpftrace -e 'interval:s:5 { printf("ls\n"); }' Attaching 1 probe... ls ^C ```
- Loading branch information
Showing
10 changed files
with
74 additions
and
17 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
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