[uClibc-cvs] [uClibc 0000116]: mkstemp fails in chroot environment because /dev/[u]random might not be available
bugs at busybox.net
bugs at busybox.net
Sat Apr 16 04:00:07 UTC 2005
The following issue has been CLOSED
======================================================================
<http://busybox.net/bugs/view.php?id=116>
======================================================================
Reported By: dicksnippe
Assigned To: uClibc
======================================================================
Project: uClibc
Issue ID: 116
Category: Other
Reproducibility: always
Severity: major
Priority: normal
Status: closed
Resolution: open
Fixed in Version:
======================================================================
Date Submitted: 02-18-2005 11:49 PST
Last Modified: 04-15-2005 21:00 PDT
======================================================================
Summary: mkstemp fails in chroot environment because
/dev/[u]random might not be available
Description:
In the latest uClibc (0.9.27) there's an issue with any recent rsync
version:
rsync might chroot to any directory (basically whatever is configured as
"path" option in /etc/rsyncd.conf) before it starts doing it's thing.
During execution rsync calls mkstemp (or mktemp) inside a chrooted
environment.
The uClibc environment of mkstemp/mktemp tries to read /dev/urandom (or
/dev/random) to generate random contents for the .XXXXXX part of its
argument.
In a chrooted environment /dev/[u]random might not be available.
Because of this the mkstemp call fails and returns "-1" and rsync fails
and
issues something along the lines of:
rsync: mkstemp ".tmp.XXXXXX" (in <module>) failed: File exists (17)
imho this is a bug in uClibc and not in rsync. mkstemp should not depend
on
/dev/[u]random. Perhaps, instead it should fall back (like glibc) on
gettimeofday(2) and getpid(2) for providing randomness instead of
failing.
PS: uClibc and busybox are great! We (= isp) use them to build an initrd
environment to boot +/- 200 servers. uClibc+busybox have decimated the
time we need to install a new server from a week to 5 minutes! Please keep
up the good work.
======================================================================
----------------------------------------------------------------------
vapier - 02-21-05 00:53
----------------------------------------------------------------------
down in libc/misc/internals/tempname.c, we could modify fillrand() to use
something stupid like gettimeofday() as a fallback for when /dev/urandom
and /dev/random are unavailable ...
----------------------------------------------------------------------
vapier - 04-15-05 21:00
----------------------------------------------------------------------
added back in the gettimeofday / getpid code as a fall back for when
reading the random nodes in /dev/ fail
Issue History
Date Modified Username Field Change
======================================================================
02-18-05 11:49 dicksnippe New Issue
02-18-05 11:49 dicksnippe File Added: mkstemp.c
02-21-05 00:53 vapier Note Added: 0000052
02-21-05 00:53 vapier Issue Monitored: vapier
03-16-05 11:56 andersen Assigned To andersen => uClibc
04-15-05 21:00 vapier Status assigned => closed
04-15-05 21:00 vapier Note Added: 0000148
======================================================================
More information about the uClibc-cvs
mailing list