Skip to contentSkip to conversation

mdadm segfault at assemble

DISCUSSION NeilBrown 1 participant 1 message Feb 16, 2012 1 message not in the archive MD RAID

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

NeilBrown

author
#1 lore raw
Quoted 22 lines · On Wed, 15 Feb 2012 08:54:32 +0100 Arkadiusz Miśkiewicz <[email protected]> wrote:

Hi,

mapfile.c:434

struct mddev_ident *match = conf_match(st, info, NULL, 0, NULL);

so devname is NULL and that's passed down to fnmatch in match_oneof causing segfault.

Looked at git and it seems to be the same as in mine 3.2.3 version.

Starting program: /sbin/mdadm --assemble --scan --auto=yes

Program received signal SIGSEGV, Segmentation fault.
0xb7ef9f15 in fnmatch () from /lib/libc.so.6
(gdb) bt
#0 0xb7ef9f15 in fnmatch () from /lib/libc.so.6
#1 0x08051caf in match_oneof (devices=0x80dea79 ",/dev/sdb3", devname=0x0) at config.c:958
#2 0x08052051 in conf_match (st=0x80def50, info=0x80e11b8, devname=0x0, verbose=0, rvp=0x0) at config.c:1049

Quoted 5 lines
#3  0x080a8e0c in RebuildMap () at mapfile.c:434
#4  0x080a865b in map_read (melp=0xbffff8a4) at mapfile.c:201
#5  0x080a8526 in map_lock (melp=0xbffff8a4) at mapfile.c:145
#6  0x0804e0f6 in main (argc=4, argv=0xbffffc54) at mdadm.c:1320

Thanks for the report.

This should fix it.

NeilBrown

commit 9f1b0f0f1ed0dd4752be65348a24971335cd50e8

Author: NeilBrown <[email protected]>
Date:   Thu Feb 16 14:11:57 2012 +1100

config: conf_match should ignore devname when not set.

mapfile:RebuildMap calls conf_match with no devname, so we must be careful not to use it.

config.c +1 -1
index 6027b2f..d8f48e1 100644
@@ -1045,7 +1045,7 @@ struct mddev_ident *conf_match(struct supertype *st,
 					array_list->devname);
 			continue;
 		}
-		if (array_list->devices &&
+		if (array_list->devices && devname &&
 		    !match_oneof(array_list->devices, devname)) {
 			if (verbose >= 2 && array_list->devname)
 				fprintf(stderr, Name