]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: expand error for signal received on non-Go thread.
authorAlan Donovan <adonovan@google.com>
Fri, 15 Feb 2013 04:37:14 +0000 (23:37 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 15 Feb 2013 04:37:14 +0000 (23:37 -0500)
We call runtime.findnull dynamically to avoid exceeding the
static nosplit stack limit check.  (Thanks minux!)

Fixes #4048.

R=rsc, minux.ma, ality
CC=golang-dev
https://golang.org/cl/7232066

src/pkg/runtime/thread_darwin.c
src/pkg/runtime/thread_freebsd.c
src/pkg/runtime/thread_linux.c
src/pkg/runtime/thread_netbsd.c
src/pkg/runtime/thread_openbsd.c

index ab3257572a7a2125a6600ba249c586db0fdd4e51..0758d6858db6637c18bf0933de3677bc725a0a40 100644 (file)
@@ -497,7 +497,7 @@ runtime·badcallback(void)
        runtime·write(2, badcallback, sizeof badcallback - 1);
 }
 
-static int8 badsignal[] = "runtime: signal received on thread not created by Go.\n";
+static int8 badsignal[] = "runtime: signal received on thread not created by Go";
 
 // This runs on a foreign stack, without an m or a g.  No stack split.
 #pragma textflag 7
@@ -508,5 +508,11 @@ runtime·badsignal(int32 sig)
                return;  // Ignore SIGPROFs intended for a non-Go thread.
        }
        runtime·write(2, badsignal, sizeof badsignal - 1);
+       if (0 <= sig && sig < NSIG) {
+               // Call runtime·findnull dynamically to circumvent static stack size check.
+               static int32 (*findnull)(byte*) = runtime·findnull;
+               runtime·write(2, runtime·sigtab[sig].name, findnull((byte*)runtime·sigtab[sig].name));
+       }
+       runtime·write(2, "\n", 1);
        runtime·exit(1);
 }
index 54c26215a605146451b5f64e9940005cc7c40beb..eba794cb333d0ee37eb6cef8742c4f77a15f1345 100644 (file)
@@ -206,7 +206,7 @@ runtime·badcallback(void)
        runtime·write(2, badcallback, sizeof badcallback - 1);
 }
 
-static int8 badsignal[] = "runtime: signal received on thread not created by Go.\n";
+static int8 badsignal[] = "runtime: signal received on thread not created by Go";
 
 // This runs on a foreign stack, without an m or a g.  No stack split.
 #pragma textflag 7
@@ -217,5 +217,11 @@ runtime·badsignal(int32 sig)
                return;  // Ignore SIGPROFs intended for a non-Go thread.
        }
        runtime·write(2, badsignal, sizeof badsignal - 1);
+       if (0 <= sig && sig < NSIG) {
+               // Call runtime·findnull dynamically to circumvent static stack size check.
+               static int32 (*findnull)(byte*) = runtime·findnull;
+               runtime·write(2, runtime·sigtab[sig].name, findnull((byte*)runtime·sigtab[sig].name));
+       }
+       runtime·write(2, "\n", 1);
        runtime·exit(1);
 }
index dc8cad57a98f9de66904f5bb6e642d6678d468b4..778b9078b90f2a6c5d74080acee5575c2954bab4 100644 (file)
@@ -256,7 +256,7 @@ runtime·badcallback(void)
        runtime·write(2, badcallback, sizeof badcallback - 1);
 }
 
-static int8 badsignal[] = "runtime: signal received on thread not created by Go.\n";
+static int8 badsignal[] = "runtime: signal received on thread not created by Go";
 
 // This runs on a foreign stack, without an m or a g.  No stack split.
 #pragma textflag 7
@@ -267,5 +267,11 @@ runtime·badsignal(int32 sig)
                return;  // Ignore SIGPROFs intended for a non-Go thread.
        }
        runtime·write(2, badsignal, sizeof badsignal - 1);
+       if (0 <= sig && sig < NSIG) {
+               // Call runtime·findnull dynamically to circumvent static stack size check.
+               static int32 (*findnull)(byte*) = runtime·findnull;
+               runtime·write(2, runtime·sigtab[sig].name, findnull((byte*)runtime·sigtab[sig].name));
+       }
+       runtime·write(2, "\n", 1);
        runtime·exit(1);
 }
index 4d174a537b1b92b0f7fafbc32baf106b3ffe4357..cf66d9c79784bcfa124fc9f73c1c66b206247a7d 100644 (file)
@@ -252,7 +252,7 @@ runtime·badcallback(void)
        runtime·write(2, badcallback, sizeof badcallback - 1);
 }
 
-static int8 badsignal[] = "runtime: signal received on thread not created by Go.\n";
+static int8 badsignal[] = "runtime: signal received on thread not created by Go";
 
 // This runs on a foreign stack, without an m or a g.  No stack split.
 #pragma textflag 7
@@ -263,5 +263,11 @@ runtime·badsignal(int32 sig)
                return;  // Ignore SIGPROFs intended for a non-Go thread.
        }
        runtime·write(2, badsignal, sizeof badsignal - 1);
+       if (0 <= sig && sig < NSIG) {
+               // Call runtime·findnull dynamically to circumvent static stack size check.
+               static int32 (*findnull)(byte*) = runtime·findnull;
+               runtime·write(2, runtime·sigtab[sig].name, findnull((byte*)runtime·sigtab[sig].name));
+       }
+       runtime·write(2, "\n", 1);
        runtime·exit(1);
 }
index 57f64cf589dd1017ad8a8c46c8f876bcb5558b79..fd42f28e8bd5c223c189fd6857d93aa77f04c678 100644 (file)
@@ -229,7 +229,7 @@ runtime·badcallback(void)
        runtime·write(2, badcallback, sizeof badcallback - 1);
 }
 
-static int8 badsignal[] = "runtime: signal received on thread not created by Go.\n";
+static int8 badsignal[] = "runtime: signal received on thread not created by Go";
 
 // This runs on a foreign stack, without an m or a g.  No stack split.
 #pragma textflag 7
@@ -240,5 +240,11 @@ runtime·badsignal(int32 sig)
                return;  // Ignore SIGPROFs intended for a non-Go thread.
        }
        runtime·write(2, badsignal, sizeof badsignal - 1);
+       if (0 <= sig && sig < NSIG) {
+               // Call runtime·findnull dynamically to circumvent static stack size check.
+               static int32 (*findnull)(byte*) = runtime·findnull;
+               runtime·write(2, runtime·sigtab[sig].name, findnull((byte*)runtime·sigtab[sig].name));
+       }
+       runtime·write(2, "\n", 1);
        runtime·exit(1);
 }