* [Qemu-devel] [PATCH] exec.c: Use correct attrs in cpu_memory_rw_debug()
@ 2019-01-17 13:38 Peter Maydell
2019-01-17 14:28 ` Stefano Garzarella
2019-01-17 15:17 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 3+ messages in thread
From: Peter Maydell @ 2019-01-17 13:38 UTC (permalink / raw)
To: qemu-arm, qemu-devel; +Cc: patches
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 <peter.maydell@linaro.org>
---
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 += (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 -= l;
buf += l;
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] exec.c: Use correct attrs in cpu_memory_rw_debug()
2019-01-17 13:38 [Qemu-devel] [PATCH] exec.c: Use correct attrs in cpu_memory_rw_debug() Peter Maydell
@ 2019-01-17 14:28 ` Stefano Garzarella
2019-01-17 15:17 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Stefano Garzarella @ 2019-01-17 14:28 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-arm, qemu-devel, patches
On Thu, Jan 17, 2019 at 01:38:34PM +0000, Peter Maydell wrote:
> 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 <peter.maydell@linaro.org>
> ---
> exec.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] exec.c: Use correct attrs in cpu_memory_rw_debug()
2019-01-17 13:38 [Qemu-devel] [PATCH] exec.c: Use correct attrs in cpu_memory_rw_debug() Peter Maydell
2019-01-17 14:28 ` Stefano Garzarella
@ 2019-01-17 15:17 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-17 15:17 UTC (permalink / raw)
To: Peter Maydell, qemu-arm, qemu-devel; +Cc: patches
On 1/17/19 2:38 PM, Peter Maydell wrote:
> 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 <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> 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 += (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 -= l;
> buf += l;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-17 15:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-17 13:38 [Qemu-devel] [PATCH] exec.c: Use correct attrs in cpu_memory_rw_debug() Peter Maydell
2019-01-17 14:28 ` Stefano Garzarella
2019-01-17 15:17 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).