1
The following changes since commit 013a18edbbc59cdad019100c7d03c0494642b74c:
1
The following changes since commit 73e0f70e097b7c92a5ce16ee35b53afe119b20d7:
2
2
3
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-2020051=
3
Merge tag 'pull-lu-20211123' of https://gitlab.com/rth7680/qemu into staging (2021-11-23 11:33:14 +0100)
4
4' into staging (2020-05-14 16:17:55 +0100)
5
4
6
are available in the Git repository at:
5
are available in the Git repository at:
7
6
8
https://github.com/stefanha/qemu.git tags/block-pull-request
7
https://gitlab.com/hreitz/qemu.git tags/pull-block-2021-11-23
9
8
10
for you to fetch changes up to ba607ca8bff4d2c2062902f8355657c865ac7c29:
9
for you to fetch changes up to 4dd218fd0717ed3cddb69c01eeb9da630107d89d:
11
10
12
aio-posix: disable fdmon-io_uring when GSource is used (2020-05-18 18:16:00=
11
iotests/149: Skip on unsupported ciphers (2021-11-23 15:39:12 +0100)
13
+0100)
14
12
15
----------------------------------------------------------------
13
----------------------------------------------------------------
16
Pull request
14
Block patches for 6.2-rc2:
15
- Fix memory leak in vvfat when vvfat_open() fails
16
- iotest fixes for the gnutls crypto backend
17
17
18
----------------------------------------------------------------
18
----------------------------------------------------------------
19
Daniella Lee (1):
20
block/vvfat.c fix leak when failure occurs
19
21
20
Philippe Mathieu-Daud=C3=A9 (6):
22
Hanna Reitz (2):
21
tests/fuzz/Makefile: Do not link code using unavailable devices
23
iotests: Use aes-128-cbc
22
Makefile: List fuzz targets in 'make help'
24
iotests/149: Skip on unsupported ciphers
23
tests/fuzz: Add missing space in test description
24
tests/fuzz: Remove unuseful/unused typedefs
25
tests/fuzz: Extract pciconfig_fuzz_qos() method
26
tests/fuzz: Extract ioport_fuzz_qtest() method
27
25
28
Stefan Hajnoczi (2):
26
block/vvfat.c | 16 ++++++++++++----
29
aio-posix: don't duplicate fd handler deletion in
27
tests/qemu-iotests/149 | 23 ++++++++++++++++++-----
30
fdmon_io_uring_destroy()
28
tests/qemu-iotests/206 | 4 ++--
31
aio-posix: disable fdmon-io_uring when GSource is used
29
tests/qemu-iotests/206.out | 6 +++---
30
tests/qemu-iotests/210 | 4 ++--
31
tests/qemu-iotests/210.out | 6 +++---
32
6 files changed, 40 insertions(+), 19 deletions(-)
32
33
33
Makefile | 6 +++-
34
--
34
tests/qtest/fuzz/Makefile.include | 6 ++--
35
2.33.1
35
include/block/aio.h | 3 ++
36
tests/qtest/fuzz/i440fx_fuzz.c | 47 ++++++++++++++++++++-----------
37
util/aio-posix.c | 13 +++++++++
38
util/aio-win32.c | 4 +++
39
util/async.c | 1 +
40
util/fdmon-io_uring.c | 13 +++++++--
41
8 files changed, 69 insertions(+), 24 deletions(-)
42
36
43
--=20
44
2.25.3
45
37
diff view generated by jsdifflib
1
The glib event loop does not call fdmon_io_uring_wait() so fd handlers
1
From: Daniella Lee <daniellalee111@gmail.com>
2
waiting to be submitted build up in the list. There is no benefit is
3
using io_uring when the glib GSource is being used, so disable it
4
instead of implementing a more complex fix.
5
2
6
This fixes a memory leak where AioHandlers would build up and increasing
3
Function vvfat_open called function enable_write_target and init_directories,
7
amounts of CPU time were spent iterating them in aio_pending(). The
4
and these functions malloc new memory for BDRVVVFATState::qcow_filename,
8
symptom is that guests become slow when QEMU is built with io_uring
5
BDRVVVFATState::used_clusters, and BDRVVVFATState::cluster_buff.
9
support.
10
6
11
Buglink: https://bugs.launchpad.net/qemu/+bug/1877716
7
When the specified folder does not exist ,it may contains memory leak.
12
Fixes: 73fd282e7b6dd4e4ea1c3bbb3d302c8db51e4ccf ("aio-posix: add io_uring fd monitoring implementation")
8
After init_directories function is executed, the vvfat_open return -EIO,
13
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9
and bdrv_open_driver goto label open_failed,
14
Tested-by: Oleksandr Natalenko <oleksandr@redhat.com>
10
the program use g_free(bs->opaque) to release BDRVVVFATState struct
15
Message-id: 20200511183630.279750-3-stefanha@redhat.com
11
without members mentioned.
16
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12
13
command line:
14
qemu-system-x86_64 -hdb <vdisk qcow file> -usb -device usb-storage,drive=fat16
15
-drive file=fat:rw:fat-type=16:"<path of a host folder does not exist>",
16
id=fat16,format=raw,if=none
17
18
enable_write_target called:
19
(gdb) bt
20
at ../block/vvfat.c:3114
21
flags=155650, errp=0x7fffffffd780) at ../block/vvfat.c:1236
22
node_name=0x0, options=0x555556fa45d0, open_flags=155650,
23
errp=0x7fffffffd890) at ../block.c:1558
24
errp=0x7fffffffd890) at ../block.c:1852
25
reference=0x0, options=0x555556fa45d0, flags=40962, parent=0x555556f98cd0,
26
child_class=0x555556b1d6a0 <child_of_bds>, child_role=19,
27
errp=0x7fffffffda90) at ../block.c:3779
28
options=0x555556f9cfc0, bdref_key=0x555556239bb8 "file",
29
parent=0x555556f98cd0, child_class=0x555556b1d6a0 <child_of_bds>,
30
child_role=19, allow_none=true, errp=0x7fffffffda90) at ../block.c:3419
31
reference=0x0, options=0x555556f9cfc0, flags=8194, parent=0x0,
32
child_class=0x0, child_role=0, errp=0x555556c98c40 <error_fatal>)
33
at ../block.c:3726
34
options=0x555556f757b0, flags=0, errp=0x555556c98c40 <error_fatal>)
35
at ../block.c:3872
36
options=0x555556f757b0, flags=0, errp=0x555556c98c40 <error_fatal>)
37
at ../block/block-backend.c:436
38
bs_opts=0x555556f757b0, errp=0x555556c98c40 <error_fatal>)
39
at ../blockdev.c:608
40
errp=0x555556c98c40 <error_fatal>) at ../blockdev.c:992
41
......
42
43
Signed-off-by: Daniella Lee <daniellalee111@gmail.com>
44
Message-Id: <20211119112553.352222-1-daniellalee111@gmail.com>
45
[hreitz: Took commit message from v1]
46
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
17
---
47
---
18
include/block/aio.h | 3 +++
48
block/vvfat.c | 16 ++++++++++++----
19
util/aio-posix.c | 12 ++++++++++++
49
1 file changed, 12 insertions(+), 4 deletions(-)
20
util/aio-win32.c | 4 ++++
21
util/async.c | 1 +
22
4 files changed, 20 insertions(+)
23
50
24
diff --git a/include/block/aio.h b/include/block/aio.h
51
diff --git a/block/vvfat.c b/block/vvfat.c
25
index XXXXXXX..XXXXXXX 100644
52
index XXXXXXX..XXXXXXX 100644
26
--- a/include/block/aio.h
53
--- a/block/vvfat.c
27
+++ b/include/block/aio.h
54
+++ b/block/vvfat.c
28
@@ -XXX,XX +XXX,XX @@ void aio_context_setup(AioContext *ctx);
55
@@ -XXX,XX +XXX,XX @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags,
29
*/
56
30
void aio_context_destroy(AioContext *ctx);
57
qemu_co_mutex_init(&s->lock);
31
58
32
+/* Used internally, do not call outside AioContext code */
59
- ret = 0;
33
+void aio_context_use_g_source(AioContext *ctx);
60
+ qemu_opts_del(opts);
34
+
61
+
35
/**
62
+ return 0;
36
* aio_context_set_poll_params:
63
+
37
* @ctx: the aio context
64
fail:
38
diff --git a/util/aio-posix.c b/util/aio-posix.c
65
+ g_free(s->qcow_filename);
39
index XXXXXXX..XXXXXXX 100644
66
+ s->qcow_filename = NULL;
40
--- a/util/aio-posix.c
67
+ g_free(s->cluster_buffer);
41
+++ b/util/aio-posix.c
68
+ s->cluster_buffer = NULL;
42
@@ -XXX,XX +XXX,XX @@ void aio_context_destroy(AioContext *ctx)
69
+ g_free(s->used_clusters);
43
aio_free_deleted_handlers(ctx);
70
+ s->used_clusters = NULL;
71
+
72
qemu_opts_del(opts);
73
return ret;
44
}
74
}
45
75
@@ -XXX,XX +XXX,XX @@ static int enable_write_target(BlockDriverState *bs, Error **errp)
46
+void aio_context_use_g_source(AioContext *ctx)
76
int size = sector2cluster(s, s->sector_count);
47
+{
77
QDict *options;
48
+ /*
78
49
+ * Disable io_uring when the glib main loop is used because it doesn't
79
- s->used_clusters = calloc(size, 1);
50
+ * support mixed glib/aio_poll() usage. It relies on aio_poll() being
80
+ s->used_clusters = g_malloc0(size);
51
+ * called regularly so that changes to the monitored file descriptors are
81
52
+ * submitted, otherwise a list of pending fd handlers builds up.
82
array_init(&(s->commits), sizeof(commit_t));
53
+ */
83
54
+ fdmon_io_uring_destroy(ctx);
84
@@ -XXX,XX +XXX,XX @@ static int enable_write_target(BlockDriverState *bs, Error **errp)
55
+ aio_free_deleted_handlers(ctx);
85
return 0;
56
+}
86
57
+
87
err:
58
void aio_context_set_poll_params(AioContext *ctx, int64_t max_ns,
88
- g_free(s->qcow_filename);
59
int64_t grow, int64_t shrink, Error **errp)
89
- s->qcow_filename = NULL;
60
{
90
return ret;
61
diff --git a/util/aio-win32.c b/util/aio-win32.c
62
index XXXXXXX..XXXXXXX 100644
63
--- a/util/aio-win32.c
64
+++ b/util/aio-win32.c
65
@@ -XXX,XX +XXX,XX @@ void aio_context_destroy(AioContext *ctx)
66
{
67
}
91
}
68
92
69
+void aio_context_use_g_source(AioContext *ctx)
70
+{
71
+}
72
+
73
void aio_context_set_poll_params(AioContext *ctx, int64_t max_ns,
74
int64_t grow, int64_t shrink, Error **errp)
75
{
76
diff --git a/util/async.c b/util/async.c
77
index XXXXXXX..XXXXXXX 100644
78
--- a/util/async.c
79
+++ b/util/async.c
80
@@ -XXX,XX +XXX,XX @@ static GSourceFuncs aio_source_funcs = {
81
82
GSource *aio_get_g_source(AioContext *ctx)
83
{
84
+ aio_context_use_g_source(ctx);
85
g_source_ref(&ctx->source);
86
return &ctx->source;
87
}
88
--
93
--
89
2.25.3
94
2.33.1
90
95
96
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
Our gnutls crypto backend (which is the default as of 8bd0931f6)
2
supports neither twofish-128 nor the CTR mode. CBC and aes-128 are
3
supported by all of our backends (as far as I can tell), so use
4
aes-128-cbc in our iotests.
2
5
3
Some devices availability depends on CONFIG options.
6
(We could also use e.g. aes-256-cbc, but the different key sizes would
4
Use these options to only link tests when requested device
7
lead to different key slot offsets and so change the reference output
5
is available.
8
more, which is why I went with aes-128.)
6
9
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
10
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
8
Message-id: 20200514143433.18569-2-philmd@redhat.com
11
Message-Id: <20211117151707.52549-2-hreitz@redhat.com>
9
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
13
Tested-by: Thomas Huth <thuth@redhat.com>
10
---
14
---
11
tests/qtest/fuzz/Makefile.include | 6 +++---
15
tests/qemu-iotests/206 | 4 ++--
12
1 file changed, 3 insertions(+), 3 deletions(-)
16
tests/qemu-iotests/206.out | 6 +++---
17
tests/qemu-iotests/210 | 4 ++--
18
tests/qemu-iotests/210.out | 6 +++---
19
4 files changed, 10 insertions(+), 10 deletions(-)
13
20
14
diff --git a/tests/qtest/fuzz/Makefile.include b/tests/qtest/fuzz/Makefile.include
21
diff --git a/tests/qemu-iotests/206 b/tests/qemu-iotests/206
22
index XXXXXXX..XXXXXXX 100755
23
--- a/tests/qemu-iotests/206
24
+++ b/tests/qemu-iotests/206
25
@@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.qcow2') as disk_path, \
26
'encrypt': {
27
'format': 'luks',
28
'key-secret': 'keysec0',
29
- 'cipher-alg': 'twofish-128',
30
- 'cipher-mode': 'ctr',
31
+ 'cipher-alg': 'aes-128',
32
+ 'cipher-mode': 'cbc',
33
'ivgen-alg': 'plain64',
34
'ivgen-hash-alg': 'md5',
35
'hash-alg': 'sha1',
36
diff --git a/tests/qemu-iotests/206.out b/tests/qemu-iotests/206.out
15
index XXXXXXX..XXXXXXX 100644
37
index XXXXXXX..XXXXXXX 100644
16
--- a/tests/qtest/fuzz/Makefile.include
38
--- a/tests/qemu-iotests/206.out
17
+++ b/tests/qtest/fuzz/Makefile.include
39
+++ b/tests/qemu-iotests/206.out
18
@@ -XXX,XX +XXX,XX @@ fuzz-obj-y += tests/qtest/fuzz/fork_fuzz.o
40
@@ -XXX,XX +XXX,XX @@ Format specific information:
19
fuzz-obj-y += tests/qtest/fuzz/qos_fuzz.o
41
20
42
=== Successful image creation (encrypted) ===
21
# Targets
43
22
-fuzz-obj-y += tests/qtest/fuzz/i440fx_fuzz.o
44
-{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "qcow2", "encrypt": {"cipher-alg": "twofish-128", "cipher-mode": "ctr", "format": "luks", "hash-alg": "sha1", "iter-time": 10, "ivgen-alg": "plain64", "ivgen-hash-alg": "md5", "key-secret": "keysec0"}, "file": {"driver": "file", "filename": "TEST_DIR/PID-t.qcow2"}, "size": 33554432}}}
23
-fuzz-obj-y += tests/qtest/fuzz/virtio_net_fuzz.o
45
+{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "qcow2", "encrypt": {"cipher-alg": "aes-128", "cipher-mode": "cbc", "format": "luks", "hash-alg": "sha1", "iter-time": 10, "ivgen-alg": "plain64", "ivgen-hash-alg": "md5", "key-secret": "keysec0"}, "file": {"driver": "file", "filename": "TEST_DIR/PID-t.qcow2"}, "size": 33554432}}}
24
-fuzz-obj-y += tests/qtest/fuzz/virtio_scsi_fuzz.o
46
{"return": {}}
25
+fuzz-obj-$(CONFIG_PCI_I440FX) += tests/qtest/fuzz/i440fx_fuzz.o
47
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
26
+fuzz-obj-$(CONFIG_VIRTIO_NET) += tests/qtest/fuzz/virtio_net_fuzz.o
48
{"return": {}}
27
+fuzz-obj-$(CONFIG_SCSI) += tests/qtest/fuzz/virtio_scsi_fuzz.o
49
@@ -XXX,XX +XXX,XX @@ Format specific information:
28
50
encrypt:
29
FUZZ_CFLAGS += -I$(SRC_PATH)/tests -I$(SRC_PATH)/tests/qtest
51
ivgen alg: plain64
30
52
hash alg: sha1
53
- cipher alg: twofish-128
54
+ cipher alg: aes-128
55
uuid: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
56
format: luks
57
- cipher mode: ctr
58
+ cipher mode: cbc
59
slots:
60
[0]:
61
active: true
62
diff --git a/tests/qemu-iotests/210 b/tests/qemu-iotests/210
63
index XXXXXXX..XXXXXXX 100755
64
--- a/tests/qemu-iotests/210
65
+++ b/tests/qemu-iotests/210
66
@@ -XXX,XX +XXX,XX @@ with iotests.FilePath('t.luks') as disk_path, \
67
},
68
'size': size,
69
'key-secret': 'keysec0',
70
- 'cipher-alg': 'twofish-128',
71
- 'cipher-mode': 'ctr',
72
+ 'cipher-alg': 'aes-128',
73
+ 'cipher-mode': 'cbc',
74
'ivgen-alg': 'plain64',
75
'ivgen-hash-alg': 'md5',
76
'hash-alg': 'sha1',
77
diff --git a/tests/qemu-iotests/210.out b/tests/qemu-iotests/210.out
78
index XXXXXXX..XXXXXXX 100644
79
--- a/tests/qemu-iotests/210.out
80
+++ b/tests/qemu-iotests/210.out
81
@@ -XXX,XX +XXX,XX @@ Format specific information:
82
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
83
{"return": {}}
84
85
-{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"cipher-alg": "twofish-128", "cipher-mode": "ctr", "driver": "luks", "file": {"driver": "file", "filename": "TEST_DIR/PID-t.luks"}, "hash-alg": "sha1", "iter-time": 10, "ivgen-alg": "plain64", "ivgen-hash-alg": "md5", "key-secret": "keysec0", "size": 67108864}}}
86
+{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"cipher-alg": "aes-128", "cipher-mode": "cbc", "driver": "luks", "file": {"driver": "file", "filename": "TEST_DIR/PID-t.luks"}, "hash-alg": "sha1", "iter-time": 10, "ivgen-alg": "plain64", "ivgen-hash-alg": "md5", "key-secret": "keysec0", "size": 67108864}}}
87
{"return": {}}
88
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
89
{"return": {}}
90
@@ -XXX,XX +XXX,XX @@ encrypted: yes
91
Format specific information:
92
ivgen alg: plain64
93
hash alg: sha1
94
- cipher alg: twofish-128
95
+ cipher alg: aes-128
96
uuid: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
97
- cipher mode: ctr
98
+ cipher mode: cbc
99
slots:
100
[0]:
101
active: true
31
--
102
--
32
2.25.3
103
2.33.1
33
104
105
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
Whenever qemu-img or qemu-io report that some cipher is unsupported,
2
skip the whole test, because that is probably because qemu has been
3
configured with the gnutls crypto backend.
2
4
3
List softmmu fuzz targets in 'make help' output:
5
We could taylor the algorithm list to what gnutls supports, but this is
6
a test that is run rather rarely anyway (because it requires
7
password-less sudo), and so it seems better and easier to skip it. When
8
this test is intentionally run to check LUKS compatibility, it seems
9
better not to limit the algorithms but keep the list extensive.
4
10
5
$ make help
11
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
6
...
12
Message-Id: <20211117151707.52549-3-hreitz@redhat.com>
7
Architecture specific targets:
13
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
8
aarch64-softmmu/all - Build for aarch64-softmmu
14
---
9
aarch64-softmmu/fuzz - Build fuzzer for aarch64-softmmu
15
tests/qemu-iotests/149 | 23 ++++++++++++++++++-----
10
alpha-softmmu/all - Build for alpha-softmmu
16
1 file changed, 18 insertions(+), 5 deletions(-)
11
alpha-softmmu/fuzz - Build fuzzer for alpha-softmmu
12
arm-softmmu/all - Build for arm-softmmu
13
arm-softmmu/fuzz - Build fuzzer for arm-softmmu
14
...
15
17
16
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
18
diff --git a/tests/qemu-iotests/149 b/tests/qemu-iotests/149
17
Message-id: 20200514143433.18569-3-philmd@redhat.com
19
index XXXXXXX..XXXXXXX 100755
18
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
20
--- a/tests/qemu-iotests/149
19
---
21
+++ b/tests/qemu-iotests/149
20
Makefile | 6 +++++-
22
@@ -XXX,XX +XXX,XX @@ def create_image(config, size_mb):
21
1 file changed, 5 insertions(+), 1 deletion(-)
23
fn.truncate(size_mb * 1024 * 1024)
24
25
26
+def check_cipher_support(config, output):
27
+ """Check the output of qemu-img or qemu-io for mention of the respective
28
+ cipher algorithm being unsupported, and if so, skip this test.
29
+ (Returns `output` for convenience.)"""
30
+
31
+ if 'Unsupported cipher algorithm' in output:
32
+ iotests.notrun('Unsupported cipher algorithm '
33
+ f'{config.cipher}-{config.keylen}-{config.mode}; '
34
+ 'consider configuring qemu with a different crypto '
35
+ 'backend')
36
+ return output
37
+
38
def qemu_img_create(config, size_mb):
39
"""Create and format a disk image with LUKS using qemu-img"""
40
41
@@ -XXX,XX +XXX,XX @@ def qemu_img_create(config, size_mb):
42
"%dM" % size_mb]
43
44
iotests.log("qemu-img " + " ".join(args), filters=[iotests.filter_test_dir])
45
- iotests.log(iotests.qemu_img_pipe(*args), filters=[iotests.filter_test_dir])
46
+ iotests.log(check_cipher_support(config, iotests.qemu_img_pipe(*args)),
47
+ filters=[iotests.filter_test_dir])
48
49
def qemu_io_image_args(config, dev=False):
50
"""Get the args for access an image or device with qemu-io"""
51
@@ -XXX,XX +XXX,XX @@ def qemu_io_write_pattern(config, pattern, offset_mb, size_mb, dev=False):
52
args = ["-c", "write -P 0x%x %dM %dM" % (pattern, offset_mb, size_mb)]
53
args.extend(qemu_io_image_args(config, dev))
54
iotests.log("qemu-io " + " ".join(args), filters=[iotests.filter_test_dir])
55
- iotests.log(iotests.qemu_io(*args), filters=[iotests.filter_test_dir,
56
- iotests.filter_qemu_io])
57
+ iotests.log(check_cipher_support(config, iotests.qemu_io(*args)),
58
+ filters=[iotests.filter_test_dir, iotests.filter_qemu_io])
59
60
61
def qemu_io_read_pattern(config, pattern, offset_mb, size_mb, dev=False):
62
@@ -XXX,XX +XXX,XX @@ def qemu_io_read_pattern(config, pattern, offset_mb, size_mb, dev=False):
63
args = ["-c", "read -P 0x%x %dM %dM" % (pattern, offset_mb, size_mb)]
64
args.extend(qemu_io_image_args(config, dev))
65
iotests.log("qemu-io " + " ".join(args), filters=[iotests.filter_test_dir])
66
- iotests.log(iotests.qemu_io(*args), filters=[iotests.filter_test_dir,
67
- iotests.filter_qemu_io])
68
+ iotests.log(check_cipher_support(config, iotests.qemu_io(*args)),
69
+ filters=[iotests.filter_test_dir, iotests.filter_qemu_io])
70
71
72
def test_once(config, qemu_img=False):
73
--
74
2.33.1
22
75
23
diff --git a/Makefile b/Makefile
24
index XXXXXXX..XXXXXXX 100644
25
--- a/Makefile
26
+++ b/Makefile
27
@@ -XXX,XX +XXX,XX @@ endif
28
    @$(if $(TARGET_DIRS), \
29
        echo 'Architecture specific targets:'; \
30
        $(foreach t, $(TARGET_DIRS), \
31
-        $(call print-help-run,$(t)/all,Build for $(t));) \
32
+        $(call print-help-run,$(t)/all,Build for $(t)); \
33
+        $(if $(CONFIG_FUZZ), \
34
+            $(if $(findstring softmmu,$(t)), \
35
+                $(call print-help-run,$(t)/fuzz,Build fuzzer for $(t)); \
36
+        ))) \
37
        echo '')
