Commit 28792f5d authored by Aram Hăvărneanu's avatar Aram Hăvărneanu Committed by Dave Cheney

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
parent fcc10bc0
...@@ -170,7 +170,7 @@ func execve(path uintptr, argv uintptr, envp uintptr) (err uintptr) { ...@@ -170,7 +170,7 @@ func execve(path uintptr, argv uintptr, envp uintptr) (err uintptr) {
c.fn = (void*)libc·execve; c.fn = (void*)libc·execve;
c.n = 3; c.n = 3;
c.args = (void*)&path; c.args = (void*)&path;
runtime·cgocall(runtime·asmsysvicall6, &c); runtime·asmcgocall(runtime·asmsysvicall6, &c);
err = c.err; err = c.err;
} }
...@@ -193,7 +193,7 @@ func fcntl1(fd uintptr, cmd uintptr, arg uintptr) (val uintptr, err uintptr) { ...@@ -193,7 +193,7 @@ func fcntl1(fd uintptr, cmd uintptr, arg uintptr) (val uintptr, err uintptr) {
c.fn = (void*)libc·fcntl; c.fn = (void*)libc·fcntl;
c.n = 3; c.n = 3;
c.args = (void*)&fd; c.args = (void*)&fd;
runtime·cgocall(runtime·asmsysvicall6, &c); runtime·asmcgocall(runtime·asmsysvicall6, &c);
err = c.err; err = c.err;
val = c.r1; val = c.r1;
} }
...@@ -227,7 +227,7 @@ func ioctl(fd uintptr, req uintptr, arg uintptr) (err uintptr) { ...@@ -227,7 +227,7 @@ func ioctl(fd uintptr, req uintptr, arg uintptr) (err uintptr) {
c.fn = (void*)libc·ioctl; c.fn = (void*)libc·ioctl;
c.n = 3; c.n = 3;
c.args = (void*)&fd; c.args = (void*)&fd;
runtime·cgocall(runtime·asmsysvicall6, &c); runtime·asmcgocall(runtime·asmsysvicall6, &c);
err = c.err; err = c.err;
} }
...@@ -338,7 +338,7 @@ func write1(fd uintptr, buf uintptr, nbyte uintptr) (n uintptr, err uintptr) { ...@@ -338,7 +338,7 @@ func write1(fd uintptr, buf uintptr, nbyte uintptr) (n uintptr, err uintptr) {
c.fn = (void*)libc·write; c.fn = (void*)libc·write;
c.n = 3; c.n = 3;
c.args = (void*)fd; c.args = (void*)fd;
runtime·cgocall(runtime·asmsysvicall6, &c); runtime·asmcgocall(runtime·asmsysvicall6, &c);
err = c.err; err = c.err;
n = c.r1; n = c.r1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment