From nobody Sat Sep 28 22:37:05 2024 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 1548700110563253.90389980894952; Mon, 28 Jan 2019 10:28:30 -0800 (PST) Received: from localhost ([127.0.0.1]:36603 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goBdz-0008G6-H7 for importer@patchew.org; Mon, 28 Jan 2019 13:28:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goBN8-0002eY-Rb for qemu-devel@nongnu.org; Mon, 28 Jan 2019 13:11:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goBN7-0008MW-N9 for qemu-devel@nongnu.org; Mon, 28 Jan 2019 13:11:02 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:36631) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1goBN5-0008H2-Om for qemu-devel@nongnu.org; Mon, 28 Jan 2019 13:11:00 -0500 Received: by mail-wr1-x429.google.com with SMTP id u4so19163413wrp.3 for ; Mon, 28 Jan 2019 10:10:58 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id b18sm97910681wrw.83.2019.01.28.10.10.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Jan 2019 10:10:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=168FJ/UByMoqmKTqzxbvuPaUazSmh6HplX+UPK0CMJE=; b=T21C3PQI5GmJ71sQUU52I0ZIR/bNwOYnXyzk1q6NsUEf7IRxwIMK8KNfmSYf5dKN2d gtGZC8H0vcgkTefXswY7KIDmk0ql1QSCZqD+bnp316P98P1rGRtUeoNpp656VdMvri0E MjuaeIayzYgv1wdlrRLtlcvALroKj+QOr3HQg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=168FJ/UByMoqmKTqzxbvuPaUazSmh6HplX+UPK0CMJE=; b=X+jk26GfTNy7nPxdqaQ3jyHL/g+7bl5LhDQapdd6YoZm2IohBFMbtwR0UtCTOSFLYr yM+FwUSUd1/PRi4j6M6wdflRol8RccU5OStpg7S8gDGK+wjSlN2fWMvdk97zhT0el4mx kfUkTKaRAkcb2e74gV/9QSN2pqDhhn1Z7lTbHP9A/cgxz5ODOc0eNq5G7oK0g76ocfPa vlRpMk885/snkO/cVw33nUMdybSsdwxvsqN4L7S9PBC/C96ZcfEwAWG88aLRwmfFrNWL GratCT49xuHOHIOBoJ0klpvw2OudVByBE5yCcMpFJedMZ1wCGRl3B9EA7EsexeRVndm7 BAZw== X-Gm-Message-State: AJcUuke1T4nVzUf/79HFD1SxeEDbgIjmzTSJ6SfHRi8/vGUoFnPbVQqK EuyeCreeRGICbYuQVN6CWfoK9aBPWrIgSQ== X-Google-Smtp-Source: ALg8bN5GsmqbulUItRzVrvMHLdkdIYh0irRk3ZL0q4uVB1cPLQ8Yp9DSzYNGtlnbRF3AoRFoyxLVuw== X-Received: by 2002:adf:82a4:: with SMTP id 33mr21482734wrc.252.1548699057443; Mon, 28 Jan 2019 10:10:57 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 28 Jan 2019 18:10:27 +0000 Message-Id: <20190128181047.20781-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190128181047.20781-1-peter.maydell@linaro.org> References: <20190128181047.20781-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::429 Subject: [Qemu-devel] [PULL 06/26] 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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: Stefano Garzarella Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20190117133834.7480-1-peter.maydell@linaro.org --- exec.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/exec.c b/exec.c index 895449f9261..9557a4e523c 100644 --- a/exec.c +++ b/exec.c @@ -3882,12 +3882,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