Go to file
Michael Ellerman e4e8bc1df6 powerpc/kvm: Fix PR KVM with KUAP/MEM_KEYS enabled
The changes to add KUAP support with the hash MMU broke booting of KVM
PR guests. The symptom is no visible progress of the guest, or possibly
just "SLOF" being printed to the qemu console.

Host code is still executing, but breaking into xmon might show a stack
trace such as:

  __might_fault+0x84/0xe0 (unreliable)
  kvm_read_guest+0x1c8/0x2f0 [kvm]
  kvmppc_ld+0x1b8/0x2d0 [kvm]
  kvmppc_load_last_inst+0x50/0xa0 [kvm]
  kvmppc_exit_pr_progint+0x178/0x220 [kvm_pr]
  kvmppc_handle_exit_pr+0x31c/0xe30 [kvm_pr]
  after_sprg3_load+0x80/0x90 [kvm_pr]
  kvmppc_vcpu_run_pr+0x104/0x260 [kvm_pr]
  kvmppc_vcpu_run+0x34/0x48 [kvm]
  kvm_arch_vcpu_ioctl_run+0x340/0x450 [kvm]
  kvm_vcpu_ioctl+0x2ac/0x8c0 [kvm]
  sys_ioctl+0x320/0x1060
  system_call_exception+0x160/0x270
  system_call_common+0xf0/0x27c

Bisect points to commit b2ff33a10c ("powerpc/book3s64/hash/kuap:
Enable kuap on hash"), but that's just the commit that enabled KUAP with
hash and made the bug visible.

The root cause seems to be that KVM PR is creating kernel mappings that
don't use the correct key, since we switched to using key 3.

We have a helper for adding the right key value, however it's designed
to take a pteflags variable, which the KVM code doesn't have. But we can
make it work by passing 0 for the pteflags, and tell it explicitly that
it should use the kernel key.

With that changed guests boot successfully.

Fixes: d94b827e89 ("powerpc/book3s64/kuap: Use Key 3 for kernel mapping with hash translation")
Cc: stable@vger.kernel.org # v5.11+
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210419120139.1455937-1-mpe@ellerman.id.au
2021-04-20 14:22:24 +10:00
Documentation Documentation/powerpc: Add proper links for manual and tests 2021-04-20 14:22:23 +10:00
LICENSES LICENSES: Add the CC-BY-4.0 license 2020-12-08 10:33:27 -07:00
arch powerpc/kvm: Fix PR KVM with KUAP/MEM_KEYS enabled 2021-04-20 14:22:24 +10:00
block block: Discard page cache of zone reset target range 2021-03-11 11:49:25 -07:00
certs certs: Replace K{U,G}IDT_INIT() with GLOBAL_ROOT_{U,G}ID 2021-01-21 16:16:10 +00:00
crypto crypto: mips/poly1305 - enable for all MIPS processors 2021-03-08 11:52:17 +01:00
drivers macintosh/via-pmu: Fix build warning 2021-04-16 23:57:51 +10:00
fs Merge branch 'akpm' (patches from Andrew) 2021-03-14 12:23:34 -07:00
include signal: Add unsafe_get_compat_sigset() 2021-04-03 21:22:18 +11:00
init Merge branch 'akpm' (patches from Andrew) 2021-03-14 12:23:34 -07:00
ipc fs: make helpers idmap mount aware 2021-01-24 14:27:20 +01:00
kernel prctl: fix PR_SET_MM_AUXV kernel stack leak 2021-03-14 14:33:27 -07:00
lib lib/vdso: Add vdso_data pointer as input to __arch_get_timens_vdso_data() 2021-04-14 23:04:44 +10:00
mm Merge branch 'akpm' (patches from Andrew) 2021-03-14 12:23:34 -07:00
net NFS Client Bugfixes for Linux 5.10-rc3 2021-03-12 14:19:35 -08:00
samples Merge git://git.kernel.org:/pub/scm/linux/kernel/git/netdev/net 2021-03-09 17:15:56 -08:00
scripts kbuild: fix ld-version.sh to not be affected by locale 2021-03-13 11:12:13 +09:00
security Revert 95ebabde38 ("capabilities: Don't allow writing ambiguous v3 file capabilities") 2021-03-12 15:27:14 -06:00
sound ALSA: hda/hdmi: Cancel pending works before suspend 2021-03-10 12:52:01 +01:00
tools selftests/powerpc: Suggest memtrace instead of /dev/mem for ci memory 2021-04-08 21:17:44 +10:00
usr Kbuild updates for v5.12 2021-02-25 10:17:31 -08:00
virt KVM: x86/mmu: Consider the hva in mmu_notifier retry 2021-02-22 13:16:53 -05:00
.clang-format cxl for 5.12 2021-02-24 09:38:36 -08:00
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore clang-lto series for v5.12-rc1 2021-02-23 09:28:51 -08:00
.mailmap treewide: Miguel has moved 2021-02-26 09:41:03 -08:00
COPYING
CREDITS treewide: Miguel has moved 2021-02-26 09:41:03 -08:00
Kbuild
Kconfig kbuild: ensure full rebuild when the compiler is updated 2020-05-12 13:28:33 +09:00
MAINTAINERS Merge branch 'akpm' (patches from Andrew) 2021-03-14 12:23:34 -07:00
Makefile Linux 5.12-rc3 2021-03-14 14:41:02 -07:00
README

README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.