pkgsrc-WIP-changes archive

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

compiler-rt-netbsd: Correct the strlcat(3) interceptor



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Fri Feb 2 14:52:12 2018 +0100
Changeset:	35a2811a133df580b4fe105e24e79b28e5392b11

Modified Files:
	compiler-rt-netbsd/distinfo
	compiler-rt-netbsd/patches/patch-include_sanitizer_netbsd__syscall__hooks.h
	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-lib_sanitizer__common_sanitizer__platform__interceptors.h
	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-utils_generate__netbsd__ioctls.awk
	compiler-rt-netbsd/patches/patch-utils_generate__netbsd__syscalls.awk

Log Message:
compiler-rt-netbsd: Correct the strlcat(3) interceptor

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=35a2811a133df580b4fe105e24e79b28e5392b11

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

diffstat:
 compiler-rt-netbsd/distinfo                        | 18 +++---
 ...atch-include_sanitizer_netbsd__syscall__hooks.h |  2 +-
 ...zer__common_sanitizer__common__interceptors.inc | 69 ++++++++--------------
 ...mmon_sanitizer__netbsd__interceptors__ioctl.inc |  2 +-
 ...nitizer__common_sanitizer__netbsd__syscalls.inc |  2 +-
 ...zer__common_sanitizer__platform__interceptors.h |  2 +-
 ...sanitizer__common_TestCases_NetBSD_kvm__open.cc |  2 +-
 ...izer__common_TestCases_NetBSD_kvm__openfiles.cc |  2 +-
 .../patch-utils_generate__netbsd__ioctls.awk       |  2 +-
 .../patch-utils_generate__netbsd__syscalls.awk     |  2 +-
 10 files changed, 42 insertions(+), 61 deletions(-)

diffs:
diff --git a/compiler-rt-netbsd/distinfo b/compiler-rt-netbsd/distinfo
index 4e0a049b40..cd289f628b 100644
--- a/compiler-rt-netbsd/distinfo
+++ b/compiler-rt-netbsd/distinfo
@@ -2,7 +2,7 @@ $NetBSD: distinfo,v 1.35 2015/09/11 01:21:57 tnn Exp $
 
 SHA1 (patch-cmake_config-ix.cmake) = 7425d12d9601544fe12d5f4e242682c085893b71
 SHA1 (patch-include_CMakeLists.txt) = c9dc00e80ac7416993aa0355321e405856940478
-SHA1 (patch-include_sanitizer_netbsd__syscall__hooks.h) = 30f981378aa6fa1aae7fe0b67269fbc90f284eab
+SHA1 (patch-include_sanitizer_netbsd__syscall__hooks.h) = 27395b73ce56136b1bc60ed61d8cabbd8a7e2fd4
 SHA1 (patch-lib_asan_asan__interceptors.cc) = 0dcc154820dcef2de65c3f0cdcec2ea365123f1e
 SHA1 (patch-lib_esan_esan__interceptors.cpp) = 2e3e300201e5cc20d612cb0847a0a3c624b73f30
 SHA1 (patch-lib_fuzzer_tests_CMakeLists.txt) = 766b817c2ede73ca90d6e25a4b8330ed3d38b84b
@@ -10,13 +10,13 @@ SHA1 (patch-lib_hwasan_hwasan__interceptors.cc) = 27038b764c7d3d4f1885d85dc6d76c
 SHA1 (patch-lib_msan_msan__interceptors.cc) = f6388495e44c2ddf2cdfa4cf59e9da0e5e60c2d7
 SHA1 (patch-lib_msan_msan__linux.cc) = 6fd2ada4a84d1e1cc47ec8f4e1f0608861c73c1a
 SHA1 (patch-lib_sanitizer__common_CMakeLists.txt) = 2a0a50c9fccf4be9328aa5ecd7c55adace841fe8
