[PATCH v5 02/19] exec: Fix cpu_watchpoint_address_matches address length

Richard Henderson posted 19 patches 5 years, 7 months ago
Maintainers: Peter Maydell <peter.maydell@linaro.org>, Riku Voipio <riku.voipio@iki.fi>, Eduardo Habkost <ehabkost@redhat.com>, Richard Henderson <rth@twiddle.net>, Paolo Bonzini <pbonzini@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
[PATCH v5 02/19] exec: Fix cpu_watchpoint_address_matches address length
Posted by Richard Henderson 5 years, 7 months ago
The only caller of cpu_watchpoint_address_matches passes
TARGET_PAGE_SIZE, so the bug is not currently visible.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/exec.c b/exec.c
index 2874bb5088..5162f0d12f 100644
--- a/exec.c
+++ b/exec.c
@@ -1127,7 +1127,7 @@ int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len)
     int ret = 0;
 
     QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
-        if (watchpoint_address_matches(wp, addr, TARGET_PAGE_SIZE)) {
+        if (watchpoint_address_matches(wp, addr, len)) {
             ret |= wp->flags;
         }
     }
-- 
2.20.1


Re: [PATCH v5 02/19] exec: Fix cpu_watchpoint_address_matches address length
Posted by Philippe Mathieu-Daudé 5 years, 7 months ago
On 5/8/20 5:43 PM, Richard Henderson wrote:
> The only caller of cpu_watchpoint_address_matches passes
> TARGET_PAGE_SIZE, so the bug is not currently visible.
> 
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   exec.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/exec.c b/exec.c
> index 2874bb5088..5162f0d12f 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1127,7 +1127,7 @@ int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len)
>       int ret = 0;
>   
>       QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
> -        if (watchpoint_address_matches(wp, addr, TARGET_PAGE_SIZE)) {
> +        if (watchpoint_address_matches(wp, addr, len)) {
>               ret |= wp->flags;
>           }
>       }
> 

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>