From: Eric Blake <eblake@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [PATCH] docs: show how to spawn qemu-storage-daemon with fd passing
Date: Mon, 1 Mar 2021 09:49:21 -0600 [thread overview]
Message-ID: <5b86b310-8e3b-8bb6-365c-a73b0f2843be@redhat.com> (raw)
In-Reply-To: <YD0LQ3fDG6t2VRG4@redhat.com>
On 3/1/21 9:41 AM, Daniel P. Berrangé wrote:
> On Mon, Mar 01, 2021 at 03:31:59PM +0000, Stefan Hajnoczi wrote:
>> The QMP monitor, NBD server, and vhost-user-blk export all support file
>> descriptor passing. This is a useful technique because it allows the
>> parent process to spawn and wait for qemu-storage-daemon without busy
>> waiting, which may delay startup due to arbitrary sleep() calls.
>>
>> This Python example is inspired by the test case written for libnbd by
>> Richard W.M. Jones <rjones@redhat.com>:
>> https://gitlab.com/nbdkit/libnbd/-/commit/89113f484effb0e6c322314ba75c1cbe07a04543
>>
>> Thanks to Daniel P. Berrangé <berrange@redhat.com> for suggestions on
>> how to get this working. Now let's document it!
>>
>> + sock_path = '/tmp/qmp-{}.sock'.format(os.getpid())
>
> Example code inevitably gets cut+paste into real world apps, and this
> example is a tmpfile CVE flaw. At least put it in $CWD instead.
Except $CWD may be too long for a sock file name to be created.
Creating the sock in a securely-created subdirectory of /tmp is more
reliable.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2021-03-01 15:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-01 15:31 [PATCH] docs: show how to spawn qemu-storage-daemon with fd passing Stefan Hajnoczi
2021-03-01 15:39 ` Richard W.M. Jones
2021-03-01 15:44 ` Daniel P. Berrangé
2021-03-01 16:50 ` Stefan Hajnoczi
2021-03-01 16:56 ` Daniel P. Berrangé
2021-03-01 17:19 ` Stefan Hajnoczi
2021-03-01 16:53 ` Stefan Hajnoczi
2021-03-01 15:41 ` Daniel P. Berrangé
2021-03-01 15:49 ` Eric Blake [this message]
2021-03-01 16:06 ` Daniel P. Berrangé
2021-03-01 16:55 ` Stefan Hajnoczi
2021-03-02 4:47 ` Markus Armbruster
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=5b86b310-8e3b-8bb6-365c-a73b0f2843be@redhat.com \
--to=eblake@redhat.com \
--cc=berrange@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).