tun_device: enforce ioctl restrictions
Require all SELinux domains which have permission to perform ioctls on /dev/tun explicitly specify what ioctls they perform. Only allow the safe defaults FIOCLEX and FIONCLEX, which are alternate, uncommon ways to set and unset the O_CLOEXEC flag. Remove app's ability to issue *any* ioctls on /dev/tun, period. Add neverallow assertions (compile time assertion + CTS test) to prevent regressions. Limit system_server's ability to perform ioctls on /dev/tun to FIOCLEX, FIONCLEX, TUNGETIFF, and TUNSETIFF. Testing and source code examination shows that only TUNGETIFF and TUNSETIFF are used by system_server. The goal of this change is to put SELinux ioctl controls in place for /dev/tun, so we don't have to maintain the custom kernel patch at https://android.googlesource.com/kernel/common/+/11cee2be0c2062ba88f04eb51196506f870a3b5d%5E%21 Delete the neverallow assertion in isolated_app.te. This is already covered by the assertion present in app_neverallows.te. Test: cts-tradefed run cts -m CtsHostsideNetworkTests -t com.android.cts.net.HostsideVpnTests Test: cts-tradefed run cts -m CtsHostsideNetworkTests Test: cts-tradefed run cts -m CtsNetTestCases Bug: 111560739 Bug: 111560570 Change-Id: Ibe1c3a9e880db0bee438535554abdbc6d84eec45
Showing
- private/app_neverallows.te 29 additions, 2 deletionsprivate/app_neverallows.te
- private/isolated_app.te 0 additions, 3 deletionsprivate/isolated_app.te
- private/system_server.te 1 addition, 0 deletionsprivate/system_server.te
- public/app.te 1 addition, 1 deletionpublic/app.te
- public/domain.te 4 additions, 0 deletionspublic/domain.te
Please register or sign in to comment