Bug 238121 - rm can segfault when racing another rm to delete a directory
rm can segfault when racing another rm to delete a directory
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: coreutils (Show other bugs)
4.4
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-04-27 06:30 EDT by Bryn M. Reeves
Modified: 2010-10-22 10:35 EDT (History)
1 user (show)

See Also:
Fixed In Version: RHBA-2007-0786
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-11-15 11:09:28 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)
patch to fix rm segfault (273 bytes, patch)
2007-04-27 06:52 EDT, Bryn M. Reeves
no flags Details | Diff

  None (edit)
Description Bryn M. Reeves 2007-04-27 06:30:28 EDT
+++ This bug was initially created as a clone of Bug #235994 +++

+++ That 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@jabberwocky.com on 2007-04-05 11:54 EST --
Created an attachment (id=151772)
Patch to fix rm segfault
Comment 1 Bryn M. Reeves 2007-04-27 06:52:17 EDT
Created attachment 153598 [details]
patch to fix rm segfault
Comment 8 errata-xmlrpc 2007-11-15 11:09:28 EST
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-2007-0786.html

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