diff mbox series

[for-9.2] accel/tcg: Fix user-only probe_access_internal plugin check

Message ID 20241111145002.144995-1-richard.henderson@linaro.org (mailing list archive)
State New
Headers show
Series [for-9.2] accel/tcg: Fix user-only probe_access_internal plugin check | expand

Commit Message

Richard Henderson Nov. 11, 2024, 2:50 p.m. UTC
The acc_flag check for write should have been against PAGE_WRITE_ORG,
not PAGE_WRITE.  But it is better to combine two acc_flag checks
to a single check against access_type.  This matches the system code
in cputlb.c.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2647
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 accel/tcg/user-exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alex Bennée Nov. 11, 2024, 3 p.m. UTC | #1
Richard Henderson <richard.henderson@linaro.org> writes:

> The acc_flag check for write should have been against PAGE_WRITE_ORG,
> not PAGE_WRITE.  But it is better to combine two acc_flag checks
> to a single check against access_type.  This matches the system code
> in cputlb.c.
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2647
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  accel/tcg/user-exec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
> index aa8af52cc3..06016eb030 100644
> --- a/accel/tcg/user-exec.c
> +++ b/accel/tcg/user-exec.c
> @@ -800,7 +800,7 @@ static int probe_access_internal(CPUArchState *env, vaddr addr,
>      if (guest_addr_valid_untagged(addr)) {
>          int page_flags = page_get_flags(addr);
>          if (page_flags & acc_flag) {
> -            if ((acc_flag == PAGE_READ || acc_flag == PAGE_WRITE)
> +            if (access_type != MMU_INST_FETCH
>                  && cpu_plugin_mem_cbs_enabled(env_cpu(env))) {
>                  return TLB_MMIO;
>              }

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
diff mbox series

Patch

diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
index aa8af52cc3..06016eb030 100644
--- a/accel/tcg/user-exec.c
+++ b/accel/tcg/user-exec.c
@@ -800,7 +800,7 @@  static int probe_access_internal(CPUArchState *env, vaddr addr,
     if (guest_addr_valid_untagged(addr)) {
         int page_flags = page_get_flags(addr);
         if (page_flags & acc_flag) {
-            if ((acc_flag == PAGE_READ || acc_flag == PAGE_WRITE)
+            if (access_type != MMU_INST_FETCH
                 && cpu_plugin_mem_cbs_enabled(env_cpu(env))) {
                 return TLB_MMIO;
             }