mdadm --detail --scan segfaults during update-initramfs

Bug #969384 reported by Paul Gortmaker on 2012-03-30
40
This bug affects 5 people
Affects Status Importance Assigned to Milestone
mdadm (Ubuntu)
Critical
Dimitri John Ledkov
Precise
Critical
Dimitri John Ledkov
Quantal
Critical
Dimitri John Ledkov

Bug Description

[IMPACT]

 * mdadm --detail --scan segfauls, when used with raw device names

 * This may result in update-initramfs call failure, preventing users from updating linux kernel and other parts which are included in the initramfs.

* The bug is fixed in the upstream bug fix point release

[TESTCASE]

 * Reproduce a segfault by running mdadm --detail --scan with raw device names
 * Upgrade the package
 * Notice that running mdadm --detail --scan no longer segfaults

[Regression Potential]

 * Minimal, worst thing that can happen is that the said call still segfaults or has other new problems.

Related branches

Paul Gortmaker (paul-gortmaker) wrote :
Brian Murray (brian-murray) wrote :

I was unable to recreate this on two separate systems using mdadm in precise with raid arrays.

On Wed, Apr 4, 2012 at 12:42 PM, Brian Murray <email address hidden> wrote:
> I was unable to recreate this on two separate systems using mdadm in
> precise with raid arrays.

I suspect it is tied to my using raw deice names and not UUIDs. Rather
than focusing on recreating it, did you investigate the various traces and
extra info I supplied? Is there extra info above that which I can give you?

Paul.
--
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/969384
>
> Title:
>  mdadm --detail --scan segfaults during update-initramfs
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu/+source/mdadm/+bug/969384/+subscriptions

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mdadm (Ubuntu):
status: New → Confirmed
ilia (ilia) wrote :

Upstream commit 9f1b0f0f1ed should fix this segmentation fault:
http://neil.brown.name/git?p=mdadm;a=commitdiff;h=9f1b0f0f1ed0dd4752be65348a24971335cd50e8

This commit is included in 3.2.4 release, consider updating the whole package.

FYI, below is a gdb stacktrace of mdadm 3.2.3-2ubuntu1:

#0 0x00007ffff7aa5b91 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff7ae39c9 in fnmatch () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x0000000000409e88 in match_oneof (devices=0x685179 ",/dev/sdb3,/dev/sdc3", devname=0x0) at config.c:959
#3 0x000000000040a1b3 in conf_match (st=0x685730, info=0x68da80, devname=0x0, verbose=0, rvp=0x0) at config.c:1050
#4 0x000000000044d10b in RebuildMap () at mapfile.c:434
#5 0x000000000044d585 in map_read (melp=0x7fffffffe560) at mapfile.c:201
#6 0x000000000044d67d in map_by_devnum (map=0x7fffffffe560, devnum=0) at mapfile.c:309
#7 0x0000000000407335 in main (argc=<optimized out>, argv=<optimized out>) at mdadm.c:1477

Source snippets:
#4: /* NB: 3rd argument is NULL */
    struct mddev_ident *match = conf_match(st, info,
               NULL, 0,
               NULL);

