* [PATCH] segment faulty occured in add_feature()
@ 2016-11-01 0:44 huang.wei56
2016-11-01 16:05 ` Benjamin Marzinski
0 siblings, 1 reply; 2+ messages in thread
From: huang.wei56 @ 2016-11-01 0:44 UTC (permalink / raw)
To: Christophe Varoqui
Cc: wei huang, tang.junhui, zhang.kai16, dm-devel, bart.vanassche
From: wei huang <huang.wei56@zte.com.cn>
Problem:
Multipathd segment faulty occured when device policy was configured in multipath.conf as follow:
#This is a device configuration just for COMPELNT device
devices {
device {
vendor COMPELNT
dev_loss_tmo 120
scheduler deadline
}
}
The call trace is:
Program received signal SIGSEGV, Segmentation fault.
0x00007f4eaaf49251 in __strstr_sse2 () from /lib64/libc.so.6
(gdb) bt
#0 0x00007f4eaaf49251 in __strstr_sse2 () from /lib64/libc.so.6
#1 0x00007f4eabba879c in add_feature (f=f@entry=0x211b248, n=n@entry=0x7f4eabbc530a queue_if_no_path)
at structs.c:524
#2 0x00007f4eabba6993 in merge_hwe (src=0x2148c70, dst=0x211b220) at config.c:359
#3 factorize_hwtable (hw=0x214b800, n=n@entry=77) at config.c:452
#4 0x00007f4eabba7850 in load_config (file=file@entry=0x4144c8 /etc/multipath.conf) at config.c:651
#5 0x0000000000408959 in reconfigure (vecs=vecs@entry=0x2128ae0) at main.c:2078
#6 0x00000000004063c6 in child (param=0x0) at main.c:2483
#7 main (argc=<optimized out>, argv=<optimized out>) at main.c:2725
(gdb) up
#1 0x00007f4eabba879c in add_feature (f=f@entry=0x211b248, n=n@entry=0x7f4eabbc530a queue_if_no_path)
at structs.c:524
524 if (strstr(*f, n))
(gdb) p *f
= 0x0
Reasons:
When multipathd loads config, it will call merge_hwe() to merge the features between default_hw[] and config.
If the vender is not configured features in default_hw[], dst->features's value will be null. So strstr()'s first
parameter *f is null in add_feature(),too.
Signed-off-by: wei huang <huang.wei56@zte.com.cn>
---
libmultipath/structs.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index fee58e5..f673325 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -520,6 +520,17 @@ add_feature (char **f, char *n)
if (!n || *n == '0')
return 0;
+ /* default feature is null */
+ if(!*f)
+ {
+ l = asprintf(&t, "1 %s", n);
+ if(l == -1)
+ return 1;
+
+ *f = t;
+ return 0;
+ }
+
/* Check if feature is already present */
if (strstr(*f, n))
return 0;
--
2.8.1.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] segment faulty occured in add_feature()
2016-11-01 0:44 [PATCH] segment faulty occured in add_feature() huang.wei56
@ 2016-11-01 16:05 ` Benjamin Marzinski
0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Marzinski @ 2016-11-01 16:05 UTC (permalink / raw)
To: huang.wei56; +Cc: tang.junhui, zhang.kai16, dm-devel, bart.vanassche
On Tue, Nov 01, 2016 at 08:44:49AM +0800, huang.wei56@zte.com.cn wrote:
ACK
-Ben
> From: wei huang <huang.wei56@zte.com.cn>
>
> Problem:
> Multipathd segment faulty occured when device policy was configured in multipath.conf as follow:
> #This is a device configuration just for COMPELNT device
> devices {
> device {
> vendor COMPELNT
> dev_loss_tmo 120
> scheduler deadline
> }
> }
>
> The call trace is:
> Program received signal SIGSEGV, Segmentation fault.
> 0x00007f4eaaf49251 in __strstr_sse2 () from /lib64/libc.so.6
> (gdb) bt
> #0 0x00007f4eaaf49251 in __strstr_sse2 () from /lib64/libc.so.6
> #1 0x00007f4eabba879c in add_feature (f=f@entry=0x211b248, n=n@entry=0x7f4eabbc530a queue_if_no_path)
> at structs.c:524
> #2 0x00007f4eabba6993 in merge_hwe (src=0x2148c70, dst=0x211b220) at config.c:359
> #3 factorize_hwtable (hw=0x214b800, n=n@entry=77) at config.c:452
> #4 0x00007f4eabba7850 in load_config (file=file@entry=0x4144c8 /etc/multipath.conf) at config.c:651
> #5 0x0000000000408959 in reconfigure (vecs=vecs@entry=0x2128ae0) at main.c:2078
> #6 0x00000000004063c6 in child (param=0x0) at main.c:2483
> #7 main (argc=<optimized out>, argv=<optimized out>) at main.c:2725
> (gdb) up
> #1 0x00007f4eabba879c in add_feature (f=f@entry=0x211b248, n=n@entry=0x7f4eabbc530a queue_if_no_path)
> at structs.c:524
> 524 if (strstr(*f, n))
> (gdb) p *f
> = 0x0
>
> Reasons:
> When multipathd loads config, it will call merge_hwe() to merge the features between default_hw[] and config.
> If the vender is not configured features in default_hw[], dst->features's value will be null. So strstr()'s first
> parameter *f is null in add_feature(),too.
>
> Signed-off-by: wei huang <huang.wei56@zte.com.cn>
> ---
> libmultipath/structs.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/libmultipath/structs.c b/libmultipath/structs.c
> index fee58e5..f673325 100644
> --- a/libmultipath/structs.c
> +++ b/libmultipath/structs.c
> @@ -520,6 +520,17 @@ add_feature (char **f, char *n)
> if (!n || *n == '0')
> return 0;
>
> + /* default feature is null */
> + if(!*f)
> + {
> + l = asprintf(&t, "1 %s", n);
> + if(l == -1)
> + return 1;
> +
> + *f = t;
> + return 0;
> + }
> +
> /* Check if feature is already present */
> if (strstr(*f, n))
> return 0;
> --
> 2.8.1.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-11-01 16:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-01 0:44 [PATCH] segment faulty occured in add_feature() huang.wei56
2016-11-01 16:05 ` Benjamin Marzinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).