[Bug 1811228] Re: Mdadm allows to change the name of the volume to empty and not trim whitespaces.

Christian Ehrhardt  1811228 at bugs.launchpad.net
Wed Apr 10 14:43:49 UTC 2019


Hi,
I need your help in testing this.
I have created a PPA [1] with the fixes for this issue, but I lack a IMSM HW.

I'd ask the people affected/subscribed to test the PPA.
While doing so please
a) ensure the test steps you have trigger the bug without the PPA
b) ensure the PPA fixes the issue

Test steps on this bug seemed already good to me, but if you have issues
using those to confirm it please let me know that we can fix the
Description.

[1]: https://launchpad.net/~paelzer/+archive/ubuntu/bug-1811228-1811795
-mdadm-imsm

** Description changed:

+ [Impact]
+ 
+  * Due to a lack of input checking mdadm could program the IMSM
+    with empty "" names for the storage devices causing issues
+    later on.
+ 
+  * Fix by backporting a fix that was committed shortly after what made 
+    it into Bionic/Disco
+ 
+ [Test Case]
+ 
+  * This needs a Intel(R) Matrix Storage Hardware which limits the 
+    systems this can be tested. Below in the original report is example 
+    output of these commands.
+    $ mdadm --create /dev/md/imsm0 --metadata=imsm --raid-devices=2 /dev/nvme11n1 /dev/nvme12n1 --run
+    $ mdadm --create /dev/md/r0d2 --level=0 --chunk=128 --raid-devices=2 /dev/nvme11n1 /dev/nvme12n1 --run
+    $ mdadm -D /dev/md/imsm0
+    $ mdadm --stop /dev/md/r0d2
+    $ mdadm --update-subarray=0 --update=name -N "" /dev/md/imsm0
+    # the command above should not be allowed, empty of non-trimmed names cause issues down the road.
+    $ mdadm --assemble --scan
+    $ mdadm -D /dev/md/imsm0
+ 
+ [Regression Potential]
+ 
+  * The fixes are local to the support of the Intel(R) Matrix Storage 
+    Manager through mdadm. As much as that makes testing harder it also 
+    limits the fallout of regressions to other components.
+    The one regression I could think of is automation/scripts that 
+    expects to work with whitespaces, but since that is known to
+    fail it is better to force them off of that.
+ 
+ [Other Info]
+  
+  * n/a
+ 
+ ---
+ 
  Description:
  Mdadm allows to change the name of the volume to any, including empty, too short and too long.
  White spaces in the begin or end of the correct name are not trimmed properly.
  
  Steps to reproduce:
  1.	Create the volume:
  # mdadm --create /dev/md/imsm0 --metadata=imsm --raid-devices=2 /dev/nvme11n1 /dev/nvme12n1 --run
  # mdadm --create /dev/md/r0d2 --level=0 --chunk=128 --raid-devices=2 /dev/nvme11n1 /dev/nvme12n1 --run
  
  2.	Check if volume name is correct:
  # mdadm -D /dev/md/imsm0
  /dev/md/imsm0:
-            Version : imsm
-         Raid Level : container
-      Total Devices : 2
+            Version : imsm
+         Raid Level : container
+      Total Devices : 2
  
-    Working Devices : 2
+    Working Devices : 2
  
+               UUID : 6dce006b:086ce0fa:bdcf4f9e:d8bd68c4
+      Member Arrays : /dev/md/r0d2
  
-               UUID : 6dce006b:086ce0fa:bdcf4f9e:d8bd68c4
-      Member Arrays : /dev/md/r0d2
+     Number   Major   Minor   RaidDevice
  
-     Number   Major   Minor   RaidDevice
- 
-        -     259       13        -        /dev/nvme12n1
-        -     259       12        -        /dev/nvme11n1
+        -     259       13        -        /dev/nvme12n1
+        -     259       12        -        /dev/nvme11n1
  root at gklab-94-128:~# mdadm -D /dev/md/r0d2
  /dev/md/r0d2:
