pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
compiler-rt-netbsd: Handle sigaction syscall renaming
Module Name: pkgsrc-wip
Committed By: Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By: kamil
Date: Wed Jun 28 19:08:37 2017 +0200
Changeset: 3e7c52b97b4d6cb8ea69a081409ac818c812c34a
Modified Files:
compiler-rt-netbsd/distinfo
compiler-rt-netbsd/patches/patch-lib_interception_interception__linux.cc
Log Message:
compiler-rt-netbsd: Handle sigaction syscall renaming
With this patch, llvm asan with with clang works.
$ cat test.c
int
main(int argc, char **argv)
{
printf("%s", argv[argc+10000]);
return 0;
}
$ /usr/pkg/bin/clang -fno-omit-frame-pointer -O0 -g -ggdb -U_FORTIFY_SOURCE -fsanitize=address -v test.c -o bin-czz
$ ./bin-czz
ASAN:DEADLYSIGNAL
=================================================================
==13478==ERROR: AddressSanitizer: SEGV on unknown address 0x1fefffed72f6
(pc 0x00000047fcb1 bp 0x7f7fff6a5ef0 sp 0x7f7fff6a5ed0 T0)
==13478==The signal is caused by a READ memory access.
#0 0x47fcb0 in main /tmp/test.c:6:15
#1 0x409dfa in ___start (/tmp/bin-czz+0x409dfa)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /tmp/test.c:6:15 in main
==13478==ABORTING
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=3e7c52b97b4d6cb8ea69a081409ac818c812c34a
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
compiler-rt-netbsd/distinfo | 2 +-
.../patch-lib_interception_interception__linux.cc | 25 ++++++++++++++++++++--
2 files changed, 24 insertions(+), 3 deletions(-)
diffs:
diff --git a/compiler-rt-netbsd/distinfo b/compiler-rt-netbsd/distinfo
index 1a3b2ab133..c94f2d7c0f 100644
--- a/compiler-rt-netbsd/distinfo
+++ b/compiler-rt-netbsd/distinfo
@@ -21,7 +21,7 @@ SHA1 (patch-lib_asan_asan__stack.h) = a3dd10b42713265f6a54a2b86e33420b052f431f
SHA1 (patch-lib_asan_scripts_asan__symbolize.py) = d6c079e7092b22b5379293dbb8d1e2445e077932
SHA1 (patch-lib_builtins_gcc__personality__v0.c) = 66c36733afc7043f662328303de2573fd9005bf3
SHA1 (patch-lib_interception_interception.h) = f18c140feec3c88fec57ac7ba1fbedb03db2bac6
-SHA1 (patch-lib_interception_interception__linux.cc) = 168f375658c09900b12ab73ba22d7166a488afb3
+SHA1 (patch-lib_interception_interception__linux.cc) = a7c8a898784eb8424ca17dd96cf8faac4b3057bb
SHA1 (patch-lib_interception_interception__linux.h) = 2f37344082e935a99fc04203453d387fe78bd6d3
SHA1 (patch-lib_safestack_safestack.cc) = 6ccd97d3253eb3e284fc8375e651f2527317d88a
SHA1 (patch-lib_sanitizer__common_CMakeLists.txt) = 45b18179c5d1d9f284ccfe4670a989ac30d05e92
diff --git a/compiler-rt-netbsd/patches/patch-lib_interception_interception__linux.cc b/compiler-rt-netbsd/patches/patch-lib_interception_interception__linux.cc
index 865b6c4203..388322ef1c 100644
--- a/compiler-rt-netbsd/patches/patch-lib_interception_interception__linux.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_interception_interception__linux.cc
@@ -2,7 +2,7 @@ $NetBSD$
--- lib/interception/interception_linux.cc.orig 2017-06-03 23:53:56.000000000 +0000
+++ lib/interception/interception_linux.cc
-@@ -12,7 +12,7 @@
+@@ -12,14 +12,28 @@
// Linux-specific interception methods.
//===----------------------------------------------------------------------===//
@@ -11,7 +11,28 @@ $NetBSD$
#include "interception.h"
#include <dlfcn.h> // for dlsym() and dlvsym()
-@@ -33,4 +33,4 @@ void *GetFuncAddrVer(const char *func_na
+
++#ifdef __NetBSD__
++static int mystrcmp(const char *s1, const char *s2) {
++ while (*s1 == *s2++)
++ if (*s1++ == 0)
++ return (0);
++ return (*(const unsigned char *)s1 - *(const unsigned char *)--s2);
++}
++#endif
++
+ namespace __interception {
+ bool GetRealFunctionAddress(const char *func_name, uptr *func_addr,
+ uptr real, uptr wrapper) {
++#ifdef __NetBSD__
++ // XXX: Until I come up with something better to deal with renames.
++ if (mystrcmp(func_name, "sigaction") == 0)
++ func_name = "__sigaction14";
++#endif
+ *func_addr = (uptr)dlsym(RTLD_NEXT, func_name);
+ return real == wrapper;
+ }
+@@ -33,4 +47,4 @@ void *GetFuncAddrVer(const char *func_na
} // namespace __interception
Home |
Main Index |
Thread Index |
Old Index