GOTCHA icon indicating copy to clipboard operation
GOTCHA copied to clipboard

Fix for not wrapping a function for a different Wrappee.

Open hariharan-devarajan opened this issue 2 years ago • 2 comments

In cases, like in OpenCL, the main library (OpenCL) acts as a wrapper for other implementations (libamdocl64.so). In this case both have same function names implemented. If we wrap OpenCL functions with gotcha which dynamically loads libamdocl64.so with same function name, we should not return a wrapper meant to intercept OpenCL. So we should check if the wrapper given to the caller of dlsym is for the same wrappee as requested by the caller.

Fixes #146. @bertwesarg So essentially, what was happening is

When u call gotcha_wrap, u wrapped the clGetExtensionFunctionAddress function within libOpenCL.so.

Now the OpenCL, dlopen libamdocl64.so and did a dlsym for clGetExtensionFunctionAddress. GOTCHA was returning the wrapper for libOpenCL.so.

The fix essentially adds a check to make sure we return the wrapper for the function we wrapped. Let me know if this works.

hariharan-devarajan avatar Apr 19 '24 06:04 hariharan-devarajan

Pull Request Test Coverage Report for Build 9297202239

Details

  • 7 of 7 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 9297145788: 0.0%
Covered Lines: 1008
Relevant Lines: 1008

💛 - Coveralls

coveralls avatar Apr 22 '24 16:04 coveralls

@bertwesarg did u get a change to look at this PR? Does this cover all the cases you need for #146

hariharan-devarajan avatar May 16 '24 22:05 hariharan-devarajan

I will give this PR a last test in my use case and will approve then

bertwesarg avatar Jun 03 '24 09:06 bertwesarg

I will give this PR a last test in my use case and will approve then

LGTM

bertwesarg avatar Jun 03 '24 12:06 bertwesarg