pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
compiler-rt-netbsd: Sync with Yang Zheng GSoC patches
Module Name: pkgsrc-wip
Committed By: Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By: kamil
Date: Sat Jun 9 01:02:35 2018 +0200
Changeset: 6893f2e34af1f6de93d3786b2afd222c43dbd686
Modified Files:
compiler-rt-netbsd/distinfo
compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__common__interceptors.inc
compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__interceptors.h
compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc
compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h
Added Files:
compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc
compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h
Log Message:
compiler-rt-netbsd: Sync with Yang Zheng GSoC patches
A lot of new interceptors.
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=6893f2e34af1f6de93d3786b2afd222c43dbd686
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
compiler-rt-netbsd/distinfo | 10 +-
...zer__common_sanitizer__common__interceptors.inc | 460 ++++++++++++++++++++-
...zer__common_sanitizer__platform__interceptors.h | 8 +-
...__common_sanitizer__platform__limits__netbsd.cc | 80 +++-
...r__common_sanitizer__platform__limits__netbsd.h | 71 +++-
...r__common_sanitizer__platform__limits__posix.cc | 12 +
...er__common_sanitizer__platform__limits__posix.h | 12 +
7 files changed, 610 insertions(+), 43 deletions(-)
diffs:
diff --git a/compiler-rt-netbsd/distinfo b/compiler-rt-netbsd/distinfo
index 2268243564..331ad3f36a 100644
--- a/compiler-rt-netbsd/distinfo
+++ b/compiler-rt-netbsd/distinfo
@@ -11,13 +11,15 @@ SHA1 (patch-lib_fuzzer_tests_CMakeLists.txt) = e2e0e397eaf148df329f2c25ca9185f57
SHA1 (patch-lib_interception_interception.h) = a7f97b191769c846be27e17430bbe39435976642
SHA1 (patch-lib_msan_msan__interceptors.cc) = b8d6a174a0b302a87d3f1489a439f186b034313d
SHA1 (patch-lib_msan_msan__linux.cc) = 6fd2ada4a84d1e1cc47ec8f4e1f0608861c73c1a
-SHA1 (patch-lib_sanitizer__common_sanitizer__common__interceptors.inc) = 3746d47670557d072a2a57763af6c68b0bdc519d
+SHA1 (patch-lib_sanitizer__common_sanitizer__common__interceptors.inc) = 0b59bf76e85b40c3ee220b3ea75e68e685f704a3
SHA1 (patch-lib_sanitizer__common_sanitizer__internal__defs.h) = 9ffcb3ae5ccfcb99d842efe55f6d698cd2e02846
SHA1 (patch-lib_sanitizer__common_sanitizer__linux.cc) = 83636321cef6a17281a27e2ed3dd1b71e5429a6a
SHA1 (patch-lib_sanitizer__common_sanitizer__linux__libcdep.cc) = c1ce6657580cc0865808dd713d1f28afc3baaaa7
-SHA1 (patch-lib_sanitizer__common_sanitizer__platform__interceptors.h) = 085ebe6709bf834a6c663c845e0f0e118f759b05
-SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc) = c77fa6e013e776a48ed43b1c244b4430e7590c50
-SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h) = c47538580572ffdae14b095df76739a603a63a32
+SHA1 (patch-lib_sanitizer__common_sanitizer__platform__interceptors.h) = 0a33e3002b5074512818d21a5ede9bb0e55bfcad
+SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc) = 9a605e4fef4177c125eb7e010ef18b196e74242e
+SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h) = 4ca25c16e8c586c6333976632c145ce30e71690a
+SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc) = 95fef4690641063603db1b1dcb00c610948142f1
+SHA1 (patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h) = b2c0149501713bc16b657344b8b9a3a0ce48b107
SHA1 (patch-lib_sanitizer__common_sanitizer__procmaps__bsd.cc) = 8b629840ff7f56c670d322a9dbbdf7e33ce90cb5
SHA1 (patch-lib_sanitizer__common_sanitizer__unwind__linux__libcdep.cc) = 5225619de386fa8e017b6d391c9f1eba4bdda2af
SHA1 (patch-lib_scudo_scudo__platform.h) = 119d7ad8f8ca9d3e846dbdd7f805ca771e30e410
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 74f7e34aaf..f3db0d6946 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
@@ -14,15 +14,16 @@ $NetBSD$
#define getitimer __getitimer50
#define getpwent __getpwent50
#define getpwnam __getpwnam50
-@@ -111,6 +116,7 @@
+@@ -111,6 +116,8 @@
#define times __times13
#define wait3 __wait350
#define wait4 __wait450
+#define getmntinfo __getmntinfo13
++#define mount __mount50
extern const unsigned short *_ctype_tab_;
extern const short *_toupper_tab_;
extern const short *_tolower_tab_;
-@@ -3301,14 +3307,14 @@ INTERCEPTOR(INTMAX_T, strtoimax, const c
+@@ -3301,14 +3308,14 @@ INTERCEPTOR(INTMAX_T, strtoimax, const c
return res;
}
@@ -39,7 +40,16 @@ $NetBSD$
StrtolFixAndCheck(ctx, nptr, endptr, real_endptr, base);
return res;
}
-@@ -7190,6 +7196,1098 @@ INTERCEPTOR(struct __sanitizer_netent *,
+@@ -4196,7 +4203,7 @@ INTERCEPTOR(int, fstatfs64, int fd, void
+ #endif
+
+ #if SANITIZER_INTERCEPT_STATVFS
+-INTERCEPTOR(int, statvfs, char *path, void *buf) {
++INTERCEPTOR(int, statvfs, const char *path, void *buf) {
+ void *ctx;
+ COMMON_INTERCEPTOR_ENTER(ctx, statvfs, path, buf);
+ if (path) COMMON_INTERCEPTOR_READ_RANGE(ctx, path, REAL(strlen)(path) + 1);
+@@ -7190,6 +7197,1534 @@ INTERCEPTOR(struct __sanitizer_netent *,
#define INIT_NETENT
#endif
@@ -1134,11 +1144,447 @@ $NetBSD$
+#else
+#define INIT_MODCTL
+#endif
++
++#if SANITIZER_INTERCEPT_STATVFS1
++INTERCEPTOR(int, statvfs1, const char *path, void *buf, int flags) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, statvfs1, path, buf, flags);
++ if (path) COMMON_INTERCEPTOR_READ_RANGE(ctx, path, REAL(strlen)(path) + 1);
++
++ int res = REAL(statvfs1)(path, buf, flags);
++ if (!res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, struct_statvfs_sz);
++ return res;
++}
++INTERCEPTOR(int, fstatvfs1, int fd, void *buf, int flags) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, fstatvfs1, fd, buf, flags);
++
++ int res = REAL(fstatvfs1)(fd, buf, flags);
++ if (!res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, struct_statvfs_sz);
++ return res;
++}
++#define INIT_STATVFS1 \
++ COMMON_INTERCEPT_FUNCTION(statvfs1); \
++ COMMON_INTERCEPT_FUNCTION(fstatvfs1);
++#else
++#define INIT_STATVFS1
++#endif
++
++#if SANITIZER_INTERCEPT_NETBSD_MOUNT
++
++INTERCEPTOR(int, mount, const char *type, const char *dir, int flags,
++ void *data, SIZE_T data_len) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, mount, type, dir, flags, data, data_len);
++ if (type)
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, type, REAL(strlen)(type) + 1);
++ if (dir)
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, dir, REAL(strlen)(dir) + 1);
++
++ // FIXME The data is a type-dependant structure which may contain
++ // pointers inside. It is necessary to check them separately. But
++ // the number of types is too large, temporarily relax this check
++ // here.
++ if (data)
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, data, data_len);
++
++ return REAL(mount)(type, dir, flags, data, data_len);
++}
++
++INTERCEPTOR(int, unmount, const char *dir, int flags) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, unmount, dir, flags);
++ if (dir)
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, dir, strlen(dir) + 1);
++ return REAL(unmount)(dir, flags);
++}
++
++#define INIT_NETBSD_MOUNT \
++ COMMON_INTERCEPT_FUNCTION(mount); \
++ COMMON_INTERCEPT_FUNCTION(unmount)
++#else
++#define INIT_NETBSD_MOUNT
++#endif
++
++#if SANITIZER_INTERCEPT_FSEEK
++
++// FIXME The FILE type should be checked.
++// Current challenge is that this type is OS-specific and for some
++// OSs, it is not self-contained, i.e., it contains pointers inside
++// and needs extra inside checking. So, we need to check them
++// separately for different OSs.
++
++INTERCEPTOR(int, fseek, __sanitizer_FILE *stream, long int offset, int whence) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, fseek, stream, offset, whence);
++ return REAL(fseek)(stream, offset, whence);
++}
++
++INTERCEPTOR(int, fseeko, __sanitizer_FILE *stream, OFF_T offset, int whence) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, fseeko, stream, offset, whence);
++ return REAL(fseeko)(stream, offset, whence);
++}
++
++INTERCEPTOR(long int, ftell, __sanitizer_FILE *stream) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, ftell, stream);
++ return REAL(ftell)(stream);
++}
++
++INTERCEPTOR(long int, ftello, __sanitizer_FILE *stream) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, ftello, stream);
++ return REAL(ftello)(stream);
++}
++
++INTERCEPTOR(void, rewind, __sanitizer_FILE *stream) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, rewind, stream);
++ return REAL(rewind)(stream);
++}
++
++INTERCEPTOR(int, fgetpos, __sanitizer_FILE *stream, void *pos) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, fgetpos, stream, pos);
++ int ret = REAL(fgetpos)(stream, pos);
++ if (pos && ret == 0)
++ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, pos, fpos_t_sz);
++ return ret;
++}
++
++INTERCEPTOR(int, fsetpos, __sanitizer_FILE *stream, const void *pos) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, fsetpos, stream, pos);
++ if (pos)
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, pos, fpos_t_sz);
++ return REAL(fsetpos)(stream, pos);
++}
++
++#define INIT_FSEEK \
++ COMMON_INTERCEPT_FUNCTION(fseek); \
++ COMMON_INTERCEPT_FUNCTION(fseeko); \
++ COMMON_INTERCEPT_FUNCTION(ftell); \
++ COMMON_INTERCEPT_FUNCTION(ftello); \
++ COMMON_INTERCEPT_FUNCTION(rewind); \
++ COMMON_INTERCEPT_FUNCTION(fgetpos); \
++ COMMON_INTERCEPT_FUNCTION(fsetpos)
++#else
++#define INIT_FSEEK
++#endif
++
++#if SANITIZER_INTERCEPT_CDBR
++static void cdbr_read_range(void *ctx, struct __sanitizer_cdbr *cdbr) {
++ if (cdbr) {
++ // other pointers like hash_base, offset_base and data_base
++ // are calculated from the mmap_base
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, cdbr, sizeof(*cdbr));
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, cdbr->mmap_base, cdbr->mmap_size);
++ }
++}
++
++static void cdbr_write_range(void *ctx, struct __sanitizer_cdbr *cdbr) {
++ if (cdbr) {
++ // other pointers like hash_base, offset_base and data_base
++ // are calculated from the mmap_base
++ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, cdbr, sizeof(*cdbr));
++ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, cdbr->mmap_base, cdbr->mmap_size);
++ }
++}
++
++INTERCEPTOR(struct __sanitizer_cdbr *, cdbr_open, const char *path, int flags) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, cdbr_open, path, flags);
++ if (path)
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, path, REAL(strlen)(path) + 1);
++ struct __sanitizer_cdbr *ret = REAL(cdbr_open)(path, flags);
++ cdbr_write_range(ctx, ret);
++ return ret;
++}
++
++
++INTERCEPTOR(u32, cdbr_entries, struct __sanitizer_cdbr *cdbr) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, cdbr_entries, cdbr);
++ cdbr_read_range(ctx, cdbr);
++ return REAL(cdbr_entries)(cdbr);
++}
++
++INTERCEPTOR(int, cdbr_get, struct __sanitizer_cdbr *cdbr, u32 index,
++ const void **data, SIZE_T *datalen) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, cdbr_get, cdbr, index, data, datalen);
++ cdbr_read_range(ctx, cdbr);
++ int ret = REAL(cdbr_get)(cdbr, index, data, datalen);
++ if (data && datalen && ret == 0) {
++ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data, sizeof(*data));
++ if (*data) {
++ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, datalen, sizeof(*datalen));
++ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, *data, *datalen);
++ }
++ }
++ return ret;
++}
++
++INTERCEPTOR(int, cdbr_find, struct __sanitizer_cdbr *cdbr, const void *key,
++ SIZE_T keylen, const void **data, SIZE_T *datalen) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, cdbr_find, cdbr, key, keylen, data, datalen);
++ cdbr_read_range(ctx, cdbr);
++ if (key)
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, key, keylen);
++ int ret = REAL(cdbr_find)(cdbr, key, keylen, data, datalen);
++ if (data && datalen && ret == 0) {
++ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data, sizeof(*data));
++ if (*data) {
++ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, datalen, sizeof(*datalen));
++ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, *data, *datalen);
++ }
++ }
++ return ret;
++}
++
++INTERCEPTOR(void, cdbr_close, struct __sanitizer_cdbr *cdbr) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, cdbr_close, cdbr);
++ cdbr_read_range(ctx, cdbr);
++ REAL(cdbr_close)(cdbr);
++}
++
++#define INIT_CDBR \
++ COMMON_INTERCEPT_FUNCTION(cdbr_open); \
++ COMMON_INTERCEPT_FUNCTION(cdbr_entries); \
++ COMMON_INTERCEPT_FUNCTION(cdbr_get); \
++ COMMON_INTERCEPT_FUNCTION(cdbr_find); \
++ COMMON_INTERCEPT_FUNCTION(cdbr_close)
++#else
++#define INIT_CDBR
++#endif
++
++#if SANITIZER_INTERCEPT_RMD160
++
++INTERCEPTOR(void, RMD160Init, void *context) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, RMD160Init, context);
++ REAL(RMD160Init)(context);
++ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, context, RMD160_CTX_sz);
++}
++
++INTERCEPTOR(void, RMD160Update, void *context,
++ const unsigned char *data, unsigned int len) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, RMD160Update, context, data, len);
++ if (data)
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, data, len);
++ if (context)
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, context, RMD160_CTX_sz);
++ REAL(RMD160Update)(context, data, len);
++}
++
++INTERCEPTOR(void, RMD160Final, unsigned char digest[20], void *context) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, RMD160Final, digest, context);
++ REAL(RMD160Final)(digest, context);
++ if (digest)
++ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, digest, sizeof(unsigned char) * 20);
++}
++
++INTERCEPTOR(void, RMD160Transform, u32 state[5], const u32 buffer[16]) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, RMD160Transform, state, buffer);
++ if (state)
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, state, sizeof(u32) * 5);
++ if (buffer)
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, buffer, sizeof(u32) * 16);
++ REAL(RMD160Transform)(state, buffer);
++}
++
++INTERCEPTOR(char *, RMD160End, void *context, char *buf) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, RMD160End, context, buf);
++ if (context)
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, context, RMD160_CTX_sz);
++ char *ret = REAL(RMD160End)(context, buf);
++ if (ret)
++ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ret, RMD160_return_length);
++ return ret;
++}
++
++INTERCEPTOR(char *, RMD160File, char *filename, char *buf) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, RMD160File, filename, buf);
++ if (filename)
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, filename, REAL(strlen)(filename) + 1);
++ char *ret = REAL(RMD160File)(filename, buf);
++ if (ret)
++ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ret, RMD160_return_length);
++ return ret;
++}
++
++INTERCEPTOR(char *, RMD160Data, unsigned char *data, SIZE_T len, char *buf) {
++ void *ctx;
++ COMMON_INTERCEPTOR_ENTER(ctx, RMD160Data, data, len, buf);
++ if (data)
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, data, len);
++ char *ret = REAL(RMD160Data)(data, len, buf);
++ if (ret)
++ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ret, RMD160_return_length);
++ return ret;
++}
++
++#define INIT_RMD160 \
++ COMMON_INTERCEPT_FUNCTION(RMD160Init); \
++ COMMON_INTERCEPT_FUNCTION(RMD160Update); \
++ COMMON_INTERCEPT_FUNCTION(RMD160Final); \
++ COMMON_INTERCEPT_FUNCTION(RMD160Transform); \
++ COMMON_INTERCEPT_FUNCTION(RMD160End); \
++ COMMON_INTERCEPT_FUNCTION(RMD160File); \
++ COMMON_INTERCEPT_FUNCTION(RMD160Data)
++#else
++#define INIT_RMD160
++#endif
++
++#if SANITIZER_INTERCEPT_SHA2
++
++#define SHA2_INTERCEPTORS(LEN, SHA2_STATE_T) \
++ INTERCEPTOR(void, SHA##LEN##_Init, void *context) { \
++ void *ctx; \
++ COMMON_INTERCEPTOR_ENTER(ctx, SHA##LEN##_Init, context); \
++ REAL(SHA##LEN##_Init)(context); \
++ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, context, SHA##LEN##_CTX_sz); \
++ } \
++ INTERCEPTOR(void, SHA##LEN##_Update, void *context, \
++ const u8 *data, SIZE_T len) { \
++ void *ctx; \
++ COMMON_INTERCEPTOR_ENTER(ctx, SHA##LEN##_Update, context, data, len); \
++ if (data) \
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, data, len); \
++ if (context) \
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, context, SHA##LEN##_CTX_sz); \
++ REAL(SHA##LEN##_Update)(context, data, len); \
++ } \
++ INTERCEPTOR(void, SHA##LEN##_Pad, void *context) { \
++ void *ctx; \
++ COMMON_INTERCEPTOR_ENTER(ctx, SHA##LEN##_Pad, context); \
++ if (context) \
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, context, SHA##LEN##_CTX_sz); \
++ REAL(SHA##LEN##_Pad)(context); \
++ } \
++ INTERCEPTOR(void, SHA##LEN##_Final, u8 digest[SHA##LEN##_digest_length], void *context) { \
++ void *ctx; \
++ COMMON_INTERCEPTOR_ENTER(ctx, SHA##LEN##_Final, digest, context); \
++ REAL(SHA##LEN##_Final)(digest, context); \
++ if (digest) \
++ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, digest, \
++ sizeof(digest[0]) * SHA##LEN##_digest_length); \
++ } \
++ INTERCEPTOR(void, SHA##LEN##_Transform, SHA2_STATE_T state[8], \
++ const u8 buffer[SHA##LEN##_block_length]) { \
++ void *ctx; \
++ COMMON_INTERCEPTOR_ENTER(ctx, SHA##LEN##_Transform, state, buffer); \
++ if (state) \
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, state, sizeof(state[0]) * 8); \
++ if (buffer) \
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, buffer, \
++ sizeof(buffer[0]) * SHA##LEN##_block_length); \
++ REAL(SHA##LEN##_Transform)(state, buffer); \
++ } \
++ INTERCEPTOR(char *, SHA##LEN##_End, void *context, char *buf) { \
++ void *ctx; \
++ COMMON_INTERCEPTOR_ENTER(ctx, SHA##LEN##_End, context, buf); \
++ if (context) \
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, context, SHA##LEN##_CTX_sz); \
++ char *ret = REAL(SHA##LEN##_End)(context, buf); \
++ if (ret) \
++ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ret, SHA##LEN##_return_length); \
++ return ret; \
++ } \
++ INTERCEPTOR(char *, SHA##LEN##_File, const char *filename, char *buf) { \
++ void *ctx; \
++ COMMON_INTERCEPTOR_ENTER(ctx, SHA##LEN##_File, filename, buf); \
++ if (filename) \
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, filename, REAL(strlen)(filename) + 1); \
++ char *ret = REAL(SHA##LEN##_File)(filename, buf); \
++ if (ret) \
++ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ret, SHA##LEN##_return_length); \
++ return ret; \
++ } \
++ INTERCEPTOR(char *, SHA##LEN##_FileChunk, const char *filename, char *buf, \
++ OFF_T offset, OFF_T length) { \
++ void *ctx; \
++ COMMON_INTERCEPTOR_ENTER(ctx, SHA##LEN##_FileChunk, filename, buf, offset, length); \
++ if (filename) \
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, filename, REAL(strlen)(filename) + 1); \
++ char *ret = REAL(SHA##LEN##_FileChunk)(filename, buf, offset, length); \
++ if (ret) \
++ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ret, SHA##LEN##_return_length); \
++ return ret; \
++ } \
++ INTERCEPTOR(char *, SHA##LEN##_Data, u8 *data, SIZE_T len, char *buf) { \
++ void *ctx; \
++ COMMON_INTERCEPTOR_ENTER(ctx, SHA##LEN##_Data, data, len, buf); \
++ if (data) \
++ COMMON_INTERCEPTOR_READ_RANGE(ctx, data, len); \
++ char *ret = REAL(SHA##LEN##_Data)(data, len, buf); \
++ if (ret) \
++ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ret, SHA##LEN##_return_length); \
++ return ret; \
++ }
++
++SHA2_INTERCEPTORS(224, u32);
++SHA2_INTERCEPTORS(256, u32);
++SHA2_INTERCEPTORS(384, u64);
++SHA2_INTERCEPTORS(512, u64);
++
++
++#define INIT_SHA2 \
++ COMMON_INTERCEPT_FUNCTION(SHA224_Init); \
++ COMMON_INTERCEPT_FUNCTION(SHA224_Update); \
++ COMMON_INTERCEPT_FUNCTION(SHA224_Pad); \
++ COMMON_INTERCEPT_FUNCTION(SHA224_Final); \
++ COMMON_INTERCEPT_FUNCTION(SHA224_Transform); \
++ COMMON_INTERCEPT_FUNCTION(SHA224_End); \
++ COMMON_INTERCEPT_FUNCTION(SHA224_File); \
++ COMMON_INTERCEPT_FUNCTION(SHA224_FileChunk); \
++ COMMON_INTERCEPT_FUNCTION(SHA224_Data); \
++ COMMON_INTERCEPT_FUNCTION(SHA256_Init); \
++ COMMON_INTERCEPT_FUNCTION(SHA256_Update); \
++ COMMON_INTERCEPT_FUNCTION(SHA256_Pad); \
++ COMMON_INTERCEPT_FUNCTION(SHA256_Final); \
++ COMMON_INTERCEPT_FUNCTION(SHA256_Transform); \
++ COMMON_INTERCEPT_FUNCTION(SHA256_End); \
++ COMMON_INTERCEPT_FUNCTION(SHA256_File); \
++ COMMON_INTERCEPT_FUNCTION(SHA256_FileChunk); \
++ COMMON_INTERCEPT_FUNCTION(SHA256_Data); \
++ COMMON_INTERCEPT_FUNCTION(SHA384_Init); \
++ COMMON_INTERCEPT_FUNCTION(SHA384_Update); \
++ COMMON_INTERCEPT_FUNCTION(SHA384_Pad); \
++ COMMON_INTERCEPT_FUNCTION(SHA384_Final); \
++ COMMON_INTERCEPT_FUNCTION(SHA384_Transform); \
++ COMMON_INTERCEPT_FUNCTION(SHA384_End); \
++ COMMON_INTERCEPT_FUNCTION(SHA384_File); \
++ COMMON_INTERCEPT_FUNCTION(SHA384_FileChunk); \
++ COMMON_INTERCEPT_FUNCTION(SHA384_Data); \
++ COMMON_INTERCEPT_FUNCTION(SHA512_Init); \
++ COMMON_INTERCEPT_FUNCTION(SHA512_Update); \
++ COMMON_INTERCEPT_FUNCTION(SHA512_Pad); \
++ COMMON_INTERCEPT_FUNCTION(SHA512_Final); \
++ COMMON_INTERCEPT_FUNCTION(SHA512_Transform); \
++ COMMON_INTERCEPT_FUNCTION(SHA512_End); \
++ COMMON_INTERCEPT_FUNCTION(SHA512_File); \
++ COMMON_INTERCEPT_FUNCTION(SHA512_FileChunk); \
++ COMMON_INTERCEPT_FUNCTION(SHA512_Data)
++
++#undef SHA2_INTERCEPTORS
++
++#else
++#define INIT_SHA2
++#endif
+
static void InitializeCommonInterceptors() {
static u64 metadata_mem[sizeof(MetadataHashMap) / sizeof(u64) + 1];
interceptor_metadata_map = new((void *)&metadata_mem) MetadataHashMap();
-@@ -7436,6 +8534,22 @@ static void InitializeCommonInterceptors
+@@ -7436,6 +8971,28 @@ static void InitializeCommonInterceptors
INIT_TTYENT;
INIT_PROTOENT;
INIT_NETENT;
@@ -1158,6 +1604,12 @@ $NetBSD$
+ INIT_NL_LANGINFO;
+ INIT_FPARSELN;
+ INIT_MODCTL;
++ INIT_STATVFS1;
++ INIT_NETBSD_MOUNT;
++ INIT_FSEEK;
++ INIT_CDBR;
++ INIT_RMD160;
++ INIT_SHA2;
INIT___PRINTF_CHK;
}
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 12a5f5db50..bcc87fa880 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
@@ -2,7 +2,7 @@ $NetBSD$
--- lib/sanitizer_common/sanitizer_platform_interceptors.h.orig 2018-06-06 19:08:28.000000000 +0000
+++ lib/sanitizer_common/sanitizer_platform_interceptors.h
-@@ -507,4 +507,21 @@
+@@ -507,4 +507,27 @@
#define SANITIZER_INTERCEPT_PROTOENT SI_NETBSD
#define SANITIZER_INTERCEPT_NETENT SI_NETBSD
@@ -22,5 +22,11 @@ $NetBSD$
+#define SANITIZER_INTERCEPT_NL_LANGINFO SI_POSIX
+#define SANITIZER_INTERCEPT_FPARSELN SI_POSIX
+#define SANITIZER_INTERCEPT_MODCTL SI_NETBSD
++#define SANITIZER_INTERCEPT_STATVFS1 SI_NETBSD
++#define SANITIZER_INTERCEPT_NETBSD_MOUNT SI_NETBSD
++#define SANITIZER_INTERCEPT_FSEEK SI_POSIX
++#define SANITIZER_INTERCEPT_CDBR SI_NETBSD
++#define SANITIZER_INTERCEPT_RMD160 SI_NETBSD
++#define SANITIZER_INTERCEPT_SHA2 SI_NETBSD
+
#endif // #ifndef SANITIZER_PLATFORM_INTERCEPTORS_H
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc
index 6c57eb6efb..cf9c112abb 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc
@@ -36,7 +36,20 @@ $NetBSD$
#include <net/bpf.h>
#include <net/if_atm.h>
#include <net/if_gre.h>
-@@ -173,6 +181,7 @@
+@@ -134,10 +142,12 @@
+ #include <netinet6/nd6.h>
+ #include <netnatm/natm.h>
+ #include <netsmb/smb_dev.h>
++#include <rmd160.h>
+ #include <soundcard.h>
+ #include <sys/agpio.h>
+ #include <sys/ataio.h>
+ #include <sys/audioio.h>
++#include <sys/cdbr.h>
+ #include <sys/cdio.h>
+ #include <sys/chio.h>
+ #include <sys/clockctl.h>
+@@ -173,6 +183,7 @@
#include <sys/filio.h>
#include <sys/ipc.h>
#include <sys/mman.h>
@@ -44,15 +57,16 @@ $NetBSD$
#include <sys/mount.h>
#include <sys/mqueue.h>
#include <sys/msg.h>
-@@ -180,6 +189,7 @@
+@@ -180,6 +191,8 @@
#include <sys/ptrace.h>
#include <sys/resource.h>
#include <sys/sem.h>
+#include <sys/sha1.h>
++#include <sys/sha2.h>
#include <sys/shm.h>
#include <sys/signal.h>
#include <sys/socket.h>
-@@ -202,8 +212,13 @@
+@@ -202,8 +215,13 @@
#include <utime.h>
#include <utmp.h>
#include <utmpx.h>
@@ -66,7 +80,7 @@ $NetBSD$
// Include these after system headers to avoid name clashes and ambiguities.
#include "sanitizer_internal_defs.h"
-@@ -238,6 +253,10 @@ unsigned struct_rlimit_sz = sizeof(struc
+@@ -238,6 +256,10 @@ unsigned struct_rlimit_sz = sizeof(struc
unsigned struct_timespec_sz = sizeof(struct timespec);
unsigned struct_sembuf_sz = sizeof(struct sembuf);
unsigned struct_kevent_sz = sizeof(struct kevent);
@@ -77,25 +91,53 @@ $NetBSD$
unsigned struct_utimbuf_sz = sizeof(struct utimbuf);
unsigned struct_itimerspec_sz = sizeof(struct itimerspec);
unsigned struct_timex_sz = sizeof(struct timex);
-@@ -2063,6 +2082,21 @@ unsigned IOCTL_SNDCTL_DSP_SILENCE = SNDC
+@@ -2063,6 +2085,38 @@ unsigned IOCTL_SNDCTL_DSP_SILENCE = SNDC
const int si_SEGV_MAPERR = SEGV_MAPERR;
const int si_SEGV_ACCERR = SEGV_ACCERR;
+
-+unsigned SHA1_CTX_sz = sizeof(SHA1_CTX);
-+unsigned SHA1_return_length = 41;
-+unsigned MD2_CTX_sz = sizeof(MD2_CTX);
-+unsigned MD2_return_length = 33;
-+unsigned MD4_CTX_sz = sizeof(MD4_CTX);
-+unsigned MD4_return_length = 33;
-+unsigned MD5_CTX_sz = sizeof(MD5_CTX);
-+unsigned MD5_return_length = 33;
-+int unvis_valid = UNVIS_VALID;
-+int unvis_validpush = UNVIS_VALIDPUSH;
-+int modctl_load = MODCTL_LOAD;
-+int modctl_unload = MODCTL_UNLOAD;
-+int modctl_stat = MODCTL_STAT;
-+int modctl_exists = MODCTL_EXISTS;
++const unsigned SHA1_CTX_sz = sizeof(SHA1_CTX);
++const unsigned SHA1_return_length = SHA1_DIGEST_STRING_LENGTH; // 41
++const unsigned MD2_CTX_sz = sizeof(MD2_CTX);
++const unsigned MD2_return_length = MD2_DIGEST_STRING_LENGTH; // 33
++const unsigned MD4_CTX_sz = sizeof(MD4_CTX);
++const unsigned MD4_return_length = 33;
++const unsigned MD5_CTX_sz = sizeof(MD5_CTX);
++const unsigned MD5_return_length = MD5_DIGEST_STRING_LENGTH; // 33
++const unsigned RMD160_CTX_sz = sizeof(RMD160_CTX);
++const unsigned RMD160_return_length = RMD160_DIGEST_STRING_LENGTH;// 41
++
++#define SHA2_CONST(LEN) \
++ const unsigned SHA##LEN##_CTX_sz = sizeof(SHA##LEN##_CTX); \
++ const unsigned SHA##LEN##_return_length = SHA##LEN##_DIGEST_STRING_LENGTH; \
++ const unsigned SHA##LEN##_block_length = SHA##LEN##_BLOCK_LENGTH; \
++ const unsigned SHA##LEN##_digest_length = SHA##LEN##_DIGEST_LENGTH
++
++SHA2_CONST(224);
++SHA2_CONST(256);
++SHA2_CONST(384);
++SHA2_CONST(512);
++
++#undef SHA2_CONST
++
++const int unvis_valid = UNVIS_VALID;
++const int unvis_validpush = UNVIS_VALIDPUSH;
++const int modctl_load = MODCTL_LOAD;
++const int modctl_unload = MODCTL_UNLOAD;
++const int modctl_stat = MODCTL_STAT;
++const int modctl_exists = MODCTL_EXISTS;
++const unsigned fpos_t_sz = sizeof(fpos_t);
} // namespace __sanitizer
using namespace __sanitizer;
+@@ -2224,4 +2278,10 @@ CHECK_SIZE_AND_OFFSET(group, gr_passwd);
+ CHECK_SIZE_AND_OFFSET(group, gr_gid);
+ CHECK_SIZE_AND_OFFSET(group, gr_mem);
+
++CHECK_TYPE_SIZE(modctl_load_t);
++CHECK_SIZE_AND_OFFSET(modctl_load_t, ml_filename);
++CHECK_SIZE_AND_OFFSET(modctl_load_t, ml_flags);
++CHECK_SIZE_AND_OFFSET(modctl_load_t, ml_props);
++CHECK_SIZE_AND_OFFSET(modctl_load_t, ml_propslen);
++
+ #endif // SANITIZER_NETBSD
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h
index ed479cac86..a624ff1e39 100644
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.h
@@ -26,21 +26,37 @@ $NetBSD$
struct __sanitizer_ptrace_io_desc {
int piod_op;
void *piod_offs;
-@@ -2194,6 +2204,28 @@ extern unsigned IOCTL_SNDCTL_DSP_SILENCE
+@@ -2194,6 +2204,69 @@ extern unsigned IOCTL_SNDCTL_DSP_SILENCE
extern const int si_SEGV_MAPERR;
extern const int si_SEGV_ACCERR;
+
-+extern unsigned SHA1_CTX_sz;
-+extern unsigned SHA1_return_length;
-+extern unsigned MD2_CTX_sz;
-+extern unsigned MD2_return_length;
-+extern unsigned MD4_CTX_sz;
-+extern unsigned MD4_return_length;
-+extern unsigned MD5_CTX_sz;
-+extern unsigned MD5_return_length;
-+extern int unvis_valid;
-+extern int unvis_validpush;
++extern const unsigned SHA1_CTX_sz;
++extern const unsigned SHA1_return_length;
++extern const unsigned MD2_CTX_sz;
++extern const unsigned MD2_return_length;
++extern const unsigned MD4_CTX_sz;
++extern const unsigned MD4_return_length;
++extern const unsigned MD5_CTX_sz;
++extern const unsigned MD5_return_length;
++extern const unsigned RMD160_CTX_sz;
++extern const unsigned RMD160_return_length;
++
++#define SHA2_EXTERN(LEN)\
++ extern const unsigned SHA##LEN##_CTX_sz; \
++ extern const unsigned SHA##LEN##_return_length; \
++ extern const unsigned SHA##LEN##_block_length; \
++ extern const unsigned SHA##LEN##_digest_length
++
++SHA2_EXTERN(224);
++SHA2_EXTERN(256);
++SHA2_EXTERN(384);
++SHA2_EXTERN(512);
++
++#undef SHA2_EXTERN
++
++extern const int unvis_valid;
++extern const int unvis_validpush;
+
+typedef struct __sanitizer_modctl_load {
+ const char *ml_filename;
@@ -48,10 +64,35 @@ $NetBSD$
+ const char *ml_props;
+ uptr ml_propslen;
+} __sanitizer_modctl_load_t;
-+extern int modctl_load;
-+extern int modctl_unload;
-+extern int modctl_stat;
-+extern int modctl_exists;
++extern const int modctl_load;
++extern const int modctl_unload;
++extern const int modctl_stat;
++extern const int modctl_exists;
++extern const unsigned fpos_t_sz;
++
++struct __sanitizer_cdbr {
++ void (*unmap)(void *, void *, uptr);
++ void *cookie;
++ u8 *mmap_base;
++ uptr mmap_size;
++
++ u8 *hash_base;
++ u8 *offset_base;
++ u8 *data_base;
++
++ u32 data_size;
++ u32 entries;
++ u32 entries_index;
++ u32 seed;
++
++ u8 offset_size;
++ u8 index_size;
++
++ u32 entries_m;
++ u32 entries_index_m;
++ u8 entries_s1, entries_s2;
++ u8 entries_index_s1, entries_index_s2;
++};
} // namespace __sanitizer
#define CHECK_TYPE_SIZE(TYPE) \
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc
new file mode 100644
index 0000000000..0b41f04fc0
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.cc
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- lib/sanitizer_common/sanitizer_platform_limits_posix.cc.orig 2018-06-01 09:39:33.000000000 +0000
++++ lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -945,6 +945,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(El
+
+ const int si_SEGV_MAPERR = SEGV_MAPERR;
+ const int si_SEGV_ACCERR = SEGV_ACCERR;
++ const unsigned fpos_t_sz = sizeof(fpos_t);
+ } // namespace __sanitizer
+
+ using namespace __sanitizer;
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h
new file mode 100644
index 0000000000..015d080cf2
--- /dev/null
+++ b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__posix.h
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- lib/sanitizer_common/sanitizer_platform_limits_posix.h.orig 2018-04-25 21:13:40.000000000 +0000
++++ lib/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -1504,6 +1504,7 @@ struct __sanitizer_cookie_io_functions_t
+
+ extern const int si_SEGV_MAPERR;
+ extern const int si_SEGV_ACCERR;
++ extern const unsigned fpos_t_sz;
+ } // namespace __sanitizer
+
+ #define CHECK_TYPE_SIZE(TYPE) \
Home |
Main Index |
Thread Index |
Old Index