Repository navigation
Commit b420ee9
committed
fix(test): the host KAT punned its result type, and LP64 made it matter
`run_grind` declared its result `uint64_t` and handed the address to the kernel
as `volatile unsigned long long *`. Those are the same type on Darwin/arm64 and
different types of the same width on LP64 glibc, so on Linux the cast
type-punned; with `#include "rpx.cu"` putting the whole kernel in this
translation unit, GCC 13.3 at -O2 was free under TBAA to assume a write through
`unsigned long long *` could not touch an `unsigned long`, and to keep `result`
in a register across the inlined call.
It did. `run_grind` returned UINT64_MAX for every input, so layer 8's two checks
per vector that expect the SENTINEL passed VACUOUSLY while the two that expect a
found nonce failed. Six rows, at every sha back to the gated base c00342c, on
a target that passes on a clang/arm64 laptop where the two types coincide.
Measured on the box at this sha:
-O2 6 FAILURE(S)
-O2 -fno-strict-aliasing ALL HOST KAT CHECKS PASS
-O0 ALL HOST KAT CHECKS PASS
None of it was ever a statement about the device grind. This file is a HOST
replay of the kernel source through `cuda_host_shim.h` — no nvcc, no cubin, no
device — so the defect was in the harness holding the result, not in the kernel
it tests. The production path re-validates every device nonce with the host
predicate, and the block pins read `host fallbacks 0` throughout.
`crypto/math-cuda/tests/host_kat/` holds exactly one instance of the pattern and
this is it: the shim's `atomicMin` takes `unsigned long long *` as a parameter,
and the kernels' casts there only drop `volatile` from an already-matching type.
Test-only; no production code and no proof bytes move. It also unblocks this
lineage's CI `host-kat` job, which has been failing since the device grind
landed.
(cherry picked from commit 90a38ec)1 parent 05f0500 commit b420ee9
1 file changed
Lines changed: 25 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1097 | 1097 | | |
1098 | 1098 | | |
1099 | 1099 | | |
1100 | | - | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
1101 | 1125 | | |
1102 | 1126 | | |
1103 | 1127 | | |
| |||
0 commit comments