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 umount2 syscall flags type, add conversion helper function #1211

Closed
wants to merge 1 commit into from

Conversation

oheifetz
Copy link
Contributor

  • change the flags (param 1) from u32 to s32
  • add a userspace to scap flag conversion helper routine

Reported by: github issue #515

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: change the flags (param 1) from u32 to s32 and add a userspace to scap flag conversion helper routine

Which issue(s) this PR fixes: issue 515 umount2 bullet

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@poiana
Copy link
Contributor

poiana commented Jul 18, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: oheifetz
Once this PR has been reviewed and has the lgtm label, please assign fededp for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@github-actions
Copy link

github-actions bot commented Jul 18, 2023

Please double check driver/SCHEMA_VERSION file. See versioning.

@incertum
Copy link
Contributor

@oheifetz just wanted to let you know, we are discussing in the other PR #1192 (comment) how to make the executive decision on when we absolutely need to bump the event given it's rather a long list of minor type miss casts. We will keep you updated, for now we are holding all these PRs until we have clarified the open questions.

@oheifetz
Copy link
Contributor Author

Hi @incertum,
Saw that some CI builds failed even though my builds and tests passed. I ran:

cmake -DUSE_BUNDLED_DEPS=On -DBUILD_LIBSCAP_GVISOR=Off \
      -DENABLE_DRIVERS_TESTS=On -DCREATE_TEST_TARGETS=On \
      -DBUILD_BPF=On -DBUILD_LIBSCAP_MODERN_BPF=On -DMODERN_BPF_DEBUG_MODE=On ..
make drivers_test
make driver bpf
make unit-test-libsinsp; make run-unit-test-libsinsp;
make unit-test-libscap; sudo libscap/test/unit-test-libscap;
sudo ./test/drivers/drivers_test -b driver/bpf/probe.o;
sudo ./test/drivers/drivers_test -m
sudo ./test/drivers/drivers_test -k

If there are some additional builds I can run to confirm that it will not fail on CI it would be great

@Andreagit97
Copy link
Member

Andreagit97 commented Jul 20, 2023

hey @oheifetz yes if you want to reproduce the failure locally you have to put -DBUILD_LIBSCAP_GVISOR=On the fix here seems to put ifdefs around the flag you added, so:

#ifdef MNT_FORCE
	if (flags & MNT_FORCE)
		res |= PPM_MNT_FORCE;
#endif
#ifdef MNT_DETACH
	if (flags & MNT_DETACH)
		res |= PPM_MNT_DETACH;
#endif

    ...
	return res;

The ifdef __NR_umount2 is not enough because the syscall numbers are defined in another header with respect to the flags

@oheifetz oheifetz force-pushed the issue_515_umount2 branch 2 times, most recently from 26481c7 to 3d9b845 Compare July 20, 2023 10:52
@FedeDP
Copy link
Contributor

FedeDP commented Jul 26, 2023

/milestone driver-backlog

@poiana poiana added this to the driver-backlog milestone Jul 26, 2023
- change the flags (param 1) from u32 to s32
- add a userspace to scap flag conversion helper routine

Reported by: github issue falcosecurity#515

Signed-off-by: Ofer Heifetz <oheifetz@gmail.com>
@oheifetz
Copy link
Contributor Author

Hi @incertum,
When pushing code now I get: `! [remote rejected] issue_515_umount2 -> issue_515_umount2 (refusing to allow a Personal Access Token to create or update workflow ``
Is there some explanation on the workflow changes that needs to be done to make a push work?

@incertum
Copy link
Contributor

@oheifetz probably not, I just pushed myself onto my branch. I have had such issues in the past and likely something in your settings changed or you need to setup a new ssh key or something. Please let us know if you keep having these issues after checking everything.

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