From: Theodore Ts'o <tytso@mit.edu>
To: Nikhilesh Reddy <reddyn@codeaurora.org>
Cc: linux-ext4@vger.kernel.org, darrick.wong@oracle.com
Subject: Re: Null pointer dereference of s_chksum_driver in ext4_chksum
Date: Sun, 3 May 2015 17:37:00 -0400 [thread overview]
Message-ID: <20150503213700.GL10014@thunk.org> (raw)
In-Reply-To: <5546810E.7070607@codeaurora.org>
On Sun, May 03, 2015 at 01:11:58PM -0700, Nikhilesh Reddy wrote:
> Please find additional details below:
>
> This occurred in while de-referencing the sbi->s_chksum_driver member of
> the superblock info.
>
> This occurs during a bootup mount
>
> 10.216919: <6> EXT4-fs (mmcblk0p22): mounted filesystem with ordered
> data mode. Opts: barrier=1,discard
> 10.225032: <6> SELinux: initialized (dev mmcblk0p22, type ext4),
> uses xattr
> 10.235901: <6> EXT4-fs (mmcblk0p29): Ignoring removed
> nomblk_io_submit option
> 10.341141: <6> Unable to handle kernel NULL pointer dereference
> at virtual address 00000000
I'd have to actually see the full file system to understand what is
going on, but what I suspect is happening is that the file system has
been corrupted in at least two different ways. The first is that
there the journal inode is corrupted; this is what's causing the call
to ext4_error_inode() from a call to jbd2_journal_bmap().
The *second* thing which is going on is that before we noticed the
corrupted journal inode, the journal contained a copy of the
superblock which we replayed that _set_ the metadata checksum feature
flag. Since it wasn't set originally when file system was initially
mounted, s_chksum_driver wasn't initialized, and this cuases the NULL
pointer deference.
Avoiding the kernel crash was fixed by accident in 3.18 with the
following commit: 9aa5d32ba269 ("Replace open coded mdata csum feature
to helper function"), since instead of actually checking to see if the
metadata checksum field is set, it uses as its primary mechanism
checking to see if s_chksum_driver is non-NULL. There is a
WARN_ON_ONCE that will trip in the situation where the feature flag is
set and s_chksum_driver is NULL, but that really is a "should never
happen" situation. The only scenario I can think of where this might
have happened is the one I described above, where it was enabled by a
journal replay.
This should be sufficient to avoid the crash, but I haven't had the
chance to try creating a file system corrupted the way I conjecture it
was corrupted, and see whether it we correctly fail the mount (which
is clearly what should happen if we discover a corrupted journal inode
while replaying the journal during the mount.)
- Ted
next prev parent reply other threads:[~2015-05-03 21:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-01 19:48 Null pointer dereference of s_chksum_driver in ext4_chksum Nikhilesh Reddy
2015-05-03 20:11 ` Nikhilesh Reddy
2015-05-03 21:37 ` Theodore Ts'o [this message]
2015-05-04 19:35 ` Nikhilesh Reddy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150503213700.GL10014@thunk.org \
--to=tytso@mit.edu \
--cc=darrick.wong@oracle.com \
--cc=linux-ext4@vger.kernel.org \
--cc=reddyn@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).