Skip to content
Snippets Groups Projects
  1. Jul 27, 2017
    • Jeff Vander Stoep's avatar
      netd: relax binder neverallow rules for hwservices · 07c650eb
      Jeff Vander Stoep authored
      Relax neverallow rule restricting binder access to/from netd so that
      netd can export hwbinder services to vendor components.
      
      Continue to disallow app access to netd via binder.
      
      Bug: 36682246
      Test: build
      Change-Id: I8e558ea1add6c36b966ec1da204062ea82df3f3f
      07c650eb
  2. Jul 24, 2017
    • Jeff Vander Stoep's avatar
      Move domain_deprecated into private policy · 7c34e83f
      Jeff Vander Stoep authored
      This attribute is being actively removed from policy. Since
      attributes are not being versioned, partners must not be able to
      access and use this attribute. Move it from private and verify in
      the logs that rild and tee are not using these permissions.
      
      Bug: 38316109
      Test: build and boot Marlin
      Test: Verify that rild and tee are not being granted any of these
            permissions.
      Merged-In: I31beeb5bdf3885195310b086c1af3432dc6a349b
      Change-Id: I31beeb5bdf3885195310b086c1af3432dc6a349b
      (cherry picked from commit 76aab82c)
      7c34e83f
  3. Jul 16, 2017
    • Lorenzo Colitti's avatar
      Explicitly allow netd to take the iptables lock. · 9273c1bb
      Lorenzo Colitti authored
      This was previously relying on domain_deprecated rules deleted in
      change I588a1e7ea7ef984907b79a5a391efb2dcd6e6431.
      
      Bug: 28760354
      Test: unbreaks networking on AOSP bullhead
      Change-Id: I873e1f08f72104dee7509e45b1db0b284ca56085
      9273c1bb
  4. Jul 13, 2017
  5. Jul 10, 2017
    • Lorenzo Colitti's avatar
      Temporarily revert the SELinux policy for persist.netd.stable_secret. · 07e631d2
      Lorenzo Colitti authored
      This change did not make it into core sepolicy in time for O.
      The revert allows devices to define these selinux policies in
      vendor-specific sepolicy instead of core sepolicy. It is
      necessary because:
      
      1. It is too late to change property_contexts in O.
      2. Adding the netd_stable_secret prop to vendor sepolicy results
         in a duplicate definition error at compile time.
      3. Defining a new vendor-specific context (such as
         net_stable_secret_vendor_prop) and applying it to
         persist.netd.stable_secret results in the device not booting
         due to attempting to apply two different contexts to the same
         property.
      
      Lack of the sepolicy no longer breaks wifi connectivity now that
      IpManager no longer considers failure to set the stable secret to
      be a fatal error.
      
      Once all interested devices have adopted the vendor sepolicy,
      this policy can safely be reinstated by reverting said vendor
      sepolicies in internal master.
      
      This reverts commit abb1ba65.
      
      Bug: 17613910
      Test: bullhead builds, boots, connects to wifi
      Change-Id: Idffcf78491171c54bca9f93cb920eab9b1c47709
      07e631d2
  6. Jun 12, 2017
    • Joel Scherpelz's avatar
      SELinux policy for secure persistent netd storage · abb1ba65
      Joel Scherpelz authored
      This is used to persist RFC 7217 stable secrets across device reboots.
      
      First submit caused a merge conflict. This revision replaces netd_prop
      with a more unique name netd_stable_secret_prop.
      
      Test: as follows
          - Manually tested that stable_secret is generated on first use and
            persists until reset of user data partition (factory reset).
          - Tested that "adb shell getprop" was denied access to
            persist.netd.stable_secret after running "adb unroot".
      Bug: 17613910
      
      Change-Id: I0a609c724799a15b1926e62534c16810d34f2275
      abb1ba65
  7. Jun 08, 2017
    • Bartosz Fabianowski's avatar
      Revert "SELinux policy for secure persistent netd storage" · 06486796
      Bartosz Fabianowski authored
      This broke the build on master. See b/17613910#comment17
      for details.
      
      This reverts commit ef1fd98b.
      
      Change-Id: I11f7d463061a9b6340c11827135586266e26f016
      06486796
    • Joel Scherpelz's avatar
      SELinux policy for secure persistent netd storage · ef1fd98b
      Joel Scherpelz authored
      This is used to persist RFC 7217 stable secrets across device reboots.
      
      Test: as follows
          - Manually tested that stable_secret is generated on first use and
            persists until reset of user data partition (factory reset).
          - Tested that "adb shell getprop" was denied access to
            persist.netd.stable_secret after running "adb unroot".
      Bug: 17613910
      
      Change-Id: I4dad00fb189d697aceaffae49ad63987c7e45054
      ef1fd98b
  8. Mar 23, 2017
  9. Feb 27, 2017
    • Nick Kralevich's avatar
      netd.te: drop dccp_socket support · 5251ad1a
      Nick Kralevich authored
      No SELinux domains can create dccp_socket instances, so it doesn't make
      any sense to allow netd to minipulate already-open dccp sockets.
      
      Bug: 35784697
      Test: policy compiles.
      Change-Id: I189844462cbab58ed58c24fbad6a392f6b035815
      5251ad1a
  10. Jan 26, 2017
    • William Roberts's avatar
      te_macros: introduce add_service() macro · 606d2fd6
      William Roberts authored
      
      Introduce the add_service() macro which wraps up add/find
      permissions for the source domain with a neverallow preventing
      others from adding it. Only a particular domain should
      add a particular service.
      
      Use the add_service() macro to automatically add a neverallow
      that prevents other domains from adding the service.
      
      mediadrmserver was adding services labeled mediaserver_service.
      Drop the add permission as it should just need the find
      permission.
      
      Additionally, the macro adds the { add find } permission which
      causes some existing neverallow's to assert. Adjust those
      neverallow's so "self" can always find.
      
      Test: compile and run on hikey and emulator. No new denials were
      found, and all services, where applicable, seem to be running OK.
      
      Change-Id: Ibbd2a5304edd5f8b877bc86852b0694732be993c
      Signed-off-by: default avatarWilliam Roberts <william.c.roberts@intel.com>
      606d2fd6
  11. Nov 30, 2016
    • Nick Kralevich's avatar
      domain_deprecated.te: remove /proc/net access · dd649da8
      Nick Kralevich authored
      Remove /proc/net access to domain_deprecated. Add it to domains where it
      was missing before.
      
      Other than these domains, SELinux denial monitoring hasn't picked up any
      denials related to /proc/net
      
      Bug: 28760354
      Test: Device boots
      Test: No unexpected denials in denial collection logs.
      Change-Id: Ie5bfa4bc0070793c1e8bf3b00676fd31c08d426a
      dd649da8
  12. Oct 06, 2016
    • dcashman's avatar
      Split general policy into public and private components. · cc39f637
      dcashman authored
      Divide policy into public and private components.  This is the first
      step in splitting the policy creation for platform and non-platform
      policies.  The policy in the public directory will be exported for use
      in non-platform policy creation.  Backwards compatibility with it will
      be achieved by converting the exported policy into attribute-based
      policy when included as part of the non-platform policy and a mapping
      file will be maintained to be included with the platform policy that
      maps exported attributes of previous versions to the current platform
      version.
      
      Eventually we would like to create a clear interface between the
      platform and non-platform device components so that the exported policy,
      and the need for attributes is minimal.  For now, almost all types and
      avrules are left in public.
      
      Test: Tested by building policy and running on device.
      
      Change-Id: Idef796c9ec169259787c3f9d8f423edf4ce27f8c
      cc39f637
  13. Sep 21, 2016
  14. Sep 12, 2016
    • Christopher Wiley's avatar
      Add back fowner capability to netd · 28029706
      Christopher Wiley authored
      This addresses error messages like:
      
      11-30 18:00:15.196  6917  6917 W Binder:6596_2: type=1400 audit(0.0:46):
      avc: denied { fowner } for capability=3 scontext=u:r:netd:s0
      tcontext=u:r:netd:s0 tclass=capability permissive=0
      
      11-30 18:00:15.200  6596  6917 E /system/bin/netd:
      android::WriteStringToFile fchmod failed: Operation not permitted
      
      11-30 18:00:15.200  6596  6917 E Netd    : failed to write to
      /data/misc/net/rt_tables (Operation not permitted)
      
      Bug: 31147892
      Change-Id: Id11704f8e2b8c08db92de374ed44913b70d6ae66
      28029706
  15. Sep 11, 2016
    • Jeff Vander Stoep's avatar
      Enforce ioctl command whitelisting on all sockets · bff98015
      Jeff Vander Stoep authored
      Remove the ioctl permission for most socket types. For others, such as
      tcp/udp/rawip/unix_dgram/unix_stream set a default unprivileged whitelist
      that individual domains may extend (except where neverallowed like
      untrusted_app). Enforce via a neverallowxperm rule.
      
      Change-Id: I15548d830f8eff1fd4d64005c5769ca2be8d4ffe
      bff98015
  16. Sep 10, 2016
  17. Sep 07, 2016
  18. Aug 29, 2016
  19. Aug 26, 2016
    • Christopher Wiley's avatar
      SEPolicy to start hostapd via init · d29c1a0a
      Christopher Wiley authored
      While here, remove a lot of extra permissions that we apparently
      had because hostapd was inheriting fds from netd.
      
      Bug: 30041118
      Test: netd can request init to start/stop hostapd without denials.
      
      Change-Id: Ia777497443a4226a201030eccb9dfc5a40f015dd
      (cherry picked from commit 8a6c5f85)
      d29c1a0a
    • Christopher Wiley's avatar
      Define explicit label for wlan sysfs fwpath · 97db27d8
      Christopher Wiley authored
      avc: denied { write } for name="fwpath" dev="sysfs" ino=6863
      scontext=u:r:wificond:s0 tcontext=u:object_r:sysfs_wlan_fwpath:s0
      tclass=file permissive=0
      
      Test: wificond and netd can write to this path, wifi works
      Test: `runtest frameworks-wifi` passes
      
      Bug: 29579539
      
      Change-Id: Ia21c654b00b09b9fe3e50d564b82966c9c8e6994
      (cherry picked from commit 7d13dd80)
      97db27d8
  20. Jun 14, 2016
    • dcashman's avatar
      Keep pre-existing sysfs write permissions. · 17cfd3fc
      dcashman authored
      Commit: b144ebab added the sysfs_usb
      type and granted the read perms globally, but did not add write
      permissions for all domains that previously had them.  Add the ability
      to write to sysfs_usb for all domains that had the ability to write to
      those files previously (sysfs).
      
      Address denials such as:
      type=1400 audit(1904.070:4): avc:  denied  { write } for  pid=321 comm="ueventd" name="uevent" dev="sysfs" ino=1742 scontext=u:r:ueventd:s0 tcontext=u:object_r:sysfs_usb:s0 tclass=file permissive=0
      
      Bug: 28417852
      Change-Id: I4562ea73f2158ebefba74b58ca572f2176d1b849
      17cfd3fc
  21. Apr 19, 2016
  22. Apr 13, 2016
    • Lorenzo Colitti's avatar
      selinux changes for DNS metrics. · 71d6ddc3
      Lorenzo Colitti authored
      1. Allow the system server to create the dns_listener service.
      2. Allow netd to use said service.
      
      Change-Id: Ic6394d7b2bdebf1c4d6cf70a79754a4996e943e2
      71d6ddc3
  23. Mar 03, 2016
    • Stephen Smalley's avatar
      Update netlink socket classes. · 423fd19d
      Stephen Smalley authored
      
      Define new netlink socket security classes introduced by upstream kernel commit
      6c6d2e9bde1c1c87a7ead806f8f5e2181d41a652 ("selinux: update netlink socket
      classes").  This was merged in Linux 4.2 and is therefore only required
      for Android kernels based on 4.2 or newer (e.g. the android-4.4 branch
      of the kernel/common tree).
      
      Add the new socket classes to socket_class_set.
      Add an initial set of allow rules although further refinement
      will likely be necessary.  Any allow rule previously written
      on :netlink_socket may need to be rewritten or duplicated for
      one or more of the more specific classes.  For now, we retain
      the existing :netlink_socket rules for compatibility on older kernels.
      
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      
      (cherry picked from commit 01d95c23)
      
      Change-Id: Ic00a0d474730cda91ba3bc387e0cc14482f82114
      423fd19d
    • Stephen Smalley's avatar
      Update netlink socket classes. · 01d95c23
      Stephen Smalley authored
      
      Define new netlink socket security classes introduced by upstream kernel commit
      6c6d2e9bde1c1c87a7ead806f8f5e2181d41a652 ("selinux: update netlink socket
      classes").  This was merged in Linux 4.2 and is therefore only required
      for Android kernels based on 4.2 or newer (e.g. the android-4.4 branch
      of the kernel/common tree).
      
      Add the new socket classes to socket_class_set.
      Add an initial set of allow rules although further refinement
      will likely be necessary.  Any allow rule previously written
      on :netlink_socket may need to be rewritten or duplicated for
      one or more of the more specific classes.  For now, we retain
      the existing :netlink_socket rules for compatibility on older kernels.
      
      Change-Id: I5040b30edd2d374538490a080feda96dd4bae5bf
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      01d95c23
  24. Mar 02, 2016
  25. Feb 24, 2016
  26. Feb 22, 2016
  27. Feb 18, 2016
    • Lorenzo Colitti's avatar
      Allow the framework to communicate with netd via a binder service · 24dcc8b1
      Lorenzo Colitti authored
      This will allow us to provide a better interface between Java
      services (e.g., ConnectivityService) and netd than the current
      FrameworkListener / NativeDaemonConnector interface which uses
      text strings over a Unix socket.
      
      Bug: 27239233
      Change-Id: If40582ae2820e54f1960556b7bf7e88d98c525af
      24dcc8b1
  28. Feb 16, 2016
    • Lorenzo Colitti's avatar
      Allow netd to use NETLINK_SOCK_DIAG. · 71a6a3ef
      Lorenzo Colitti authored
      This is needed to kill sockets using the new SOCK_DESTROY
      operation instead of using SIOCKILLADDR.
      
      Bug: 26976388
      
      (cherry picked from commit b38e2790)
      
      Change-Id: Id80c6278f19f9fd20fe8d4fca72f84bff9249ed8
      71a6a3ef
    • Lorenzo Colitti's avatar
      Allow netd to use NETLINK_SOCK_DIAG. · b38e2790
      Lorenzo Colitti authored
      This is needed to kill sockets using the new SOCK_DESTROY
      operation instead of using SIOCKILLADDR.
      
      Bug: 26976388
      Change-Id: I01a63a754726a0e9fb68be48b76df4dc47752edb
      b38e2790
  29. Jan 15, 2016
  30. Nov 03, 2015
    • Jeff Vander Stoep's avatar
      Create attribute for moving perms out of domain · d22987b4
      Jeff Vander Stoep authored
      Motivation: Domain is overly permissive. Start removing permissions
      from domain and assign them to the domain_deprecated attribute.
      Domain_deprecated and domain can initially be assigned to all
      domains. The goal is to not assign domain_deprecated to new domains
      and to start removing domain_deprecated where it is not required or
      reassigning the appropriate permissions to the inheriting domain
      when necessary.
      
      Bug: 25433265
      Change-Id: I8b11cb137df7bdd382629c98d916a73fe276413c
      d22987b4
  31. Aug 25, 2015
    • Stephen Smalley's avatar
      Only allow toolbox exec where /system exec was already allowed. · a3c97a76
      Stephen Smalley authored
      
      When the toolbox domain was introduced, we allowed all domains to exec it
      to avoid breakage.  However, only domains that were previously allowed the
      ability to exec /system files would have been able to do this prior to the
      introduction of the toolbox domain.  Remove the rule from domain.te and add
      rules to all domains that are already allowed execute_no_trans to system_file.
      Requires coordination with device-specific policy changes with the same Change-Id.
      
      Change-Id: Ie46209f0412f9914857dc3d7c6b0917b7031aae5
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      a3c97a76
  32. May 07, 2015
    • William Roberts's avatar
      Replace unix_socket_connect() and explicit property sets with macro · 2f5a6a96
      William Roberts authored
      
      A common source of mistakes when authoring sepolicy is properly
      setting up property sets. This is a 3 part step of:
      1. Allowing the unix domain connection to the init/property service
      2. Allowing write on the property_socket file
      3. Allowing the set on class property_service
      
      The macro unix_socket_connect() handled 1 and 2, but could be
      confusing for first time policy authors. 3 had to be explicitly
      added.
      
      To correct this, we introduce a new macros:
      set_prop(sourcedomain, targetprop)
      
      This macro handles steps 1, 2 and 3.
      
      No difference in sediff is expected.
      
      (cherrypicked from commit 625a3526)
      
      Change-Id: I630ba0178439c935d08062892990d43a3cc1239e
      Signed-off-by: default avatarWilliam Roberts <william.c.roberts@linux.intel.com>
      2f5a6a96
    • William Roberts's avatar
      Replace unix_socket_connect() and explicit property sets with macro · 625a3526
      William Roberts authored
      
      A common source of mistakes when authoring sepolicy is properly
      setting up property sets. This is a 3 part step of:
      1. Allowing the unix domain connection to the init/property service
      2. Allowing write on the property_socket file
      3. Allowing the set on class property_service
      
      The macro unix_socket_connect() handled 1 and 2, but could be
      confusing for first time policy authors. 3 had to be explicitly
      added.
      
      To correct this, we introduce a new macros:
      set_prop(sourcedomain, targetprop)
      
      This macro handles steps 1, 2 and 3.
      
      No difference in sediff is expected.
      
      Change-Id: I630ba0178439c935d08062892990d43a3cc1239e
      Signed-off-by: default avatarWilliam Roberts <william.c.roberts@linux.intel.com>
      625a3526
  33. Apr 02, 2015
    • Nick Kralevich's avatar
      netd dontaudit fsetid · 8d200817
      Nick Kralevich authored
      For the reasons explained in the pre-existing code, we don't want
      to grant fsetid to netd, nor do we want denial messages to be
      generated.
      
      Change-Id: I34dcea81acd25b4eddc46bb54ea0d828b33c5fdc
      8d200817
Loading