Bug 118251 - prelink mishandles temp files if /usr mounted read-only
prelink mishandles temp files if /usr mounted read-only
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: prelink (Show other bugs)
1
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-03-14 10:46 EST by Robert Nichols
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version: 0.3.1-2
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-03-17 07:49:53 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Robert Nichols 2004-03-14 10:46:29 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1)
Gecko/20031114

Description of problem:
The scheduled daily prelink job blows up when it attempts to process
binaries on a read-only file system.  When the attempt to create a
temporary file in the current directory fails, the temp file is
created in /tmp.  This is pointless if /tmp is on a different file
system because a subsequent rename will fail due to an invalid
cross-device link.  The big problem is that prelink then fails to
remove the temp file it created.  If there have been major updates, it
is likely that the file system for /tmp will run out of space.  After
this, the full file system causes failures in various other tasks on
the system.

Version-Release number of selected component (if applicable):
prelink-0.3.0-13

How reproducible:
Always

Steps to Reproduce:
1. Run "/usr/sbin/prelink -fav -mR" on a system with /usr mounted
read-only.


Actual Results:  A large number of messages of the form:
  /usr/sbin/prelink: Could not rename temporary to
/usr/X11R6/lib/libX11.so.6.2: Invalid cross-device link

A large number of temporary files are left in /tmp.

The file system containing /tmp runs out of space if it is not large
enough to contain a copy of all of the binaries in /usr.

Expected Results:  Prelink should gracefully fail when it cannot
create a temporary file on the same filesystem as the binary it is
processing.

Additional info:
Comment 1 Jakub Jelinek 2004-03-15 09:31:30 EST
--- prelink/src/dso.c~  2004-03-15 15:34:13.034559500 +0100
+++ prelink/src/dso.c   2004-03-15 15:34:13.034559500 +0100
@@ -1735,10 +1735,14 @@ update_dso (DSO *dso)
       utime (name2, &u);

       if (set_security_context (dso, name2, name1))
-       return 1;
+        {
+         unlink (name2);
+         return 1;
+       }

       if (rename (name2, name1))
        {
+         unlink (name2);
          error (0, errno, "Could not rename temporary to %s", name1);
          return 1;
        }

should fix this.  I'll include it in 0.3.1-2.
Comment 2 Jay Turner 2004-09-02 01:19:46 EDT
An errata has been issued which should help the problem 
described in this bug report. This report is therefore being 
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, 
please follow the link below. You may reopen this bug report 
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2004-386.html

Note You need to log in before you can comment on or make changes to this bug.