From 76deefd0cd9c4066f2f7000b9b7fb475bddcc5c9 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 22 Sep 2014 21:14:43 +0000 Subject: [PATCH] runtime: Mark runtime_goexit function as noinline. If the compiler inlines this function into kickoff, it may reuse the TLS block address to load g. However, this is not necessarily correct, as the call to g->entry in kickoff may cause the TLS address to change. If the wrong value is loaded for g->status in runtime_goexit, it may cause a runtime panic. By marking the function as noinline we prevent the compiler from reusing the TLS address. From-SVN: r215484 --- libgo/runtime/proc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c index 4195aff76a78..87cd3edac00a 100644 --- a/libgo/runtime/proc.c +++ b/libgo/runtime/proc.c @@ -1894,6 +1894,7 @@ runtime_gosched0(G *gp) // Need to mark it as nosplit, because it runs with sp > stackbase (as runtime_lessstack). // Since it does not return it does not matter. But if it is preempted // at the split stack check, GC will complain about inconsistent sp. +void runtime_goexit(void) __attribute__ ((noinline)); void runtime_goexit(void) { -- 2.43.5