] Bugfix: isapc:apic_state ?Start QEMU with "qemu-system-x86_64 -nographic -M isapc -serial none -monitor stdio" ?and enter "info lapic" at the monitor prompt ⇒ Segmentation fault
On Mon, Mar 27, 2017 at 03:49:13PM +0530, Tejaswini wrote:
Thanks for the patch!
Please CC the maintainers of target/i386/helper.c:
$ scripts/get_maintainer.pl -f target/i386/helper.c Paolo Bonzini <[email protected]> (maintainer:X86) Richard Henderson <[email protected]> (maintainer:X86) Eduardo Habkost <[email protected]> (maintainer:X86)
Please shorten the subject line:
[[RFC][Bugfix:isapc lapic state]] Bugfix: isapc:apic_state ?Start QEMU with "qemu-system-x86_64 -nographic -M isapc -serial none -monitor stdio" ?and enter "info lapic" at the monitor prompt ⇒ Segmentation fault
I suggest:
[PATCH] target-i386: fix "info lapic" segfault on isapc
The commit message (subject line) should be a short summary of the patch. Typically this is below 80 or even 72 characters. Details go in the commit description (email body before '---'), which can be arbitrarily long. Please move the command-line for reproducing the segmentation fault into the commit description.
Please don't add extra tags to the Subject line unless you're sure they are commonly used in QEMU (e.g. "[Bugfix:isapc lapic state]] Bugfix:
isapc:apic_state").
Quoted 5 lines
From: Tejaswini Poluri <[email protected]>
The error occurs for only isapc machine type as it doesn't have apic state The cpu->apic_state of isapc is NULL. Hence added null pointer check in x86_cpu_dump_local_apic_state()
Please remove the indentation.
Quoted 11 lines
Signed-off-by Tejaswini Poluri <[email protected]>--- target/i386/helper.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)target/i386/helper.c +0
-0
target/i386/helper.c void x86_cpu_dump_local_apic_state(CPUState *cs, FILE *f, · line 333
Quoted 8 lines
target/i386/helper.c +4
-1@@ -327,7 +327,10 @@ void x86_cpu_dump_local_apic_state(CPUState *cs, FILE *f,X86CPU *cpu =X86_CPU (cs);APICCommonState *s =APIC_COMMON (cpu->apic_state);uint32_t *lvt = s->lvt; - +if (!s) { +cpu_fprintf (f,"apic state not available\n" ); +return ; + }
Did you test this code?
The dereference one line above will still cause a segfault:
uint32_t *lvt = s->lvt; <--- s is NULL!