linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: bugzilla-daemon@bugzilla.kernel.org
To: linux-ext4@vger.kernel.org
Subject: [Bug 202897] BUG: unable to handle kernel paging request at __memmove
Date: Sun, 24 Mar 2019 05:28:40 +0000	[thread overview]
Message-ID: <bug-202897-13602-8IXBluNGKu@https.bugzilla.kernel.org/> (raw)
In-Reply-To: <bug-202897-13602@https.bugzilla.kernel.org/>

https://bugzilla.kernel.org/show_bug.cgi?id=202897

Theodore Tso (tytso@mit.edu) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tytso@mit.edu

--- Comment #6 from Theodore Tso (tytso@mit.edu) ---
The patch in #4 looks closer to the right thing.  In fact, this should do:

diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index dc82e7757f67..491f9ee4040e 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1696,7 +1696,7 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info
*i,

        /* No failures allowed past this point. */

-       if (!s->not_found && here->e_value_size && here->e_value_offs) {
+       if (!s->not_found && here->e_value_size && !here->e_value_inum) {
                /* Remove the old value. */
                void *first_val = s->base + min_offs;
                size_t offs = le16_to_cpu(here->e_value_offs);


That's because if e_value_inum==0, then here->e_value_offs is guaranteed to be
non-zero --- otherwise it would have failed a check in earlier in
ext4_xattr_check_entries().  In the case where e_value_inum !=0,
here->e_value_offs must be zero.  We're currently however, not checking it both
in the kernel and in e2fsck.  We're just ignoring in all other cases when
!e_value_inum.   Why we're ignoring e_value_offs and not doing a check I'm not
sure.  I want to dig back through some older e-mail discussions and see if I
can get the original developer who did ea_inode feature to see if he knows of
some reason why we're not enforcing that check.    My preference would be to
enforce that check and fail the inode as corrupt, but there may be something
I'm missing. 

There are also a large number of other tests which we're not enforcing in the
kernel that I'm strongly considering adding.   The root inode is being used as
a ea_inode value --- and that should have been rejected, except the
EXT4_EA_INODE_FL flag was set on inode #2.   But in that case, we probably
should reject all files that are reachable from the name space (e.g., all
directories, regular files, etc.) that have EXT4_EA_INODE_FL; that should never
happen.   If we did that, the file system would have never successfully
mounted, so we wouldn't have tripped this particular memmove case.   Which is
good in production, but it does make it harder for fuzzers to find legitimate
real bugs, since we block them much earlier in the process.    In this
particular case, the fact that we have e_value_inum pointing at a root
directory is not the reason why we BUG'ed on the memmove.  It's because
e_value_offs was non-zero when e_value_inum was also non-zero, and that's not
supposed to ever happen.  

I should probably also make the kernel more strict about having both a journal
UUID and a journal inum set at the same time.  That's again one of those
"should never happen situations".

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

  parent reply	other threads:[~2019-03-24  5:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13  6:51 [Bug 202897] New: BUG: unable to handle kernel paging request at __memmove bugzilla-daemon
2019-03-13  6:51 ` [Bug 202897] " bugzilla-daemon
2019-03-15 14:15 ` bugzilla-daemon
2019-03-15 16:00 ` bugzilla-daemon
2019-03-20  0:23 ` bugzilla-daemon
2019-03-21  0:40 ` bugzilla-daemon
2019-03-24  5:28 ` bugzilla-daemon [this message]
2019-04-05 20:16 ` bugzilla-daemon
2019-04-05 21:37 ` bugzilla-daemon
2019-04-05 22:42 ` bugzilla-daemon

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=bug-202897-13602-8IXBluNGKu@https.bugzilla.kernel.org/ \
    --to=bugzilla-daemon@bugzilla.kernel.org \
    --cc=linux-ext4@vger.kernel.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).