exec.c: fix setting 1-byte-long watchpoints
PATCH 1/1 exec.c: fix setting 1-byte-long watchpoints
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.
--- exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
exec.c +1 -1
@@ -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 ;
Signature · 1 line
1.8.1.4
Quoted 15 lines · Max Filippov
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 <[email protected]>--- exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)exec.c +0
-0
exec.c int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, · line 601
Quoted 8 lines
exec.c +1
-1@@ -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 ;
and sorry for the breakage; I'll apply this to master in a bit.
thanks
-- PMM
Peter Maydell
AppliedQuoted 27 lines · Peter Maydell
Quoted 15 lines · Max Filippov
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 <[email protected]>--- exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)exec.c +0
-0exec.c int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, · line 601
Quoted 8 lines
exec.c +1
-1@@ -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 <[email protected]>
Quoted 1 line
and sorry for the breakage; I'll apply this to master in a bit.
Applied to master; thanks.
-- PMM