Skip to content

Extend experiment seccomp program#3464

Merged
saku3 merged 47 commits intoyouki-dev:mainfrom
sat0ken:extend-experiment-seccomp
Apr 7, 2026
Merged

Extend experiment seccomp program#3464
saku3 merged 47 commits intoyouki-dev:mainfrom
sat0ken:extend-experiment-seccomp

Conversation

@sat0ken
Copy link
Copy Markdown
Contributor

@sat0ken sat0ken commented Mar 17, 2026

Description

working #2724

// sorry for this PR is difficult to review.
// sorry for my mistake PR Closed #3463. Re open it

・add json file for more test case and create example dir
・some function copy to libcontainer/seccomp
・add check argument of system call
・bpf jmp instruction cannot jump more than 255. If the number of system calls exceeds 255, it will be split.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test updates
  • CI/CD related changes
  • Other (please describe):

Testing

  • Added new unit tests
  • Added new integration tests
  • Ran existing test suite
  • Tested manually (please provide steps)
  1. download test program from my repo.
  2. go build & go run
  3. run cargo run --example readjson
  4. compare print bpf code stdout step 2 and 3.

Related Issues

Fixes #

Additional Context

sat0ken and others added 30 commits March 17, 2026 23:51
- add default error return code to InstructionData
- add action to Rule
- add action to fn new of Rule and fix test code
- add seccomp compare op code to const
- ported function from libcontainer of seccomp
- update Cargo.toml and lock
- add const of seccomp flags
- add flags to InstructionData
- add derive
- improve implementation to generate filter from LinuxSeccomp
- update main.rs to use oci_spec
- fix format

Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
- modify systemcall of args check logic
- add for test code and add serde to use json
- update gen_validate
- update seccomp_data_args_offset to get args index
- add file for test
- update check argument code
- update check argument code
- fix test code
- remove unusual args from fn to_instruction_with_args
- add test code
- add test case with args
- add test for arm64

Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
sat0ken added 11 commits March 17, 2026 23:59
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
@saku3 saku3 added the kind/experimental `/experimental` label Mar 18, 2026
@sat0ken sat0ken mentioned this pull request Mar 19, 2026
4 tasks
sat0ken added 4 commits April 1, 2026 23:48
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
@sat0ken
Copy link
Copy Markdown
Contributor Author

sat0ken commented Apr 1, 2026

I write below about disscussed with @saku3 and agreed.

  • structure do like this
experiment/seccomp/
  ├── src/
  │   ├── instruction/
  │   ├── lib.rs
  │   ├── seccomp.rs
  └── tests/
      ├── readjson.rs
      ├── filter.rs
      └── helpers/
          └── mod.rs
  • tokio by using example code, mark as dev-dependencies in Cargo.toml
  • To compare output of bpf instruction, add code about read json file by using libseccomp-rs

fix warning

Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Copy link
Copy Markdown
Member

@saku3 saku3 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 PR!

We are working toward our own seccomp implementation so that we can remove the dependency on libseccomp.

At the moment, both @sat0ken and I recognize that there are still several issues in the current PR.
Since the PR has grown quite large, we would like to merge it at this stage and continue improving it in follow-up PRs.

As of now, this functionality should not impact youki itself at this point so merging it will not break youki.


#[test]
fn test_build_instruction_with_args_x86_equal() {
let persolality = get_syscall_number(&Arch::X86, "personality").unwrap();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
let persolality = get_syscall_number(&Arch::X86, "personality").unwrap();
let personality = get_syscall_number(&Arch::X86, "personality").unwrap();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I fixed.

716a547

(rule.args.unwrap().arg0 >> 32) as c_uint,
));

// lower 32bit check of
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
// lower 32bit check of
// lower 32bit check of args

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I fixed.

716a547

Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
@saku3 saku3 merged commit 11e2610 into youki-dev:main Apr 7, 2026
28 checks passed
@github-actions github-actions bot mentioned this pull request Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/experimental `/experimental`

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants