Bug 620300 (CVE-2010-2798) - CVE-2010-2798 kernel: gfs2: rename causes kernel panic
Summary: CVE-2010-2798 kernel: gfs2: rename causes kernel panic
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2010-2798
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 602025 614642 614913 614914 614916
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-08-02 03:03 UTC by Eugene Teo (Security Response)
Modified: 2023-05-12 18:46 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-03-28 08:55:13 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2010:0660 0 normal SHIPPED_LIVE Important: kernel security and bug fix update 2010-08-30 13:10:32 UTC
Red Hat Product Errata RHSA-2010:0670 0 normal SHIPPED_LIVE Important: kernel security and bug fix update 2010-09-02 18:00:25 UTC
Red Hat Product Errata RHSA-2010:0723 0 normal SHIPPED_LIVE Important: kernel security and bug fix update 2010-09-29 14:53:22 UTC

Description Eugene Teo (Security Response) 2010-08-02 03:03:06 UTC
Description of problem:
The problem was in the way the gfs2 directory code was trying to re-use sentinel directory entries.

In the failing case, gfs2's rename function was renaming a file to another name that had the same non-trivial length. The file being renamed happened to be the first directory entry on the leaf block.

First, the rename code (gfs2_rename in ops_inode.c) found the original directory entry and decided it could do its job by simply replacing the directory entry with another.  Therefore it determined correctly that no block allocations were needed.

Next, the rename code deleted the old directory entry prior to replacing it with the new name.  Therefore, the soon-to-be replaced directory entry was temporarily made into a directory entry "sentinel" or a place holder at the start of a leaf block.

Lastly, it went to re-add the replacement directory entry in that leaf block.  However, when gfs2_dirent_find_space was looking for space in the leaf block, it used the wrong value for the sentinel.  That threw off its calculations so later it decides it can't really re-use the sentinel and therefore must allocate a new leaf block.  But because it previously decided to re-use the directory entry, it didn't waste the time to grab a new block allocation for the inode.  Therefore, the inode's i_alloc pointer was still NULL and it crashes trying to reference it.

In the case of sentinel directory entries, the entire dirent is reused, not just the "free space" portion of it, and therefore the function gfs2_dirent_find_space should use the value 0 rather than GFS2_DIRENT_SIZE(0) for the actual dirent size.

Fixing this calculation enables the reproducer programs to work properly.

Comment 2 Eugene Teo (Security Response) 2010-08-02 03:15:07 UTC
Statement:

This issue did not affect the version of Linux kernel as shipped with Red Hat
Enterprise Linux 3, 4 and Red Hat Enterprise MRG as they did not include
support for the GFS2 file system.

A future kernel update in Red Hat Enterprise Linux 5 will address this issue.

Comment 3 Eugene Teo (Security Response) 2010-08-02 03:23:49 UTC
Introduced in upstream commit 71b86f56 (v2.6.19-rc1), and fixed in commit 728a756b.

http://git.kernel.org/linus/71b86f562b5eb6f94ea00bba060caa64d0137969
http://git.kernel.org/linus/728a756b8fcd22d80e2dbba8117a8a3aafd3f203

Comment 4 Eugene Teo (Security Response) 2010-08-20 06:15:56 UTC
Acknowledgements:

Red Hat would like to thank Grant Diffey of CenITex for reporting this issue.

Comment 5 errata-xmlrpc 2010-08-30 13:11:17 UTC
This issue has been addressed in following products:

  Red Hat Enterprise Linux 5.3.Z - Server Only

Via RHSA-2010:0660 https://rhn.redhat.com/errata/RHSA-2010-0660.html

Comment 6 errata-xmlrpc 2010-09-02 17:20:27 UTC
This issue has been addressed in following products:

  Red Hat Enterprise Linux 5.4.Z - Server Only

Via RHSA-2010:0670 https://rhn.redhat.com/errata/RHSA-2010-0670.html

Comment 8 errata-xmlrpc 2010-09-29 14:53:34 UTC
This issue has been addressed in following products:

  Red Hat Enterprise Linux 5

Via RHSA-2010:0723 https://rhn.redhat.com/errata/RHSA-2010-0723.html


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