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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
|
QEMU: use after free vulnerability in esp_do_dma() in hw/scsi/esp.c
A use-after-free vulnerability was found in the am53c974 SCSI host bus adapter emulation of QEMU. It could occur in the esp_do_dma() function in hw/scsi/esp.c while handling the 'Information Transfer' command (CMD_TI). A privileged guest user may abuse this flaw to crash the QEMU process on the host, resulting in a denial of service or potential code execution with the privileges of the QEMU process.
This issue was reported by Cheolwoo Myung (Seoul National University).
Original report:
Using hypervisor fuzzer, hyfuzz, I found a use-after-free issue in
am53c974 emulator of QEMU enabled ASan.
It occurs while transferring information, as it does not check the
buffer to be transferred.
A malicious guest user/process could use this flaw to crash the QEMU
process resulting in DoS scenario.
To reproduce this issue, please run the QEMU with the following command
line.
# To enable ASan option, please set configuration with the following
$ ./configure --target-list=i386-softmmu --disable-werror --enable-sanitizers
$ make
# To reproduce this issue, please run the QEMU process with the following command line
$ ./qemu-system-i386 -m 512 -drive file=./hyfuzz.img,index=0,media=disk,format=raw \
-device am53c974,id=scsi -device scsi-hd,drive=SysDisk \
-drive id=SysDisk,if=none,file=./disk.img
Please find attached the disk images to reproduce this issue.
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1909996
Looks the same, or very similar to this one:
/*
* Autogenerated Fuzzer Test Case
*
* This work is licensed under the terms of the GNU GPL, version 2 or
* later. See the COPYING file in the top-level directory.
*/
#include "qemu/osdep.h"
#include "libqos/libqtest.h"
/*
* cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, \
* -m 4G -device am53c974,id=scsi -device scsi-hd,drive=disk0 -drive \
* id=disk0,if=none,file=null-co://,format=raw -nodefaults -qtest stdio
* outl 0xcf8 0x80001010
* outl 0xcfc 0xc000
* outl 0xcf8 0x80001004
* outw 0xcfc 0x01
* outl 0xc046 0x02
* outl 0xc03f 0x0300
* outw 0xc00b 0x4300
* outl 0xc00b 0x9000
* EOF
*/
static void test_fuzz(void)
{
QTestState *s = qtest_init(
"-display none , -m 4G -device am53c974,id=scsi -device "
"scsi-hd,drive=disk0 -drive "
"id=disk0,if=none,file=null-co://,format=raw -nodefaults");
qtest_outl(s, 0xcf8, 0x80001010);
qtest_outl(s, 0xcfc, 0xc000);
qtest_outl(s, 0xcf8, 0x80001004);
qtest_outw(s, 0xcfc, 0x01);
qtest_outl(s, 0xc046, 0x02);
qtest_outl(s, 0xc03f, 0x0300);
qtest_outw(s, 0xc00b, 0x4300);
qtest_outl(s, 0xc00b, 0x9000);
qtest_quit(s);
}
int main(int argc, char **argv)
{
const char *arch = qtest_get_arch();
g_test_init(&argc, &argv, NULL);
if (strcmp(arch, "i386") == 0) {
qtest_add_func("fuzz/test_fuzz", test_fuzz);
}
return g_test_run();
}
Technically, the first one is a heap use-after-free, while the second a stack buffer overflow. They could be two different manifestations of the same issue; they both originate from handle_ti() and the root cause may be the same.
Heap uaf:
=================================================================
==129653==ERROR: AddressSanitizer: heap-use-after-free on address 0x6290000b5000 at pc 0x7f0c3d947dd3 bp 0x7f0c13bfdac0 sp 0x7f0c13bfd270
READ of size 27 at 0x6290000b5000 thread T7
#0 0x7f0c3d947dd2 in __interceptor_memcpy (/lib64/libasan.so.6+0x39dd2)
#1 0x562c1c7292b2 in flatview_write_continue softmmu/physmem.c:2781
#2 0x562c1c729589 in flatview_write softmmu/physmem.c:2816
#3 0x562c1c729ef7 in address_space_write softmmu/physmem.c:2908
#4 0x562c1c729faf in address_space_rw softmmu/physmem.c:2918
#5 0x562c1c217754 in dma_memory_rw_relaxed include/sysemu/dma.h:8
#6 0x562c1c2177a1 in dma_memory_rw include/sysemu/dma.h:127
#7 0x562c1c21791b in pci_dma_rw include/hw/pci/pci.h:803
#8 0x562c1c21b6e3 in esp_pci_dma_memory_rw hw/scsi/esp-pci.c:283
#9 0x562c1c21ba6e in esp_pci_dma_memory_write hw/scsi/esp-pci.c:302
#10 0x562c1c428685 in esp_do_dma hw/scsi/esp.c:526
#11 0x562c1c429cb5 in handle_ti hw/scsi/esp.c:629
...
Stack bof:
=================================================================
==138588==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffc8a90c300 at pc 0x559b1de0780e bp 0x7ffc8a90bd10 sp 0x7ffc8a90bd08
WRITE of size 4 at 0x7ffc8a90c300 thread T0
#0 0x559b1de0780d in stl_he_p include/qemu/bswap.h:353
#1 0x559b1de07dec in stn_he_p include/qemu/bswap.h:486
#2 0x559b1de23e47 in flatview_read_continue softmmu/physmem.c:2841
#3 0x559b1de24215 in flatview_read softmmu/physmem.c:2879
#4 0x559b1de243b5 in address_space_read_full softmmu/physmem.c:2892
#5 0x559b1de2462c in address_space_rw softmmu/physmem.c:2920
#6 0x559b1d1ec514 in dma_memory_rw_relaxed include/sysemu/dma.h:88
#7 0x559b1d1ec561 in dma_memory_rw include/sysemu/dma.h:127
#8 0x559b1d1ec6db in pci_dma_rw include/hw/pci/pci.h:803
#9 0x559b1d1f04a3 in esp_pci_dma_memory_rw hw/scsi/esp-pci.c:283
#10 0x559b1d1f07f8 in esp_pci_dma_memory_read hw/scsi/esp-pci.c:296
#11 0x559b1d66fab1 in esp_do_dma hw/scsi/esp.c:576
#12 0x559b1d6746e1 in handle_ti hw/scsi/esp.c:845
...
Note that the use-after-free was found in v5.2.0 and, as far as I can tell, is not reproducible anymore on master. The ESP/NCR53C9x emulator (hw/scsi/esp.c) underwent several changes since v5.2.0. By git-bisecting, it looks like the original reproducer is neutralized after commit [1]. However, the qtest reproducer (comment #3) seems to be working fine on master as of today.
[1] https://git.qemu.org/?p=qemu.git;a=commit;h=bb0bc7bbc9764a5e9e81756819838c5db88652b8
Hi Mauro,
Oops... I missed that it was a stack-overflow. I went through my list of crashes, and the closest one I can find is a heap UAF, but it is a write, rather than a read:
/*
* Autogenerated Fuzzer Test Case
*
* Copyright (c) 2021 <name of author>
*
* This work is licensed under the terms of the GNU GPL, version 2 or
* later. See the COPYING file in the top-level directory.
*/
#include "qemu/osdep.h"
#include "libqos/libqtest.h"
/*
* cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, \
* -m 4G -device am53c974,id=scsi -device scsi-hd,drive=disk0 -drive \
* id=disk0,if=none,file=null-co://,format=raw -nodefaults -qtest stdio
* outl 0xcf8 0x80001010
* outl 0xcfc 0xc000
* outl 0xcf8 0x80001004
* outw 0xcfc 0x05
* outb 0xc046 0x02
* outl 0xc00b 0xc100
* outl 0xc040 0x03
* outl 0xc040 0x03
* write 0x0 0x1 0x41
* outl 0xc00b 0xc100
* outw 0xc040 0x02
* outl 0xc00b 0x9000
* EOF
*/
static void test_fuzz(void)
{
QTestState *s = qtest_init(
"-display none , -m 4G -device am53c974,id=scsi -device "
"scsi-hd,drive=disk0 -drive "
"id=disk0,if=none,file=null-co://,format=raw -nodefaults");
qtest_outl(s, 0xcf8, 0x80001010);
qtest_outl(s, 0xcfc, 0xc000);
qtest_outl(s, 0xcf8, 0x80001004);
qtest_outw(s, 0xcfc, 0x05);
qtest_outb(s, 0xc046, 0x02);
qtest_outl(s, 0xc00b, 0xc100);
qtest_outl(s, 0xc040, 0x03);
qtest_outl(s, 0xc040, 0x03);
qtest_bufwrite(s, 0x0, "\x41", 0x1);
qtest_outl(s, 0xc00b, 0xc100);
qtest_outw(s, 0xc040, 0x02);
qtest_outl(s, 0xc00b, 0x9000);
qtest_quit(s);
}
int main(int argc, char **argv)
{
const char *arch = qtest_get_arch();
g_test_init(&argc, &argv, NULL);
if (strcmp(arch, "i386") == 0) {
qtest_add_func("fuzz/test_fuzz", test_fuzz);
}
return g_test_run();
}
Thank you both for the reproducers. Please see the proposed patchset here:
https://lists.gnu.org/archive/html/qemu-devel/2021-03/msg06063.html
On Wednesday, 17 March, 2021, 10:26:36 pm IST, Cheolwoo Myung <email address hidden> wrote:
> Hello PJP, Mauro
>
> Of course. you can post the details with our reproducers.
> I'm glad it helped you.
>
> Thank you.
> - Cheolwoo Myung
>
2021년 3월 17일 (수) 오후 10:30, P J P <email address hidden>님이 작성:
>
>On Monday, 15 March, 2021, 07:54:30 pm IST, Mauro Matteo Cascella <email address hidden> wrote:
>>JFYI, CVE-2020-35506 was assigned to a very similar (if not the same)
>>issue, see https://bugs.launchpad.net/qemu/+bug/1909247.
>
> * From the QEMU command lines below they do look similar.
>
> * CVE bug above does not link to an upstream fix/patch. Maybe it's not fixed yet?
>
>
>On Mon, Mar 15, 2021 at 6:58 AM P J P <email address hidden> wrote:
> >On Monday, 15 March, 2021, 11:11:14 am IST, Cheolwoo Myung <email address hidden> wrote:
> >Using hypervisor fuzzer, hyfuzz, I found a use-after-free issue in am53c974 emulator of QEMU enabled ASan.
> >
> ># To reproduce this issue, please run the QEMU process with the following command line.
> >$ ./qemu-system-i386 -m 512 -drive file=./hyfuzz.img,index=0,media=disk,format=raw \
> > -device am53c974,id=scsi -device scsi-hd,drive=SysDisk -drive >id=SysDisk,if=none,file=./disk.img
> >
> >
> > Using hypervisor fuzzer, hyfuzz, I found a stack buffer overflow issue in am53c974 emulator of QEMU enabled ASan.
> >
> ># To reproduce this issue, please run the QEMU process with the following command line.
> >$ ./qemu-system-i386 -m 512 -drive file=./hyfuzz.img,index=0,media=disk,format=raw \
> > -device am53c974,id=scsi -device scsi-hd,drive=SysDisk -drive >id=SysDisk,if=none,file=./disk.img
> >
* I was able to reproduce these issues against the latest upstream git source
and following patch helps to fix above two issues.
===
$ git diff hw/scsi/
diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c
index c3d3dab05e..4a6f208069 100644
--- a/hw/scsi/esp-pci.c
+++ b/hw/scsi/esp-pci.c
@@ -98,6 +98,7 @@ static void esp_pci_handle_abort(PCIESPState *pci, uint32_t val)
trace_esp_pci_dma_abort(val);
if (s->current_req) {
scsi_req_cancel(s->current_req);
+ s->async_len = 0;
}
}
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 507ab363bc..99bee7bc66 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -564,7 +564,7 @@ static void esp_do_dma(ESPState *s)
int to_device = ((s->rregs[ESP_RSTAT] & 7) == STAT_DO);
uint8_t buf[ESP_CMDFIFO_SZ];
- len = esp_get_tc(s);
+ len = MIN(esp_get_tc(s), sizeof(buf));
if (s->do_cmd) {
/*
===
> >Using hypervisor fuzzer, hyfuzz, I found a heap buffer overflow issue in am53c974 emulator of QEMU enabled ASan.
> >
> ># To reproduce this issue, please run the QEMU process with the following command line.
> >$ ./qemu-system-i386 -m 512 -drive file=./hyfuzz.img,index=0,media=disk,format=raw \
> > -device am53c974,id=scsi -device scsi-hd,drive=SysDisk -drive >id=SysDisk,if=none,file=./disk.img
* This heap OOB access issue seems to occur because
static void do_busid_cmd(...)
...
buf = (uint8_t *)fifo8_pop_buf(&s->cmdfifo, cmdlen, &n); <==
'buf' points towards an end of the 32 byte buffer allocated via
static void esp_init(Object *obj)
...
fifo8_create(&s->cmdfifo, ESP_CMDFIFO_SZ(=32)); <==
and the OOB access could occur at numerous places, one of which is
scsi_req_new
-> scsi_req_parse_cdb
-> memcpy(cmd->buf, buf, cmd->len); <== buf=27, cmd->len=6 <= 27+6 exceeds limit 32.
* This one is quite tricky to fix. Because 'buf[]' is accessed at various
places with hard coded index values. It's not easy to check access
against 's->cmdfifo' object.
@Cheolwoo: is it okay with you if we post above details and your reproducers on the upstream bug
-> https://bugs.launchpad.net/qemu/+bug/1909247
It'll help to discuss/prepare a proper fix patch.
Thank you.
---
-P J P
http://feedmug.com
Can you confirm that this is fixed in the v2 of the above patchset?
https://lists.gnu.org/archive/html/qemu-devel/2021-03/msg06550.html
ATB,
Mark.
Hello,
Thank you all for your comments. Both patches (PJP/comment#8 - Mark/comment#9) seem to properly fix the UAF reported by Alexander in comment #6. However, I'm still able to reproduce the heap-bof from the above hw-esp-oob-issues.zip:
./x86_64-softmmu/qemu-system-x86_64 -m 512 \
-drive file=./atch2/hyfuzz.img,index=0,media=disk,format=raw \
-device am53c974,id=scsi -device scsi-hd,drive=SysDisk \
-drive id=SysDisk,if=none,file=./atch2/disk.img
Hi,
I can still trigger stack-overflows, heap-UAFs and heap-overflows in the
code, but Mark's patches fixed some of the issues. I didn't want to
flood the issue-tracker with further problems in this code, since it
isn't clear what the security expectations are for this device. Of
course it is only a matter of time until someone sends more reports to
qemu-security.
Mark, do you want me to provide more reproducers for this device?
-Alex
On 3/24/21 4:53 PM, Alexander Bulekov wrote:
> Hi,
> I can still trigger stack-overflows, heap-UAFs and heap-overflows in the
> code, but Mark's patches fixed some of the issues. I didn't want to
> flood the issue-tracker with further problems in this code, since it
> isn't clear what the security expectations are for this device. Of
> course it is only a matter of time until someone sends more reports to
> qemu-security.
I'd expect qemu-security to have a template "Thank you for your bug
but this device is not within the 'security' boundary, we will forward
your report to the community".
>
> Mark, do you want me to provide more reproducers for this device?
Surely Mark prefers you provide bugfixes instead :D
Phil.
If Alex is interested in having a fuzz-proof device as a starting point for fuzzing QEMU's SCSI layer then I don't mind doing the basic work as I've spent a few months deep in the internals of the ESP controller, and it makes sense to look at this whilst it is all still fresh. I'd say there's at least one more set of ESP changes already waiting for after the 6.0 release.
PJP:
Your change to esp-pci.c looks like a genuine issue, although there is an inconsistency within ESP as to what determines whether a request is in progress or not. My v2 patchset above uses the request member being non-NULL to indicate a valid request, but this should be made consistent throughout the driver.
Can you provide a qtest reproducer so that it can be incorporated into the test included in the v2 patchset and also allow me to check that this issue has been fixed?
Alex:
If you can try PJP's patch to esp-pci.c and if you still see some issues then please update this bug with a test case or two, and I will look at them when I get a moment.
Mauro:
Thanks for the test case - again I shall look at this when I have some available time.
Add some more regression tests for the esp device.
(Prasad's Patch)
Based-on: <email address hidden>
(Mark's v2 Patchset)
Based-on: <email address hidden>
Signed-off-by: Alexander Bulekov <email address hidden>
---
Hi Mark,
Hopefully these are useful. I realized that my previous message was
innacurate (I forgot to apply Prasad's patch, or your v2
patchset). The only corruptions that I am continuing to see are
heap-overflows. I am guessing that most of these are due to some mututal
root cause, so the number of tests far-exceeds the actual number of
errors, but I am providing all of the crashes with unique-looking
stack-traces, just in case.
Please let me know if I can provide anything else that would help.
-Alex
tests/qtest/am53c974-test.c | 1137 +++++++++++++++++++++++++++++++++++
1 file changed, 1137 insertions(+)
diff --git a/tests/qtest/am53c974-test.c b/tests/qtest/am53c974-test.c
index c90bd4c187..cb2a5646a6 100644
--- a/tests/qtest/am53c974-test.c
+++ b/tests/qtest/am53c974-test.c
@@ -9,6 +9,1125 @@
#include "libqos/libqtest.h"
+/*
+ * cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, -m \
+ * 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 -drive \
+ * id=disk0,if=none,file=null-co://,format=raw -nodefaults -qtest stdio
+ * outl 0xcf8 0x80001010
+ * outl 0xcfc 0xc000
+ * outl 0xcf8 0x80001004
+ * outw 0xcfc 0x01
+ * outb 0xc000 0x4
+ * outb 0xc008 0xa0
+ * outl 0xc03f 0x0300
+ * outl 0xc00b 0xc300
+ * outw 0xc00b 0x9000
+ * outl 0xc00b 0xc300
+ * outl 0xc00b 0xc300
+ * outl 0xc00b 0xc300
+ * outw 0xc00b 0x9000
+ * outw 0xc00b 0x1000
+ * EOF
+ */
+static void crash_0900379669(void)
+{
+ QTestState *s = qtest_init(
+ "-display none -m 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 "
+ "-drive id=disk0,if=none,file=null-co://,format=raw -nodefaults");
+ qtest_outl(s, 0xcf8, 0x80001010);
+ qtest_outl(s, 0xcfc, 0xc000);
+ qtest_outl(s, 0xcf8, 0x80001004);
+ qtest_outw(s, 0xcfc, 0x01);
+ qtest_outb(s, 0xc000, 0x4);
+ qtest_outb(s, 0xc008, 0xa0);
+ qtest_outl(s, 0xc03f, 0x0300);
+ qtest_outl(s, 0xc00b, 0xc300);
+ qtest_outw(s, 0xc00b, 0x9000);
+ qtest_outl(s, 0xc00b, 0xc300);
+ qtest_outl(s, 0xc00b, 0xc300);
+ qtest_outl(s, 0xc00b, 0xc300);
+ qtest_outw(s, 0xc00b, 0x9000);
+ qtest_outw(s, 0xc00b, 0x1000);
+ qtest_quit(s);
+}
+/*
+ * cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, -m \
+ * 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 -drive \
+ * id=disk0,if=none,file=null-co://,format=raw -nodefaults -qtest stdio
+ * outl 0xcf8 0x80001010
+ * outl 0xcfc 0xc000
+ * outl 0xcf8 0x80001004
+ * outw 0xcfc 0x01
+ * outl 0xc008 0x20
+ * outw 0xc000 0x1
+ * outb 0xc040 0x03
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outw 0xc00b 0x4200
+ * outl 0xc00a 0x410000
+ * EOF
+ */
+static void crash_094661a91b(void)
+{
+ QTestState *s = qtest_init(
+ "-display none -m 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 "
+ "-drive id=disk0,if=none,file=null-co://,format=raw -nodefaults");
+ qtest_outl(s, 0xcf8, 0x80001010);
+ qtest_outl(s, 0xcfc, 0xc000);
+ qtest_outl(s, 0xcf8, 0x80001004);
+ qtest_outw(s, 0xcfc, 0x01);
+ qtest_outl(s, 0xc008, 0x20);
+ qtest_outw(s, 0xc000, 0x1);
+ qtest_outb(s, 0xc040, 0x03);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outw(s, 0xc00b, 0x4200);
+ qtest_outl(s, 0xc00a, 0x410000);
+ qtest_quit(s);
+}
+/*
+ * cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, -m \
+ * 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 -drive \
+ * id=disk0,if=none,file=null-co://,format=raw -nodefaults -qtest stdio
+ * outl 0xcf8 0x80001010
+ * outl 0xcfc 0xc000
+ * outl 0xcf8 0x80001004
+ * outw 0xcfc 0x01
+ * outb 0xc000 0x4
+ * outl 0xc007 0x8000
+ * outl 0xc03f 0x0300
+ * outl 0xc00b 0x4300
+ * outw 0xc00b 0x9000
+ * outl 0xc00b 0xc300
+ * outl 0xc00b 0xc300
+ * outl 0xc00b 0xc300
+ * outw 0xc00b 0x9000
+ * outw 0xc00b 0x1000
+ * EOF
+ */
+static void crash_0fff2155cb(void)
+{
+ QTestState *s = qtest_init(
+ "-display none -m 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 "
+ "-drive id=disk0,if=none,file=null-co://,format=raw -nodefaults");
+ qtest_outl(s, 0xcf8, 0x80001010);
+ qtest_outl(s, 0xcfc, 0xc000);
+ qtest_outl(s, 0xcf8, 0x80001004);
+ qtest_outw(s, 0xcfc, 0x01);
+ qtest_outb(s, 0xc000, 0x4);
+ qtest_outl(s, 0xc007, 0x8000);
+ qtest_outl(s, 0xc03f, 0x0300);
+ qtest_outl(s, 0xc00b, 0x4300);
+ qtest_outw(s, 0xc00b, 0x9000);
+ qtest_outl(s, 0xc00b, 0xc300);
+ qtest_outl(s, 0xc00b, 0xc300);
+ qtest_outl(s, 0xc00b, 0xc300);
+ qtest_outw(s, 0xc00b, 0x9000);
+ qtest_outw(s, 0xc00b, 0x1000);
+ qtest_quit(s);
+}
+/*
+ * cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, -m \
+ * 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 -drive \
+ * id=disk0,if=none,file=null-co://,format=raw -nodefaults -qtest stdio
+ * outl 0xcf8 0x80001010
+ * outl 0xcfc 0xc000
+ * outl 0xcf8 0x80001004
+ * outw 0xcfc 0x01
+ * outw 0xc00c 0x41
+ * outw 0xc00a 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00c 0x43
+ * outw 0xc00b 0x00
+ * outw 0xc00b 0x00
+ * outw 0xc00c 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00a 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00c 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00a 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00c 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00a 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00c 0x00
+ * outl 0xc00a 0x00
+ * outl 0xc006 0x00
+ * outl 0xc00b 0x00
+ * outw 0xc00b 0x0800
+ * outw 0xc00b 0x00
+ * outw 0xc00b 0x00
+ * outl 0xc006 0x00
+ * outl 0xc00b 0x00
+ * outw 0xc00b 0x0800
+ * outw 0xc00b 0x00
+ * outw 0xc00b 0x4100
+ * outw 0xc00a 0x00
+ * outl 0xc00a 0x100000
+ * outl 0xc00a 0x00
+ * outw 0xc00c 0x43
+ * outl 0xc00a 0x100000
+ * outl 0xc00a 0x100000
+ * EOF
+ */
+static void crash_1548bd10e7(void)
+{
+ QTestState *s = qtest_init(
+ "-display none -m 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 "
+ "-drive id=disk0,if=none,file=null-co://,format=raw -nodefaults");
+ qtest_outl(s, 0xcf8, 0x80001010);
+ qtest_outl(s, 0xcfc, 0xc000);
+ qtest_outl(s, 0xcf8, 0x80001004);
+ qtest_outw(s, 0xcfc, 0x01);
+ qtest_outw(s, 0xc00c, 0x41);
+ qtest_outw(s, 0xc00a, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00c, 0x43);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00a, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00a, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00a, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outl(s, 0xc006, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00b, 0x0800);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc006, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00b, 0x0800);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00b, 0x4100);
+ qtest_outw(s, 0xc00a, 0x00);
+ qtest_outl(s, 0xc00a, 0x100000);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00c, 0x43);
+ qtest_outl(s, 0xc00a, 0x100000);
+ qtest_outl(s, 0xc00a, 0x100000);
+ qtest_quit(s);
+}
+/*
+ * cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, -m \
+ * 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 -drive \
+ * id=disk0,if=none,file=null-co://,format=raw -nodefaults -qtest stdio
+ * outl 0xcf8 0x80001010
+ * outl 0xcfc 0xc000
+ * outl 0xcf8 0x80001004
+ * outw 0xcfc 0x01
+ * outl 0xc00a 0x420000
+ * outl 0xc00a 0x430000
+ * outl 0xc00b 0x00
+ * outw 0xc00b 0x00
+ * outw 0xc00b 0x00
+ * outl 0xc00b 0x00
+ * outw 0xc00b 0x00
+ * outl 0xc00b 0x00
+ * outw 0xc00b 0x00
+ * outl 0xc00b 0x00
+ * outb 0xc008 0x00
+ * outw 0xc00b 0x00
+ * outb 0xc008 0xa0
+ * outw 0xc00b 0x00
+ * outw 0xc00b 0x00
+ * outw 0xc00b 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00b 0x00
+ * outl 0xc00a 0x00
+ * outl 0xc00a 0x00
+ * outl 0xc00b 0x00
+ * outw 0xc00b 0x00
+ * outl 0xc00b 0x1000
+ * outw 0xc00b 0x1000
+ * EOF
+ */
+static void crash_1afe349482(void)
+{
+ QTestState *s = qtest_init(
+ "-display none -m 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 "
+ "-drive id=disk0,if=none,file=null-co://,format=raw -nodefaults");
+ qtest_outl(s, 0xcf8, 0x80001010);
+ qtest_outl(s, 0xcfc, 0xc000);
+ qtest_outl(s, 0xcf8, 0x80001004);
+ qtest_outw(s, 0xcfc, 0x01);
+ qtest_outl(s, 0xc00a, 0x420000);
+ qtest_outl(s, 0xc00a, 0x430000);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outb(s, 0xc008, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outb(s, 0xc008, 0xa0);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0x1000);
+ qtest_outw(s, 0xc00b, 0x1000);
+ qtest_quit(s);
+}
+/*
+ * cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, -m \
+ * 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 -drive \
+ * id=disk0,if=none,file=null-co://,format=raw -nodefaults -qtest stdio
+ * outl 0xcf8 0x80001010
+ * outl 0xcfc 0xc000
+ * outl 0xcf8 0x80001004
+ * outw 0xcfc 0x01
+ * outl 0xc007 0x2000
+ * outw 0xc00b 0x0100
+ * outw 0xc00c 0x43
+ * outl 0xc00a 0x00
+ * outw 0xc00a 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00c 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00a 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00c 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00a 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00c 0x00
+ * outw 0xc00b 0x00
+ * outw 0xc00b 0x00
+ * outw 0xc00c 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00a 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00c 0x00
+ * outl 0xc00a 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00c 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00c 0x00
+ * outw 0xc00b 0x00
+ * outw 0xc00b 0x00
+ * outw 0xc00c 0x00
+ * outw 0xc00a 0x00
+ * outl 0xc00a 0x100000
+ * outl 0xc00a 0x100000
+ * outl 0xc00a 0x00
+ * outw 0xc00c 0x43
+ * outl 0xc00a 0x100000
+ * outl 0xc00a 0x100000
+ * EOF
+ */
+static void crash_1b42581317(void)
+{
+ QTestState *s = qtest_init(
+ "-display none -m 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 "
+ "-drive id=disk0,if=none,file=null-co://,format=raw -nodefaults");
+ qtest_outl(s, 0xcf8, 0x80001010);
+ qtest_outl(s, 0xcfc, 0xc000);
+ qtest_outl(s, 0xcf8, 0x80001004);
+ qtest_outw(s, 0xcfc, 0x01);
+ qtest_outl(s, 0xc007, 0x2000);
+ qtest_outw(s, 0xc00b, 0x0100);
+ qtest_outw(s, 0xc00c, 0x43);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00a, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00a, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00a, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00a, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outw(s, 0xc00a, 0x00);
+ qtest_outl(s, 0xc00a, 0x100000);
+ qtest_outl(s, 0xc00a, 0x100000);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00c, 0x43);
+ qtest_outl(s, 0xc00a, 0x100000);
+ qtest_outl(s, 0xc00a, 0x100000);
+ qtest_quit(s);
+}
+/*
+ * cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, -m \
+ * 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 -drive \
+ * id=disk0,if=none,file=null-co://,format=raw -nodefaults -qtest stdio
+ * outl 0xcf8 0x80001010
+ * outl 0xcfc 0xc000
+ * outl 0xcf8 0x80001004
+ * outw 0xcfc 0x01
+ * outl 0xc007 0x1500
+ * outw 0xc00b 0x4100
+ * outw 0xc00b 0x4100
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x00
+ * outw 0xc00b 0x1000
+ * outw 0xc009 0x00
+ * outl 0xc00b 0xc000
+ * outl 0xc00b 0xc000
+ * outl 0xc00b 0xc000
+ * outl 0xc00b 0xc000
+ * outl 0xc00b 0x0
+ * outl 0xc00b 0xc000
+ * outl 0xc00b 0xc000
+ * outl 0xc00b 0xc000
+ * outl 0xc007 0x00
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x1000
+ * outl 0xc007 0x00
+ * outw 0xc00b 0x4100
+ * EOF
+ */
+static void crash_30e28cfa86(void)
+{
+ QTestState *s = qtest_init(
+ "-display none -m 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 "
+ "-drive id=disk0,if=none,file=null-co://,format=raw -nodefaults");
+ qtest_outl(s, 0xcf8, 0x80001010);
+ qtest_outl(s, 0xcfc, 0xc000);
+ qtest_outl(s, 0xcf8, 0x80001004);
+ qtest_outw(s, 0xcfc, 0x01);
+ qtest_outl(s, 0xc007, 0x1500);
+ qtest_outw(s, 0xc00b, 0x4100);
+ qtest_outw(s, 0xc00b, 0x4100);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00b, 0x1000);
+ qtest_outw(s, 0xc009, 0x00);
+ qtest_outl(s, 0xc00b, 0xc000);
+ qtest_outl(s, 0xc00b, 0xc000);
+ qtest_outl(s, 0xc00b, 0xc000);
+ qtest_outl(s, 0xc00b, 0xc000);
+ qtest_outl(s, 0xc00b, 0x0);
+ qtest_outl(s, 0xc00b, 0xc000);
+ qtest_outl(s, 0xc00b, 0xc000);
+ qtest_outl(s, 0xc00b, 0xc000);
+ qtest_outl(s, 0xc007, 0x00);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x1000);
+ qtest_outl(s, 0xc007, 0x00);
+ qtest_outw(s, 0xc00b, 0x4100);
+ qtest_quit(s);
+}
+/*
+ * cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, -m \
+ * 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 -drive \
+ * id=disk0,if=none,file=null-co://,format=raw -nodefaults -qtest stdio
+ * outl 0xcf8 0x80001010
+ * outl 0xcfc 0xc000
+ * outl 0xcf8 0x80001004
+ * outw 0xcfc 0x01
+ * outb 0xc008 0x42
+ * outw 0xc00b 0x4100
+ * outw 0xc00b 0x4100
+ * outw 0xc00b 0x00
+ * outw 0xc00b 0x1000
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outl 0xc00b 0x0300
+ * outw 0xc00b 0x1000
+ * EOF
+ */
+static void crash_34093bfc7c(void)
+{
+ QTestState *s = qtest_init(
+ "-display none -m 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 "
+ "-drive id=disk0,if=none,file=null-co://,format=raw -nodefaults");
+ qtest_outl(s, 0xcf8, 0x80001010);
+ qtest_outl(s, 0xcfc, 0xc000);
+ qtest_outl(s, 0xcf8, 0x80001004);
+ qtest_outw(s, 0xcfc, 0x01);
+ qtest_outb(s, 0xc008, 0x42);
+ qtest_outw(s, 0xc00b, 0x4100);
+ qtest_outw(s, 0xc00b, 0x4100);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00b, 0x1000);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_outw(s, 0xc00b, 0x1000);
+ qtest_quit(s);
+}
+/*
+ * cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, -m \
+ * 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 -drive \
+ * id=disk0,if=none,file=null-co://,format=raw -nodefaults -qtest stdio
+ * outl 0xcf8 0x80001010
+ * outl 0xcfc 0xc000
+ * outl 0xcf8 0x80001004
+ * outw 0xcfc 0x01
+ * outw 0xc000 0x1
+ * outb 0xc040 0x03
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outw 0xc007 0xa000
+ * outl 0xc00a 0x410000
+ * EOF
+ */
+static void crash_3a05434a1f(void)
+{
+ QTestState *s = qtest_init(
+ "-display none -m 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 "
+ "-drive id=disk0,if=none,file=null-co://,format=raw -nodefaults");
+ qtest_outl(s, 0xcf8, 0x80001010);
+ qtest_outl(s, 0xcfc, 0xc000);
+ qtest_outl(s, 0xcf8, 0x80001004);
+ qtest_outw(s, 0xcfc, 0x01);
+ qtest_outw(s, 0xc000, 0x1);
+ qtest_outb(s, 0xc040, 0x03);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outw(s, 0xc007, 0xa000);
+ qtest_outl(s, 0xc00a, 0x410000);
+ qtest_quit(s);
+}
+/*
+ * cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, -m \
+ * 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 -drive \
+ * id=disk0,if=none,file=null-co://,format=raw -nodefaults -qtest stdio
+ * outl 0xcf8 0x80001010
+ * outl 0xcfc 0xc000
+ * outl 0xcf8 0x80001004
+ * outw 0xcfc 0x01
+ * outw 0xc000 0x01
+ * outb 0xc040 0x03
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0x4200
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0x4000
+ * outl 0xc00b 0xc200
+ * outl 0xc00b 0x00
+ * outl 0xc00b 0x00
+ * outl 0xc00b 0x00
+ * outl 0xc00b 0x00
+ * outl 0xc00b 0x00
+ * outl 0xc00b 0x00
+ * outl 0xc00b 0x00
+ * outl 0xc00b 0x00
+ * outl 0xc00b 0x00
+ * outl 0xc00b 0x00
+ * outl 0xc00b 0x00
+ * outl 0xc00b 0x00
+ * outl 0xc00b 0x00
+ * outl 0xc00b 0x00
+ * outl 0xc00b 0x00
+ * outl 0xc00b 0x00
+ * outl 0xc00b 0x00
+ * outw 0xc00b 0x00
+ * EOF
+ */
+static void crash_3ab5744bc3(void)
+{
+ QTestState *s = qtest_init(
+ "-display none -m 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 "
+ "-drive id=disk0,if=none,file=null-co://,format=raw -nodefaults");
+ qtest_outl(s, 0xcf8, 0x80001010);
+ qtest_outl(s, 0xcfc, 0xc000);
+ qtest_outl(s, 0xcf8, 0x80001004);
+ qtest_outw(s, 0xcfc, 0x01);
+ qtest_outw(s, 0xc000, 0x01);
+ qtest_outb(s, 0xc040, 0x03);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0x4200);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0x4000);
+ qtest_outl(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_quit(s);
+}
+/*
+ * cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, -m \
+ * 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 -drive \
+ * id=disk0,if=none,file=null-co://,format=raw -nodefaults -qtest stdio
+ * outl 0xcf8 0x80001010
+ * outl 0xcfc 0xc000
+ * outl 0xcf8 0x80001004
+ * outw 0xcfc 0x01
+ * outl 0xc00b 0x4100
+ * outw 0xc00b 0xc200
+ * outl 0xc03f 0x0300
+ * EOF
+ */
+static void crash_530ff2e211(void)
+{
+ QTestState *s = qtest_init(
+ "-display none -m 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 "
+ "-drive id=disk0,if=none,file=null-co://,format=raw -nodefaults");
+ qtest_outl(s, 0xcf8, 0x80001010);
+ qtest_outl(s, 0xcfc, 0xc000);
+ qtest_outl(s, 0xcf8, 0x80001004);
+ qtest_outw(s, 0xcfc, 0x01);
+ qtest_outl(s, 0xc00b, 0x4100);
+ qtest_outw(s, 0xc00b, 0xc200);
+ qtest_outl(s, 0xc03f, 0x0300);
+ qtest_quit(s);
+}
+/*
+ * cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, -m \
+ * 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 -drive \
+ * id=disk0,if=none,file=null-co://,format=raw -nodefaults -qtest stdio
+ * outl 0xcf8 0x80001010
+ * outl 0xcfc 0xc000
+ * outl 0xcf8 0x80001004
+ * outw 0xcfc 0x01
+ * outl 0xc03f 0x0300
+ * outw 0xc00b 0x4300
+ * outw 0xc000 0x01
+ * outw 0xc009 0x00
+ * outw 0xc00b 0x1000
+ * outl 0xc00d 0x02000000
+ * outw 0xc00c 0xc2
+ * outw 0xc00b 0x4100
+ * outl 0xc00b 0x1000
+ * EOF
+ */
+static void crash_76ab101171(void)
+{
+ QTestState *s = qtest_init(
+ "-display none -m 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 "
+ "-drive id=disk0,if=none,file=null-co://,format=raw -nodefaults");
+ qtest_outl(s, 0xcf8, 0x80001010);
+ qtest_outl(s, 0xcfc, 0xc000);
+ qtest_outl(s, 0xcf8, 0x80001004);
+ qtest_outw(s, 0xcfc, 0x01);
+ qtest_outl(s, 0xc03f, 0x0300);
+ qtest_outw(s, 0xc00b, 0x4300);
+ qtest_outw(s, 0xc000, 0x01);
+ qtest_outw(s, 0xc009, 0x00);
+ qtest_outw(s, 0xc00b, 0x1000);
+ qtest_outl(s, 0xc00d, 0x02000000);
+ qtest_outw(s, 0xc00c, 0xc2);
+ qtest_outw(s, 0xc00b, 0x4100);
+ qtest_outl(s, 0xc00b, 0x1000);
+ qtest_quit(s);
+}
+/*
+ * cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, -m \
+ * 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 -drive \
+ * id=disk0,if=none,file=null-co://,format=raw -nodefaults -qtest stdio
+ * outl 0xcf8 0x80001010
+ * outl 0xcfc 0xc000
+ * outl 0xcf8 0x80001004
+ * outw 0xcfc 0x01
+ * outb 0xc000 0x4
+ * outw 0xc007 0x4000
+ * outl 0xc03f 0x0300
+ * outl 0xc00b 0xc300
+ * outw 0xc00b 0x9000
+ * outl 0xc00b 0xc300
+ * outw 0xc00b 0x9000
+ * outl 0xc00b 0x00
+ * outl 0xc00b 0xc300
+ * outw 0xc00b 0x9000
+ * outw 0xc00b 0x1000
+ * EOF
+ */
+static void crash_7f743a0082(void)
+{
+ QTestState *s = qtest_init(
+ "-display none -m 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 "
+ "-drive id=disk0,if=none,file=null-co://,format=raw -nodefaults");
+ qtest_outl(s, 0xcf8, 0x80001010);
+ qtest_outl(s, 0xcfc, 0xc000);
+ qtest_outl(s, 0xcf8, 0x80001004);
+ qtest_outw(s, 0xcfc, 0x01);
+ qtest_outb(s, 0xc000, 0x4);
+ qtest_outw(s, 0xc007, 0x4000);
+ qtest_outl(s, 0xc03f, 0x0300);
+ qtest_outl(s, 0xc00b, 0xc300);
+ qtest_outw(s, 0xc00b, 0x9000);
+ qtest_outl(s, 0xc00b, 0xc300);
+ qtest_outw(s, 0xc00b, 0x9000);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0xc300);
+ qtest_outw(s, 0xc00b, 0x9000);
+ qtest_outw(s, 0xc00b, 0x1000);
+ qtest_quit(s);
+}
+/*
+ * cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, -m \
+ * 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 -drive \
+ * id=disk0,if=none,file=null-co://,format=raw -nodefaults -qtest stdio
+ * outl 0xcf8 0x80001010
+ * outl 0xcfc 0xc000
+ * outl 0xcf8 0x80001004
+ * outw 0xcfc 0x01
+ * outb 0xc000 0x4
+ * outl 0xc03f 0x0300
+ * outl 0xc00b 0xc300
+ * outw 0xc00b 0x9000
+ * outl 0xc00b 0x00
+ * outl 0xc00b 0xc300
+ * outw 0xc00b 0x9000
+ * outl 0xc00b 0x00
+ * outl 0xc00b 0xc300
+ * outl 0xc00b 0xc300
+ * outw 0xc00b 0x9000
+ * outw 0xc00b 0x1000
+ * EOF
+ */
+static void crash_87744a2e67(void)
+{
+ QTestState *s = qtest_init(
+ "-display none -m 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 "
+ "-drive id=disk0,if=none,file=null-co://,format=raw -nodefaults");
+ qtest_outl(s, 0xcf8, 0x80001010);
+ qtest_outl(s, 0xcfc, 0xc000);
+ qtest_outl(s, 0xcf8, 0x80001004);
+ qtest_outw(s, 0xcfc, 0x01);
+ qtest_outb(s, 0xc000, 0x4);
+ qtest_outl(s, 0xc03f, 0x0300);
+ qtest_outl(s, 0xc00b, 0xc300);
+ qtest_outw(s, 0xc00b, 0x9000);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0xc300);
+ qtest_outw(s, 0xc00b, 0x9000);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00b, 0xc300);
+ qtest_outl(s, 0xc00b, 0xc300);
+ qtest_outw(s, 0xc00b, 0x9000);
+ qtest_outw(s, 0xc00b, 0x1000);
+ qtest_quit(s);
+}
+/*
+ * cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, -m \
+ * 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 -drive \
+ * id=disk0,if=none,file=null-co://,format=raw -nodefaults -qtest stdio
+ * outl 0xcf8 0x80001010
+ * outl 0xcfc 0xc000
+ * outl 0xcf8 0x80001004
+ * outw 0xcfc 0x01
+ * outw 0xc00c 0x41
+ * outl 0xc00a 0x00
+ * outw 0xc00c 0x43
+ * outw 0xc00b 0x00
+ * outw 0xc00b 0x00
+ * outw 0xc00c 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00a 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00c 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00a 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00c 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00a 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00c 0x00
+ * outw 0xc00b 0x00
+ * outw 0xc00b 0x00
+ * outw 0xc00c 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00a 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00c 0x00
+ * outl 0xc00a 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00c 0x00
+ * outl 0xc00a 0x00
+ * outw 0xc00c 0x00
+ * outw 0xc00b 0x00
+ * outw 0xc00b 0x00
+ * outw 0xc00c 0x00
+ * outw 0xc00a 0x00
+ * outl 0xc00a 0x100000
+ * outl 0xc00a 0x100000
+ * outl 0xc00a 0x00
+ * outw 0xc00c 0x43
+ * outl 0xc00a 0x100000
+ * outl 0xc00a 0x100000
+ * EOF
+ */
+static void crash_9f92a77bd6(void)
+{
+ QTestState *s = qtest_init(
+ "-display none -m 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 "
+ "-drive id=disk0,if=none,file=null-co://,format=raw -nodefaults");
+ qtest_outl(s, 0xcf8, 0x80001010);
+ qtest_outl(s, 0xcfc, 0xc000);
+ qtest_outl(s, 0xcf8, 0x80001004);
+ qtest_outw(s, 0xcfc, 0x01);
+ qtest_outw(s, 0xc00c, 0x41);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00c, 0x43);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00a, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00a, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00a, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00a, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00b, 0x00);
+ qtest_outw(s, 0xc00c, 0x00);
+ qtest_outw(s, 0xc00a, 0x00);
+ qtest_outl(s, 0xc00a, 0x100000);
+ qtest_outl(s, 0xc00a, 0x100000);
+ qtest_outl(s, 0xc00a, 0x00);
+ qtest_outw(s, 0xc00c, 0x43);
+ qtest_outl(s, 0xc00a, 0x100000);
+ qtest_outl(s, 0xc00a, 0x100000);
+ qtest_quit(s);
+}
+/*
+ * cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, -m \
+ * 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 -drive \
+ * id=disk0,if=none,file=null-co://,format=raw -nodefaults -qtest stdio
+ * outl 0xcf8 0x80001010
+ * outl 0xcfc 0xc000
+ * outl 0xcf8 0x80001004
+ * outw 0xcfc 0x01
+ * outb 0xc008 0xa
+ * outw 0xc00b 0x4100
+ * outw 0xc00b 0x4100
+ * outw 0xc00b 0x1000
+ * outl 0xc00b 0x0800
+ * outl 0xc00b 0x0400
+ * outl 0xc00b 0x0400
+ * outl 0xc00b 0x0400
+ * outl 0xc00b 0x0400
+ * outl 0xc00b 0x0400
+ * outl 0xc00b 0x0400
+ * outl 0xc00b 0x0800
+ * outl 0xc00b 0x0400
+ * outl 0xc00b 0x0400
+ * outl 0xc00b 0x0400
+ * outl 0xc00b 0x0800
+ * outl 0xc00b 0x0400
+ * outl 0xc00b 0x0400
+ * outl 0xc00b 0x0400
+ * outl 0xc00b 0x4200
+ * EOF
+ */
+static void crash_d94dc29565(void)
+{
+ QTestState *s = qtest_init(
+ "-display none -m 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 "
+ "-drive id=disk0,if=none,file=null-co://,format=raw -nodefaults");
+ qtest_outl(s, 0xcf8, 0x80001010);
+ qtest_outl(s, 0xcfc, 0xc000);
+ qtest_outl(s, 0xcf8, 0x80001004);
+ qtest_outw(s, 0xcfc, 0x01);
+ qtest_outb(s, 0xc008, 0xa);
+ qtest_outw(s, 0xc00b, 0x4100);
+ qtest_outw(s, 0xc00b, 0x4100);
+ qtest_outw(s, 0xc00b, 0x1000);
+ qtest_outl(s, 0xc00b, 0x0800);
+ qtest_outl(s, 0xc00b, 0x0400);
+ qtest_outl(s, 0xc00b, 0x0400);
+ qtest_outl(s, 0xc00b, 0x0400);
+ qtest_outl(s, 0xc00b, 0x0400);
+ qtest_outl(s, 0xc00b, 0x0400);
+ qtest_outl(s, 0xc00b, 0x0400);
+ qtest_outl(s, 0xc00b, 0x0800);
+ qtest_outl(s, 0xc00b, 0x0400);
+ qtest_outl(s, 0xc00b, 0x0400);
+ qtest_outl(s, 0xc00b, 0x0400);
+ qtest_outl(s, 0xc00b, 0x0800);
+ qtest_outl(s, 0xc00b, 0x0400);
+ qtest_outl(s, 0xc00b, 0x0400);
+ qtest_outl(s, 0xc00b, 0x0400);
+ qtest_outl(s, 0xc00b, 0x4200);
+ qtest_quit(s);
+}
+/*
+ * cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, -m \
+ * 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 -drive \
+ * id=disk0,if=none,file=null-co://,format=raw -nodefaults -qtest stdio
+ * outl 0xcf8 0x80001010
+ * outl 0xcfc 0xc000
+ * outl 0xcf8 0x80001004
+ * outw 0xcfc 0x01
+ * outw 0xc00b 0x4100
+ * outl 0xc00b 0x0300
+ * inl 0xc00b
+ * outl 0xc00b 0x0800
+ * outl 0xc00b 0x0800
+ * outl 0xc00b 0x0800
+ * outl 0xc00b 0x0800
+ * outl 0xc00b 0x0800
+ * outl 0xc00b 0x0800
+ * outl 0xc00b 0x0800
+ * outl 0xc00b 0x0800
+ * outl 0xc00b 0x0800
+ * outl 0xc00b 0x0800
+ * outl 0xc00b 0x0800
+ * outl 0xc00b 0x0800
+ * outl 0xc00b 0x0800
+ * outl 0xc00b 0x0800
+ * outl 0xc00b 0x00
+ * outl 0xc00a 0x410000
+ * EOF
+ */
+static void crash_df5a21ccf3(void)
+{
+ QTestState *s = qtest_init(
+ "-display none -m 512M -device am53c974,id=scsi -device scsi-hd,drive=disk0 "
+ "-drive id=disk0,if=none,file=null-co://,format=raw -nodefaults");
+ qtest_outl(s, 0xcf8, 0x80001010);
+ qtest_outl(s, 0xcfc, 0xc000);
+ qtest_outl(s, 0xcf8, 0x80001004);
+ qtest_outw(s, 0xcfc, 0x01);
+ qtest_outw(s, 0xc00b, 0x4100);
+ qtest_outl(s, 0xc00b, 0x0300);
+ qtest_inl(s, 0xc00b);
+ qtest_outl(s, 0xc00b, 0x0800);
+ qtest_outl(s, 0xc00b, 0x0800);
+ qtest_outl(s, 0xc00b, 0x0800);
+ qtest_outl(s, 0xc00b, 0x0800);
+ qtest_outl(s, 0xc00b, 0x0800);
+ qtest_outl(s, 0xc00b, 0x0800);
+ qtest_outl(s, 0xc00b, 0x0800);
+ qtest_outl(s, 0xc00b, 0x0800);
+ qtest_outl(s, 0xc00b, 0x0800);
+ qtest_outl(s, 0xc00b, 0x0800);
+ qtest_outl(s, 0xc00b, 0x0800);
+ qtest_outl(s, 0xc00b, 0x0800);
+ qtest_outl(s, 0xc00b, 0x0800);
+ qtest_outl(s, 0xc00b, 0x0800);
+ qtest_outl(s, 0xc00b, 0x00);
+ qtest_outl(s, 0xc00a, 0x410000);
+ qtest_quit(s);
+}
static void test_cmdfifo_underflow_ok(void)
{
@@ -106,6 +1225,24 @@ int main(int argc, char **argv)
g_test_init(&argc, &argv, NULL);
if (strcmp(arch, "i386") == 0) {
+ qtest_add_func("fuzz/crash_0900379669", crash_0900379669);
+ qtest_add_func("fuzz/crash_094661a91b", crash_094661a91b);
+ qtest_add_func("fuzz/crash_0fff2155cb", crash_0fff2155cb);
+ qtest_add_func("fuzz/crash_1548bd10e7", crash_1548bd10e7);
+ qtest_add_func("fuzz/crash_1afe349482", crash_1afe349482);
+ qtest_add_func("fuzz/crash_1b42581317", crash_1b42581317);
+ qtest_add_func("fuzz/crash_30e28cfa86", crash_30e28cfa86);
+ qtest_add_func("fuzz/crash_34093bfc7c", crash_34093bfc7c);
+ qtest_add_func("fuzz/crash_3a05434a1f", crash_3a05434a1f);
+ qtest_add_func("fuzz/crash_3ab5744bc3", crash_3ab5744bc3);
+ qtest_add_func("fuzz/crash_530ff2e211", crash_530ff2e211);
+ qtest_add_func("fuzz/crash_76ab101171", crash_76ab101171);
+ qtest_add_func("fuzz/crash_7f743a0082", crash_7f743a0082);
+ qtest_add_func("fuzz/crash_87744a2e67", crash_87744a2e67);
+ qtest_add_func("fuzz/crash_9f92a77bd6", crash_9f92a77bd6);
+ qtest_add_func("fuzz/crash_d94dc29565", crash_d94dc29565);
+ qtest_add_func("fuzz/crash_dd24c44f80", crash_dd24c44f80);
+ qtest_add_func("fuzz/crash_df5a21ccf3", crash_df5a21ccf3);
qtest_add_func("am53c974/test_cmdfifo_underflow_ok",
test_cmdfifo_underflow_ok);
qtest_add_func("am53c974/test_cmdfifo_overflow_ok",
--
2.28.0
Thanks again Alex. I've just posted a v3 to the list which fixes your extra test cases, and also those contained within the uaf and hw-esp-oob attachments:
https://lists.gnu.org/archive/html/qemu-devel/2021-04/msg00015.html
This is fixed now, thank you Mark.
Patchset v4:
https://lists.gnu.org/archive/html/qemu-devel/2021-04/msg01000.html
Upstream commits:
https://git.qemu.org/?p=qemu.git;a=commit;h=0db895361b8a82e1114372ff9f48
https://git.qemu.org/?p=qemu.git;a=commit;h=e392255766071c8cac480da3a9ae
https://git.qemu.org/?p=qemu.git;a=commit;h=e5455b8c1c6170c788f3c0fd577c
https://git.qemu.org/?p=qemu.git;a=commit;h=c5fef9112b15c4b5494791cdf8bb
https://git.qemu.org/?p=qemu.git;a=commit;h=7b320a8e67a534925048cbabfa51
https://git.qemu.org/?p=qemu.git;a=commit;h=99545751734035b76bd372c4e721
https://git.qemu.org/?p=qemu.git;a=commit;h=fa7505c154d4d00ad89a747be2ed
https://git.qemu.org/?p=qemu.git;a=commit;h=fbc6510e3379fa8f8370bf71198f
https://git.qemu.org/?p=qemu.git;a=commit;h=0ebb5fd80589835153a0c2baa1b8
https://git.qemu.org/?p=qemu.git;a=commit;h=324c8809897c8c53ad05c3a7147d
https://git.qemu.org/?p=qemu.git;a=commit;h=607206948cacda4a80be5b976dba
|