From patchwork Wed Jul 4 20:36:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev\" via" X-Patchwork-Id: 10507601 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9388E602BC for ; Wed, 4 Jul 2018 20:37:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 832E7288CE for ; Wed, 4 Jul 2018 20:37:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7734528992; Wed, 4 Jul 2018 20:37:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B0D56288CE for ; Wed, 4 Jul 2018 20:37:33 +0000 (UTC) Received: from localhost ([::1]:49177 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1faoWq-0006Pg-IU for patchwork-qemu-devel@patchwork.kernel.org; Wed, 04 Jul 2018 16:37:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1faoWF-00066a-0s for qemu-devel@nongnu.org; Wed, 04 Jul 2018 16:36:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1faoWB-0001Ca-SJ for qemu-devel@nongnu.org; Wed, 04 Jul 2018 16:36:55 -0400 Received: from smtp1.mail.ru ([94.100.179.111]:41454) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1faoWB-0001Bp-Gq for qemu-devel@nongnu.org; Wed, 04 Jul 2018 16:36:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Message-Id:Date:Subject:Cc:To:From; bh=6HfWsZU9LiQpPDnh9ETzyr8L1zpwP67bh1neMkiOVm8=; b=KpeUTOtJGKdatonV/yivIs4f7JwFibgzJXC9R0RktE7rBwJM7BIxLDAJxdJ8j2PULGXc/z5z9Pp7cQMDlRpQmHlytqcEUnH89Fz+bFbs++B16lVM76aBOg5aquhc3aAWdKEBTtynlK1pJLTvqY0zRhCxXIRpqW8gIPzrb2uitz8=; Received: by smtp1.mail.ru with esmtpa (envelope-from ) id 1faoW9-0004p2-3Q; Wed, 04 Jul 2018 23:36:49 +0300 To: qemu-devel@nongnu.org Date: Wed, 4 Jul 2018 23:36:39 +0300 Message-Id: <20180704203639.29553-1-jusual@mail.ru> X-Mailer: git-send-email 2.17.1 Authentication-Results: smtp1.mail.ru; auth=pass smtp.auth=jusual@mail.ru smtp.mailfrom=jusual@mail.ru X-7FA49CB5: 0D63561A33F958A546D730C94C3E195D7A1DB105B3199CC0C0440B95AB2430220A6AB1C7CE11FEE35EF3C447179F0106BA3038C0950A5D36B5C8C57E37DE458B4C7702A67D5C33162DBA43225CD8A89F0A35B161A8BF67C17BBEEA77B372C496DE4CAE6281C7766143847C11F186F3C5E7DDDDC251EA7DABCC89B49CDF41148F458B267F216095A92623479134186CDE6BA297DBC24807EABDAD6C7F3747799A X-Mailru-Sender: 7766D515518070DE138AAC7428EA760D24A01AE1771F46394D215BA1E7FAB48076CE0944C6A90CC17C4160E8B47E48163DDE9B364B0DF2898CB68AF7A628805D594FB4C9F0DBF412AE208404248635DF X-Mras: OK X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 94.100.179.111 Subject: [Qemu-devel] [PATCH] target/arm: Forbid unprivileged mode for M Baseline X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Julia Suvorova via Qemu-devel From: "Denis V. Lunev\" via" Reply-To: Julia Suvorova Cc: Peter Maydell , Jim Mussared , =?UTF-8?q?Steffen=20G=C3=B6rtz?= , Joel Stanley , Stefan Hajnoczi , Julia Suvorova Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP MSR handling is the only place where CONTROL.nPRIV is modified. Signed-off-by: Julia Suvorova --- target/arm/helper.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 5ee229eb35..83cca554ad 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -10781,8 +10781,10 @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val) !arm_v7m_is_handler_mode(env)) { write_v7m_control_spsel(env, (val & R_V7M_CONTROL_SPSEL_MASK) != 0); } - env->v7m.control[env->v7m.secure] &= ~R_V7M_CONTROL_NPRIV_MASK; - env->v7m.control[env->v7m.secure] |= val & R_V7M_CONTROL_NPRIV_MASK; + if (arm_feature(env, ARM_FEATURE_M_MAIN)) { + env->v7m.control[env->v7m.secure] &= ~R_V7M_CONTROL_NPRIV_MASK; + env->v7m.control[env->v7m.secure] |= val & R_V7M_CONTROL_NPRIV_MASK; + } break; default: bad_reg: