From: Laurent Bercot <ska-dietlibc@skarnet.org>
To: musl@lists.openwall.com
Subject: Re: install.sh is wrong with libc.so
Date: Wed, 15 Jan 2014 11:01:39 +0000 [thread overview]
Message-ID: <52D66A93.8030608@skarnet.org> (raw)
In-Reply-To: <5905c9fb-9fc8-4cf1-ac29-ed830c8ae5a1@email.android.com>
> umask 077
> cat < lib/libc.so > /lib/libc.so.tmp.pid # /lib/libc.so.tmp.pid is created with mode 600
> mv -f /lib/libc.so.tmp.pid /lib/libc.so
> chmod 755 /lib/libc.so # failed with "Permission denied"
Very funny bug ^^
I'm curious of the thought process behind that code:
- why cat instead of cp ? I guess it's to avoid the implementation-defined behaviour
of cp wrt. rights of the destination file, whereas >'s behaviour is guaranteed.
- but an explicit chmod is needed anyway.
- why perform the chmod after the mv, since mv is guaranteed to be a rename() in that
case, the rights will be preserved ? Is there a possibility of someone abusing the
temp file if it is 0755, knowing it is owned by root anyway ?
chmoding the temp file before the mv -f, instead of /lib/libc.so at the end, looks
like the obvious and simplest fix, but I'm wondering whether I missed something.
--
Laurent
next prev parent reply other threads:[~2014-01-15 11:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-15 8:42 orc
2014-01-15 11:01 ` Laurent Bercot [this message]
2014-01-15 11:35 ` Christian Wiese
2014-01-15 11:52 ` orc
2014-01-15 12:58 ` Christian Wiese
2014-01-15 12:13 ` Szabolcs Nagy
2014-01-15 12:48 ` orc
2014-01-15 14:18 ` Szabolcs Nagy
2014-01-15 16:31 ` Rich Felker
2014-01-16 1:34 ` orc
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=52D66A93.8030608@skarnet.org \
--to=ska-dietlibc@skarnet.org \
--cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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).