Comment 2 for bug 2042366

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Synthetic reproducer on Jammy
===

Ubuntu Server cloud image:
---

SERIES=jammy

wget https://cloud-images.ubuntu.com/$SERIES/current/${SERIES}-server-cloudimg-amd64.img
qemu-img create -F qcow2 -b ${SERIES}-server-cloudimg-amd64.img -f qcow2 $SERIES.qcow2 8G

cloud-init image:
---

echo 'local-hostname: test' >meta-data

PUBKEY=$(cat $HOME/.ssh/id_rsa.pub)

cat <<EOF >user-data
#cloud-config
users:
  - name: ubuntu
    ssh-authorized-keys: ["$PUBKEY"]
    sudo: ['ALL=(ALL) NOPASSWD:ALL']
    groups: sudo
    shell: /bin/bash
runcmd:
   - echo 'AllowUsers ubuntu' >>/etc/ssh/sshd_config
   - restart ssh
EOF

genisoimage -output test-cidata.iso -volid cidata -joliet -rock user-data meta-data

QEMU VM:
---
- multipath disk on virtio-scsi:
- host forwarding for ssh login:

truncate -s 1G multipath.img

qemu-system-x86_64 \
  -machine q35 -accel kvm -cpu host -m 2048 \
  -nodefaults -no-user-config \
  -nographic -serial stdio \
  \
  -net nic -net user,hostfwd=::22222-:22 \
  \
  -drive file=$SERIES.qcow2 \
  -drive file=test-cidata.iso,media=cdrom \
  \
  -device virtio-scsi,id=scsi1 \
  \
  -drive file=multipath.img,if=none,cache=none,format=file,locking=off,id=path0 \
  -device scsi-hd,bus=scsi1.0,serial=helloworld,drive=path0 \
  \
  -drive file=multipath.img,if=none,cache=none,format=file,locking=off,id=path1 \
  -device scsi-hd,bus=scsi1.0,serial=helloworld,drive=path1

$ ssh ubuntu@127.0.0.1 -p 22222

$ sudo multipath -l
mpatha (0QEMU_QEMU_HARDDISK_helloworld) dm-0 QEMU,QEMU HARDDISK
size=1.0G features='0' hwhandler='0' wp=rw
|-+- policy='service-time 0' prio=0 status=active
| `- 0:0:0:0 sda 8:0 active undef running
`-+- policy='service-time 0' prio=0 status=enabled
  `- 0:0:1:0 sdb 8:16 active undef running

Latest version:
---

sudo add-apt-repository -yp proposed
sudo apt install -y multipath-tools/jammy-proposed

sudo systemctl restart multipathd.service

$ dpkg -s multipath-tools | grep Version:
Version: 0.8.8-1ubuntu1.22.04.3

Debug symbols
---

V1=$(dpkg-query -Wf '${Version}' multipath-tools)
V2=$(dpkg-query -Wf '${Version}' libdevmapper1.02.1 | cut -d: -f2-)

wget https://launchpad.net/ubuntu/+archive/primary/+files/multipath-tools-dbgsym_${V1}_amd64.ddeb
wget https://launchpad.net/ubuntu/+archive/primary/+files/libdevmapper1.02.1-dbgsym_${V2}_amd64.ddeb

sudo dpkg -i ./multipath-tools-dbgsym_${V1}_amd64.ddeb ./libdevmapper1.02.1-dbgsym_${V2}_amd64.ddeb

Debugger
---

sudo apt install -y gdb

sudo gdb -p $(pidof multipathd)

(gdb) b dm_get_map
Breakpoint 1 at ...
(gdb) c
Thread 6 "multipathd" hit Breakpoint 1, dm_get_map (name=0x558d02dc6880 "mpatha", ...

(gdb) b dm_get_next_target
Breakpoint 2 at ...
(gdb) c
Thread 6 "multipathd" hit Breakpoint 2, dm_get_next_target (...

(gdb) finish
Run till exit from #0 dm_get_next_target (...
Value returned is $1 = (void *) 0x0

(gdb) p params
$2 = 0x7f4e24004c60 "0 0 2 1 service-time 0 1 2 8:0 1 1 service-time 0 1 2 8:16 1 1 "

(gdb) set params = 0
(gdb) p params
$3 = 0x0

(gdb) disable breakpoints
(gdb) c

Thread 6 "multipathd" received signal SIGSEGV, Segmentation fault.
...

(gdb) q

$ sudo systemctl status multipathd.service | grep -e Active: -e Process:
     Active: failed (Result: signal) since Tue 2023-10-31 21:49:06 UTC; 5s ago
    Process: 2295 ExecStartPre=/sbin/modprobe -a scsi_dh_alua scsi_dh_emc scsi_dh_rdac dm-multipath (code=exited, status=0/SUCCESS)
    Process: 2296 ExecStart=/sbin/multipathd -d -s (code=killed, signal=SEGV)