Commit cbfce9b
authored
fix(dropreason): Check ftrace_enabled required for fexit programs (#1926)
# Description
Adds a check for `/proc/sys/kernel/ftrace_enabled` before deciding to
use fexit eBPF programs. When ftrace is disabled, the plugin will fall
back to kprobes.
## Changes
- Added `IsFtraceEnabled()` helper function in
`pkg/plugin/common/common_linux.go` that reads
`/proc/sys/kernel/ftrace_enabled`
- Updated `getEbpfPayload()` to check ftrace status and log it
- Modified `resolvePayload()` to accept `ftraceEnabled` parameter and
only use fexit programs when ftrace is enabled (in addition to existing
kernel version/architecture requirements)
- Updated documentation to clarify that fexit programs require ftrace to
be enabled
## Behavior
- **Before**: Plugin would attempt to use fexit programs based only on
kernel version and architecture, potentially failing when ftrace is
disabled
- **After**: Plugin checks ftrace status and gracefully falls back to
kprobes when ftrace is disabled
## Related Issue
If this pull request is related to any issue, please mention it here.
Additionally, make sure that the issue is assigned to you before
submitting this pull request.
## Checklist
- [x] I have read the [contributing
documentation](https://retina.sh/docs/Contributing/overview).
- [x] I signed and signed-off the commits (`git commit -S -s ...`). See
[this
documentation](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification)
on signing commits.
- [x] I have correctly attributed the author(s) of the code.
- [x] I have tested the changes locally.
- [x] I have followed the project's style guidelines.
- [x] I have updated the documentation, if necessary.
- [x] I have added tests, if applicable.
## Screenshots (if applicable) or Testing Completed
Verified on kernel 6.6.0 with both ftrace enabled and disabled
scenarios. When ftrace is enabled fexit programs are used. When ftrace
is disabled, the plugin uses kprobes/kretprobes.
<img width="1739" height="677" alt="image"
src="https://github.com/user-attachments/assets/39ae49f2-7600-4ab0-aa68-8abd0c6d0472"
/>
<img width="1743" height="806" alt="image"
src="https://github.com/user-attachments/assets/25aef3cf-fc27-4dae-8328-4d4e50d43ca9"
/>
## Additional Notes
Add any additional notes or context about the pull request here.
---
Please refer to the [CONTRIBUTING.md](../CONTRIBUTING.md) file for more
information on how to contribute to this project.1 parent 34e8f5f commit cbfce9b
File tree
4 files changed
+55
-10
lines changed- pkg/plugin
- common
- dropreason
- test/plugin/dropreason
4 files changed
+55
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
| 487 | + | |
487 | 488 | | |
488 | 489 | | |
489 | 490 | | |
| |||
493 | 494 | | |
494 | 495 | | |
495 | 496 | | |
| 497 | + | |
496 | 498 | | |
497 | 499 | | |
498 | 500 | | |
| |||
502 | 504 | | |
503 | 505 | | |
504 | 506 | | |
| 507 | + | |
505 | 508 | | |
506 | 509 | | |
507 | 510 | | |
| |||
511 | 514 | | |
512 | 515 | | |
513 | 516 | | |
| 517 | + | |
514 | 518 | | |
515 | 519 | | |
516 | 520 | | |
| |||
520 | 524 | | |
521 | 525 | | |
522 | 526 | | |
| 527 | + | |
523 | 528 | | |
524 | 529 | | |
525 | 530 | | |
| |||
529 | 534 | | |
530 | 535 | | |
531 | 536 | | |
| 537 | + | |
532 | 538 | | |
533 | 539 | | |
534 | 540 | | |
| |||
538 | 544 | | |
539 | 545 | | |
540 | 546 | | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
541 | 568 | | |
542 | 569 | | |
543 | 570 | | |
544 | 571 | | |
545 | 572 | | |
546 | 573 | | |
547 | 574 | | |
548 | | - | |
| 575 | + | |
549 | 576 | | |
550 | 577 | | |
551 | 578 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| 55 | + | |
| 56 | + | |
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
| |||
74 | 77 | | |
75 | 78 | | |
76 | 79 | | |
77 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
78 | 85 | | |
79 | 86 | | |
80 | 87 | | |
81 | | - | |
| 88 | + | |
82 | 89 | | |
83 | 90 | | |
84 | 91 | | |
85 | | - | |
86 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
87 | 95 | | |
88 | 96 | | |
89 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
0 commit comments