-
Notifications
You must be signed in to change notification settings - Fork 18k
regexp: unexpected return pc for regexp.(*Regexp).tryBacktrack called #53989
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
Comments
Could you show the full stack trace of the failure? Thanks. |
@cherrymui Please see the entire trace below
|
sure, updated in the description |
@cherrymui Note that this same sample code works fine on my m1 macbook pro
|
Thanks. It seems that both the main executable and the plugin have the function Still looking into why |
while the investigation is going on, can this be added to the 1.19 milestone for visibility (ideally as a release-blocker)? |
just as @dims could not reproduce on an M1 darwin machine, I couldn't reproduce on an darwin/amd64 machine, only a linux/amd64 machine |
Yes, this bug depends on compiler and architecture details, and also how the dynamic linker resolves symbols, so it is very system dependent. I think I understand the problem, will send a CL soon. Thanks. |
Can you clarify how the caller and plugin are compiled differently? Do you mean plugin mode is causing the difference? |
The plugin needs to be position independent code, whereas the main executable doesn't. This causes slight differences in code generation, e.g. the use of GOT, TLS model, etc. |
Change https://go.dev/cl/418960 mentions this issue: |
@cherrymui sweeeeetttt! the change https://go.dev/cl/418960 fixed the original problem we had in kubernetes/kubernetes#111297 |
@cherrymui @toothrot can we please add this in 1.19? |
@gopherbot please consider this for backport to 1.19, it's a regression. |
Backport issue(s) opened: #54010 (for 1.19). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
We don't need backport. Go 1.19 hasn't been released, and the tree is not open for 1.20 development. Go 1.19 will be cut on the main branch, which includes the CL above. |
ah, my mistake, I didn't realize master kept getting merged to the 1.19 branch, thanks! |
I don't have access to do so, but feel free to close #54010 |
When using plugins, if the plugin and the main executable both have the same function, and if it uses jump table, currently the jump table symbol have the same name so it will be deduplicated by the dynamic linker. This causes a function in the plugin may (in the middle of the function) jump to the function with the same name in the main executable (or vice versa). But the function may be compiled slightly differently, because the plugin needs to be PIC. Jumping from the middle of one function to the other will not work. Avoid this problem by marking the jump table symbol local to a DSO. Fixes golang#53989. Change-Id: I2b573b9dfc22401c8a09ffe9b9ea8bb83d3700ca Reviewed-on: https://go-review.googlesource.com/c/go/+/418960 Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Encountered a runtime crash on 1.19rc2 in the regexp package when running a configuration that uses plugins. The specific configuration was https://github.com/golangci/golangci-lint combined with a custom linter plugin which happened to use a regexp internally. The original issue was kubernetes/kubernetes#111297
The following is a minimal reproducer which is compiled as a plugin and then run:
plugin.go:
Running that on 1.19rc2 produces:
Running that on go1.18.4 works fine:
What did you expect to see?
Regexp calls inside a plugin work.
What did you see instead?
Regexp calls inside a plugin trigger runtime errors.
@dims found 0293c51, which looks related. Reverting that fixed the issue in the linter scenario we encountered, but did not resolve the issue with this reproduceredit: reverting 0293c51 did not fix the linter scenario, we were mistaken about thatThe text was updated successfully, but these errors were encountered: