** Tags added: kernel-daily-bug -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. https://bugs.launchpad.net/bugs/1962831
Title: [UBUNTU 20.04] KVM: Enable storage key checking for intercepted instruction Status in Ubuntu on IBM z Systems: Fix Released Status in linux package in Ubuntu: Fix Released Status in linux source package in Focal: Fix Released Bug description: SRU Justification: ================== [Impact] * KVM uses lazy storage key enablement as Linux does no longer make use of the storage keys. When the guest enters keyed mode, then KVM will save/restore the key during paging, provide change/reference tracking for guest and host and for all interpreted instructions will do key protection. * If an instruction is intercepted and passed along to userspace (like QEMU) no storage key protection is checked, though. * But this is in violation of the architecture and it can result in misbehaving guests that rely on key protection for all instructions. * This item will improve the MEMOP ioctl to also add key checking. In case of a key protection the right fault is injected in the guest. [Fix] * The following changes since commit dbdbd581976f9dfcc9e21a777273b55bdb9bf138: UBUNTU: Ubuntu-5.4.0-102.115 (2022-02-23 15:32:05 +0100) are available in the Git repository at: https://git.launchpad.net/~fheimes/+git/lp1962831/ 16c0809cf1012e68279a8936a482c1d63cc4d14c for you to fetch changes up to 16c0809cf1012e68279a8936a482c1d63cc4d14c: KVM: s390: Add missing vm MEM_OP size check (2022-03-03 22:45:50 +0100) * Patches are upstream accepted (but some are as of today still in linux-next). * Notes on why the backports are needed are included in the provenance of the corresponding commit. [Test Case] * An IBM z13 or LinuxONE system is needed running Ubuntu Server 20.04 with QEMU/KVM setup. * These modification here are covered by the following three tests: * [kvm-unit-tests,v2] s390x: Test effect of storage keys on some instructions https://patchwork.kernel.org/project/kvm/patch/20220301095059.3026178-1-s...@linux.ibm.com/ * [PATCH v2 0/5] memop selftest for storage key checking https://lore.kernel.org/kvm/20220225155311.3540514-1-s...@linux.ibm.com/ * c7ef9ebbed20 "KVM: s390: selftests: Test TEST PROTECTION emulation" * The tests and the verification will be done by the IBM Z team. * On top a test build is available (see below). [Where problems could occur] * Issues with vm ioctl may occur due to the introduction of _vm_ioctl. * Tests may fail or may report wrong states due to the new TEST_FAIL macro in tests/utilities or due to new variants of GUEST_ASSERT in selftests. * Problems on gaccess might be caused due to the refactoring of gpa, length calculation, access address range check and the new access_guest_page helper function. * In uaccess issues may occur due to the introduction of the bit field for OAC specifier, that causes lot's but relatively straight forward changes or due to the new storage key checking functions copy_from/to_user_key functions. * Compile issues may happen if the changes in uaccess.h bout z10 features are erroneous. * Instructions that are emulated by KVM might be impacted due to the expanded storage key checking, that now covers intercepted instructions, too. This is the most significant modification in terms of size and complexity and therefore carries the highest risk. * MEM_OP IOCTL could be harmed due to the additional, but optional, storage key extension and checking, or the new size check and I/O emulation can be impacted due to the new vm IOCTL for key checked guest memory access. * Some tests were added to mitigate this, like the selftests TEST PROTECTION. * The renaming of the existing vcpu memop functions shouldn't be very harmful, since issues will already occur test build. * The rest are API documentation updates and clarifications. * Except two include/header changes and changes in tools/testing all other modifications are s390x specific [Other] * It was ensured that these changes are in jammy based on LP#1933179. __________ Description: KVM uses lazy storage key enablement as Linux does no longer make use of the storage keys. When the guest enters keyed mode, then KVM will save/restore the key during paging, provide change/reference tracking for guest and host and for all interpreted instructions will do key protection. If an instruction is intercepted and passed along to userspace (like QEMU) no storage key protection is checked, though. This is in violation of the architecture and it can result in misbehaving guests that rely on key protection for all instructions. This item will add the missing key checking to MEMOP ioctl. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu-z-systems/+bug/1962831/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp