* Re: [Qemu-devel] [[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
[not found] <1490609953-5076-1-git-send-email-tejaswinipoluri3@gmail.com>
@ 2017-03-27 10:57 ` Stefan Hajnoczi
0 siblings, 0 replies; only message in thread
From: Stefan Hajnoczi @ 2017-03-27 10:57 UTC (permalink / raw)
To: Tejaswini; +Cc: qemu-devel, kwolf
[-- Attachment #1: Type: text/plain, Size: 2249 bytes --]
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 <pbonzini@redhat.com> (maintainer:X86)
Richard Henderson <rth@twiddle.net> (maintainer:X86)
Eduardo Habkost <ehabkost@redhat.com> (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").
> From: Tejaswini Poluri <tejaswinipoluri3@gmail.com>
>
> 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.
>
> Signed-off-by: Tejaswini Poluri <tejaswinipoluri3@gmail.com>
> ---
> target/i386/helper.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/target/i386/helper.c b/target/i386/helper.c
> index e2af340..1a8e3dd 100644
> --- a/target/i386/helper.c
> +++ b/target/i386/helper.c
> @@ -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!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-03-27 10:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1490609953-5076-1-git-send-email-tejaswinipoluri3@gmail.com>
2017-03-27 10:57 ` [Qemu-devel] [[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 Stefan Hajnoczi
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).