Bug 287 - connmand segfault with qemumips sato/sdk images
Summary: connmand segfault with qemumips sato/sdk images
Status: VERIFIED FIXED
Alias: None
Product: Meta-yocto
Classification: Build System, Metadata & Runtime
Component: meta-yocto (show other bugs)
Version: 0.9
Hardware: x86 mips
: Medium normal
Target Milestone: 0.9 M4
Assignee: Qing He
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2010-09-07 23:47 UTC by xianchao zhang
Modified: 2010-12-21 06:07 UTC (History)
9 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified: Program Management
Documentation change: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description xianchao zhang 2010-09-07 23:47:44 UTC
Testing Env:    
Host: Ubuntu 10.04 LTS
Kernel: 2.6.32-21-generic-pae
Image location: http://autobuilder.pokylinux.org/milestone/20100905-1/

1. download sato or sdk image from milesone build.
2. boot up qemumips with either image
3. run command 'connmand', segfault will arise.

###################

root@qemumips:~# connmand
 Segmentation fault

####################
Comment 1 Qing He 2010-09-16 18:28:51 UTC
I'll look at this bug
Comment 2 Qing He 2010-09-16 23:00:23 UTC
It's interesting, crash actually happened in /lib/ld.so.1.

Tracing back, found it's in elf/rtld.c:1612
>   /* Set up debugging before the debugger is notified for the first time.  */
> #ifdef ELF_MACHINE_DEBUG_SETUP
>   /* Some machines (e.g. MIPS) don't use DT_DEBUG in this way.  */
>   ELF_MACHINE_DEBUG_SETUP (main_map, r);                  // <== 1612
>   ELF_MACHINE_DEBUG_SETUP (&GL(dl_rtld_map), r);
> #else

and ELF_MACHINE_DEBUG_SETUP is defined in ports/sysdeps/mips/dl-machine.h:
> /* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in
>    with the run-time address of the r_debug structure  */
> #define ELF_MACHINE_DEBUG_SETUP(l,r) \
> do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \
>        *(ElfW(Addr) *)((l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) = \
>        (ElfW(Addr) *)(r); \
>    } while (0)

Looking at the connmand binary:
>  0x70000016 (MIPS_RLD_MAP)      0

So this is where it crashes.

According to sysv-abi mips supplement, "DT_MIPS_RLD_MAP ... is used by debugging. It contains the address of a 32-bit word in the .data section which is supplied by the compilation environment. The word's contents are not specified and programs using this value are not ABI - compliant."

This means MIPS_RLD_MAP should have legitimate values rather than 0, the problem probably lies in binutils. Will look around to see which configuration triggers the issue.
Comment 3 Qing He 2010-09-17 01:02:14 UTC
the triggering parameter is -Wl,--version-script=connman.ver, since the _RLD_MAP variable is rendered local by the version script, DT_MIPS_RLD_MAP cannot get the value of the variable and thus leaves 0 there.

Possible solutions are:
1. add _RLD_MAP in global section of connman.ver
2. modify binutils to let it fill DT_MIPS_RLD_MAP regardless the locality of _RLD_MA
3. add sanity check in glibc to ignore MIPS_RLD_MAP if it's 0

we also needs to checkif  eglibc suffers from this issue.
Comment 5 xianchao zhang 2010-09-29 18:59:10 UTC
With the latest nightly build (20100928), this issue has been fixed.