{"id":817566,"url":"http://patchwork.ozlabs.org/api/patches/817566/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/1506092407-26985-8-git-send-email-peter.maydell@linaro.org/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1506092407-26985-8-git-send-email-peter.maydell@linaro.org>","list_archive_url":null,"date":"2017-09-22T14:59:54","name":"[07/20] target/arm: Warn about restoring to unaligned stack","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"84b64b0caef50a5975a0d768dc1e2c81c0cce0d1","submitter":{"id":5111,"url":"http://patchwork.ozlabs.org/api/people/5111/?format=json","name":"Peter Maydell","email":"peter.maydell@linaro.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/1506092407-26985-8-git-send-email-peter.maydell@linaro.org/mbox/","series":[{"id":4650,"url":"http://patchwork.ozlabs.org/api/series/4650/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=4650","date":"2017-09-22T14:59:47","name":"ARM v8M: exception entry, exit and security","version":1,"mbox":"http://patchwork.ozlabs.org/series/4650/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/817566/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/817566/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xzGyj2N3Rz9sNw\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 23 Sep 2017 01:06:21 +1000 (AEST)","from localhost ([::1]:59349 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dvPX1-0004YM-Bk\n\tfor incoming@patchwork.ozlabs.org; Fri, 22 Sep 2017 11:06:19 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:47049)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <pm215@archaic.org.uk>) id 1dvPQa-0007yg-Je\n\tfor qemu-devel@nongnu.org; Fri, 22 Sep 2017 10:59:41 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <pm215@archaic.org.uk>) id 1dvPQZ-00048J-Hv\n\tfor qemu-devel@nongnu.org; Fri, 22 Sep 2017 10:59:40 -0400","from orth.archaic.org.uk ([2001:8b0:1d0::2]:37556)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <pm215@archaic.org.uk>)\n\tid 1dvPQX-00043B-BF; Fri, 22 Sep 2017 10:59:37 -0400","from pm215 by orth.archaic.org.uk with local (Exim 4.89)\n\t(envelope-from <pm215@archaic.org.uk>)\n\tid 1dvPQU-0007AY-IF; Fri, 22 Sep 2017 15:59:34 +0100"],"From":"Peter Maydell <peter.maydell@linaro.org>","To":"qemu-arm@nongnu.org,\n\tqemu-devel@nongnu.org","Date":"Fri, 22 Sep 2017 15:59:54 +0100","Message-Id":"<1506092407-26985-8-git-send-email-peter.maydell@linaro.org>","X-Mailer":"git-send-email 2.7.4","In-Reply-To":"<1506092407-26985-1-git-send-email-peter.maydell@linaro.org>","References":"<1506092407-26985-1-git-send-email-peter.maydell@linaro.org>","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2001:8b0:1d0::2","Subject":"[Qemu-devel] [PATCH 07/20] target/arm: Warn about restoring to\n\tunaligned stack","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"patches@linaro.org","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"Attempting to do an exception return with an exception frame that\nis not 8-aligned is UNPREDICTABLE in v8M; warn about this.\n(It is not UNPREDICTABLE in v7M, and our implementation can\nhandle the merely-4-aligned case fine, so we don't need to\ndo anything except warn.)\n\nSigned-off-by: Peter Maydell <peter.maydell@linaro.org>\n---\n target/arm/helper.c | 7 +++++++\n 1 file changed, 7 insertions(+)","diff":"diff --git a/target/arm/helper.c b/target/arm/helper.c\nindex a2e46fb..979129e 100644\n--- a/target/arm/helper.c\n+++ b/target/arm/helper.c\n@@ -6403,6 +6403,13 @@ static void do_v7m_exception_exit(ARMCPU *cpu)\n                                               return_to_sp_process);\n         uint32_t frameptr = *frame_sp_p;\n \n+        if (!QEMU_IS_ALIGNED(frameptr, 8) &&\n+            arm_feature(env, ARM_FEATURE_V8)) {\n+            qemu_log_mask(LOG_GUEST_ERROR,\n+                          \"M profile exception return with non-8-aligned SP \"\n+                          \"for destination state is UNPREDICTABLE\\n\");\n+        }\n+\n         /* Pop registers. TODO: make these accesses use the correct\n          * attributes and address space (S/NS, priv/unpriv) and handle\n          * memory transaction failures.\n","prefixes":["07/20"]}