From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55716) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhYiU-0005z1-NK for qemu-devel@nongnu.org; Tue, 06 May 2014 02:19:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WhYiO-0003EP-OW for qemu-devel@nongnu.org; Tue, 06 May 2014 02:19:02 -0400 Received: from mail-qa0-x233.google.com ([2607:f8b0:400d:c00::233]:60945) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhYiO-0003EI-Ia for qemu-devel@nongnu.org; Tue, 06 May 2014 02:18:56 -0400 Received: by mail-qa0-f51.google.com with SMTP id w8so4717821qac.24 for ; Mon, 05 May 2014 23:18:56 -0700 (PDT) From: "Edgar E. Iglesias" Date: Tue, 6 May 2014 16:08:19 +1000 Message-Id: <1399356506-5609-16-git-send-email-edgar.iglesias@gmail.com> In-Reply-To: <1399356506-5609-1-git-send-email-edgar.iglesias@gmail.com> References: <1399356506-5609-1-git-send-email-edgar.iglesias@gmail.com> Subject: [Qemu-devel] [PATCH v1 15/22] target-arm: A64: Forbid ERET to increase the EL List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, peter.maydell@linaro.org Cc: rob.herring@linaro.org, peter.crosthwaite@xilinx.com, john.williams@xilinx.com, alex.bennee@linaro.org, agraf@suse.de From: "Edgar E. Iglesias" Signed-off-by: Edgar E. Iglesias --- target-arm/op_helper.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c index dd9e4fc..770c776 100644 --- a/target-arm/op_helper.c +++ b/target-arm/op_helper.c @@ -389,6 +389,7 @@ void HELPER(exception_return)(CPUARMState *env) unsigned int spsr_idx = arm64_banked_spsr_index(1); uint32_t spsr = env->banked_spsr[spsr_idx]; int new_el, i; + int cur_el = arm_current_pl(env); if (env->pstate & PSTATE_SP) { env->sp_el[1] = env->xregs[31]; @@ -410,6 +411,10 @@ void HELPER(exception_return)(CPUARMState *env) env->regs[15] = env->elr_el[ELR_EL_IDX(1)] & ~0x1; } else { new_el = extract32(spsr, 2, 2); + if (new_el > cur_el) { + /* Disallow returns to higher ELs than the current one. */ + goto illegal_return; + } if (new_el > 1) { /* Return to unimplemented EL */ goto illegal_return; -- 1.8.3.2