diff mbox

[for,1.7] exec: fix breakpoint_invalidate when pc may not be translated

Message ID 1382921008-12575-1-git-send-email-jcmvbkbc@gmail.com
State New
Headers show

Commit Message

Max Filippov Oct. 28, 2013, 12:43 a.m. UTC
This fixes qemu abort with the following message:

    include/qemu/int128.h:22: int128_get64: Assertion `!a.hi' failed.

which happens due to attempt to invalidate breakpoint by virtual address
for which get_phys_page_debug couldn't find mapping.

For more details see
http://lists.nongnu.org/archive/html/qemu-devel/2013-09/msg04582.html

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 exec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Max Filippov Nov. 6, 2013, 6:23 p.m. UTC | #1
On Mon, Oct 28, 2013 at 4:43 AM, Max Filippov <jcmvbkbc@gmail.com> wrote:
> This fixes qemu abort with the following message:
>
>     include/qemu/int128.h:22: int128_get64: Assertion `!a.hi' failed.
>
> which happens due to attempt to invalidate breakpoint by virtual address
> for which get_phys_page_debug couldn't find mapping.
>
> For more details see
> http://lists.nongnu.org/archive/html/qemu-devel/2013-09/msg04582.html

Ping^2?

> Cc: qemu-stable@nongnu.org
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> ---
>  exec.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/exec.c b/exec.c
> index 2e31ffc..9150430 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -409,8 +409,10 @@ static void breakpoint_invalidate(CPUState *cpu, target_ulong pc)
>  #else
>  static void breakpoint_invalidate(CPUState *cpu, target_ulong pc)
>  {
> -    tb_invalidate_phys_addr(cpu_get_phys_page_debug(cpu, pc) |
> -            (pc & ~TARGET_PAGE_MASK));
> +    hwaddr phys = cpu_get_phys_page_debug(cpu, pc);
> +    if (phys != -1) {
> +        tb_invalidate_phys_addr(phys | (pc & ~TARGET_PAGE_MASK));
> +    }
>  }
>  #endif
>  #endif /* TARGET_HAS_ICE */
> --
> 1.8.1.4
>
Paolo Bonzini Nov. 7, 2013, 9:52 a.m. UTC | #2
Il 06/11/2013 19:23, Max Filippov ha scritto:
> On Mon, Oct 28, 2013 at 4:43 AM, Max Filippov <jcmvbkbc@gmail.com> wrote:
>> This fixes qemu abort with the following message:
>>
>>     include/qemu/int128.h:22: int128_get64: Assertion `!a.hi' failed.
>>
>> which happens due to attempt to invalidate breakpoint by virtual address
>> for which get_phys_page_debug couldn't find mapping.
>>
>> For more details see
>> http://lists.nongnu.org/archive/html/qemu-devel/2013-09/msg04582.html
> 
> Ping^2?

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

>> Cc: qemu-stable@nongnu.org
>> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
>> ---
>>  exec.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/exec.c b/exec.c
>> index 2e31ffc..9150430 100644
>> --- a/exec.c
>> +++ b/exec.c
>> @@ -409,8 +409,10 @@ static void breakpoint_invalidate(CPUState *cpu, target_ulong pc)
>>  #else
>>  static void breakpoint_invalidate(CPUState *cpu, target_ulong pc)
>>  {
>> -    tb_invalidate_phys_addr(cpu_get_phys_page_debug(cpu, pc) |
>> -            (pc & ~TARGET_PAGE_MASK));
>> +    hwaddr phys = cpu_get_phys_page_debug(cpu, pc);
>> +    if (phys != -1) {
>> +        tb_invalidate_phys_addr(phys | (pc & ~TARGET_PAGE_MASK));
>> +    }
>>  }
>>  #endif
>>  #endif /* TARGET_HAS_ICE */
>> --
>> 1.8.1.4
>>
> 
> 
>
diff mbox

Patch

diff --git a/exec.c b/exec.c
index 2e31ffc..9150430 100644
--- a/exec.c
+++ b/exec.c
@@ -409,8 +409,10 @@  static void breakpoint_invalidate(CPUState *cpu, target_ulong pc)
 #else
 static void breakpoint_invalidate(CPUState *cpu, target_ulong pc)
 {
-    tb_invalidate_phys_addr(cpu_get_phys_page_debug(cpu, pc) |
-            (pc & ~TARGET_PAGE_MASK));
+    hwaddr phys = cpu_get_phys_page_debug(cpu, pc);
+    if (phys != -1) {
+        tb_invalidate_phys_addr(phys | (pc & ~TARGET_PAGE_MASK));
+    }
 }
 #endif
 #endif /* TARGET_HAS_ICE */