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

new(scap): Support gVisor no_events mode/full proc scan for nodriver #997

Merged
merged 4 commits into from
Mar 22, 2023

Conversation

gnosek
Copy link
Contributor

@gnosek gnosek commented Mar 20, 2023

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 PR is a smaller patch to achieve the same thing as #986. Instead of introducing a no_events mode for all engines, it introduces one just for gVisor. kmod/bpf/modern_bpf can use the nodriver engine instead (with the new full_proc_scan=true flag) to achieve the same result.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

deepskyblue86 and others added 4 commits March 20, 2023 16:01
Co-authored-by: Angelo Puglisi <angelopuglisi86@gmail.com>
Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
The nodriver engine is still the only user of limited /proc scan
but we no longer check handle->m_mode. Instead we have a dedicated
flag. This lets us have the nodriver engine with a full /proc scan
if we want.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
The patch is somewhat weird because it introduces an option
for the nodriver engine which is used only by the main libscap
code (the /proc scan does not live in the engine). Still, we're
(logically) configuring the nodriver engine, I believe the flag
belongs in the engine config.

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
This new flag means that we're *not* going to get any events
from the engine and are using it just for the secondary
effects of scap_open (mostly getting the process table).

This is needed to safely open a new inspector while another
one exists. Otherwise we'd overwrite the gVisor socket
with a new one (which would become inactive the moment we close
the second inspector), breaking all future gVisor connections.

Co-Authored-By: Angelo Puglisi <angelopuglisi86@gmail.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
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.

Thank you for this!
/approve

@poiana
Copy link
Contributor

poiana commented Mar 21, 2023

LGTM label has been added.

Git tree hash: 305303c28bee699f3c873699f4f2a2506d48e1a6

@Andreagit97 Andreagit97 added this to the 0.11.0 milestone Mar 21, 2023
@Andreagit97
Copy link
Member

cc @LucaGuerra
/hold

@@ -97,7 +97,7 @@ engine::~engine()

}

int32_t engine::init(std::string config_path, std::string root_path)
int32_t engine::init(std::string config_path, std::string root_path, bool no_events)
Copy link
Contributor

Choose a reason for hiding this comment

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

Not related to this change, but we're copying strings here

Copy link
Contributor

Choose a reason for hiding this comment

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

I personally don't think copying strings is an issue here. It certainly isn't for this PR :)

userspace/libscap/scap-int.h Show resolved Hide resolved
Copy link
Contributor

@LucaGuerra LucaGuerra left a comment

Choose a reason for hiding this comment

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

LGTM, only have a very minor comment

When that's resolved you can remove the hold to get it merged :) Thanks!

@poiana
Copy link
Contributor

poiana commented Mar 21, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Andreagit97, gnosek, LucaGuerra

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 [Andreagit97,LucaGuerra,gnosek]

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

@LucaGuerra
Copy link
Contributor

/unhold

@gnosek gnosek changed the title wip: new(scap): Support gVisor no_events mode/full proc scan for nodriver new(scap): Support gVisor no_events mode/full proc scan for nodriver Mar 22, 2023
@poiana poiana merged commit 3ade7e2 into falcosecurity:master Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants