pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

compiler-rt-netbsd: Improve the kvm(3) handling



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Mon Jan 22 14:16:25 2018 +0100
Changeset:	4bd423d662eb3a6f20e9e78dbcf13a5ceded79b9

Modified Files:
	compiler-rt-netbsd/distinfo
	compiler-rt-netbsd/patches/patch-include_sanitizer_netbsd__syscall__hooks.h
	compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__common__interceptors.inc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__netbsd__interceptors__ioctl.inc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__netbsd__syscalls.inc
	compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_strlcat.cc
	compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_strlcpy.cc
	compiler-rt-netbsd/patches/patch-utils_generate__netbsd__ioctls.awk
	compiler-rt-netbsd/patches/patch-utils_generate__netbsd__syscalls.awk
Added Files:
	compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_kvm__open.cc
	compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_kvm__openfiles.cc
	compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_paccept.cc

Log Message:
compiler-rt-netbsd: Improve the kvm(3) handling

Add kvm_open.cc and kvm_openfiles.cc tests.

Sponsored by <The NetBSD Foundation>

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=4bd423d662eb3a6f20e9e78dbcf13a5ceded79b9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 compiler-rt-netbsd/distinfo                        | 21 +++---
 ...atch-include_sanitizer_netbsd__syscall__hooks.h |  2 +-
 .../patches/patch-lib_msan_msan__interceptors.cc   | 86 ++--------------------
 ...zer__common_sanitizer__common__interceptors.inc | 45 ++++++++---
 ...mmon_sanitizer__netbsd__interceptors__ioctl.inc |  2 +-
 ...nitizer__common_sanitizer__netbsd__syscalls.inc |  2 +-
 ...sanitizer__common_TestCases_NetBSD_kvm__open.cc | 18 +++++
 ...izer__common_TestCases_NetBSD_kvm__openfiles.cc | 18 +++++
 ...t_sanitizer__common_TestCases_NetBSD_paccept.cc | 79 ++++++++++++++++++++
 ...t_sanitizer__common_TestCases_NetBSD_strlcat.cc |  2 +-
 ...t_sanitizer__common_TestCases_NetBSD_strlcpy.cc |  2 +-
 .../patch-utils_generate__netbsd__ioctls.awk       |  2 +-
 .../patch-utils_generate__netbsd__syscalls.awk     |  2 +-
 13 files changed, 174 insertions(+), 107 deletions(-)

diffs:
diff --git a/compiler-rt-netbsd/distinfo b/compiler-rt-netbsd/distinfo
index d9b0ecce2d..d57f683633 100644
--- a/compiler-rt-netbsd/distinfo
+++ b/compiler-rt-netbsd/distinfo
@@ -2,20 +2,20 @@ $NetBSD: distinfo,v 1.35 2015/09/11 01:21:57 tnn Exp $
 
 SHA1 (patch-cmake_config-ix.cmake) = 11195c8254c84d5972a2ffee8a9e66758ab7105b
 SHA1 (patch-include_CMakeLists.txt) = b6f2713b7e5337aed542442936b6f747efe0a607
-SHA1 (patch-include_sanitizer_netbsd__syscall__hooks.h) = 93200e8be347521dda7d453722b44945cb18e048
+SHA1 (patch-include_sanitizer_netbsd__syscall__hooks.h) = 62a6b2c06067015626bd78995160a073234e5dd8
 SHA1 (patch-lib_asan_asan__interceptors.cc) = ea4005ce02775060ff52af76d568c450892067b5
 SHA1 (patch-lib_esan_esan__interceptors.cpp) = a7103ca053e92a810c87c593262bb386f3d02606
 SHA1 (patch-lib_fuzzer_tests_CMakeLists.txt) = bed69bc433f70ec4d88fc5aa11d47ffbd18f4b74
 SHA1 (patch-lib_hwasan_hwasan__interceptors.cc) = c49ab3759728bbd3e27580a3d0d3e2db0bceb2a6
