{"record":{"id":"7cf68cf5624027ad","repo":"openai/codex","slug":"invalid-bundled-bubblewrap-fd-path-err","errorCode":null,"errorMessage":"invalid bundled bubblewrap fd path: {err}","messagePattern":"invalid bundled bubblewrap fd path: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"codex-rs/linux-sandbox/src/bundled_bwrap.rs","lineNumber":52,"sourceCode":"\nimpl BundledBwrapLauncher {\n    pub(crate) fn exec(&self, argv: Vec<String>, preserved_files: Vec<File>) -> ! {\n        let bwrap_file = File::open(self.program.as_path()).unwrap_or_else(|err| {\n            panic!(\n                \"failed to open bundled bubblewrap {}: {err}\",\n                self.program.as_path().display()\n            )\n        });\n        if let Err(err) = verify_digest(&bwrap_file, expected_sha256(), self.program.as_path()) {\n            eprintln!(\"{err}\");\n            std::process::exit(crate::BUNDLED_BWRAP_DIGEST_VERIFICATION_FAILURE_EXIT_CODE);\n        }\n\n        make_files_inheritable(&preserved_files);\n\n        let fd_path = format!(\"/proc/self/fd/{}\", bwrap_file.as_raw_fd());\n        let program_cstring = CString::new(fd_path.as_str())\n            .unwrap_or_else(|err| panic!(\"invalid bundled bubblewrap fd path: {err}\"));\n        let cstrings = argv_to_cstrings(&argv);\n        let mut argv_ptrs: Vec<*const c_char> = cstrings\n            .iter()\n            .map(CString::as_c_str)\n            .map(CStr::as_ptr)\n            .collect();\n        argv_ptrs.push(std::ptr::null());\n\n        // SAFETY: `program_cstring` and every entry in `argv_ptrs` are valid C\n        // strings for the duration of the call. On success `execv` does not return.\n        unsafe {\n            libc::execv(program_cstring.as_ptr(), argv_ptrs.as_ptr());\n        }\n        let err = std::io::Error::last_os_error();\n        panic!(\n            \"failed to exec bundled bubblewrap {} via {fd_path}: {err}\",\n            self.program.as_path().display()\n        );","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/linux-sandbox/src/bundled_bwrap.rs#L34-L70","documentation":"After digest verification, exec() runs bwrap through its /proc/self/fd/{fd} path so the exact verified file (not a re-resolvable path) is executed. That generated path is converted to a CString; the panic fires only if the string contains an interior NUL byte, which is impossible for the literal prefix /proc/self/fd/ followed by a decimal fd number. It is a defensive assertion guarding an effectively unreachable condition.","triggerScenarios":"Not reachable through normal API use: the fd path is synthesized from a raw descriptor number. A hit indicates memory corruption, a patched/incompatible runtime, or a corrupted build rather than caller error.","commonSituations":"None in practice; would only surface under fuzzing, binary corruption, or a runtime tampering with format!/CString internals.","solutions":["Treat as an environment or binary integrity failure: rebuild from clean sources and re-verify the installation.","Report upstream with the exact panic message and platform details; no correct caller code can trigger this path."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Defensive: reject paths with interior NUL bytes before any exec-style API\nfn cstring_safe(s: &str) -> bool {\n    !s.contains('\\u{0}')\n}\nassert!(cstring_safe(program_path.to_str().unwrap_or(\"\")));","typeGuard":"fn is_cstring_safe(s: &str) -> bool { !s.contains('\\u{0}') }","tryCatchPattern":null,"preventionTips":["No caller-side action can trigger this panic; it guards an impossible condition.","Keep toolchain and binary provenance verifiable (reproducible builds) so corruption is detectable."],"tags":["rust","linux","sandbox","c-string","panic","unreachable"],"backgroundTag":"nul-byte-in-path","analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}