All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Edward Adam Davis <eadavis@qq.com>
Cc: syzbot+1aa90f0eb1fc3e77d969@syzkaller.appspotmail.com,
	almaz.alexandrovich@paragon-software.com, brauner@kernel.org,
	jack@suse.cz, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, ntfs3@lists.linux.dev,
	syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH] fs: Prevent non-symlinks from entering pick link
Date: Wed, 18 Jun 2025 06:27:47 +0100	[thread overview]
Message-ID: <20250618052747.GQ1880847@ZenIV> (raw)
In-Reply-To: <20250618050200.GP1880847@ZenIV>

On Wed, Jun 18, 2025 at 06:02:00AM +0100, Al Viro wrote:
> On Wed, Jun 18, 2025 at 05:50:16AM +0100, Al Viro wrote:
> 
> > NAK.  This is not the first time that garbage is suggested and no,
> > we are not going to paper over that shite in fs/namei.c.
> > 
> > Not going to happen.
> > 
> > You ARE NOT ALLOWED to call make_bad_inode() on a live inode, period.
> > Never, ever to be done.
> > 
> > There's a lot of assertions it violates and there's no chance in
> > hell to plaster each with that kind of checks.
> > 
> > Fix NTFS.  End of story.
> 
> To elaborate a bit: if you look at the end of e.g. their attr_set_size(),
> you'll see
> out:
>         if (is_bad) {
> bad_inode:
> 		_ntfs_bad_inode(&ni->vfs_inode);
> 	}
> 	return err;
> }
> 
> This is a bug.  So are similar places all over the place there.
> You are not supposed to use make_bad_inode() as a general-purpose
> "something went wrong, don't wanna see it anymore" tool.
> 
> And as long as it stays there, any fuzzing reports of ntfs are pretty
> much worthless - any of those places (easily located by grepping for
> _ntfs_bad_inode) can fuck the kernel up.  Once ntfs folks get around
> to saner error recovery, it would make sense to start looking into
> fuzzing that thing again.  Until then - nope.  Again, this is *NOT*
> going to be papered over in a random set of places (pretty certain
> to remain incomplete) in VFS.

Note that anything that calls __d_add(dentry, inode) with is_bad_inode(inode)
(or d_add(), or d_instantiate(), or d_splice_alias() under the same conditions)
is also FUBAR.

So's anything that calls make_bad_inode() on a struct inode that might be
in process of being passed to one of those functions by another thread.

This is fundamentally wrong; bad inodes are not supposed to end up attached
to dentries.

  reply	other threads:[~2025-06-18  5:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-17  8:01 [syzbot] [ntfs3?] general protection fault in pick_link (2) syzbot
2025-06-17 12:46 ` Edward Adam Davis
2025-06-17 13:19   ` syzbot
2025-06-18  2:33 ` Edward Adam Davis
2025-06-18  2:55   ` syzbot
2025-06-18  3:03 ` Edward Adam Davis
2025-06-18  3:30   ` syzbot
2025-06-18  3:30 ` [PATCH] fs: Prevent non-symlinks from entering pick link Edward Adam Davis
2025-06-18  4:50   ` Al Viro
2025-06-18  5:02     ` Al Viro
2025-06-18  5:27       ` Al Viro [this message]
2025-06-18  5:34         ` Edward Adam Davis
2025-06-18  6:18           ` Al Viro
2025-06-18  6:53             ` Edward Adam Davis
2025-06-18  7:31               ` [PATCH V2] fs/ntfs3: cancle set bad inode after removing name fails Edward Adam Davis

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=20250618052747.GQ1880847@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=brauner@kernel.org \
    --cc=eadavis@qq.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntfs3@lists.linux.dev \
    --cc=syzbot+1aa90f0eb1fc3e77d969@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.