mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: disable CPU profiling before removing the SIGPROF handler
Otherwise, in c-archive or c-shared mode, there is the chance of getting a SIGPROF just after the signal handler is removed but before profiling is disabled, in which case the program will die. Fixes #46498 Change-Id: I5492beef45fec9fb9a7f58724356d6aedaf799ac Reviewed-on: https://go-review.googlesource.com/c/go/+/329290 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
parent
6f22d2c682
commit
57aaa19aae
1 changed files with 2 additions and 2 deletions
|
|
@ -280,6 +280,8 @@ func setProcessCPUProfiler(hz int32) {
|
||||||
it.it_value = it.it_interval
|
it.it_value = it.it_interval
|
||||||
setitimer(_ITIMER_PROF, &it, nil)
|
setitimer(_ITIMER_PROF, &it, nil)
|
||||||
} else {
|
} else {
|
||||||
|
setitimer(_ITIMER_PROF, &itimerval{}, nil)
|
||||||
|
|
||||||
// If the Go signal handler should be disabled by default,
|
// If the Go signal handler should be disabled by default,
|
||||||
// switch back to the signal handler that was installed
|
// switch back to the signal handler that was installed
|
||||||
// when we enabled profiling. We don't try to handle the case
|
// when we enabled profiling. We don't try to handle the case
|
||||||
|
|
@ -303,8 +305,6 @@ func setProcessCPUProfiler(hz int32) {
|
||||||
setsig(_SIGPROF, h)
|
setsig(_SIGPROF, h)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setitimer(_ITIMER_PROF, &itimerval{}, nil)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue