Prefetched sets are stored by root, but are read by an unprivileged
authorrpe <rpe@openbsd.org>
Sun, 14 Jan 2018 12:12:52 +0000 (12:12 +0000)
committerrpe <rpe@openbsd.org>
Sun, 14 Jan 2018 12:12:52 +0000 (12:12 +0000)
commit0ebd7fdb55fc5923e929d6cf9c0efade5fc94940
treec907e793f606eb20c2708b3e35c0c4ee98e22536
parent0dfa4009674e3444e346b13939fa4d22eb92befe
Prefetched sets are stored by root, but are read by an unprivileged
user during the actual install phase. Add a check to the selection
of the prefetch area to ensure the unprivleged user can read files
from there.

Move the selection logic to its own function prefetcharea_fs_list()
which returns a unique list of candidate filesystems, or with rc=1.
While at it, remove /var/tmp from the potential list of candidates
because it's a symbolic link to /tmp since 2014.

Change install_files() to loop over the candidates and check if it
can read a test file, otherwise clean up and skip this filesystem.

Problem found by benno@ whose upgrade failed due to /usr/obj being
owned by build:wobj and permissions that prevented the unprivileged
user to read the prefetched set files from there.

discussed with and OK benno@ halex@ tb@
distrib/miniroot/install.sub