Bug 235994 - rm can segfault when racing another rm to delete a directory
Summary: rm can segfault when racing another rm to delete a directory
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: coreutils
Version: 5.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Ondrej Vasik
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-04-11 11:31 UTC by Tim Waugh
Modified: 2008-05-21 15:16 UTC (History)
1 user (show)

Fixed In Version: RHBA-2008-0310
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-05-21 15:16:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2008:0310 0 normal SHIPPED_LIVE coreutils bug fix update 2008-05-20 18:53:27 UTC

Description Tim Waugh 2007-04-11 11:31:19 UTC
+++ This bug was initially created as a clone of Bug #235401 +++

Description of problem:

When deleting a deep directory tree from two different instances of "rm -rf"
simultaneously, one of the instances may segfault.

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

coreutils-5.97-12.3.fc6

Steps to Reproduce:
1. Create a deep directory tree (I used 10 levels deep)
2. From two different command lines, rm -rf the parent directory of the tree
3. Repeat (it requires tricky timing so may not always happen)
  
Actual results:

One of the 'rm's will segfault.

Expected results:

Neither of the 'rm's would segfault.

Additional info:

The problem seems to be in remove.c:remove_cwd_entries(), where opendir is
called on ".".  If this fails for reason of ENOENT, the function calls readdir
on the NULL dirp.

Patch attached.

-- Additional comment from dshaw on 2007-04-05 11:54 EST --
Created an attachment (id=151772)
Patch to fix rm segfault

Comment 2 RHEL Program Management 2007-06-05 20:32:10 UTC
This request was evaluated by Red Hat Product Management for
inclusion in a Red Hat Enterprise Linux release.  Since this
bugzilla is in a component that is not approved for the current
release, it has been closed with resolution deferred.  You may
reopen this bugzilla for consideration in the next release.

Comment 4 RHEL Program Management 2007-10-16 04:02:43 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 10 errata-xmlrpc 2008-05-21 15:16:09 UTC
An advisory 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-2008-0310.html



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