-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
misc/cgo/testsigfwd: Test fails starting with 1.19 on x86 Alpine Linux #54422
Comments
@golang/runtime |
This may be fixed on tip by https://go.dev/cl/421935. If so, we could consider backporting that to 1.19. |
That is the same as 365ca69, no? Because if so I already have that backported (see What did you do? in my original issue description). |
Sorry for the confusion. I agree that we shouldn't start adding Looking further at the issue I don't understand why not adding it would lead to the "invalid header" error that you mention. |
I don't understand though how Any ideas? |
@mengzhuo since you authored the aforementioned commit, do you have an idea how this might be related? I was also able to extract the
Maybe this helps with debugging the error regarding compressed dwarf information? I am personally not sure what to look for in these files though. |
I had no idea how they are related, sorry.
|
Thanks for pointing this out. We ran into this on Alpine Linux Edge (the development version) since cgo is involved here this might then be related to a specific binutils/gcc/… version. On Edge we use binutils 2.39 (2.38 in the latest Alpine release) and gcc 12.1.1 (11.2.1 on the latest Alpine release). |
@mengzhuo while debugging this further I just noticed that you tried to reproduce this issue on amd64 (at least The code that seems to be emitting the error message is: Lines 1183 to 1189 in d34287a
I added the following printf debug output: diff --git a/src/debug/elf/file.go b/src/debug/elf/file.go
index aff2b00aae..6af82828d0 100644
--- a/src/debug/elf/file.go
+++ b/src/debug/elf/file.go
@@ -1253,6 +1253,10 @@ func (f *File) DWARF() (*dwarf.Data, error) {
}
}
if dlen > 0 {
+ fmt.Printf("Section: %s\n", s.Name)
+ fmt.Printf("b = %x\n", b)
+ fmt.Printf("compressionOffset = %v\n", s.compressionOffset)
+ fmt.Printf("decoding: %x\n", b[s.compressionOffset:])
r, err := zlib.NewReader(bytes.NewBuffer(b[s.compressionOffset:]))
if err != nil {
return nil, err With this patch the output is:
And In fact, it seems that the
I am not sure though if The file is available here: https://dev.alpinelinux.org/~nmeum/go-issue-%2354422/_cgo_with_stack_protector.o |
I note that when the Go linker does DWARF compression, if a given section doesn't benefit from compression it will leave it as is (e.g. see https://go.googlesource.com/go/+/2551324cd01b295915c10c6d3d06625676401610/src/cmd/link/internal/ld/dwarf.go#2225). Could this be what's happening here? |
@mengzhuo is there any chance that you can take another look at this given that you tried to reproduce the issue on x86_64 and not x86? Maybe the additional information provided in #54422 (comment) is also useful to you. |
@nmeum, is this still an issue? It appears that the Alpine patch was deleted in https://git.alpinelinux.org/aports/commit/community/go?id=57b7f2005454faff9f036f04c11a7c78a0281948 for Go 1.20. |
I can no longer reproduce this so yea, let's close this for now. |
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?
Compiled Go from source using
./make.bash
on x86 Alpine Linux Edge with 365ca69 backported. Afterwards, invoked the test suite using./run.bash -run='!(^cgo_test$)'
(cgo tests are known to fail on Alpine due to #39857).What did you expect to see?
Successful test run.
What did you see instead?
A test failure of
../misc/cgo/testsigfwd
:Full build log: alpine-linux-x86-edge-go-1.19.txt
I am aware that Alpine/musl is not fully supported by the test suite (see #19938 etc.), however, I am still reporting this as the test case passed with Go 1.18 (and also passes on all other architectures supported by Alpine). Furthermore, this seems to be related to #52919 and #54313 as the test case passes successfully with the following change (as discussed in the referenced issues, Alpine uses
-fstack-protector
by default):If
-fstack-protector
is generally unsupported on all Go architectures, then I would suggest having cgo add that to the compiler flags by default unconditionally. If it is just about this test case it would also be sufficient to commit the diff from above (with this diff therun.bash
invocation from above succeeds). However, I don't fully understand why it worked prior to Go 1.19 without-fno-stack-protector
.The text was updated successfully, but these errors were encountered: