From: Markus Armbruster <armbru@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: "xiaoqiang zhao" <zxq_yx_007@163.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: Our abstract UNIX domain socket support is a mess
Date: Fri, 30 Oct 2020 11:30:42 +0100 [thread overview]
Message-ID: <87zh44uht9.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20201029160744.GB6271@merkur.fritz.box> (Kevin Wolf's message of "Thu, 29 Oct 2020 17:07:44 +0100")
Kevin Wolf <kwolf@redhat.com> writes:
> Am 29.10.2020 um 15:02 hat Daniel P. Berrangé geschrieben:
>> On Wed, Oct 28, 2020 at 01:41:06PM +0100, Markus Armbruster wrote:
[...]
>> > Issue#1: our interface is differently ugly, for no good reason
>> >
>> > Like the Linux kernel, we also appropriate existing @path for abstract
>> > sockets. With less excuse, though; we could have created a neater
>> > interface, easily.
>> >
>> > Unlike the Linux kernel, we don't do blobs. In other words, our variant
>> > of the hack is not general.
>>
>> The Linux kernel interface is low level and not the way any userspace
>> application exposes the use of abstract sockets. No one wants to
>> specify an abstract socket by listing all 108 characters with many
>> trailing nuls. It would be insane to do this.
>>
>> There are two ways userspace apps expose abstract socket config.
>>
>> Either using a leading "@" as a magic substitute for NUL and not
>> supporting a coibfigurable way to distinguish truncated vs full
>> length, just define the desired behaviour for their app. THis is
>> what dbus does to denote its abstract socket paths.
>
> Using magic characters in strings to distinguish different types of
> objects is always wrong in QAPI. If we interpreted leading '@' this way,
> you wouldn't be able to specify a relative filename starting with '@'
> any more.
>
>> Or, just or by having explicit flags "abstract" and "tight" to
>> control the behaviour. The latter is what 'socat' does to allow
>> use of abstract sockets.
>>
>> For QEMU the former approach gives broad interoperabiltiy with
>> userspace applications, so made more sense than using magic "@".
>
> Boolean flags to distinguish different types are better than parsing
> strings, but still not optimal. Documentation like "only matters for
> abstract sockets" is another hint that we're treating things the same
> that aren't the same.
>
> The proper way to distinguish two different types is unions. So I think
Yes.
> the ideal interface would be another SocketAddress variant that could
> then also use base64 instead of str to represent arbitrary blobs, like
> Markus suggested below.
There are no impossible combinations to ignore or reject, and to
document. Instead, introspection tells the whole story.
Done this way, we could easily support both a (string, bool tight) for
convenience and base64 blob for generality, if we want to.
But I stand by my opinion that the feature is simply not worth its keep.
To make me reconsider, show me actual uses.
> Probably too late now.
It's too late if we decide it is.
>> > Elsewhere in QMP, we use base64 for blobs.
>> >
>> > Aside: QMP can do embedded 0 bytes. It represents them as overlong
>> > UTF-8 “\xC0\x80", though.
>> >
>> > Not sure the interface is worth fixing now. Abstract sockets are niche.
>> > In my opinion, we should've said no.
>>
>> The interface doesn't need fixing - the way it is represented in
>> QEMU is much saner than the low level struct sockaddr_un representation
>> used to talk to the kernel, and is common with other userspace apps.
>>
>> The use case is to enable interoperability with other apps that use
>> an abstract socket.
>
> Kevin
prev parent reply other threads:[~2020-10-30 10:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-28 12:41 Our abstract UNIX domain socket support is a mess Markus Armbruster
2020-10-29 14:02 ` Daniel P. Berrangé
2020-10-29 16:07 ` Kevin Wolf
2020-10-29 18:47 ` Eric Blake
2020-10-30 9:16 ` Daniel P. Berrangé
2020-10-30 10:30 ` Markus Armbruster [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zh44uht9.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=zxq_yx_007@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.