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

feat(driver): support for mknod/mknodat syscall #1270

Merged
merged 2 commits into from
Aug 2, 2023

Conversation

therealbobo
Copy link
Contributor

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-engine-udig

/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:

This adds support for mknod and mknodat syscalls.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@github-actions
Copy link

github-actions bot commented Aug 1, 2023

Please double check driver/SCHEMA_VERSION file. See versioning.

[PPME_SYSCALL_MKNOD_E] = {"mknod", EC_OTHER | EC_SYSCALL, EF_NONE, 0},
[PPME_SYSCALL_MKNOD_X] = {"mknod", EC_OTHER | EC_SYSCALL, EF_NONE, 4, {{"res", PT_ERRNO, PF_DEC}, {"path", PT_CHARBUF, PF_NA},{"mode", PT_MODE, PF_OCT, mknod_mode},{"dev", PT_UINT32, PF_DEC}}},
[PPME_SYSCALL_MKNODAT_E] = {"mknodat", EC_OTHER | EC_SYSCALL, EF_NONE, 0},
[PPME_SYSCALL_MKNODAT_X] = {"mknodat", EC_OTHER | EC_SYSCALL, EF_NONE, 5, {{"res", PT_ERRNO, PF_DEC}, {"dirfd", PT_FD, PF_DEC},{"path", PT_CHARBUF, PF_NA},{"mode", PT_MODE, PF_OCT, mknod_mode},{"dev", PT_UINT32, PF_DEC}}},
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't PPME_SYSCALL_MKNODAT_X be set as EF_USES_FD or something, or have a specific parser in parsers.cpp, due to it supporting relative paths through dirfd?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I forgot about that! I'll work on it!

Copy link
Contributor

Choose a reason for hiding this comment

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

We can change this in a follow up PR too! I'm ok in merging this sooner so that drivers get updated!

@therealbobo therealbobo force-pushed the feat/mknod branch 2 times, most recently from ec047bb to bd2d62c Compare August 1, 2023 14:00
driver/ppm_flag_helpers.h Outdated Show resolved Hide resolved
driver/ppm_flag_helpers.h Show resolved Hide resolved
driver/bpf/fillers.h Outdated Show resolved Hide resolved
driver/bpf/fillers.h Outdated Show resolved Hide resolved
driver/ppm_flag_helpers.h Show resolved Hide resolved
driver/syscall_table.c Show resolved Hide resolved
test/drivers/test_suites/syscall_exit_suite/mknod_e.cpp Outdated Show resolved Hide resolved
test/drivers/test_suites/syscall_exit_suite/mknodat_e.cpp Outdated Show resolved Hide resolved
@Andreagit97 Andreagit97 added this to the next-driver milestone Aug 1, 2023
@therealbobo therealbobo force-pushed the feat/mknod branch 2 times, most recently from 33a6b5f to 860bb5a Compare August 1, 2023 23:59
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
Co-Authored-By: Andrea Terzolo <andreaterzolo3@gmail.com>
Andreagit97
Andreagit97 previously approved these changes Aug 2, 2023
Copy link
Member

@Andreagit97 Andreagit97 left a comment

Choose a reason for hiding this comment

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

/approve
thank you!

driver/event_table.c Outdated Show resolved Hide resolved
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
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

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.

I think we also need to add mknodat to uint8_t *sinsp_filter_check_event::extract_abspath.
Possibly other places too!

@poiana poiana removed the lgtm label Aug 2, 2023
@poiana poiana requested a review from FedeDP August 2, 2023 09:23
@therealbobo
Copy link
Contributor Author

We discussed earlier to make those changes in a follow-up pr but I'm ok to do it here, wdyt? @FedeDP

@FedeDP
Copy link
Contributor

FedeDP commented Aug 2, 2023

Ah ops sorry, it's ok then!

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 poiana added the lgtm label Aug 2, 2023
@poiana
Copy link
Contributor

poiana commented Aug 2, 2023

LGTM label has been added.

Git tree hash: b59cb6d5ec1815f6cbc8e0593e4931a0ad230e87

@Andreagit97
Copy link
Member

/hold

Copy link
Member

@Andreagit97 Andreagit97 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 Aug 2, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Andreagit97, FedeDP, therealbobo

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

@FedeDP
Copy link
Contributor

FedeDP commented Aug 2, 2023

/unhold

@poiana poiana merged commit 9373ee9 into falcosecurity:master Aug 2, 2023
29 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.

5 participants