-SHA1 (patch-lib_msan_msan__interceptors.cc) = 9f0c1a05430314581b1711f1d5a1ab8870053879
+SHA1 (patch-lib_msan_msan__interceptors.cc) = 42f9f0416e1b30f15fb0f104d70d4b0ead83519f
 SHA1 (patch-lib_msan_msan__linux.cc) = d75d7587071a9e7a3f6a08a3008af55319e62cab
 SHA1 (patch-lib_sanitizer__common_CMakeLists.txt) = fcbf2987ccab5258fe760aef6ef47bd97e0e0b2c
-SHA1 (patch-lib_sanitizer__common_sanitizer__common__interceptors.inc) = 914bc407173b5e22627fcc82ce6fd61a8bf32cca
+SHA1 (patch-lib_sanitizer__common_sanitizer__common__interceptors.inc) = b36bbc916336f09d5176239714501e5d1208a5d0
 SHA1 (patch-lib_sanitizer__common_sanitizer__common__interceptors__ioctl.inc) = 231f519a0564aa69d746a7f0bbee1b1aeed927a7
 SHA1 (patch-lib_sanitizer__common_sanitizer__internal__defs.h) = 2ff74de8be0825ca4162969cb2ed367654934a17
 SHA1 (patch-lib_sanitizer__common_sanitizer__linux.cc) = b1057f01ae2f03498613eb1a02501c8a65d16fed
-SHA1 (patch-lib_sanitizer__common_sanitizer__netbsd__interceptors__ioctl.inc) = 8eacd483ac5d56b666dd36d448d3aa7b7c7e5467
-SHA1 (patch-lib_sanitizer__common_sanitizer__netbsd__syscalls.inc) = d6ee9e0914bbb98cfb823d93ccfb27842b8e145e
+SHA1 (patch-lib_sanitizer__common_sanitizer__netbsd__interceptors__ioctl.inc) = 2ac600e005856bd880a36b64726c169a25ae849d
+SHA1 (patch-lib_sanitizer__common_sanitizer__netbsd__syscalls.inc) = 189a180e443874590dc3056c2281f295e88373ca
 SHA1 (patch-lib_sanitizer__common_sanitizer__platform__interceptors.h) = 8b11b1732a0ec455fd871805d3a92f6891c0dfaa
 SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc) = 47236661e37673d66a52e80c3f55be13029014ca
 SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h) = 2441d51ba207b067a52b7688076335bb38ad0bb9
@@ -24,8 +24,11 @@ SHA1 (patch-lib_scudo_scudo__platform.h) = d44bd094136dd0381db87344fbbcad1dcfd44
 SHA1 (patch-lib_tsan_rtl_tsan__interceptors.cc) = 4fbaa64e3f8d28cdbab6783c296dfd31cecb45a5
 SHA1 (patch-test_asan_lit.cfg) = becbc3c8c9cfd589e1dcbf1014dd4655f952c144
 SHA1 (patch-test_lsan_lit.common.cfg) = 10dc251f80efb96d015a22c740dc20b1843b9a11
-SHA1 (patch-test_sanitizer__common_TestCases_NetBSD_strlcat.cc) = 67aa581bc86b5070aba6017908612284980f0087
-SHA1 (patch-test_sanitizer__common_TestCases_NetBSD_strlcpy.cc) = 5d0c5018ba6523d7d4da240c41841e95808214de
+SHA1 (patch-test_sanitizer__common_TestCases_NetBSD_kvm__open.cc) = ef0eff694a3b00da7efa4ce46cc9bce69c44cef7
+SHA1 (patch-test_sanitizer__common_TestCases_NetBSD_kvm__openfiles.cc) = 5a33bc8016db53c949ad2d19417377deeb894ffa
+SHA1 (patch-test_sanitizer__common_TestCases_NetBSD_paccept.cc) = aecb903ded17b032a7390452e0874d769b30260d
+SHA1 (patch-test_sanitizer__common_TestCases_NetBSD_strlcat.cc) = 07aed0bc75019f523afa44d8ed456e4884e776d2
+SHA1 (patch-test_sanitizer__common_TestCases_NetBSD_strlcpy.cc) = f1f99916bd7ab6e137aabdd8d508bb099fd9549c
 SHA1 (patch-test_scudo_lit.cfg) = 111a66513b994534bb0d69d214b7e0cb4e2b8eb8
