-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
interface's based hooks don't allow more than one function per intf per direction #338
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, but I think we have the same potential problem for all program types. E.g., you couldn't attach two different kprobe programs to the same function. You might not need to do this right now, but it's a possible use case, so I think we should make the same change for the appProgramId for all types.
I don't think we can attach the same kprobe/uprobe multiple times ? |
a9ef581
to
b0eb74b
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #338 +/- ##
=======================================
Coverage 27.64% 27.64%
=======================================
Files 87 87
Lines 7499 7499
=======================================
Hits 2073 2073
Misses 5226 5226
Partials 200 200
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -78,7 +78,7 @@ func (r *BpfApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Reque | |||
for j, p := range a.Spec.Programs { | |||
switch p.Type { | |||
case bpfmaniov1alpha1.ProgTypeFentry: | |||
appProgramId := fmt.Sprintf("%s-%s", strings.ToLower(string(p.Type)), sanitize(p.Fentry.FunctionName)) | |||
appProgramId := fmt.Sprintf("%s-%s", strings.ToLower(string(p.Type)), p.Fentry.BpfFunctionName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can make this same change to the types that don't support a list of attach points. Or, if we do, we should still include the attach point itself, because if a user wants to attach the same bpf program to multiple Fentry attach points (for example), they'll need to use multiple Fentry program entries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking through this more, I think we need both the attach point and the bpf program name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can get away without the attach point for the programs that support multiple attach points by mandating that people use a single entry in the bpfApplication CRD for a given program-type/bpf-program-name instead of using multiple entries of the same program type for different attach points.
@@ -100,7 +100,7 @@ func (r *BpfApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Reque | |||
complete, res, err = r.reconcileCommon(ctx, rec, fentryObjects) | |||
|
|||
case bpfmaniov1alpha1.ProgTypeFexit: | |||
appProgramId := fmt.Sprintf("%s-%s", strings.ToLower(string(p.Type)), sanitize(p.Fexit.FunctionName)) | |||
appProgramId := fmt.Sprintf("%s-%s", strings.ToLower(string(p.Type)), p.Fexit.BpfFunctionName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment on Fentry.
@@ -123,7 +123,7 @@ func (r *BpfApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Reque | |||
|
|||
case bpfmaniov1alpha1.ProgTypeKprobe, | |||
bpfmaniov1alpha1.ProgTypeKretprobe: | |||
appProgramId := fmt.Sprintf("%s-%s", strings.ToLower(string(p.Type)), sanitize(p.Kprobe.FunctionName)) | |||
appProgramId := fmt.Sprintf("%s-%s", strings.ToLower(string(p.Type)), p.Kprobe.BpfFunctionName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment on Fentry.
@@ -146,7 +146,7 @@ func (r *BpfApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Reque | |||
|
|||
case bpfmaniov1alpha1.ProgTypeUprobe, | |||
bpfmaniov1alpha1.ProgTypeUretprobe: | |||
appProgramId := fmt.Sprintf("%s-%s", strings.ToLower(string(p.Type)), sanitize(p.Uprobe.FunctionName)) | |||
appProgramId := fmt.Sprintf("%s-%s", strings.ToLower(string(p.Type)), p.Uprobe.BpfFunctionName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment on Fentry.
…ce per direction Signed-off-by: Mohamed Mahmoud <mmahmoud@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
bpfman agent operator go into loop loading/unreloading the program incorrectly when more than on hook is used on the same interface for the same direction
for example this yaml will cause the issue to happen
with the fix