[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [for-2.9 2/8] char: Fix socket with "type"
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-block] [Qemu-devel] [for-2.9 2/8] char: Fix socket with "type": "vsock" address |
Date: |
Thu, 30 Mar 2017 08:32:09 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
Marc-André Lureau <address@hidden> writes:
> ----- Original Message -----
>>
>> Hi
>>
>> ----- Original Message -----
>> > Watch this:
>> >
>> > $ qemu-system-x86_64 -nodefaults -S -display none -qmp stdio
>> > {"QMP": {"version": {"qemu": {"micro": 91, "minor": 8, "major": 2},
>> > "package": " (v2.8.0-1195-gf84141e-dirty)"}, "capabilities": []}}
>> > { "execute": "qmp_capabilities" }
>> > {"return": {}}
>> > { "execute": "chardev-add", "arguments": { "id": "chr0", "backend": {
>> > "type": "socket", "data": { "addr": { "type": "vsock", "data": { "cid":
>> > "CID", "port": "P" }}}}}}
>> > Aborted (core dumped)
>> >
>> > Crashes because SocketAddress_to_str() is blissfully unaware of
>> > SOCKET_ADDRESS_KIND_VSOCK. Fix that. Pick the output format to match
>> > socket_parse(), just like the existing formats.
>> >
>> > Cc: Stefan Hajnoczi <address@hidden>
>> > Cc: Paolo Bonzini <address@hidden>
>> > Cc: Marc-André Lureau <address@hidden>
>> > Signed-off-by: Markus Armbruster <address@hidden>
>>
>> Reviewed-by: Marc-André Lureau <address@hidden>
Thanks!
>> > ---
>> > chardev/char-socket.c | 4 ++++
>> > 1 file changed, 4 insertions(+)
>> >
>> > diff --git a/chardev/char-socket.c b/chardev/char-socket.c
>> > index 6344b07..36ab0d6 100644
>> > --- a/chardev/char-socket.c
>> > +++ b/chardev/char-socket.c
>> > @@ -357,6 +357,10 @@ static char *SocketAddress_to_str(const char *prefix,
>> > SocketAddress *addr,
>> > return g_strdup_printf("%sfd:%s%s", prefix, addr->u.fd.data->str,
>> > is_listen ? ",server" : "");
>> > break;
>> > + case SOCKET_ADDRESS_KIND_VSOCK:
>> > + return g_strdup_printf("%svsock:%s:%s", prefix,
>> > + addr->u.vsock.data->cid,
>> > + addr->u.vsock.data->port);
>> > default:
>> > abort();
>>
>> ooch.. may I suggest we don't abort() here? g_return_val_if_fail() perhaps a
>> more judicious choice?
>
> -> g_return_if_reached()
If we reach the default label, program state is messed up, and
continuing is unsafe.
In case we decide we want to push our luck and continue anyway: as far
as I can tell, we don't use g_log() anywhere. We can discuss whether we
have uses for it, but hard freeze is a bad time to actually introduce
it.
- Re: [Qemu-block] [for-2.9 1/8] nbd sockets vnc: Mark problematic address family tests TODO, (continued)
[Qemu-block] [for-2.9 2/8] char: Fix socket with "type": "vsock" address, Markus Armbruster, 2017/03/29
Re: [Qemu-block] [for-2.9 2/8] char: Fix socket with "type": "vsock" address, Stefan Hajnoczi, 2017/03/29
Re: [Qemu-block] [for-2.9 2/8] char: Fix socket with "type": "vsock" address, Max Reitz, 2017/03/29
[Qemu-block] [for-2.9 4/8] block: Document -drive problematic code and bugs, Markus Armbruster, 2017/03/29
[Qemu-block] [for-2.9 7/8] nbd: Tidy up blockdev-add interface, Markus Armbruster, 2017/03/29