Skip to content
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

fix(libsinsp): avoid setting a null event pointer when returning SCAP… #1738

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

mrgian
Copy link
Contributor

@mrgian mrgian commented Mar 8, 2024

…_EOF in sinsp::next

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area API-version

/area build

/area CI

/area driver-kmod

/area driver-bpf

/area driver-modern-bpf

/area libscap-engine-bpf

/area libscap-engine-gvisor

/area libscap-engine-kmod

/area libscap-engine-modern-bpf

/area libscap-engine-nodriver

/area libscap-engine-noop

/area libscap-engine-source-plugin

/area libscap-engine-savefile

/area libscap

/area libpman

/area libsinsp

/area tests

/area proposals

Does this PR require a change in the driver versions?

/version driver-API-version-major

/version driver-API-version-minor

/version driver-API-version-patch

/version driver-SCHEMA-version-major

/version driver-SCHEMA-version-minor

/version driver-SCHEMA-version-patch

What this PR does / why we need it:
Avoids a possible segfault in applications expecting a valid event pointer when SCAP_EOF is reached (e.g. oss-sysdig),
like it was before #1423 .

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@@ -1202,8 +1202,9 @@ int32_t sinsp::next(OUT sinsp_evt **puevt)
{
if (m_external_event_processor)
{
m_external_event_processor->process_event(NULL, libsinsp::EVENT_RETURN_EOF);
m_external_event_processor->process_event(evt, libsinsp::EVENT_RETURN_EOF);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1423 didn't touch these lines? I see that this code is there since ~3yrs at least; a quick blame showed that: https://github.com/falcosecurity/libs/blame/682a4a9ea917dabff8df75bd739ee446a940251e/userspace/libsinsp/sinsp.cpp

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. That's not needed.

@mrgian mrgian force-pushed the fix-null-ptr-scap-eof branch from 0bd6330 to fadaa42 Compare March 8, 2024 15:23
…_EOF in sinsp::next

Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
@mrgian mrgian force-pushed the fix-null-ptr-scap-eof branch from fadaa42 to 883b4aa Compare March 8, 2024 15:23
Copy link
Contributor

@FedeDP FedeDP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@poiana
Copy link
Contributor

poiana commented Mar 8, 2024

LGTM label has been added.

Git tree hash: bf76dcd738c7e95f64556604ff81ca8805291db6

@poiana poiana added the approved label Mar 8, 2024
@FedeDP
Copy link
Contributor

FedeDP commented Mar 8, 2024

/milestone 0.15.0

@poiana poiana added this to the 0.15.0 milestone Mar 8, 2024
@poiana
Copy link
Contributor

poiana commented Mar 11, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FedeDP, jasondellaluce, mrgian

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 [FedeDP,jasondellaluce]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana merged commit b27e8d9 into falcosecurity:master Mar 11, 2024
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants