]> granicus.if.org Git - zfs/commit
Take user namespaces into account in policy checks
authorWolfgang Bumiller <Blub@users.noreply.github.com>
Wed, 7 Mar 2018 23:40:42 +0000 (00:40 +0100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 7 Mar 2018 23:40:42 +0000 (15:40 -0800)
commit0e85048f53e46f30f26540fe3f6ae755d4d52ad1
tree60e04f7046d70e7cc7fe24574f65e34cc04283ed
parent434a3375ce84db2f86808875fb85f5afa1e84750
Take user namespaces into account in policy checks

Change file related checks to use user namespaces and make
sure involved uids/gids are mappable in the current
namespace.

Note that checks without file ownership information will
still not take user namespaces into account, as some of
these should be handled via 'zfs allow' (otherwise root in a
user namespace could issue commands such as `zpool export`).

This also adds an initial user namespace regression test
for the setgid bit loss, with a user_ns_exec helper usable
in further tests.

Additionally, configure checks for the required user
namespace related features are added for:
  * ns_capable
  * kuid/kgid_has_mapping()
  * user_ns in cred_t

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Closes #6800
Closes #7270
17 files changed:
config/kernel-userns-capabilities.m4 [new file with mode: 0644]
config/kernel.m4
configure.ac
module/zfs/policy.c
tests/runfiles/linux.run
tests/zfs-tests/cmd/Makefile.am
tests/zfs-tests/cmd/user_ns_exec/.gitignore [new file with mode: 0644]
tests/zfs-tests/cmd/user_ns_exec/Makefile.am [new file with mode: 0644]
tests/zfs-tests/cmd/user_ns_exec/user_ns_exec.c [new file with mode: 0644]
tests/zfs-tests/include/commands.cfg
tests/zfs-tests/tests/functional/Makefile.am
tests/zfs-tests/tests/functional/user_namespace/Makefile.am [new file with mode: 0644]
tests/zfs-tests/tests/functional/user_namespace/cleanup.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/user_namespace/setup.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/user_namespace/user_namespace.cfg [new file with mode: 0644]
tests/zfs-tests/tests/functional/user_namespace/user_namespace_001.ksh [new file with mode: 0755]
tests/zfs-tests/tests/functional/user_namespace/user_namespace_common.kshlib [new file with mode: 0644]