qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [Bug 1529859] [NEW] qemu 2.5.0 ivshmem segfault with msi=off option
@ 2015-12-29 13:38 maquefel
  2016-01-04 20:24 ` Eric Blake
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: maquefel @ 2015-12-29 13:38 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

Launching qemu with "-device ivshmem,chardev=ivshmemid,msi=off -chardev
socket,path=/tmp/ivshmem_socket,id=ivshmemid"

Causes segfault because, s->msi_vectors is not initialized and
s->msi_vectors == 0.

Does ivshmem exactly need this line ? :

s->msi_vectors[vector].pdev = pdev;

It makes no sence for me.

Subject: [PATCH] fixed ivshmem empty msi vector on msi=off segfault

---
 hw/misc/ivshmem.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index f73f0c2..2087d5e 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -359,8 +359,6 @@ static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier *
     int eventfd = event_notifier_get_fd(n);
     CharDriverState *chr;
 
-    s->msi_vectors[vector].pdev = pdev;
-
     chr = qemu_chr_open_eventfd(eventfd);
 
     if (chr == NULL) {
@@ -1038,10 +1036,11 @@ static void pci_ivshmem_exit(PCIDevice *dev)
     }
 
     if (ivshmem_has_feature(s, IVSHMEM_MSI)) {
-        msix_uninit_exclusive_bar(dev);
+        msix_uninit_exclusive_bar(dev);
     }
-
-    g_free(s->msi_vectors);
+    
+    if(s->msi_vectors)
+       g_free(s->msi_vectors);
 }
 
 static bool test_msix(void *opaque, int version_id)
-- 
2.3.6

** Affects: qemu
     Importance: Undecided
         Status: New


** Tags: ivshmem

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1529859

Title:
  qemu 2.5.0 ivshmem segfault with msi=off option

Status in QEMU:
  New

Bug description:
  Launching qemu with "-device ivshmem,chardev=ivshmemid,msi=off
  -chardev socket,path=/tmp/ivshmem_socket,id=ivshmemid"

  Causes segfault because, s->msi_vectors is not initialized and
  s->msi_vectors == 0.

  Does ivshmem exactly need this line ? :

  s->msi_vectors[vector].pdev = pdev;

  It makes no sence for me.

  Subject: [PATCH] fixed ivshmem empty msi vector on msi=off segfault

  ---
   hw/misc/ivshmem.c | 9 ++++-----
   1 file changed, 4 insertions(+), 5 deletions(-)

  diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
  index f73f0c2..2087d5e 100644
  --- a/hw/misc/ivshmem.c
  +++ b/hw/misc/ivshmem.c
  @@ -359,8 +359,6 @@ static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier *
       int eventfd = event_notifier_get_fd(n);
       CharDriverState *chr;
   
  -    s->msi_vectors[vector].pdev = pdev;
  -
       chr = qemu_chr_open_eventfd(eventfd);
   
       if (chr == NULL) {
  @@ -1038,10 +1036,11 @@ static void pci_ivshmem_exit(PCIDevice *dev)
       }
   
       if (ivshmem_has_feature(s, IVSHMEM_MSI)) {
  -        msix_uninit_exclusive_bar(dev);
  +        msix_uninit_exclusive_bar(dev);
       }
  -
  -    g_free(s->msi_vectors);
  +    
  +    if(s->msi_vectors)
  +       g_free(s->msi_vectors);
   }
   
   static bool test_msix(void *opaque, int version_id)
  -- 
  2.3.6

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1529859/+subscriptions

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [Bug 1529859] [NEW] qemu 2.5.0 ivshmem segfault with msi=off option
  2015-12-29 13:38 [Qemu-devel] [Bug 1529859] [NEW] qemu 2.5.0 ivshmem segfault with msi=off option maquefel
@ 2016-01-04 20:24 ` Eric Blake
  2016-01-04 21:46   ` Marc-André Lureau
  2016-01-05 10:02 ` [Qemu-devel] [Bug 1529859] " maquefel
  2016-06-23 19:18 ` T. Huth
  2 siblings, 1 reply; 5+ messages in thread
From: Eric Blake @ 2016-01-04 20:24 UTC (permalink / raw)
  To: Bug 1529859, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1817 bytes --]

On 12/29/2015 06:38 AM, maquefel wrote:
> Public bug reported:
> 
> Launching qemu with "-device ivshmem,chardev=ivshmemid,msi=off -chardev
> socket,path=/tmp/ivshmem_socket,id=ivshmemid"
> 
> Causes segfault because, s->msi_vectors is not initialized and
> s->msi_vectors == 0.
> 
> Does ivshmem exactly need this line ? :
> 
> s->msi_vectors[vector].pdev = pdev;
> 
> It makes no sence for me.
> 
> Subject: [PATCH] fixed ivshmem empty msi vector on msi=off segfault

Patches require a Signed-off-by: line before they can be applied.

> 
> ---
>  hw/misc/ivshmem.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
> index f73f0c2..2087d5e 100644
> --- a/hw/misc/ivshmem.c
> +++ b/hw/misc/ivshmem.c
> @@ -359,8 +359,6 @@ static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier *
>      int eventfd = event_notifier_get_fd(n);
>      CharDriverState *chr;
>  
> -    s->msi_vectors[vector].pdev = pdev;
> -

This avoids the segfault, but it may break other uses. Are you sure you
don't need an 'if (s->msi_vectors[vector])' conditional?

>      chr = qemu_chr_open_eventfd(eventfd);
>  
>      if (chr == NULL) {
> @@ -1038,10 +1036,11 @@ static void pci_ivshmem_exit(PCIDevice *dev)
>      }
>  
>      if (ivshmem_has_feature(s, IVSHMEM_MSI)) {
> -        msix_uninit_exclusive_bar(dev);
> +        msix_uninit_exclusive_bar(dev);

I can't see what's changing here.  Whitespace?

>      }
> -
> -    g_free(s->msi_vectors);
> +    
> +    if(s->msi_vectors)
> +       g_free(s->msi_vectors);

This hunk is bogus.  g_free(NULL) already works properly.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [Bug 1529859] [NEW] qemu 2.5.0 ivshmem segfault with msi=off option
  2016-01-04 20:24 ` Eric Blake
