testsuite/systemtap.examples/security-band-aids/cve-2013-2094.stp
raw| 1 | |
| 2 | %{ |
| 3 | #include <linux/perf_event.h> |
| 4 | %} |
| 5 | |
| 6 | function sanitize_config:long (event:long) %{ |
| 7 | struct perf_event *event; |
| 8 | |
| 9 | #if STAP_COMPAT_VERSION >= STAP_VERSION(1,8) |
| 10 | event = (struct perf_event *) (unsigned long) STAP_ARG_event; |
| 11 | #else |
| 12 | event = (struct perf_event *) (unsigned long) THIS->event; |
| 13 | #endif |
| 14 | |
| 15 | event->attr.config &= INT_MAX; |
| 16 | %} |
| 17 | |
| 18 | probe kernel.function("perf_swevent_init").call { |
| 19 | sanitize_config($event); |
| 20 | } |