mirror of
https://github.com/luxfi/node.git
synced 2026-07-27 03:39:39 +00:00
node: scrub private-repo leakage from GPU bridges
OSS public node module must not reference the private GPU plugin implementation by repo name or filesystem path. Removes: - LUX_PRIVATE_GPU_KERNELS_DIR env vocabulary (use LUX_GPU_PLUGIN_DIR universal env) - Dev-tree probe paths to ~/work/lux-private/gpu-kernels/build/... (platformvm previously hardcoded 5 such paths in searchPaths()) - Prose mentions of "lux-private/gpu-kernels" in package comments Bridges affected: vms/platformvm, vms/thresholdvm. All 20 tests PASS post-scrub under both build tags. No functional behavior change — only path / env / prose. Requires chains v1.3.1 (chains/thresholdvm re-export target).
This commit is contained in:
@@ -64,30 +64,18 @@ func candidatePlugins() []pluginCandidate {
|
|||||||
// searchPaths returns the directories the loader probes for each
|
// searchPaths returns the directories the loader probes for each
|
||||||
// candidate basename. Order:
|
// candidate basename. Order:
|
||||||
//
|
//
|
||||||
// 1. LUX_GPU_PLUGIN_DIR — shared with every other VM (aivm, bridgevm, …).
|
// 1. LUX_GPU_PLUGIN_DIR — explicit override.
|
||||||
// 2. ~/work/lux-private/gpu-kernels/build/<flavor>_backend/ — dev tree.
|
// 2. /usr/local/lib/lux-gpu/ — prefix install.
|
||||||
// 3. /usr/local/lib/lux-gpu/ — prefix install.
|
// 3. /usr/lib/lux-gpu/.
|
||||||
// 4. /usr/lib/lux-gpu/.
|
// 4. Empty string ("" — let dlopen consult the system search path).
|
||||||
// 5. Empty string ("" — let dlopen consult the system search path).
|
|
||||||
//
|
//
|
||||||
// The empty-string fallback lets a plugin in DYLD_LIBRARY_PATH /
|
// The empty-string fallback lets a plugin in DYLD_LIBRARY_PATH /
|
||||||
// LD_LIBRARY_PATH still resolve, which is the standard CI override.
|
// LD_LIBRARY_PATH still resolve, which is the standard CI override.
|
||||||
func searchPaths() []string {
|
func searchPaths() []string {
|
||||||
out := make([]string, 0, 8)
|
out := make([]string, 0, 4)
|
||||||
if d := os.Getenv("LUX_GPU_PLUGIN_DIR"); d != "" {
|
if d := os.Getenv("LUX_GPU_PLUGIN_DIR"); d != "" {
|
||||||
out = append(out, d)
|
out = append(out, d)
|
||||||
}
|
}
|
||||||
if home, err := os.UserHomeDir(); err == nil {
|
|
||||||
// Match the lux-private/gpu-kernels Cmake out-of-tree
|
|
||||||
// convention: each backend lands in its own subdir.
|
|
||||||
out = append(out,
|
|
||||||
home+"/work/lux-private/gpu-kernels/build/cuda_backend",
|
|
||||||
home+"/work/lux-private/gpu-kernels/build/hip_backend",
|
|
||||||
home+"/work/lux-private/gpu-kernels/build/metal_backend",
|
|
||||||
home+"/work/lux-private/gpu-kernels/build/vulkan_backend",
|
|
||||||
home+"/work/lux-private/gpu-kernels/build/webgpu_backend",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
out = append(out, "/usr/local/lib/lux-gpu", "/usr/lib/lux-gpu", "")
|
out = append(out, "/usr/local/lib/lux-gpu", "/usr/lib/lux-gpu", "")
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// substrate for the P-Chain validator/stake/slashing/epoch transitions is
|
// substrate for the P-Chain validator/stake/slashing/epoch transitions is
|
||||||
// resolved at PROCESS START via dlopen/dlsym against the lux-gpu-kernels
|
// resolved at PROCESS START via dlopen/dlsym against the lux-gpu-kernels
|
||||||
// plugin DSOs. This keeps the node module compilable without
|
// plugin DSOs. This keeps the node module compilable without
|
||||||
// lux-private/gpu-kernels present in the build tree — the plugin is fully
|
// the lux GPU plugin present in the build tree — the plugin is fully
|
||||||
// optional and the chain runs the existing pure-Go path otherwise.
|
// optional and the chain runs the existing pure-Go path otherwise.
|
||||||
//
|
//
|
||||||
// Lookup order (handled by backend.go):
|
// Lookup order (handled by backend.go):
|
||||||
@@ -195,7 +195,7 @@ func (k GPUBackendKind) String() string {
|
|||||||
// + platformvm_gpu_layout.hpp byte-for-byte.
|
// + platformvm_gpu_layout.hpp byte-for-byte.
|
||||||
//
|
//
|
||||||
// The struct bytes Go hands to C MUST match the on-disk layout file at
|
// The struct bytes Go hands to C MUST match the on-disk layout file at
|
||||||
// ~/work/lux-private/gpu-kernels/ops/platformvm/op.yaml — every kernel reads
|
// the GPU plugin install tree ops/platformvm/op.yaml — every kernel reads
|
||||||
// them via reinterpret_cast. A silent layout shift produces consensus-divergent
|
// them via reinterpret_cast. A silent layout shift produces consensus-divergent
|
||||||
// state roots. init() refuses to load if any size drifts.
|
// state roots. init() refuses to load if any size drifts.
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
@@ -380,7 +380,7 @@ func init() {
|
|||||||
panic(fmt.Sprintf(
|
panic(fmt.Sprintf(
|
||||||
"platformvm: layout drift — Go sizeof(%s)=%d but on-device layout=%d. "+
|
"platformvm: layout drift — Go sizeof(%s)=%d but on-device layout=%d. "+
|
||||||
"Re-sync vms/platformvm/platformvm_gpu.go against "+
|
"Re-sync vms/platformvm/platformvm_gpu.go against "+
|
||||||
"~/work/lux-private/gpu-kernels/ops/platformvm/cuda/platformvm_kernels_common.cuh.",
|
"the GPU plugin install tree ops/platformvm/cuda/platformvm_kernels_common.cuh.",
|
||||||
c.name, c.got, c.want))
|
c.name, c.got, c.want))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
// TestNodeGPULayoutSizes pins the re-exported wire structs to the same
|
// TestNodeGPULayoutSizes pins the re-exported wire structs to the same
|
||||||
// device-side __align__(16) values declared in
|
// device-side __align__(16) values declared in
|
||||||
// ~/work/lux-private/gpu-kernels/ops/mpcvm/cuda/mpcvm_kernels_common.cuh.
|
// the GPU plugin install tree ops/mpcvm/cuda/mpcvm_kernels_common.cuh.
|
||||||
//
|
//
|
||||||
// Even though the structs are type aliases to chains/thresholdvm, this
|
// Even though the structs are type aliases to chains/thresholdvm, this
|
||||||
// test sits at the node import boundary — if upstream sizes drift the
|
// test sits at the node import boundary — if upstream sizes drift the
|
||||||
|
|||||||
Reference in New Issue
Block a user