Hello, I have a segfault when I'm trying to assemble my raid0 device, I'm attaching a gdb backtrace and a patch which fix it. I have looked at the source code and the bug is pretty easily fixable. Everything is working fine with mdadm 3.1.X . I have already reported the issue upstream. Reproducible: Always Steps to Reproduce: mdadm --assemble /dev/md3 /dev/sda4 /dev/sdb4 (/dev/md3 is a raid0 device assembled some time ago with mdadm 3.1.X) Actual Results: mdadm-3.2.3 # ./mdadm --assemble /dev/md3 /dev/sda4 /dev/sdb4 Segmentation fault Expected Results: mdadm-3.2.3 # ./mdadm --assemble /dev/md3 /dev/sda4 /dev/sdb4 mdadm: /dev/md3 has been started with 2 drives. arrakis mdadm-3.2.3 # gdb ./mdadm 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 "x86_64-pc-linux-gnu". For bug reporting instructions, please see: <http://bugs.gentoo.org/>... Reading symbols from /tmp/mdadm/mdadm-3.2.3/mdadm...done. (gdb) r --assemble /dev/md3 /dev/sda4 /dev/sdb4 Starting program: /tmp/mdadm/mdadm-3.2.3/mdadm --assemble /dev/md3 /dev/sda4 /dev/sdb4 Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7acd961 in __strlen_sse2 () from /lib64/libc.so.6 (gdb) bt #0 0x00007ffff7acd961 in __strlen_sse2 () from /lib64/libc.so.6 #1 0x00007ffff7b0088d in fnmatch () from /lib64/libc.so.6 #2 0x000000000040a11d in match_oneof (devices=0x6983b9 ",/dev/sdb2", devname=0x0) at config.c:958 #3 0x000000000040a4d3 in conf_match (st=0x6aba90, info=0x6ac930, devname=0x0, verbose=0, rvp=0x0) at config.c:1049 #4 0x000000000046135b in RebuildMap () at mapfile.c:434 #5 0x0000000000460b08 in map_read (melp=0x7fffffffcdc8) at mapfile.c:201 #6 0x0000000000460cdb in map_update (mpp=0x0, devnum=3, metadata=0x7fffffffd49c "1.2", uuid=0x7fffffffd3f8, path=0x7fffffffcf90 "/dev/md3") at mapfile.c:241 #7 0x000000000041912f in Assemble (st=0x698320, mddev=0x7fffffffcf90 "/dev/md3", ident=0x7fffffffdac0, devlist=0x698030, backup_file=0x0, invalid_backup=0, readonly=0, runstop=0, update=0x0, homehost=0x7fffffffd9b0 "arrakis", require_homehost=1, verbose=0, force=0, freeze_reshape=0) at Assemble.c:1230 #8 0x000000000040648b in main (argc=5, argv=0x7fffffffde88) at mdadm.c:1258 (gdb) bt full #0 0x00007ffff7acd961 in __strlen_sse2 () from /lib64/libc.so.6 No symbol table info available. #1 0x00007ffff7b0088d in fnmatch () from /lib64/libc.so.6 No symbol table info available. #2 0x000000000040a11d in match_oneof (devices=0x6983b9 ",/dev/sdb2", devname=0x0) at config.c:958 patn = "/dev/sda2\000j\000\000\000\000\000\000\002\000\000\000\000\000\000\240~\335\367\377\177\000\000\b\006\000\000\000\000\000\000\225dC", '\000' <r>"\274, \204\254\367\377\177\000\000\n\225C\000\000\000\000\000y\231C", '\000' <repeats 25 times>, "\b\000\000\000P\246\377\377\377\177", '\000' <repeats 40 ti00@0\000\000\000\000\000\000\370~\335\367\377\177\000\000\b\177\335\367\377\177\000\000\370\246\377\377\377\177\000\000\060\060\000\000\000\000\000\000q\000\00 p = 0x6983b0 "/dev/sda2,/dev/sdb2" #3 0x000000000040a4d3 in conf_match (st=0x6aba90, info=0x6ac930, devname=0x0, verbose=0, rvp=0x0) at config.c:1049 array_list = 0x6983d0 match = 0x0 #4 0x000000000046135b in RebuildMap () at mapfile.c:434 match = 0x0 stb = {st_dev = 0, st_ino = 0, st_nlink = 0, st_mode = 0, st_uid = 0, st_gid = 0, __pad0 = 0, st_rdev = 0, st_size = 0, st_blksize = 0, st_blocks = 0, dn = "8:18", '\000' <repeats 25 times> ok = 0 info = 0x6ac930 namebuf = '\000' <repeats 99 times> dfd = 8 st = 0x6aba90 subarray = 0x0 path = 0x698820 "/dev/md1" sra = 0x6ab480 sd = 0x6ac7a0 mdstat = 0x6ab850 md = 0x6ab850 map = 0x0 mdp = 254 require_homehost = 1 sys_hostname = "arrakis", '\000' <repeats 248 times> homehost = 0x7fffffffaa50 "arrakis" arrakis mdadm-3.2.3 # emerge --info Portage 2.1.10.46 (default/linux/amd64/10.0, gcc-4.5.3, glibc-2.14.1-r2, 3.2.6-gentoo-nikita x86_64) ================================================================= System uname: Linux-3.2.6-gentoo-nikita-x86_64-Intel-R-_Core-TM-_i7-2600_CPU_@_3.40GHz-with-gentoo-2.1 Timestamp of tree: Tue, 14 Feb 2012 10:00:01 +0000 app-shells/bash: 4.2_p20 dev-java/java-config: 2.1.11-r3 dev-lang/python: 2.7.2-r3, 3.1.4-r3, 3.2.2 dev-util/cmake: 2.8.7-r2 dev-util/pkgconfig: 0.26 sys-apps/baselayout: 2.1 sys-apps/openrc: 0.9.8.4 sys-apps/sandbox: 2.5 sys-devel/autoconf: 2.13, 2.68 sys-devel/automake: 1.9.6-r3, 1.11.3 sys-devel/binutils: 2.22-r1 sys-devel/gcc: 4.5.3-r2 sys-devel/gcc-config: 1.5-r2 sys-devel/libtool: 2.4.2 sys-devel/make: 3.82-r3 sys-kernel/linux-headers: 3.2 (virtual/os-headers) sys-libs/glibc: 2.14.1-r2 Repositories: gentoo ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="* -@EULA dlj-1.1 PUEL google-chrome Oracle-BCLA-JavaSE skype-eula" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -pipe -march=native -mtune=native" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-O2 -pipe -march=native -mtune=native" DISTDIR="/usr/portage/distfiles" FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox" FFLAGS="" GENTOO_MIRRORS="http://mirrors.linuxant.fr/distfiles.gentoo.org/ http://gentoo.modulix.net/gentoo/ http://mirror.ovh.net/gentoo-distfiles/ ftp://mirrors.linuxant.fr/distfiles.gentoo.org/ http://mirror.qubenet.net/mirror/gentoo/" LANG="en_US.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X acl acpi amd64 applet avahi bash-completion berkdb bzip2 cli cracklib crypt cups cxx dbus dri fortran gdbm gnome gnome-keyring gpm gtk gtk3 iconv ipv6 jpeg2k libnotify mmx modules mudflap multilib ncurses networkmanager nls nptl nptlonly openmp pam pcre pppd readline session sse sse2 sse3 sse4 ssl ssse3 sysfs tcpd unicode vim-syntax xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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 cgi cgid 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" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Created attachment 301929 [details, diff] patch which is fixing my segfault
looks like the bug was introduced upstream in commit 2244d1a9877d18bdc42a5204d31f41920d369e87 in that, i can see conf_match() explicitly being called with devname==NULL. so your patch looks correct to me.
should be all set now in the tree; thanks for the report! Commit message: Fix segfault when assembling http://sources.gentoo.org/sys-fs/mdadm/files/mdadm-3.2.3-segv-assemble.patch?rev=1.1 http://sources.gentoo.org/sys-fs/mdadm/mdadm-3.2.3-r1.ebuild?rev=1.1