Re: [syzbot] [kernfs?] possible deadlock in kernfs_fop_llseek

From: Christoph Hellwig
Date: Fri Apr 05 2024 - 10:52:53 EST


On Fri, Apr 05, 2024 at 03:48:20PM +0200, Christian Brauner wrote:
> * 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.

That's not the point. The poins is that trying to do the dumb name
to bdev translation in early_lookup_bdev is wrong. Distro had and have
their own numbering schemes, and not using them bypasses access
control. We should never use that at runtime.

> <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.

I'm all fine with just accepting a devno and no name. But I fear it
will break something as someone added it for whatever use case they had
(and we should not have allowed that back then, but that ship has sailed
unfortunately)