-SHA1 (patch-utils_generate__netbsd__ioctls.awk) = 1a3f749fe72466cfca34602615e7cea1cad63fd9
-SHA1 (patch-utils_generate__netbsd__syscalls.awk) = c9245d51ab15fee834a9226466e1f4257a4c9aa1
+SHA1 (patch-utils_generate__netbsd__ioctls.awk) = de4516f09e9deaa7287b555a07b844dcd29fcb14
+SHA1 (patch-utils_generate__netbsd__syscalls.awk) = d6f277ca8ef4307dafea5e79784d16ac0aa413bd
diff --git a/compiler-rt-netbsd/patches/patch-include_sanitizer_netbsd__syscall__hooks.h b/compiler-rt-netbsd/patches/patch-include_sanitizer_netbsd__syscall__hooks.h
index 0aaeb71e89..204e41f0c7 100644
--- a/compiler-rt-netbsd/patches/patch-include_sanitizer_netbsd__syscall__hooks.h
+++ b/compiler-rt-netbsd/patches/patch-include_sanitizer_netbsd__syscall__hooks.h
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- include/sanitizer/netbsd_syscall_hooks.h.orig	2018-01-20 18:02:45.596113671 +0000
+--- include/sanitizer/netbsd_syscall_hooks.h.orig	2018-01-22 13:13:52.868772892 +0000
 +++ include/sanitizer/netbsd_syscall_hooks.h
 @@ -0,0 +1,4730 @@
 +//===-- netbsd_syscall_hooks.h --------------------------------------------===//
diff --git a/compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc b/compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc
index acfaaffe43..7ca55cbb02 100644
--- a/compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_msan_msan__interceptors.cc
@@ -16,81 +16,7 @@ $NetBSD$
  #endif
  
  #include <stdarg.h>
