All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Lizhi Xu <lizhi.xu@windriver.com>
Cc: jack@suse.cz, almaz.alexandrovich@paragon-software.com,
	brauner@kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, ntfs3@lists.linux.dev,
	syzbot+73d8fc29ec7cba8286fa@syzkaller.appspotmail.com,
	syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH] fs: add check for symlink corrupted
Date: Sat, 16 Nov 2024 01:25:40 +0000	[thread overview]
Message-ID: <20241116012540.GY3387508@ZenIV> (raw)
In-Reply-To: <20241116010207.1484956-1-lizhi.xu@windriver.com>

On Sat, Nov 16, 2024 at 09:02:07AM +0800, Lizhi Xu wrote:

> Our idea is the same. Because d_is_symlink() has confirmed the mode of
> symlink in step_into(), I will confirm whether the mode of symlink's inode
> has changed when the value of i_link is 2 in pick_link().
> > 	do something and return
> > 
> > so we are checking whether the inode is a symlink before calling
> > pick_link(). And yes, the d_is_symlink() is using cached type in
> > dentry->d_flags so they could mismatch. But inode is not supposed to change
> > its type during its lifetime so if there is a mismatch that is the problem
> > that needs to be fixed.
> I think syzbot executed the following two syscalls when triggering this problem:
> 
> link(&(0x7f0000000200)='./file0\x00', &(0x7f0000000240)='./bus\x00')
> mount$overlay(0x0, &(0x7f00000000c0)='./bus\x00', 0x0, 0x0, 0x0)
> 
> Obviously, this is to mount a link. Whether the mount operation itself will
> change or corrupt the i_link value and mode value of the symlink is not
> clear to me yet.

Odds are, it's not a valid struct inode instance in the first place.
It's not inode->i_link that is a problem (*nothing* should ever store
that value in there and ntfs doesn't even try that - grep and you'll see);
it's inode itself.

Have you tried KASAN-enabled build?  Might be interesting to see if
it catches anything...

  reply	other threads:[~2024-11-16  1:25 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-14 18:08 [syzbot] [ntfs3?] general protection fault in pick_link syzbot
2024-11-15  8:26 ` [syzbot] " syzbot
2024-11-15  9:49 ` [PATCH] fs: add check for symlink corrupted Lizhi Xu
2024-11-15 11:43   ` Jan Kara
2024-11-16  1:02     ` Lizhi Xu
2024-11-16  1:25       ` Al Viro [this message]
2024-11-15 13:06   ` Al Viro
2024-11-15 13:24     ` Al Viro
2024-11-16  1:39       ` Lizhi Xu
2024-11-16  2:32         ` Al Viro
2024-11-19 11:29           ` [PATCH V2] fs: improve the check of whether i_link has been set Lizhi Xu
2024-11-19 16:36             ` Al Viro
2024-11-20  3:04               ` [PATCH V3] fs/ntfs3: check if the inode is bad before creating symlink Lizhi Xu
2024-11-20 16:10                 ` Al Viro
2024-11-21  3:13                   ` Lizhi Xu
2024-11-21  3:55                     ` Al Viro
2024-11-21  5:27                       ` Lizhi Xu
2024-11-22  7:49                   ` Lizhi Xu
2024-11-22  8:10                     ` [PATCH V4] " Lizhi Xu
2024-11-22 11:50                       ` Jan Kara
2024-11-23  1:09                     ` [PATCH V5] " Lizhi Xu
2024-11-23  1:32                       ` Al Viro
2024-11-24  4:43                         ` [PATCH V6] fs/ntfs3: check if the inode is bad before instantiating dentry Lizhi Xu

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=20241116012540.GY3387508@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizhi.xu@windriver.com \
    --cc=ntfs3@lists.linux.dev \
    --cc=syzbot+73d8fc29ec7cba8286fa@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.