]> git.ipfire.org Git - thirdparty/systemd.git/commit
tmpfiles: don't resolve pathnames when traversing recursively through directory trees
authorFranck Bui <fbui@suse.com>
Fri, 2 Mar 2018 16:19:32 +0000 (17:19 +0100)
committerFranck Bui <fbui@suse.com>
Mon, 5 Mar 2018 18:00:11 +0000 (19:00 +0100)
commit936f6bdb803c432578e2cdcc5f93f3bfff93aff0
tree9c68144383ea5afb7737533dd5ad9679b1a444cf
parent56114d45d01fe3e4938e31549ad7c0bd19b9cf42
tmpfiles: don't resolve pathnames when traversing recursively through directory trees

Otherwise we can be fooled if one path component is replaced underneath us.

The patch achieves that by always operating at file descriptor level (by using
*at() helpers) and by making sure we do not any path resolution when traversing
direcotry trees.

However this is not always possible, for instance when listing the content of a
directory or some operations don't provide the *at() helpers or others (such as
fchmodat()) don't have the AT_EMPTY_PATH flag. In such cases we operate on
/proc/self/fd/%i pseudo-symlink instead, which works the same for all kinds of
objects and requires no checking of type beforehand.

Also O_PATH flag is used when opening file objects in order to prevent
undesired behaviors: device nodes from reacting, automounts from
triggering, etc...

Fixes: #7986
Fixes: CVE-2018-6954
src/tmpfiles/tmpfiles.c