doc: alternate signal stack setup for c-archive or c-shared builds (#2225)
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
This commit is contained in:
15
config.go
15
config.go
@@ -219,9 +219,18 @@ const (
|
||||
// part. wazero automatically performs ahead-of-time compilation as needed when
|
||||
// Runtime.CompileModule is invoked.
|
||||
//
|
||||
// Warning: This panics at runtime if the runtime.GOOS or runtime.GOARCH does not
|
||||
// support compiler. Use NewRuntimeConfig to safely detect and fallback to
|
||||
// NewRuntimeConfigInterpreter if needed.
|
||||
// # Warning
|
||||
//
|
||||
// - This panics at runtime if the runtime.GOOS or runtime.GOARCH does not
|
||||
// support compiler. Use NewRuntimeConfig to safely detect and fallback to
|
||||
// NewRuntimeConfigInterpreter if needed.
|
||||
//
|
||||
// - If you are using wazero in buildmode=c-archive or c-shared, make sure that you set up the alternate signal stack
|
||||
// by using, e.g. `sigaltstack` combined with `SA_ONSTACK` flag on `sigaction` on Linux,
|
||||
// before calling any api.Function. This is because the Go runtime does not set up the alternate signal stack
|
||||
// for c-archive or c-shared modes, and wazero uses the different stack than the calling Goroutine.
|
||||
// Hence, the signal handler might get invoked on the wazero's stack, which may cause a stack overflow.
|
||||
// https://github.com/tetratelabs/wazero/blob/2092c0a879f30d49d7b37f333f4547574b8afe0d/internal/integration_test/fuzz/fuzz/tests/sigstack.rs#L19-L36
|
||||
func NewRuntimeConfigCompiler() RuntimeConfig {
|
||||
ret := engineLessConfig.clone()
|
||||
ret.engineKind = engineKindCompiler
|
||||
|
||||
Reference in New Issue
Block a user