38
    @$(if $(TOOLS), \
39
        echo 'Tools targets:'; \
40
--
41
2.25.3
42
76
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
1
3
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4
Message-id: 20200514143433.18569-4-philmd@redhat.com
5
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6
---
7
tests/qtest/fuzz/i440fx_fuzz.c | 6 +++---
8
1 file changed, 3 insertions(+), 3 deletions(-)
9
10
diff --git a/tests/qtest/fuzz/i440fx_fuzz.c b/tests/qtest/fuzz/i440fx_fuzz.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/tests/qtest/fuzz/i440fx_fuzz.c
13
+++ b/tests/qtest/fuzz/i440fx_fuzz.c
14
@@ -XXX,XX +XXX,XX @@ static void register_pci_fuzz_targets(void)
15
/* Uses simple qtest commands and reboots to reset state */
16
fuzz_add_target(&(FuzzTarget){
17
.name = "i440fx-qtest-reboot-fuzz",
18
- .description = "Fuzz the i440fx using raw qtest commands and"
19
+ .description = "Fuzz the i440fx using raw qtest commands and "
20
"rebooting after each run",
21
.get_init_cmdline = i440fx_argv,
22
.fuzz = i440fx_fuzz_qtest});
23
@@ -XXX,XX +XXX,XX @@ static void register_pci_fuzz_targets(void)
24
/* Uses libqos and forks to prevent state leakage */
25
fuzz_add_qos_target(&(FuzzTarget){
26
.name = "i440fx-qos-fork-fuzz",
27
- .description = "Fuzz the i440fx using raw qtest commands and"
28
+ .description = "Fuzz the i440fx using raw qtest commands and "
29
"rebooting after each run",
30
.pre_vm_init = &fork_init,
31
.fuzz = i440fx_fuzz_qos_fork,},
32
@@ -XXX,XX +XXX,XX @@ static void register_pci_fuzz_targets(void)
33
*/
34
fuzz_add_qos_target(&(FuzzTarget){
35
.name = "i440fx-qos-noreset-fuzz",
36
- .description = "Fuzz the i440fx using raw qtest commands and"
37
+ .description = "Fuzz the i440fx using raw qtest commands and "
38
"rebooting after each run",
39
.fuzz = i440fx_fuzz_qos,},
40
"i440FX-pcihost",
41
--
42
2.25.3
43
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
1
3
These typedefs are not used. Use a simple structure,
4
remote the typedefs.
5
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Message-id: 20200514143433.18569-5-philmd@redhat.com
8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9
---
10
tests/qtest/fuzz/i440fx_fuzz.c | 10 ++++------
11
1 file changed, 4 insertions(+), 6 deletions(-)
12
13
diff --git a/tests/qtest/fuzz/i440fx_fuzz.c b/tests/qtest/fuzz/i440fx_fuzz.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/tests/qtest/fuzz/i440fx_fuzz.c
16
+++ b/tests/qtest/fuzz/i440fx_fuzz.c
17
@@ -XXX,XX +XXX,XX @@ static void i440fx_fuzz_qtest(QTestState *s,
18
* loop over the Data, breaking it up into actions. each action has an
19
* opcode, address offset and value
20
*/
21
- typedef struct QTestFuzzAction {
22
+ struct {
23
uint8_t opcode;
24
uint8_t addr;
25
uint32_t value;
26
- } QTestFuzzAction;
27
- QTestFuzzAction a;
28
+ } a;
29
30
while (Size >= sizeof(a)) {
31
/* make a copy of the action so we can normalize the values in-place */
32
@@ -XXX,XX +XXX,XX @@ static void i440fx_fuzz_qos(QTestState *s,
33
* Same as i440fx_fuzz_qtest, but using QOS. devfn is incorporated into the
34
* value written over Port IO
35
*/
36
- typedef struct QOSFuzzAction {
37
+ struct {
38
uint8_t opcode;
39
uint8_t offset;
40
int devfn;
41
uint32_t value;
42
- } QOSFuzzAction;
43
+ } a;
44
45
static QPCIBus *bus;
46
if (!bus) {
47
bus = qpci_new_pc(s, fuzz_qos_alloc);
48
}
49
50
- QOSFuzzAction a;
51
while (Size >= sizeof(a)) {
52
memcpy(&a, Data, sizeof(a));
53
switch (a.opcode % ACTION_MAX) {
54
--
55
2.25.3
56
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
1
3
Extract the generic pciconfig_fuzz_qos() method from
4
i440fx_fuzz_qos(). This will help to write tests not
5
specific to the i440FX controller.
6
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Message-id: 20200514143433.18569-6-philmd@redhat.com
9
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10
---
11
tests/qtest/fuzz/i440fx_fuzz.c | 20 ++++++++++++++------
12
1 file changed, 14 insertions(+), 6 deletions(-)
13
14
diff --git a/tests/qtest/fuzz/i440fx_fuzz.c b/tests/qtest/fuzz/i440fx_fuzz.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/tests/qtest/fuzz/i440fx_fuzz.c
17
+++ b/tests/qtest/fuzz/i440fx_fuzz.c
18
@@ -XXX,XX +XXX,XX @@ static void i440fx_fuzz_qtest(QTestState *s,
19
flush_events(s);
20
}
21
22
-static void i440fx_fuzz_qos(QTestState *s,
23
+static void pciconfig_fuzz_qos(QTestState *s, QPCIBus *bus,
24
const unsigned char *Data, size_t Size) {
25
/*
26
* Same as i440fx_fuzz_qtest, but using QOS. devfn is incorporated into the
27
@@ -XXX,XX +XXX,XX @@ static void i440fx_fuzz_qos(QTestState *s,
28
uint32_t value;
29
} a;
30
31
- static QPCIBus *bus;
32
- if (!bus) {
33
- bus = qpci_new_pc(s, fuzz_qos_alloc);
34
- }
35
-
36
while (Size >= sizeof(a)) {
37
memcpy(&a, Data, sizeof(a));
38
switch (a.opcode % ACTION_MAX) {
39
@@ -XXX,XX +XXX,XX @@ static void i440fx_fuzz_qos(QTestState *s,
40
flush_events(s);
41
}
42
43
+static void i440fx_fuzz_qos(QTestState *s,
44
+ const unsigned char *Data,
45
+ size_t Size)
46
+{
47
+ static QPCIBus *bus;
48
+
49
+ if (!bus) {
50
+ bus = qpci_new_pc(s, fuzz_qos_alloc);
51
+ }
52
+
53
+ pciconfig_fuzz_qos(s, bus, Data, Size);
54
+}
55
+
56
static void i440fx_fuzz_qos_fork(QTestState *s,
57
const unsigned char *Data, size_t Size) {
58
if (fork() == 0) {
59
--
60
2.25.3
61
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
1
3
Extract generic ioport_fuzz_qtest() method from
4
i440fx_fuzz_qtest(). This will help to write tests
5
not specific to the i440FX controller.
6
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Message-id: 20200514143433.18569-7-philmd@redhat.com
9
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10
---
11
tests/qtest/fuzz/i440fx_fuzz.c | 11 +++++++++--
12
1 file changed, 9 insertions(+), 2 deletions(-)
13
14
diff --git a/tests/qtest/fuzz/i440fx_fuzz.c b/tests/qtest/fuzz/i440fx_fuzz.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/tests/qtest/fuzz/i440fx_fuzz.c
17
+++ b/tests/qtest/fuzz/i440fx_fuzz.c
18
@@ -XXX,XX +XXX,XX @@ enum action_id {
19
ACTION_MAX
20
};
21
22
-static void i440fx_fuzz_qtest(QTestState *s,
23
+static void ioport_fuzz_qtest(QTestState *s,
24
const unsigned char *Data, size_t Size) {
25
/*
26
* loop over the Data, breaking it up into actions. each action has an
27
@@ -XXX,XX +XXX,XX @@ static void i440fx_fuzz_qtest(QTestState *s,
28
flush_events(s);
29
}
30
31
+static void i440fx_fuzz_qtest(QTestState *s,
32
+ const unsigned char *Data,
33
+ size_t Size)
34
+{
35
+ ioport_fuzz_qtest(s, Data, Size);
36
+}
37
+
38
static void pciconfig_fuzz_qos(QTestState *s, QPCIBus *bus,
39
const unsigned char *Data, size_t Size) {
40
/*
41
- * Same as i440fx_fuzz_qtest, but using QOS. devfn is incorporated into the
42
+ * Same as ioport_fuzz_qtest, but using QOS. devfn is incorporated into the
43
* value written over Port IO
44
*/
45
struct {
46
--
47
2.25.3
48
diff view generated by jsdifflib
Deleted patch
1
The io_uring file descriptor monitoring implementation has an internal
2
list of fd handlers that are pending submission to io_uring.
3
fdmon_io_uring_destroy() deletes all fd handlers on the list.
4
1
5
Don't delete fd handlers directly in fdmon_io_uring_destroy() for two
6
reasons:
7
1. This duplicates the aio-posix.c AioHandler deletion code and could
8
become outdated if the struct changes.
9
2. Only handlers with the FDMON_IO_URING_REMOVE flag set are safe to
10
remove. If the flag is not set then something still has a pointer to
11
the fd handler. Let aio-posix.c and its user worry about that. In
12
practice this isn't an issue because fdmon_io_uring_destroy() is only
13
called when shutting down so all users have removed their fd
14
handlers, but the next patch will need this!
15
16
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
17
Tested-by: Oleksandr Natalenko <oleksandr@redhat.com>
18
Message-id: 20200511183630.279750-2-stefanha@redhat.com
19
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
20
---
21
util/aio-posix.c | 1 +
22
util/fdmon-io_uring.c | 13 ++++++++++---
23
2 files changed, 11 insertions(+), 3 deletions(-)
24
25
diff --git a/util/aio-posix.c b/util/aio-posix.c
26
index XXXXXXX..XXXXXXX 100644
27
--- a/util/aio-posix.c
28
+++ b/util/aio-posix.c
29
@@ -XXX,XX +XXX,XX @@ void aio_context_destroy(AioContext *ctx)
30
{
31
fdmon_io_uring_destroy(ctx);
32
fdmon_epoll_disable(ctx);
33
+ aio_free_deleted_handlers(ctx);
34
}
35
36
void aio_context_set_poll_params(AioContext *ctx, int64_t max_ns,
37
diff --git a/util/fdmon-io_uring.c b/util/fdmon-io_uring.c
38
index XXXXXXX..XXXXXXX 100644
39
--- a/util/fdmon-io_uring.c
40
+++ b/util/fdmon-io_uring.c
41
@@ -XXX,XX +XXX,XX @@ void fdmon_io_uring_destroy(AioContext *ctx)
42
43
io_uring_queue_exit(&ctx->fdmon_io_uring);
44
45
- /* No need to submit these anymore, just free them. */
46
+ /* Move handlers due to be removed onto the deleted list */
47
while ((node = QSLIST_FIRST_RCU(&ctx->submit_list))) {
48
+ unsigned flags = atomic_fetch_and(&node->flags,
49
+ ~(FDMON_IO_URING_PENDING |
50
+ FDMON_IO_URING_ADD |
51
+ FDMON_IO_URING_REMOVE));
52
+
53
+ if (flags & FDMON_IO_URING_REMOVE) {
54
+ QLIST_INSERT_HEAD_RCU(&ctx->deleted_aio_handlers, node, node_deleted);
55
+ }
56
+
57
QSLIST_REMOVE_HEAD_RCU(&ctx->submit_list, node_submitted);
58
- QLIST_REMOVE(node, node);
59
- g_free(node);
60
}
61
62
ctx->fdmon_ops = &fdmon_poll_ops;
63
--
64
2.25.3
65
diff view generated by jsdifflib