#include "sanitizer_common/sanitizer_common_syscalls.inc"
#include "sanitizer_common/sanitizer_syscalls_netbsd.inc"
+INTERCEPTOR(const char *, strsignal, int sig) {
+ void *ctx;
+ COMMON_INTERCEPTOR_ENTER(ctx, strsignal, sig);
+ const char *res = REAL(strsignal)(sig);
+ if (res)
+ __msan_unpoison(res, internal_strlen(res) + 1);
+ return res;
+}
+
struct dlinfo {
char *dli_fname;
void *dli_fbase;
INTERCEPT_FUNCTION(gethostname);
MSAN_MAYBE_INTERCEPT_EPOLL_WAIT;
MSAN_MAYBE_INTERCEPT_EPOLL_PWAIT;
+ INTERCEPT_FUNCTION(strsignal);
INTERCEPT_FUNCTION(dladdr);
INTERCEPT_FUNCTION(dlerror);
INTERCEPT_FUNCTION(dl_iterate_phdr);
--- /dev/null
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t
+
+#include <assert.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+
+int main(void) {
+ const char *p = strsignal(SIGSEGV);
+ assert(p);
+ printf("%s %zu\n", p, strlen(p));
+ return 0;
+}