Comment 0 for bug 2026881

Revision history for this message
Arnaud Veron (arnaudveron) wrote :

Hi,

scsi3 pgr managed by mpathpersist command is broken in multipath-tools (0.8.8-1ubuntu1.22.04.1)

1) Release
----------

root@qau22c13n2:~# lsb_release -rd
Description: Ubuntu 22.04.2 LTS
Release: 22.04

2) Package version
------------------

root@qau22c13n2:~# apt-cache policy multipath-tools
multipath-tools:
  Installed: 0.8.8-1ubuntu1.22.04.1
  Candidate: 0.8.8-1ubuntu1.22.04.1
  Version table:
 *** 0.8.8-1ubuntu1.22.04.1 500
        500 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu jammy-security/main amd64 Packages
        100 /var/lib/dpkg/status
     0.8.8-1ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 Packages

3) What you expected to happen
------------------------------

Log from 20.04, which is not impacted by the issue

root@qau20c26n1:~# mpathpersist -i -k /dev/dm-18
  PR generation=0x4, 0 registered reservation key.
root@qau20c26n1:~# mpathpersist -v2 --out --register-ignore --param-sark=0x214872831999999 /dev/dm-18
Jul 11 17:10:27 | 36589cfc00000063203b03118b408db8c: pr message=map 36589cfc00000063203b03118b408db8c setprkey key 214872831999999
Jul 11 17:10:27 | 36589cfc00000063203b03118b408db8c: message=map 36589cfc00000063203b03118b408db8c setprkey key 214872831999999 reply=ok

Jul 11 17:10:27 | 36589cfc00000063203b03118b408db8c: pr message=map 36589cfc00000063203b03118b408db8c setprstatus
Jul 11 17:10:27 | 36589cfc00000063203b03118b408db8c: message=map 36589cfc00000063203b03118b408db8c setprstatus reply=ok

root@qau20c26n1:~# echo $?
0
root@qau20c26n1:~# mpathpersist -i -k /dev/dm-18
  PR generation=0x6, 2 registered reservation keys follow:
    0x214872831999999
    0x214872831999999

=> the key is correctly registered

4) What happened instead
------------------------

root@qau22c13n2:~# mpathpersist -i -k /dev/dm-14
  PR generation=0x3, 0 registered reservation key.
root@qau22c13n2:~# mpathpersist -v2 --out --register-ignore --param-sark=0x214872831593209 /dev/dm-14
8710.372441 | 36589cfc0000007507940a4aaf05aead6: adding new path sdv
8710.375149 | 36589cfc0000007507940a4aaf05aead6: adding new path sdac
8710.375236 | 36589cfc0000007507940a4aaf05aead6: pr message=map 36589cfc0000007507940a4aaf05aead6 setprkey key 214872831593209
8710.375393 | 36589cfc0000007507940a4aaf05aead6: message=map 36589cfc0000007507940a4aaf05aead6 setprkey key 214872831593209 reply=map 36589cfc0000007507940a4aaf05aead6 setprkey key 214872831593209: Missing argument
multipath-tools v0.8.8 (03/12, 2021)
CLI commands reference:
 list|show paths
 list|show paths format $format
 list|show paths raw format $format
 list|show path $path
 list|show maps|multipaths
 list|show status
 list|show daemon
 list|show maps|multipaths status
 list|show maps|multipaths stats
 list|show maps|multipaths format $format
 list|show maps|multipaths raw format $format
 list|show maps|multipaths topology
 list|show topology
 list|show maps|multipaths json
 list|show map|multipath $map topology
 list|show map|multipath $map format $format
 list|show map|multipath $map raw format $format
 list|show map|multipath $map json
 list|show config local
 list|show config
 list|show blacklist
 list|show devices
 list|show wildcards
 reset maps|multipaths stats
 reset map|multipath $map stats
 add path $path
 remove|del path $path
 add map|multipath $map
 remove|del map|multipath $map
 remove|del maps|multipaths
 switch|switchgroup map|multipath $map group $group
 reconfigure
 reconfigure all
 suspend map|multipath $map
 resume map|multipath $map
 resize map|multipath $map
 reload map|multipath $map
 reset map|multipath $map
 reinstate path $path
 fail path $path
 disablequeueing map|multipath $map
 restorequeueing map|multipath $map
 disablequeueing maps|multipaths
 restorequeueing maps|multipaths
 quit|exit
 shutdown
 getprstatus map|multipath $map
 setprstatus map|multipath $map
 unsetprstatus map|multipath $map
 forcequeueing daemon
 restorequeueing daemon
 getprkey map|multipath $map
 setprkey map|multipath $map key $key
 unsetprkey map|multipath $map
 setmarginal path $path
 unsetmarginal path $path
 unsetmarginal map|multipath $map

8710.375427 | 36589cfc0000007507940a4aaf05aead6: failed to set prkey for multipathd.
PR out: command failed
root@qau22c13n2:~# echo $?
13

root@qau22c13n2:~# mpathpersist -i -k /dev/dm-14
  PR generation=0x3, 0 registered reservation key.

=> the key is not registered

5) Root Cause
-------------

multipath-tools (0.8.8-1ubuntu1.22.04.1) introduced a regression from the patch below (from CVE-2022-41974)

https://github.com/opensvc/multipath-tools/commit/f812466f68b8e020818c6454d7b7a7e278bc99f6

commit f812466f68b8e020818c6454d7b7a7e278bc99f6
Author: Martin Wilck <email address hidden>
Date: Wed Aug 24 19:05:08 2022 +0200

    multipathd: more robust command parsing

Before this patch, multipathd command "map 36589cfc0000007507940a4aaf05aead6 setprkey key 214872831593209" was fine.
With this patch, it has to be "setprkey map 36589cfc0000007507940a4aaf05aead6 key 214872831593209"

It has been fixed upstream in the patch below:

https://github.com/opensvc/multipath-tools/commit/04912e2fea94da2e7ccedabab5725b07ade2bcd4

commit 04912e2fea94da2e7ccedabab5725b07ade2bcd4
Author: Benjamin Marzinski <email address hidden>
Date: Tue Nov 29 22:56:48 2022 -0600

    libmpathpersist: fix command keyword ordering

Thanks for your work.