diff options
-rw-r--r-- | libc/netbsd/net/getaddrinfo.c | 2 | ||||
-rw-r--r-- | libc/netbsd/net/getnameinfo.c | 2 | ||||
-rw-r--r-- | linker/debugger.c | 20 |
3 files changed, 22 insertions, 2 deletions
diff --git a/libc/netbsd/net/getaddrinfo.c b/libc/netbsd/net/getaddrinfo.c index 7dd65ff3a..326b09c58 100644 --- a/libc/netbsd/net/getaddrinfo.c +++ b/libc/netbsd/net/getaddrinfo.c @@ -479,7 +479,7 @@ android_getaddrinfo_proxy( goto exit; } - char buf[5]; + char buf[4]; // read result code for gethostbyaddr if (fread(buf, 1, sizeof(buf), proxy) != sizeof(buf)) { goto exit; diff --git a/libc/netbsd/net/getnameinfo.c b/libc/netbsd/net/getnameinfo.c index eed23a7c7..8a1e95e08 100644 --- a/libc/netbsd/net/getnameinfo.c +++ b/libc/netbsd/net/getnameinfo.c @@ -201,7 +201,7 @@ android_gethostbyaddr_proxy(char* nameBuf, size_t nameBufLen, const void *addr, } result = 0; - char msg_buf[5]; + char msg_buf[4]; // read result code for gethostbyaddr if (fread(msg_buf, 1, sizeof(msg_buf), proxy) != sizeof(msg_buf)) { goto exit; diff --git a/linker/debugger.c b/linker/debugger.c index 40411b11a..899a5b2e7 100644 --- a/linker/debugger.c +++ b/linker/debugger.c @@ -40,6 +40,8 @@ #include <sys/socket.h> #include <sys/un.h> +extern int tgkill(int tgid, int tid, int sig); + void notify_gdb_of_libraries(); #define RETRY_ON_EINTR(ret,cond) \ @@ -181,6 +183,24 @@ void debugger_signal_handler(int n, siginfo_t* info, void* unused) /* remove our net so we fault for real when we return */ signal(n, SIG_DFL); + + /* + * These signals are not re-thrown when we resume. This means that + * crashing due to (say) SIGPIPE doesn't work the way you'd expect it + * to. We work around this by throwing them manually. We don't want + * to do this for *all* signals because it'll screw up the address for + * faults like SIGSEGV. + */ + switch (n) { + case SIGABRT: + case SIGFPE: + case SIGPIPE: + case SIGSTKFLT: + (void) tgkill(getpid(), gettid(), n); + break; + default: // SIGILL, SIGBUS, SIGSEGV + break; + } } void debugger_init() |