Bug 981356 - golang "safe path" needs to be added to gdb
golang "safe path" needs to be added to gdb
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: golang (Show other bugs)
20
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Adam Goode
Fedora Extras Quality Assurance
:
: 1002415 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-04 10:24 EDT by Richard W.M. Jones
Modified: 2014-08-08 13:44 EDT (History)
5 users (show)

See Also:
Fixed In Version: golang-1.2.2-9.fc20
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-07-26 11:59:25 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Richard W.M. Jones 2013-07-04 10:24:06 EDT
Description of problem:

When you run gdb on a compiled golang program, gdb is unable to
load the Go extension.  It prints:

warning: File "/usr/share/golang/src/pkg/runtime/runtime-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load:/usr/bin/mono-gdb.py".
To enable execution of this file add
	add-auto-load-safe-path /usr/share/golang/src/pkg/runtime/runtime-gdb.py
line to your configuration file "/home/rjones/.gdbinit".
To completely disable this security protection add
	set auto-load safe-path /
line to your configuration file "/home/rjones/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
	info "(gdb)Auto-loading safe path"

I didn't look into this in great detail, but it seems as if
the golang package needs to update this "safe path" somehow
(as obviously the mono package is already doing).

Version-Release number of selected component (if applicable):

golang 1.1.1-3.fc18.x86_64

How reproducible:

100%

Steps to Reproduce:
1. Create a minimal golang program.
2. go build the-program.go
3. gdb ./the-program.go

Actual results:

See above.
Comment 1 Richard W.M. Jones 2013-07-04 10:25:33 EDT
Step 2 & 3 are of course:

2. go build -o the-program the-program.go
3. gdb ./the-program
Comment 2 Adam Goode 2013-07-04 21:59:31 EDT
$ strings /usr/bin/gdb | grep mono
$debugdir:$datadir/auto-load:/usr/bin/mono-gdb.py

This is hard-coded into gdb for mono. :)

But I think I can fix this no problem.
Comment 3 Adam Goode 2013-07-04 23:41:02 EDT
To fix this without hacks, #981520 must be addressed. I will put in the files in /etc/gdbinit.d so that if the gdb bug is fixed, this will work.

For now, I guess you need to put the recommended commands into .gdbinit.
Comment 4 Jan Kratochvil 2013-07-05 03:58:34 EDT
That "/usr/bin/mono-gdb.py" is just a workaround of Mono Bug 815501.

The file "/usr/share/golang/src/pkg/runtime/runtime-gdb.py" has incorrect location, it should be placed under "/usr/share/gdb/auto-load/".  As the compiled Go program does not use any shared libraries it could be even:
/usr/share/gdb/auto-load/usr/share/golang/src/pkg/runtime/runtime-gdb.py

It should be just some stub like:
/usr/share/gdb/auto-load/usr/lib64/libglib-2.0.so.0.3400.2-gdb.py
Comment 5 Adam Goode 2013-07-05 10:29:48 EDT
Jan:
I have tried putting runtime-gdb.py in both /usr/share/gdb/auto-load/ as well as /usr/share/gdb/auto-load/usr/lib64/golang/src/pkg/runtime, but it fails.

I think this is because of the .debug_gdb_script section in each go file, correct? The correct solution would be to fix the compiler to put the correct path in the executable, right?
Comment 6 Jan Kratochvil 2013-07-05 12:21:56 EDT
(In reply to Adam Goode from comment #5)
> I think this is because of the .debug_gdb_script section in each go file,
> correct? The correct solution would be to fix the compiler to put the
> correct path in the executable, right?

Yes, I assumed you are going to change also the path in the compiler accordingly.

This is a bit unusual case for gdb auto-load because IIUC do golang-produced binaries are statically linked (this also does not seem too much packaging guidelines compliant but if there is no other choice...).

BTW I do not know anything about Go but isn't gccgo more suitable for Fedora?
Comment 7 Adam Goode 2013-07-05 15:07:20 EDT
gccgo is already in Fedora. golang is the other implementation of Go, based on the Plan 9 toolchain. golang also contains the "go" command, which handles building, dependencies, downloading of remote packages. Eventually this command will be able to drive gccgo as well as the "g" series of compilers.
Comment 8 Adam Goode 2013-07-05 15:31:09 EDT
Looks like I need to replace finddebugruntimepath in dwarf.c with a new path.
Comment 9 Fedora End Of Life 2013-09-16 10:23:13 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 20 development cycle.
Changing version to '20'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora20
Comment 10 Vincent Batts 2014-07-08 11:36:15 EDT
*** Bug 1002415 has been marked as a duplicate of this bug. ***
Comment 11 Fedora Update System 2014-07-15 12:57:42 EDT
golang-1.2.2-9.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/golang-1.2.2-9.el6
Comment 12 Fedora Update System 2014-07-15 13:10:27 EDT
golang-1.2.2-9.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/golang-1.2.2-9.fc19
Comment 13 Fedora Update System 2014-07-15 14:06:46 EDT
golang-1.2.2-9.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/golang-1.2.2-9.fc20
Comment 14 Fedora Update System 2014-07-15 23:51:50 EDT
Package golang-1.2.2-9.el6:
* should fix your issue,
* was pushed to the Fedora EPEL 6 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=epel-testing golang-1.2.2-9.el6'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-EPEL-2014-1907/golang-1.2.2-9.el6
then log in and leave karma (feedback).
Comment 15 Fedora Update System 2014-07-26 11:59:25 EDT
golang-1.2.2-9.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 16 Fedora Update System 2014-07-26 12:00:32 EDT
golang-1.2.2-9.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 17 Fedora Update System 2014-08-08 13:44:43 EDT
golang-1.2.2-12.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/golang-1.2.2-12.el6

Note You need to log in before you can comment on or make changes to this bug.