Bringing up Chromium on ARMv6

705 views
Skip to first unread message

Liam McLoughlin

unread,
Apr 20, 2012, 1:31:55 PM4/20/12
to Chromium OS dev
Hey,

I'm trying to get Chromium OS running on an ARMv6 device, the
Raspberry Pi. I've built all the packages and created the rootFS, and
the device boots from the USB stick happily, up to the point where it
attempts to launch Chromium itself. The Xorg server starts correctly,
but Chromium itself segfaults instantly on launch.

There's not enough memory on the device to run a debug build with GDB,
so I've built a debug build and stripped the debug symbols out, and
then ran that. I've then transferred the core dump to my dev machine,
and run gdb against this with a non-stripped version of the binary.

However, GDB complains that the binary has PIE enabled, and so it
falls over completely. I'd have thought that should be disabled in a
debug build, so I'm not sure why I'm seeing it.

Can anyone suggest things to try to get useful debug information out
of this? I've provided an strace below, but if there's any other
information I can get that'd be useful, please tell me what and how.

Also, if this is something you're interested in hacking on, then let
me know and I can provide you with SSH to a Pi! :)

Cheers,
Liam McLoughlin

strace: http://radium.hexxeh.net/strace.txt

Sonny Rao

unread,
Apr 20, 2012, 9:08:08 PM4/20/12
to Liam McLoughlin, Chromium OS dev

Hmm, could you turn off ASLR and just generate a core file and look at
it on your build machine?
To turn off ASLR (as root) echo 0 > /proc/sys/kernel/randomize_va_space

Liam McLoughlin

unread,
Apr 21, 2012, 7:24:34 AM4/21/12
to Sonny Rao, Chromium OS dev
Just tried that now, getting the same deal from GDB with the new core:

arm-linux-gnueabi-gdb raspberry-pi/lkgr/src/out/Debug/chrome core.chrome 
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-linux-gnueabi".
For bug reporting instructions, please see:

warning: The current binary is a PIE (Position Independent Executable), which
GDB does NOT currently support.  Most debugger features will fail if used
in this session.

Reading symbols from /home/hexxeh/raspberry-pi/lkgr/src/out/Debug/chrome...done.
Core was generated by `./chrome'.
Program terminated with signal 11, Segmentation fault.

warning: (Internal error: pc 0x5e90ec in read in psymtab, but not in symtab.)


warning: (Internal error: pc 0x5e90ec in read in psymtab, but not in symtab.)


warning: (Internal error: pc 0x5e90ec in read in psymtab, but not in symtab.)

#0  0x005e90ec in _init (
warning: (Internal error: pc 0x5e90ec in read in psymtab, but not in symtab.)

)

warning: (Internal error: pc 0x5e90ec in read in psymtab, but not in symtab.)

(gdb) bt
warning: (Internal error: pc 0x5e90ec in read in psymtab, but not in symtab.)

warning: (Internal error: pc 0x5e90ec in read in psymtab, but not in symtab.)

#0  0x005e90ec in _init (warning: (Internal error: pc 0x5e90ec in read in psymtab, but not in symtab.)

)
warning: (Internal error: pc 0x5e90ec in read in psymtab, but not in symtab.)

warning: (Internal error: pc 0x5e90ec in read in psymtab, but not in symtab.)

#1  0x3018b2f4 in ?? ()
#2  0x3018b2f4 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
warning: (Internal error: pc 0x5e90ec in read in psymtab, but not in symtab.)

Guillaume Brunerie

unread,
Apr 21, 2012, 8:23:59 AM4/21/12
to Liam McLoughlin, Sonny Rao, Chromium OS dev
Le 21 avril 2012 13:24, Liam McLoughlin <hex...@hexxeh.net> a écrit :
>
> Just tried that now, getting the same deal from GDB with the new core:
>
> arm-linux-gnueabi-gdb raspberry-pi/lkgr/src/out/Debug/chrome core.chrome
> GNU gdb (GDB) 7.0.1-debian
> Copyright (C) 2009 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "--host=x86_64-linux-gnu --target=arm-linux-gnueabi".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>...
>
> warning: The current binary is a PIE (Position Independent Executable), which
> GDB does NOT currently support.  Most debugger features will fail if used
> in this session.


Searching on Google, I found this : http://lwn.net/Articles/379511/

> GDB 7.1 brings new targets, features and improvements, including:
> […]
>  * Position Independent Executable (PIE) debugging.
> […]

Perhaps you could just try to upgrade to gdb 7.1 (which is still more
than two-year old)


> --
> Chromium OS Developers mailing list: chromiu...@chromium.org
> View archives, change email options, or unsubscribe:
> http://groups.google.com/a/chromium.org/group/chromium-os-dev?hl=en

Liam McLoughlin

unread,
Apr 22, 2012, 2:10:59 PM4/22/12
to Chromium OS dev
Just tried using GDB 7.4, where I get a stack trace, but it's not
exactly useful:

GNU gdb (Gentoo 7.4 p1) 7.4
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/
gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show
copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-pc-linux-gnu --
target=armv6zk-softfloat-linux-gnueabi".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>.
(gdb) set solib-absolute-prefix /home/hexxeh/rootfs
(gdb) file chrome/chrome
Reading symbols from /home/hexxeh/chrome/chrome...done.
(gdb) core core.chrome
[New LWP 25926]
Core was generated by `./chrome'.
Program terminated with signal 11, Segmentation fault.
#0 0x005e90ec in ?? ()
(gdb) bt
#0 0x005e90ec in ?? ()
#1 0x3018b2f4 in __libc_csu_init ()
#2 0x40a154c4 in __libc_start_main () from /home/hexxeh/rootfs/lib/
libc.so.6
#3 0x2a5edc24 in _start ()

