Linux RAID subsystem development
 help / color / mirror / Atom feed
From: Jes Sorensen <jes@trained-monkey.org>
To: Li Xiao Keng <lixiaokeng@huawei.com>,
	Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>,
	Paul Menzel <pmenzel@molgen.mpg.de>,
	linux-raid@vger.kernel.org
Cc: linfeilong <linfeilong@huawei.com>,
	"liuzhiqiang (I)" <liuzhiqiang26@huawei.com>,
	Wu Guanghao <wuguanghao3@huawei.com>
Subject: Re: [PATCH V5] Fix NULL dereference in super_by_fd
Date: Tue, 28 Feb 2023 12:28:41 -0500	[thread overview]
Message-ID: <4ab31e8b-652f-5bff-abc9-323fcff32b09@trained-monkey.org> (raw)
In-Reply-To: <e9b040d6-e01b-7113-aed0-95071bd0aa26@huawei.com>

On 2/26/23 22:12, Li Xiao Keng wrote:
> When we create 100 partitions (major is 259 not 254) in a raid device,
> mdadm may coredump:
> 
> Core was generated by `/usr/sbin/mdadm --detail --export /dev/md1p7'.
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0  __strlen_avx2_rtm () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:74
> 74		VPCMPEQ	(%rdi), %ymm0, %ymm1
> (gdb) bt
> #0  __strlen_avx2_rtm () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:74
> #1  0x00007fbb9a7e4139 in __strcpy_chk (dest=dest@entry=0x55d55d6a13ac "", src=0x0, destlen=destlen@entry=32) at strcpy_chk.c:28
> #2  0x000055d55ba1766d in strcpy (__src=<optimized out>, __dest=0x55d55d6a13ac "") at /usr/include/bits/string_fortified.h:79
> #3  super_by_fd (fd=fd@entry=3, subarrayp=subarrayp@entry=0x7fff44dfcc48) at util.c:1289
> #4  0x000055d55ba273a6 in Detail (dev=0x7fff44dfef0b "/dev/md1p7", c=0x7fff44dfe440) at Detail.c:101
> #5  0x000055d55ba0de61 in misc_list (c=<optimized out>, ss=<optimized out>, dump_directory=<optimized out>, ident=<optimized out>, devlist=<optimized out>) at mdadm.c:1959
> #6  main (argc=<optimized out>, argv=<optimized out>) at mdadm.c:1629
> 
> The direct cause is fd2devnm returning NULL, so add a check.
> 
> Signed-off-by: Li Xiao Keng <lixiaokeng@huawei.com>
> Signed-off-by: Wu Guang Hao <wuguanghao3@huawei.com>
> ---
> V1->V2: When fd2devnm return NULL, super_by_fd return NULL but not an
> incomplete 'st' entry. At the same time, add a check in map_by_devnm
> to avoid coredump.
> 
> V2->V3: Fix style issues.
> V3->V4: Change strcpy() to strncpy().
> V4->V5: Move changelog to the location after '---'
> 
>  mapfile.c | 4 ++++
>  util.c    | 7 ++++++-
>  2 files changed, 10 insertions(+), 1 deletion(-)
>

Applied!

Thanks,
Jes



      parent reply	other threads:[~2023-02-28 17:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-27  3:12 [PATCH V5] Fix NULL dereference in super_by_fd Li Xiao Keng
2023-02-28  8:50 ` Coly Li
2023-02-28  8:56 ` Coly Li
2023-02-28 17:28 ` Jes Sorensen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ab31e8b-652f-5bff-abc9-323fcff32b09@trained-monkey.org \
    --to=jes@trained-monkey.org \
    --cc=linfeilong@huawei.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=liuzhiqiang26@huawei.com \
    --cc=lixiaokeng@huawei.com \
    --cc=mariusz.tkaczyk@linux.intel.com \
    --cc=pmenzel@molgen.mpg.de \
    --cc=wuguanghao3@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox