Skip to content
Snippets Groups Projects
  1. Feb 11, 2014
  2. Feb 04, 2014
    • Stephen Smalley's avatar
      Add file_contexts entries for socket files. · a7e4ace1
      Stephen Smalley authored
      
      So that we do not relabel them on a restorecon -R /data.
      
      Change-Id: I8dd915d9bb80067339621b905ea2b4ea0fa8d71e
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      a7e4ace1
    • Stephen Smalley's avatar
      Label /data/misc/wifi/sockets with wpa_socket. · 418e2abd
      Stephen Smalley authored
      
      This will ensure that any sockets created in this directory
      will default to wpa_socket unless a type_transition is defined.
      Define a type transition for system_server to keep its separate
      system_wpa_socket type assigned for its socket.  Allow wpa
      to create and unlink sockets in the directory.  We leave the
      already existing rules for wifi_data_file in place for compatibility
      with existing devices that have wifi_data_file on /data/misc/wifi/sockets.
      
      Change-Id: I9e35cc93abf89ce3594860aa3193f84a3b42ea6e
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      418e2abd
    • Mark Salyzyn's avatar
      sepolicy: Add write_logd, read_logd & control_logd · 8ed750e9
      Mark Salyzyn authored
      - Add write_logd, read_logd and control_logd macros added along
        with contexts for user space logd.
      - Specify above on domain wide, or service-by-service basis
      - Add logd rules.
      - deprecate access_logcat as unused.
      - 'allow <domain> zygote:unix_dgram_socket write;' rule added to
        deal with fd inheritance. ToDo: investigate means to allow
        references to close, and reopen in context of application
        or call setsockcreatecon() to label them in child context.
      
      Change-Id: I35dbb9d5122c5ed9b8c8f128abf24a871d6b26d8
      8ed750e9
  3. Jan 16, 2014
    • Stephen Smalley's avatar
      Allow mediaserver to connect to bluetooth. · 09f6a99b
      Stephen Smalley authored
      
      Re-purpose the existing bluetooth_socket type, originally
      for /dev/socket/bluetooth used by bluetoothd in the old
      bluetooth stack, for sockets created by bluedroid under
      /data/misc/bluedroid, and allow mediaserver to connect
      to such sockets.  This is required for playing audio
      on paired BT devices.
      
      Based on b/12417855.
      
      Change-Id: I24ecdf407d066e7c4939ed2a0edb97222a1879f6
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      09f6a99b
    • Nick Kralevich's avatar
      Remove /sys/class/rfkill/rfkill.* lines · 94f322e0
      Nick Kralevich authored
      These are all symlinks. The restorecon in /sys doesn't follow
      symlinks, so these lines have absolutely no effect, and just
      serve to confuse people.
      
      Remove them.
      
      Change-Id: I24373fa0308ec700011ed19b1ce29a491d1feff3
      94f322e0
    • Stephen Smalley's avatar
      Drop legacy device types. · d9b8ef43
      Stephen Smalley authored
      
      powervr_device is obsoleted by the more general gpu_device.
      akm_device and accelerometer_device are obsoleted by the more
      general sensors_device.
      
      We could also drop the file_contexts entries altogether and
      take them to device-specific policy (in this case, they all
      came from crespo, so that is obsolete for master).
      
      Change-Id: I63cef43b0d66bc99b80b64655416cc050f443e7d
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      d9b8ef43
  4. Jan 08, 2014
    • rpcraig's avatar
      Apply a label to /data/mediadrm files. · d362cdf8
      rpcraig authored
      
      /data/mediadrm is appearing on devices but is
      receiving the system_data_file type. Use the
      media_data_file label to help classify these files.
      This new label will help with the following denials.
      with exisiting allow rules for mediaserver are already
      in place.
      
      type=1400 msg=audit(1389139139.551:308): avc:  denied  { open } for  pid=179 comm="mediaserver" name="ay64.dat" dev="mmcblk0p23" ino=136819 scontext=u:r:mediaserver:s0 tcontext=u:object_r:system_data_file:s0 tclass=file
      type=1400 msg=audit(1389139140.783:309): avc:  denied  { read } for  pid=179 comm="mediaserver" name="IDM1013" dev="mmcblk0p23" ino=136818 scontext=u:r:mediaserver:s0 tcontext=u:object_r:system_data_file:s0 tclass=dir
      type=1400 msg=audit(1389139140.783:310): avc:  denied  { open } for  pid=179 comm="mediaserver" name="IDM1013" dev="mmcblk0p23" ino=136818 scontext=u:r:mediaserver:s0 tcontext=u:object_r:system_data_file:s0 tclass=dir
      
      Change-Id: I84ac78517fdbb0264cf07379120a62675505fc95
      Signed-off-by: default avatarrpcraig <rpcraig@tycho.ncsc.mil>
      d362cdf8
    • Stephen Smalley's avatar
      Drop extra _system_file types. · c0493c8d
      Stephen Smalley authored
      
      They serve no purpose; these directories/files are normally accessible
      in the same way as the rest of /system.  Also one of them has the wrong
      attributes (data_file_type), thereby making it writable by some domains,
      and under current policy, shell and apps cannot do ls -l /etc/ppp /etc/dhcpcd.
      
      Change-Id: I0c1baa434fe78373684f4eaab40a41fddf2bdd79
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      c0493c8d
  5. Jan 07, 2014
    • Stephen Smalley's avatar
      Remove ping domain. · 396015c3
      Stephen Smalley authored
      
      ping in Android no longer requires any additional privileges beyond
      the caller.  Drop the ping domain and executable file type entirely.
      
      Also add net_domain() to shell domain so that it can create and
      use network sockets.
      
      Change-Id: If51734abe572aecf8f510f1a55782159222e5a67
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      396015c3
  6. Dec 17, 2013
    • Stephen Smalley's avatar
      Label /data/media with its own type and allow access. · e13fabd7
      Stephen Smalley authored
      
      /data/media presently is left in system_data_file, which requires
      anything that wants to write to it to be able to write to system_data_file.
      Introduce a new type for /data/media, media_rw_data_file (to match
      the media_rw UID assigned to it and distinguish it from /data/misc/media
      which has media UID and media_data_file type), and allow access to it.
      
      We allow this for all platform app domains as WRITE_MEDIA_STORAGE permission is granted
      to signature|system.  We should not have to allow it to untrusted_app.
      
      Set up type transitions in sdcardd to automatically label any directories
      or files it creates with the new type.
      
      Change-Id: I5c7e6245b854a9213099e40a41d9583755d37d42
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      e13fabd7
  7. Dec 16, 2013
    • Nick Kralevich's avatar
      initial dumpstate domain · 09e6abd9
      Nick Kralevich authored
      Add the necessary rules to support dumpstate.
      Start off initially in permissive until it has more testing.
      
      Dumpstate is triggered by running "adb bugreport"
      
      Change-Id: Ic17a60cca1f6f40daa4f2c51e9ad6009ef36cfbd
      09e6abd9
    • Nick Kralevich's avatar
      initial inputflinger domain · caa6a32d
      Nick Kralevich authored
      Add a placeholder domain for inputflinger.
      Mark it initially unconfined and enforcing.
      
      Change-Id: I433fd9e1954486136cb8abb084b4e19bb7fc2f19
      caa6a32d
  8. Dec 13, 2013
    • Nick Kralevich's avatar
      Label /data/misc/zoneinfo · 7466f9b6
      Nick Kralevich authored
      And allow any SELinux domain to read these timezone
      related files.
      
      Addresses the following denial:
      <5>[    4.746399] type=1400 audit(3430294.470:7): avc:  denied  { open } for  pid=197 comm="time_daemon" name="tzdata" dev="mmcblk0p28" ino=618992 scontext=u:r:time:s0 tcontext=u:object_r:system_data_file:s0 tclass=file
      
      Change-Id: Iff32465e62729d7aad8c79607848d89ce0aede86
      7466f9b6
    • Nick Kralevich's avatar
      alphabetize /data/misc entries. · 6a32eec7
      Nick Kralevich authored
      Alphabetize the entries for the /data/misc subdirectories.
      
      Change-Id: I3690085cbb99c225545545668dedd66341a14edb
      6a32eec7
  9. Dec 12, 2013
  10. 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
  11. 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
  12. Dec 02, 2013
  13. 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
  14. 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
  15. 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
  16. Nov 07, 2013
  17. Nov 06, 2013
  18. 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
  19. 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
  20. Oct 03, 2013
  21. 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
  22. Sep 27, 2013
  23. Sep 26, 2013
  24. 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
  25. 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
  26. Sep 13, 2013
  27. Aug 05, 2013
  28. 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
  29. 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