On Apr 21, 1:23 pm, Guillaume Brunerie <guillaume.brune...@gmail.com>
wrote:
> Le 21 avril 2012 13:24, Liam McLoughlin <hex...@hexxeh.net> a écrit :
>
>
>
>
>
>
>
>
>
>
>
> > Just tried that now, getting the same deal from GDB with the new core:
>
> > arm-linux-gnueabi-gdb raspberry-pi/lkgr/src/out/Debug/chrome core.chrome
> > GNU gdb (GDB) 7.0.1-debian
> > Copyright (C) 2009 Free Software Foundation, Inc.
> > License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> > This is free software: you are free to change and redistribute it.
> > There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> > and "show warranty" for details.
> > This GDB was configured as "--host=x86_64-linux-gnu --target=arm-linux-gnueabi".
> > For bug reporting instructions, please see:
> > <http://www.gnu.org/software/gdb/bugs/>...
>
> > warning: The current binary is a PIE (Position Independent Executable), which
> > GDB does NOT currently support.  Most debugger features will fail if used
> > in this session.
>
> Searching on Google, I found this :http://lwn.net/Articles/379511/
>
> > GDB 7.1 brings new targets, features and improvements, including:
> > […]
> >  * Position Independent Executable (PIE) debugging.
> > […]
>
> Perhaps you could just try to upgrade to gdb 7.1 (which is still more
> than two-year old)
>
> > Chromium OS Developers mailing list: chromium-os-...@chromium.org

Mattias Nissler

unread,
Apr 23, 2012, 5:32:10 AM4/23/12
to Liam McLoughlin, Chromium OS dev
FWIW, I'm routinely mounting a debug build of Chrome into the image using sshfs. Then, you can use gdbserver to attach to the running Chrome instance and debug from the dev machine. Here is how that's done:

1. Get a root shell on the device (e.g. through ssh on a test image)
2. Mount the chrome directory from the chroot's build tree into the device:

sudo modprobe fuse
sshfs USER@HOST:CHROMEOSDIR/chroot/build/x86-generic/opt/google/chrome \
      /opt/google/chrome/ \
      -o nonempty \
      -o allow_other \
      -o suid

3. Make sure sshfs will be able to read the files (on the host machine):

sudo chmod -R a+rX /build/x86-generic/opt/google/chrome

4. You can now restart the session in the VM and it'll just pull the chrome binary through the mount:

restart ui



Chromium OS Developers mailing list: chromiu...@chromium.org

Sonny Rao

unread,
Apr 23, 2012, 7:49:21 AM4/23/12
to Liam McLoughlin, Chromium OS dev
Well, that does look a lot better... no complaints about pie and you
seem to be reading the debug symbols
I guess the question is where is 0x005e90ec? Is that around where the
chrome binary is loaded?

You might try something like "info files" to see where things are
loaded, or "disassemble 0x005e90e0" or "disassemble * 0x005e90e0" and
see if you can get either a function name or some instructions?

> Chromium OS Developers mailing list: chromiu...@chromium.org

Liam McLoughlin

unread,
Apr 23, 2012, 4:03:25 PM4/23/12
to Sonny Rao, Chromium OS dev
Looks like GDB doesn't know where 0x005e90ec is either:

(gdb) disassemble 0x005e90e0 
No function contains specified address.
(gdb) disassemble * 0x005e90e0
Cannot access memory at address 0x5e90e0

Rahul Chaturvedi

unread,
Apr 23, 2012, 5:01:23 PM4/23/12
to Liam McLoughlin, Sonny Rao, Chromium OS dev
Try using the checked in /usr/bin/gdb_remote script in your chroot?

Rahul Chaturvedi

unread,
Apr 23, 2012, 5:03:12 PM4/23/12
to Liam McLoughlin, Sonny Rao, Chromium OS dev
We had a flag called linux_disable_pie in Chrome just to get around this issue - but the /usr/bin/gdb_remote script (or using the workflow described in the end of the bug) fixes the issue.

John Sheu

unread,
Apr 23, 2012, 8:53:31 PM4/23/12
to Rahul Chaturvedi, Liam McLoughlin, Sonny Rao, Chromium OS dev
I was banging my head on this a while ago on ARM.  After digging around the GDB sources -- it turns out you have to load the debug symbols before connecting to the target (e.g. with "file /build/<platform>/opt/google/chrome/chrome"); otherwise GDB doesn't fix up the addresses for PIE executables correctly.

I'm usually debugging like so:
  • <start gdb>
  • set sysroot /build/<platform>
  • set debug-file-directory /build/<platform>/usr/lib/debug
  • file /build/<platform>/opt/google/chrome/chrome
  • target remote <ip>:<port>
Hope that helps.

-John Sheu

Liam McLoughlin

unread,
Apr 24, 2012, 3:35:00 PM4/24/12
to John Sheu, Rahul Chaturvedi, Sonny Rao, Chromium OS dev
Glad to report I've finally made some progress on this. It turned out to be a weird toolchain bug. Somebody sent me a patch that got crossdev working for armv6 inside the CrOS chroot, so I built my toolchain there, and now Chrome builds and runs without segfaulting.

It's still failing to launch, with these errors:

[11050:11050:1933501432:ERROR:compositor.cc(72)] Could not load the GL bindings
[11050:11050:1933502306:FATAL:image_transport_factory.cc(121)] Check failed: surface_.get(). Unable to create compositor GL surface.

But then, we're missing X11 drivers for the RPi at the moment, so that's to be expected I suppose.

Thanks for all the suggestions/help!

Cheers,
Liam
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages