From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Cc: Constantin Musca
<constantinx.musca-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] patch.bbclass: Use one TMPDIR per patching process
Date: Fri, 14 Sep 2012 12:50:50 +0100 [thread overview]
Message-ID: <1347623450.9456.29.camel@ted> (raw)
In-Reply-To: <lyvcfgu9ls.fsf@ensc-virt.intern.sigma-chemnitz.de>
On Fri, 2012-09-14 at 13:28 +0200, Enrico Scholz wrote:
> Constantin Musca
> <constantinx.musca-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> writes:
>
> > + process_tmpdir = os.path.join('/tmp', str(os.getpid()))
> > + if os.path.exists(process_tmpdir):
> > + shutil.rmtree(process_tmpdir)
> > + os.makedirs(process_tmpdir)
>
> ooohhhh... this violates trivial rules regarding secure generation of
> tempfiles. Better use 'mkdtemp()' from the 'tempfile' module.
The problem is that the internal temp directory creation inside patch
can be broken. We *really* don't want to start building patch-native so
this workaround gives patch a fighting chance of not conflicting with
other instances of itself. Its only being used as a prefix, not as the
full directory path name so it isn't quite as insecure as it would first
appear.
I'm fine if we want to use the mkdtemp approach though and further
randomise this. I'd also suggest any updated version adds a comment to
the code about *why* we need a separate TMPDIR and which versions of
patch have this problem.
Cheers,
Richard
next prev parent reply other threads:[~2012-09-14 12:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-12 11:58 [PATCH] patch.bbclass: Use one TMPDIR per patching process Constantin Musca
2012-09-14 11:28 ` Enrico Scholz
2012-09-14 11:50 ` Richard Purdie [this message]
2012-09-14 12:24 ` Enrico Scholz
2012-09-14 13:33 ` Richard Purdie
2012-09-14 13:40 ` Enrico Scholz
2012-09-14 16:00 ` Saul Wold
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=1347623450.9456.29.camel@ted \
--to=richard.purdie@linuxfoundation.org \
--cc=constantinx.musca-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=enrico.scholz@sigma-chemnitz.de \
--cc=openembedded-core@lists.openembedded.org \
/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