linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]mdadm: fix coredump of mdadm --monitor -r
@ 2021-08-16  7:24 Wu Guanghao
  2021-08-19  8:21 ` Wu Guanghao
  2021-10-08 10:01 ` Jes Sorensen
  0 siblings, 2 replies; 4+ messages in thread
From: Wu Guanghao @ 2021-08-16  7:24 UTC (permalink / raw)
  To: linux-raid; +Cc: liuzhiqiang26, linfeilong

Hi,

The --monitor -r option requires a parameter, otherwise a null pointer will be manipulated
when converting to integer data, and a coredump will appear.

# mdadm --monitor -r
Segmentation fault (core dumped)

Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
---
 ReadMe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ReadMe.c b/ReadMe.c
index 06b8f7e..070a164 100644
--- a/ReadMe.c
+++ b/ReadMe.c
@@ -81,11 +81,11 @@ char Version[] = "mdadm - v" VERSION " - " VERS_DATE EXTRAVERSION "\n";
  *     found, it is started.
  */

-char short_options[]="-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:k:";
+char short_options[]="-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:r:n:x:u:c:d:z:U:N:safRSow1tye:k";
 char short_bitmap_options[]=
-               "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:k:";
+               "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:r:n:x:u:c:d:z:U:N:safRSow1tye:k";
 char short_bitmap_auto_options[]=
-               "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sa:rfRSow1tye:k:";
+               "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:r:n:x:u:c:d:z:U:N:sa:RSow1tye:k";

 struct option long_options[] = {
     {"manage",    0, 0, ManageOpt},
--
2.23.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH]mdadm: fix coredump of mdadm --monitor -r
  2021-08-16  7:24 [PATCH]mdadm: fix coredump of mdadm --monitor -r Wu Guanghao
@ 2021-08-19  8:21 ` Wu Guanghao
  2021-08-19 11:44   ` Tkaczyk, Mariusz
  2021-10-08 10:01 ` Jes Sorensen
  1 sibling, 1 reply; 4+ messages in thread
From: Wu Guanghao @ 2021-08-19  8:21 UTC (permalink / raw)
  To: linux-raid, jsorensen, mariusz.tkaczyk, jes; +Cc: liuzhiqiang26, linfeilong

ping

在 2021/8/16 15:24, Wu Guanghao 写道:
> Hi,
> 
> The --monitor -r option requires a parameter, otherwise a null pointer will be manipulated
> when converting to integer data, and a coredump will appear.
> 
> # mdadm --monitor -r
> Segmentation fault (core dumped)
> 
> Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
> ---
>  ReadMe.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/ReadMe.c b/ReadMe.c
> index 06b8f7e..070a164 100644
> --- a/ReadMe.c
> +++ b/ReadMe.c
> @@ -81,11 +81,11 @@ char Version[] = "mdadm - v" VERSION " - " VERS_DATE EXTRAVERSION "\n";
>   *     found, it is started.
>   */
> 
> -char short_options[]="-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:k:";
> +char short_options[]="-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:r:n:x:u:c:d:z:U:N:safRSow1tye:k";
>  char short_bitmap_options[]=
> -               "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:k:";
> +               "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:r:n:x:u:c:d:z:U:N:safRSow1tye:k";
>  char short_bitmap_auto_options[]=
> -               "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sa:rfRSow1tye:k:";
> +               "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:r:n:x:u:c:d:z:U:N:sa:RSow1tye:k";
> 
>  struct option long_options[] = {
>      {"manage",    0, 0, ManageOpt},
> --
> 2.23.0
> .
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]mdadm: fix coredump of mdadm --monitor -r
  2021-08-19  8:21 ` Wu Guanghao
