[PATCH] D55167: Add a new interceptors for cdbr(3) and cdbw(3) API from NetBSD

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 10 13:26:49 PST 2018


vitalybuka added a comment.

In D55167#1324855 <https://reviews.llvm.org/D55167#1324855>, @joerg wrote:

> I don't see why this interceptor needs to know about the internals of `struct cdbr` or `struct cdbw` at all. They are fully opaque. All memory accessed by users is explicitly sized as argument to the functions or returned with the size.


Then we give up on TSAN check of fieds, or msan check if caller will try to read particular fields



================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:8520
+  if (cdbr)
+    COMMON_INTERCEPTOR_READ_RANGE(ctx, cdbr, sizeof(*cdbr));
+  if (key)
----------------
Why is this enough?
Are those pointers always point inside of __sanitizer_cdbr?
e.g. __sanitizer_cdbr::hash_base

If not than we are going to hide those accesses from TSAN and miss races.
Or if callers will read by those pointers, MSAN may falsely detect uninitialized values.


================
Comment at: lib/sanitizer_common/sanitizer_platform_limits_netbsd.h:2259
+  void (*unmap)(void *, void *, uptr);
+  void *cookie;
+  u8 *mmap_base;
----------------
if it is not sanitizing the fields, should the struct be replaced with __sanitizer_cdbr_sz?


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55167/new/

https://reviews.llvm.org/D55167





More information about the llvm-commits mailing list