-
Notifications
You must be signed in to change notification settings - Fork 163
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
refactor(userspace): re-implement plugin loader in C and split it in its own package #392
refactor(userspace): re-implement plugin loader in C and split it in its own package #392
Conversation
falcosecurity/plugins#121 is a good example where the plugin loader code might be needed in an external project and must not be replicated to guarantee consistency. |
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'm not super familiar with the plugins system, but the change looks cool! I left a few comments on the C code, they are mostly nitpicks, so don't worry too much about them.
userspace/plugin/plugin_loader.c
Outdated
if(a->api.s == NULL) \ | ||
{ \ | ||
strcpy(e, "symbol not implemented: "); \ | ||
strncat(e, #s, PLUGIN_MAX_ERRLEN - 1); \ |
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.
Here we are not considering "symbol not implemented: "
length when accounting for max size.
I don't think this will ever be an issue, still it would be great to deal with it given that we are using strncat
:)
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.
Just changed this thanks to the suggestions of @Molter73!
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 so cool!
Thank you!
Did you consider adding a library around it?
Thanks Fede! You mean building a |
/retest |
Thanks @Molter73 for the deep review! I appreciate it 🙏🏼 |
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 is cool.
👍 for me :)
LGTM label has been added. Git tree hash: ed493b873af12985ceeeb97ee45b6bdf4e2d5980
|
89dcd02
to
6a429da
Compare
…ide of sinsp and scap Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
…l directory Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com> Co-authored-by: Mauro Ezequiel Moltrasio <moltrasiom@hotmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com> Co-authored-by: Mauro Ezequiel Moltrasio <moltrasiom@hotmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com> Co-authored-by: Mauro Ezequiel Moltrasio <moltrasiom@hotmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
6a429da
to
47bf2b8
Compare
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
47bf2b8
to
08b3ae0
Compare
/retest |
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.
/approve
LGTM label has been added. Git tree hash: 5ea9263eaee5d65b445c072761767e003bea50fc
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: FedeDP, jasondellaluce The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
Again 👍
What type of PR is this?
/kind cleanup
/kind design
Any specific area of the project related to this PR?
/area libscap-engine-source-plugin
/area libsinsp
What this PR does / why we need it:
Which issue(s) this PR fixes:
This PR refactors the plugin definitions and loading logic. The plugin types, definitions, and loading logic are now all under an ad-hoc
userspace/plugin
directory on which both libscap and libsinsp dependencies. The goals and benefits are:userspace/plugin
plugin_info.h
file has been split intoplugin_types.h
andplugin_api.h
, so that consumers can only import the definitions they needfalcoctl
, could be built on top of this code.plugin_init
orplugin_destroy
as optional. The new plugin loader also prompts more explicit error messages, such as when the semver checks fail.Special notes for your reviewer:
~400 LOC are caused by moving
plugin_info.h
and splitting it intoplugin/plugin_types.h
andplugin/plugin_api.h
.Does this PR introduce a user-facing change?: