falcosecurity / plugin-sdk-go

Falco plugins SDK for Go
Apache License 2.0
26 stars 17 forks source link

fix(pkg/sdk): solve memory alignment issues when setting extraction value #75

Closed jasondellaluce closed 1 year ago

jasondellaluce commented 1 year ago

What type of PR is this?

/kind bug

Any specific area of the project related to this PR?

/area plugin-sdk

What this PR does / why we need it:

Which issue(s) this PR fixes:

When writing res data into a ss_plugin_extract_field, we allocate an array batch that we reuse from request to request. We used to compute the offset of each result "slot" by assuming that each value always had the same size as the union of results, because by supporting only a char pointer and uint64 all values had the same size. This guarantee stopped being true when we introduced ss_plugin_byte_buffer, which now forces us to compute the right result slot offsets depending on the type data size, which is the right thing to do anyways. The framework will expect the result to be a contiguous array of the same data type defines by the result union, so it should be the SDK's responsibility to properly align values like that.

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

fix(pkg/sdk): solve memory alignment issues when setting extraction value
poiana commented 1 year ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jasondellaluce, leogr

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: - ~~[OWNERS](https://github.com/falcosecurity/plugin-sdk-go/blob/main/OWNERS)~~ [jasondellaluce,leogr] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
poiana commented 1 year ago

LGTM label has been added.

Git tree hash: 0e8997caebb7b38c8c23778acabcc3119f081e7d