Skip to content
Snippets Groups Projects
  • Nick Kralevich's avatar
    tun_device: enforce ioctl restrictions · 619c1ef2
    Nick Kralevich authored
    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
    619c1ef2