]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/shared/mount-util.c
mount-util: tweak how we find inaccessible device nodes
authorLennart Poettering <lennart@poettering.net>
Wed, 19 Aug 2020 15:25:33 +0000 (17:25 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 20 Aug 2020 16:15:29 +0000 (18:15 +0200)
commitcbed1dc8af748138ba32f079959c577bfa8365b2
tree99a4298fc74da48b2d8ec7120ff89b27e329aaa7
parent5b14956385ee1076b98c3ca730bb9c1c9e95fc22
mount-util: tweak how we find inaccessible device nodes

On new kernels (>= 5.8) unprivileged users may create the 0:0 character
device node. Which is great, as we can use that as inaccessible device
nodes if we run unprivileged. Hence, change how we find the right
inaccessible device inodes: when the user asks for a block device node,
but we have none, try the char device node first. If that doesn't exist,
fall back to the socket node as before.

This means that:

1. in the best case we'll return a node if the right device node type
2. otherwise we hopefully at least can return a device node if one asked
   for even if the type doesn't match (i.e. we return char instead of
   the requested block device node)
3. in the worst case (old kernels…) we'll return a socket node
src/shared/mount-util.c