Linaro GDB crashes on 3.x kernels

Bug #871901 reported by Ulrich Weigand
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GDB
Fix Released
Medium
Ulrich Weigand
gdb
Fix Released
Critical

Bug Description

GDB crashes on startup on ARM if the kernel reports a two-level version string (e.g. 3.0, 3.1) instead of a three-level version string (2.6.39, 3.0.0, ...).

Related branches

Revision history for this message
In , Johannes Pfau (johannespfau) wrote :

Created attachment 5940
patch

Because of a bug in the get_linux_version function in the arm-linux-nat.c file, gdb always segfaults. get_linux_version assumes that a linux kernel version always has 3 version numbers (n.n.n) which is not true for the linux 3.0 kernel. In my case, the kernel version string is "3.0-ARCH". Because of that, the third token returned by strtok is null, which causes the segfault.

Patch for gdb 7.3.1 attached.

Revision history for this message
In , Pedro-codesourcery (pedro-codesourcery) wrote :

I'm not seeing where any of those os_FOO values are used. Can we just garbage collect all of that?

Revision history for this message
Ulrich Weigand (uweigand) wrote :
Changed in gdb-linaro:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Ulrich Weigand (uweigand)
Revision history for this message
In , Uweigand-gcc (uweigand-gcc) wrote :

(In reply to comment #1)
> I'm not seeing where any of those os_FOO values are used. Can we just garbage
> collect all of that?

Agreed. This has been in since the beginning of CVS history, and was apparently never used even then.

I'll prepare a patch to remove this routine.

Revision history for this message
In , Cvs-commit (cvs-commit) wrote :

CVSROOT: /cvs/src
Module name: src
Changes by: <email address hidden> 2011-10-10 18:47:49

Modified files:
 gdb : ChangeLog arm-linux-nat.c

Log message:
 PR gdb/13218
 * arm-linux-nat.c (os_version, os_major, os_minor, os_release):
 Remove unused variables.
 (get_linux_version): Remove function.
 (_initialize_arm_linux_nat): Do not call it.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.13410&r2=1.13411
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/arm-linux-nat.c.diff?cvsroot=src&r1=1.49&r2=1.50

Revision history for this message
In , Uweigand-gcc (uweigand-gcc) wrote :

Fixed.

Revision history for this message
Ulrich Weigand (uweigand) wrote :
Revision history for this message
Ulrich Weigand (uweigand) wrote :

Fix checked in to Linaro GDB as well.

Changed in gdb-linaro:
milestone: none → 7.3-2011.10
status: In Progress → Fix Committed
Changed in gdb:
importance: Unknown → Critical
status: Unknown → Fix Released
Changed in gdb-linaro:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.