Bug 720551 - xfs_error_report() oops when passed-in mp is NULL
Summary: xfs_error_report() oops when passed-in mp is NULL
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel
Version: 5.7
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: rc
: ---
Assignee: Eric Sandeen
QA Contact: Boris Ranto
URL:
Whiteboard:
Depends On:
Blocks: 684637 727835
TreeView+ depends on / blocked
 
Reported: 2011-07-12 03:04 UTC by Cui Chun
Modified: 2012-02-21 03:44 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Under some circumstances, error reports within the XFS file system could dereference a NULL pointer causing a kernel panic. This update fixes the NULL pointer dereference, and the kernel panic no longer occurs.
Clone Of:
Environment:
Last Closed: 2012-02-21 03:44:46 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0150 0 normal SHIPPED_LIVE Moderate: Red Hat Enterprise Linux 5.8 kernel update 2012-02-21 07:35:24 UTC

Comment 1 Eric Sandeen 2011-07-12 03:31:11 UTC
So something has gone wrong in xfs_bmbt_insert(), and it called XFS_WANT_CORRUPTED_GOTO, which calls XFS_ERROR_REPORT() with a NULL value for mp.

Eventually this trickles down to xfs_cmn_err() which does:

printk(KERN_ALERT "Filesystem %s: " fmt "\n", (mp)->m_fsname, ## args);

but mp is null.  m_fsname is offset 0x118, so:

> > Unable to handle kernel NULL pointer dereference at 0000000000000118 RIP:  
is what we've hit.

upstream we test for null mp on a similar path:

        if (mp && mp->m_fsname) {
                printk("%sXFS (%s): %pV\n", level, mp->m_fsname, vaf);

but that's after a fairly significant logging rewrite, just testing for mp would be enough I think.

commit a496b81bc57ff2dc2242dfc087b1a0a0582b1447
Author: Dave Chinner <dchinner>
Date:   Fri Dec 17 17:14:47 2010 -0500

    [fs] xfs: remove cmn_err log buffer and lock

looks like it introduced this, since it went from:

-xfs_fs_vcmn_err(int level, xfs_mount_t *mp, char *fmt, va_list ap)
-{
-       if (mp != NULL) {
...
-               sprintf(newfmt, "Filesystem \"%s\": %s", mp->m_fsname, fmt);

to

+#define xfs_fs_cmn_err(lvl, mp, fmt, args...)  \
+       do { \
+               printk(lvl "Filesystem %s: " fmt "\n", (mp)->m_fsname, ## args); \

Comment 2 Eryu Guan 2011-07-12 06:05:38 UTC
This panic comes from xfstests 250(known issue on both rhel5 and rhel6), and I can reproduce it on -246 kernel, which doesn't contain patch "[fs] xfs: remove cmn_err log buffer and lock".

I think this is the rhel5 counterpart for bug 626244.

Comment 3 Qian Cai 2011-07-13 01:23:08 UTC
From developers:

The downside here is that some corruptions will oops when detected.  That's a regression.

Comment 5 Eric Sandeen 2011-07-13 18:26:14 UTC
sent to rhkernel-list on 07/13/2011

Comment 6 Eric Sandeen 2011-07-14 17:07:06 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Under some circumstances, error reports within the XFS filesystem may dereference a NULL pointer and oops.

Comment 9 Jarod Wilson 2011-08-23 14:05:47 UTC
Patch(es) available in kernel-2.6.18-282.el5
You can download this test kernel (or newer) from http://people.redhat.com/jwilson/el5
Detailed testing feedback is always welcomed.

Comment 10 Martin Prpič 2011-09-08 15:01:02 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-Under some circumstances, error reports within the XFS filesystem may dereference a NULL pointer and oops.+Under some circumstances, error reports within the XFS file system could dereference a NULL pointer cause kernel panic. This update fixes the NULL pointer dereference, and kernel panic no longer occurs.

Comment 11 Eric Sandeen 2011-09-08 15:09:52 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-Under some circumstances, error reports within the XFS file system could dereference a NULL pointer cause kernel panic. This update fixes the NULL pointer dereference, and kernel panic no longer occurs.+Under some circumstances, error reports within the XFS file system could dereference a NULL pointer causing a kernel panic. This update fixes the NULL pointer dereference, and the kernel panic no longer occurs.

Comment 14 errata-xmlrpc 2012-02-21 03:44:46 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2012-0150.html


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