Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 287338 - sys-fs/mdadm-3.0.2 segfaults when using "--export --detail"
Summary: sys-fs/mdadm-3.0.2 segfaults when using "--export --detail"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-02 10:55 UTC by Marcin Mirosław
Modified: 2009-10-05 09:04 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge.info,4.33 KB, text/plain)
2009-10-02 10:55 UTC, Marcin Mirosław
Details
kernel config (.config,57.12 KB, text/plain)
2009-10-04 17:09 UTC, Marcin Mirosław
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcin Mirosław 2009-10-02 10:55:03 UTC
Probably, after upgrading to 3.0.2 i'm finding segfaults in dmesg:
dmesg |grep segf
mdadm[1427]: segfault at 0 ip 0808bb9a sp bf8c2080 error 4 in mdadm[8048000+51000]
mdadm[1425]: segfault at 0 ip 0808bb9a sp bffc7960 error 4 in mdadm[8048000+51000]
mdadm[1424]: segfault at 0 ip 0808bb9a sp bf89a5b0 error 4 in mdadm[8048000+51000]
mdadm[1421]: segfault at 0 ip 0808bb9a sp bff77500 error 4 in mdadm[8048000+51000]
mdadm[1428]: segfault at 0 ip 0808bb9a sp bff34170 error 4 in mdadm[8048000+51000]
mdadm[1426]: segfault at 0 ip 0808bb9a sp bfcdaa40 error 4 in mdadm[8048000+51000]
mdadm[1578]: segfault at 0 ip 0808bb9a sp bf9113c0 error 4 in mdadm[8048000+51000]
mdadm[1582]: segfault at 0 ip 0808bb9a sp bfb46d50 error 4 in mdadm[8048000+51000]
mdadm[1585]: segfault at 0 ip 0808bb9a sp bfd7a5b0 error 4 in mdadm[8048000+51000]

uname -a
Linux marcinm 2.6.31-gentoo-r1 #1 PREEMPT Mon Sep 28 14:37:47 CEST 2009 i686 Intel(R) Celeron(R) CPU 2.53GHz GenuineIntel GNU/Linux



Reproducible: Always
Comment 1 Marcin Mirosław 2009-10-02 10:55:49 UTC
Created attachment 205820 [details]
emerge --info
Comment 2 Jouni Rinne 2009-10-02 11:58:47 UTC
(Sigh...) The same problem here, downgraded to 3.0 which works well.

My emerge --info:

Portage 2.1.6.13 (default/linux/amd64/2008.0, gcc-4.3.4, glibc-2.10.1-r0, 2.6.28-gentoo-r5 x86_64)
=================================================================
System uname: Linux-2.6.28-gentoo-r5-x86_64-Intel-R-_Core-TM-2_Duo_CPU_E8500_@_3.16GHz-with-gentoo-2.0.1
Timestamp of tree: Thu, 01 Oct 2009 16:45:01 +0000
distcc 3.1 x86_64-pc-linux-gnu [disabled]
ccache version 2.4 [enabled]
app-shells/bash:     4.0_p33
dev-java/java-config: 2.1.9-r1
dev-lang/python:     2.5.4-r2, 2.6.2-r2, 3.1.1-r1
dev-python/pycrypto: 2.0.1-r8
dev-util/ccache:     2.4-r8
dev-util/cmake:      2.6.4-r2
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.4.3-r3
sys-apps/sandbox:    2.1
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2, 1.11
sys-devel/binutils:  2.19.1-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="amd64 ~amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=nocona -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -march=nocona -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://trumpetti.atm.tut.fi/gentoo/"
LANG="fi_FI.UTF-8"
LDFLAGS="-Wl,-O1"
LINGUAS="fi"
MAKEOPTS="-j5"
PKGDIR="/usr/local/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /usr/local/portage/layman/pd-overlay /usr/local/portage/layman/oss-overlay /usr/local/portage/layman/lightscribe"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 audiofile avahi berkdb bluetooth bonjour bzip2 cairo cdinstall cli crypt cups curl dbus dirac dri dv dvd dvdread encode exif ffmpeg flac fontforge fortran gdbm gif git gnome gpm gtk2 hal iconv id3tag ieee1394 imagemagick ipv6 isdnlog jack joystick jpeg kde ladspa lash lcms libnotify lzo mad matroska mikmod mjpeg mmap mmx mmxext modules motif mp3 mp4 mpeg mtp mudflap multilib ncurses nls nptl nptlonly nsplugin ogg openexr opengl openmp pam pcre pdf perl png pppd python qt3 qt3support qt4 quicktime readline reflection ruby scanner sdl session smp sndfile sox speex spl sqlite sqlite3 sse sse2 ssl ssse3 svg sysfs tcpd theora tiff truetype unicode usb v4l v4l2 vorbis wavpack x264 xcb xine xinerama xml xorg xulrunner xv xvid xvmc zeroconf zlib" ALSA_CARDS="seq-dummy dummy virmidi mtpav mts64 serial-u16550 mpu401 loopback     portman2x4 ad1889 als300 als4000 ali5451 atiixp atiixp-modem au8810 au8820     au8830 azt3328 bt87x ca0106 cmipci cs4281 cs46xx cs5535audio darla20 gina20     layla20 darla24 gina24 layla24 mona mia echo3g indigo indigoio indigodj     emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel hdsp hdspm     ice1712 ice1724 intel8x0 intel8x0m korg1212 maestro3 mixart nm256 pcxhr     riptide rme32 rme96 rme9652 sonicvibes trident via82xx via82xx-modem vx222     ymfpci pdplus asihpi usb-audio usb-usx2y vxpocket pdaudiocf soc     aica emi26 emu1212 emu1616 emu1820" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="evdev keyboard mouse joystick" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="fi" USERLAND="GNU" VIDEO_CARDS="vesa fglrx radeon radeonhd"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

