1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
graphic: 0.825
assembly: 0.818
socket: 0.802
instruction: 0.794
other: 0.789
semantic: 0.768
network: 0.753
boot: 0.743
device: 0.738
mistranslation: 0.657
KVM: 0.589
vnc: 0.553
qemu 2.5.0 ivshmem segfault with msi=off option
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
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
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 <email address hidden> 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
>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.
Patch has been included here:
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=47213eb1104709bf23
|