saddam1412 / cuda-waste

Automatically exported from code.google.com/p/cuda-waste
0 stars 0 forks source link

DLL injection fails with explicit LoadLibrary call before CUDA call #4

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Running Waste on this input fails:

//#include <iostream>
#include <stdio.h>
#include <Windows.h>

__global__ void fun(int * mem)
{
    *mem = 1;
}

int main()
{
    char * c = "wrapper.dll";
    LoadLibraryA(c);
    void * p = &LoadLibraryA;
    void * q = LoadLibraryA;

    int h = 0;
    int * d;
    cudaMalloc(&d, sizeof(int));
    cudaMemcpy(d, &h, sizeof(int), cudaMemcpyHostToDevice);
    fun<<<1,1>>>(d);
    cudaThreadSynchronize();
    int rv = cudaGetLastError();
    cudaMemcpy(&h, d, sizeof(int), cudaMemcpyDeviceToHost);
    printf("Result = %d\n", h);
    //std::cout << "Result = " << h << "\n";
    return 0;
}

Original issue reported on code.google.com by Ken.Dom...@gmail.com on 24 May 2013 at 9:24

GoogleCodeExporter commented 8 years ago
This problem was associated with the call stack overflow problem, which was 
fixed.

Original comment by Ken.Dom...@gmail.com on 31 May 2013 at 2:16