[Qemu-devel] [PATCH] target-i386: fix "info lapic" segfault on isapc

Tejaswini posted 1 patch 7 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1490685583-16987-1-git-send-email-tejaswinipoluri3@gmail.com
Test checkpatch passed
Test docker passed
Test s390x passed
target/i386/helper.c | 4 ++++
1 file changed, 4 insertions(+)
[Qemu-devel] [PATCH] target-i386: fix "info lapic" segfault on isapc
Posted by Tejaswini 7 years ago
From: Tejaswini Poluri <tejaswinipoluri3@gmail.com>

Start QEMU with
"qemu-system-x86_64 -nographic -M isapc -serial none-monitor stdio"
and enter "info lapic" at the monitor prompt ⇒
Segmentation fault

Signed-off-by: Tejaswini Poluri <tejaswinipoluri3@gmail.com>
---
 target/i386/helper.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/i386/helper.c b/target/i386/helper.c
index e2af340..f11cac6 100644
--- a/target/i386/helper.c
+++ b/target/i386/helper.c
@@ -326,6 +326,10 @@ void x86_cpu_dump_local_apic_state(CPUState *cs, FILE *f,
 {
     X86CPU *cpu = X86_CPU(cs);
     APICCommonState *s = APIC_COMMON(cpu->apic_state);
+    if (!s) {
+        cpu_fprintf(f, "local apic state not available\n");
+        return;
+    }
     uint32_t *lvt = s->lvt;
 
     cpu_fprintf(f, "dumping local APIC state for CPU %-2u\n\n",
-- 
2.7.4


Re: [Qemu-devel] [PATCH] target-i386: fix "info lapic" segfault on isapc
Posted by Paolo Bonzini 7 years ago

On 28/03/2017 09:19, Tejaswini wrote:
> From: Tejaswini Poluri <tejaswinipoluri3@gmail.com>
> 
> Start QEMU with
> "qemu-system-x86_64 -nographic -M isapc -serial none-monitor stdio"
> and enter "info lapic" at the monitor prompt ⇒
> Segmentation fault
> 
> Signed-off-by: Tejaswini Poluri <tejaswinipoluri3@gmail.com>
> ---
>  target/i386/helper.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/target/i386/helper.c b/target/i386/helper.c
> index e2af340..f11cac6 100644
> --- a/target/i386/helper.c
> +++ b/target/i386/helper.c
> @@ -326,6 +326,10 @@ void x86_cpu_dump_local_apic_state(CPUState *cs, FILE *f,
>  {
>      X86CPU *cpu = X86_CPU(cs);
>      APICCommonState *s = APIC_COMMON(cpu->apic_state);
> +    if (!s) {
> +        cpu_fprintf(f, "local apic state not available\n");
> +        return;
> +    }
>      uint32_t *lvt = s->lvt;
>  
>      cpu_fprintf(f, "dumping local APIC state for CPU %-2u\n\n",
> 

Queued, thanks.

Paolo