#3: /* NB: devname is a 3rd argument name, i.e. devname==NULL */
  if (array_list->devices &&
      !match_oneof(array_list->devices, devname)) {

#2: /* NB: fnmatch() receives NULL as a 2nd argument, which leads to SIGSEGV */
  if (fnmatch(patn, devname, FNM_PATHNAME)==0)

ilia (ilia) wrote :
Changed in mdadm (Ubuntu):
assignee: nobody → Dmitrijs Ledkovs (dmitrij.ledkov)
importance: Undecided → Critical

The attachment "Upstream fix" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Steve Langasek (vorlon) on 2012-06-12
Changed in mdadm (Ubuntu Precise):
status: New → Triaged
Changed in mdadm (Ubuntu Quantal):
status: Confirmed → Triaged
Changed in mdadm (Ubuntu Precise):
importance: Undecided → Critical
assignee: nobody → Dmitrijs Ledkovs (dmitrij.ledkov)
milestone: none → ubuntu-12.04.1
tags: added: rls-q-incoming
Steve Langasek (vorlon) on 2012-06-22
tags: removed: rls-q-incoming
Launchpad Janitor (janitor) wrote :
Download full text (3.3 KiB)

This bug was fixed in the package mdadm - 3.2.5-1ubuntu1

---------------
mdadm (3.2.5-1ubuntu1) quantal; urgency=low

  * Merge from Debian testing. (LP: #920324) Remaining changes:
    - Call checks in local-premount to avoid race condition with udev
      and opening a degraded array.
    - d/initramfs/mdadm-functions: Record in /run when boot-degraded
      question has been asked so that it is only asked once
    - pass --test to mdadm to enable result codes for degraded arrays.
    - debian/control: we need udev and util-linux in the right version. We
      also remove the build dependency from quilt and docbook-to-man as both
      are not used in Ubuntus mdadm.
    - debian/initramfs/hook: kept the Ubuntus version for handling the absence
      of active raid arrays in <initramfs>/etc/mdadm/mdadm.conf
    - debian/initramfs/script.local-top.DEBIAN, debian/mdadm-startall,
      debian/mdadm.raid.DEBIAN: removed. udev does its job now instead.
    - debian/mdadm-startall.sgml, debian/mdadm-startall.8: documentation of
      unused startall script
    - debian/mdadm.config, debian/mdadm.postinst - let udev do the handling
      instead. Resolved merge conflict by keeping Ubuntu's version.
    - debian/mdadm.postinst, debian/mdadm.config, initramfs/init-premount:
      boot-degraded enablement; maintain udev starting of RAID devices;
      init-premount hook script for the initramfs, to provide information at
      boot
    - debian/mkconf.in is the older mkconf. Kept the Ubuntu version.
    - debian/rules: Kept Ubuntus version for installing apport hooks, not
      installing un-used startall script.
    - debian/install-rc, check.d/_numbers, check.d/root_on_raid: Ubuntu partman
      installer changes
    - debian/presubj: Dropped this unused bug reporting file. Instead use
      source_mdadm.py act as an apport hook for bug handling.
    - d/p/debian-changes-3.1.4-1+8efb9d1ubuntu4: mdadm udev rule
      incrementally adds mdadm member when detected. Starting such an
      array in degraded mode is possible by mdadm -IRs. Using mdadm
      -ARs without stopping the array first does nothing when no
      mdarray-unassociated device is available. Using mdadm -IRs to
      start a previously partially assembled array through incremental
      mode. Keeping the mdadm -ARs for assembling arrays which were for
      some reason not assembled through incremental mode (i.e through
      mdadm's udev rule).

  * Additional Ubuntu changes:
      - debian/initramfs/local-premount: add call wait_for_udev to wait a
      little longer for RAID devices to appear (LP: #942106)

  * Dropped Ubuntu changes:
    - Build udeb with -O2 on ppc64, working around a link error. Builds
      fine without it on debian.
    - rename debian/mdadm.vol_id.udev to debian/mdadm.mdadm-blkid.udev so
      that the rules file ends up with a more reasonable name. debian/rules
      changes for adding ubuntu's udev rule corresponding to mdadm. As we
      are now using 'upstream' udev rules see 3.2.3-2ubuntu2.

  * Changes to Ubuntu changes:
    - debian/source_mdadm.py: make apport hook python 2 and 3 compatible
      (LP: #1013171).

  * New upstream release closes this...

Read more...

Changed in mdadm (Ubuntu Quantal):
status: Triaged → Fix Released
description: updated
Changed in mdadm (Ubuntu Precise):
status: Triaged → In Progress

Hello Paul, or anyone else affected,

Accepted mdadm into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/mdadm/3.2.5-1ubuntu0.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in mdadm (Ubuntu Precise):
status: In Progress → Fix Committed
tags: added: verification-needed
Adam Conrad (adconrad) wrote :

Hello Paul, or anyone else affected,

Accepted mdadm into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/mdadm/3.2.5-1ubuntu0.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Dimitri John Ledkov (xnox) wrote :

I also did not manage to reproduce the segfault with precise.
But I also did not encounter seg-faults with precise-proposed version.

ilia or Paul Gortmaker (paul-gortmaker) can you please confirm that update-initramfs no longer segfaults for you with the mdadm package from precise-proposed?

We may simply trust the upstream fix, on the basis that there is no regression w.r.t precise version mdadm on this front.

Seems OK now, see below:

-------------
root@yow-lpgnfs-02:/home/paul# ls -l /sbin/mdadm
-rwxr-xr-x 1 root root 462496 Aug 4 02:54 /sbin/mdadm
root@yow-lpgnfs-02:/home/paul# mdadm --version
mdadm - v3.2.5 - 18th May 2012
root@yow-lpgnfs-02:/home/paul# dpkg-query -l|grep mdadm
ii mdadm 3.2.5-1ubuntu0.2 tool to administer Linux MD arrays (software RAID)
root@yow-lpgnfs-02:/home/paul# mdadm --detail --scan
ARRAY /dev/md0 metadata=0.90 UUID=48165815:e3a4f8ba:63476e95:1b06b14d
root@yow-lpgnfs-02:/home/paul# which mdadm
/sbin/mdadm
root@yow-lpgnfs-02:/home/paul# grep ^ARRAY /etc/mdadm/mdadm.conf
ARRAY /dev/md0 level=raid0 num-devices=2 devices=/dev/sda1,/dev/sdb1
root@yow-lpgnfs-02:/home/paul#
---------------

Steve Langasek (vorlon) on 2012-08-13
tags: added: verification-done
removed: verification-needed

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mdadm - 3.2.5-1ubuntu0.2

---------------
mdadm (3.2.5-1ubuntu0.2) precise-proposed; urgency=low

  * Patch udev-md-raid.rules to not auto-start arrays based on detection
    of ddf or isw (imsm) signatures; this conflicts with dmraid usage in
    precise and requires more analysis before it can be enabled in SRU.
    LP: #1030292.

mdadm (3.2.5-1ubuntu0.1) precise-proposed; urgency=low

  * Stable Micro Point Bug Fix release:
    - SRU master bug (LP: #1009973)
    - Fixes segfault upon update-initramfs (LP: #969384)
    - Fixes does not allow internal bitmap on version 1.2 arrays (LP: #1022915)
  * Preserved previous behaviour, by reverting:
    - bitmap chunk size of 0 will continue to mean 512B
    - Modify the below fix, to accept previous syntax
      "b10c663 config: fix handing of 'homehost' in AUTO line."
  * Use upstream version of udev rules, instead of three slightly
    different ubuntu udev rules (LP: #968074) (LP: #1002357)
  * Add missing mdmon utility. This enables external metadata RAID
    formats: DDF and Intel Matrix Storage Management (IMSM). (LP: #957494)
  * Copy udev rule from /etc/udev/rules.d/ as well as the
    /lib/udev/rules.d/, to allow local administrator to override mdadm
    rules file (LP: #1017407)
  * debian/initramfs/local-premount: add call wait_for_udev to wait a
    little longer for RAID devices to appear. This improves
    boot reliability. (LP: #942106)

mdadm (3.2.5-1) unstable; urgency=low

  [ Michael Tokarev ]
  * new upstream (bugfix) release, fixing regression when --add'ing
    device to an array, introduced in 3.2.4, plus other minor fixes
    (Closes: #673104, #673344)
  * new patch: sha1-includes.diff to fix #include mess in new sha1.h
  * added a check into debian/checkarray to skip checking arrays created
    less than 2 weeks ago (Closes: #624273)

  [ Dmitrijs Ledkovs ]
  * Remove obsolete documentation dating back to ~etch release
  * Remove reference to obsolete documention from debconf templates
  * Update debconf templates translations
  * Remove compatability with acient initramfs-tools
  * Remove debian-specific mdadm-startall.8 in clean target

mdadm (3.2.4-1) unstable; urgency=low

  * new upstream (bugfix) release (Closes: #664088, #661552)
  * removed debian-run-udev.diff (applied upstream), and
    all RUNDIR handling from debian/rules (it is the default now)
  * add build-arch and build-indep targets to debian/rules, and
    bump Standards-Version to 3.9.3

mdadm (3.2.3-3) unstable; urgency=low

  * switch from topgit to plain 3.0 (quilt) layout, creating
    debian/patches. Don't build-depend on quilt as patching
    is done automatically by dpkg-source.
  * debian/patches/debian-run-udev.diff by Roger Leigh (Closes: #644319, #627774)
  * update debian/mdadm.logcheck.ignore.server to recognize "k" in
    addition of "blocks" in kernel messages. Thanks to Frédéric Brière
    for the patch (Closes: #656038)
 -- Steve Langasek <email address hidden> Fri, 03 Aug 2012 23:08:39 -0700

Changed in mdadm (Ubuntu Precise):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers