Repository: tetratelabs/wazero
Pull request #1223 (2023-03-13 03:17:47)

renames exit log scope to proc and resolves gojs files to cwd
Many tests failed in gojs due to needing to be resolved against the CWD, which is atypically stored host side. This fixes that and renames the "exit" scope to "proc" so we can use it for other proc concerns besides exit.

This reduces known failures on GOOS=js from 23 to 14:
```bash
$ wazero run -mount=/usr/local/go/src/os:/:ro -mount=/tmp:/tmp -mount=/etc:/etc:ro -mount=/usr:/usr:ro -mount=/dev:/dev:ro os.wasm |grep '^--- FAIL'|wc -l
      14
```

See #1222


Patch:
diff --git a/cmd/wazero/wazero.go b/cmd/wazero/wazero.go
index e96334d2..da3c8eba 100644
--- a/cmd/wazero/wazero.go
+++ b/cmd/wazero/wazero.go
@@ -434,8 +434,8 @@ func (f *logScopesFlag) Set(input string) error {
 			continue
 		case "clock":
 			*f |= logScopesFlag(logging.LogScopeClock)
-		case "exit":
-			*f |= logScopesFlag(logging.LogScopeExit)
+		case "proc":
+			*f |= logScopesFlag(logging.LogScopeProc)
 		case "filesystem":
 			*f |= logScopesFlag(logging.LogScopeFilesystem)
 		case "memory":
diff --git a/experimental/logging/log_listener.go b/experimental/logging/log_listener.go
index 0fa75c63..40b075a8 100644
--- a/experimental/logging/log_listener.go
+++ b/experimental/logging/log_listener.go
@@ -34,10 +34,10 @@ const (
 	LogScopeNone = logging.LogScopeNone
 	// LogScopeClock enables logging for functions such as `clock_time_get`.
 	LogScopeClock = logging.LogScopeClock
-	// LogScopeExit enables logging for functions such as `proc_exit`.
+	// LogScopeProc enables logging for functions such as `proc_exit`.
 	//
 	// Note: This includes functions that both log and exit. e.g. `abort`.
-	LogScopeExit = logging.LogScopeExit
+	LogScopeProc = logging.LogScopeProc
 	// LogScopeFilesystem enables logging for functions such as `path_open`.
 	//
 	// Note: This doesn't log writes to the console.
diff --git a/internal/assemblyscript/logging/logging.go b/internal/assemblyscript/logging/logging.go
index 9e2f40ec..ca59e7af 100644
--- a/internal/assemblyscript/logging/logging.go
+++ b/internal/assemblyscript/logging/logging.go
@@ -6,7 +6,7 @@ import (
 	"github.com/tetratelabs/wazero/internal/logging"
 )
 
-func isExitFunction(fnd api.FunctionDefinition) bool {
+func isProcFunction(fnd api.FunctionDefinition) bool {
 	return fnd.ExportNames()[0] == AbortName
 }
 
@@ -16,8 +16,8 @@ func isRandomFunction(fnd api.FunctionDefinition) bool {
 
 // IsInLogScope returns true if the current function is in any of the scopes.
 func IsInLogScope(fnd api.FunctionDefinition, scopes logging.LogScopes) bool {
-	if scopes.IsEnabled(logging.LogScopeExit) {
-		if isExitFunction(fnd) {
+	if scopes.IsEnabled(logging.LogScopeProc) {
+		if isProcFunction(fnd) {
 			return true
 		}
 	}
diff --git a/internal/gojs/builtin.go b/internal/gojs/builtin.go
index a19e3845..4187f2ff 100644
--- a/internal/gojs/builtin.go
+++ b/internal/gojs/builtin.go
@@ -3,6 +3,7 @@ package gojs
 import (
 	"net/http"
 
+	"github.com/tetratelabs/wazero/internal/gojs/custom"
 	"github.com/tetratelabs/wazero/internal/gojs/goos"
 )
 
@@ -43,18 +44,18 @@ var (
 	arrayConstructor = newJsVal(goos.RefArrayConstructor, "Array")
 
 	// jsProcess = js.Global().Get("process") // fs_js.go init
-	jsProcess = newJsVal(goos.RefJsProcess, "process").
+	jsProcess = newJsVal(goos.RefJsProcess, custom.NameProcess).
 			addProperties(map[string]interface{}{
 			"pid":  float64(1),        // Get("pid").Int() in syscall_js.go for syscall.Getpid
 			"ppid": goos.RefValueZero, // Get("ppid").Int() in syscall_js.go for syscall.Getppid
 		}).
-		addFunction("cwd", processCwd{}).              // syscall.Cwd in fs_js.go
-		addFunction("chdir", processChdir{}).          // syscall.Chdir in fs_js.go
-		addFunction("getuid", returnZero{}).           // syscall.Getuid in syscall_js.go
-		addFunction("getgid", returnZero{}).           // syscall.Getgid in syscall_js.go
-		addFunction("geteuid", returnZero{}).          // syscall.Geteuid in syscall_js.go
-		addFunction("getgroups", returnSliceOfZero{}). // syscall.Getgroups in syscall_js.go
-		addFunction("umask", returnArg0{})             // syscall.Umask in syscall_js.go
+		addFunction(custom.NameProcessCwd, processCwd{}).              // syscall.Cwd in fs_js.go
+		addFunction(custom.NameProcessChdir, processChdir{}).          // syscall.Chdir in fs_js.go
+		addFunction(custom.NameProcessGetuid, returnZero{}).           // syscall.Getuid in syscall_js.go
+		addFunction(custom.NameProcessGetgid, returnZero{}).           // syscall.Getgid in syscall_js.go
+		addFunction(custom.NameProcessGeteuid, returnZero{}).          // syscall.Geteuid in syscall_js.go
+		addFunction(custom.NameProcessGetgroups, returnSliceOfZero{}). // syscall.Getgroups in syscall_js.go
+		addFunction(custom.NameProcessUmask, returnArg0{})             // syscall.Umask in syscall_js.go
 
 	// uint8ArrayConstructor = js.Global().Get("Uint8Array")
 	//	// fs_js.go, rand_js.go, roundtrip_js.go init
diff --git a/internal/gojs/custom/names.go b/internal/gojs/custom/names.go
index 09a97bb9..9c39122e 100644
--- a/internal/gojs/custom/names.go
+++ b/internal/gojs/custom/names.go
@@ -189,7 +189,8 @@ var NameSection = map[string]*Names{
 }
 
 var NameSectionSyscallValueCall = map[string]map[string]*Names{
-	NameCrypto: CryptoNameSection,
-	NameDate:   DateNameSection,
-	NameFs:     FsNameSection,
+	NameCrypto:  CryptoNameSection,
+	NameDate:    DateNameSection,
+	NameFs:      FsNameSection,
+	NameProcess: ProcessNameSection,
 }
diff --git a/internal/gojs/custom/process.go b/internal/gojs/custom/process.go
new file mode 100644
index 00000000..c288a618
--- /dev/null
+++ b/internal/gojs/custom/process.go
@@ -0,0 +1,53 @@
+package custom
+
+const (
+	NameProcess          = "process"
+	NameProcessCwd       = "cwd"
+	NameProcessChdir     = "chdir"
+	NameProcessGetuid    = "getuid"
+	NameProcessGetgid    = "getgid"
+	NameProcessGeteuid   = "geteuid"
+	NameProcessGetgroups = "getgroups"
+	NameProcessUmask     = "umask"
+)
+
+// ProcessNameSection are the functions defined in the object named NameProcess.
+// Results here are those set to the current event object, but effectively are
+// results of the host function.
+var ProcessNameSection = map[string]*Names{
+	NameProcessCwd: {
+		Name:        NameProcessCwd,
+		ParamNames:  []string{},
+		ResultNames: []string{"cwd"},
+	},
+	NameProcessChdir: {
+		Name:        NameProcessChdir,
+		ParamNames:  []string{"path"},
+		ResultNames: []string{"err"},
+	},
+	NameProcessGetuid: {
+		Name:        NameProcessGetuid,
+		ParamNames:  []string{},
+		ResultNames: []string{"uid"},
+	},
+	NameProcessGetgid: {
+		Name:        NameProcessGetgid,
+		ParamNames:  []string{},
+		ResultNames: []string{"gid"},
+	},
+	NameProcessGeteuid: {
+		Name:        NameProcessGeteuid,
+		ParamNames:  []string{},
+		ResultNames: []string{"euid"},
+	},
+	NameProcessGetgroups: {
+		Name:        NameProcessGetgroups,
+		ParamNames:  []string{},
+		ResultNames: []string{"groups"},
+	},
+	NameProcessUmask: {
+		Name:        NameProcessUmask,
+		ParamNames:  []string{"mask"},
+		ResultNames: []string{"oldmask"},
+	},
+}
diff --git a/internal/gojs/fs.go b/internal/gojs/fs.go
index f33891d3..e8fc592b 100644
--- a/internal/gojs/fs.go
+++ b/internal/gojs/fs.go
@@ -6,6 +6,7 @@ import (
 	"io"
 	"io/fs"
 	"os"
+	"path"
 	"syscall"
 
 	"github.com/tetratelabs/wazero/api"
@@ -98,7 +99,7 @@ type (
 type jsfsOpen struct{}
 
 func (jsfsOpen) invoke(ctx context.Context, mod api.Module, args ...interface{}) (interface{}, error) {
-	path := args[0].(string)
+	path := resolvePath(ctx, args[0].(string))
 	flags := toUint64(args[1]) // flags are derived from constants like oWRONLY
 	perm := goos.ValueToUint32(args[2])
 	callback := args[3].(funcWrapper)
@@ -116,7 +117,7 @@ func (jsfsOpen) invoke(ctx context.Context, mod api.Module, args ...interface{})
 type jsfsStat struct{}
 
 func (jsfsStat) invoke(ctx context.Context, mod api.Module, args ...interface{}) (interface{}, error) {
-	path := args[0].(string)
+	path := resolvePath(ctx, args[0].(string))
 	callback := args[1].(funcWrapper)
 
 	stat, err := syscallStat(mod, path)
@@ -140,7 +141,7 @@ func syscallStat(mod api.Module, path string) (*jsSt, error) {
 type jsfsLstat struct{}
 
 func (jsfsLstat) invoke(ctx context.Context, mod api.Module, args ...interface{}) (interface{}, error) {
-	path := args[0].(string)
+	path := resolvePath(ctx, args[0].(string))
 	callback := args[1].(funcWrapper)
 
 	lstat, err := syscallLstat(mod, path)
@@ -367,7 +368,7 @@ func syscallWrite(mod api.Module, fd uint32, offset interface{}, p []byte) (n ui
 type jsfsReaddir struct{}
 
 func (jsfsReaddir) invoke(ctx context.Context, mod api.Module, args ...interface{}) (interface{}, error) {
-	path := args[0].(string)
+	path := resolvePath(ctx, args[0].(string))
 	callback := args[1].(funcWrapper)
 
 	stat, err := syscallReaddir(ctx, mod, path)
@@ -427,7 +428,7 @@ func (processCwd) invoke(ctx context.Context, _ api.Module, _ ...interface{}) (i
 type processChdir struct{}
 
 func (processChdir) invoke(ctx context.Context, mod api.Module, args ...interface{}) (interface{}, error) {
-	path := args[0].(string)
+	path := path.Clean(args[0].(string))
 
 	if s, err := syscallStat(mod, path); err != nil {
 		return nil, err
@@ -445,7 +446,7 @@ func (processChdir) invoke(ctx context.Context, mod api.Module, args ...interfac
 type jsfsMkdir struct{}
 
 func (jsfsMkdir) invoke(ctx context.Context, mod api.Module, args ...interface{}) (interface{}, error) {
-	path := args[0].(string)
+	path := resolvePath(ctx, args[0].(string))
 	perm := goos.ValueToUint32(args[1])
 	callback := args[2].(funcWrapper)
 
@@ -471,7 +472,7 @@ func (jsfsMkdir) invoke(ctx context.Context, mod api.Module, args ...interface{}
 type jsfsRmdir struct{}
 
 func (jsfsRmdir) invoke(ctx context.Context, mod api.Module, args ...interface{}) (interface{}, error) {
-	path := args[0].(string)
+	path := resolvePath(ctx, args[0].(string))
 	callback := args[1].(funcWrapper)
 
 	fsc := mod.(*wasm.CallContext).Sys.FS()
@@ -486,8 +487,8 @@ func (jsfsRmdir) invoke(ctx context.Context, mod api.Module, args ...interface{}
 type jsfsRename struct{}
 
 func (jsfsRename) invoke(ctx context.Context, mod api.Module, args ...interface{}) (interface{}, error) {
-	from := args[0].(string)
-	to := args[1].(string)
+	from := resolvePath(ctx, args[0].(string))
+	to := resolvePath(ctx, args[1].(string))
 	callback := args[2].(funcWrapper)
 
 	fsc := mod.(*wasm.CallContext).Sys.FS()
@@ -502,7 +503,7 @@ func (jsfsRename) invoke(ctx context.Context, mod api.Module, args ...interface{
 type jsfsUnlink struct{}
 
 func (jsfsUnlink) invoke(ctx context.Context, mod api.Module, args ...interface{}) (interface{}, error) {
-	path := args[0].(string)
+	path := resolvePath(ctx, args[0].(string))
 	callback := args[1].(funcWrapper)
 
 	fsc := mod.(*wasm.CallContext).Sys.FS()
@@ -517,7 +518,7 @@ func (jsfsUnlink) invoke(ctx context.Context, mod api.Module, args ...interface{
 type jsfsUtimes struct{}
 
 func (jsfsUtimes) invoke(ctx context.Context, mod api.Module, args ...interface{}) (interface{}, error) {
-	path := args[0].(string)
+	path := resolvePath(ctx, args[0].(string))
 	atimeSec := toInt64(args[1])
 	mtimeSec := toInt64(args[2])
 	callback := args[3].(funcWrapper)
@@ -537,7 +538,7 @@ func (jsfsUtimes) invoke(ctx context.Context, mod api.Module, args ...interface{
 type jsfsChmod struct{}
 
 func (jsfsChmod) invoke(ctx context.Context, mod api.Module, args ...interface{}) (interface{}, error) {
-	path := args[0].(string)
+	path := resolvePath(ctx, args[0].(string))
 	mode := goos.ValueToUint32(args[1])
 	callback := args[2].(funcWrapper)
 
@@ -577,7 +578,7 @@ func (jsfsFchmod) invoke(ctx context.Context, mod api.Module, args ...interface{
 type jsfsChown struct{}
 
 func (jsfsChown) invoke(ctx context.Context, mod api.Module, args ...interface{}) (interface{}, error) {
-	path := args[0].(string)
+	path := resolvePath(ctx, args[0].(string))
 	uid := goos.ValueToUint32(args[1])
 	gid := goos.ValueToUint32(args[2])
 	callback := args[3].(funcWrapper)
@@ -617,7 +618,7 @@ func (jsfsFchown) invoke(ctx context.Context, mod api.Module, args ...interface{
 type jsfsLchown struct{}
 
 func (jsfsLchown) invoke(ctx context.Context, mod api.Module, args ...interface{}) (interface{}, error) {
-	path := args[0].(string)
+	path := resolvePath(ctx, args[0].(string))
 	uid := goos.ValueToUint32(args[1])
 	gid := goos.ValueToUint32(args[2])
 	callback := args[3].(funcWrapper)
@@ -634,7 +635,7 @@ func (jsfsLchown) invoke(ctx context.Context, mod api.Module, args ...interface{
 type jsfsTruncate struct{}
 
 func (jsfsTruncate) invoke(ctx context.Context, mod api.Module, args ...interface{}) (interface{}, error) {
-	path := args[0].(string)
+	path := resolvePath(ctx, args[0].(string))
 	length := toInt64(args[1])
 	callback := args[2].(funcWrapper)
 
@@ -674,7 +675,7 @@ func (jsfsFtruncate) invoke(ctx context.Context, mod api.Module, args ...interfa
 type jsfsReadlink struct{}
 
 func (jsfsReadlink) invoke(ctx context.Context, mod api.Module, args ...interface{}) (interface{}, error) {
-	path := args[0].(string)
+	path := resolvePath(ctx, args[0].(string))
 	callback := args[1].(funcWrapper)
 
 	fsc := mod.(*wasm.CallContext).Sys.FS()
@@ -689,8 +690,8 @@ func (jsfsReadlink) invoke(ctx context.Context, mod api.Module, args ...interfac
 type jsfsLink struct{}
 
 func (jsfsLink) invoke(ctx context.Context, mod api.Module, args ...interface{}) (interface{}, error) {
-	path := args[0].(string)
-	link := args[1].(string)
+	path := resolvePath(ctx, args[0].(string))
+	link := resolvePath(ctx, args[1].(string))
 	callback := args[2].(funcWrapper)
 
 	fsc := mod.(*wasm.CallContext).Sys.FS()
@@ -705,8 +706,8 @@ func (jsfsLink) invoke(ctx context.Context, mod api.Module, args ...interface{})
 type jsfsSymlink struct{}
 
 func (jsfsSymlink) invoke(ctx context.Context, mod api.Module, args ...interface{}) (interface{}, error) {
-	path := args[0].(string)
-	link := args[1].(string)
+	path := resolvePath(ctx, args[0].(string))
+	link := resolvePath(ctx, args[1].(string))
 	callback := args[2].(funcWrapper)
 
 	fsc := mod.(*wasm.CallContext).Sys.FS()
@@ -805,3 +806,18 @@ func (s *jsSt) call(_ context.Context, _ api.Module, _ goos.Ref, method string,
 func jsfsInvoke(ctx context.Context, mod api.Module, callback funcWrapper, err error) (interface{}, error) {
 	return callback.invoke(ctx, mod, goos.RefJsfs, err, err == nil) // note: error first
 }
+
+// resolvePath is needed when a non-absolute path is given to a function.
+// Unlike other host ABI, GOOS=js maintains the CWD host side.
+func resolvePath(ctx context.Context, path string) string {
+	if len(path) == 0 || path[0] == '/' || path[0] == '.' {
+		return path // leave alone .. or absolute paths.
+	}
+	return joinPath(getState(ctx).cwd, path)
+}
+
+// joinPath avoids us having to rename fields just to avoid conflict with the
+// path package.
+func joinPath(dirName, baseName string) string {
+	return path.Join(dirName, baseName)
+}
diff --git a/internal/gojs/logging/logging.go b/internal/gojs/logging/logging.go
index e2ba7657..120093bc 100644
--- a/internal/gojs/logging/logging.go
+++ b/internal/gojs/logging/logging.go
@@ -27,8 +27,11 @@ func IsInLogScope(fnd api.FunctionDefinition, scopes logging.LogScopes) bool {
 		}
 	}
 
-	if scopes.IsEnabled(logging.LogScopeExit) {
-		if fnd.Name() == custom.NameRuntimeWasmExit {
+	if scopes.IsEnabled(logging.LogScopeProc) {
+		switch fnd.Name() {
+		case custom.NameRuntimeWasmExit:
+			return true
+		case custom.NameSyscallValueCall: // e.g. proc.*
 			return true
 		}
 	}
@@ -90,7 +93,8 @@ func Config(fnd api.FunctionDefinition, scopes logging.LogScopes) (pSampler logg
 		pLoggers = []logging.ParamLogger{runtimeGetRandomDataParamLogger}
 		// no results
 	case custom.NameSyscallValueCall:
-		pSampler = (&syscallValueCallParamSampler{scopes: scopes}).isSampled
+		p := &syscallValueCallParamSampler{scopes: scopes}
+		pSampler = p.isSampled
 		pLoggers = []logging.ParamLogger{syscallValueCallParamLogger}
 		rLoggers = []logging.ResultLogger{syscallValueCallResultLogger}
 	default: // TODO: make generic logger for gojs
@@ -173,6 +177,8 @@ func (s *syscallValueCallParamSampler) isSampled(ctx context.Context, mod api.Mo
 			return fd > sys.FdStderr
 		}
 		return true
+	case goos.RefJsProcess:
+		return logging.LogScopeProc.IsEnabled(s.scopes)
 	}
 
 	return s.scopes == logging.LogScopeAll
@@ -188,6 +194,8 @@ func syscallValueCallParamLogger(ctx context.Context, mod api.Module, w logging.
 		logSyscallValueCallArgs(w, custom.NameDate, m, args)
 	case goos.RefJsfs:
 		logFsParams(m, w, args)
+	case goos.RefJsProcess:
+		logSyscallValueCallArgs(w, custom.NameProcess, m, args)
 	default:
 		// TODO: other scopes
 	}
@@ -250,6 +258,10 @@ func syscallValueCallResultLogger(ctx context.Context, mod api.Module, w logging
 	case goos.RefJsfs:
 		resultNames = custom.FsNameSection[m].ResultNames
 		resultVals = gojs.GetLastEventArgs(ctx)
+	case goos.RefJsProcess:
+		resultNames = custom.ProcessNameSection[m].ResultNames
+		rRef := stack.ParamVal(ctx, 6, gojs.LoadValue) // val is after padding
+		resultVals = []interface{}{rRef}
 	default:
 		// TODO: other scopes
 	}
diff --git a/internal/logging/logging.go b/internal/logging/logging.go
index a4755e1e..0d05c6b1 100644
--- a/internal/logging/logging.go
+++ b/internal/logging/logging.go
@@ -39,7 +39,7 @@ type LogScopes uint64
 const (
 	LogScopeNone            = LogScopes(0)
 	LogScopeClock LogScopes = 1 << iota
-	LogScopeExit
+	LogScopeProc
 	LogScopeFilesystem
 	LogScopeMemory
 	LogScopePoll
@@ -51,8 +51,8 @@ func scopeName(s LogScopes) string {
 	switch s {
 	case LogScopeClock:
 		return "clock"
-	case LogScopeExit:
-		return "exit"
+	case LogScopeProc:
+		return "proc"
 	case LogScopeFilesystem:
 		return "filesystem"
 	case LogScopeMemory:
diff --git a/internal/sysfs/rootfs.go b/internal/sysfs/rootfs.go
index 445b99ff..e6720a16 100644
--- a/internal/sysfs/rootfs.go
+++ b/internal/sysfs/rootfs.go
@@ -321,7 +321,7 @@ func (c *CompositeFS) Symlink(oldName, link string) (err error) {
 	if fromFS != toFS {
 		return syscall.ENOSYS // not yet anyway
 	}
-	return c.fs[fromFS].Link(oldNamePath, linkPath)
+	return c.fs[fromFS].Symlink(oldNamePath, linkPath)
 }
 
 // Truncate implements FS.Truncate
diff --git a/internal/wasi_snapshot_preview1/logging/logging.go b/internal/wasi_snapshot_preview1/logging/logging.go
index f5425300..271169fc 100644
--- a/internal/wasi_snapshot_preview1/logging/logging.go
+++ b/internal/wasi_snapshot_preview1/logging/logging.go
@@ -18,7 +18,7 @@ func isClockFunction(fnd api.FunctionDefinition) bool {
 	return strings.HasPrefix(fnd.Name(), "clock_")
 }
 
-func isExitFunction(fnd api.FunctionDefinition) bool {
+func isProcFunction(fnd api.FunctionDefinition) bool {
 	return fnd.Name() == ProcExitName
 }
 
@@ -48,8 +48,8 @@ func IsInLogScope(fnd api.FunctionDefinition, scopes logging.LogScopes) bool {
 		}
 	}
 
-	if scopes.IsEnabled(logging.LogScopeExit) {
-		if isExitFunction(fnd) {
+	if scopes.IsEnabled(logging.LogScopeProc) {
+		if isProcFunction(fnd) {
 			return true
 		}
 	}


Test patch:
diff --git a/cmd/wazero/wazero_test.go b/cmd/wazero/wazero_test.go
index d86ae6a5..393ecdfd 100644
--- a/cmd/wazero/wazero_test.go
+++ b/cmd/wazero/wazero_test.go
@@ -295,9 +295,9 @@ func TestRun(t *testing.T) {
 			expectedStdout: "pooh\n",
 		},
 		{
-			name:       "wasi hostlogging=exit",
+			name:       "wasi hostlogging=proc",
 			wasm:       wasmCatTinygo,
-			wazeroOpts: []string{"--hostlogging=exit", fmt.Sprintf("--mount=%s:/animals:ro", bearDir)},
+			wazeroOpts: []string{"--hostlogging=proc", fmt.Sprintf("--mount=%s:/animals:ro", bearDir)},
 			wasmArgs:   []string{"/animals/not-bear.txt"},
 			expectedStderr: `==> wasi_snapshot_preview1.proc_exit(rval=1)
 `, // ^^ proc_exit panics, which short-circuits the logger. Hence, no "<==".
@@ -352,9 +352,9 @@ func TestRun(t *testing.T) {
 			expectedStdout: "pooh\n",
 		},
 		{
-			name:       "GOARCH=wasm GOOS=js hostlogging=exit",
+			name:       "GOARCH=wasm GOOS=js hostlogging=proc",
 			wasm:       wasmCatGo,
-			wazeroOpts: []string{"--hostlogging=exit", fmt.Sprintf("--mount=%s:/animals:ro", bearDir)},
+			wazeroOpts: []string{"--hostlogging=proc", fmt.Sprintf("--mount=%s:/animals:ro", bearDir)},
 			wasmArgs:   []string{"/animals/not-bear.txt"},
 			expectedStderr: `==> go.runtime.wasmExit(code=1)
 <==
diff --git a/imports/assemblyscript/assemblyscript_test.go b/imports/assemblyscript/assemblyscript_test.go
index bc5359fd..9e2cb601 100644
--- a/imports/assemblyscript/assemblyscript_test.go
+++ b/imports/assemblyscript/assemblyscript_test.go
@@ -50,7 +50,7 @@ func TestAbort(t *testing.T) {
 
 		t.Run(tc.name, func(t *testing.T) {
 			var stderr bytes.Buffer
-			mod, r, log := requireProxyModule(t, tc.exporter, wazero.NewModuleConfig().WithStderr(&stderr), logging.LogScopeExit)
+			mod, r, log := requireProxyModule(t, tc.exporter, wazero.NewModuleConfig().WithStderr(&stderr), logging.LogScopeProc)
 			defer r.Close(testCtx)
 
 			messageOff, filenameOff := writeAbortMessageAndFileName(t, mod.Memory(), encodeUTF16("message"), encodeUTF16("filename"))
diff --git a/internal/assemblyscript/logging/logging_test.go b/internal/assemblyscript/logging/logging_test.go
index 1024e7ca..eee82172 100644
--- a/internal/assemblyscript/logging/logging_test.go
+++ b/internal/assemblyscript/logging/logging_test.go
@@ -30,9 +30,9 @@ func TestIsInLogScope(t *testing.T) {
 		expected bool
 	}{
 		{
-			name:     "abort in LogScopeExit",
+			name:     "abort in LogScopeProc",
 			fnd:      abort,
-			scopes:   logging.LogScopeExit,
+			scopes:   logging.LogScopeProc,
 			expected: true,
 		},
 		{
@@ -42,9 +42,9 @@ func TestIsInLogScope(t *testing.T) {
 			expected: false,
 		},
 		{
-			name:     "abort in LogScopeExit|LogScopeFilesystem",
+			name:     "abort in LogScopeProc|LogScopeFilesystem",
 			fnd:      abort,
-			scopes:   logging.LogScopeExit | logging.LogScopeFilesystem,
+			scopes:   logging.LogScopeProc | logging.LogScopeFilesystem,
 			expected: true,
 		},
 		{
diff --git a/internal/gojs/logging/logging_test.go b/internal/gojs/logging/logging_test.go
index 741c1ac6..1574724d 100644
--- a/internal/gojs/logging/logging_test.go
+++ b/internal/gojs/logging/logging_test.go
@@ -32,9 +32,9 @@ func TestIsInLogScope(t *testing.T) {
 		expected bool
 	}{
 		{
-			name:     "runtimeWasmExit in LogScopeExit",
+			name:     "runtimeWasmExit in LogScopeProc",
 			fnd:      runtimeWasmExit,
-			scopes:   logging.LogScopeExit,
+			scopes:   logging.LogScopeProc,
 			expected: true,
 		},
 		{
@@ -44,9 +44,9 @@ func TestIsInLogScope(t *testing.T) {
 			expected: false,
 		},
 		{
-			name:     "runtimeWasmExit in LogScopeExit|LogScopeFilesystem",
+			name:     "runtimeWasmExit in LogScopeProc|LogScopeFilesystem",
 			fnd:      runtimeWasmExit,
-			scopes:   logging.LogScopeExit | logging.LogScopeFilesystem,
+			scopes:   logging.LogScopeProc | logging.LogScopeFilesystem,
 			expected: true,
 		},
 		{
diff --git a/internal/gojs/misc_test.go b/internal/gojs/misc_test.go
index e2aa0ff5..ae1bfbf1 100644
--- a/internal/gojs/misc_test.go
+++ b/internal/gojs/misc_test.go
@@ -18,7 +18,7 @@ func Test_exit(t *testing.T) {
 
 	var log bytes.Buffer
 	loggingCtx := context.WithValue(testCtx, experimental.FunctionListenerFactoryKey{},
-		logging.NewHostLoggingListenerFactory(&log, logging.LogScopeExit))
+		logging.NewHostLoggingListenerFactory(&log, logging.LogScopeProc))
 
 	stdout, stderr, err := compileAndRun(loggingCtx, "exit", wazero.NewModuleConfig())
 
diff --git a/internal/logging/logging_test.go b/internal/logging/logging_test.go
index 04ea7aba..cb062214 100644
--- a/internal/logging/logging_test.go
+++ b/internal/logging/logging_test.go
@@ -52,7 +52,7 @@ func TestLogScopes_String(t *testing.T) {
 		{name: "none", scopes: LogScopeNone, expected: ""},
 		{name: "any", scopes: LogScopeAll, expected: "all"},
 		{name: "clock", scopes: LogScopeClock, expected: "clock"},
-		{name: "exit", scopes: LogScopeExit, expected: "exit"},
+		{name: "proc", scopes: LogScopeProc, expected: "proc"},
 		{name: "filesystem", scopes: LogScopeFilesystem, expected: "filesystem"},
 		{name: "poll", scopes: LogScopePoll, expected: "poll"},
 		{name: "random", scopes: LogScopeRandom, expected: "random"},
diff --git a/internal/wasi_snapshot_preview1/logging/logging_test.go b/internal/wasi_snapshot_preview1/logging/logging_test.go
index 14329e22..ad84a72a 100644
--- a/internal/wasi_snapshot_preview1/logging/logging_test.go
+++ b/internal/wasi_snapshot_preview1/logging/logging_test.go
@@ -123,9 +123,9 @@ func TestIsInLogScope(t *testing.T) {
 			expected: false,
 		},
 		{
-			name:     "procExit in LogScopeExit",
+			name:     "procExit in LogScopeProc",
 			fnd:      procExit,
-			scopes:   logging.LogScopeExit,
+			scopes:   logging.LogScopeProc,
 			expected: true,
 		},
 		{
@@ -135,9 +135,9 @@ func TestIsInLogScope(t *testing.T) {
 			expected: false,
 		},
 		{
-			name:     "procExit in LogScopeExit|LogScopeFilesystem",
+			name:     "procExit in LogScopeProc|LogScopeFilesystem",
 			fnd:      procExit,
-			scopes:   logging.LogScopeExit | logging.LogScopeFilesystem,
+			scopes:   logging.LogScopeProc | logging.LogScopeFilesystem,
 			expected: true,
 		},
 		{