[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87v9jwm4s7.fsf@x220.int.ebiederm.org>
Date: Fri, 12 Jun 2020 15:02:16 -0500
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Alexey Dobriyan <adobriyan@...il.com>,
Al Viro <viro@...iv.linux.org.uk>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Alexey Gladkov <gladkov.alexey@...il.com>
Subject: Re: [GIT PULL] proc fixes v2 for v5.8-rc1
Linus Torvalds <torvalds@...ux-foundation.org> writes:
> On Fri, Jun 12, 2020 at 12:34 PM Eric W. Biederman
> <ebiederm@...ssion.com> wrote:
>>
>> ebiederm@...ssion.com (Eric W. Biederman) writes:
>
> What happened to that first version of the email? I never got it..
A little distracted I think. I forgot to edit the above line out,
and v2 because it is my second pull request for a proc fix into
v5.8-rc1.
>> Looking at the code the fsnotify watch should have been removed by
>> fsnotify_sb_delete in generic_shutdown_super.
>
> Hmm. Correct. The new_inode_pseudo() is for things that don't have
> quotas, fsnotify or writeback.
>
> That was used somewhat intentionally on /proc, though. /proc certainly
> doesn't have quotas or writeback.
It also means we break our debugging by not putting inodes on the s_inodes list.
AKA this line in generic_shutdown_super is also depent on that behavior.
if (!list_empty(&sb->s_inodes)) {
printk("VFS: Busy inodes after unmount of %s. "
"Self-destruct in 5 seconds. Have a nice day...\n",
sb->s_id);
}
> And fsnotify on /proc seems a bit questionably too. Do people actually
> _do_ this and depend on it, or is this just about syzbot doing
> something odd and thus showing the problem?
>
> Anyway, I have pulled your fix, because I think it's reasonable and
> safe, but I do wonder if we should have kept the new_inode_pseudo(),
> and instead just make fsnotify say "you can't notify on an inode that
> isn't on the superblock list". Hmm?
>
> Is fsnotify on /proc really sensible? Do we actually generate any
> useful notifications?
I don't know of any proc code that does anything to make
fsnotify/inotify work. Since changes to proc are not initialiated
through the vfs that probably means fsnotify is pretty much useless.
I have a sense that a use after free that anyone can trigger could be a
bit dangerous, and despite not being the only virtual filesystem in the
kernel proc is the only virtual filesystem that called new_inode_pseudo.
Eric
Powered by blists - more mailing lists