Comment 3 Dawid Stawiarski 2009-10-03 16:46:11 UTC
it looks like, it happens, when 'mdadm --detail' is used in combination with '--export' parameter (when used separately they both work OK).
Comment 4 f3d 2009-10-03 22:56:56 UTC
Same symptoms here.

Gdb traces in case it's useful :

Starting program: /sbin/mdadm --export --detail /dev/md0
MD_LEVEL=raid1
MD_DEVICES=2
MD_METADATA=0.90
MD_UUID=2fbf6c88:2d0dbc06:88a4902f:84456010

Program received signal SIGSEGV, Segmentation fault.
0x000000000043260e in set_member_info (st=0x9b52f0, ent=0x9b54a0)
    at mapfile.c:306
306	mapfile.c: No such file or directory.
	in mapfile.c
Comment 5 SpanKY gentoo-dev 2009-10-04 00:34:26 UTC
works on my system.  is the crash only with '--export --detail' ?  reporting "segfault in dmesg" isnt useful information.

# dd if=/dev/zero of=1 count=1000000
1000000+0 records in
1000000+0 records out
512000000 bytes (512 MB) copied, 31.8356 s, 16.1 MB/s
# cp 1 2
# losetup /dev/loop1 1
# losetup /dev/loop2 2

# mdadm --create -n 2 -l raid1 /dev/md0 /dev/loop{1,2}
mdadm: /dev/loop1 appears to be part of a raid array:
    level=raid1 devices=2 ctime=Sat Oct  3 20:31:07 2009
mdadm: /dev/loop2 appears to be part of a raid array:
    level=raid1 devices=2 ctime=Sat Oct  3 20:31:07 2009
Continue creating array? y
mdadm: array /dev/md0 started.

# mdadm --detail --export /dev/md0
MD_LEVEL=raid1
MD_DEVICES=2
MD_METADATA=0.90
MD_UUID=190e387a:ed3b70f3:c7753f8f:4e18d54b

