[PATCH] D39124: Add NetBSD improvements in sanitizers

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 23 07:47:30 PDT 2017


dvyukov added inline comments.


================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:452
+#if SANITIZER_NETBSD
+  int res = internal_syscall_ptr(SYSCALL(nanosleep), &ts, &ts);
+#else
----------------
krytarowski wrote:
> dvyukov wrote:
> > krytarowski wrote:
> > > dvyukov wrote:
> > > > nanosleep declared as returning int, why is this syscall_ptr?
> > > `_ptr` here means that input arguments are pointers.
> > I see.
> > Is it possible to use syscall64 (__syscall) for all syscalls?
> Not in a portable way across architectures.
This just looks messy code-wise and additional maintenance burden (e.g. we change the !NETBSD case, but forgot to update the NETBSD case):

```
#if SANITIZER_NETBSD
  return internal_syscall_ptr(SYSCALL(execve), (uptr)filename, (uptr)argv,
                          (uptr)envp);
#else
  return internal_syscall(SYSCALL(execve), (uptr)filename, (uptr)argv,
                          (uptr)envp);
#endif
```

What do you think about introducing internal_syscall/syscall64/syscall_ptr for all OSes?


Repository:
  rL LLVM

https://reviews.llvm.org/D39124





More information about the llvm-commits mailing list