@ 2016-01-04 21:46   ` Marc-André Lureau
  0 siblings, 0 replies; 5+ messages in thread
From: Marc-André Lureau @ 2016-01-04 21:46 UTC (permalink / raw)
  To: Eric Blake; +Cc: Bug 1529859, QEMU

See previously posted patch:

http://lists.gnu.org/archive/html/qemu-stable/2015-12/msg00034.html

On Mon, Jan 4, 2016 at 9:24 PM, Eric Blake <eblake@redhat.com> wrote:
> On 12/29/2015 06:38 AM, maquefel wrote:
>> Public bug reported:
>>
>> Launching qemu with "-device ivshmem,chardev=ivshmemid,msi=off -chardev
>> socket,path=/tmp/ivshmem_socket,id=ivshmemid"
>>
>> Causes segfault because, s->msi_vectors is not initialized and
>> s->msi_vectors == 0.
>>
>> Does ivshmem exactly need this line ? :
>>
>> s->msi_vectors[vector].pdev = pdev;
>>
>> It makes no sence for me.
>>
>> Subject: [PATCH] fixed ivshmem empty msi vector on msi=off segfault
>
> Patches require a Signed-off-by: line before they can be applied.
>
>>
>> ---
>>  hw/misc/ivshmem.c | 9 ++++-----
>>  1 file changed, 4 insertions(+), 5 deletions(-)
>>
>> diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
>> index f73f0c2..2087d5e 100644
>> --- a/hw/misc/ivshmem.c
>> +++ b/hw/misc/ivshmem.c
>> @@ -359,8 +359,6 @@ static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier *
>>      int eventfd = event_notifier_get_fd(n);
>>      CharDriverState *chr;
>>
>> -    s->msi_vectors[vector].pdev = pdev;
>> -
>
> This avoids the segfault, but it may break other uses. Are you sure you
> don't need an 'if (s->msi_vectors[vector])' conditional?
>
>>      chr = qemu_chr_open_eventfd(eventfd);
>>
>>      if (chr == NULL) {
>> @@ -1038,10 +1036,11 @@ static void pci_ivshmem_exit(PCIDevice *dev)
>>      }
>>
>>      if (ivshmem_has_feature(s, IVSHMEM_MSI)) {
>> -        msix_uninit_exclusive_bar(dev);
>> +        msix_uninit_exclusive_bar(dev);
>
> I can't see what's changing here.  Whitespace?
>
>>      }
>> -
>> -    g_free(s->msi_vectors);
>> +
>> +    if(s->msi_vectors)
>> +       g_free(s->msi_vectors);
>
> This hunk is bogus.  g_free(NULL) already works properly.
>
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>



-- 
Marc-André Lureau

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [Bug 1529859] Re: qemu 2.5.0 ivshmem segfault with msi=off option
  2015-12-29 13:38 [Qemu-devel] [Bug 1529859] [NEW] qemu 2.5.0 ivshmem segfault with msi=off option maquefel
  2016-01-04 20:24 ` Eric Blake
@ 2016-01-05 10:02 ` maquefel
  2016-06-23 19:18 ` T. Huth
  2 siblings, 0 replies; 5+ messages in thread
From: maquefel @ 2016-01-05 10:02 UTC (permalink / raw)
  To: qemu-devel

>See previously posted patch:
> http://lists.gnu.org/archive/html/qemu-stable/2015-12/msg00034.html

