Skip to content

[blk-threaded - 9/12] seccomp: add block worker thread filter - #6131

Open
PierreBertholom wants to merge 4 commits into
pbertho/blk-threaded-08from
pbertho/blk-threaded-09
Open

[blk-threaded - 9/12] seccomp: add block worker thread filter#6131
PierreBertholom wants to merge 4 commits into
pbertho/blk-threaded-08from
pbertho/blk-threaded-09

Conversation

@PierreBertholom

@PierreBertholom PierreBertholom commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

[9/12] part of the PR stack starting with #6123

Changes

This pull request contains the seccomp filter and its support changes.

seccompiler: truncate memfd before each BPF export

Reset the shared memfd before each export so a shorter filter cannot
retain instructions from the previous filter.

test: fix x86 regs for seccomp static analysis

Resolve x86 syscall numbers written through partial registers while
preserving unaffected bits during backpropagation.
Inspect seccomp rules from all thread categories.

seccomp: add block worker thread filter

Add an optional seccomp category and a syscall allowlist for block
workers.
Keep existing custom filters valid when no block worker is needed.
Apply the filter before entering the worker event loop.

docs: document seccomp thread categories

Document the allowed and mandatory Firecracker thread categories.
Explain when custom filters need the optional block worker category.

Reset the shared memfd before each export so a shorter filter cannot
retain instructions from the previous filter.

Signed-off-by: Pierre Bertholom <pbertho@amazon.com>
Resolve x86 syscall numbers written through partial registers while
preserving unaffected bits during backpropagation.
Inspect seccomp rules from all thread categories.

Signed-off-by: Pierre Bertholom <pbertho@amazon.com>
Add an optional seccomp category and a syscall allowlist for block
workers.
Keep existing custom filters valid when no block worker is needed.
Apply the filter before entering the worker event loop.

Signed-off-by: Pierre Bertholom <pbertho@amazon.com>
Document the allowed and mandatory Firecracker thread categories.
Explain when custom filters need the optional block worker category.

Signed-off-by: Pierre Bertholom <pbertho@amazon.com>
@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.88%. Comparing base (2ea86d1) to head (e3a30b2).

Files with missing lines Patch % Lines
src/seccompiler/src/lib.rs 0.00% 2 Missing ⚠️
src/vmm/src/devices/virtio/block/virtio/worker.rs 87.50% 1 Missing ⚠️
Additional details and impacted files
@@                     Coverage Diff                     @@
##           pbertho/blk-threaded-08    #6131      +/-   ##
===========================================================
- Coverage                    81.89%   81.88%   -0.01%     
===========================================================
  Files                          278      278              
  Lines                        31592    31606      +14     
===========================================================
+ Hits                         25871    25882      +11     
- Misses                        5721     5724       +3     
Flag Coverage Δ
5.10-m5n.metal 82.02% <85.00%> (-0.01%) ⬇️
5.10-m6a.metal 81.36% <85.00%> (-0.01%) ⬇️
5.10-m6g.metal 78.89% <85.00%> (-0.01%) ⬇️
5.10-m6i.metal 82.02% <85.00%> (+<0.01%) ⬆️
5.10-m7a.metal-48xl 81.35% <85.00%> (-0.01%) ⬇️
5.10-m7g.metal 78.89% <85.00%> (-0.01%) ⬇️
5.10-m7i.metal-24xl 81.99% <85.00%> (-0.01%) ⬇️
5.10-m7i.metal-48xl 82.00% <85.00%> (-0.01%) ⬇️
5.10-m8g.metal-24xl 78.88% <85.00%> (-0.01%) ⬇️
5.10-m8g.metal-48xl 78.88% <85.00%> (-0.01%) ⬇️
5.10-m8i.metal-48xl 82.00% <85.00%> (-0.01%) ⬇️
5.10-m8i.metal-96xl 82.00% <85.00%> (-0.01%) ⬇️
6.1-m5n.metal 82.05% <85.00%> (-0.01%) ⬇️
6.1-m6a.metal 81.39% <85.00%> (+<0.01%) ⬆️
6.1-m6g.metal 78.88% <85.00%> (-0.01%) ⬇️
6.1-m6i.metal 82.04% <85.00%> (-0.01%) ⬇️
6.1-m7a.metal-48xl 81.37% <85.00%> (-0.01%) ⬇️
6.1-m7g.metal 78.89% <85.00%> (-0.01%) ⬇️
6.1-m7i.metal-24xl 82.06% <85.00%> (-0.01%) ⬇️
6.1-m7i.metal-48xl 82.05% <85.00%> (-0.01%) ⬇️
6.1-m8g.metal-24xl 78.88% <85.00%> (-0.01%) ⬇️
6.1-m8g.metal-48xl 78.88% <85.00%> (-0.01%) ⬇️
6.1-m8i.metal-48xl 82.07% <85.00%> (+<0.01%) ⬆️
6.1-m8i.metal-96xl 82.06% <85.00%> (-0.01%) ⬇️
6.18-m5n.metal 82.04% <85.00%> (-0.01%) ⬇️
6.18-m6a.metal 81.38% <85.00%> (-0.01%) ⬇️
6.18-m6g.metal 78.89% <85.00%> (-0.01%) ⬇️
6.18-m6i.metal 82.04% <85.00%> (-0.01%) ⬇️
6.18-m7a.metal-48xl 81.37% <85.00%> (-0.01%) ⬇️
6.18-m7g.metal 78.89% <85.00%> (-0.01%) ⬇️
6.18-m7i.metal-24xl 82.05% <85.00%> (-0.01%) ⬇️
6.18-m7i.metal-48xl 82.06% <85.00%> (+<0.01%) ⬆️
6.18-m8g.metal-24xl 78.88% <85.00%> (-0.01%) ⬇️
6.18-m8g.metal-48xl 78.89% <85.00%> (+<0.01%) ⬆️
6.18-m8i.metal-48xl 82.06% <85.00%> (-0.01%) ⬇️
6.18-m8i.metal-96xl 82.06% <85.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

"syscall": "rt_sigprocmask"
},
{
"syscall": "rt_sigaction",

@Manciukic Manciukic Aug 26, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we should also have rt_sigreturn which is used to return from signal handler if it happens to receive a signal in the worker thread. We recently caught a bug where api thread was missing it.

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