diff options
| author | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-09-23 07:05:45 -0400 |
|---|---|---|
| committer | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-09-23 07:05:45 -0400 |
| commit | 54ca82d81bacb56197a607d0039ca6a015f5ac44 (patch) | |
| tree | 355be543e9da05468c5c0003ff7ddb60944221ec /userspace/cuda/570.144/scripts/ghidra_analyze.sh | |
| parent | 893318f45eff1a2b5f4d554297d08a9e987c2a52 (diff) | |
| download | open-iov-54ca82d81bacb56197a607d0039ca6a015f5ac44.tar.gz open-iov-54ca82d81bacb56197a607d0039ca6a015f5ac44.zip | |
userspace/cuda: libcuda analysis tree (debug-focused), guest ioctl tracer
Analysis tooling for debugging CUDA execution in Open-IOV guests:
- userspace/cuda/570.144/: fetch a library from a running guest (nc),
objdump helpers, crash ip -> file vaddr + symbol mapping, and Ghidra
headless import/analysis/decompile scripts (project kept so single
functions decompile in seconds). The purpose is debugging correctness
and performance of CUDA in Open-IOV VMs (not a reimplementation);
extracted binaries and decompiled output are gitignored.
- tools/guest-diag/ioctl_trace.c: ptrace tracker for the NVIDIA driver
ioctls of a child (libcuda issues raw syscalls, so LD_PRELOAD sees
nothing). Decodes RM_ALLOC (class) and RM_CONTROL (cmd) arguments;
this is how the cuCtxCreate crash sequence was captured.
- tools/test/cuda_drv_test.c: unbuffered + per-call markers so a crash
identifies the CUDA call it happened in.
Diffstat (limited to 'userspace/cuda/570.144/scripts/ghidra_analyze.sh')
| -rwxr-xr-x | userspace/cuda/570.144/scripts/ghidra_analyze.sh | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/userspace/cuda/570.144/scripts/ghidra_analyze.sh b/userspace/cuda/570.144/scripts/ghidra_analyze.sh new file mode 100755 index 0000000..b844300 --- /dev/null +++ b/userspace/cuda/570.144/scripts/ghidra_analyze.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# +# ghidra_analyze.sh - import a library into a Ghidra project and run the full +# auto-analysis once. The project is kept, so later decompilations are cheap: +# +# scripts/ghidra_decompile_project.sh <hex-vaddr> [outfile] +# +# Full analysis of a ~70 MB library can take a long time; run it in the +# background and log to run/ghidra-analyze.log. +# +# Usage: scripts/ghidra_analyze.sh <binary> +# env: GHIDRA_HOME (default /snap/ghidra/current/ghidra) +# PROJECT_DIR (default ../run/ghidra-proj) +# PROJECT_NAME (default cuda-analysis) +set -e + +HERE="$(cd "$(dirname "$0")" && pwd)" +ROOT="$(cd "$HERE/.." && pwd)" +RUN="$ROOT/run" +BIN="${1:?usage: $0 <binary>}" + +GHIDRA_HOME="${GHIDRA_HOME:-/snap/ghidra/current/ghidra}" +ANALYZE="$GHIDRA_HOME/support/analyzeHeadless" +PROJECT_DIR="${PROJECT_DIR:-$RUN/ghidra-proj}" +PROJECT_NAME="${PROJECT_NAME:-cuda-analysis}" + +[ -x "$ANALYZE" ] || { echo "analyzeHeadless not found at $ANALYZE"; exit 1; } +mkdir -p "$PROJECT_DIR" + +echo "[*] importing + analyzing $BIN (this can take a long time)" +"$ANALYZE" "$PROJECT_DIR" "$PROJECT_NAME" \ + -import "$BIN" \ + -overwrite \ + -scriptPath "$ROOT/ghidra" \ + -analysisTimeoutPerFile 0 +echo "[ok] analysis complete"
\ No newline at end of file |
