qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Tejaswini <tejaswinipoluri3@gmail.com>
Cc: qemu-devel@nongnu.org, kwolf@redhat.com
Subject: 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
Date: Mon, 27 Mar 2017 11:57:51 +0100	[thread overview]
Message-ID: <20170327105751.GA26900@stefanha-x1.localdomain> (raw)
In-Reply-To: <1490609953-5076-1-git-send-email-tejaswinipoluri3@gmail.com>

[-- 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 --]

           reply	other threads:[~2017-03-27 10:58 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1490609953-5076-1-git-send-email-tejaswinipoluri3@gmail.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170327105751.GA26900@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=tejaswinipoluri3@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).