﻿# Trace the CUDA library actually loaded by a process

Establish the loaded object identity in the actual worker before inferring CUDA library provenance from installed files.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/guide-linux-library-loader/
Language: en

The serving image contains the expected CUDA library, yet a running worker uses another copy. Installed files, loader candidates and loaded objects are different evidence. Establish which shared object the actual process mapped before changing a global search path or treating a package inventory as proof of runtime provenance.

## Identify the process and library role

Record the final worker, its executable, relevant namespace and the exact shared-object name involved in the error. Runtime, driver-facing and application libraries have different roles. A version printed by a convenient command does not identify every object used by a long-lived model process. Keep observations attached to the failing invocation rather than a newly launched diagnostic shell.

## Read loader resolution conditions

The dynamic loader documents search behavior involving the dependency form, embedded paths, applicable environment, cache and default directories. The rules also differ in secure execution. Do not summarize this as a universal instruction to prepend one directory. Preserve the actual launch conditions and whether the application loads a component later rather than only through initial dependencies.

## Inspect mapped object identity

Authorized mapping metadata can show the library's mapped path, device and inode. Compare that object with the intended package or image content in the process's mount view. A pathname changed after launch does not retarget an existing mapping. Multiple mappings can belong to one shared object, so avoid treating each region as a separate installed library.

## Attribute a resolved address carefully

Within a controlled diagnostic implementation, dladdr can associate an address with a loaded object and symbol information. The documented procedure-linkage-table caveat means an arbitrary function pointer is not always the definitive target one expects. Use the supported method and retain its limitations. Neither a filesystem search nor a symbol name alone establishes which implementation executed the failing operation.

## Verify the corrected launch

In an isolated equivalent, change one justified launch condition and observe the loaded identity again before exercising a bounded model operation. Acceptance means the intended object is used under recorded conditions. It does not prove ABI compatibility, driver health, future late-loaded dependencies or correctness of the model merely because one selected library now comes from the expected location.

## Primary references

[Linux Dynamic Loader](https://man7.org/linux/man-pages/man8/ld.so.8.html).

[Process Memory Mappings](https://man7.org/linux/man-pages/man5/proc_pid_maps.5.html).

[Loaded Shared-object Address Information](https://man7.org/linux/man-pages/man3/dladdr.3.html).

Related reading: [Reproducible inference stacks: preserving a GPU pilot’s result](/journal/software-stack-reproducibility/); [GPU containers or virtual machines: what to check before deployment](/journal/gpu-containers-vs-vms/).
