Skip to content
Snippets Groups Projects
  1. Mar 06, 2017
  2. Mar 04, 2017
    • Wei Wang's avatar
      init.te: grant sysfs_type debugfs_type · 6cd8c9be
      Wei Wang authored
      Fix restorecon failue on second call
      
      Bug: 35803475
      Test: angler boot with UART on and set sys.wifitracing.started to 0 after boot
      Change-Id: Ia5496fcba031616297fa0a4c0f45e3ece0b4d662
      6cd8c9be
  3. Feb 27, 2017
    • Sandeep Patil's avatar
      init: enable init to relabel symlinks for system_block_devices · df32f3e8
      Sandeep Patil authored
      
      early mounted block device are created by 'init' in its first stage, so
      the following restorecon() now finds device nodes and their corresponding
      symlinks. The CL adds rule to make sure the block and
      system_block_devices can be relabeled by init in this case.
      
      Bug: 35792677
      Bug: 27805372
      
      Test: tested ota using 'adb sideload' on sailfish
      
      Change-Id: I7d9d89878919c1267bf3c74f0cdbb4367b5ad458
      Signed-off-by: default avatarSandeep Patil <sspatil@google.com>
      df32f3e8
  4. Feb 24, 2017
    • mukesh agrawal's avatar
      allow WifiService to use tracing on user builds · 723364f1
      mukesh agrawal authored
      Previously, we'd restricted WifiService's use of
      the kernel's tracing feature to just userdebug_or_eng
      builds.
      
      This restriction was in place because the feature
      had not yet been reviewed from a privacy perspective.
      Now that the feature has passed privacy review, enable
      the feature on all builds.
      
      Note that other safeguards remain in place (on all
      builds):
      - The set of events to be monitored is configured by
        init, rather than WifiService (part of system_server).
        This privilege separation prevents a compromised
        system_server from tracing additional information.
      - The trace events are kept only in RAM, until/unless
        WifiService receives a dump request. (This would happen,
        for example, in the case of adb dumpsys, or generating
        a bugreport.)
      
      Bug: 35679234
      Test: manual (see below)
      
      Manual test details:
      - flash device
      - connect device to a wifi network
      $ adb shell dumpsys wifi | grep rdev_connect
        [should see at least one matching line]
      
      Change-Id: I85070054857d75177d0bcdeb9b2c95bfd7e3b6bc
      723364f1
  5. Feb 20, 2017
    • Sandeep Patil's avatar
      init: allow init to restorecon on block devices and their symlinks · 1c8e606f
      Sandeep Patil authored
      
      For early mount we end up creating the device nodes for partitions
      under /dev/block before selinux is initialized. Which means, that
      restorecon_recursive on /dev/block will have to relabel these nodes
      and their symlinks.
      
      This change adds the rule to allow init do the same.
      
      b/27805372
      
      Test: boot marlin / sailfish with early mount device node creation
      but mount partitions using the default 'mountall' without any selinux
      denials.
      
      Change-Id: Ib9335f3f961d485d2120a175dbdbf85d6f70b160
      Signed-off-by: default avatarSandeep Patil <sspatil@google.com>
      1c8e606f
  6. Feb 12, 2017
    • Nick Kralevich's avatar
      tracefs: avoid overly generic regexes · 4cae28d4
      Nick Kralevich authored
      On boot, Android runs restorecon on a number of virtual directories,
      such as /sys and /sys/kernel/debug, to ensure that the SELinux labels
      are correct. To avoid causing excessive boot time delays, the restorecon
      code aggressively prunes directories, to avoid recursing down directory
      trees which will never have a matching SELinux label.
      
      See:
      * https://android-review.googlesource.com/93401
      * https://android-review.googlesource.com/109103
      
      The key to this optimization is avoiding unnecessarily broad regular
      expressions in file_contexts. If an overly broad regex exists, the tree
      pruning code is ineffective, and the restorecon ends up visiting lots of
      unnecessary directories.
      
      The directory /sys/kernel/debug/tracing contains approximately 4500
      files normally, and on debuggable builds, this number can jump to over
      9000 files when the processing from wifi-events.rc occurs. For
      comparison, the entire /sys/kernel/debug tree (excluding
      /sys/kernel/debug/tracing) only contains approximately 8000 files. The
      regular expression "/sys/kernel(/debug)?/tracing/(.*)?" ends up matching
      a significant number of files, which impacts boot performance.
      
      Instead of using an overly broad regex, refine the regex so only the
      files needed have an entry in file_contexts. This list of files is
      essentially a duplicate of the entries in
      frameworks/native/cmds/atrace/atrace.rc .
      
      This change reduces the restorecon_recursive call for /sys/kernel/debug
      from approximately 260ms to 40ms, a boot time reduction of approximately
      220ms.
      
      Bug: 35248779
      Test: device boots, no SELinux denials, faster boot.
      Change-Id: I70f8af102762ec0180546b05fcf014c097135f3e
      4cae28d4
  7. Feb 10, 2017
    • Nick Kralevich's avatar
      init.te: remove domain_deprecated · b59c2016
      Nick Kralevich authored
      auditallows have been in place for a while, and no obvious denials.
      Remove domain_deprecated from init.te
      
      While I'm here, clean up the formatting of the lines in
      domain_deprecated.te.
      
      Bug: 28760354
      Test: policy compiles and device boots. No obvious problems.
      Change-Id: Ia12e77c3e25990957abf15744e083eed9ffbb056
      b59c2016
  8. Feb 09, 2017
    • Nick Kralevich's avatar
      Address auditallow spam from init · 8b63356b
      Nick Kralevich authored
      Init has access to a number of character devices inherited via
      domain.te. Exclude those character devices from the auditallow
      logging.
      
      In addition, init has access to a number of character devices explicitly
      listed in init.te. Exclude those from auditallow logging too.
      
      Addresses various auditallow spam, including:
      
      avc: granted { read open } for comm="init" path="/dev/urandom"
      dev="tmpfs" ino=1197 scontext=u:r:init:s0
      tcontext=u:object_r:random_device:s0 tclass=chr_file
      
      avc: granted { read open } for comm="init" path="/dev/ptmx" dev="tmpfs"
      ino=1294 scontext=u:r:init:s0 tcontext=u:object_r:ptmx_device:s0
      tclass=chr_file
      
      avc: granted { read } for comm="init" name="keychord" dev="tmpfs"
      ino=1326 scontext=u:r:init:s0 tcontext=u:object_r:keychord_device:s0
      tclass=chr_file
      
      avc: granted { read open } for comm="init" path="/dev/keychord"
      dev="tmpfs" ino=1326 scontext=u:r:init:s0
      tcontext=u:object_r:keychord_device:s0 tclass=chr_file
      
      and others not covered above.
      
      Bug: 35197529
      Bug: 33347297
      Test: policy compiles and no auditallow denials.
      Change-Id: Id869404a16c81c779943e9967eb32da226b6047e
      8b63356b
  9. Feb 03, 2017
  10. Feb 01, 2017
    • Max Bires's avatar
      Removing init and ueventd access to generic char files · 3171829a
      Max Bires authored
      There are many character files that are unreachable to all processes
      under selinux policies. Ueventd and init were the only two domains that
      had access to these generic character files, but auditing proved there
      was no use for that access. In light of this, access is being completely
      revoked so that the device nodes can be removed, and a neverallow is
      being audited to prevent future regressions.
      
      Test: The device boots
      Bug: 33347297
      Change-Id: If050693e5e5a65533f3d909382e40f9c6b85f61c
      3171829a
  11. Jan 31, 2017
    • Mark Salyzyn's avatar
      logd: add getEventTag command and service · 384ce662
      Mark Salyzyn authored
      The event log tag service uses /dev/event-log-tags, pstore and
      /data/misc/logd/event-log-tags as sticky storage for the invented
      log tags.
      
      Test: gTest liblog-unit-tests, logd-unit-tests & logcat-unit-tests
      Bug: 31456426
      Change-Id: Iacc8f36f4a716d4da8dca78a4a54600ad2a288dd
      384ce662
    • Mark Salyzyn's avatar
      logd: restrict access to /dev/event-log-tags · d33a9a19
      Mark Salyzyn authored
      Create an event_log_tags_file label and use it for
      /dev/event-log-tags.  Only trusted system log readers are allowed
      direct read access to this file, no write access.  Untrusted domain
      requests lack direct access, and are thus checked for credentials via
      the "plan b" long path socket to the event log tag service.
      
      Test: gTest logd-unit-tests, liblog-unit-tests and logcat-unit-tests
      Bug: 31456426
      Bug: 30566487
      Change-Id: Ib9b71ca225d4436d764c9bc340ff7b1c9c252a9e
      d33a9a19
  12. Jan 23, 2017
  13. Jan 18, 2017
    • mukesh agrawal's avatar
      allow init and system_server access to tracing · 3a6bc68e
      mukesh agrawal authored
      Revise policy, to allow init and system_server to configure,
      clear, and read kernel trace events. This will enable us to
      debug certain WiFi failures.
      
      Note that system_server is restricted to only accessing
      a wifi-specific trace instance. (Hence, system_server is
      not allowed to interfere with atrace.) Moreover, even for
      the wifi trace instance, system_server is granted limited
      permissions. (system_server can not, e.g., change which
      events are traced.)
      
      Note also that init and system_server are only granted these
      powers on userdebug or eng builds.
      
      The init.te and system_server.te changes resolve the
      following denials:
      
      // Denials when wifi-events.rc configures tracing
      { write } for pid=1 comm="init" name="instances" dev="debugfs" ino=755 scontext=u:r:init:s0 tcontext=u:object_r:debugfs_tracing_instances:s0 tclass=dir permissive=1
      { add_name } for pid=1 comm="init" name="wifi" scontext=u:r:init:s0 tcontext=u:object_r:debugfs_tracing_instances:s0 tclass=dir permissive=1
      { create } for pid=1 comm="init" name="wifi" scontext=u:r:init:s0 tcontext=u:object_r:debugfs_tracing_instances:s0 tclass=dir permissive=1
      { write } for pid=1 comm="init" name="tracing_on" dev="debugfs" ino=18067 scontext=u:r:init:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1
      { write } for pid=1 comm="init" name="buffer_size_kb" dev="debugfs" ino=18061 scontext=u:r:init:s0 tcontext=u:object_r:debugfs_tracing_instances:s0 tclass=file permissive=1
      
      // Denials when system_server sets up fail-safe
      // (auto-terminate tracing if system_server dies)
      { search } for pid=882 comm="system_server" name="instances" dev="debugfs" ino=755 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_tracing_instances:s0 tclass=dir permissive=1
      { read } for pid=882 comm="system_server" name="free_buffer" dev="debugfs" ino=18063 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1
      { open } for pid=882 comm="system_server" path="/sys/kernel/debug/tracing/instances/wifi/free_buffer" dev="debugfs" ino=18063 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1
      { getattr } for pid=882 comm="system_server" path="/sys/kernel/debug/tracing/instances/wifi/free_buffer" dev="debugfs" ino=18063 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1
      
      // Denials when system_server toggles tracing on or off
      // (WifiStateMachine is a thread in system_server)
      { search } for pid=989 comm="WifiStateMachin" name="instances" dev="debugfs" ino=755 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_tracing_instances:s0 tclass=dir permissive=1
      { write } for pid=989 comm="WifiStateMachin" name="tracing_on" dev="debugfs" ino=18067 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1
      { open } for pid=989 comm="WifiStateMachin" path="/sys/kernel/debug/tracing/instances/wifi/tracing_on" dev="debugfs" ino=18067 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1
      { getattr } for pid=989 comm="WifiStateMachin" path="/sys/kernel/debug/tracing/instances/wifi/tracing_on" dev="debugfs" ino=18067 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1
      { write } for pid=989 comm="WifiStateMachin" name="tracing_on" dev="debugfs" ino=18067 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1
      { open } for pid=989 comm="WifiStateMachin" path="/sys/kernel/debug/tracing/instances/wifi/tracing_on" dev="debugfs" ino=18067 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1
      { getattr } for pid=989 comm="WifiStateMachin" path="/sys/kernel/debug/tracing/instances/wifi/tracing_on" dev="debugfs" ino=18067 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1
      
      // Denials when system_server reads the event trace
      // (This happens in response to a dumpsys request)
      { search } for pid=3537 comm="Binder:882_B" name="instances" dev="debugfs" ino=755 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_tracing_instances:s0 tclass=dir permissive=1
      { read } for pid=3537 comm="Binder:882_B" name="trace" dev="debugfs" ino=18059 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1
      { open } for pid=3537 comm="Binder:882_B" path="/sys/kernel/debug/tracing/instances/wifi/trace" dev="debugfs" ino=18059 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1
      { getattr } for pid=3537 comm="Binder:882_B" path="/sys/kernel/debug/tracing/instances/wifi/trace" dev="debugfs" ino=18059 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1
      { write } for pid=3537 comm="Binder:882_B" name="trace" dev="debugfs" ino=18059 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1
      
      Bug: 27254565
      Test: manual
      Manual test:
      - Build this CL along with CL:322337
      - Verify that system boots, and that we can connect to GoogleGuest.
        (Testing of actual trace functionality with require some more
        patches in frameworks/opt/net/wifi.)
      $ adb root && adb shell dmesg | egrep 'avc: denied.+debugfs'
      
      Change-Id: Ib6eb4116549277f85bd510d25fb30200f1752f4d
      3a6bc68e
  14. Jan 13, 2017
    • Max Bires's avatar
      Auditing init and ueventd access to chr device files. · 9e7a5b0a
      Max Bires authored
      It seems likely that there is no reason to keep around a number of
      devices that are configured to be included into the pixel kernels. Init
      and ueventd should be the only processes with r/w access to these
      devices, so auditallow rules have been added to ensure that they aren't
      actually used.
      
      /dev/keychord was given its own type since it's one of the few character
      devices that's actually legitimately used and would cause log spam in
      the auditallow otherwise.
      
      Bug: 33347297
      Test: The phone boots without any apparent log spam.
      
      Change-Id: I3dd9557df8a9218b8c802e33ff549d15849216fb
      9e7a5b0a
  15. Jan 03, 2017
    • Nick Kralevich's avatar
      init.te: allow creating kernel audit entries · b50db946
      Nick Kralevich authored
      Allow init to send userspace generated SELinux denials to the kernel
      audit subsystem.
      
      Test: "setprop asdf asdf" from the unprivileged adb shell user
            generated an SELinux denial processed by logd.
      Bug: 27878170
      Change-Id: I0ecd0601408bbda8227802c13689f98e507282d1
      b50db946
  16. Dec 20, 2016
    • Mark Salyzyn's avatar
      logcat: introduce split to logd and logpersist domains · da62cb4d
      Mark Salyzyn authored
      - transition to logpersist from init
      - sort some overlapping negative references
      - intention is to allow logpersist to be used by vendor
        userdebug logging
      
      Test: gTest liblog-unit-tests, logd-unit-tests & logcat-unit-tests
      Bug: 30566487
      Change-Id: I7806f5a2548cbe0c1f257a0ba2855f2eb69d8e7c
      da62cb4d
  17. Dec 17, 2016
    • Nick Kralevich's avatar
      init.te: fixup stale comment · 92ade748
      Nick Kralevich authored
      init switch from a setcon() based transition to an exec() based
      transition in bug 19702273. Fixup stale comment.
      
      Test: comment only change. Policy compiles.
      Bug: 19702273
      Change-Id: I6e1b4b3680193453adafa8952a7ea343d2977505
      92ade748
  18. Dec 05, 2016
    • Max's avatar
      /dev/port does not seem to be used, adding in rules to confirm. · c27c23fb
      Max authored
      Only init and ueventd have any access to /dev/port, and neither should
      have any use for it. As it stands, leaving port in just represents
      additional attack surface with no useful functionality, so it should be
      removed if possible, not only from Pixel devices, but from all Android
      devices.
      
      Test: The phone boots successfully
      
      Bug:33301618
      Change-Id: Iedc51590f1ffda02444587d647889ead9bdece3f
      c27c23fb
  19. Nov 21, 2016
    • Nick Kralevich's avatar
      Collapse urandom_device into random_device · 5eadcb8c
      Nick Kralevich authored
      urandom_device and random_device have the exact same security
      properties. Collapse them into one type.
      
      Test: device boots and /dev/urandom is labeled correctly.
      Change-Id: I12da30749291bc5e37d99bc9422bb86cb58cec41
      5eadcb8c
  20. Nov 12, 2016
  21. Nov 01, 2016
  22. 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
  23. Sep 12, 2016
  24. 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
  25. Sep 10, 2016
  26. Sep 01, 2016
  27. Aug 29, 2016
  28. Aug 15, 2016
    • Hung-ying Tyan's avatar
      Allow init to mount /odm, /vendor early · c3774720
      Hung-ying Tyan authored
      Specifically we need init to relabel (/dev/device-mapper, /dev/block/dm-?)
      and other files in /dev/block/* from tmpfs to dm_device and block_device
      respectively.
      
      BUG=27805372
      
      Change-Id: I16af6e803f8e4150481137aba24d5406872f9c62
      c3774720
  29. Aug 11, 2016
  30. Aug 05, 2016
    • Daniel Micay's avatar
      restrict access to timing information in /proc · 5423db6e
      Daniel Micay authored
      These APIs expose sensitive information via timing side channels. This
      leaves access via the adb shell intact along with the current uses by
      dumpstate, init and system_server.
      
      The /proc/interrupts and /proc/stat files were covered in this paper:
      
      https://www.lightbluetouchpaper.org/2016/07/29/yet-another-android-side-channel/
      
      The /proc/softirqs, /proc/timer_list and /proc/timer_stats files are
      also relevant.
      
      Access to /proc has been greatly restricted since then, with untrusted
      apps no longer having direct access to these, but stricter restrictions
      beyond that would be quite useful.
      
      Change-Id: Ibed16674856569d26517e5729f0f194b830cfedd
      5423db6e
  31. Jul 22, 2016
  32. Jul 07, 2016
  33. Jun 28, 2016
  34. May 13, 2016
    • Christian Poetzsch's avatar
      sepolicy: add support for new tracefs · 97573fdf
      Christian Poetzsch authored
      Since kernel 4.1 ftrace is supported as a new separate filesystem. It
      gets automatically mounted by the kernel under the old path
      /sys/kernel/debug/tracing. Because it lives now on a separate device
      some sepolicy rules need to be updated. This patch is doing that. Most
      of the rules are created based on a conversation happened on the SELinux
      Android mailing list:
      
      http://comments.gmane.org/gmane.comp.security.seandroid/2799
      
      
      
      Note, that this also needs 3a343a1 from the 4.4 branch in kernel/common.
      Also note that when tracefs is auto mounted by the kernel, the kernel
      does not use the "mode" parameter specified to mount debugfs for
      tracefs. So an extra line like
      
         chmod 0755 /sys/kernel/debug/tracing
      
      is necessary in init.${ro.hardware}.rc after debugfs was mounted.
      
      Signed-off-by: default avatarChristian Poetzsch <christian.potzsch@imgtec.com>
      
      (cherry picked from commit 4dafa72a)
      
      Change-Id: I75738c756b49da4ac109ae442ee37c1e2844ff0a
      97573fdf
    • Christian Poetzsch's avatar
      sepolicy: add support for new tracefs · 4dafa72a
      Christian Poetzsch authored
      Since kernel 4.1 ftrace is supported as a new separate filesystem. It
      gets automatically mounted by the kernel under the old path
      /sys/kernel/debug/tracing. Because it lives now on a separate device
      some sepolicy rules need to be updated. This patch is doing that. Most
      of the rules are created based on a conversation happened on the SELinux
      Android mailing list:
      
      http://comments.gmane.org/gmane.comp.security.seandroid/2799
      
      
      
      Note, that this also needs 3a343a1 from the 4.4 branch in kernel/common.
      Also note that when tracefs is auto mounted by the kernel, the kernel
      does not use the "mode" parameter specified to mount debugfs for
      tracefs. So an extra line like
      
         chmod 0755 /sys/kernel/debug/tracing
      
      is necessary in init.${ro.hardware}.rc after debugfs was mounted.
      
      Change-Id: I60fb7a90e24628e0370c3bca57644451fce5646d
      Signed-off-by: default avatarChristian Poetzsch <christian.potzsch@imgtec.com>
  35. May 10, 2016
    • Jeff Vander Stoep's avatar
      allow init to read symlinks in sys · 912f3c10
      Jeff Vander Stoep authored
      avc: denied { read } for name="device" dev="sysfs" ino=36099 scontext=u:r:init:s0 tcontext=u:object_r:sysfs_rmtfs:s0 tclass=lnk_file
      
      init is already allowed to read directories, this is an obvious omission.
      
      Change-Id: I5131a84bb67e73aaed235c3cbab95c365eaaa2f0
      912f3c10
  36. Apr 07, 2016
  37. Apr 05, 2016
  38. Apr 01, 2016
    • Nick Kralevich's avatar
      refine /data/misc/logd rules · 8a8770cd
      Nick Kralevich authored
      (cherry pick from commit 6937aa93)
      
      Followup to 121f5bfd.
      
      Move misc_logd_file neverallow rule from domain.te to logd.te,
      since the goal of the neverallow rule is to protect logd / logpersist
      files from other processes.
      
      Switch the misc_logd_file neverallow rule from using "rw_file_perms"
      to "no_rw_file_perms". The latter covers more cases of file
      modifications.
      
      Add more neverallow rules covering misc_logd_file directories.
      
      Instead of using not_userdebug_nor_eng(), modify the rules to be
      consistent with other highly constrained file types such as
      keystore_data_file or vold_data_file. See, for example,
      https://android-review.googlesource.com/144768
      
      To see the net effect of this change, you can use the following
      command line:
      
        sesearch --allow -t misc_logd_file -c file,dir,lnk_file \
        out/target/product/bullhead/root/sepolicy
      
      Before this change:
      
        # userdebug builds
        allow init misc_logd_file:dir { search setattr read create getattr write relabelfrom ioctl rmdir remove_name relabelto open add_name };
        allow init misc_logd_file:file { setattr read create write relabelfrom getattr relabelto unlink open };
        allow init misc_logd_file:lnk_file { setattr relabelfrom create getattr relabelto unlink };
        allow logd misc_logd_file:dir { search read lock getattr write ioctl remove_name open add_name };
        allow logd misc_logd_file:file { rename setattr read lock create getattr write ioctl unlink open append };
        allow shell misc_logd_file:dir { search read lock getattr ioctl open };
        allow shell misc_logd_file:file { read lock ioctl open getattr };
      
        # user builds
        allow init misc_logd_file:dir { search setattr read create getattr write relabelfrom ioctl rmdir remove_name relabelto open add_name };
        allow init misc_logd_file:file relabelto;
        allow init misc_logd_file:lnk_file { setattr relabelfrom create getattr relabelto unlink };
      
      After this change:
      
        # userdebug builds
        allow init misc_logd_file:dir { search setattr read create getattr ioctl relabelto open };
        allow init misc_logd_file:file { relabelto getattr };
        allow init misc_logd_file:lnk_file relabelto;
        allow logd misc_logd_file:dir { search read lock getattr write ioctl remove_name open add_name };
        allow logd misc_logd_file:file { rename setattr read lock create getattr write ioctl unlink open append };
        allow shell misc_logd_file:dir { search read lock getattr ioctl open };
        allow shell misc_logd_file:file { read lock ioctl open getattr };
      
        # user builds
        allow init misc_logd_file:dir { search setattr read create getattr ioctl relabelto open };
        allow init misc_logd_file:file { relabelto getattr };
        allow init misc_logd_file:lnk_file relabelto;
      
      Change-Id: I0b00215049ad83182f458b4b9e258289c5144479
      Bug: 27965066
      8a8770cd
Loading