forked from bpftrace/bpftrace
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent banned kernel funcs from all probes
Previously we only banned kretprobes from using banned kernel functions but a bpftrace script at Meta saw a crash from utilizing one of these functions in kfunc/kretfunc. This changes prevents any probe from attaching to one of these functions. Issue: bpftrace#3144
- Loading branch information
Jordan Rome
committed
May 21, 2024
1 parent
4c8b262
commit 6889844
Showing
2 changed files
with
36 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,45 @@ | ||
# Check the list of banned functions | ||
|
||
NAME kretprobe:_raw_spin_lock is banned | ||
PROG kretprobe:_raw_spin_lock { exit(); } | ||
EXPECT ERROR: kretprobe:_raw_spin_lock can't be used as it might lock up your system. | ||
EXPECT ERROR: kernel function: _raw_spin_lock can't be used as it might lock up your system. | ||
TIMEOUT 1 | ||
WILL_FAIL | ||
|
||
NAME kretprobe:queued_spin_lock_slowpath is banned | ||
PROG kretprobe:queued_spin_lock_slowpath { exit(); } | ||
EXPECT ERROR: kretprobe:queued_spin_lock_slowpath can't be used as it might lock up your system. | ||
EXPECT ERROR: kernel function: queued_spin_lock_slowpath can't be used as it might lock up your system. | ||
TIMEOUT 1 | ||
WILL_FAIL | ||
|
||
NAME kretprobe:_raw_spin_unlock_irqrestore is banned | ||
PROG kretprobe:_raw_spin_unlock_irqrestore { exit(); } | ||
EXPECT ERROR: kretprobe:_raw_spin_unlock_irqrestore can't be used as it might lock up your system. | ||
EXPECT ERROR: kernel function: _raw_spin_unlock_irqrestore can't be used as it might lock up your system. | ||
TIMEOUT 1 | ||
WILL_FAIL | ||
|
||
NAME kretprobe:_raw_spin_lock_irqsave is banned | ||
PROG kretprobe:_raw_spin_lock_irqsave { exit(); } | ||
EXPECT ERROR: kretprobe:_raw_spin_lock_irqsave can't be used as it might lock up your system. | ||
EXPECT ERROR: kernel function: _raw_spin_lock_irqsave can't be used as it might lock up your system. | ||
TIMEOUT 1 | ||
WILL_FAIL | ||
|
||
# Check the list of banned probes for those functions | ||
|
||
NAME kprobe:_raw_spin_lock is banned | ||
PROG kprobe:_raw_spin_lock { exit(); } | ||
EXPECT ERROR: kernel function: _raw_spin_lock can't be used as it might lock up your system. | ||
TIMEOUT 1 | ||
WILL_FAIL | ||
|
||
NAME kfunc:queued_spin_lock_slowpath is banned | ||
PROG kfunc:queued_spin_lock_slowpath { exit(); } | ||
EXPECT ERROR: kernel function: queued_spin_lock_slowpath can't be used as it might lock up your system. | ||
TIMEOUT 1 | ||
WILL_FAIL | ||
|
||
NAME kretfunc:_raw_spin_unlock_irqrestore is banned | ||
PROG kretfunc:_raw_spin_unlock_irqrestore { exit(); } | ||
EXPECT ERROR: kernel function: _raw_spin_unlock_irqrestore can't be used as it might lock up your system. | ||
TIMEOUT 1 | ||
WILL_FAIL |