-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hook: Add conditional library initialization in cuGetProcAddress()
initialize_libnvshare() is our bootstrapping function, which, among others, obtains the original CUDA function addresses needed for our hook logic. We currently only call initialize_libnvshare() when the user application makes its first call to cuInit(), which we assume is **always** the first CUDA Driver API function that it makes. However, CUDA >=11.3 applications that use the Runtime API call cuGetProcAddress() before cuInit(), which means that in these cases cuGetProcAddress() is the first function called. So far we were lucky, as the first call that such apps make is cuGetProcAddress("cuInit"), which falls into our custom handling cases and does not invoke the original cuGetProcAddress() to which we don't have a pointer, as we haven't bootstrapped CUDA yet. To address the aforementioned case and avoid potential NULL pointer dereferences, add a one-time call to initialize_libnvshare() in cuGetProcAddress(). Signed-off-by: Xinyuan Lyu <[email protected]> Reviewed-by: George Alexopoulos <[email protected]>
- Loading branch information
1 parent
67bed3f
commit d56dc01
Showing
1 changed file
with
23 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters