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

Support pidfd_open syscall #1187

Merged
merged 6 commits into from
Jul 18, 2023
Merged

Conversation

Rohith-Raju
Copy link
Contributor

@Rohith-Raju Rohith-Raju commented Jul 5, 2023

What type of PR is this?

/kind feature

Any specific area of the project related to this PR?

/area driver-kmod

/area driver-bpf

/area driver-modern-bpf

/area tests

Does this PR require a change in the driver versions?

What this PR does / why we need it:

This PR adds support for pidfd_open syscall

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Support pidfd_open syscall

Signed-off-by: rohith-raju <rohithraju488@gmail.com>
@github-actions
Copy link

github-actions bot commented Jul 5, 2023

Please double check driver/API_VERSION file. See versioning.

Signed-off-by: rohith-raju <rohithraju488@gmail.com>
@Rohith-Raju Rohith-Raju force-pushed the pidfd_open branch 4 times, most recently from 463b4b6 to d732b41 Compare July 9, 2023 06:57
Signed-off-by: rohith-raju <rohithraju488@gmail.com>
Signed-off-by: rohith-raju <rohithraju488@gmail.com>
@Rohith-Raju Rohith-Raju changed the title WIP: Support pidfd_open syscall Support pidfd_open syscall Jul 11, 2023
@Andreagit97 Andreagit97 modified the milestones: 0.13.0, driver-backlog Jul 17, 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.

Thank you for this!

unsigned long flags;

/* Parameter 1: ret (type: PT_FD) */
retval = bpf_syscall_get_retval(data->ctx);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
retval = bpf_syscall_get_retval(data->ctx);
long retval = bpf_syscall_get_retval(data->ctx);


/* Parameter 1: ret (type: PT_FD) */
retval = bpf_syscall_get_retval(data->ctx);
res = bpf_push_s64_to_ring(data, retval);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
res = bpf_push_s64_to_ring(data, retval);
int res = bpf_push_s64_to_ring(data, retval);

driver/bpf/fillers.h Outdated Show resolved Hide resolved
//////////////////////////
// pidfd_open flags
//////////////////////////
# define PIDFD_NONBLOCK 1U
Copy link
Member

Choose a reason for hiding this comment

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

why do we use 1U here? In the kernel I found

#define PIDFD_NONBLOCK O_NONBLOCK

driver/bpf/fillers.h Outdated Show resolved Hide resolved
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.

Almost done :)

driver/bpf/fillers.h Outdated Show resolved Hide resolved
{
unsigned long val;
int res;
int retval;
Copy link
Member

Choose a reason for hiding this comment

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

we still need to address this

Signed-off-by: rohith-raju <rohithraju488@gmail.com>
@Rohith-Raju
Copy link
Contributor Author

Rohith-Raju commented Jul 18, 2023

Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
@Andreagit97
Copy link
Member

@Andreagit97 We probably need to add a kernel check since the test is using 5.8. WDYT? https://app.circleci.com/pipelines/github/falcosecurity/libs/1551/workflows/e87d59c2-1033-4f49-9abd-de04f3d09db1/jobs/4382?invite=true#step-105-11153_6

I moved the flag checks in the failure case, this should solve our issues 🤞

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 Jul 18, 2023

LGTM label has been added.

Git tree hash: fe01ebc452b0d150696f4ad40c8382682b183259

Copy link
Contributor

@jasondellaluce jasondellaluce 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 Jul 18, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Andreagit97, jasondellaluce, Rohith-Raju

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,jasondellaluce]

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

@poiana poiana merged commit 199e5aa into falcosecurity:master Jul 18, 2023
@FedeDP
Copy link
Contributor

FedeDP commented Jul 28, 2023

/milestone 5.1.0+driver

@poiana poiana modified the milestones: next-driver, 5.1.0+driver Jul 28, 2023
@Rohith-Raju Rohith-Raju deleted the pidfd_open branch December 11, 2023 09:19
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