stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, James Hogan <james.hogan@imgtec.com>,
	Ralf Baechle <ralf@linux-mips.org>,
	Gleb Natapov <gleb@kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Sanjay Lal <sanjayl@kymasys.com>,
	linux-mips@linux-mips.org, kvm@vger.kernel.org
Subject: [PATCH 3.10 09/48] MIPS: KVM: Pass reserved instruction exceptions to guest
Date: Sun, 11 May 2014 21:19:43 +0200	[thread overview]
Message-ID: <20140511191949.401773094@linuxfoundation.org> (raw)
In-Reply-To: <20140511191948.079900414@linuxfoundation.org>

3.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: James Hogan <james.hogan@imgtec.com>

commit 15505679362270d02c449626385cb74af8905514 upstream.

Previously a reserved instruction exception while in guest code would
cause a KVM internal error if kvm_mips_handle_ri() didn't recognise the
instruction (including a RDHWR from an unrecognised hardware register).

However the guest OS should really have the opportunity to catch the
exception so that it can take the appropriate actions such as sending a
SIGILL to the guest user process or emulating the instruction itself.

Therefore in these cases emulate a guest RI exception and only return
EMULATE_FAIL if that fails, being careful to revert the PC first in case
the exception occurred in a branch delay slot in which case the PC will
already point to the branch target.

Also turn the printk messages relating to these cases into kvm_debug
messages so that they aren't usually visible.

This allows crashme to run in the guest without killing the entire VM.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sanjay Lal <sanjayl@kymasys.com>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/mips/kvm/kvm_mips_emul.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/arch/mips/kvm/kvm_mips_emul.c
+++ b/arch/mips/kvm/kvm_mips_emul.c
@@ -1571,17 +1571,17 @@ kvm_mips_handle_ri(unsigned long cause,
 			arch->gprs[rt] = kvm_read_c0_guest_userlocal(cop0);
 #else
 			/* UserLocal not implemented */
-			er = kvm_mips_emulate_ri_exc(cause, opc, run, vcpu);
+			er = EMULATE_FAIL;
 #endif
 			break;
 
 		default:
-			printk("RDHWR not supported\n");
+			kvm_debug("RDHWR %#x not supported @ %p\n", rd, opc);
 			er = EMULATE_FAIL;
 			break;
 		}
 	} else {
-		printk("Emulate RI not supported @ %p: %#x\n", opc, inst);
+		kvm_debug("Emulate RI not supported @ %p: %#x\n", opc, inst);
 		er = EMULATE_FAIL;
 	}
 
@@ -1590,6 +1590,7 @@ kvm_mips_handle_ri(unsigned long cause,
 	 */
 	if (er == EMULATE_FAIL) {
 		vcpu->arch.pc = curr_pc;
+		er = kvm_mips_emulate_ri_exc(cause, opc, run, vcpu);
 	}
 	return er;
 }



  parent reply	other threads:[~2014-05-11 19:19 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-11 19:19 [PATCH 3.10 00/48] 3.10.40-stable review Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 01/48] drivers/tty/hvc: dont free hvc_console_setup after init Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 02/48] tty: serial: 8250_core.c Bug fix for Exar chips Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 03/48] n_tty: Fix n_tty_write crash when echoing in raw mode Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 04/48] floppy: ignore kernel-only members in FDRAWCMD ioctl input Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 05/48] floppy: dont write kernel-only members to FDRAWCMD ioctl output Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 06/48] iser-target: Add missing se_cmd put for WRITE_PENDING in tx_comp_err Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 07/48] ARM: 7840/1: LPAE: dont reject mapping /dev/mem above 4GB Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 08/48] KVM: ioapic: fix assignment of ioapic->rtc_status.pending_eoi (CVE-2014-0155) Greg Kroah-Hartman
2014-05-11 19:19 ` Greg Kroah-Hartman [this message]
2014-05-11 19:19 ` [PATCH 3.10 10/48] MIPS: Hibernate: Flush TLB entries in swsusp_arch_resume() Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 11/48] virtio_balloon: dont softlockup on huge balloon changes Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 12/48] [SCSI] virtio-scsi: Skip setting affinity on uninitialized vq Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 13/48] [SCSI] mpt2sas: Dont disable device twice at suspend Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 14/48] powerpc/compat: 32-bit little endian machine name is ppcle, not ppc Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 15/48] powerpc/tm: Disable IRQ in tm_recheckpoint Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 16/48] s390/chsc: fix SEI usage on old FW levels Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 17/48] s390/bpf,jit: initialize A register if 1st insn is BPF_S_LDX_B_MSH Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 18/48] ARC: Entry Handler tweaks: Simplify branch for in-kernel preemption Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 19/48] ARC: Entry Handler tweaks: Optimize away redundant IRQ_DISABLE_SAVE Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 20/48] framebuffer: fix cfb_copyarea Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 21/48] matroxfb: restore the registers M_ACCESS and M_PITCH Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 22/48] mach64: use unaligned access Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 23/48] mach64: fix cursor when character width is not a multiple of 8 pixels Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 24/48] b43: Fix machine check error due to improper access of B43_MMIO_PSM_PHY_HDR Greg Kroah-Hartman
2014-05-11 19:19 ` [PATCH 3.10 25/48] libata/ahci: accommodate tag ordered controllers Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 26/48] iwlwifi: dvm: take mutex when sending SYNC BT config command Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 27/48] mac80211: fix WPA with VLAN on AP side with ps-sta again Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 28/48] mac80211: fix software remain-on-channel implementation Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 29/48] mac80211: exclude AP_VLAN interfaces from tx power calculation Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 30/48] locks: allow __break_lease to sleep even when break_time is 0 Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 31/48] rtlwifi: rtl8723ae: Fix too long disable of IRQs Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 32/48] rtlwifi: rtl8188ee: " Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 33/48] rtlwifi: rtl8192cu: " Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 34/48] rtlwifi: rtl8192se: " Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 35/48] rtlwifi: rtl8192se: Fix regression due to commit 1bf4bbb Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 36/48] rtlwifi: rtl8188ee: initialize packet_beacon Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 37/48] gpio: mxs: Allow for recursive enable_irq_wake() call Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 38/48] tgafb: fix data copying Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 39/48] mtd: atmel_nand: Disable subpage NAND write when using Atmel PMECC Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 40/48] mtd: nuc900_nand: NULL dereference in nuc900_nand_enable() Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 41/48] mtd: sm_ftl: heap corruption in sm_create_sysfs_attributes() Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 42/48] Skip intel_crt_init for Dell XPS 8700 Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 43/48] dm transaction manager: fix corruption due to non-atomic transaction commit Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 44/48] dm thin: fix dangling bio in process_deferred_bios error path Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 45/48] lockd: ensure we tear down any live sockets when socket creation fails during lockd_up Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 46/48] Input: synaptics - add min/max quirk for ThinkPad T431s, L440, L540, S1 Yoga and X1 Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 47/48] Input: synaptics - add min/max quirk for ThinkPad Edge E431 Greg Kroah-Hartman
2014-05-11 19:20 ` [PATCH 3.10 48/48] drm: cirrus: add power management support Greg Kroah-Hartman
2014-05-11 22:50 ` [PATCH 3.10 00/48] 3.10.40-stable review Guenter Roeck
2014-05-12 21:54 ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140511191949.401773094@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=gleb@kernel.org \
    --cc=james.hogan@imgtec.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=pbonzini@redhat.com \
    --cc=ralf@linux-mips.org \
    --cc=sanjayl@kymasys.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).