From: Christian Brauner <brauner@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Amir Goldstein <amir73il@gmail.com>,
Al Viro <viro@zeniv.linux.org.uk>,
syzbot <syzbot+9a5b0ced8b1bfb238b56@syzkaller.appspotmail.com>,
gregkh@linuxfoundation.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com,
tj@kernel.org, valesini@yandex-team.ru, Jan Kara <jack@suse.cz>,
Miklos Szeredi <miklos@szeredi.hu>
Subject: Re: [syzbot] [kernfs?] possible deadlock in kernfs_fop_llseek
Date: Fri, 5 Apr 2024 15:48:20 +0200 [thread overview]
Message-ID: <20240405-liebschaft-effekt-ca71fb6e7699@brauner> (raw)
In-Reply-To: <20240405-ozonwerte-hungrig-326d97c62e65@brauner>
On Fri, Apr 05, 2024 at 01:19:35PM +0200, Christian Brauner wrote:
> On Fri, Apr 05, 2024 at 08:51:35AM +0200, Christoph Hellwig wrote:
> > On Thu, Apr 04, 2024 at 12:33:40PM +0300, Amir Goldstein wrote:
> > > I don't follow what you are saying.
> > > Which code is in non-starter violation?
> > > kernfs for calling lookup_bdev() with internal of->mutex held?
> >
> > That is a huge problem, and has been causing endless annoying lockdep
> > chains in the block layer for us. If we have some way to kill this
> > the whole block layer would benefit.
>
> Why not just try and add a better resume api that forces resume to not
> use a path argument neither for resume_file nor for writes to
> /sys/power/resume. IOW, extend the protocol what can get written to
> /sys/power/resume and then phase out the path argument. It'll take a
> while but it's a possibly clean solution.
In fact, just looking at this code with a naive set of eyes for a second:
* There's early_lookup_bdev() which deals with PARTUUID,
PARTLABEL, raw device number, and lookup based on /dev. No actual path
lookup involved in that.
* So the only interesting case is lookup_bdev() for /sys/power/suspend.
That one takes arbitrary paths. But being realistic for a moment...
How many people will specify a device path that's _not_ some variant
of /dev/...? IOW, how many people will specify a device path that's
not on devtmpfs or a symlink on devtmpfs? Probably almost no one.
Containers come to mind ofc. But they can't mount devtmpfs so usually
what they do is that they create a tmpfs mount at /dev and then
bind-mount device nodes they need into there. But unprivileged
containers cannot use suspend because that requires init_user_ns
capabilities. And privileged containers that are allowed to hibernate
and use custom paths seem extremly unlikely as well.
So really, _naively_ it seems to me that one could factor out the /dev/*
part of the device number parsing logic in early_lookup_bdev() and port
resume_store() to use that first and only if that fails fall back to
full lookup_bdev(). (Possibly combined with some sort of logging that the
user should use /dev/... paths or at least a way to recognize that this
arbitrary path stuff is actually used.)
And citing from a chat with the hibernation maintainer in systemd:
<brauner> So /sys/power/resume does systemd ever write anything other than a /dev/* path in to there?
<maintainer> Hmm? You never do that? It only accepts devno.
So that takes away one of the main users of this api. So I really
suspect that arbitrary device path is unused in practice. Maybe I'm all
wrong though.
next prev parent reply other threads:[~2024-04-05 13:48 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-03 18:23 [syzbot] [kernfs?] possible deadlock in kernfs_fop_llseek syzbot
2024-04-03 23:51 ` syzbot
2024-04-04 6:54 ` Amir Goldstein
2024-04-04 8:11 ` Al Viro
2024-04-04 8:21 ` Al Viro
2024-04-04 8:40 ` Al Viro
2024-04-04 9:33 ` Amir Goldstein
2024-04-04 22:01 ` Al Viro
2024-04-05 10:34 ` Amir Goldstein
2024-04-05 6:51 ` Christoph Hellwig
2024-04-05 11:19 ` Christian Brauner
2024-04-05 13:48 ` Christian Brauner [this message]
2024-04-05 14:52 ` Christoph Hellwig
2024-04-05 15:41 ` Tejun Heo
2024-04-06 3:54 ` Al Viro
2024-04-05 10:47 ` Christian Brauner
2024-04-05 14:48 ` Amir Goldstein
2024-04-06 4:09 ` Al Viro
2024-04-06 5:25 ` Amir Goldstein
2024-04-05 15:08 ` Amir Goldstein
2024-04-05 15:37 ` syzbot
2024-04-05 16:23 ` Al Viro
2024-04-06 5:34 ` Amir Goldstein
2024-04-06 7:05 ` syzbot
2024-04-06 7:11 ` Al Viro
2024-04-06 8:23 ` Hillf Danton
2024-04-07 0:48 ` Al Viro
2024-04-06 8:57 ` Amir Goldstein
2024-04-07 0:50 ` Al Viro
2024-04-07 11:02 ` Amir Goldstein
2024-04-09 9:18 ` Christian Brauner
2024-04-04 0:42 ` Hillf Danton
2024-04-04 1:08 ` syzbot
2024-04-04 2:12 ` Hillf Danton
2024-04-04 2:39 ` syzbot
2024-04-05 23:00 ` Hillf Danton
2024-04-05 23:02 ` syzbot
2024-04-06 0:10 ` Al Viro
2024-04-05 23:02 ` Hillf Danton
2024-04-06 0:34 ` syzbot
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=20240405-liebschaft-effekt-ca71fb6e7699@brauner \
--to=brauner@kernel.org \
--cc=amir73il@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=syzbot+9a5b0ced8b1bfb238b56@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=tj@kernel.org \
--cc=valesini@yandex-team.ru \
--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 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.