-SHA1 (patch-lib_sanitizer__common_sanitizer__common__interceptors.inc) = ecfc7348a2e28bf301845d9f212aaab65a687480
+SHA1 (patch-lib_sanitizer__common_sanitizer__common__interceptors.inc) = c13f6d9ff96d743ddc922d292074c196ebf80f21
 SHA1 (patch-lib_sanitizer__common_sanitizer__common__interceptors__ioctl.inc) = a4b00d19eb5528a320255e8b0dcbaf07f1f8aa16
 SHA1 (patch-lib_sanitizer__common_sanitizer__internal__defs.h) = a6ce44f3cfd42640c6fbe514814e8e485fac1dfc
 SHA1 (patch-lib_sanitizer__common_sanitizer__linux.cc) = a9d86ca4c434faca53db8ccb81f96a44ca309a0f
-SHA1 (patch-lib_sanitizer__common_sanitizer__netbsd__interceptors__ioctl.inc) = ac5dbf9a9498dd3ce07eac59b1c45260b4ac4247
-SHA1 (patch-lib_sanitizer__common_sanitizer__netbsd__syscalls.inc) = a5c9e062d694583fa29fb1f90007539c7526a4b1
-SHA1 (patch-lib_sanitizer__common_sanitizer__platform__interceptors.h) = 9bd0971016c2ed4aecb53491d7d65baa9a7eeabd
+SHA1 (patch-lib_sanitizer__common_sanitizer__netbsd__interceptors__ioctl.inc) = ccc99d067b23ab87f49ad560225ba856d23eab43
+SHA1 (patch-lib_sanitizer__common_sanitizer__netbsd__syscalls.inc) = 6e531bd2e13d0b60881727afd40b1824a4eb77e6
+SHA1 (patch-lib_sanitizer__common_sanitizer__platform__interceptors.h) = b6d541dc2596c7c63e23d3e0aedaf301d26aa342
 SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc) = 8100b7170b8c4adf7b13adf3c998a233e6623aff
 SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h) = dde2e7de842e50ae9db534f9f441e0eb49e6dce4
 SHA1 (patch-lib_sanitizer__common_sanitizer__procmaps__freebsd.cc) = c6459f21789a5ef13e37714487c09110062c9c5d
@@ -24,8 +24,8 @@ SHA1 (patch-lib_scudo_scudo__platform.h) = 119d7ad8f8ca9d3e846dbdd7f805ca771e30e
 SHA1 (patch-lib_tsan_rtl_tsan__interceptors.cc) = 374bbfc9c58fdb43d7d0ede549a01bb0a372f1aa
 SHA1 (patch-test_asan_lit.cfg) = e36362ff6a14efbb54452fd3699ad00f0d9bba1c
 SHA1 (patch-test_lsan_lit.common.cfg) = b09b4ab3a97dc881b701a3583b0b126b8206cfe2
-SHA1 (patch-test_sanitizer__common_TestCases_NetBSD_kvm__open.cc) = 1a858dc0deef42d1da472669f04ef8234f9bec87
-SHA1 (patch-test_sanitizer__common_TestCases_NetBSD_kvm__openfiles.cc) = de07c9d65a47dfc04509198462245bee3fd78af8
+SHA1 (patch-test_sanitizer__common_TestCases_NetBSD_kvm__open.cc) = 9dc3a25b4f1bfc9f35222359f6cdfa587173f94d
+SHA1 (patch-test_sanitizer__common_TestCases_NetBSD_kvm__openfiles.cc) = dade97e32929f278bdb951fe93bbaa0fe42ba36f
 SHA1 (patch-test_scudo_lit.cfg) = 35e4f0524a8fd26e90e5d968b73d75f277da3779
-SHA1 (patch-utils_generate__netbsd__ioctls.awk) = 3f266e64e12322d94fc890e46355cab70ceda405
-SHA1 (patch-utils_generate__netbsd__syscalls.awk) = cb4d4bf4dce56204467bfd0a304e2a568c83c210
+SHA1 (patch-utils_generate__netbsd__ioctls.awk) = dc6428a08c372b2dd83fd2b71fece7de073e959a
+SHA1 (patch-utils_generate__netbsd__syscalls.awk) = 901f23bc744935e95ec161d48148875472f98fd2
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 42a68a4d64..6ea7d47651 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-02-02 00:08:42.510513193 +0000
+--- include/sanitizer/netbsd_syscall_hooks.h.orig	2018-02-02 13:51:14.436737454 +0000
 +++ include/sanitizer/netbsd_syscall_hooks.h
 @@ -0,0 +1,4730 @@
 +//===-- netbsd_syscall_hooks.h --------------------------------------------===//
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 101178d326..21d2911925 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
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_common_interceptors.inc.orig	2018-02-02 00:08:32.539460964 +0000
+--- lib/sanitizer_common/sanitizer_common_interceptors.inc.orig	2018-02-02 00:08:32.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_common_interceptors.inc
 @@ -36,6 +36,7 @@
  //   COMMON_INTERCEPTOR_MEMCPY_IMPL