@ 2021-08-19 11:44   ` Tkaczyk, Mariusz
  0 siblings, 0 replies; 4+ messages in thread
From: Tkaczyk, Mariusz @ 2021-08-19 11:44 UTC (permalink / raw)
  To: Wu Guanghao, linux-raid, jsorensen, jes; +Cc: liuzhiqiang26, linfeilong

On 19.08.2021 10:21, Wu Guanghao wrote:
> ping
> 
> 在 2021/8/16 15:24, Wu Guanghao 写道:
>> Hi,
>>
>> The --monitor -r option requires a parameter, otherwise a null pointer will be manipulated
>> when converting to integer data, and a coredump will appear.
>>
>> # mdadm --monitor -r
>> Segmentation fault (core dumped)
>>
>> Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
>> ---
>>   ReadMe.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/ReadMe.c b/ReadMe.c
>> index 06b8f7e..070a164 100644
>> --- a/ReadMe.c
>> +++ b/ReadMe.c
>> @@ -81,11 +81,11 @@ char Version[] = "mdadm - v" VERSION " - " VERS_DATE EXTRAVERSION "\n";
>>    *     found, it is started.
>>    */
>>
>> -char short_options[]="-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:k:";
>> +char short_options[]="-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:r:n:x:u:c:d:z:U:N:safRSow1tye:k";
>>   char short_bitmap_options[]=
>> -               "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:k:";
>> +               "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:r:n:x:u:c:d:z:U:N:safRSow1tye:k";
>>   char short_bitmap_auto_options[]=
>> -               "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sa:rfRSow1tye:k:";
>> +               "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:r:n:x:u:c:d:z:U:N:sa:RSow1tye:k";
>>
>>   struct option long_options[] = {
>>       {"manage",    0, 0, ManageOpt},
>> --
>> 2.23.0
>> .
>>

Acked-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>

Thanks,
Mariusz

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]mdadm: fix coredump of mdadm --monitor -r
  2021-08-16  7:24 [PATCH]mdadm: fix coredump of mdadm --monitor -r Wu Guanghao
  2021-08-19  8:21 ` Wu Guanghao
@ 2021-10-08 10:01 ` Jes Sorensen
  1 sibling, 0 replies; 4+ messages in thread
From: Jes Sorensen @ 2021-10-08 10:01 UTC (permalink / raw)
  To: Wu Guanghao, linux-raid; +Cc: liuzhiqiang26, linfeilong

On 8/16/21 3:24 AM, Wu Guanghao wrote:
> Hi,
> 
> The --monitor -r option requires a parameter, otherwise a null pointer will be manipulated
> when converting to integer data, and a coredump will appear.
> 
> # mdadm --monitor -r
> Segmentation fault (core dumped)
> 
> Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
> ---
>  ReadMe.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Something is fishy with your mail client as this didn't apply, but I
applied it manually.

This seems a reasonable fix, even though we have different usages of -r
they all require an argument. That said the whole argument parsing
handling could do with an overhaul.

Thanks,
Jes


> diff --git a/ReadMe.c b/ReadMe.c
> index 06b8f7e..070a164 100644
> --- a/ReadMe.c
> +++ b/ReadMe.c
> @@ -81,11 +81,11 @@ char Version[] = "mdadm - v" VERSION " - " VERS_DATE EXTRAVERSION "\n";
>   *     found, it is started.
>   */
> 
> -char short_options[]="-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:k:";
> +char short_options[]="-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:r:n:x:u:c:d:z:U:N:safRSow1tye:k";
>  char short_bitmap_options[]=
> -               "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:k:";
> +               "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:r:n:x:u:c:d:z:U:N:safRSow1tye:k";
>  char short_bitmap_auto_options[]=
> -               "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sa:rfRSow1tye:k:";
> +               "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:r:n:x:u:c:d:z:U:N:sa:RSow1tye:k";
> 
>  struct option long_options[] = {
>      {"manage",    0, 0, ManageOpt},
> --
> 2.23.0
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-08 10:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-16  7:24 [PATCH]mdadm: fix coredump of mdadm --monitor -r Wu Guanghao
2021-08-19  8:21 ` Wu Guanghao
2021-08-19 11:44   ` Tkaczyk, Mariusz
2021-10-08 10:01 ` Jes Sorensen

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).