1*84604595SDaniel P. Berrangé /*
2*84604595SDaniel P. Berrangé  * QTest test cases for virtio balloon device
3*84604595SDaniel P. Berrangé  *
4*84604595SDaniel P. Berrangé  * Copyright (c) 2024 Gao Shiyuan <gaoshiyuan@baidu.com>
5*84604595SDaniel P. Berrangé  *
6*84604595SDaniel P. Berrangé  * SPDX-License-Identifier: GPL-2.0-or-later
7*84604595SDaniel P. Berrangé  */
8*84604595SDaniel P. Berrangé 
9*84604595SDaniel P. Berrangé #include "qemu/osdep.h"
10*84604595SDaniel P. Berrangé #include "libqtest.h"
11*84604595SDaniel P. Berrangé 
12*84604595SDaniel P. Berrangé /*
13*84604595SDaniel P. Berrangé  * https://gitlab.com/qemu-project/qemu/-/issues/2576
14*84604595SDaniel P. Berrangé  * Used to trigger:
15*84604595SDaniel P. Berrangé  *   virtio_address_space_lookup: Assertion `mrs.mr' failed.
16*84604595SDaniel P. Berrangé  */
17*84604595SDaniel P. Berrangé static void oss_fuzz_71649(void)
18*84604595SDaniel P. Berrangé {
19*84604595SDaniel P. Berrangé     QTestState *s = qtest_init("-device virtio-balloon -machine q35"
20*84604595SDaniel P. Berrangé                                " -nodefaults");
21*84604595SDaniel P. Berrangé 
22*84604595SDaniel P. Berrangé     qtest_outl(s, 0xcf8, 0x80000890);
23*84604595SDaniel P. Berrangé     qtest_outl(s, 0xcfc, 0x2);
24*84604595SDaniel P. Berrangé     qtest_outl(s, 0xcf8, 0x80000891);
25*84604595SDaniel P. Berrangé     qtest_inl(s, 0xcfc);
26*84604595SDaniel P. Berrangé     qtest_quit(s);
27*84604595SDaniel P. Berrangé }
28*84604595SDaniel P. Berrangé 
29*84604595SDaniel P. Berrangé int main(int argc, char **argv)
30*84604595SDaniel P. Berrangé {
31*84604595SDaniel P. Berrangé     g_test_init(&argc, &argv, NULL);
32*84604595SDaniel P. Berrangé 
33*84604595SDaniel P. Berrangé     qtest_add_func("virtio-balloon/oss_fuzz_71649", oss_fuzz_71649);
34*84604595SDaniel P. Berrangé 
35*84604595SDaniel P. Berrangé     return g_test_run();
36*84604595SDaniel P. Berrangé }
37*84604595SDaniel P. Berrangé 
38