@@ -171,7 +171,28 @@ $NetBSD$
  #if SANITIZER_INTERCEPT___XSTAT
  INTERCEPTOR(int, __xstat, int version, const char *path, void *buf) {
    void *ctx;
-@@ -6759,6 +6807,937 @@ INTERCEPTOR(SIZE_T, strlcat, char *dst, 
+@@ -6741,16 +6789,15 @@ INTERCEPTOR(SIZE_T, strlcpy, char *dst, 
+ 
+ INTERCEPTOR(SIZE_T, strlcat, char *dst, char *src, SIZE_T size) {
+   void *ctx;
++  SIZE_T len = 0;
+   COMMON_INTERCEPTOR_ENTER(ctx, strlcat, dst, src, size);
+   // src is checked in the strlcpy() interceptor
+   if (dst) {
+-    SIZE_T len = REAL(strnlen)(dst, size);
++    len = REAL(strnlen)(dst, size);
+     COMMON_INTERCEPTOR_READ_STRING(ctx, dst, Min(len, size - 1) + 1);
+-    // Reuse the rest of the code in the strlcpy() interceptor
+-    dst += len;
+-    size -= len;
+   }
+-  return WRAP(strlcpy)(dst, src, size);
++  // Reuse the rest of the code in the strlcpy() interceptor
++  return len + WRAP(strlcpy)(dst + len, src, size - len);
+ }
+ #define INIT_STRLCPY \
+   COMMON_INTERCEPT_FUNCTION(strlcpy); \
+@@ -6759,6 +6806,897 @@ INTERCEPTOR(SIZE_T, strlcat, char *dst, 
  #define INIT_STRLCPY
  #endif
  
@@ -644,46 +665,6 @@ $NetBSD$
 +#define INIT_SYSCTL
 +#endif
 +
-+#if SANITIZER_INTERCEPT_STRLCPY
-+INTERCEPTOR(SIZE_T, strlcpy, char *dst, char *src, SIZE_T size) {
-+  void *ctx;
-+  SIZE_T res;
-+  COMMON_INTERCEPTOR_ENTER(ctx, strlcpy, dst, src, size);
-+  if (src) {
-+    SIZE_T len = REAL(strnlen)(src, size);
-+    COMMON_INTERCEPTOR_READ_RANGE(ctx, src, len >= size ? size : len + 1);
-+  }
-+  res = REAL(strlcpy)(dst, src, size);
-+  COMMON_INTERCEPTOR_WRITE_RANGE(ctx, dst, REAL(strlen)(dst) + 1);
-+  return res;
-+}
-+
-+INTERCEPTOR(SIZE_T, strlcat, char *dst, char *src, SIZE_T size) {
-+  void *ctx;
-+  SIZE_T res;
-+  COMMON_INTERCEPTOR_ENTER(ctx, strlcat, dst, src, size);
-+  if (src) {
-+    SIZE_T len = REAL(strnlen)(src, size);
-+    COMMON_INTERCEPTOR_READ_RANGE(ctx, src, len >= size ? size : len + 1);
-+  }
-+  if (dst) {
-+    SIZE_T len = REAL(strnlen)(dst, size);
-+    COMMON_INTERCEPTOR_READ_RANGE(ctx, dst, len >= size ? size : len + 1);
-+    // Simplify WRITE_RANGE
-+    dst += len;
-+    size -= len;
-+  }
-+  res = REAL(strlcpy)(dst, src, size);
-+  COMMON_INTERCEPTOR_WRITE_RANGE(ctx, dst, REAL(strlen)(dst) + 1);
-+  return res;
-+}
-+#define INIT_STRLCPY \
-+  COMMON_INTERCEPT_FUNCTION(strlcpy); \
-+  COMMON_INTERCEPT_FUNCTION(strlcat);
-+#else
-+#define INIT_STRLCPY
-+#endif
-+
 +#if SANITIZER_INTERCEPT_ATOF
 +INTERCEPTOR(double, atof, char *nptr) {
 +  void *ctx;
@@ -1109,7 +1090,7 @@ $NetBSD$
  static void InitializeCommonInterceptors() {
    static u64 metadata_mem[sizeof(MetadataHashMap) / sizeof(u64) + 1];
    interceptor_metadata_map = new((void *)&metadata_mem) MetadataHashMap();
-@@ -6961,6 +7940,7 @@ static void InitializeCommonInterceptors
+@@ -6961,6 +7899,7 @@ static void InitializeCommonInterceptors
    INIT_SEND_SENDTO;
    INIT_STAT;
    INIT_EVENTFD_READ_WRITE;
@@ -1117,7 +1098,7 @@ $NetBSD$
    INIT___XSTAT;
    INIT___XSTAT64;
    INIT___LXSTAT;
-@@ -6984,6 +7964,18 @@ static void InitializeCommonInterceptors
+@@ -6984,6 +7923,18 @@ static void InitializeCommonInterceptors
    INIT_NAME_TO_HANDLE_AT;
    INIT_OPEN_BY_HANDLE_AT;
    INIT_STRLCPY;
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 2be6e11ae3..bfca373189 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-02-02 00:08:42.513643476 +0000
+--- lib/sanitizer_common/sanitizer_netbsd_interceptors_ioctl.inc.orig	2018-02-02 13:51:14.441037582 +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 974fabe7a9..e18a8aac99 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-02-02 00:08:42.514508661 +0000
+--- lib/sanitizer_common/sanitizer_netbsd_syscalls.inc.orig	2018-02-02 13:51:14.442371829 +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-lib_sanitizer__common_sanitizer__platform__interceptors.h b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__interceptors.h
index dc7492c4d8..bdc1a561a0 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__interceptors.h
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__interceptors.h
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- lib/sanitizer_common/sanitizer_platform_interceptors.h.orig	2018-02-02 00:08:32.539912357 +0000
+--- lib/sanitizer_common/sanitizer_platform_interceptors.h.orig	2018-02-02 00:08:32.000000000 +0000
 +++ lib/sanitizer_common/sanitizer_platform_interceptors.h
 @@ -406,6 +406,7 @@
  
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
index 9a41c02460..b7d61d17f4 100644
--- 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
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- test/sanitizer_common/TestCases/NetBSD/kvm_open.cc.orig	2018-02-02 00:08:42.516684543 +0000
+--- test/sanitizer_common/TestCases/NetBSD/kvm_open.cc.orig	2018-02-02 13:51:14.445518668 +0000
 +++ test/sanitizer_common/TestCases/NetBSD/kvm_open.cc
 @@ -0,0 +1,13 @@
 +// RUN: %clangxx -O0 -g %s -o %t && %run %t
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
index ed990f5ab5..255871e860 100644
--- 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
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- test/sanitizer_common/TestCases/NetBSD/kvm_openfiles.cc.orig	2018-02-02 00:08:42.516773424 +0000
+--- test/sanitizer_common/TestCases/NetBSD/kvm_openfiles.cc.orig	2018-02-02 13:51:14.445663239 +0000
 +++ test/sanitizer_common/TestCases/NetBSD/kvm_openfiles.cc
 @@ -0,0 +1,13 @@
 +// 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 60257553eb..73203745c0 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-02-02 00:08:42.517096849 +0000
+--- utils/generate_netbsd_ioctls.awk.orig	2018-02-02 13:51:14.446124820 +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 3115eb9b3b..e76905696a 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-02-02 00:08:42.517755805 +0000
+--- utils/generate_netbsd_syscalls.awk.orig	2018-02-02 13:51:14.447134865 +0000
 +++ utils/generate_netbsd_syscalls.awk
 @@ -0,0 +1,2989 @@
 +#!/usr/bin/awk -f


Home | Main Index | Thread Index | Old Index