linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sasha.levin@oracle.com>
To: Jan Kara <jack@suse.cz>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
	linux-fsdevel@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: fs: gpf in simple_setattr
Date: Fri, 07 Mar 2014 21:14:21 -0500	[thread overview]
Message-ID: <531A7CFD.9030603@oracle.com> (raw)
In-Reply-To: <53189BF8.1010308@oracle.com>

On 03/06/2014 11:02 AM, Sasha Levin wrote:
> On 03/05/2014 07:45 AM, Jan Kara wrote:
>> On Tue 04-03-14 19:00:32, Sasha Levin wrote:
>>> On 03/03/2014 04:40 PM, Jan Kara wrote:
>>>> On Sat 01-03-14 15:05:21, Sasha Levin wrote:
>>>>>> ping again?
>>>>>>
>>>>>> I've been working on it, but don't see an obvious issue.
>>>>>>
>>>>>> It does look like an access to invalid memory easily doable from
>>>>>> userspace, so it should probably get fixed soon...
>>>>    Hum, can you maybe dump the name in dentry passed to simple_setattr()? Or
>>>> maybe even the whole path using dentry_path() (but not sure if that will
>>>> be workable on half-torn-down fs)? Maybe it will give us a hint at which
>>>> filesystem to look...
>>>
>>> It's just garbage, this is why I'm having a hard time making any progress with
>>> this bug.
>>    OK, but that is strange because we hold a reference to the dentry so
>> noone should free it. So dentry->d_name should be valid... Is the rest of
>> the dentry also garbage? E.g. does dentry->d_inode still point to the inode
>> we call __mark_inode_dirty() on? Is dentry->d_sb == dentry->d_inode->i_sb?
>> Also if the inode isn't completely garbage, we can maybe infer something
>> from inode->i_op - that should point to some statically allocated
>> operations struct so we should be able to guess fs type from that.
>
> It's actually pretty tricky. This issue being a race makes catching it at the right time
> difficult.
>
> I've tried catching it in simple_setattr() before calling mark_inode_dirty() by testing
> for the poison values inside inode, but they seem to be perfectly fine there and still
> show up as bad within mark_inode_dirty().
>
> Then I tried trapping it inside mark_inode_dirty(), but at that point I usually get garbage
> inside inode, and have no way to go back to dentry.
>
> Right now I'm just trying to dump everything that goes through simple_setattr() in hopes that
> I could easily figure out what went wrong by looking at the log, but that just stops the bug
> from reproducing.

I've tried the following code in simple_setattr() right before the call to mark_inode_dirty():

         p = dentry_path(dentry, pth, 200);
         printk(KERN_ERR "doh: %s %s\n", p, inode->i_sb->s_type->name);

but it seems that while 'p' ends up being "/", inode->i_sb is garbage and we can't pull out anything
about the file system.

Any way I could get anything useful any other way?


Thanks,
Sasha


  reply	other threads:[~2014-03-08  2:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-19  0:25 fs: gpf in simple_setattr Sasha Levin
2014-01-08 16:00 ` Sasha Levin
2014-03-01 20:05   ` Sasha Levin
2014-03-02  3:35     ` Linus Torvalds
2014-03-03  2:01       ` Sasha Levin
2014-03-03 21:40     ` Jan Kara
2014-03-05  0:00       ` Sasha Levin
2014-03-05 12:45         ` Jan Kara
2014-03-06 16:02           ` Sasha Levin
2014-03-08  2:14             ` Sasha Levin [this message]
2014-03-10 10:43               ` Jan Kara
2014-03-10 14:13                 ` Sasha Levin
2014-03-24 14:42                   ` Sasha Levin
2014-03-24 21:48                     ` Jan Kara
2014-03-25  0:44                       ` Sasha Levin
2014-03-25 17:33                         ` Jan Kara
2014-03-25 17:51                           ` Sasha Levin
2014-03-25 21:12                             ` Jan Kara
2014-03-26  0:12                               ` Sasha Levin
2014-03-26  0:41                               ` Linus Torvalds
2014-03-26  5:34                                 ` Jan Kara
2014-03-26  5:53                               ` Dave Jones
2014-03-26 15:00                                 ` Sasha Levin

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=531A7CFD.9030603@oracle.com \
    --to=sasha.levin@oracle.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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).