[PATCH] D19875: [sanitizer] Move stat/__xstat to the common interceptors

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Tue May 3 12:29:04 PDT 2016


eugenis added inline comments.

================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:5527
@@ +5526,3 @@
+  int res = REAL(stat)(path, buf);
+  if (!res)
+    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, __sanitizer::struct_stat_sz);
----------------
zhaoqin wrote:
> should I add flags check here too?
> I feel that the write cannot be skipped for correctness, e.g., msan mark buffer as defined.
Write is necessary for msan.
Ideally, if intercept_stat==0, MSan should do WRITE_RANGE, and other sanitizers should do nothing.
Maybe these flags should be handled differently. MSan already has logic for disabling checks in nested interceptors, see MSanInterceptorContext::in_interceptor_scope. Setting that to true disables all checks, but keeps writes (i.e. msan_unpoison calls) enabled. If something like that is implemented in other sanitizers, then intercept_stat could just set this (or similar) flag in COMMON_INTERCEPTOR_ENTER.

For now just keep the WRITE_RANGE unconditionally.



Repository:
  rL LLVM

http://reviews.llvm.org/D19875





More information about the llvm-commits mailing list