Merge "Update kernel headers and add syscall "perf_event_open""
diff --git a/libc/netbsd/net/getaddrinfo.c b/libc/netbsd/net/getaddrinfo.c
index 7dd65ff..326b09c 100644
--- a/libc/netbsd/net/getaddrinfo.c
+++ b/libc/netbsd/net/getaddrinfo.c
@@ -479,7 +479,7 @@
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 eed23a7..8a1e95e 100644
--- a/libc/netbsd/net/getnameinfo.c
+++ b/libc/netbsd/net/getnameinfo.c
@@ -201,7 +201,7 @@
}
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 40411b1..899a5b2 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 @@
/* 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()