This patch addresses https://github.com/google/sanitizers/issues/804. Users can use mcheck and mprobe functions to verify heap state so we should intercept them to avoid breakage of valid code.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/lsan/lsan_interceptors.cc | ||
---|---|---|
197 ↗ | (On Diff #96900) | We don't seem to use enum at all (except for "return MCHECK_OK" which can be replaced with "return 0"). |
lib/lsan/lsan_interceptors.cc | ||
---|---|---|
197 ↗ | (On Diff #96900) | Ok, if you think that it would be cleaner to just use 0 here I don't mind. |
Right, we need mcheck_pedantic as well. I'm not sure about mcheck_check_all since it checks all chunks allocated by Glibc and this is probably fine. Should we add it for consistency?
From man, "The mcheck_pedantic() and mcheck_check_all() functions are available since glibc 2.2. The mcheck() and mprobe() functions are present since at least glibc 2.0". What about systems < 2.0? I guess, __GLIBC_PREREQ is required here.
lib/sanitizer_common/sanitizer_common_interceptors.inc | ||
---|---|---|
6157 ↗ | (On Diff #96958) | I think INIT_MCHECK_MPROBE is simply unnecessary if we don't use REAL(mcheck). Compare with asan_malloc_linux.cc. And we don't need to care about glibc version then. |
lib/sanitizer_common/sanitizer_common_interceptors.inc | ||
---|---|---|
6157 ↗ | (On Diff #96958) | Here, yes, but the test still need the version check for check_pedantic, right? We had this problem with getauxval, there're bots running on glibc 2.13. |
lib/sanitizer_common/sanitizer_common_interceptors.inc | ||
---|---|---|
6157 ↗ | (On Diff #96958) | Yes. |