qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] exec.c: fix setting 1-byte-long watchpoints
@ 2014-09-18  5:03 Max Filippov
  2014-09-18 18:33 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Max Filippov @ 2014-09-18  5:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: Max Filippov, Peter Maydell, Richard Henderson

With commit 05068c0dfb5b 'exec.c: Relax restrictions on watchpoint length
and alignment' it's no longer possible to set 1-byte-long watchpoint
because of incorrect address range check.
Fix that by changing condition that checks for address wraparound.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/exec.c b/exec.c
index 2b24651..759055d 100644
--- a/exec.c
+++ b/exec.c
@@ -595,7 +595,7 @@ int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
     CPUWatchpoint *wp;
 
     /* forbid ranges which are empty or run off the end of the address space */
-    if (len == 0 || (addr + len - 1) <= addr) {
+    if (len == 0 || (addr + len - 1) < addr) {
         error_report("tried to set invalid watchpoint at %"
                      VADDR_PRIx ", len=%" VADDR_PRIu, addr, len);
         return -EINVAL;
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] exec.c: fix setting 1-byte-long watchpoints
  2014-09-18  5:03 [Qemu-devel] [PATCH] exec.c: fix setting 1-byte-long watchpoints Max Filippov
@ 2014-09-18 18:33 ` Peter Maydell
  2014-09-19 17:24   ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2014-09-18 18:33 UTC (permalink / raw)
  To: Max Filippov; +Cc: QEMU Developers, Richard Henderson

On 17 September 2014 22:03, Max Filippov <jcmvbkbc@gmail.com> wrote:
> With commit 05068c0dfb5b 'exec.c: Relax restrictions on watchpoint length
> and alignment' it's no longer possible to set 1-byte-long watchpoint
> because of incorrect address range check.
> Fix that by changing condition that checks for address wraparound.
>
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> ---
>  exec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/exec.c b/exec.c
> index 2b24651..759055d 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -595,7 +595,7 @@ int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
>      CPUWatchpoint *wp;
>
>      /* forbid ranges which are empty or run off the end of the address space */
> -    if (len == 0 || (addr + len - 1) <= addr) {
> +    if (len == 0 || (addr + len - 1) < addr) {
>          error_report("tried to set invalid watchpoint at %"
>                       VADDR_PRIx ", len=%" VADDR_PRIu, addr, len);
>          return -EINVAL;

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

and sorry for the breakage; I'll apply this to master in a bit.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] exec.c: fix setting 1-byte-long watchpoints
  2014-09-18 18:33 ` Peter Maydell
@ 2014-09-19 17:24   ` Peter Maydell
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2014-09-19 17:24 UTC (permalink / raw)
  To: Max Filippov; +Cc: QEMU Developers, Richard Henderson

On 18 September 2014 11:33, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 17 September 2014 22:03, Max Filippov <jcmvbkbc@gmail.com> wrote:
>> With commit 05068c0dfb5b 'exec.c: Relax restrictions on watchpoint length
>> and alignment' it's no longer possible to set 1-byte-long watchpoint
>> because of incorrect address range check.
>> Fix that by changing condition that checks for address wraparound.
>>
>> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
>> ---
>>  exec.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/exec.c b/exec.c
>> index 2b24651..759055d 100644
>> --- a/exec.c
>> +++ b/exec.c
>> @@ -595,7 +595,7 @@ int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
>>      CPUWatchpoint *wp;
>>
>>      /* forbid ranges which are empty or run off the end of the address space */
>> -    if (len == 0 || (addr + len - 1) <= addr) {
>> +    if (len == 0 || (addr + len - 1) < addr) {
>>          error_report("tried to set invalid watchpoint at %"
>>                       VADDR_PRIx ", len=%" VADDR_PRIu, addr, len);
>>          return -EINVAL;
>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>
> and sorry for the breakage; I'll apply this to master in a bit.

Applied to master; thanks.

-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-19 17:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-18  5:03 [Qemu-devel] [PATCH] exec.c: fix setting 1-byte-long watchpoints Max Filippov
2014-09-18 18:33 ` Peter Maydell
2014-09-19 17:24   ` Peter Maydell

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).