aya: Hello XDP run with map error

I am following hello XDP! and get this error:

cargo xtask run
Error: map error

Caused by:
    0: failed to create map `AYA_LOGS` with code -1
    1: Operation not permitted (os error 1)
Failed to run `sudo -E target/debug/myapp`

and with sudo, still get this error:

sudo target/debug/myapp
Error: map error

Caused by:
    0: failed to create map `AYA_LOG_BUF` with code -1
    1: Operation not permitted (os error 1)

any ideas?

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 20

Most upvoted comments

Here is my workable solution:

// myapp/myapp/Cargo.toml
rlimit = "0.9.1"

// myapp/myapp/src/main.rs
use rlimit::Resource;
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
    let opt = Opt::parse();
    env_logger::init();

    if !Resource::MEMLOCK
        .set(rlimit::INFINITY, rlimit::INFINITY)
        .is_ok()
    {
        warn!("cannot remove mem lock");
    }

And my solution is involved in https://github.com/aya-rs/aya-template/pull/94.

Hope it would help.