-          Container : /dev/md/imsm0, member 0
-         Raid Level : raid0
-         Array Size : 781412352 (745.21 GiB 800.17 GB)
-       Raid Devices : 2
-      Total Devices : 2
+          Container : /dev/md/imsm0, member 0
+         Raid Level : raid0
+         Array Size : 781412352 (745.21 GiB 800.17 GB)
+       Raid Devices : 2
+      Total Devices : 2
  
-              State : clean
-     Active Devices : 2
-    Working Devices : 2
-     Failed Devices : 0
-      Spare Devices : 0
+              State : clean
+     Active Devices : 2
+    Working Devices : 2
+     Failed Devices : 0
+      Spare Devices : 0
  
-         Chunk Size : 128K
+         Chunk Size : 128K
  
  Consistency Policy : none
  
- 
-               UUID : 9608dbcd:e4668ab4:015e7469:a263e5e0
-     Number   Major   Minor   RaidDevice State
-        0     259       12        0      active sync   /dev/nvme11n1
-        1     259       13        1      active sync   /dev/nvme12n1
+               UUID : 9608dbcd:e4668ab4:015e7469:a263e5e0
+     Number   Major   Minor   RaidDevice State
+        0     259       12        0      active sync   /dev/nvme11n1
+        1     259       13        1      active sync   /dev/nvme12n1
  
  3.	Stop the volume:
  # mdadm --stop /dev/md/r0d2
  
  4.	Try to change the name of the volume. New name should not be allowed by mdadm (ex. empty), or shuld start or end with whitespaces:
  # mdadm --update-subarray=0 --update=name -N "" /dev/md/imsm0
  
  5.	Assembly the volume:
  # mdadm --assemble --scan
  mdadm: Started /dev/md126 with 2 devices
  
  6.      Check the volume name.
  
  Expected result:
  Mdam should not allow to change name to incorrect. The volume with wrong name should not be assembled. If volume name is correct, eventual whitespaces should be trimmed.
  
  Current result:
  Mdadm allows to change the name of the volume to any and assemble the volume with wrong name.
  If name is correct and starts/ends with whitespace, it is not trimmed.
  
  # mdadm -D /dev/md/imsm0
  /dev/md/imsm0:
-            Version : imsm
-         Raid Level : container
-      Total Devices : 2
+            Version : imsm
+         Raid Level : container
+      Total Devices : 2
  
-    Working Devices : 2
+    Working Devices : 2
  
+               UUID : 6dce006b:086ce0fa:bdcf4f9e:d8bd68c4
+      Member Arrays : /dev/md126
  
-               UUID : 6dce006b:086ce0fa:bdcf4f9e:d8bd68c4
-      Member Arrays : /dev/md126
+     Number   Major   Minor   RaidDevice
  
-     Number   Major   Minor   RaidDevice
- 
-        -     259       13        -        /dev/nvme12n1
-        -     259       12        -        /dev/nvme11n1
+        -     259       13        -        /dev/nvme12n1
+        -     259       12        -        /dev/nvme11n1
  
  # mdadm -E /dev/nvme12n1
  /dev/nvme12n1:
-           Magic : Intel Raid ISM Cfg Sig.
-         Version : 1.0.00
-     Orig Family : 3292ee00
-          Family : 3292ee00
-      Generation : 00000003
-      Attributes : All supported
-            UUID : 6dce006b:086ce0fa:bdcf4f9e:d8bd68c4
-        Checksum : 88845429 correct
-     MPB Sectors : 1
-           Disks : 2
-    RAID Devices : 1
+           Magic : Intel Raid ISM Cfg Sig.
+         Version : 1.0.00
+     Orig Family : 3292ee00
+          Family : 3292ee00
+      Generation : 00000003
+      Attributes : All supported
+            UUID : 6dce006b:086ce0fa:bdcf4f9e:d8bd68c4
+        Checksum : 88845429 correct
+     MPB Sectors : 1
+           Disks : 2
+    RAID Devices : 1
  
-   Disk01 Serial : FT641000CH400BGN
-           State : active
-              Id : 00000000
-     Usable Size : 97676545 (372.61 GiB 400.08 GB)
+   Disk01 Serial : FT641000CH400BGN
+           State : active
+              Id : 00000000
+     Usable Size : 97676545 (372.61 GiB 400.08 GB)
  
  []:
