SVF icon indicating copy to clipboard operation
SVF copied to clipboard

Specifying sources and sinks for saber

Open enochii opened this issue 11 months ago • 0 comments
trafficstars

Hi, I am using saber to detect memory leaks. I notice that some programs may use operator new and operator delete to allocate and deallocate memory. It seems like currently saber does not support them (https://github.com/SVF-tools/SVF/blob/master/svf/lib/SABER/SaberCheckerAPI.cpp#L51).

Moreover, after compilation, the name mangling mechanism may modify the name of specific API. For instance, in my case, operator new and operator delete are replaced by _Znwm and _ZdlPv.

!56597 = !DISubprogram(name: "operator new", linkageName: "_Znwm", scope: !56598, file: !56598, line: 120, type: !56599, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !421)
...
!56601 = !DISubprogram(name: "operator delete", linkageName: "_ZdlPv", scope: !56598, file: !56598, line: 124, type: !4745, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !421)

A possible workaround is adding _Znwm and _ZdlPv to ei_pairs in https://github.com/SVF-tools/SVF/blob/master/svf/lib/SABER/SaberCheckerAPI.cpp#L51.

Is there any other way to sidestep this mechanism? I guess it would be convenient that saber can automatically transform these mangled names to the original ones to enable effective detection. Another suggestion is to use a specification file (e.g., x.json) to replace the hard-coded ei_pairs array.

enochii avatar Dec 18 '24 11:12 enochii