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 BPF_F_SLEEPABLE flag support to LSM #545

Merged
merged 5 commits into from
Apr 25, 2023

Conversation

epompeii
Copy link
Contributor

This adds support for the BPF_F_SLEEPABLE flag for LSM : https://lore.kernel.org/netdev/20200827220114.69225-3-alexei.starovoitov@gmail.com/

It follows the same tack as XDP multi-buffer support: #519

Internally, this option follows the libbpf convention and is represented as lsm.s: https://elixir.bootlin.com/linux/latest/source/tools/lib/bpf/libbpf.c#L8560

In the public API, this is exposed via the eBPF lsm macro as an optional sleepable = "bool" argument.

#[lsm(name = "lsm_bprm_check_security", sleepable = "true")]
pub fn bprm_check_security(ctx: LsmContext) -> i32 {
    match try_bprm_check_security(ctx) {
        Ok(ret) => ret,
        Err(ret) => ret,
    }
}

@netlify
Copy link

netlify bot commented Mar 17, 2023

Deploy Preview for aya-rs-docs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 1f2006b
🔍 Latest deploy log https://app.netlify.com/sites/aya-rs-docs/deploys/6447dc8cd549b30008eae601
😎 Deploy Preview https://deploy-preview-545--aya-rs-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Collaborator

@alessandrod alessandrod 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 doing this! See comments

aya-bpf-macros/src/expand.rs Outdated Show resolved Hide resolved
aya-bpf-macros/src/expand.rs Show resolved Hide resolved
aya-obj/src/obj.rs Outdated Show resolved Hide resolved
aya-obj/src/obj.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@alessandrod alessandrod 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! Lgtm. Can you please rebase? I've fixed the CI failure on main.

@alessandrod alessandrod merged commit 120b59d into aya-rs:main Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants