mirror of
https://github.com/golang/go
synced 2024-11-12 03:50:21 -07:00
runtime: avoid runtime·cgocall in functions called by forkAndExecInChild
Calling runtime·cgocall could trigger a GC in the child while gclock was held by the parent. Fixes #7511 LGTM=bradfitz, dvyukov, dave R=golang-codereviews, bradfitz, dvyukov, dave CC=golang-codereviews, rsc https://golang.org/cl/75210044
This commit is contained in:
parent
fcc10bc0f1
commit
28792f5d83
@ -170,7 +170,7 @@ func execve(path uintptr, argv uintptr, envp uintptr) (err uintptr) {
|
||||
c.fn = (void*)libc·execve;
|
||||
c.n = 3;
|
||||
c.args = (void*)&path;
|
||||
runtime·cgocall(runtime·asmsysvicall6, &c);
|
||||
runtime·asmcgocall(runtime·asmsysvicall6, &c);
|
||||
err = c.err;
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ func fcntl1(fd uintptr, cmd uintptr, arg uintptr) (val uintptr, err uintptr) {
|
||||
c.fn = (void*)libc·fcntl;
|
||||
c.n = 3;
|
||||
c.args = (void*)&fd;
|
||||
runtime·cgocall(runtime·asmsysvicall6, &c);
|
||||
runtime·asmcgocall(runtime·asmsysvicall6, &c);
|
||||
err = c.err;
|
||||
val = c.r1;
|
||||
}
|
||||
@ -227,7 +227,7 @@ func ioctl(fd uintptr, req uintptr, arg uintptr) (err uintptr) {
|
||||
c.fn = (void*)libc·ioctl;
|
||||
c.n = 3;
|
||||
c.args = (void*)&fd;
|
||||
runtime·cgocall(runtime·asmsysvicall6, &c);
|
||||
runtime·asmcgocall(runtime·asmsysvicall6, &c);
|
||||
err = c.err;
|
||||
}
|
||||
|
||||
@ -338,7 +338,7 @@ func write1(fd uintptr, buf uintptr, nbyte uintptr) (n uintptr, err uintptr) {
|
||||
c.fn = (void*)libc·write;
|
||||
c.n = 3;
|
||||
c.args = (void*)fd;
|
||||
runtime·cgocall(runtime·asmsysvicall6, &c);
|
||||
runtime·asmcgocall(runtime·asmsysvicall6, &c);
|
||||
err = c.err;
|
||||
n = c.r1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user