Skip to content

seccomp: Lazily construct precompiled seccomp programs - #14795

Merged
copybara-service[bot] merged 2 commits into
masterfrom
test/cl982799777
Sep 17, 2026
Merged

copybara-service[bot] merged 2 commits into
masterfrom
test/cl982799777

Conversation

@copybara-service

Copy link
Copy Markdown

seccomp: Lazily construct precompiled seccomp programs

GetPrecompiled() eagerly built a map of every precompiled seccomp program via registerPrograms(), materializing the bytecode of all programs at sandbox startup. With 432 programs totaling ~3.4MB of BPF bytecode, this cost ~8ms per sandbox even though each sandbox only looks up a single program.

Change the code generator to emit a switch statement instead, so that only the bytecode of the requested program is constructed. This drops GetPrecompiled() from ~8ms to ~40us, and the "precompiled seccomp program rendered" startup phase from ~10.5ms to ~0.26ms.

Assisted-by: DeepSeek:DeepSeek-V3
FUTURE_COPYBARA_INTEGRATE_REVIEW=#14674 from ruanjinjie-eng:Lazily_precompiled_seccomp_progs 581a20c

GetPrecompiled() eagerly built a map of every precompiled seccomp program
via registerPrograms(), materializing the bytecode of all programs at
sandbox startup. With 432 programs totaling ~3.4MB of BPF bytecode, this
cost ~8ms per sandbox even though each sandbox only looks up a single
program.

Change the code generator to emit a switch statement instead, so that only
the bytecode of the requested program is constructed. This drops
GetPrecompiled() from ~8ms to ~40us, and the "precompiled seccomp program
rendered" startup phase from ~10.5ms to ~0.26ms.

Assisted-by: DeepSeek:DeepSeek-V3
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
@copybara-service copybara-service Bot added the exported Issue was exported automatically label Sep 16, 2026
@copybara-service
copybara-service Bot force-pushed the test/cl982799777 branch 3 times, most recently from 030df60 to 450a774 Compare September 17, 2026 05:12
@copybara-service
copybara-service Bot merged commit 51a455c into master Sep 17, 2026
2 checks passed
@copybara-service
copybara-service Bot deleted the test/cl982799777 branch September 17, 2026 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exported Issue was exported automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants