Skip to content
Snippets Groups Projects
  1. Nov 20, 2017
    • Jeff Vander Stoep's avatar
      Revert "Move platform/vendor data violations to device policy" · 03177f05
      Jeff Vander Stoep authored
      This reverts commit d4785c37.
      
      Temporarily revert to fix crosshatch.
      
      Test: crosshatch now builds
      03177f05
    • Jeff Vander Stoep's avatar
      Move platform/vendor data violations to device policy · d4785c37
      Jeff Vander Stoep authored
      Sharing data folders by path will be disallowed because it violates
      the approved API between platform and vendor components tested by
      VTS. Move all violating permissions from core selinux policy to
      device specific policy so that we can exempt existing devices from
      the ban and enforce it on new devices.
      
      Bug: 34980020
      Test: Move permissions. Build and test wifi, wifi AP, nfc, fingerprint
          and Play movies on Marlin and Taimen.
      Test: build on Angler, Bullhead, Dragon, Fugu, Marlin, Walleye
      
      Change-Id: Ib6fc9cf1403e74058aaae5a7b0784922f3172b4e
      d4785c37
  2. Apr 14, 2017
  3. Apr 13, 2017
  4. Apr 11, 2017
    • Sandeep Patil's avatar
      sepolicy: make exec_types in /vendor a subset of vendor_file_type · 2ee66e7d
      Sandeep Patil authored
      
      We install all default hal implementations in /vendor/bin/hw along with
      a few domains that are defined in vendor policy and installed in
      /vendor. These files MUST be a subset of the global 'vendor_file_type'
      which is used to address *all files installed in /vendor* throughout the
      policy.
      
      Bug: 36463595
      Test: Boot sailfish without any new denials
      
      Change-Id: I3d26778f9a26f9095f49d8ecc12f2ec9d2f4cb41
      Signed-off-by: default avatarSandeep Patil <sspatil@google.com>
      2ee66e7d
  5. Mar 28, 2017
    • Jeff Vander Stoep's avatar
      Ban vendor components access to core data types · 4a478c47
      Jeff Vander Stoep authored
      Vendor and system components are only allowed to share files by
      passing open FDs over HIDL. Ban all directory access and all file
      accesses other than what can be applied to an open file:
      stat/read/write/append.
      
      This commit marks core data types as core_data_file_type and bans
      access to non-core domains with an exemption for apps. A temporary
      exemption is also granted to domains that currently rely on
      access with TODOs and bug number for each exemption.
      
      Bug: 34980020
      Test: Build and boot Marlin. Make phone call, watch youtube video.
            No new denials observed.
      Change-Id: I320dd30f9f0a5bf2f9bb218776b4bccdb529b197
      4a478c47
  6. Mar 09, 2017
    • Po-Chien Hsueh's avatar
      sepolicy: Move hostapd to vendor · 9a293013
      Po-Chien Hsueh authored
      Move hostapd to vendor/bin/ because it's only used by WIFI HAL.
      This commit is for sepolicy corresponding changes.
      
      Bug: 34236942
      Bug: 34237659
      Test: Hotspot works fine. Integration test.
      
      Change-Id: I2ee165970a20f4015d5d62fc590d448e9acb92c1
      9a293013
  7. 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
  8. Sep 11, 2016
  9. Sep 09, 2016
  10. Aug 26, 2016
    • Christopher Wiley's avatar
      Give hostapd permissions to use its control socket · ce7bb1d4
      Christopher Wiley authored
      Bug: 30311493
      Test: hostapd starts and stops reliably without complaining about
            permission to create the control directory, the control socket,
            or write to the control socket.
      
      Change-Id: If8cf57cce5df2c6af06c8b7f28708e40876e948c
      (cherry picked from commit cbabe363)
      ce7bb1d4
    • 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
  11. Jul 22, 2016
    • Christopher Wiley's avatar
      Give hostapd permissions to use its control socket · cbabe363
      Christopher Wiley authored
      Bug: 30311493
      Test: hostapd starts and stops reliably without complaining about
            permission to create the control directory, the control socket,
            or write to the control socket.
      
      Change-Id: If8cf57cce5df2c6af06c8b7f28708e40876e948c
      cbabe363
  12. Jul 13, 2016
    • Christopher Wiley's avatar
      SEPolicy to start hostapd via init · 8a6c5f85
      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
      8a6c5f85
  13. Jun 15, 2016
    • Jeff Vander Stoep's avatar
      Enforce ioctl command whitelisting on all sockets · c71c6622
      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
      c71c6622
  14. 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
  15. 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
  16. Apr 30, 2014
    • Stephen Smalley's avatar
      DO NOT MERGE: Ensure that /data/misc/wifi/sockets is always labeled wpa_socket. · b55ebfb0
      Stephen Smalley authored
      
      It appears that wpa_supplicant tries to rmdir /data/misc/wifi/sockets
      and re-create it at times, so make sure that it remains labeled correctly
      when re-created in this manner via a name-based type transition rule.
      Do the same for hostapd as it also has permissions for creating/removing
      this directory.
      
      <5>[83921.800071] type=1400 audit(1392997522.105:26): avc:  denied  { rmdir } for  pid=3055 comm="wpa_supplicant" name="sockets" dev="mmcblk0p28" ino=618957 scontext=u:r:wpa:s0 tcontext=u:object_r:wpa_socket:s0 tclass=dir
      
      We no longer need the type_transition for sock_file as it will inherit
      the type from the parent directory which is set via restorecon_recursive
      /data/misc/wifi/sockets or via type_transition, so drop it.
      
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      
      (cherry picked from commit 7ade68d7)
      
      Change-Id: Ie3e2f4c14ce29a63634aa4049ab47f2624e93310
      b55ebfb0
    • Stephen Smalley's avatar
      DO NOT MERGE: Update hostapd domain for /data/misc/wifi/sockets label change. · 5086de28
      Stephen Smalley authored
      
      Change I9e35cc93abf89ce3594860aa3193f84a3b42ea6e changed the type
      on /data/misc/wifi/sockets to wpa_socket and change
      I51b09c5e40946673a38732ea9f601b2d047d3b62 fixed the type on existing
      devices.  Consequently hostapd now needs access to wpa_socket dir
      and sock_file.
      
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      
      (cherry picked from commit f2067371)
      
      Change-Id: I58dd3d5927e6cf9e349dc7584df499521d49afb1
      5086de28
    • Stephen Smalley's avatar
      DO NOT MERGE: partial backport of 08461cb0 · ad10d108
      Stephen Smalley authored
      
      Original change: Allow netd-spawned domains to use inherited netd unix_dgram_socket.
      
      Resolves denials such as:
       avc:  denied  { read write } for  pid=4346 comm="hostapd" path="socket:[7874]" dev="sockfs" ino=7874 scontext=u:r:hostapd:s0 tcontext=u:r:netd:s0 tclass=unix_dgram_socket
       avc:  denied  { read write } for  pid=4348 comm="dnsmasq" path="socket:[7874]" dev="sockfs" ino=7874 scontext=u:r:dnsmasq:s0 tcontext=u:r:netd:s0 tclass=unix_dgram_socket
      
      Change-Id: Iebbbf8f9f31b56ec5b158dda93101472c25e638d
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      ad10d108
  17. Mar 18, 2014
    • Stephen Smalley's avatar
      Allow netd-spawned domains to use inherited netd unix_dgram_socket. · 08461cb0
      Stephen Smalley authored
      
      Resolves denials such as:
       avc:  denied  { read write } for  pid=4346 comm="hostapd" path="socket:[7874]" dev="sockfs" ino=7874 scontext=u:r:hostapd:s0 tcontext=u:r:netd:s0 tclass=unix_dgram_socket
       avc:  denied  { read write } for  pid=4348 comm="dnsmasq" path="socket:[7874]" dev="sockfs" ino=7874 scontext=u:r:dnsmasq:s0 tcontext=u:r:netd:s0 tclass=unix_dgram_socket
      
      Change-Id: Ie82f39c32c6e04bc9ef1369ca787cf80b3b4141c
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      08461cb0
  18. Mar 14, 2014
  19. Mar 12, 2014
    • Stephen Smalley's avatar
      Label /data/misc/wifi/hostapd with wpa_socket type. · 5f8d9f85
      Stephen Smalley authored
      
      hostapd creates sockets under /data/misc/wifi/hostapd.
      Ensure that they are labeled correctly both at runtime
      (type_transition) and during the init.rc restorecon_recursive /data
      (file_contexts).
      
      Addresses denials such as:
       avc:  denied  { create } for  pid=20476 comm="hostapd" name="wlan0" scontext=u:r:hostapd:s0 tcontext=u:object_r:wifi_data_file:s0 tclass=sock_file
       avc:  denied  { setattr } for  pid=20476 comm="hostapd" name="wlan0" dev="mmcblk0p23" ino=619005 scontext=u:r:hostapd:s0 tcontext=u:object_r:wifi_data_file:s0 tclass=sock_file
       avc:  denied  { unlink } for  pid=20476 comm="hostapd" name="wlan0" dev="mmcblk0p23" ino=619005 scontext=u:r:hostapd:s0 tcontext=u:object_r:wifi_data_file:s0 tclass=sock_file
      
      Change-Id: I80a443faeb6017a9d6cbdb8da9d7416f29a7b85f
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      5f8d9f85
  20. Feb 25, 2014
    • Stephen Smalley's avatar
      Clean up socket rules. · 16011320
      Stephen Smalley authored
      
      Replace * or any permission set containing create with
      create_socket_perms or create_stream_socket_perms.
      
      Add net_domain() to all domains using network sockets and
      delete rules already covered by domain.te or net.te.
      
      For netlink_route_socket, only nlmsg_write needs to be separately
      granted to specific domains that are permitted to modify the routing
      table.   Clarification:  read/write permissions are just ability to
      perform read/recv() or write/send() on the socket, whereas nlmsg_read/
      nlmsg_write permissions control ability to observe or modify the
      underlying kernel state accessed via the socket.
      See security/selinux/nlmsgtab.c in the kernel for the mapping of
      netlink message types to nlmsg_read or nlmsg_write.
      
      Delete legacy rule for b/12061011.
      
      This change does not touch any rules where only read/write were allowed
      to a socket created by another domain (inherited across exec or
      received across socket or binder IPC).  We may wish to rewrite some or all
      of those rules with the rw_socket_perms macro but that is a separate
      change.
      
      Change-Id: Ib0637ab86f6d388043eff928e5d96beb02e5450e
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      16011320
  21. Feb 21, 2014
    • Stephen Smalley's avatar
      Ensure that /data/misc/wifi/sockets is always labeled wpa_socket. · 7ade68d7
      Stephen Smalley authored
      
      It appears that wpa_supplicant tries to rmdir /data/misc/wifi/sockets
      and re-create it at times, so make sure that it remains labeled correctly
      when re-created in this manner via a name-based type transition rule.
      Do the same for hostapd as it also has permissions for creating/removing
      this directory.
      
      <5>[83921.800071] type=1400 audit(1392997522.105:26): avc:  denied  { rmdir } for  pid=3055 comm="wpa_supplicant" name="sockets" dev="mmcblk0p28" ino=618957 scontext=u:r:wpa:s0 tcontext=u:object_r:wpa_socket:s0 tclass=dir
      
      We no longer need the type_transition for sock_file as it will inherit
      the type from the parent directory which is set via restorecon_recursive
      /data/misc/wifi/sockets or via type_transition, so drop it.
      
      Change-Id: Iffa61c426783eb03205ba6964c624c6ecea32630
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      7ade68d7
  22. Feb 11, 2014
  23. Jan 11, 2014
    • Nick Kralevich's avatar
      Support forcing permissive domains to unconfined. · 623975fa
      Nick Kralevich authored
      Permissive domains are only intended for development.
      When a device launches, we want to ensure that all
      permissive domains are in, at a minimum, unconfined+enforcing.
      
      Add FORCE_PERMISSIVE_TO_UNCONFINED to Android.mk. During
      development, this flag is false, and permissive domains
      are allowed. When SELinux new feature development has been
      frozen immediately before release, this flag will be flipped
      to true. Any previously permissive domains will move into
      unconfined+enforcing.
      
      This will ensure that all SELinux domains have at least a
      minimal level of protection.
      
      Unconditionally enable this flag for all user builds.
      
      Change-Id: I1632f0da0022c80170d8eb57c82499ac13fd7858
      623975fa
  24. Nov 18, 2013
  25. Oct 21, 2013
    • Nick Kralevich's avatar
      Move unconfined domains out of permissive mode. · 353c72e3
      Nick Kralevich authored
      This change removes the permissive line from unconfined
      domains. Unconfined domains can do (mostly) anything, so moving
      these domains into enforcing should be a no-op.
      
      The following domains were deliberately NOT changed:
      1) kernel
      2) init
      
      In the future, this gives us the ability to tighten up the
      rules in unconfined, and have those tightened rules actually
      work.
      
      When we're ready to tighten up the rules for these domains,
      we can:
      
      1) Remove unconfined_domain and re-add the permissive line.
      2) Submit the domain in permissive but NOT unconfined.
      3) Remove the permissive line
      4) Wait a few days and submit the no-permissive change.
      
      For instance, if we were ready to do this for adb, we'd identify
      a list of possible rules which allow adbd to work, re-add
      the permissive line, and then upload those changes to AOSP.
      After sufficient testing, we'd then move adb to enforcing.
      We'd repeat this for each domain until everything is enforcing
      and out of unconfined.
      
      Change-Id: If674190de3262969322fb2e93d9a0e734f8b9245
      353c72e3
  26. Jun 28, 2013
    • Nick Kralevich's avatar
      Enable SELinux protections for netd. · dbd28d91
      Nick Kralevich authored
      This change does several things:
      
      1) Restore domain.te to the version present at
      cd516a32 . This is the version
      currently being distributed in AOSP.
      
      2) Add "allow domain properties_device:file r_file_perms;" to
      domain.te, to allow all domains to read /dev/__properties__ .
      This change was missing from AOSP.
      
      3) Restore netd.te to the version present at
      80c9ba52 . This is the version
      currently being distributed in AOSP.
      
      4) Remove anything involving module loading from netd.te. CTS
      enforces that Android kernels can't have module loading enabled.
      
      5) Add several new capabilities, plus data file rules, to
      netd.te, since netd needs to write to files owned by wifi.
      
      6) Add a new unconfined domain called dnsmasq.te, and allow
      transitions from netd to that domain. Over time, we'll tighten up
      the dnsmasq.te domain.
      
      7) Add a new unconfined domain called hostapd.te, and allow
      transitions from netd to that domain. Over time, we'll tighten up
      the hostapd.te domain.
      
      The net effect of these changes is to re-enable SELinux protections
      for netd. The policy is FAR from perfect, and allows a lot of wiggle
      room, but we can improve it over time.
      
      Testing: as much as possible, I've exercised networking related
      functionality, including turning on and off wifi, entering airplane
      mode, and enabling tethering and portable wifi hotspots. It's quite
      possible I've missed something, and if we experience problems, I
      can roll back this change.
      
      Bug: 9618347
      Change-Id: I23ff3eebcef629bc7baabcf6962f25f116c4a3c0
      dbd28d91
Loading