HomeFreeBSD

Use env, not sh in zfsctl_snapshot_{,un}mount()

Description

Use env, not sh in zfsctl_snapshot_{,un}mount()

Call mount and umount via /usr/bin/env instead of /bin/sh in
zfsctl_snapshot_mount() and zfsctl_snapshot_unmount().

This change fixes a shell code injection flaw. The call to /bin/sh
passed the mountpoint unescaped, only surrounded by single quotes. A
mountpoint containing one or more single quotes would cause the command
to fail or potentially execute arbitrary shell code.

This change also provides compatibility with grsecurity patches.
Grsecurity only allows call_usermodehelper() to use helper binaries in
certain paths. /usr/bin/* is allowed, /bin/* is not.

Details

Provenance
Stian Ellingsen <stian@plaimi.net>Authored on Oct 6 2016, 6:03 PM
Parents
rG00b65db71102: Fix use after free in zfsctl_snapshot_unmount()
Branches
Unknown
Tags
Unknown