Skip to content
Snippets Groups Projects
  1. Dec 06, 2013
    • Nick Kralevich's avatar
      Move lmkd into it's own domain. · 2b392fcc
      Nick Kralevich authored
      lmkd low memory killer daemon
      
      The kernel low memory killer logic has been moved to a new daemon
      called lmkd.  ActivityManager communicates with this daemon over a
      named socket.
      
      This is just a placeholder policy, starting off in unconfined_domain.
      
      Change-Id: Ia3f9a18432c2ae37d4f5526850e11432fd633e10
      2b392fcc
    • Stephen Smalley's avatar
      Restrict the ability to set usermodehelpers and proc security settings. · 7adb999e
      Stephen Smalley authored
      
      Limit the ability to write to the files that configure kernel
      usermodehelpers and security-sensitive proc settings to the init domain.
      Permissive domains can also continue to set these values.
      
      The current list is not exhaustive, just an initial set.
      Not all of these files will exist on all kernels/devices.
      Controlling access to certain kernel usermodehelpers, e.g. cgroup
      release_agent, will require kernel changes to support and cannot be
      addressed here.
      
      Expected output on e.g. flo after the change:
      ls -Z /sys/kernel/uevent_helper /proc/sys/fs/suid_dumpable /proc/sys/kernel/core_pattern /proc/sys/kernel/dmesg_restrict /proc/sys/kernel/hotplug /proc/sys/kernel/kptr_restrict /proc/sys/kernel/poweroff_cmd /proc/sys/kernel/randomize_va_space /proc/sys/kernel/usermodehelper
      -rw-r--r-- root     root              u:object_r:usermodehelper:s0 uevent_helper
      -rw-r--r-- root     root              u:object_r:proc_security:s0 suid_dumpable
      -rw-r--r-- root     root              u:object_r:usermodehelper:s0 core_pattern
      -rw-r--r-- root     root              u:object_r:proc_security:s0 dmesg_restrict
      -rw-r--r-- root     root              u:object_r:usermodehelper:s0 hotplug
      -rw-r--r-- root     root              u:object_r:proc_security:s0 kptr_restrict
      -rw-r--r-- root     root              u:object_r:usermodehelper:s0 poweroff_cmd
      -rw-r--r-- root     root              u:object_r:proc_security:s0 randomize_va_space
      -rw------- root     root              u:object_r:usermodehelper:s0 bset
      -rw------- root     root              u:object_r:usermodehelper:s0 inheritable
      
      Change-Id: I3f24b4bb90f0916ead863be6afd66d15ac5e8de0
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      7adb999e
  2. Dec 05, 2013
    • Robert Craig's avatar
      Drop tegra specific label from policy. · b2547644
      Robert Craig authored
      This label was originally used for Motorola
      Xoom devices. nvmap is the tegra gpu memory
      manager and the various nvhost drivers are
      for tegra graphics related functionality,
      i.e. display serial interface, image signal
      processor, or media processing stuff.
      
      Only grouper and tilapia presently need this
      policy.
      
      Change-Id: I2a7000f69abf3185724d88d428e8237e0ca436ec
      b2547644
  3. Dec 02, 2013
  4. Nov 12, 2013
    • Stephen Smalley's avatar
      Rename camera_calibration_file and audio_firmware_file. · 8510d31e
      Stephen Smalley authored
      
      Use more general type names for the contents of /data/misc/camera and
      /data/misc/audio.  These were the names used in our policy until 4.3
      was released, at which point we switched to be consistent with AOSP.
      However, the Galaxy S4 4.2.2 image, Galaxy S4 4.3 image, and
      Galaxy Note 3 4.3 image all shipped with policies using _data_file names
      because they were based on our older policy.  So we may as well switch
      AOSP to these names.
      
      Not sure if in fact these could be all coalesced to the new media_data_file
      type for /data/misc/media introduced by
      Ic374488f8b62bd4f8b3c90f30da0e8d1ed1a7343.
      
      Options to fix already existing devices, which would only apply
      to Nexus devices with 4.3 or 4.4 at this point:
      1) Add restorecon_recursive /data/misc/audio /data/misc/camera to either
      the system/core init.rc or to the device-specific init.*.rc files.
      -or-
      2) Add a typealias declaration in the policy to remap the old type names.
      to the new ones.  Then existing types on persistent storage will be
      remapped internally to the new ones.
      -or-
      3) Some sort of relabeld.
      
      Option #2 is implemented by this change.
      
      Change-Id: Id36203f5bb66b5200efc1205630b5b260ef97496
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      8510d31e
  5. Nov 11, 2013
    • Stephen Smalley's avatar
      Label /dev/fscklogs and allow system_server access to it. · af47ebb6
      Stephen Smalley authored
      
      Otherwise you get denials such as:
      type=1400 audit(1383590310.430:623): avc:  denied  { getattr } for  pid=1629 comm="Thread-78" path="/dev/fscklogs/log" dev="tmpfs" ino=1642 scontext=u:r:system_server:s0 tcontext=u:object_r:device:s0 tclass=file
      type=1400 audit(1383590310.430:624): avc:  denied  { open } for  pid=1629 comm="Thread-78" name="log" dev="tmpfs" ino=1642 scontext=u:r:system_server:s0 tcontext=u:object_r:device:s0 tclass=file
      type=1400 audit(1383590310.430:625): avc:  denied  { write } for  pid=1629 comm="Thread-78" name="fscklogs" dev="tmpfs" ino=1628 scontext=u:r:system_server:s0 tcontext=u:object_r:device:s0 tclass=dir
      type=1400 audit(1383590310.430:625): avc:  denied  { remove_name } for  pid=1629 comm="Thread-78" name="log" dev="tmpfs" ino=1642 scontext=u:r:system_server:s0 tcontext=u:object_r:device:s0 tclass=dir
      type=1400 audit(1383590310.430:625): avc:  denied  { unlink } for  pid=1629 comm="Thread-78" name="log" dev="tmpfs" ino=1642 scontext=u:r:system_server:s0 tcontext=u:object_r:device:s0 tclass=file
      
      Change-Id: Ia7ae06a6d4cc5d2a59b8b85a5fb93cc31074fd37
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      af47ebb6
  6. Nov 08, 2013
    • Stephen Smalley's avatar
      Label /data/misc/media and allow mediaserver access to it. · a7716718
      Stephen Smalley authored
      
      Otherwise we get denials like these on 4.4:
      
      type=1400 audit(1383590170.360:29): avc:  denied  { write } for  pid=61 comm="mediaserver" name="media" dev="mtdblock1" ino=6416 scontext=u:r:mediaserver:s0 tcontext=u:object_r:system_data_file:s0 tclass=dir
      type=1400 audit(1383590170.360:29): avc:  denied  { add_name } for  pid=61 comm="mediaserver" name="emulator.camera.hotplug.0" scontext=u:r:mediaserver:s0 tcontext=u:object_r:system_data_file:s0 tclass=dir
      type=1400 audit(1383590170.360:29): avc:  denied  { create } for  pid=61 comm="mediaserver" name="emulator.camera.hotplug.0" scontext=u:r:mediaserver:s0 tcontext=u:object_r:system_data_file:s0 tclass=file
      type=1400 audit(1383590170.360:29): avc:  denied  { write open } for  pid=61 comm="mediaserver" name="emulator.camera.hotplug.0" dev="mtdblock1" ino=6431 scontext=u:r:mediaserver:s0 tcontext=u:object_r:system_data_file:s0 tclass=file
      type=1400 audit(1383590255.100:231): avc:  denied  { write } for  pid=832 comm="mediaserver" name="emulator.camera.hotplug.0" dev="mtdblock1" ino=6431 scontext=u:r:mediaserver:s0 tcontext=u:object_r:system_data_file:s0 tclass=file
      type=1400 audit(1383590255.100:231): avc:  denied  { open } for  pid=832 comm="mediaserver" name="emulator.camera.hotplug.0" dev="mtdblock1" ino=6431 scontext=u:r:mediaserver:s0 tcontext=u:object_r:system_data_file:s0 tclass=file
      
      Change-Id: Ic374488f8b62bd4f8b3c90f30da0e8d1ed1a7343
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      a7716718
  7. Nov 07, 2013
  8. Nov 06, 2013
  9. Oct 31, 2013
    • Stephen Smalley's avatar
      Change the type on /dev/uinput to match /dev/uhid. · b3c48b66
      Stephen Smalley authored
      
      /dev/uinput is accessed in the same way as /dev/uhid,
      and unlike /dev/input/*.  bluetooth requires access to
      the former and not to the latter, while shell requires access
      to the latter and not the former.  This is also consistent
      with their DAC group ownerships (net_bt_stack for /dev/uinput
      and /dev/uhid vs input for /dev/input/*).
      
      Change-Id: I0059d832a7fe036ed888c91e1fb96f3e6e0bd2d4
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      b3c48b66
  10. Oct 30, 2013
    • Nick Kralevich's avatar
      Move sysfs_devices_system_cpu to the central policy. · 967f39a6
      Nick Kralevich authored
      Every device has a CPU. This is not device specific.
      
      Allow every domain to read these files/directories.
      For unknown reasons, these files are accessed by A LOT
      of processes.
      
      Allow ueventd to write to these files. This addresses
      the following denials seen on mako:
      
      <5>[    4.935602] type=1400 audit(1383167737.512:4): avc:  denied  { read } for  pid=140 comm="ueventd" name="cpu0" dev="sysfs" ino=3163 scontext=u:r:ueventd:s0 tcontext=u:object_r:sysfs_devices_system_cpu:s0 tclass=dir
      <5>[    4.935785] type=1400 audit(1383167737.512:5): avc:  denied  { open } for  pid=140 comm="ueventd" name="cpu0" dev="sysfs" ino=3163 scontext=u:r:ueventd:s0 tcontext=u:object_r:sysfs_devices_system_cpu:s0 tclass=dir
      <5>[    4.935937] type=1400 audit(1383167737.512:6): avc:  denied  { search } for  pid=140 comm="ueventd" name="cpu0" dev="sysfs" ino=3163 scontext=u:r:ueventd:s0 tcontext=u:object_r:sysfs_devices_system_cpu:s0 tclass=dir
      <5>[    4.936120] type=1400 audit(1383167737.512:7): avc:  denied  { write } for  pid=140 comm="ueventd" name="uevent" dev="sysfs" ino=3164 scontext=u:r:ueventd:s0 tcontext=u:object_r:sysfs_devices_system_cpu:s0 tclass=file
      <5>[    4.936303] type=1400 audit(1383167737.512:8): avc:  denied  { open } for  pid=140 comm="ueventd" name="uevent" dev="sysfs" ino=3164 scontext=u:r:ueventd:s0 tcontext=u:object_r:sysfs_devices_system_cpu:s0 tclass=file
      
      Change-Id: I4766dc571762d8fae06aa8c26828c070b80f5936
      967f39a6
  11. Oct 03, 2013
  12. Oct 01, 2013
    • Stephen Smalley's avatar
      Label adb keys file and allow access to it. · 55540755
      Stephen Smalley authored
      
      The /adb_keys entry will only take effect if a restorecon is
      applied by init.rc on a kernel that includes the rootfs labeling
      support, but does no harm otherwise.
      
      The /data/misc/adb labeling ensures correct labeling of the adb_keys
      file created if the device has ro.adb.secure=1 set.
      
      Allow adbd to read the file.
      
      Change-Id: I97b3d86a69681330bba549491a2fb39df6cf20ef
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      55540755
  13. Sep 27, 2013
  14. Sep 26, 2013
  15. Sep 20, 2013
    • Stephen Smalley's avatar
      Label /dev/socket/gps with its own type. · 567ee411
      Stephen Smalley authored
      
      The type was already defined and used in type transitions for cases
      where the gps socket is created at runtime by gpsd, but on some devices
      it is created by init based on an init.<board>.rc socket entry and therefore
      needs a file_contexts entry.
      
      Before:
      $ ls -Z /dev/socket/gps
      srw-rw---- gps      system            u:object_r:device:s0 gps
      
      After:
      $ ls -Z /dev/socket/gps
      srw-rw---- gps      system            u:object_r:gps_socket:s0 gps
      
      Change-Id: I8eef08d80e965fc4f3e9dd09d4fa446aaed82624
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      567ee411
  16. Sep 19, 2013
    • Stephen Smalley's avatar
      Label /dev/socket/mdns with its own type. · 4caf8c99
      Stephen Smalley authored
      
      Otherwise it gets left in the general device type, and we get denials such
      as:
      type=1400 msg=audit(1379617262.940:102): avc:  denied  { write } for  pid=579 comm="mDnsConnector" name="mdns" dev="tmpfs" ino=3213 scontext=u:r:system_server:s0 tcontext=u:object_r:device:s0 tclass=sock_file
      
      This of course only shows up if using a confined system_server.
      
      Change-Id: I2456dd7aa4d72e6fd15b55c251245186eb54a80a
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      4caf8c99
  17. Sep 13, 2013
  18. Aug 05, 2013
  19. Jul 15, 2013
    • Nick Kralevich's avatar
      Remove /sys from file_contexts · 3632bb29
      Nick Kralevich authored
      /sys was getting labeled as a rootfs file, but according to
      genfs_contexts, it's really a sysfs file. This conflict is causing
      problems when patch f29c533c49ab1c90eae612b1c454f2c6879a6658 from
      system/core is applied.
      
      Change-Id: I3f34c9ee68bedb171ebebfcd356e924c987b58ff
      3632bb29
  20. 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
  21. May 15, 2013
  22. May 09, 2013
  23. May 02, 2013
  24. Apr 25, 2013
  25. Apr 24, 2013
  26. Apr 05, 2013
    • Geremy Condra's avatar
      Add the sysrq_file special file and give ADB write access. · bb2591e5
      Geremy Condra authored
      Change-Id: Ief2d412dddf4cefdf43a26538c4be060df4cc787
      bb2591e5
    • Geremy Condra's avatar
      Add downloaded file policy. · bfb26e7b
      Geremy Condra authored
      Change-Id: I6f68323cddcf9e13b2a730b8d6b8730587fb4366
      bfb26e7b
    • Stephen Smalley's avatar
      run-as policy fixes. · 74ba8c86
      Stephen Smalley authored
      - Remove dac_read_search as it is no longer required by run-as.
      - Introduce a separate type for /dev/tty so that we can allow use of own tty for
      for a run-as shell without allowing access to other /dev/tty[0-9]* nodes.
      - Allow sigchld notifications for death of run-as and its descendants by adbd.
      - Drop redundant rules for executing shell or system commands from untrusted_app;
      now covered by rules in app.te.
      
      Change-Id: Ic3bf7bee9eeabf9ad4a20f61fbb142a64bb37c6c
      74ba8c86
    • Robert Craig's avatar
      Add new domains for private apps. · ffd8c441
      Robert Craig authored
      
      /data/app-private is used when making an
      app purchase or forward locking. Provide a
      new label for the directory as well as the
      tmp files that appear under it.
      
      Change-Id: I910cd1aa63538253e10a8d80268212ad9fc9fca5
      Signed-off-by: default avatarrpcraig <rpcraig@tycho.ncsc.mil>
      ffd8c441
    • Stephen Smalley's avatar
      run-as policy fixes. · cd516a32
      Stephen Smalley authored
      - Remove dac_read_search as it is no longer required by run-as.
      - Introduce a separate type for /dev/tty so that we can allow use of own tty for
      for a run-as shell without allowing access to other /dev/tty[0-9]* nodes.
      - Allow sigchld notifications for death of run-as and its descendants by adbd.
      - Drop redundant rules for executing shell or system commands from untrusted_app;
      now covered by rules in app.te.
      
      Change-Id: Ic3bf7bee9eeabf9ad4a20f61fbb142a64bb37c6c
      cd516a32
  27. Apr 04, 2013
Loading