Skip to content
Snippets Groups Projects
  1. Jan 02, 2018
    • Chenbo Feng's avatar
      sepolicy: New sepolicy classes and rules about bpf object · 08f92f9c
      Chenbo Feng authored
      Add the new classes for eBPF map and program to limit the access to eBPF
      object. Add corresponding rules to allow netd module initialize bpf
      programs and maps, use the program and read/wirte to eBPF maps.
      
      Test: no bpf sepolicy violations when device boot
      Change-Id: I63c35cd60f1972d4fb36ef2408da8d5f2246f7fd
      08f92f9c
  2. Jul 13, 2017
    • Stephen Smalley's avatar
      sepolicy: Define validate_trans permission · 50992311
      Stephen Smalley authored
      
      Kernel commit f9df6458218f4fe ("selinux: export validatetrans
      decisions") introduced a /sys/fs/selinux/validatetrans pseudo file
      for use by userspace file system servers and defined a new validatetrans
      permission to control its use.
      
      Define the new permission in the Android SELinux policy.
      This change only defines the new permission; it does not allow it
      to any domains by default.
      
      This avoids a kernel message warning about the undefined permission on
      the policy load, ala:
      SELinux:  Permission validate_trans in class security not defined in policy.
      
      Test: Policy builds
      
      Change-Id: Ib922a83b7d8f94905207663a72f7a1bc3db8d2c2
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      50992311
  3. Jul 10, 2017
    • Stephen Smalley's avatar
      sepolicy: Define and allow map permission · 4397f082
      Stephen Smalley authored
      
      Kernel commit 3ba4bf5f1e2c ("selinux: add a map permission check for mmap")
      added a map permission check on mmap so that we can
      distinguish memory mapped access (since it has different implications
      for revocation).  The purpose of a separate map permission check on
      mmap(2) is to permit policy to prohibit memory mapping of specific files
      for which we need to ensure that every access is revalidated, particularly
      useful for scenarios where we expect the file to be relabeled at runtime
      in order to reflect state changes (e.g. cross-domain solution, assured
      pipeline without data copying).  The kernel commit is anticipated to
      be included in Linux 4.13.
      
      This change defines map permission for the Android policy.  It mirrors
      the definition in the kernel classmap by adding it to the common
      definitions for files and sockets.  This will break compatibility for
      kernels that predate the dynamic class/perm mapping support (< 2.6.33);
      on such kernels, one would instead need to add map permission
      to the end of each file and socket access vector.
      
      This change also adds map permission to the global macro definitions for
      file permissions, thereby allowing it in any allow rule that uses these
      macros, and to specific rules allowing mapping of files from /system
      and executable types. This should cover most cases where it is needed,
      although it may still need to be added to specific allow rules when the
      global macros are not used.
      
      Test: Policy builds
      
      Change-Id: Iab3ccd2b6587618e68ecab58218838749fe5e7f5
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      4397f082
  4. Jun 26, 2017
    • Stephen Smalley's avatar
      Define smc_socket security class. · 2be9799b
      Stephen Smalley authored
      
      Linux kernel commit da69a5306ab9 ("selinux: support distinctions among all
      network address families") triggers a build error if a new address family
      is added without defining a corresponding SELinux security class.  As a
      result, the smc_socket class was added to the kernel to resolve a build
      failure as part of merge commit 3051bf36c25d that introduced AF_SMC circa
      Linux 4.11.  Define this security class and its access vector, add
      it to the socket_class_set macro, and exclude it from webview_zygote
      like other socket classes.
      
      Test:  Policy builds
      
      Change-Id: Idbb8139bb09c6d1c47f1a76bd10f4ce1e9d939cb
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      2be9799b
  5. May 17, 2017
    • Stephen Smalley's avatar
      Define getrlimit permission for class process · 91a3eeac
      Stephen Smalley authored
      
      This permission was added to the kernel in commit 791ec491c372
      ("prlimit,security,selinux: add a security hook for prlimit")
      circa Linux 4.12 in order to control the ability to get the resource
      limits of another process.  It is only checked when acting on another
      process, so it is not required for getrlimit(2), only for prlimit(2)
      on another process.
      
      Test:  Policy builds
      
      Change-Id: Ic0079a341e959f1c5a3d045974df4b756fd4ab67
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      91a3eeac
  6. Apr 19, 2017
    • Dan Cashman's avatar
      Remove vndservice_manager object classes. · fe02a4ee
      Dan Cashman authored
      vndservicemanager is a copy of servicemanager, and so has the exact
      same properties.  This should be reflected in the sharing of an object
      manager in SELinux policy, rather than creating a second one, which is
      effectively an attempt at namespacing based on object rather than type
      labels.  hwservicemanager, however, provides different and additional
      functionality that may be reflected in changed permissions, though they
      currently map to the existing servicemanager permissions.  Keep the new
      hwservice_manager object manager but remove the vndservice_manager one.
      
      (preemptive cherry-pick of commit: 2f1c7ba7
      to avoid merge conflict)
      
      Bug: 34454312
      Bug: 36052864
      Test: policy builds and device boots.
      Change-Id: I9e0c2757be4026101e32ba780f1fa67130cfa14e
      fe02a4ee
  7. Apr 18, 2017
    • Dan Cashman's avatar
      Remove vndservice_manager object classes. · 2f1c7ba7
      Dan Cashman authored
      vndservicemanager is a copy of servicemanager, and so has the exact
      same properties.  This should be reflected in the sharing of an object
      manager in SELinux policy, rather than creating a second one, which is
      effectively an attempt at namespacing based on object rather than type
      labels.  hwservicemanager, however, provides different and additional
      functionality that may be reflected in changed permissions, though they
      currently map to the existing servicemanager permissions.  Keep the new
      hwservice_manager object manager but remove the vndservice_manager one.
      
      Bug: 34454312
      Bug: 36052864
      Test: policy builds and device boots.
      Change-Id: I9e0c2757be4026101e32ba780f1fa67130cfa14e
      2f1c7ba7
  8. Apr 12, 2017
    • Shawn Willden's avatar
      Add keystore_key:attest_unique_id to priv_app. · a0c7f012
      Shawn Willden authored
      Only privileged apps are supposed to be able to get unique IDs from
      attestation.
      
      Test: CTS test verifies the negative condition, manual the positive
      Bug: 34671471
      Change-Id: I9ab3f71b1e11ed1d7866ff933feece73152d2578
      a0c7f012
  9. Apr 06, 2017
  10. Feb 06, 2017
    • Stephen Smalley's avatar
      Remove obsolete netlink_firewall_socket and netlink_ip6fw_socket classes. · 4921085d
      Stephen Smalley authored
      
      The implementation for NETLINK_FIREWALL and NETLINK_IP6_FW protocols
      was removed from the kernel in commit
      d16cf20e2f2f13411eece7f7fb72c17d141c4a84 ("netfilter: remove ip_queue
      support") circa Linux 3.5.  Unless we need to retain compatibility
      for kernels < 3.5, we can drop these classes from the policy altogether.
      
      Possibly the neverallow rule in app.te should be augmented to include
      the newer netlink security classes, similar to webview_zygote, but
      that can be a separate change.
      
      Test: policy builds
      
      Change-Id: Iab9389eb59c96772e5fa87c71d0afc86fe99bb6b
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      4921085d
    • Stephen Smalley's avatar
      Define extended_socket_class policy capability and socket classes · 431bdd9f
      Stephen Smalley authored
      
      Add a definition for the extended_socket_class policy capability used
      to enable the use of separate socket security classes for all network
      address families rather than the generic socket class.  The capability
      also enables the use of separate security classes for ICMP and SCTP
      sockets, which were previously mapped to rawip_socket class.  Add
      definitions for the new socket classes and access vectors enabled by
      this capability.  Add the new socket classes to the socket_class_set
      macro, and exclude them from webview_zygote domain as with other socket
      classes.
      
      Allowing access by specific domains to the new socket security
      classes is left to future commits.  Domains previously allowed
      permissions to the 'socket' class will require permission to the
      more specific socket class when running on kernels with this support.
      
      The kernel support will be included upstream in Linux 4.11.  The
      relevant kernel commits are da69a5306ab92e07224da54aafee8b1dccf024f6
      ("selinux: support distinctions among all network address families"),
      ef37979a2cfa3905adbf0c2a681ce16c0aaea92d ("selinux: handle ICMPv6
      consistently with ICMP"), and b4ba35c75a0671a06b978b6386b54148efddf39f
      ("selinux: drop unused socket security classes").
      
      This change requires selinux userspace commit
      d479baa82d67c9ac56c1a6fa041abfb9168aa4b3 ("libsepol: Define
      extended_socket_class policy capability") in order to build the
      policy with this capability enabled.  This commit is already in
      AOSP master.
      
      Test: policy builds
      
      Change-Id: I788b4be9f0ec0bf2356c0bbef101cd42a1af49bb
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      431bdd9f
    • Stephen Smalley's avatar
      Define the user namespace capability classes and access vectors. · 8a003607
      Stephen Smalley authored
      
      Kernel commit 8e4ff6f228e4722cac74db716e308d1da33d744f
      (selinux: distinguish non-init user namespace capability checks)
      introduced support for distinguishing capability
      checks against a target associated with the init user namespace
      versus capability checks against a target associated with a non-init
      user namespace by defining and using separate security classes for the
      latter.  This support is needed on Linux to support e.g. Chrome usage of
      user namespaces for the Chrome sandbox without needing to allow Chrome to
      also exercise capabilities on targets in the init user namespace.
      
      Define the new security classes and access vectors for the Android policy.
      Refactor the original capability and capability2 access vector definitions
      as common declarations to allow reuse by the new cap_userns and cap2_userns
      classes.
      
      This change does not allow use of the new classes by any domain; that
      is deferred to future changes as needed if/when Android enables user
      namespaces and the Android version of Chrome starts using them.
      
      The kernel support went upstream in Linux 4.7.
      
      Based on the corresponding refpolicy patch by Chris PeBenito, but
      reworked for the Android policy.
      
      Test: policy builds
      
      Change-Id: I71103d39e93ee0e8c24816fca762944d047c2235
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      8a003607
  11. Jan 18, 2017
    • Josh Gao's avatar
      Introduce crash_dump debugging helper. · cb3eb4ee
      Josh Gao authored
      Replace the global debuggerd with a per-process debugging helper that
      gets exec'ed by the process that crashed.
      
      Bug: http://b/30705528
      Test: crasher/crasher64, `debuggerd <pid>`, `kill -ABRT <pid>`
      Change-Id: Iad1b7478f7a4e2690720db4b066417d8b66834ed
      cb3eb4ee
  12. Nov 21, 2016
    • Nick Kralevich's avatar
      access_vectors: Remove unused permission definitions · 11dc03e5
      Nick Kralevich authored
      Description stolen from
      https://github.com/torvalds/linux/commit/42a9699a9fa179c0054ea3cf5ad3cc67104a6162
      
      Remove unused permission definitions from SELinux.
      Many of these were only ever used in pre-mainline
      versions of SELinux, prior to Linux 2.6.0.  Some of them
      were used in the legacy network or compat_net=1 checks
      that were disabled by default in Linux 2.6.18 and
      fully removed in Linux 2.6.30.
      
      Permissions never used in mainline Linux:
      file swapon
      filesystem transition
      tcp_socket { connectto newconn acceptfrom }
      node enforce_dest
      unix_stream_socket { newconn acceptfrom }
      
      Legacy network checks, removed in 2.6.30:
      socket { recv_msg send_msg }
      node { tcp_recv tcp_send udp_recv udp_send rawip_recv rawip_send dccp_recv dccp_send }
      netif { tcp_recv tcp_send udp_recv udp_send rawip_recv rawip_send dccp_recv dccp_send }
      
      Test: policy compiles and no boot errors (marlin)
      Change-Id: Idaef2567666f80db39c3e3cee70e760e1dac73ec
      11dc03e5
  13. 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
  14. Apr 07, 2016
  15. 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
  16. Oct 01, 2015
  17. May 26, 2015
  18. May 18, 2015
  19. May 14, 2015
  20. May 12, 2015
  21. Mar 31, 2015
    • Chad Brubaker's avatar
      Add keystore add_auth · 8927772c
      Chad Brubaker authored
      This is for the new addAuthToken keystore method from
      I7f7647d9a36ea453ec6d62fc84087ca8f76e53dd. These tokens will be used to
      authorize keymaster operations. The tokens are HMAC'd and so shouldn't
      be fakeable but this is still limited to system_server only.
      
      Change-Id: I3ff46b676ecac8a878d3aa0a25ba9a8b0c5e1f47
      8927772c
  22. Mar 09, 2015
    • dcashman's avatar
      Only allow system_server to send commands to zygote. · 8f81dcad
      dcashman authored
      Add neverallow rules to ensure that zygote commands are only taken from
      system_server.
      
      Also remove the zygote policy class which was removed as an object manager in
      commit: ccb3424639821b5ef85264bc5836451590e8ade7
      
      Bug: 19624279
      
      Change-Id: I1c925d7facf19b3953b5deb85d992415344c4c9f
      8f81dcad
  23. Sep 11, 2014
  24. Aug 29, 2014
  25. Jul 24, 2014
  26. Jul 15, 2014
    • Riley Spahn's avatar
      Add access control for each service_manager action. · 344fc109
      Riley Spahn authored
      Add SELinux MAC for the service manager actions list
      and find. Add the list and find verbs to the
      service_manager class. Add policy requirements for
      service_manager to enforce policies to binder_use
      macro.
      
      (cherry picked from commit b8511e0d)
      
      Change-Id: I980d4a8acf6a0c6e99a3a7905961eb5564b1be15
      344fc109
  27. Jul 14, 2014
    • Riley Spahn's avatar
      Add access control for each service_manager action. · b8511e0d
      Riley Spahn authored
      Add SELinux MAC for the service manager actions list
      and find. Add the list and find verbs to the
      service_manager class. Add policy requirements for
      service_manager to enforce policies to binder_use
      macro.
      
      Change-Id: I224b1c6a6e21e3cdeb23badfc35c82a37558f964
      b8511e0d
  28. Jun 26, 2014
    • Riley Spahn's avatar
      Adding policies for KeyStore MAC. · 1196d2a5
      Riley Spahn authored
      Add keystore_key class and an action for each action supported
      by keystore. Add policies that replicate the access control that
      already exists in keystore. Add auditallow rules for actions
      not known to be used frequently. Add macro for those domains
      wishing to access keystore.
      
      Change-Id: Iddd8672b9e9b72b45ee208e6eda608cc9dc61edc
      1196d2a5
  29. Jun 12, 2014
    • Riley Spahn's avatar
      Add SELinux rules for service_manager. · f90c41f6
      Riley Spahn authored
      Add a service_mananger class with the verb add.
      Add a type that groups the services for each of the
      processes that is allowed to start services in service.te
      and an attribute for all services controlled by the service
      manager. Add the service_contexts file which maps service
      name to target label.
      
      Bug: 12909011
      Change-Id: I017032a50bc90c57b536e80b972118016d340c7d
      f90c41f6
  30. Jun 06, 2014
  31. May 03, 2014
    • dcashman's avatar
      Remove specifycapabilities permission. · c4db82cf
      dcashman authored
      specifycapabilities is no longer specified by the zygote userspace manager.
      It was removed in commit: 42a4bb5730266f80585e67262c73505d0bfffbf8.  Remove
      this permission from policy.
      
      Change-Id: I866a25b590a375a68de6eec9af1b3ef779889985
      c4db82cf
  32. Mar 19, 2013
    • Stephen Smalley's avatar
      Update binder-related policy. · 9ce99e39
      Stephen Smalley authored
      
      The binder_transfer_binder hook was changed in the kernel, obsoleting
      the receive permission and changing the target of the transfer permission.
      Update the binder-related policy to match the revised permission checking.
      
      Change-Id: I1ed0dadfde2efa93296e967eb44ca1314cf28586
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      9ce99e39
  33. Aug 10, 2012
  34. Apr 04, 2012
    • Stephen Smalley's avatar
      Add policy for property service. · 124720a6
      Stephen Smalley authored
      New property_contexts file for property selabel backend.
      New property.te file with property type declarations.
      New property_service security class and set permission.
      Allow rules for setting properties.
      124720a6
Loading