[PATCH] D54076: Add interceptors for the sysctl(3) API family from NetBSD

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 7 17:54:16 PST 2018


krytarowski added inline comments.


================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:7376
+
+INTERCEPTOR(void *, asysctlbyname, const char *sname, SIZE_T *len) {
+  void *ctx;
----------------
vitalybuka wrote:
> > The asysctl() and asysctlbyname() functions are wrappers for sysctl() and
> > sysctlbyname().  They return memory allocated with malloc(3) and resize
> > the buffer in a loop until all data fits.
> 
> if so we should not intercept asysctl and  asysctlbyname
They are not macro wrappers, but rather complex standalone code.

https://nxr.netbsd.org/xref/src/lib/libc/gen/asysctl.c

`asysctlbyname` will break because `int name[CTL_MAXNAME];` and `u_int namelen` will be unknown to sanitizers.

Trying to skip `asysctl` will be risky too, it might work but I will feel safer with an interceptor.


Repository:
  rL LLVM

https://reviews.llvm.org/D54076





More information about the llvm-commits mailing list