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(decl): potential nil ptr deref and shell script SIGUSR handling #243

Merged
merged 3 commits into from
Nov 26, 2024

Conversation

ekoops
Copy link
Contributor

@ekoops ekoops commented Nov 25, 2024

What type of PR is this?

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

/kind bug

/kind cleanup

/kind documentation

/kind tests

/kind feature

Any specific area of the project related to this PR?

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

/area commands

/area pkg

/area events

What this PR does / why we need it:
This PR fixes the SIGUSR1 signal handling for shell scripts by correctly handling the exit code set by the signal (138). The first instruction after the blocking wait now verifies the returned exit code and clears its value if it matches the one set by the signal. Moreover, this PR fixes a potential nil pointer dereference in test context validation and conditionally disable shell script execution when both "before" and "after" scripts are not provided by the user.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

ekoops and others added 2 commits November 25, 2024 10:44
Fix SIGUSR1 handling by resetting the associated exit code (138)
after handler execution. Comment shell script.

Signed-off-by: Leonardo Di Giovanna <[email protected]>
Co-authored-by: Aldo Lacuku <[email protected]>
Signed-off-by: Leonardo Di Giovanna <[email protected]>
Co-authored-by: Aldo Lacuku <[email protected]>
@poiana poiana requested review from FedeDP and leogr November 25, 2024 09:52
@poiana poiana added the size/M label Nov 25, 2024
@ekoops ekoops changed the title fix(decl): potential nil ptr deref and shell script SIGUSR handling wip: fix(decl): potential nil ptr deref and shell script SIGUSR handling Nov 25, 2024
Disable shell script execution if both "before" and "after" scripts
are not provided.

Signed-off-by: Leonardo Di Giovanna <[email protected]>
Co-authored-by: Aldo Lacuku <[email protected]>
@ekoops ekoops changed the title wip: fix(decl): potential nil ptr deref and shell script SIGUSR handling fix(decl): potential nil ptr deref and shell script SIGUSR handling Nov 25, 2024
Copy link
Member

@alacuku alacuku left a comment

Choose a reason for hiding this comment

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

/lgtm

@poiana
Copy link

poiana commented Nov 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alacuku, ekoops

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana
Copy link

poiana commented Nov 26, 2024

LGTM label has been added.

Git tree hash: 264bc63b69d6e52fdd049cb38208a7da6276804c

@poiana poiana merged commit 43ce926 into falcosecurity:declarative-testing Nov 26, 2024
5 of 6 checks passed
@ekoops ekoops deleted the ekoops/fixes branch November 26, 2024 16:38
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.

3 participants