Bug 235401 - 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: Fedora
Classification: Fedora
Component: coreutils
Version: 6
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: FC6Update
TreeView+ depends on / blocked
 
Reported: 2007-04-05 15:54 UTC by Daphne Shaw
Modified: 2007-11-30 22:12 UTC (History)
1 user (show)

Fixed In Version: 5.97-12.5.fc6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-04-19 08:25:06 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Patch to fix rm segfault (270 bytes, patch)
2007-04-05 15:54 UTC, Daphne Shaw
no flags Details | Diff

Description Daphne Shaw 2007-04-05 15:54:17 UTC
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.

Comment 1 Daphne Shaw 2007-04-05 15:54:17 UTC
Created attachment 151772 [details]
Patch to fix rm segfault

Comment 2 Tim Waugh 2007-04-11 11:33:16 UTC
Thanks for the patch.

Comment 3 Fedora Update System 2007-04-18 22:37:45 UTC
Fixed in update: coreutils-5.97-12.5.fc6


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