I just encountered this myself. Was a bit bored, so did some testing.
mdadm master HEAD (4.0) does not segfault, nor does the HEAD of the branch mdadm-3.3.4
However, if you acquire the actual version of source used by ubuntu (3.3, from 2013(!)) and compile, and run through gdb, you get:
Program received signal SIGSEGV, Segmentation fault.
strlen () at ../sysdeps/x86_64/strlen.S:106
106 ../sysdeps/x86_64/strlen.S: No such file or directory.
(gdb) bt
#0 strlen () at ../sysdeps/x86_64/strlen.S:106
#1 0x00007ffff7a9847e in __GI___strdup (s=0x0) at strdup.c:41
#2 0x0000000000477ddf in xstrdup (str=0x0) at xmalloc.c:66
#3 0x0000000000435009 in add_new_arrays (mdstat=0x6b4480, statelist=0x7fffffffe020, test=0, info=0x7fffffffe070)
at Monitor.c:670
#4 0x00000000004336e7 in Monitor (devlist=0x0, mailaddr=0x6b4510 "root", alert_cmd=0x0, c=0x7fffffffe210,
daemonise=0, oneshot=1, dosyslog=0, pidfile=0x0, increments=20, share=0) at Monitor.c:223
#5 0x0000000000406cd1 in main (argc=4, argv=0x7fffffffe6d8) at mdadm.c:1448
Monitor.c:670 is
st->devname = xstrdup(get_md_name(mse->devnm));
with the obvious unchecked return value of get_md_name
I just encountered this myself. Was a bit bored, so did some testing.
mdadm master HEAD (4.0) does not segfault, nor does the HEAD of the branch mdadm-3.3.4
However, if you acquire the actual version of source used by ubuntu (3.3, from 2013(!)) and compile, and run through gdb, you get:
Program received signal SIGSEGV, Segmentation fault. x86_64/ strlen. S:106 x86_64/ strlen. S: No such file or directory. x86_64/ strlen. S:106 0x7fffffffe020, test=0, info=0x7fffffff e070) e6d8) at mdadm.c:1448
strlen () at ../sysdeps/
106 ../sysdeps/
(gdb) bt
#0 strlen () at ../sysdeps/
#1 0x00007ffff7a9847e in __GI___strdup (s=0x0) at strdup.c:41
#2 0x0000000000477ddf in xstrdup (str=0x0) at xmalloc.c:66
#3 0x0000000000435009 in add_new_arrays (mdstat=0x6b4480, statelist=
at Monitor.c:670
#4 0x00000000004336e7 in Monitor (devlist=0x0, mailaddr=0x6b4510 "root", alert_cmd=0x0, c=0x7fffffffe210,
daemonise=0, oneshot=1, dosyslog=0, pidfile=0x0, increments=20, share=0) at Monitor.c:223
#5 0x0000000000406cd1 in main (argc=4, argv=0x7fffffff
Monitor.c:670 is
st->devname = xstrdup( get_md_ name(mse- >devnm) );
with the obvious unchecked return value of get_md_name
Looking through the git history, this was fixed with http:// git.neil. brown.name/ ?p=mdadm. git;a=commitdif f;h=1e08717f0b7 856b389e9d5eb2d c330d146636183
I'd recommend backporting this patch :)