From: Andrew Pimlott <andrew@pimlott.net>
To: Willy Tarreau <willy@w.ods.org>
Cc: Ulrich Drepper <drepper@redhat.com>,
Linux Kernel <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>
Subject: Re: [PATCH] O_DIRECTORY|O_CREAT handling
Date: Sun, 28 Dec 2003 13:03:41 -0500 [thread overview]
Message-ID: <20031228180341.GA1134@pimlott.net> (raw)
In-Reply-To: <20031221105110.GA1323@alpha.home.local>
On Sun, Dec 21, 2003 at 11:51:10AM +0100, Willy Tarreau wrote:
> base_dir="/tmp/tmpdir";
> do {
> rnd=random();
> sprintf(dir, "%s%d", base_dir, rnd);
> } while (!mkdir(dir, 0700);
> /* now I'm guaranteed that I'm the first to get this dir, */
> /* and only my UID can work in it */
> chdir(dir);
>
> So the only race would be someone working with the same UID (or root) removing
> the directory and replacing it with another one (or a symlink or anything)
> between mkdir() and chdir().
If /tmp isn't sticky, anyone can do this. I think this is the
scenario Ulrich was referring to.
Andrew
next prev parent reply other threads:[~2003-12-28 18:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-21 9:40 Ulrich Drepper
2003-12-21 10:51 ` Willy Tarreau
2003-12-28 18:03 ` Andrew Pimlott [this message]
2003-12-28 18:25 ` viro
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=20031228180341.GA1134@pimlott.net \
--to=andrew@pimlott.net \
--cc=akpm@osdl.org \
--cc=drepper@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
--cc=willy@w.ods.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
all inboxes | Powered by JetHome®