ソフトウェアサンドボックスの基礎(2025)
## Japanese Translation:
このドキュメントは、本質的なパフォーマンスを維持しながら非特権ユーザーとして安全に Docker コンテナを実行することを可能にするカスタマイズされた seccomp ポリシシーの導入について記述しています。アプローチは Docker のデフォルトのプロファイルに大きく影響を受けており、ルートが必要となる syscalls や指紋採取・プロファイリングに有用な syscalls(例:`mincore`, `cachestat`)を回避するための追加チューニングが施されています。Syscall ポリシーは、systemd のフィルターセットおよび OpenBSD の pledge モデルに着想を得た预先定義されたグループに分類されます:
- **POLICY Aio**: io_cancel, io_destroy, io_getevents, io_pgetevents, io_setup, io_submit
- **POLICY BasicIo**: read, readv, tee, vmsplice, write, writev, ioctl(一般的なストリーム/基本 I/O)
- **POLICY Clock**: clock_getres, clock_gettime, gettimeofday, time, times
- **POLICY CompatX86**: personality(古い ABI のエミュレーション), arch_prctl(x86 ファミリの ABI)
- **POLICY CompatDB32**: remap_file_pages;**POLICY CompatSystemd**: name_to_handle_at(マウント ID サポート用)
- **POLICY CompatWine**: modify_ldt
- **POLICY Credentials**: getegid, geteuid, getgid, getgroups, getresgid, getresuid, getuid
- **POLICY CredentialsExtra**: capget(プロセス間の関係性を照会するためのもの;主要な BPF を小さく保つため別扱い)
- **POLICY CredentialsMutation**: capset, setfsgid, setfsuid, setgid, setgroups, setregid, setresgid, setresuid, setreuid, setuid
- **POLICY CRuntime**: brk, exit, futex, mmap, getrandom(glibc の malloc 用)およびその他の C ランタイム関数
- **POLICY Debug**: kcmp, ptrace など。これらは既に YAMA や CAP_PERFMON などのカーネルの safeguard によって制御されています。
- **POLICY Filesystem**: access, open, stat, symlink, unlink および多数のファイル操作系コール
- **POLICY Process**: clone, execve, fork, getpid, kill, prctl, wait4 など、プロセス制御に関するオペレーション
管理者は、これらの事前に定義されたポリシーセットの中から、特定のワークロードの要件に合わせて選択し、必要に応じてそれらを組み合わせるか、独自の BPF プログラムを書くことで個別の要件を満たすことができます。この標準化された方法は、攻撃対象領域を大幅に縮小しながらも、厳格なセキュリティと現代的なアプリケーションの要求の両方をバランスよく満たします。
## Text to translate:
## Summary:
This document introduces customized seccomp policies enabling Docker containers to run securely as unprivileged users while retaining essential performance. The approach is heavily influenced by Docker's default profile, with additional tuning to avoid syscalls requiring root or useful for fingerprinting/profiling (e.g., `mincore`, `cachestat`). Syscall policies are categorized into predefined groups inspired by systemd's filter sets and OpenBSD's pledge model:
- **POLICY Aio**: io_cancel, io_destroy, io_getevents, io_pgetevents, io_setup, io_submit
- **POLICY BasicIo**: read, readv, tee, vmsplice, write, writev, ioctl (generic/stream/basic I/O)
- **POLICY Clock**: clock_getres, clock_gettime, gettimeofday, time, times
- **POLICY CompatX86**: personality (old ABI emulation), arch_prctl (x86-family ABI)
- **POLICY CompatDB32**: remap_file_pages; **POLICY CompatSystemd**: name_to_handle_at (mount-id support)
- **POLICY CompatWine**: modify_ldt
- **POLICY Credentials**: getegid, geteuid, getgid, getgroups, getresgid, getresuid, getuid
- **POLICY CredentialsExtra**: capget (for querying process relationships; kept separate to keep the main BPF small)
- **POLICY CredentialsMutation**: capset, setfsgid, setfsuid, setgid, setgroups, setregid, setresgid, setresuid, setreuid, setuid
- **POLICY CRuntime**: brk, exit, futex, mmap, getrandom (for glibc's malloc) and other C runtime functions
- **POLICY Debug**: kcmp, ptrace and similar; these are already gated by kernel safeguards such as YAMA or CAP_PERFMON.
- **POLICY Filesystem**: access, open, stat, symlink, unlink and many other file-operation syscalls
- **POLICY Process**: clone, execve, fork, getpid, kill, prctl, wait4 and similar process-control operations
Administrators can choose from these predefined policy sets tailored to specific workload needs, optionally combining them or writing custom BPF programs for unique requirements. This standardized method significantly reduces the attack surface while balancing strict security with modern application demands.