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

Add perf_event_open test #1363

Merged
merged 21 commits into from
Oct 24, 2023
Merged

Add perf_event_open test #1363

merged 21 commits into from
Oct 24, 2023

Conversation

erthalion
Copy link
Contributor

@erthalion erthalion commented Oct 9, 2023

Description

Checklist

  • Investigated and inspected CI test results
    - [ ] Updated documentation accordingly

Automated testing
- [ ] Added unit tests

  • Added integration tests
    - [ ] Added regression tests

Testing Performed

@erthalion erthalion requested a review from a team as a code owner October 9, 2023 14:22
@erthalion erthalion marked this pull request as draft October 9, 2023 14:22
@erthalion erthalion force-pushed the feature/perf-event-open-test branch 2 times, most recently from b9cb304 to 23e572b Compare October 10, 2023 15:33
@github-actions
Copy link

github-actions bot commented Oct 10, 2023

Kernel Method Without Collector Time (secs) With Collector Time (secs) Baseline median (secs) Collector median (secs) PValue

@erthalion erthalion force-pushed the feature/perf-event-open-test branch from 0c9121a to e60ef3d Compare October 12, 2023 08:42
@erthalion erthalion marked this pull request as ready for review October 24, 2023 08:08
Copy link
Collaborator

@Molter73 Molter73 left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together @erthalion! I left a few comments but nothing major, think we can go ahead and merge stackrox/falcosecurity-libs#57 so we can directly update the falco submodule here, WDYT?

integration-tests/container/perf_event_open/Dockerfile Outdated Show resolved Hide resolved
Comment on lines 25 to 34
// How long to wait for events, in seconds
int wait_interval = 10;

// /sys/kernel/debug/tracing/events/sched/sched_process_exit/id
int tracepoint_code = 310;

if (argc == 3) {
wait_interval = atoi(argv[1]);
tracepoint_code = atoi(argv[2]);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like we are always using the arguments passed in, so we might want to fail if the number of arguments is wrong instead.

Suggested change
// How long to wait for events, in seconds
int wait_interval = 10;
// /sys/kernel/debug/tracing/events/sched/sched_process_exit/id
int tracepoint_code = 310;
if (argc == 3) {
wait_interval = atoi(argv[1]);
tracepoint_code = atoi(argv[2]);
}
if (argc != 3) {
fprintf(stderr, "Expected 2 arguments, got: %d", argc - 1);
exit(EXIT_FAILURE);
}
// How long to wait for events, in seconds
int wait_interval = atoi(argv[1]);
// /sys/kernel/debug/tracing/events/sched/sched_process_exit/id
int tracepoint_code = atoi(argv[2]);

@@ -234,7 +234,7 @@ func (s *IntegrationTestSuiteBase) GetLogLines(containerName string) []string {
}

func (s *IntegrationTestSuiteBase) launchContainer(name string, args ...string) (string, error) {
cmd := []string{common.RuntimeCommand, "run", "-d", "--name", name}
cmd := []string{common.RuntimeCommand, "run", "-d", "--name", name, "--privileged"}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will launch all containers as privileged, you probably want to add the flag specifically to the perf-event-open container via the args parameter.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Either that or we want a separate launchPrivilegedContainer method that adds the flag.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, this one is definitely not what I intended to do, probably a left over after some code shuffling.

@@ -1 +1 @@
2.6.0
2.7.0-rc1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since we are pretty close to the release, we probably want to go directly to 2.7.0

@erthalion
Copy link
Contributor Author

Thanks for putting this together @erthalion! I left a few comments but nothing major, think we can go ahead and merge stackrox/falcosecurity-libs#57 so we can directly update the falco submodule here, WDYT?

Yep, makes sense to me.

Do everything in a single run.

Co-authored-by: Mauro Ezequiel Moltrasio <[email protected]>
@Molter73
Copy link
Collaborator

Thanks for putting this together @erthalion! I left a few comments but nothing major, think we can go ahead and merge stackrox/falcosecurity-libs#57 so we can directly update the falco submodule here, WDYT?

Yep, makes sense to me.

Merged!

Invert arguments checking logic for the test binary.
Remove unnecessary sampling bits from the perf_even_open config.
Move the privileged flag to be used only for perf_event_open container.
Set new modules version.
Copy link
Collaborator

@Molter73 Molter73 left a comment

Choose a reason for hiding this comment

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

LGTM!

@erthalion erthalion merged commit e5111a6 into master Oct 24, 2023
84 checks passed
@erthalion erthalion deleted the feature/perf-event-open-test branch October 24, 2023 16:08
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.

2 participants