Comment 8 for bug 1929926

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Ok, emulation it shall be then ...
Finalized test steps:

1.
On x86 get an emulated s390x guest the way you prefer
Example with uvtool + modifications:
$ sudo apt install qemu-system-s390x
$ uvt-simplestreams-libvirt --verbose sync --source http://cloud-images.ubuntu.com/daily arch=s390x label=daily release=focal
$ uvt-kvm create --password=ubuntu qemu-s390x-tcg release=focal arch=s390x label=daily
$ virsh destroy qemu-s390x-tcg
That image will obviously fail to run in x86, so adapt the Guest XML to use tcg
Use something like:
<domain type='qemu'>
  <name>qemu-s390x-tcg</name>
  <uuid>cfac1691-2da7-49bb-bf09-c7f0cdefcf85</uuid>
  <metadata>
    <uvt:ssh_known_hosts xmlns:uvt="https://launchpad.net/uvtool/libvirt/1">ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDYv7mW5g+YoZH1w7v0BNTjfRA/IWM4xSKyH6zwly4W0Zl6pq1XZzO/HyoRDDVb9cXjzggyrMAKTY9749uGwg1X92OEEyJ5nOcuuhNcZJ2bgmWfvo+EqzYS8WR271Iuz3w+BQzpW6XQj7G/tnQPlnmkboFyz0UWdPhlVaBuS6LQbnRHrPWe/gc20NgOaRQf9Jq5GmXO4YywYiXJpQgqu4vrEwr1d/LQcd4oZMnErvLsCZ0pUlQK3WYHSk3F2kWaBigJsJHS6zhkGUdAFlIEqSbjuNuhuyFMdRUyAvHnY7whXOHKUsChnSinqescwfSjk2dHEOqxeIL1AyYxAzRtRd6U4F14BhoG5gphKFrle5oIf6tVidjReEHNCWfAaJPMSmRBhoaSRA4YKq/7T58dKp6FvqlmceT21lJOzRWtSp7C1xCxhomWNJFUBpupmL5WdPDfdvmqiUQaKrRBymP+yOp18TSEhqZrbvNUMsIOl8lkllnRlyp2CiQXA5RvgshKIA0= root@localhost
ssh-dss AAAAB3NzaC1kc3MAAACBALdhwADEpIp/K23jFoXlLeSi6bbGyXs+wIiQgITaSrOBVnEA63kyckWXCn/0A8zXEWF11Y4uNikZJL+49vJu412IFfVgzV8tHYnq7cVAT/WJMencfWkYFNnyqtn8w7jk3DoSXvhcjs/saiswWzKbxpMazPBGNuNbM32rLmaKY4LZAAAAFQCfHHCB16tMrLleWCr9+1AItKDTQwAAAIEAoyUeXONb8/Tb+qMRN6/qfHAGZAwxEhd1LM8DKLhFsUxqFCpyhZr7QXic/RDt4Op3jMaLPht/Un3+l5nW/h4Vs0vSkC9Q8l0t/92DV67hT+lKRJXdfE4OGgUMC32jPhQ574JdOru+4wSJEXR4yCymP8BAkEr8l+LE8aa8cqO5tuMAAACAU8CQAsXsLKHm01ES/HqWxwk8skxHsaJuCwxdIZMbFVzWO8TcjftJ21ymg3t97PPeTiojTZrVgpIUemfP1spqlawf+VeXUat6Q0Uh6DF7KvjRb6DNkfGlxzIvO9LBsJmvc3VohSQ9psf3JNfoQh/NeGj6F3Yz8pi3NpOKpN+DRec= root@localhost
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGsr5+bBmrFA4Qfv94Dj+Qwm8GjR1WsWORBfZP8QPO0HmL9uOEvtPn12W6zchY+svA0u4136ZFp/I2hZ6LXOCf0= root@localhost
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMstvO+G5089bnuUbur+pOz5RaDpx1IgtxOi3a510bSO root@localhost
</uvt:ssh_known_hosts>
  </metadata>
  <memory unit='KiB'>524288</memory>
  <currentMemory unit='KiB'>524288</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='s390x' machine='s390-ccw-virtio-focal'>hvm</type>
    <boot dev='hd'/>
  </os>
  <cpu mode='custom' match='exact' check='none'>
    <model fallback='forbid'>qemu</model>
  </cpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-s390x</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/uvtool/libvirt/images/qemu-s390x-tcg.qcow'/>
      <target dev='vda' bus='virtio'/>
      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/uvtool/libvirt/images/qemu-s390x-tcg-ds.qcow'/>
      <target dev='vdb' bus='virtio'/>
      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
    </disk>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='virtio-serial' index='0'>
      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0003'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:a5:27:b9'/>
      <source network='default'/>
      <model type='virtio'/>
      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0002'/>
    </interface>
    <console type='pty'>
      <target type='sclp' port='0'/>
    </console>
    <channel type='unix'>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <memballoon model='virtio'>
      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0004'/>
    </memballoon>
    <panic model='s390'/>
  </devices>
</domain>
$ virsh start --console qemu-s390x-tcg
# wait as in the emulator this will need a while.

2. In that guest prep the load
Note you have to run those as root
# prereq
$ sudo apt update
$ apt install binutils
# define probe
$ bash
$ echo "r:bash_readline /usr/bin/bash:0x$(nm -D /usr/bin/bash | awk '/T readline$/ {print $1}')" > /sys/kernel/debug/tracing/uprobe_events

# check if the probe is active and enable it
$ cat /sys/kernel/debug/tracing/uprobe_events
r:uprobes/bash_readline /usr/bin/bash:0x00000000000dd250
$ echo 1 >/sys/kernel/debug/tracing/events/uprobes/bash_readline/enable

# Start bash (or actually do anything in your ssh login which also is in bash)
to trigger some traces
$ /usr/bin/bash -c 'echo $BASH_VERSION'

Bad case:
bash will exit on most activities (anything that involves readline like typing a command)

Good case:
bash survives

Note: There are no log entries in Host qemu log or journal

To reset the test case you can disable tracing from the outside without triggering readline like:
$ uvt-kvm ssh qemu-s390x-tcg "echo 0 | sudo tee /sys/kernel/debug/tracing/events/uprobes/bash_readline/enable"
0
$ uvt-kvm ssh qemu-s390x-tcg "sudo cat /sys/kernel/debug/tracing/events/uprobes/bash_readline/enable"
0

Then you can ssh-log in again and now it would work in good and bad case:
ubuntu@qemu-s390x-tcg:~$ /usr/bin/bash -c 'echo $BASH_VERSION'
5.0.17(1)-release