[PATCH] D56099: [Sanitizer] Add fstab api to FreeBSD

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 27 08:01:01 PST 2018


krytarowski added inline comments.


================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:8030
 
+#if SANITIZER_INTERCEPT_FSTAB
+INTERCEPTOR(struct __sanitizer_fstab *, getfsent) {
----------------
Can you relocate it at the end of list of interceptors?


================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:8037
+    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ret, struct_fstab_sz);
+
+  return ret;
----------------
Drop empty line.


================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:8045
+  if (spec)
+    COMMON_INTERCEPTOR_READ_RANGE(ctx, spec, strlen(spec));
+  struct __sanitizer_fstab *ret = REAL(getfsspec)(spec);
----------------
`REAL()` for strlen.


================
Comment at: lib/sanitizer_common/sanitizer_platform_limits_freebsd.h:632
+
+  struct __sanitizer_fstab {
+    char *fs_spec;
----------------
Do we need definition of this struct? It does not seem to be used.


================
Comment at: test/sanitizer_common/TestCases/FreeBSD/fstab.cc:9
+
+void test_getfstab() {
+  struct fstab *fentry, *pentry, *wentry;
----------------
Please merge it with main(), as there is only a single test.


================
Comment at: test/sanitizer_common/TestCases/FreeBSD/fstab.cc:15
+  setfsent();
+  fentry = getfsent();
+
----------------
`struct fstab *fsentry = getfsent();`, similar in other places


================
Comment at: test/sanitizer_common/TestCases/FreeBSD/fstab.cc:25
+  assert(wentry);
+  assert(memcmp(fentry, wentry, sizeof(*wentry)) == 0);
+  assert(memcmp(pentry, wentry, sizeof(*pentry)) == 0);
----------------
replace `== 0` with `!`


Repository:
  rCRT Compiler Runtime

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

https://reviews.llvm.org/D56099





More information about the llvm-commits mailing list