# mdadm --version
mdadm - v3.0.2 - 25th September 2009
Comment 6 Marcin Mirosław 2009-10-04 16:51:15 UTC
(In reply to comment #5)
> works on my system.  is the crash only with '--export --detail' ?  reporting
> "segfault in dmesg" isnt useful information.

Yes, I agree, my previous info wasn't much useful, i was busy and i didn't had much time to investigate.


 # dd if=/dev/zero of=1 count=1000000
1000000+0 przeczytanych recordów
1000000+0 zapisanych recordów
skopiowane 512000000 bajtów (512 MB), 10,8516 s, 47,2 MB/s
# cp 1 2
# losetup /dev/loop1 1
# losetup /dev/loop2 2
# mdadm --create -n 2 -l raid1 /dev/md0 /dev/loop{1,2}
Segmentation fault

Happens always.
Comment 7 Marcin Mirosław 2009-10-04 17:09:42 UTC
Created attachment 206000 [details]
kernel config
Comment 8 Marcin Mirosław 2009-10-04 17:19:40 UTC
gdb trace:
gdb --args mdadm --create -n 2 -l raid1 /dev/md0 /dev/loop{1,2}
GNU gdb 6.8
Copyright (C) 2008 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 "i686-pc-linux-gnu"...
(gdb) run
Starting program: /sbin/mdadm --create -n 2 -l raid1 /dev/md0 /dev/loop1 /dev/loop2

Program received signal SIGSEGV, Segmentation fault.
0xb7f997a3 in strlen () from /lib/libc.so.6

Now I'm compilling glibc with debug. 
Comment 9 Conrad Kostecki gentoo-dev 2009-10-04 18:42:42 UTC
Same Problem here :(
Comment 10 Marcin Mirosław 2009-10-04 20:26:20 UTC
Glibc with debug enabled:
# gdb --args mdadm --create -n 2 -l raid1 /dev/md0 /dev/loop{1,2}

(gdb) run
Starting program: /sbin/mdadm --create -n 2 -l raid1 /dev/md0 /dev/loop1 /dev/loop2

Program received signal SIGSEGV, Segmentation fault.
strlen () at ../sysdeps/i386/i486/strlen.S:69
69    ../sysdeps/i386/i486/strlen.S: No such file or directory.
  in ../sysdeps/i386/i486/strlen.S
Current language:  auto; currently asm

Comment 11 SpanKY gentoo-dev 2009-10-05 06:25:17 UTC
the debug info from glibc shouldnt really matter.  if a string function is crashing, it most likely means that the package calling the string function passed a bad pointer.

build mdadm with FEATURES="installsources splitdebug" and CFLAGS="-O0 -g" and see if it still crashes.  if it does, post the backtrace from gdb rather than the current frame info (i.e. the crash message about strlen).
Comment 12 Marcin Mirosław 2009-10-05 07:07:05 UTC
I'm not sure i did it right:

gdb --args mdadm --create -n 2 -l raid1 /dev/md0 /dev/loop{1,2}
GNU gdb 6.8
[copyright]
(gdb) run
Starting program: /sbin/mdadm --create -n 2 -l raid1 /dev/md0 /dev/loop1 /dev/loop2

Program received signal SIGSEGV, Segmentation fault.
strlen () at ../sysdeps/i386/i486/strlen.S:69
69      ../sysdeps/i386/i486/strlen.S: No such file or directory.
        in ../sysdeps/i386/i486/strlen.S
Current language:  auto; currently asm
(gdb) bt
#0  strlen () at ../sysdeps/i386/i486/strlen.S:69
#1  0x0808979b in set_member_info (st=0x8490660, ent=0x8490468) at mapfile.c:306
#2  0x08089a4d in RebuildMap () at mapfile.c:369
#3  0x080892ff in map_read (melp=0xbfa0e548) at mapfile.c:166
#4  0x080891f1 in map_lock (melp=0xbfa0e548) at mapfile.c:126
#5  0x0805c3ff in Create (st=0x8490050, mddev=0xbfa0f509 "/dev/md0", chunk=0, level=1, layout=0, size=499904, raiddisks=2, sparedisks=0,
    name=0xbfa0edd4 "", homehost=0xbfa0ecb4 "serwerek", uuid=0x0, subdevs=2, devlist=0x8490020, runstop=0, verbose=0, force=0,
    assume_clean=0, bitmap_file=0x0, bitmap_chunk=65534, write_behind=0, delay=5, autof=0) at Create.c:467
#6  0x0804dd7a in main (argc=9, argv=0xbfa0f034) at mdadm.c:1223
(gdb) frame 0
#0  strlen () at ../sysdeps/i386/i486/strlen.S:69
69      in ../sysdeps/i386/i486/strlen.S
(gdb) print buf
$1 = 0x0
(gdb) list
301      * version super_by_fd does this automatically, this routine is meant as
302      * a supplement for guess_super()
303      */
304     static void set_member_info(struct supertype *st, struct mdstat_ent *ent)
305     {
306             char version[strlen(ent->metadata_version)+1];
307
308             st->subarray[0] = '\0';
309
310             if (strncmp(ent->metadata_version, "external:", 9) != 0)

Comment 13 SpanKY gentoo-dev 2009-10-05 07:59:55 UTC
thanks, that helps.  please try mdadm-3.0.2-r1 now in the tree.
Comment 14 Marcin Mirosław 2009-10-05 09:04:26 UTC
It's much better for me:)
Thank you.