Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1212472
Summary: | docker using gcc-go crashes in stacktrace | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Jakub Čajka <jcajka> | ||||||
Component: | gcc | Assignee: | Jakub Jelinek <jakub> | ||||||
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||||
Severity: | unspecified | Docs Contact: | |||||||
Priority: | unspecified | ||||||||
Version: | 22 | CC: | dan, davejohansen, jakub, jwakely, laboger, law, mjwolf, mpolacek | ||||||
Target Milestone: | --- | ||||||||
Target Release: | --- | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | gcc-5.1.1-3.fc22 | Doc Type: | Bug Fix | ||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | Environment: | ||||||||
Last Closed: | 2015-06-18 13:29:10 UTC | Type: | Bug | ||||||
Regression: | --- | Mount Type: | --- | ||||||
Documentation: | --- | CRM: | |||||||
Verified Versions: | Category: | --- | |||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||
Embargoed: | |||||||||
Bug Depends On: | |||||||||
Bug Blocks: | 467765, 1071880, 1051573 | ||||||||
Attachments: |
|
Description
Jakub Čajka
2015-04-16 13:33:24 UTC
I will submit a gccgo bug on this. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65798 has been opened for this. A fix was committed for this gcc bugzilla. It is not exactly as was suggested -- please verify this resolves the problem and if not we need to understand what was on the stack at the point runtime.Caller was called to understand why it returned invalid results. Created attachment 1018046 [details]
patch
Hm..., it doesn't fix it. I have messed it up a bit..., problem might not be the runtime.Caller...( as the rejected function name part was working around the problem). I have prepare small program triggering the crash outside docker.
package main
import "runtime"
import "fmt"
func main() {
for i := 1;i <= 5;i++ {
pc, fname, line,ok := runtime.Caller(i)
fmt.Printf("%x",pc)
fmt.Print(" ",fname," ",line," ",ok,"\n")
fn := runtime.FuncForPC(pc)
fmt.Print(fn.Name(),"\n\n")
}
}
Crashes with gcc-go:
7fefdc22b2c6 ../../../libgo/runtime/proc.c 550 true
runtime_main
7fefdc228f8b ../../../libgo/runtime/proc.c 235 true
kickoff
7fefdb20ffff 0 true
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0]
goroutine 16 [running]:
main.main
/root/test.go:12
goroutine 18 [finalizer wait]:
created by runtime_createfing
../../../libgo/runtime/mgc0.c:2572
but works fine with golang(built with --ldflags "-linkmode external"):
./test
4125e3 /usr/lib/golang/src/runtime/proc.go 63 true
runtime.main
4377e1 /usr/lib/golang/src/runtime/asm_amd64.s 2232 true
runtime.goexit
0 0 false
0 0 false
0 0 false
There is difference(probably expected?, this confused me...), in number of callers. But also libgo seems to behave differently than golang when accessing nil Func's Name, as ommiting/replacing the fn.Name() with just fn yields with gcc-go:
7feb8a48e2c6 ../../../libgo/runtime/proc.c 550 true
&{{}}
7feb8a48bf8b ../../../libgo/runtime/proc.c 235 true
&{{}}
7feb89472fff 0 true
<nil>
0 0 false
<nil>
0 0 false
<nil>
(Also tried just fn := runtime.FuncForPC(0)
fmt.Print(fn.Name(),"\n\n")
which works with golang, but fails with gcc-go)
I have checked golang's code and indeed it does checking for nil.
(symtab.go)
func cfuncname(f *_func) *byte {
if f == nil || f.nameoff == 0 {
return nil
}
datap := findmoduledatap(f.entry) // inefficient
return (*byte)(unsafe.Pointer(&datap.pclntable[f.nameoff]))
}
but libgo doesn't:
(caller.c)
String
runtime_funcname_go (Func *f)
{
return f->name;
}
changing it:
@@ -231,7 +231,13 @@ String runtime_funcname_go (Func *f)
String
runtime_funcname_go (Func *f)
{
- return f->name;
+ String str;
+ if (!f)
+ {
+ runtime_memclr (&str, sizeof str);
+ return str;
+ }
+ else return f->name;
}
seems to fix the crash(tested on x86, will do ppc). Also it seems that Entry() is not protected in both golang and libgo. I would expect same behavior as in Name(). Will open golang ticket. I hope now it is finally correct fix(or at least at right spot)... Patch in attachment.
Golang upstream ticket: https://github.com/golang/go/issues/10696 Opened gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66016 gcc-5.1.1-3.fc22,gcc-python-plugin-0.14-2.fc22 has been submitted as an update for Fedora 22. https://admin.fedoraproject.org/updates/gcc-5.1.1-3.fc22,gcc-python-plugin-0.14-2.fc22 Package gcc-5.1.1-3.fc22, gcc-python-plugin-0.14-2.fc22: * should fix your issue, * was pushed to the Fedora 22 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing gcc-5.1.1-3.fc22 gcc-python-plugin-0.14-2.fc22' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2015-9967/gcc-5.1.1-3.fc22,gcc-python-plugin-0.14-2.fc22 then log in and leave karma (feedback). gcc-5.1.1-3.fc22, gcc-python-plugin-0.14-2.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report. |