Adds libc interceptors to the runtime library for the new
EfficiencySanitizer ("esan") family of tools. The interceptors cover
the memory operations in most common library calls and will be shared
among all esan tools.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/esan/esan_interceptors.cpp | ||
---|---|---|
130 ↗ | (On Diff #54653) | Use COMMON_INTERCEPTOR_WRITE_RANGE & COMMON_INTERCEPTOR_READ_RANGE |
137 ↗ | (On Diff #54653) | Is this "n" correct or should it be the same expression as next line? |
143 ↗ | (On Diff #54653) | msan_interceptor does this differently: (pseudocode) #if FREEBSD INTERCEPTOR(stat) #else INTERCEPTOR(__xstat) #endif. Is there a reason you always add 2 intercepts? |
lib/esan/esan_interceptors.cpp | ||
---|---|---|
137 ↗ | (On Diff #54653) | Both asan and tsan consider it to write the full passed-in size but read the min value, as I had it here (modeled after tsan). The full passed-in size should be addressable, but it should not be marked as written, so they both seem incorrect. It should be the next line, for purposes of what's actually written. I will send a separate CL to change tsan and asan (unless you know of reasons why they want the capacity and not the actual written value: for syscalls, DrMemory treats the capacity and written amount differently, but I'm not sure whether these sanitizers do something like that on libc calls and I don't see code for such separate handling at first glance). |
143 ↗ | (On Diff #54653) | This is precisely what tsan does. It looks incorrect. I will fix here and and have a separate CL for fixing tsan. It sounds like tsan wasn't the best one to use as a model, or that perhaps these should have been moved to the common pool first where the process would have compared to other sanitizers. There are several confusing differences between the tsan and msan interceptors though which will take effort to sort out: later. |
Normalize interceptors
Switches the esan interceptors to use the COMMON_INTERCEPTOR_ENTER and the
common read and write range routines with contexts, to match the common
interceptors and make it easier to move later.
Updates the stat interceptor to match msan instead of the
seemingly-incorrect tsan.
lib/esan/esan_interceptors.cpp | ||
---|---|---|
177 ↗ | (On Diff #54708) | should xstat64, lstat, lstat64 interceptors be structured the same way as stat? |
lib/esan/esan_interceptors.cpp | ||
---|---|---|
177 ↗ | (On Diff #54708) | Not for xstat64 or lstat64, no: they are simply not present on FreeBSD or Android so there is no #else. As to the !FreeBSD check of msan vs the !Android check of tsan, I suppose both should be there. For lstat + lxstat, yes, that does look like a similar thing to stat + xstat. |
Add FreeBSD checks to *stat64 and split lstat in a cleaner way.
Adds further improvements to the *stat interceptors, combining the
incomplete msan and tsan interceptors.