コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
3. 制限を調整
サンドボックス ポリシーは、Sandboxee が特定のシステムコールを呼び出さないようにして、攻撃対象領域を縮小します。ただし、攻撃者はプロセスを無期限に実行したり、RAM などのリソースを枯渇させたりして、望ましくない結果を引き起こす可能性があります。
この脅威に対処するために、Sandboxee はデフォルトで厳しい実行制限のもとで実行されます。これらのデフォルトの制限が原因でプログラムの正当な実行に問題が生じる場合は、sandbox2::Limits
クラスを使用してエグゼキュータ オブジェクトに対して limits()
を呼び出すことで制限を調整できます。
以下のコード スニペットは、上限の調整の例を示しています。使用可能なすべてのオプションは、limits.h ヘッダー ファイルに記載されています。
// Restrict the address space size of the sandboxee to 4 GiB.
executor->limits()->set_rlimit_as(4ULL << 30);
// Kill sandboxee with SIGXFSZ if it writes more than 1 GiB to the filesystem.
executor->limits()->set_rlimit_fsize(1ULL << 30);
// Number of file descriptors which can be used by the sandboxee.
executor->limits()->set_rlimit_nofile(1ULL << 10);
// The sandboxee is not allowed to create core files.
executor->limits()->set_rlimit_core(0);
// Maximum 300s of real CPU time.
executor->limits()->set_rlimit_cpu(300);
// Maximum 120s of wall time.
executor->limits()->set_walltime_limit(absl::Seconds(120));
sandbox2::Limits
クラスの使用例については、ツールの例をご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2023-12-06 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2023-12-06 UTC。"],[[["Sandboxee execution is restricted by default to minimize potential harm from malicious code."],["Sandbox2 provides the `Limits` class to adjust resource limits like address space size, file size, and CPU time, allowing customization for specific program needs."],["Developers can fine-tune resource constraints using methods like `set_rlimit_as` or `set_rlimit_cpu` for more control over the Sandboxee's behavior."],["Refer to the `limits.h` header file for detailed documentation on all available limit options and their functionalities."]]],[]]