-            UUID : f4d7bd6c:34479c57:2583d3f6:7247c93e
-      RAID Level : 0
-         Members : 2
-           Slots : [UU]
-     Failed disk : none
-       This Slot : 1
-     Sector Size : 4096
-      Array Size : 195353088 (745.21 GiB 800.17 GB)
-    Per Dev Size : 97676800 (372.61 GiB 400.08 GB)
-   Sector Offset : 0
-     Num Stripes : 3052392
-      Chunk Size : 128 KiB
-        Reserved : 0
-   Migrate State : idle
-       Map State : normal
-     Dirty State : clean
-      RWH Policy : off
+            UUID : f4d7bd6c:34479c57:2583d3f6:7247c93e
+      RAID Level : 0
+         Members : 2
+           Slots : [UU]
+     Failed disk : none
+       This Slot : 1
+     Sector Size : 4096
+      Array Size : 195353088 (745.21 GiB 800.17 GB)
+    Per Dev Size : 97676800 (372.61 GiB 400.08 GB)
+   Sector Offset : 0
+     Num Stripes : 3052392
+      Chunk Size : 128 KiB
+        Reserved : 0
+   Migrate State : idle
+       Map State : normal
+     Dirty State : clean
+      RWH Policy : off
  
-   Disk00 Serial : FT62040052400GGN
-           State : active
-              Id : 00000000
-     Usable Size : 97676545 (372.61 GiB 400.08 GB)
+   Disk00 Serial : FT62040052400GGN
+           State : active
+              Id : 00000000
+     Usable Size : 97676545 (372.61 GiB 400.08 GB)

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to debian-installer in Ubuntu.
https://bugs.launchpad.net/bugs/1811228

Title:
  Mdadm allows to change the name of the volume to empty and not trim
  whitespaces.

Status in debian-installer package in Ubuntu:
  Confirmed
Status in mdadm package in Ubuntu:
  Fix Released
Status in debian-installer source package in Bionic:
  New
Status in mdadm source package in Bionic:
  Incomplete
Status in debian-installer source package in Cosmic:
  New
Status in mdadm source package in Cosmic:
  Incomplete

