From: Jason Baron <jbaron@redhat.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: kwolf@redhat.com, Paolo Bonzini <pbonzini@redhat.com>,
aliguori@us.ibm.com, qemu-devel@nongnu.org, quintela@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/3] qtest: Enable creation of multiple qemu instances
Date: Mon, 17 Dec 2012 12:13:59 -0500 [thread overview]
Message-ID: <20121217171359.GA4648@redhat.com> (raw)
In-Reply-To: <CAAu8pHuTrQ8CX4u3+=5qxXQxcKndyf4xFbRJGt2Zs=KrTq+6iQ@mail.gmail.com>
On Sat, Dec 15, 2012 at 09:20:13AM +0000, Blue Swirl wrote:
> On Sat, Dec 15, 2012 at 9:14 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> >> > +#define QTEST_FILE_TEMP "/tmp/qtest-%d.sock"
> >> > +#define QTEST_QMP_FILE_TEMP "/tmp/qtest-%d.qmp"
> >> > +#define QTEST_PID_FILE_TEMP "/tmp/qtest-%d.pid"
> >>
> >> These filenames are too predictable from security point of view,
> >
> > This need not be secure as long as the file is created with 0600
> > permissions. In fact, inspecting the pid file from the shell can
> > be useful.
>
> Permissions do not help at all because the attacker could for example
> target overwriting of a critical file.
>
> >
> > However, using mkstemp() on a prefix that includes the parent pid
> > can indeed be the best of both worlds.
>
> Yes.
>
> >
> > Paolo
>
Yes, but mkstemp() creates the file, and bind() returns EADDRINUSE, if the file
already exists.
Using mktemp() in this case, with bind() should be ok, since bind() checks if
the file exists and then creates it, if not, all within the bind() system call
(so its atomic).
Thanks,
-Jason
next prev parent reply other threads:[~2012-12-17 17:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-13 22:02 [Qemu-devel] [PATCH 0/3] qtest: add migration testing Jason Baron
2012-12-13 22:02 ` [Qemu-devel] [PATCH 1/3] qtest: Enable creation of multiple qemu instances Jason Baron
2012-12-14 20:30 ` Blue Swirl
2012-12-15 9:14 ` Paolo Bonzini
2012-12-15 9:20 ` Blue Swirl
2012-12-17 17:13 ` Jason Baron [this message]
2012-12-19 19:42 ` Blue Swirl
2012-12-13 22:02 ` [Qemu-devel] [PATCH 3/3] qtest: add migrate-test Jason Baron
2012-12-14 8:08 ` Paolo Bonzini
2012-12-14 16:14 ` Jason Baron
2012-12-14 17:25 ` Paolo Bonzini
2012-12-13 22:02 ` [Qemu-devel] [PATCH 2/3] qtest: extend qtest_qmp() to fill in the reply Jason Baron
2012-12-14 0:07 ` Andreas Färber
2012-12-14 16:10 ` Jason Baron
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=20121217171359.GA4648@redhat.com \
--to=jbaron@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=blauwirbel@gmail.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@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).