This patch resolves issue. I can confirm it works.

** Changed in: qemu
       Status: New => Fix Committed

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1529859

Title:
  qemu 2.5.0 ivshmem segfault with msi=off option

Status in QEMU:
  Fix Committed

Bug description:
  Launching qemu with "-device ivshmem,chardev=ivshmemid,msi=off
  -chardev socket,path=/tmp/ivshmem_socket,id=ivshmemid"

  Causes segfault because, s->msi_vectors is not initialized and
  s->msi_vectors == 0.

  Does ivshmem exactly need this line ? :

  s->msi_vectors[vector].pdev = pdev;

  It makes no sence for me.

  Subject: [PATCH] fixed ivshmem empty msi vector on msi=off segfault

  ---
   hw/misc/ivshmem.c | 9 ++++-----
   1 file changed, 4 insertions(+), 5 deletions(-)

  diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
  index f73f0c2..2087d5e 100644
  --- a/hw/misc/ivshmem.c
  +++ b/hw/misc/ivshmem.c
  @@ -359,8 +359,6 @@ static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier *
       int eventfd = event_notifier_get_fd(n);
       CharDriverState *chr;
   
  -    s->msi_vectors[vector].pdev = pdev;
  -
       chr = qemu_chr_open_eventfd(eventfd);
   
       if (chr == NULL) {
  @@ -1038,10 +1036,11 @@ static void pci_ivshmem_exit(PCIDevice *dev)
       }
   
       if (ivshmem_has_feature(s, IVSHMEM_MSI)) {
  -        msix_uninit_exclusive_bar(dev);
  +        msix_uninit_exclusive_bar(dev);
       }
  -
  -    g_free(s->msi_vectors);
  +    
  +    if(s->msi_vectors)
  +       g_free(s->msi_vectors);
   }
   
   static bool test_msix(void *opaque, int version_id)
  -- 
  2.3.6

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1529859/+subscriptions

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [Bug 1529859] Re: qemu 2.5.0 ivshmem segfault with msi=off option
  2015-12-29 13:38 [Qemu-devel] [Bug 1529859] [NEW] qemu 2.5.0 ivshmem segfault with msi=off option maquefel
  2016-01-04 20:24 ` Eric Blake
  2016-01-05 10:02 ` [Qemu-devel] [Bug 1529859] " maquefel
@ 2016-06-23 19:18 ` T. Huth
  2 siblings, 0 replies; 5+ messages in thread
From: T. Huth @ 2016-06-23 19:18 UTC (permalink / raw)
  To: qemu-devel

Patch has been included here:
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=47213eb1104709bf23

** Changed in: qemu
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1529859

Title:
  qemu 2.5.0 ivshmem segfault with msi=off option

Status in QEMU:
  Fix Released

Bug description:
  Launching qemu with "-device ivshmem,chardev=ivshmemid,msi=off
  -chardev socket,path=/tmp/ivshmem_socket,id=ivshmemid"

  Causes segfault because, s->msi_vectors is not initialized and
  s->msi_vectors == 0.

  Does ivshmem exactly need this line ? :

  s->msi_vectors[vector].pdev = pdev;

  It makes no sence for me.

  Subject: [PATCH] fixed ivshmem empty msi vector on msi=off segfault

  ---
   hw/misc/ivshmem.c | 9 ++++-----
   1 file changed, 4 insertions(+), 5 deletions(-)

  diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
  index f73f0c2..2087d5e 100644
  --- a/hw/misc/ivshmem.c
  +++ b/hw/misc/ivshmem.c
  @@ -359,8 +359,6 @@ static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier *
       int eventfd = event_notifier_get_fd(n);
       CharDriverState *chr;
   
  -    s->msi_vectors[vector].pdev = pdev;
  -
       chr = qemu_chr_open_eventfd(eventfd);
   
       if (chr == NULL) {
  @@ -1038,10 +1036,11 @@ static void pci_ivshmem_exit(PCIDevice *dev)
       }
   
       if (ivshmem_has_feature(s, IVSHMEM_MSI)) {
  -        msix_uninit_exclusive_bar(dev);
  +        msix_uninit_exclusive_bar(dev);
       }
  -
  -    g_free(s->msi_vectors);
  +    
  +    if(s->msi_vectors)
  +       g_free(s->msi_vectors);
   }
   
   static bool test_msix(void *opaque, int version_id)
  -- 
  2.3.6

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1529859/+subscriptions

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-23 19:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-29 13:38 [Qemu-devel] [Bug 1529859] [NEW] qemu 2.5.0 ivshmem segfault with msi=off option maquefel
2016-01-04 20:24 ` Eric Blake
2016-01-04 21:46   ` Marc-André Lureau
2016-01-05 10:02 ` [Qemu-devel] [Bug 1529859] " maquefel
2016-06-23 19:18 ` T. Huth

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).