From nobody Fri Nov 7 09:10:08 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547733397320613.0953334109953; Thu, 17 Jan 2019 05:56:37 -0800 (PST) Received: from localhost ([127.0.0.1]:45065 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gk89s-0003lH-CY for importer@patchew.org; Thu, 17 Jan 2019 08:56:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34059) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gk7sV-0006Jy-Nm for qemu-devel@nongnu.org; Thu, 17 Jan 2019 08:38:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gk7sU-00069r-2h for qemu-devel@nongnu.org; Thu, 17 Jan 2019 08:38:39 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:38416) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gk7sT-00067s-Pq for qemu-devel@nongnu.org; Thu, 17 Jan 2019 08:38:37 -0500 Received: by mail-wr1-x442.google.com with SMTP id v13so11057502wrw.5 for ; Thu, 17 Jan 2019 05:38:37 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id g197sm3700903wmd.29.2019.01.17.05.38.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Jan 2019 05:38:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6R9mI8GNZ6gdYJ2d85EWnNzi8WC2wx3DvoLVUg90EnQ=; b=kMCry3yeCFoOTW0Otz+kSZth9gHPJk0QxhACFN37gjq2m9MBKmm1dDm9CR7DLjzNpE I21aEOriIY1SDz9tUIwcFI6waXqQjOJtMnpPcsQAZN6x/L0BScp6e7bYobLzJWlsdg8W hgODgCqftagxkZH+kfThgIF5M2MOBJPObg7EA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6R9mI8GNZ6gdYJ2d85EWnNzi8WC2wx3DvoLVUg90EnQ=; b=Uu87QrgMNdmZ9vOnOG0CIR/z5GAevkjQnaV85Oloe8RqwMMvv7IljXuGxoTwxXQLmq irMJo6A4UOGyZIH/mgGCLfP9zhm5S1qjr5vjqJajJLFrTPZtc0T95XQeOHL79/1jqLSB 2rzpZtdVY9DNVVBXcG8Dve4SjZht0JAimIAerPIM5ZugPV/O58ePtsf1dXrVZ7TJU/DM Cz7CV3zM2BT/04e24+Iwh8vvxNbAusz0A2G3DilPcxetrjSRtYOMHMUyt9ZdcQyqrIRM fReIT0luRdok78ZxcWj8TleOtZpKQqbHxu9sv5PSINjAUxlge7nykzEDmZV3IVR31Xgp JlAQ== X-Gm-Message-State: AJcUukfHkZOrYEg/5Ek5ITN3q+q1nSdYG0JPYi6YpJ8KsacYjPgmMgIO V5qHPvfEIZ+mo2g+ASjBvlE6XQ== X-Google-Smtp-Source: ALg8bN7JOVcsiSNQjse8d8UpE5YFtZCriCqu6YNbTcb3uQTTHlmPNAsPKeMOTQ7I+qsg2yPtBQOSqg== X-Received: by 2002:adf:e34b:: with SMTP id n11mr11426272wrj.91.1547732316353; Thu, 17 Jan 2019 05:38:36 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Thu, 17 Jan 2019 13:38:34 +0000 Message-Id: <20190117133834.7480-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PATCH] exec.c: Use correct attrs in cpu_memory_rw_debug() 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: , Cc: patches@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" In the softmmu version of cpu_memory_rw_debug(), we ask the CPU for the attributes to use for the virtual memory access, and we correctly use those to identify the address space index. However, we were not passing them in to the address_space_write_rom() and address_space_rw() functions. The effect of this was that a memory access from the gdbstub to a device which had behaviour that was sensitive to the memory attributes (such as some ARMv8M NVIC registers) was incorrectly always performed as if non-secure, rather than using the right security state for the CPU's current state. Fixes: https://bugs.launchpad.net/qemu/+bug/1812091 Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefano Garzarella --- exec.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/exec.c b/exec.c index 6e875f0640a..2f0f40b0be6 100644 --- a/exec.c +++ b/exec.c @@ -3881,12 +3881,10 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong= addr, phys_addr +=3D (addr & ~TARGET_PAGE_MASK); if (is_write) { address_space_write_rom(cpu->cpu_ases[asidx].as, phys_addr, - MEMTXATTRS_UNSPECIFIED, - buf, l); + attrs, buf, l); } else { address_space_rw(cpu->cpu_ases[asidx].as, phys_addr, - MEMTXATTRS_UNSPECIFIED, - buf, l, 0); + attrs, buf, l, 0); } len -=3D l; buf +=3D l; --=20 2.20.1