{"record":{"id":"99e99131ca35f1f4","repo":"openai/codex","slug":"permission-profiles-requiring-direct-runtime-enfor","errorCode":null,"errorMessage":"permission profiles requiring direct runtime enforcement are incompatible with --use-legacy-landlock","messagePattern":"permission profiles requiring direct runtime enforcement are incompatible with --use-legacy-landlock","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"codex-rs/linux-sandbox/src/linux_run_main.rs","lineNumber":391,"sourceCode":"}\n\nfn ensure_inner_stage_mode_is_valid(apply_seccomp_then_exec: bool, use_legacy_landlock: bool) {\n    if apply_seccomp_then_exec && use_legacy_landlock {\n        panic!(\"--apply-seccomp-then-exec is incompatible with --use-legacy-landlock\");\n    }\n}\n\nfn ensure_legacy_landlock_mode_supports_policy(\n    use_legacy_landlock: bool,\n    file_system_sandbox_policy: &FileSystemSandboxPolicy,\n    network_sandbox_policy: NetworkSandboxPolicy,\n    sandbox_policy_cwd: &Path,\n) {\n    if use_legacy_landlock\n        && file_system_sandbox_policy\n            .needs_direct_runtime_enforcement(network_sandbox_policy, sandbox_policy_cwd)\n    {\n        panic!(\n            \"permission profiles requiring direct runtime enforcement are incompatible with --use-legacy-landlock\"\n        );\n    }\n}\n\nfn run_bwrap_with_proc_fallback(\n    sandbox_policy_cwd: &Path,\n    command_cwd: Option<&Path>,\n    file_system_sandbox_policy: &FileSystemSandboxPolicy,\n    network_sandbox_policy: NetworkSandboxPolicy,\n    inner: Vec<String>,\n    mount_proc: bool,\n    allow_network_for_proxy: bool,\n) -> ! {\n    let network_mode = bwrap_network_mode(network_sandbox_policy, allow_network_for_proxy);\n    let mut mount_proc = mount_proc;\n    let command_cwd = command_cwd.unwrap_or(sandbox_policy_cwd);\n","sourceCodeStart":373,"sourceCodeEnd":409,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/linux-sandbox/src/linux_run_main.rs#L373-L409","documentation":"Legacy Landlock mode was selected, but the resolved permission policy requires direct runtime enforcement that legacy mode cannot provide. This guard in ensure_legacy_landlock_mode_supports_policy fires when the filesystem policy needs_direct_runtime_enforcement given the network policy — i.e. split-mode rules that only the bwrap-based stages can enforce — so running with --use-legacy-landlock would silently under-sandbox.","triggerScenarios":"Thrown at codex-rs/linux-sandbox/src/linux_run_main.rs:391 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Drop --use-legacy-landlock so the bwrap-based enforcement path is used","Choose a permission profile whose filesystem policy is compatible with legacy Landlock","Update the kernel/landlock ABI so the non-legacy path is available"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}