-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[compiler-rt] Remove SHA2 interceptions for NetBSD/FreeBSD. #110246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-compiler-rt-sanitizer Author: David CARLIER (devnexen) ChangesTo Fix #110215 Full diff: https://github.com/llvm/llvm-project/pull/110246.diff 2 Files Affected:
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
index 7898af4a335e3a..8146d707f01368 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -9076,107 +9076,6 @@ INTERCEPTOR(char *, MD2Data, const unsigned char *data, unsigned int len,
#define INIT_MD2
#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); \
- if (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 && len > 0) \
- 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); \
- if (context) \
- COMMON_INTERCEPTOR_WRITE_RANGE(ctx, context, SHA##LEN##_CTX_sz); \
- } \
- INTERCEPTOR(void, SHA##LEN##_Final, u8 digest[LEN/8], \
- void *context) { \
- void *ctx; \
- CHECK_EQ(SHA##LEN##_digest_length, LEN/8); \
- COMMON_INTERCEPTOR_ENTER(ctx, SHA##LEN##_Final, digest, context); \
- if (context) \
- COMMON_INTERCEPTOR_READ_RANGE(ctx, context, SHA##LEN##_CTX_sz); \
- REAL(SHA##LEN##_Final)(digest, context); \
- if (digest) \
- COMMON_INTERCEPTOR_WRITE_RANGE(ctx, digest, \
- sizeof(digest[0]) * \
- SHA##LEN##_digest_length); \
- } \
- 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, internal_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, internal_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 && len > 0) \
- 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_INTECEPTORS(LEN) \
- COMMON_INTERCEPT_FUNCTION(SHA##LEN##_Init); \
- COMMON_INTERCEPT_FUNCTION(SHA##LEN##_Update); \
- COMMON_INTERCEPT_FUNCTION(SHA##LEN##_Final); \
- COMMON_INTERCEPT_FUNCTION(SHA##LEN##_End); \
- COMMON_INTERCEPT_FUNCTION(SHA##LEN##_File); \
- COMMON_INTERCEPT_FUNCTION(SHA##LEN##_FileChunk); \
- COMMON_INTERCEPT_FUNCTION(SHA##LEN##_Data)
-
-#define INIT_SHA2 \
- INIT_SHA2_INTECEPTORS(224); \
- INIT_SHA2_INTECEPTORS(256); \
- INIT_SHA2_INTECEPTORS(384); \
- INIT_SHA2_INTECEPTORS(512)
-#undef SHA2_INTERCEPTORS
-#else
-#define INIT_SHA2
-#endif
-
#if SANITIZER_INTERCEPT_VIS
INTERCEPTOR(char *, vis, char *dst, int c, int flag, int nextc) {
void *ctx;
@@ -10655,7 +10554,6 @@ static void InitializeCommonInterceptors() {
INIT_MD5;
INIT_FSEEK;
INIT_MD2;
- INIT_SHA2;
INIT_VIS;
INIT_CDB;
INIT_GETFSENT;
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
index d4cc380f641b82..e53b95d18a1bf3 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
@@ -567,7 +567,6 @@
#define SANITIZER_INTERCEPT_MD5 (SI_NETBSD || SI_FREEBSD)
#define SANITIZER_INTERCEPT_FSEEK (SI_NETBSD || SI_FREEBSD)
#define SANITIZER_INTERCEPT_MD2 SI_NETBSD
-#define SANITIZER_INTERCEPT_SHA2 (SI_NETBSD || SI_FREEBSD)
#define SANITIZER_INTERCEPT_CDB SI_NETBSD
#define SANITIZER_INTERCEPT_VIS (SI_NETBSD || SI_FREEBSD)
#define SANITIZER_INTERCEPT_POPEN SI_POSIX
|
@@ -10655,7 +10554,6 @@ static void InitializeCommonInterceptors() { | |||
INIT_MD5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove md5?
From my experience interceptors, other then alloc, mem* str*, detect very few issues, however require some maintaince.
Some interceptors are unavoidable to maintan state, e.g. signals, pthread etc. For msan almost all interceptors are needed. However for asan they are mostly optional.
So looking back, in my opinion, we should rather avoid interceptor if we can.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/73/builds/6794 Here is the relevant piece of the build log for the reference
|
…BSD. (llvm#110246) To Fix llvm#110215 Interceptors introduced with 18a7ebd
) To Fix llvm#110215 Interceptors introduced with 18a7ebd (cherry picked from commit d0b9c2c)
) To Fix llvm#110215 Interceptors introduced with 18a7ebd (cherry picked from commit d0b9c2c)
To Fix #110215
Interceptors introduced with 18a7ebd