]> git.ipfire.org Git - thirdparty/util-linux.git/commit - lib/canonicalize.c
lib/canonicalize: do restricted canonicalize in a subprocess
authorRian Hunter <rian@alum.mit.edu>
Sat, 13 Oct 2018 02:45:06 +0000 (19:45 -0700)
committerKarel Zak <kzak@redhat.com>
Fri, 30 Nov 2018 09:25:04 +0000 (10:25 +0100)
commite101a9eb0fab6725e0a239a92f9b50822c494a3e
tree9866e49f670b8054bfe6fe171a98e49ee1e70097
parent0ab08179171cf872cace11bf679e4a9eab7af687
lib/canonicalize: do restricted canonicalize in a subprocess

Accessing FUSE mounts require suid/sgid (saved uid) to be equal to the
owner of the mount. If mount is running as a setuid process, swapping
creds by only setting the euid/egid isn't enough to change the
suid/sgid as well. We must do a full setuid()/setgid(), but that
removes our ability to re-assume the identity of the original
euid. The solution is swap creds in a child process, preserving the
creds of the parent.

[kzak@redhat.com: - use switch() rather than if() for fork
  - use all-io.h
  - close unused pipe[] ends
  - be more strict about used types]

Addresses: https://github.com/karelzak/util-linux/pull/705
Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/canonicalize.c