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
Ok, emulation it shall be then ...
Finalized test steps:
1. ms-libvirt --verbose sync --source http:// cloud-images. ubuntu. com/daily arch=s390x label=daily release=focal qemu-s390x- tcg</name> cfac1691- 2da7-49bb- bf09-c7f0cdefcf 85</uuid> ssh_known_ hosts xmlns:uvt="https:/ /launchpad. net/uvtool/ libvirt/ 1">ssh-rsa AAAAB3NzaC1yc2E AAAADAQABAAABgQ DYv7mW5g+ YoZH1w7v0BNTjfR A/IWM4xSKyH6zwl y4W0Zl6pq1XZzO/ HyoRDDVb9cXjzgg yrMAKTY9749uGwg 1X92OEEyJ5nOcuu hNcZJ2bgmWfvo+ EqzYS8WR271Iuz3 w+BQzpW6XQj7G/ tnQPlnmkboFyz0U WdPhlVaBuS6LQbn RHrPWe/ gc20NgOaRQf9Jq5 GmXO4YywYiXJpQg qu4vrEwr1d/ LQcd4oZMnErvLsC Z0pUlQK3WYHSk3F 2kWaBigJsJHS6zh kGUdAFlIEqSbjuN uhuyFMdRUyAvHnY 7whXOHKUsChnSin qescwfSjk2dHEOq xeIL1AyYxAzRtRd 6U4F14BhoG5gphK Frle5oIf6tVidjR eEHNCWfAaJPMSmR BhoaSRA4YKq/ 7T58dKp6Fvqlmce T21lJOzRWtSp7C1 xCxhomWNJFUBpup mL5WdPDfdvmqiUQ aKrRBymP+ yOp18TSEhqZrbvN UMsIOl8lkllnRly p2CiQXA5RvgshKI A0= root@localhost AAACBALdhwADEpI p/K23jFoXlLeSi6 bbGyXs+ wIiQgITaSrOBVnE A63kyckWXCn/ 0A8zXEWF11Y4uNi kZJL+49vJu412IF fVgzV8tHYnq7cVA T/WJMencfWkYFNn yqtn8w7jk3DoSXv hcjs/saiswWzKbx pMazPBGNuNbM32r LmaKY4LZAAAAFQC fHHCB16tMrLleWC r9+1AItKDTQwAAA IEAoyUeXONb8/ Tb+qMRN6/ qfHAGZAwxEhd1LM 8DKLhFsUxqFCpyh Zr7QXic/ RDt4Op3jMaLPht/ Un3+l5nW/ h4Vs0vSkC9Q8l0t /92DV67hT+ lKRJXdfE4OGgUMC 32jPhQ574JdOru+ 4wSJEXR4yCymP8B AkEr8l+ LE8aa8cqO5tuMAA ACAU8CQAsXsLKHm 01ES/HqWxwk8skx HsaJuCwxdIZMbFV zWO8TcjftJ21ymg 3t97PPeTiojTZrV gpIUemfP1spqlaw f+VeXUat6Q0Uh6D F7KvjRb6DNkfGlx zIvO9LBsJmvc3Vo hSQ9psf3JNfoQh/ NeGj6F3Yz8pi3Np OKpN+DRec= root@localhost oYTItbmlzdHAyNT YAAAAIbmlzdHAyN TYAAABBBGsr5+ bBmrFA4Qfv94Dj+ Qwm8GjR1WsWORBf ZP8QPO0HmL9uOEv tPn12W6zchY+ svA0u4136ZFp/ I2hZ6LXOCf0= root@localhost 1NTE5AAAAIMstvO +G5089bnuUbur+ pOz5RaDpx1IgtxO i3a510bSO root@localhost known_hosts> >524288< /memory> >524288< /currentMemory> 'static' >1</vcpu> 's390-ccw- virtio- focal'> hvm</type> 'forbid' >qemu</ model> destroy< /on_poweroff> restart< /on_reboot> destroy< /on_crash> /usr/bin/ qemu-system- s390x</ emulator> var/lib/ uvtool/ libvirt/ images/ qemu-s390x- tcg.qcow' /> var/lib/ uvtool/ libvirt/ images/ qemu-s390x- tcg-ds. qcow'/> serial' index='0'> '52:54: 00:a5:27: b9'/> qemu.guest_ agent.0' /> serial' controller='0' bus='0' port='1'/>
On x86 get an emulated s390x guest the way you prefer
Example with uvtool + modifications:
$ sudo apt install qemu-system-s390x
$ uvt-simplestrea
$ 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>
<uuid>
<metadata>
<uvt:
ssh-dss AAAAB3NzaC1kc3M
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXN
ssh-ed25519 AAAAC3NzaC1lZDI
</uvt:ssh_
</metadata>
<memory unit='KiB'
<currentMemory unit='KiB'
<vcpu placement=
<os>
<type arch='s390x' machine=
<boot dev='hd'/>
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback=
</cpu>
<clock offset='utc'/>
<on_poweroff>
<on_reboot>
<on_crash>
<devices>
<emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/
<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='/
<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-
<address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0003'/>
</controller>
<interface type='network'>
<mac address=
<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.
<address type='virtio-
</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 bash:0x$ (nm -D /usr/bin/bash | awk '/T readline$/ {print $1}')" > /sys/kernel/ debug/tracing/ uprobe_ events
Note you have to run those as root
# prereq
$ sudo apt update
$ apt install binutils
# define probe
$ bash
$ echo "r:bash_readline /usr/bin/
# check if the probe is active and enable it debug/tracing/ uprobe_ events bash_readline /usr/bin/ bash:0x00000000 000dd250 debug/tracing/ events/ uprobes/ bash_readline/ enable
$ cat /sys/kernel/
r:uprobes/
$ echo 1 >/sys/kernel/
# 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: debug/tracing/ events/ uprobes/ bash_readline/ enable" debug/tracing/ events/ uprobes/ bash_readline/ enable"
$ uvt-kvm ssh qemu-s390x-tcg "echo 0 | sudo tee /sys/kernel/
0
$ uvt-kvm ssh qemu-s390x-tcg "sudo cat /sys/kernel/
0
Then you can ssh-log in again and now it would work in good and bad case: qemu-s390x- tcg:~$ /usr/bin/bash -c 'echo $BASH_VERSION'
ubuntu@
5.0.17(1)-release