Bug description:
  [Impact]

   * Due to a lack of input checking mdadm could program the IMSM
     with empty "" names for the storage devices causing issues
     later on.

   * Fix by backporting a fix that was committed shortly after what made 
     it into Bionic/Disco

  [Test Case]

   * This needs a Intel(R) Matrix Storage Hardware which limits the 
     systems this can be tested. Below in the original report is example 
     output of these commands.
     $ mdadm --create /dev/md/imsm0 --metadata=imsm --raid-devices=2 /dev/nvme11n1 /dev/nvme12n1 --run
     $ mdadm --create /dev/md/r0d2 --level=0 --chunk=128 --raid-devices=2 /dev/nvme11n1 /dev/nvme12n1 --run
     $ mdadm -D /dev/md/imsm0
     $ mdadm --stop /dev/md/r0d2
     $ mdadm --update-subarray=0 --update=name -N "" /dev/md/imsm0
     # the command above should not be allowed, empty of non-trimmed names cause issues down the road.
     $ mdadm --assemble --scan
     $ mdadm -D /dev/md/imsm0

  [Regression Potential]

   * The fixes are local to the support of the Intel(R) Matrix Storage 
     Manager through mdadm. As much as that makes testing harder it also 
     limits the fallout of regressions to other components.
     The one regression I could think of is automation/scripts that 
     expects to work with whitespaces, but since that is known to
     fail it is better to force them off of that.

  [Other Info]
   
   * n/a

  ---

  Description:
  Mdadm allows to change the name of the volume to any, including empty, too short and too long.
  White spaces in the begin or end of the correct name are not trimmed properly.

  Steps to reproduce:
  1.	Create the volume:
  # mdadm --create /dev/md/imsm0 --metadata=imsm --raid-devices=2 /dev/nvme11n1 /dev/nvme12n1 --run
  # mdadm --create /dev/md/r0d2 --level=0 --chunk=128 --raid-devices=2 /dev/nvme11n1 /dev/nvme12n1 --run

  2.	Check if volume name is correct:
  # mdadm -D /dev/md/imsm0
  /dev/md/imsm0:
             Version : imsm
          Raid Level : container
       Total Devices : 2

     Working Devices : 2

                UUID : 6dce006b:086ce0fa:bdcf4f9e:d8bd68c4
       Member Arrays : /dev/md/r0d2

      Number   Major   Minor   RaidDevice

         -     259       13        -        /dev/nvme12n1
         -     259       12        -        /dev/nvme11n1
  root at gklab-94-128:~# mdadm -D /dev/md/r0d2
  /dev/md/r0d2:
           Container : /dev/md/imsm0, member 0
          Raid Level : raid0
          Array Size : 781412352 (745.21 GiB 800.17 GB)
        Raid Devices : 2
       Total Devices : 2

               State : clean
      Active Devices : 2
     Working Devices : 2
      Failed Devices : 0
       Spare Devices : 0

          Chunk Size : 128K

  Consistency Policy : none

                UUID : 9608dbcd:e4668ab4:015e7469:a263e5e0
      Number   Major   Minor   RaidDevice State
         0     259       12        0      active sync   /dev/nvme11n1
         1     259       13        1      active sync   /dev/nvme12n1

  3.	Stop the volume:
  # mdadm --stop /dev/md/r0d2

  4.	Try to change the name of the volume. New name should not be allowed by mdadm (ex. empty), or shuld start or end with whitespaces:
  # mdadm --update-subarray=0 --update=name -N "" /dev/md/imsm0

  5.	Assembly the volume:
  # mdadm --assemble --scan
  mdadm: Started /dev/md126 with 2 devices

  6.      Check the volume name.

  Expected result:
  Mdam should not allow to change name to incorrect. The volume with wrong name should not be assembled. If volume name is correct, eventual whitespaces should be trimmed.

  Current result:
  Mdadm allows to change the name of the volume to any and assemble the volume with wrong name.
  If name is correct and starts/ends with whitespace, it is not trimmed.

  # mdadm -D /dev/md/imsm0
  /dev/md/imsm0:
             Version : imsm
          Raid Level : container
       Total Devices : 2

     Working Devices : 2

                UUID : 6dce006b:086ce0fa:bdcf4f9e:d8bd68c4
       Member Arrays : /dev/md126

      Number   Major   Minor   RaidDevice

         -     259       13        -        /dev/nvme12n1
         -     259       12        -        /dev/nvme11n1

  # mdadm -E /dev/nvme12n1
  /dev/nvme12n1:
            Magic : Intel Raid ISM Cfg Sig.
          Version : 1.0.00
      Orig Family : 3292ee00
           Family : 3292ee00
       Generation : 00000003
       Attributes : All supported
             UUID : 6dce006b:086ce0fa:bdcf4f9e:d8bd68c4
         Checksum : 88845429 correct
      MPB Sectors : 1
            Disks : 2
     RAID Devices : 1

    Disk01 Serial : FT641000CH400BGN
            State : active
               Id : 00000000
      Usable Size : 97676545 (372.61 GiB 400.08 GB)

  []:
             UUID : f4d7bd6c:34479c57:2583d3f6:7247c93e
       RAID Level : 0
          Members : 2
            Slots : [UU]
      Failed disk : none
        This Slot : 1
      Sector Size : 4096
       Array Size : 195353088 (745.21 GiB 800.17 GB)
     Per Dev Size : 97676800 (372.61 GiB 400.08 GB)
    Sector Offset : 0
      Num Stripes : 3052392
       Chunk Size : 128 KiB
         Reserved : 0
    Migrate State : idle
        Map State : normal
      Dirty State : clean
       RWH Policy : off

    Disk00 Serial : FT62040052400GGN
            State : active
               Id : 00000000
      Usable Size : 97676545 (372.61 GiB 400.08 GB)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/debian-installer/+bug/1811228/+subscriptions



More information about the foundations-bugs mailing list