-@@ -689,6 +691,73 @@ INTERCEPTOR(int, putenv, char *string) {
-   return res;
- }
- 
-+#if SANITIZER_NETBSD && 0
-+INTERCEPTOR(int, kvm_dump_header, void *kb, int op, int arg, void *cnt) {
-+  ENSURE_MSAN_INITED();
-+  int res = REAL(fstat)(fd, buf);
-+  if (!res)
-+    __msan_unpoison(buf, __sanitizer::struct_stat_sz);
-+  return res;
-+}
-+
-+INTERCEPTOR(void *, kvm_getprocs, void *kb, int op, int arg, void *cnt) {
-+  ENSURE_MSAN_INITED();
-+  int res = REAL(fstat)(fd, buf);
-+  if (!res)
-+    __msan_unpoison(buf, __sanitizer::struct_stat_sz);
-+  return res;
-+}
-+
-+kvm_close
-+0000000000004b99 T kvm_dump_header
-+000000000000565e T kvm_dump_inval
-+00000000000048cc T kvm_dump_mkheader
-+0000000000004d35 T kvm_dump_wrtheader
-+0000000000003f7e T kvm_getargv
-+0000000000004006 T kvm_getargv2
-+0000000000003fc2 T kvm_getenvv
-+0000000000004015 T kvm_getenvv2
-+00000000000043d3 T kvm_geterr
-+000000000000194b T kvm_getfiles
-+00000000000043d8 T kvm_getkernelname
-+00000000000017ec T kvm_getloadavg
-+00000000000020f3 T kvm_getlwps
-+0000000000002ed4 T kvm_getproc2
-+0000000000002ae8 T kvm_getprocs
-+00000000000055ca T kvm_nlist
-+0000000000005524 T kvm_open
-+00000000000054b1 T kvm_openfiles
-+00000000000057b9 T kvm_read
-+0000000000004024 T kvm_uread
-+000000000000595f T kvm_write
-+
-+#define MSAN_MAYBE_INTERCEPT_LIBKVM_FUNCTIONS \
-+  INTERCEPT_FUNCTION(kvm_getproc2); \
-+  INTERCEPT_FUNCTION(kvm_dump_header); \
-+  INTERCEPT_FUNCTION(kvm_dump_inval); \
-+  INTERCEPT_FUNCTION(kvm_dump_mkheader); \
-+  INTERCEPT_FUNCTION(kvm_dump_wrtheader); \
-+  INTERCEPT_FUNCTION(kvm_getargv); \
-+  INTERCEPT_FUNCTION(kvm_getargv2); \
-+  INTERCEPT_FUNCTION(kvm_getenvv); \
-+  INTERCEPT_FUNCTION(kvm_getenvv2); \
-+  INTERCEPT_FUNCTION(kvm_geterr); \
-+  INTERCEPT_FUNCTION(kvm_getfiles); \
-+  INTERCEPT_FUNCTION(kvm_getkernelname); \
-+  INTERCEPT_FUNCTION(kvm_getloadavg); \
-+  INTERCEPT_FUNCTION(kvm_getlwps); \
-+  INTERCEPT_FUNCTION(kvm_getproc2); \
-+  INTERCEPT_FUNCTION(kvm_getprocs); \
-+  INTERCEPT_FUNCTION(kvm_nlist); \
-+  INTERCEPT_FUNCTION(kvm_open); \
-+  INTERCEPT_FUNCTION(kvm_openfiles); \
-+  INTERCEPT_FUNCTION(kvm_read); \
-+  INTERCEPT_FUNCTION(kvm_uread); \
-+  INTERCEPT_FUNCTION(kvm_write)
-+#else
-+#define MSAN_MAYBE_INTERCEPT_LIBKVM_FUNCTIONS
-+#endif
-+
- #if SANITIZER_NETBSD
- INTERCEPTOR(int, fstat, int fd, void *buf) {
-   ENSURE_MSAN_INITED();
-@@ -1137,6 +1206,18 @@ INTERCEPTOR(int, pthread_join, void *th,
+@@ -1137,6 +1139,18 @@ INTERCEPTOR(int, pthread_join, void *th,
  
  extern char *tzname[2];
  
@@ -109,7 +35,7 @@ $NetBSD$
  INTERCEPTOR(void, tzset, int fake) {
    ENSURE_MSAN_INITED();
    REAL(tzset)(fake);
-@@ -1146,29 +1227,85 @@ INTERCEPTOR(void, tzset, int fake) {
+@@ -1146,29 +1160,85 @@ INTERCEPTOR(void, tzset, int fake) {
      __msan_unpoison(tzname[1], REAL(strlen)(tzname[1]) + 1);
    return;
  }
@@ -198,7 +124,7 @@ $NetBSD$
  }
  
  static void BeforeFork() {
-@@ -1322,6 +1459,11 @@ int OnExit() {
+@@ -1322,6 +1392,11 @@ int OnExit() {
      __msan_unpoison(to + size, 1);                          \
    } while (false)
  
@@ -210,7 +136,7 @@ $NetBSD$
  #include "sanitizer_common/sanitizer_platform_interceptors.h"
  #include "sanitizer_common/sanitizer_common_interceptors.inc"
  
-@@ -1401,6 +1543,7 @@ static uptr signal_impl(int signo, uptr 
+@@ -1401,6 +1476,7 @@ static uptr signal_impl(int signo, uptr 
    } while (false)
  #define COMMON_SYSCALL_POST_WRITE_RANGE(p, s) __msan_unpoison(p, s)
  #include "sanitizer_common/sanitizer_common_syscalls.inc"
@@ -218,7 +144,7 @@ $NetBSD$
  
  struct dlinfo {
    char *dli_fname;
-@@ -1566,6 +1709,9 @@ namespace __msan {
+@@ -1566,6 +1642,9 @@ namespace __msan {
  void InitializeInterceptors() {
    static int inited = 0;
    CHECK_EQ(inited, 0);
@@ -228,7 +154,7 @@ $NetBSD$
    InitializeCommonInterceptors();
    InitializeSignalInterceptors();
  
-@@ -1682,6 +1828,7 @@ void InitializeInterceptors() {
+@@ -1682,6 +1761,7 @@ void InitializeInterceptors() {
  
    INTERCEPT_FUNCTION(pthread_join);
    INTERCEPT_FUNCTION(tzset);
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__common__interceptors.inc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__common__interceptors.inc
index 08795c03e9..83fe9e981e 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__common__interceptors.inc
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__common__interceptors.inc
@@ -166,7 +166,7 @@ $NetBSD$
    return res;
  }
  
-@@ -6608,6 +6658,495 @@ INTERCEPTOR(int, getgroupmembership, con
+@@ -6608,6 +6658,518 @@ INTERCEPTOR(int, getgroupmembership, con
  #define INIT_GETGROUPLIST
  #endif
  
@@ -218,12 +218,23 @@ $NetBSD$
 +INTERCEPTOR(char **, kvm_getargv, struct __sanitizer_kvm *kd, void *kp,
 +            int nchr) {
 +  void *ctx;
++  char **argv;
 +  COMMON_INTERCEPTOR_ENTER(ctx, kvm_getargv, kd, kp, nchr);
 +  if (kd)
 +    COMMON_INTERCEPTOR_READ_RANGE(ctx, kd, sizeof(struct __sanitizer_kvm));
 +  if (kp)
 +    COMMON_INTERCEPTOR_READ_RANGE(ctx, kp, struct_kinfo_proc_sz);
-+  return REAL(kvm_getargv)(kd, kp, nchr);
++  argv = REAL(kvm_getargv)(kd, kp, nchr);
++  if (argv) {
++    char **p = argv;
++    while (*p) {
++      COMMON_INTERCEPTOR_WRITE_RANGE(ctx, p, sizeof(char **));
++      COMMON_INTERCEPTOR_WRITE_RANGE(ctx, *p, REAL(strlen)(*p) + 1);
++      p++;
++    }
++    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, p, sizeof(char **));
++  }
++  return argv;
 +}
 +
 +INTERCEPTOR(char **, kvm_getargv2, struct __sanitizer_kvm *kd, void *kp,
@@ -294,19 +305,27 @@ $NetBSD$
 +
 +INTERCEPTOR(char *, kvm_geterr, struct __sanitizer_kvm *kd) {
 +  void *ctx;
++  char *res;
 +  COMMON_INTERCEPTOR_ENTER(ctx, kvm_geterr, kd);
 +  if (kd)
 +    COMMON_INTERCEPTOR_READ_RANGE(ctx, kd, sizeof(struct __sanitizer_kvm));
-+  return REAL(kvm_geterr)(kd);
++  res = REAL(kvm_geterr)(kd);
++  if (res)
++    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, REAL(strlen)(res) + 1);
++  return res;
 +}
 +
 +INTERCEPTOR(int, kvm_getloadavg, struct __sanitizer_kvm *kd, double loadavg[],
 +            int nelem) {
 +  void *ctx;
++  int res;
 +  COMMON_INTERCEPTOR_ENTER(ctx, kvm_getloadavg, kd, loadavg, nelem);
 +  if (kd)
 +    COMMON_INTERCEPTOR_READ_RANGE(ctx, kd, sizeof(struct __sanitizer_kvm));
-+  return REAL(kvm_getloadavg)(kd, loadavg, nelem);
++  res = REAL(kvm_getloadavg)(kd, loadavg, nelem);
++  if (res > 0)
++    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, loadavg, res * sizeof(*loadavg));
++  return res;
 +}
 +
 +INTERCEPTOR(char *, kvm_getfiles, struct __sanitizer_kvm *kd, int op, int arg,
@@ -386,6 +405,8 @@ $NetBSD$
 +    COMMON_INTERCEPTOR_READ_RANGE(ctx, mf, REAL(strlen)(mf) + 1);
 +  if (sf)
 +    COMMON_INTERCEPTOR_READ_RANGE(ctx, sf, REAL(strlen)(sf) + 1);
++  if (program)
++    COMMON_INTERCEPTOR_READ_RANGE(ctx, program, REAL(strlen)(program) + 1);
 +  kd = REAL(kvm_open)(uf, mf, sf, flag, program);
 +  if (kd)
 +    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, kd, sizeof(struct __sanitizer_kvm));
@@ -393,19 +414,21 @@ $NetBSD$
 +}
 +
 +INTERCEPTOR(struct __sanitizer_kvm *, kvm_openfiles, char *uf, char *mf,
-+            char *sf, int flag, char *program) {
++            char *sf, int flag, char *errout) {
 +  void *ctx;
 +  struct __sanitizer_kvm *kd;
-+  COMMON_INTERCEPTOR_ENTER(ctx, kvm_openfiles, uf, mf, sf, flag, program);
++  COMMON_INTERCEPTOR_ENTER(ctx, kvm_openfiles, uf, mf, sf, flag, errout);
 +  if (uf)
 +    COMMON_INTERCEPTOR_READ_RANGE(ctx, uf, REAL(strlen)(uf) + 1);
 +  if (mf)
 +    COMMON_INTERCEPTOR_READ_RANGE(ctx, mf, REAL(strlen)(mf) + 1);
 +  if (sf)
 +    COMMON_INTERCEPTOR_READ_RANGE(ctx, sf, REAL(strlen)(sf) + 1);
-+  kd = REAL(kvm_openfiles)(uf, mf, sf, flag, program);
++  kd = REAL(kvm_openfiles)(uf, mf, sf, flag, errout);
 +  if (kd)
 +    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, kd, sizeof(struct __sanitizer_kvm));
++  if (!kd && errout)
++    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, errout, REAL(strlen)(errout) + 1);
 +  return kd;
 +}
 +
@@ -437,7 +460,7 @@ $NetBSD$
 +  uptr res;
 +  COMMON_INTERCEPTOR_ENTER(ctx, kvm_write, kd, kva, buf, len);
 +  res = REAL(kvm_uread)(kd, kva, buf, len);
-+  if (res)
++  if (buf && res > 0)
 +    COMMON_INTERCEPTOR_READ_RANGE(ctx, buf, res);
 +  return res;
 +}
@@ -464,7 +487,7 @@ $NetBSD$
 +  COMMON_INTERCEPT_FUNCTION(kvm_openfiles); \
 +  COMMON_INTERCEPT_FUNCTION(kvm_read); \
 +  COMMON_INTERCEPT_FUNCTION(kvm_uread); \
-+  COMMON_INTERCEPT_FUNCTION(kvm_write)
++  COMMON_INTERCEPT_FUNCTION(kvm_write);
 +#else
 +#define INIT_KVM
 +#endif
@@ -662,7 +685,7 @@ $NetBSD$
  static void InitializeCommonInterceptors() {
    static u64 metadata_mem[sizeof(MetadataHashMap) / sizeof(u64) + 1];
    interceptor_metadata_map = new((void *)&metadata_mem) MetadataHashMap();
-@@ -6687,6 +7226,7 @@ static void InitializeCommonInterceptors
+@@ -6687,6 +7249,7 @@ static void InitializeCommonInterceptors
    INIT_GETSOCKOPT;
    INIT_ACCEPT;
    INIT_ACCEPT4;
@@ -670,7 +693,7 @@ $NetBSD$
    INIT_MODF;
    INIT_RECVMSG;
    INIT_SENDMSG;
-@@ -6827,6 +7367,13 @@ static void InitializeCommonInterceptors
+@@ -6827,6 +7390,13 @@ static void InitializeCommonInterceptors
    INIT_ACCESS;
    INIT_FACCESSAT;
    INIT_GETGROUPLIST;
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__netbsd__interceptors__ioctl.inc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__netbsd__interceptors__ioctl.inc
index 07c7758767..540c935a7b 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__netbsd__interceptors__ioctl.inc
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__netbsd__interceptors__ioctl.inc
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_netbsd_interceptors_ioctl.inc.orig	2018-01-20 18:02:45.603268491 +0000
+--- lib/sanitizer_common/sanitizer_netbsd_interceptors_ioctl.inc.orig	2018-01-22 13:13:52.871549138 +0000
 +++ lib/sanitizer_common/sanitizer_netbsd_interceptors_ioctl.inc
 @@ -0,0 +1,1490 @@
 +//===-- sanitizer_common_interceptors_ioctl.inc -----------------*- C++ -*-===//
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__netbsd__syscalls.inc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__netbsd__syscalls.inc
index 873579e20e..f95d3f2541 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__netbsd__syscalls.inc
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__netbsd__syscalls.inc
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_netbsd_syscalls.inc.orig	2018-01-20 18:02:45.604207367 +0000
+--- lib/sanitizer_common/sanitizer_netbsd_syscalls.inc.orig	2018-01-22 13:13:52.872380218 +0000
 +++ lib/sanitizer_common/sanitizer_netbsd_syscalls.inc
 @@ -0,0 +1,3793 @@
 +//===-- sanitizer_common_syscalls.inc ---------------------------*- C++ -*-===//
diff --git a/compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_kvm__open.cc b/compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_kvm__open.cc
new file mode 100644
index 0000000000..aac1f4cef4
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_kvm__open.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+--- test/sanitizer_common/TestCases/NetBSD/kvm_open.cc.orig	2018-01-22 13:13:52.874384543 +0000
++++ test/sanitizer_common/TestCases/NetBSD/kvm_open.cc
+@@ -0,0 +1,13 @@
++// RUN: %clangxx -O0 -g %s -o %t && %run %t
++
++#include <fcntl.h>
++#include <kvm.h>
++
++int main(void) {
++  kvm_t K;
++
++  K = kvm_open(NULL, NULL, NULL, KVM_NO_FILES, "kvm_open");
++  kvm_close(&K);
++
++  return 0;
++}
diff --git a/compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_kvm__openfiles.cc b/compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_kvm__openfiles.cc
new file mode 100644
index 0000000000..87131262fa
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_kvm__openfiles.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+--- test/sanitizer_common/TestCases/NetBSD/kvm_openfiles.cc.orig	2018-01-22 13:13:52.874459075 +0000
++++ test/sanitizer_common/TestCases/NetBSD/kvm_openfiles.cc
+@@ -0,0 +1,13 @@
++// RUN: %clangxx -O0 -g %s -o %t && %run %t
++
++#include <fcntl.h>
++#include <kvm.h>
++
++int main(void) {
++  kvm_t K;
++
++  K = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, "kvm_open");
++  kvm_close(&K);
++
++  return 0;
++}
diff --git a/compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_paccept.cc b/compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_paccept.cc
new file mode 100644
index 0000000000..d4a55ec73e
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_paccept.cc
@@ -0,0 +1,79 @@
+$NetBSD$
+
+--- test/sanitizer_common/TestCases/NetBSD/paccept.cc.orig	2018-01-22 13:13:52.874537387 +0000
++++ test/sanitizer_common/TestCases/NetBSD/paccept.cc
+@@ -0,0 +1,74 @@
++// RUN: %clangxx -O0 -g %s -o %t && %run %t
++
++#include <netinet/in.h>
++#include <sys/socket.h>
++#include <sys/wait.h>
++#include <signal.h>
++#include <stdlib.h>
++#include <unistd.h>
++
++int main(void) {
++  int child;
++  int fd, sfd;
++  socklen_t len;
++  struct sockaddr_in server = {}, client = {};
++  sigset_t set;
++
++  child = fork();
++  if (child == 0) {
++    fd = socket(AF_INET, SOCK_STREAM, 0);
++    if (fd == -1)
++      _exit(1);
++
++    server.sin_family = AF_INET;
++    server.sin_addr.s_addr = INADDR_ANY;
++    server.sin_port = htons(2222);
++
++    if (connect(fd, (struct sockaddr *)&server, sizeof(server)) == -1)
++      _exit(1);
++
++    close(fd);
++
++    _exit(0);
++  }
++
++  fd = socket(AF_INET, SOCK_STREAM, 0);
++  if (fd == -1) {
++    kill(child, SIGKILL);
++    wait(NULL);
++    exit(1);
++  }
++
++  server.sin_family = AF_INET;
++  server.sin_addr.s_addr = INADDR_ANY;
++  server.sin_port = htons(2222);
++
++  if (bind(fd, (const struct sockaddr *)&server, sizeof(server)) == -1) {
++    kill(child, SIGKILL);
++    wait(NULL);
++    exit(1);
++  }
++
++  listen(fd, 3);
++
++  if (sigemptyset(&set) == -1) {
++    kill(child, SIGKILL);
++    wait(NULL);
++    exit(1);
++  }
++
++  len = sizeof(client);
++  sfd = paccept(fd, (struct sockaddr *)&client, &len, &set, SOCK_NONBLOCK);
++  if (sfd == -1) {
++    kill(child, SIGKILL);
++    wait(NULL);
++    exit(1);
++  }
++
++  wait(NULL);
++
++  close(sfd);
++  close(fd);
++
++  return 0;
++}
diff --git a/compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_strlcat.cc b/compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_strlcat.cc
index 6ab553407e..ca1e651c59 100644
--- a/compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_strlcat.cc
+++ b/compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_strlcat.cc
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- test/sanitizer_common/TestCases/NetBSD/strlcat.cc.orig	2018-01-20 18:02:45.607784568 +0000
+--- test/sanitizer_common/TestCases/NetBSD/strlcat.cc.orig	2018-01-22 13:13:52.874611326 +0000
 +++ test/sanitizer_common/TestCases/NetBSD/strlcat.cc
 @@ -0,0 +1,56 @@
 +// RUN: %clangxx -O0 -g %s -o %t && %run %t
diff --git a/compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_strlcpy.cc b/compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_strlcpy.cc
index d6da3599c9..87c99a45e1 100644
--- a/compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_strlcpy.cc
+++ b/compiler-rt-netbsd/patches/patch-test_sanitizer__common_TestCases_NetBSD_strlcpy.cc
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- test/sanitizer_common/TestCases/NetBSD/strlcpy.cc.orig	2018-01-20 18:02:45.607909793 +0000
+--- test/sanitizer_common/TestCases/NetBSD/strlcpy.cc.orig	2018-01-22 13:13:52.874685814 +0000
 +++ test/sanitizer_common/TestCases/NetBSD/strlcpy.cc
 @@ -0,0 +1,56 @@
 +// RUN: %clangxx -O0 -g %s -o %t && %run %t
diff --git a/compiler-rt-netbsd/patches/patch-utils_generate__netbsd__ioctls.awk b/compiler-rt-netbsd/patches/patch-utils_generate__netbsd__ioctls.awk
index 62eebb2781..8b40a335bd 100644
--- a/compiler-rt-netbsd/patches/patch-utils_generate__netbsd__ioctls.awk
+++ b/compiler-rt-netbsd/patches/patch-utils_generate__netbsd__ioctls.awk
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- utils/generate_netbsd_ioctls.awk.orig	2018-01-20 18:02:45.608298460 +0000
+--- utils/generate_netbsd_ioctls.awk.orig	2018-01-22 13:13:52.874970199 +0000
 +++ utils/generate_netbsd_ioctls.awk
 @@ -0,0 +1,755 @@
 +#!/usr/bin/awk -f
diff --git a/compiler-rt-netbsd/patches/patch-utils_generate__netbsd__syscalls.awk b/compiler-rt-netbsd/patches/patch-utils_generate__netbsd__syscalls.awk
index 209fff194b..bdc513f16b 100644
--- a/compiler-rt-netbsd/patches/patch-utils_generate__netbsd__syscalls.awk
+++ b/compiler-rt-netbsd/patches/patch-utils_generate__netbsd__syscalls.awk
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- utils/generate_netbsd_syscalls.awk.orig	2018-01-20 18:02:45.609058962 +0000
+--- utils/generate_netbsd_syscalls.awk.orig	2018-01-22 13:13:52.875613329 +0000
 +++ utils/generate_netbsd_syscalls.awk
 @@ -0,0 +1,2989 @@
 +#!/usr/bin/awk -f


Home | Main Index | Thread Index | Old Index