• Ian Lance Taylor's avatar
    cmd/compile: don't instrument copy and append in runtime · 9d8522fd
    Ian Lance Taylor authored
    Instrumenting copy and append for the race detector changes them to call
    different functions. In the runtime package the alternate functions are
    not marked as nosplit. This caused a crash in the SIGPROF handler when
    invoked on a non-Go thread in a program built with the race detector. In
    some cases the handler can call copy, the race detector changed that to
    a call to a non-nosplit function, the function tried to check the stack
    guard, and crashed because it was running on a non-Go thread. The
    SIGPROF handler is written carefully to avoid such problems, but hidden
    function calls are difficult to avoid.
    
    Fix this by changing the compiler to not instrument copy and append when
    compiling the runtime package. Change the runtime package to add
    explicit race checks for the only code I could find where copy is used
    to write to user data (append is never used).
    
    Change-Id: I11078a66c0aaa459a7d2b827b49f4147922050af
    Reviewed-on: https://go-review.googlesource.com/29472
    Run-TryBot: Ian Lance Taylor <iant@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarDmitry Vyukov <dvyukov@google.com>
    9d8522fd
Name
Last commit
Last update
..
internal Loading commit data...
doc.go Loading commit data...
fmt_test.go Loading commit data...
main.go Loading commit data...