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
|
id = 833
title = "linux-user: sendmsg fails to send messages without iov"
state = "opened"
created_at = "2022-01-23T00:38:46.271Z"
closed_at = "n/a"
labels = ["linux-user"]
url = "https://gitlab.com/qemu-project/qemu/-/issues/833"
host-os = "NixOS"
host-arch = "x86_64"
qemu-version = "qemu-x86_64 version 6.2.50 (v6.2.0-1117-gaeb0ae95b7)"
guest-os = "n/a"
guest-arch = "n/a"
description = """When run via qemu `sendmsg` fails to send messages which contain a zero length `iov` but _do_ contain ancillary data. This works fine on plain Linux.
A practical example: the `ell` library relies on this for setting the IV on a kernel crypto (`AF_ALG`) socket: https://git.kernel.org/pub/scm/libs/ell/ell.git/tree/ell/cipher.c#n526
A message without data but only ancillary data is used to set the IV."""
reproduce = """See [qemu_ancillary.c](/uploads/84ee20aa3b9178022847d6cd7fcf0048/qemu_ancillary.c) for a self contained testcase which sends two mesages (one with `msg_iovlen=0`, one with `msg_iovlen=1`).
(Test case is to be considered GPL, as I've copied bits from `ell`)
Native:
```
$ strace -esendmsg ./a.out
sendmsg(6, {msg_name=NULL, msg_namelen=0, msg_iov=NULL, msg_iovlen=0, msg_control=[{cmsg_len=36, cmsg_level=SOL_ALG, cmsg_type=0x2}], msg_controllen=40, msg_flags=0}, 0) = 0
sendmsg(6, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0", iov_len=16}], msg_iovlen=1, msg_control=[{cmsg_len=36, cmsg_level=SOL_ALG, cmsg_type=0x2}], msg_controllen=40, msg_flags=0}, 0) = 16
+++ exited with 0 +++
```
Qemu (observe missing sendmsg call):
```
$ strace -esendmsg ~/debug/qemu/build/qemu-x86_64 ./a.out
sendmsg(6, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0", iov_len=16}], msg_iovlen=1, msg_control=[{cmsg_len=36, cmsg_level=SOL_ALG, cmsg_type=0x2}], msg_controllen=40, msg_flags=0}, 0) = 16
+++ exited with 0 +++
```
For a practical reproducer:
1. Compile and run `ell`'s `test-cipher` test case:
```
$ ~/debug/qemu/build/qemu-x86_64 ./unit/test-cipher
TEST: unsupported
TEST: aes
TEST: aes_ctr
test-cipher: unit/test-cipher.c:102: test_aes_ctr: Assertion `!r' failed.
Aborted (core dumped)
```
A strace will look similar."""
additional = "n/a"
|