Skip to content

Commit cab3f42

Browse files
g-ortunoV8-internal LUCI CQ
authored andcommitted
chromium: Log target stdout and stderr on REPRL execution failures
Currently, when Fuzzilli fails to execute a script via the REPRL protocol (e.g., if the target fails to launch and send the HELO message, or crashes unexpectedly), the resulting error message is opaque (e.g., "Did not receive HELO message from child: Bad file descriptor"). Fuzzilli already captures the target's stdout and stderr in memory-mapped files by default, this change extracts those buffers and appends them to the Fuzzilli warning and error logs whenever `reprl_execute` fails. This surfaces the actual crash dump, missing dependencies, or startup errors directly in the logs, making debugging broken targets locally or on bots significantly easier. Bug: 492209808 Change-Id: If94fc9eadc97645ab240f648b7e6cf42378d091e Reviewed-on: https://chrome-internal-review.googlesource.com/c/v8/fuzzilli/+/9095283 Auto-Submit: Giovanni Ortuño Urquidi <ortuno@google.com> Reviewed-by: Matthias Liedtke <mliedtke@google.com> Commit-Queue: Matthias Liedtke <mliedtke@google.com>
1 parent b3dcb49 commit cab3f42

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

Sources/Fuzzilli/Execution/REPRL.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ public class REPRL: ComponentBase, ScriptRunner {
113113
// If we fail, we retry after a short timeout and with a fresh instance. If we still fail, we give up trying
114114
// to execute this program. If we repeatedly fail to execute any program, we abort.
115115
if status < 0 {
116-
logger.warning("Script execution failed: \(String(cString: reprl_get_last_error(reprlContext))). Retrying in 1 second...")
116+
let errorMsg = String(cString: reprl_get_last_error(reprlContext))
117+
logger.warning("Script execution failed: \(errorMsg). Retrying in 1 second...")
117118
if fuzzer.config.enableDiagnostics {
118119
fuzzer.dispatchEvent(fuzzer.events.DiagnosticsEvent, data: (name: "REPRLFail", content: scriptBuffer.data(using: .utf8)!))
119120
}
@@ -123,7 +124,16 @@ public class REPRL: ComponentBase, ScriptRunner {
123124
}
124125

125126
if status < 0 {
126-
logger.error("Script execution failed again: \(String(cString: reprl_get_last_error(reprlContext))). Giving up")
127+
let errorMsg = String(cString: reprl_get_last_error(reprlContext))
128+
let stderr = String(cString: reprl_fetch_stderr(reprlContext)).trimmingCharacters(in: .whitespacesAndNewlines)
129+
let stdout = String(cString: reprl_fetch_stdout(reprlContext)).trimmingCharacters(in: .whitespacesAndNewlines)
130+
let childOutput = """
131+
stderr:
132+
\(stderr.isEmpty ? "<no output>" : stderr)
133+
stdout:
134+
\(stdout.isEmpty ? "<no output>" : stdout)
135+
"""
136+
logger.error("Script execution failed again: \(errorMsg). Giving up\n\(childOutput)")
127137
// If we weren't able to successfully execute a script in the last N attempts, abort now...
128138
recentlyFailedExecutions += 1
129139
if recentlyFailedExecutions >= 10 {

0 commit comments

Comments
 (0)