Bug 205618 - CVE-2006-4342 shmat hangs by simultaneous shmctl(IPC_RMID)
CVE-2006-4342 shmat hangs by simultaneous shmctl(IPC_RMID)
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: kernel (Show other bugs)
All Linux
high Severity high
: ---
: ---
Assigned To: Sachin Prabhu
Brian Brock
: Security
Depends On:
  Show dependency treegraph
Reported: 2006-09-07 13:09 EDT by Issue Tracker
Modified: 2010-10-22 01:58 EDT (History)
5 users (show)

See Also:
Fixed In Version: RHSA-2006-0710
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-10-19 08:45:30 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Reproducer (675 bytes, application/x-gzip)
2006-09-07 13:11 EDT, Sachin Prabhu
no flags Details
Proposed Patch (1.62 KB, patch)
2006-09-07 13:12 EDT, Sachin Prabhu
no flags Details | Diff
Proposed Patch (1.92 KB, patch)
2006-09-15 02:54 EDT, Sachin Prabhu
no flags Details | Diff
Proposed Patch (1.94 KB, patch)
2006-09-19 02:20 EDT, Sachin Prabhu
no flags Details | Diff

  None (edit)
Description Issue Tracker 2006-09-07 13:09:26 EDT
Escalated to Bugzilla from IssueTracker
Comment 6 Sachin Prabhu 2006-09-07 13:12:04 EDT
Created attachment 135788 [details]
Proposed Patch
Comment 12 Sachin Prabhu 2006-09-15 02:54:43 EDT
Created attachment 136333 [details]
Proposed Patch

Added write locks around kfree to resolve a memory corruption issue.
Comment 14 Sachin Prabhu 2006-09-19 02:20:02 EDT
Created attachment 136605 [details]
Proposed Patch

moved br_write_lock and unlock to ipc_unlock_deleted
Comment 15 Sachin Prabhu 2006-09-20 03:51:01 EDT
Deadlock happens on smp machines when a shmat() function runs at the same time
that shmctl() is used to remove the same shm. While the shmat process waits at
the spinlock in ipc_lock function, the shmctl function deletes the path to the
kern_ipc_perm structure which holds the spinlock variable and frees the memory
location. Because of this, the ipc_unlock() run for shmctl() does not unlock the
spinlock and the shmat waits indefinitely at the spinlock.

This is serious issue for RHEL3 users especially applications using IPC
shared-memory. This deadlock brings other deadlock in IPC features (ex. IPC
semaphore) since deadlocked process holds readlock of BR_SEMAPHORE_LOCK which
are shared by all IPC features.

The code in question was backported from the 2.5 kernel with the patch
linux-2.4.21-semaphore-scale.patch by Ingo Molnar. This code does not appear
upstream in the 2.4 kernels. The Red Hat implementation on the 2.4 kernel is
done using 'Big Reader' read-write locks. The patch was written by modifying the
code from the patch provided in bz # 91146 to use brlocks.  The attached
reproducer recreates the issue.
Comment 22 Ernie Petrides 2006-09-22 21:08:09 EDT
A fix for this problem has just been committed to the RHEL3 U9
patch pool this evening (in kernel version 2.4.21-47.1.EL).
Comment 28 Ernie Petrides 2006-10-13 17:51:20 EDT
A fix for this problem has also been committed to the RHEL3 E9
patch pool this evening (in kernel version 2.4.21-47.0.1.EL).
Comment 34 Red Hat Bugzilla 2006-10-19 08:45:32 EDT
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.


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