-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
runtime: "syscall frame is no longer valid" followed by "stack split at bad time" #15639
Comments
I just tried running the PoC on an Ubuntu AWS t2.micro instance to make sure it was not platform-dependent, but I got the same result. See console output below.
Output from execution:
[...rest of output deleted] |
@ianlancetaylor, have you reviewed https://github.com/olebedev/go-duktape/blob/v2/duktape.go too? |
I did look at go-duktape and did not see any obvious errors. I don't know what is happening here. |
CL https://golang.org/cl/23153 mentions this issue. |
These problems are happening because the duktape library calls setjmp and longjmp. When calling C code from Go, you can only use setjmp/longjmp within a single C call that does not make any intervening Go calls. Specifically, the call to ctx.RequireNumber is failing and trying to call longjmp to a setjmp that occurred before calling back into Go to invoke func. That can't work. The longjmp is skipping over the intervening Go code. I think the status right now is that you can use duktape from Go as long as you are careful to not cause any errors. I recommend modifying the duktape code to crash on error rather than calling longjmp. I'm going to close this issue because I don't think there is anything we can do to fix it. |
The test case in #15639 somehow causes an invalid syscall frame. The failure is obscured because the throw occurs when throwsplit == true, which causes a "stack split at bad time" error when trying to print the throw message. This CL fixes the "stack split at bad time" by using systemstack. No test because there shouldn't be any way to trigger this error anyhow. Update #15639. Change-Id: I4240f3fd01bdc3c112f3ffd1316b68504222d9e1 Reviewed-on: https://go-review.googlesource.com/23153 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Austin Clements <austin@google.com>
I posted this on the golang-nuts mailing list and was told to go here.
There's something strange going on related to cgo-calls that seems to be able to consistently crash the runtime, as demonstrated by this PoC:
The text was updated successfully, but these errors were encountered: