diff --git a/cmake/tests-gpu-hold.cmake b/cmake/tests-gpu-hold.cmake index 32c4deb1e..e1f63f6f7 100644 --- a/cmake/tests-gpu-hold.cmake +++ b/cmake/tests-gpu-hold.cmake @@ -57,3 +57,9 @@ add_test(NAME gpu_hold_group # resolve under DIFFERENT bases, so two callers could each hold a token and both run GPU work. Asserts the two # resolve under one base in all three states, plus that the script's two predicates are textually identical. add_test(NAME gpu_hold_hold_dir COMMAND bash ${CMAKE_SOURCE_DIR}/tests/gpu_hold_hold_dir_test.sh ${CMAKE_SOURCE_DIR}/scripts/gpu-hold) + +# The holder can PROVE it holds the ticket. `[ -e "$TOKEN" ]` is true whenever ANY lane holds the box, so a guard built +# on it passes exactly when starting work is most harmful - measured 2026-11-14, when a lane's runner served on the GPU +# for 40 s inside another lane's 45-minute hold. gpu-hold exports the exact token line it wrote (GPU_HOLD_TICKET) and the +# label, and this asserts the child sees both, on a sandboxed HOME. +add_test(NAME gpu_hold_child_identity COMMAND bash ${CMAKE_SOURCE_DIR}/tests/gpu_hold_child_identity_test.sh ${CMAKE_SOURCE_DIR}/scripts/gpu-hold) diff --git a/scripts/gpu-hold b/scripts/gpu-hold index e7a819737..4a0883aa3 100755 --- a/scripts/gpu-hold +++ b/scripts/gpu-hold @@ -345,7 +345,13 @@ set -m # `while read m; do gpu-hold -- bench "$m"; done < list`: without `set -m` the loop runs every entry, with `set -m` the # first payload's `cat` swallows the rest and the sweep silently runs once. Background jobs on `main` already got # /dev/null (a non-interactive shell's rule), so this keeps that semantic and takes only the process group. -"$@" < /dev/null & +# A child cannot otherwise prove it is the HOLDER rather than a bystander: `[ -e "$TOKEN" ]` is true whenever ANY lane +# holds the box, so a guard written with it passes exactly when starting work is most harmful (measured 2026-11-14: my +# own runner did that for 40 s against another lane's 45-minute ticket). The token's content is what this run wrote, so +# give it to the child - exact, not a string guess: +# GPU_HOLD_TICKET the exact line in the token file ("gpu-hold