Skip to content
Snippets Groups Projects
  1. Apr 17, 2018
  2. Feb 05, 2018
    • Mark Salyzyn's avatar
      lmkd: add live-lock killer daemon · d583e596
      Mark Salyzyn authored
      llkd needs the ability to forcibly crash the kernel if
      cause is unlikely to result in an orderly shutdown. It
      also needs to scan /proc/<pid> for additional process
      information.
      
      Test: lmkd_unit_test --gtest_filter=llkd.*
      Bug: 33808187
      Change-Id: I7f158a13814e79d5ec71fe90dbc7461abb521945
      d583e596
    • Mark Salyzyn's avatar
      lmkd: add live-lock killer daemon · dea7da52
      Mark Salyzyn authored
      llkd needs the ability to forcibly crash the kernel if
      cause is unlikely to result in an orderly shutdown. It
      also needs to scan /proc/<pid> for additional process
      information.
      
      Test: lmkd_unit_test --gtest_filter=llkd.*
      Bug: 33808187
      Change-Id: I7f158a13814e79d5ec71fe90dbc7461abb521945
      dea7da52
  3. Nov 21, 2017
    • Benjamin Gordon's avatar
      sepolicy: Add rules for non-init namespaces · 9b2e0cbe
      Benjamin Gordon authored
      In kernel 4.7, the capability and capability2 classes were split apart
      from cap_userns and cap2_userns (see kernel commit
      8e4ff6f228e4722cac74db716e308d1da33d744f). Since then, Android cannot be
      run in a container with SELinux in enforcing mode.
      
      This change applies the existing capability rules to user namespaces as
      well as the root namespace so that Android running in a container
      behaves the same on pre- and post-4.7 kernels.
      
      This is essentially:
        1. New global_capability_class_set and global_capability2_class_set
           that match capability+cap_userns and capability2+cap2_userns,
           respectively.
        2. s/self:capability/self:global_capability_class_set/g
        3. s/self:capability2/self:global_capability2_class_set/g
        4. Add cap_userns and cap2_userns to the existing capability_class_set
           so that it covers all capabilities.  This set was used by several
           neverallow and dontaudit rules, and I confirmed that the new
           classes are still appropriate.
      
      Test: diff new policy against old and confirm that all new rules add
            only cap_userns or cap2_userns;
            Boot ARC++ on a device with the 4.12 kernel.
      Bug: crbug.com/754831
      
      Change-Id: I4007eb3a2ecd01b062c4c78d9afee71c530df95f
      9b2e0cbe
  4. Sep 20, 2017
  5. Sep 01, 2017
    • Robert Benea's avatar
      Allow lmkd read memcg stats. · 3a163a34
      Robert Benea authored
      Currently lmkd is not able to read memcg info. The mem/swap usage
      info are used by lmkd to ugrade medium pressure events to critical
      level.
      
      Test: tested on gobo
      Bug: 65180281
      Change-Id: I19d0eb53d5e754c176ffeda1b5d07049e6af8570
      3a163a34
  6. Aug 30, 2017
    • Robert Benea's avatar
      Allow lmkd read memcg stats. · 1a05283c
      Robert Benea authored
      Currently lmkd is not able to read memcg info. The mem/swap usage
      info are used by lmkd to ugrade medium pressure events to critical
      level.
      
      Test: tested on gobo
      Bug: 65180281
      Change-Id: I19d0eb53d5e754c176ffeda1b5d07049e6af8570
      1a05283c
  7. Jun 14, 2017
  8. Jun 13, 2017
    • Tim Murray's avatar
      sepolicy: fix support for lmkd · 527f64e6
      Tim Murray authored
      Allow lmkd to access /dev/memcg once again.
      
      Test: lmkd can access memcg
      bug 36588803
      
      Change-Id: Ia57dbbc3987d8858c932103c4e546cbb88893207
      527f64e6
  9. Jan 20, 2017
  10. Nov 26, 2016
    • Nick Kralevich's avatar
      Remove domain_deprecated from some domains. · 0fa81a27
      Nick Kralevich authored
      No denials showing up in collected audit logs.
      
      Bug: 28760354
      Test: Device boots
      Test: No unexpected denials in denial collection logs.
      Change-Id: I5a0d4f3c51d296bfa04e71fc226a01dcf5b5b508
      0fa81a27
  11. Oct 07, 2016
  12. 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
  13. Aug 08, 2016
  14. Jun 23, 2016
    • Jeff Vander Stoep's avatar
      lmkd: grant read access to all of /sys · 11c79b20
      Jeff Vander Stoep authored
      avc: denied { search } for pid=394 comm="lmkd" name="lowmemorykiller" dev="sysfs" ino=7541 scontext=u:r:lmkd:s0 tcontext=u:object_r:sysfs_lowmemorykiller:s0 tclass=dir permissive=0
      
      (Cherry picked from commit 30a3ee4c)
      
      Bug: 29558514
      Change-Id: Iaae907a92976af2a9dcb58be5643b8614dcde174
      11c79b20
    • Jeff Vander Stoep's avatar
      lmkd: grant read access to all of /sys · 30a3ee4c
      Jeff Vander Stoep authored
      avc: denied { search } for pid=394 comm="lmkd" name="lowmemorykiller" dev="sysfs" ino=7541 scontext=u:r:lmkd:s0 tcontext=u:object_r:sysfs_lowmemorykiller:s0 tclass=dir permissive=0
      
      Bug: 29558514
      Change-Id: Iaae907a92976af2a9dcb58be5643b8614dcde174
      30a3ee4c
  15. Feb 05, 2016
    • Nick Kralevich's avatar
      Replace "neverallow domain" by "neverallow *" · 35a14514
      Nick Kralevich authored
      Modify many "neverallow domain" rules to be "neverallow *" rules
      instead. This will catch more SELinux policy bugs where a label
      is assigned an irrelevant rule, as well as catch situations where
      a domain attribute is not assigned to a process.
      
      Change-Id: I5b83a2504c13b384f9dff616a70ca733b648ccdf
      35a14514
  16. Nov 25, 2015
  17. 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
  18. Sep 15, 2014
  19. Jul 17, 2014
    • Nick Kralevich's avatar
      lmkd: avoid locking libsigchain into memory · 57f1b89d
      Nick Kralevich authored
      https://android-review.googlesource.com/94851 added an LD_PRELOAD
      line to init.environ.rc.in. This has the effect of loading
      libsigchain.so into every process' memory space, regardless of
      whether it wants it or not.
      
      For lmkd, it doesn't need libsigchain, so it doesn't make any sense
      to load it and keep it locked in memory.
      
      Disable noatsecure for lmkd. This sets AT_SECURE=1, which instructs the
      linker to not honor security sensitive environment variables such
      as LD_PRELOAD. This prevents libsigchain.so from being loaded into
      lmkd's memory.
      
      (cherry picked from commit 8a5b28d2)
      
      Change-Id: I39baaf62058986d35ad43de708aaa3daf93b2df4
      57f1b89d
    • Nick Kralevich's avatar
      lmkd: avoid locking libsigchain into memory · 8a5b28d2
      Nick Kralevich authored
      https://android-review.googlesource.com/94851 added an LD_PRELOAD
      line to init.environ.rc.in. This has the effect of loading
      libsigchain.so into every process' memory space, regardless of
      whether it wants it or not.
      
      For lmkd, it doesn't need libsigchain, so it doesn't make any sense
      to load it and keep it locked in memory.
      
      Disable noatsecure for lmkd. This sets AT_SECURE=1, which instructs the
      linker to not honor security sensitive environment variables such
      as LD_PRELOAD. This prevents libsigchain.so from being loaded into
      lmkd's memory.
      
      Change-Id: I6378ba28ff3a1077747fe87c080e1f9f7ca8132e
      8a5b28d2
  20. Jul 16, 2014
    • Nick Kralevich's avatar
      lmkd: allow lmkd to lock itself in memory · 555c3c5a
      Nick Kralevich authored
      addresses the following denial:
      
        type=1400 audit(1.871:3): avc:  denied  { ipc_lock } for  pid=1406 comm="lmkd" capability=14  scontext=u:r:lmkd:s0 tcontext=u:r:lmkd:s0 tclass=capability
      
      Bug: 16236289
      
      (cherry picked from commit 6a1405d7)
      
      Change-Id: I560f1e52eac9360d10d81fc8a9f60eba907a8466
      555c3c5a
    • Nick Kralevich's avatar
      lmkd: allow lmkd to lock itself in memory · 6a1405d7
      Nick Kralevich authored
      addresses the following denial:
      
        type=1400 audit(1.871:3): avc:  denied  { ipc_lock } for  pid=1406 comm="lmkd" capability=14  scontext=u:r:lmkd:s0 tcontext=u:r:lmkd:s0 tclass=capability
      
      Bug: 16236289
      Change-Id: Id9923c16c6db026dd5d28996126f503c5c1d7c87
      6a1405d7
    • Colin Cross's avatar
      lmkd: allow removing cgroups and setting self to SCHED_FIFO · 2203fda5
      Colin Cross authored
      Addresses the following selinux denials:
      type=1400 audit(1405383429.107:22): avc: denied { remove_name } for pid=137 comm="lmkd" name="uid_10060" dev="cgroup" ino=18368 scontext=u:r:lmkd:s0 tcontext=u:object_r:cgroup:s0 tclass=dir permissive=0
      type=1400 audit(1405383794.109:6): avc: denied { sys_nice } for pid=1619 comm="lmkd" capability=23 scontext=u:r:lmkd:s0 tcontext=u:r:lmkd:s0 tclass=capability permissive=0
      
      (cherry picked from commit 53297318)
      
      Change-Id: I7b6e5a396bf345c4768defd7b39af2435631a35b
      2203fda5
  21. Jul 15, 2014
    • Colin Cross's avatar
      lmkd: allow removing cgroups and setting self to SCHED_FIFO · 53297318
      Colin Cross authored
      Addresses the following selinux denials:
      type=1400 audit(1405383429.107:22): avc: denied { remove_name } for pid=137 comm="lmkd" name="uid_10060" dev="cgroup" ino=18368 scontext=u:r:lmkd:s0 tcontext=u:object_r:cgroup:s0 tclass=dir permissive=0
      type=1400 audit(1405383794.109:6): avc: denied { sys_nice } for pid=1619 comm="lmkd" capability=23 scontext=u:r:lmkd:s0 tcontext=u:r:lmkd:s0 tclass=capability permissive=0
      
      Change-Id: I7b6e5a396bf345c4768defd7b39af2435631a35b
      53297318
  22. Mar 05, 2014
    • Nick Kralevich's avatar
      allow lmkd to kill processes. · 23a52e6b
      Nick Kralevich authored
      The previous patch wasn't sufficient. Allow the kill signal.
      
      Addresses the following denial:
      
      <5>[  775.819223] type=1400 audit(1393978653.489:18): avc:  denied  { sigkill } for  pid=118 comm="lmkd" scontext=u:r:lmkd:s0 tcontext=u:r:untrusted_app:s0 tclass=process
      
      Bug: 13084787
      Change-Id: I6af1ed4343b590049809a59e4f2797f6049f12e4
      23a52e6b
  23. Feb 27, 2014
    • Nick Kralevich's avatar
      Give lmkd kill capability · 24be3916
      Nick Kralevich authored
      lmkd needs the capability to kill processes.
      
      Addresses the following denial:
      
      <5>[12619.064604] type=1400 audit(1393540506.745:2565): avc:  denied  { kill } for  pid=116 comm="lmkd" capability=5  scontext=u:r:lmkd:s0 tcontext=u:r:lmkd:s0 tclass=capability
      
      Addresses the following errors:
      
      02-27 13:13:50.995   116   116 I lowmemorykiller: Killing 'com.google.android.deskclock' (7133), adj 15
      02-27 13:13:50.995   116   116 I lowmemorykiller:    to free 33836kB because cache 118512kB is below limit 122880kB for oom_adj 15
      02-27 13:13:50.995   116   116 I lowmemorykiller:    Free memory is -28472kB below reserved
      02-27 13:13:50.995   116   116 E lowmemorykiller: kill(7133): errno=1
      
      Change-Id: I7cca238610307aba9d77aa2e52a32ebd6aec3f3c
      24be3916
  24. Feb 19, 2014
    • Nick Kralevich's avatar
      lmkd: add sys_resource · 1c73a5cd
      Nick Kralevich authored
      Addresses the following denial / error:
      
      E/lowmemorykiller(  187): Error writing /proc/1148/oom_adj; errno=13
      
      [  118.264668] type=1400 audit(947231128.209:140): avc:  denied { sys_resource } for  pid=187 comm="lmkd" capability=24 scontext=u:r:lmkd:s0 tcontext=u:r:lmkd:s0 tclass=capability
      
      Change-Id: Ief2a7ead9cdd8a33e3add111ee99f7a29c12a3f2
      1c73a5cd
  25. Feb 14, 2014
    • Nick Kralevich's avatar
      Make lmkd enforcing. · 5fa2a19f
      Nick Kralevich authored
      Start enforcing SELinux rules for lmkd. Security policy
      violations will return an error instead of being allowed.
      
      Change-Id: I2bad2c2094d93ebbcb8ccc4b7f3369419004a3f0
      5fa2a19f
  26. Feb 13, 2014
    • Nick Kralevich's avatar
      initial lmkd policy. · 5467fce6
      Nick Kralevich authored
      * Allow writes to /proc/PID/oom_score_adj
      * Allow writes to /sys/module/lowmemorykiller/*
      
      Addresses the following denials:
      <5>[    3.825371] type=1400 audit(9781555.430:5): avc:  denied  { write } for  pid=176 comm="lmkd" name="minfree" dev="sysfs" ino=6056 scontext=u:r:lmkd:s0 tcontext=u:object_r:sysfs:s0 tclass=file
      <5>[   48.874747] type=1400 audit(9781600.639:16): avc:  denied  { search } for  pid=176 comm="lmkd" name="896" dev="proc" ino=9589 scontext=u:r:lmkd:s0 tcontext=u:r:system_server:s0 tclass=dir
      <5>[   48.874889] type=1400 audit(9781600.639:17): avc:  denied  { dac_override } for  pid=176 comm="lmkd" capability=1  scontext=u:r:lmkd:s0 tcontext=u:r:lmkd:s0 tclass=capability
      <5>[   48.874982] type=1400 audit(9781600.639:18): avc:  denied  { write } for  pid=176 comm="lmkd" name="oom_score_adj" dev="proc" ino=8942 scontext=u:r:lmkd:s0 tcontext=u:r:system_server:s0 tclass=file
      <5>[   48.875075] type=1400 audit(9781600.639:19): avc:  denied  { open } for  pid=176 comm="lmkd" name="oom_score_adj" dev="proc" ino=8942 scontext=u:r:lmkd:s0 tcontext=u:r:system_server:s0 tclass=file
      <5>[   49.409231] type=1400 audit(9781601.169:20): avc:  denied  { write } for  pid=176 comm="lmkd" name="minfree" dev="sysfs" ino=6056 scontext=u:r:lmkd:s0 tcontext=u:object_r:sysfs:s0 tclass=file
      <5>[  209.081990] type=1400 audit(9781760.839:24): avc:  denied  { search } for  pid=176 comm="lmkd" name="1556" dev="proc" ino=10961 scontext=u:r:lmkd:s0 tcontext=u:r:platform_app:s0 tclass=dir
      <5>[  209.082240] type=1400 audit(9781760.839:25): avc:  denied  { write } for  pid=176 comm="lmkd" name="oom_score_adj" dev="proc" ino=11654 scontext=u:r:lmkd:s0 tcontext=u:r:platform_app:s0 tclass=file
      <5>[  209.082498] type=1400 audit(9781760.839:26): avc:  denied  { open } for  pid=176 comm="lmkd" name="oom_score_adj" dev="proc" ino=11654 scontext=u:r:lmkd:s0 tcontext=u:r:platform_app:s0 tclass=file
      <5>[  209.119673] type=1400 audit(9781760.879:27): avc:  denied  { search } for  pid=176 comm="lmkd" name="1577" dev="proc" ino=12708 scontext=u:r:lmkd:s0 tcontext=u:r:release_app:s0 tclass=dir
      <5>[  209.119937] type=1400 audit(9781760.879:28): avc:  denied  { write } for  pid=176 comm="lmkd" name="oom_score_adj" dev="proc" ino=11657 scontext=u:r:lmkd:s0 tcontext=u:r:release_app:s0 tclass=file
      <5>[  209.120105] type=1400 audit(9781760.879:29): avc:  denied  { open } for  pid=176 comm="lmkd" name="oom_score_adj" dev="proc" ino=11657 scontext=u:r:lmkd:s0 tcontext=u:r:release_app:s0 tclass=file
      <5>[  209.235597] type=1400 audit(9781760.999:30): avc:  denied  { search } for  pid=176 comm="lmkd" name="1600" dev="proc" ino=11659 scontext=u:r:lmkd:s0 tcontext=u:r:shared_app:s0 tclass=dir
      <5>[  209.235798] type=1400 audit(9781760.999:31): avc:  denied  { write } for  pid=176 comm="lmkd" name="oom_score_adj" dev="proc" ino=11667 scontext=u:r:lmkd:s0 tcontext=u:r:shared_app:s0 tclass=file
      <5>[  209.236006] type=1400 audit(9781760.999:32): avc:  denied  { open } for  pid=176 comm="lmkd" name="oom_score_adj" dev="proc" ino=11667 scontext=u:r:lmkd:s0 tcontext=u:r:shared_app:s0 tclass=file
      <5>[  214.297283] type=1400 audit(9781766.059:64): avc:  denied  { write } for  pid=176 comm="lmkd" name="oom_score_adj" dev="proc" ino=11211 scontext=u:r:lmkd:s0 tcontext=u:r:untrusted_app:s0 tclass=file
      <5>[  214.297415] type=1400 audit(9781766.059:65): avc:  denied  { open } for  pid=176 comm="lmkd" name="oom_score_adj" dev="proc" ino=11211 scontext=u:r:lmkd:s0 tcontext=u:r:untrusted_app:s0 tclass=file
      <5>[  214.355060] type=1400 audit(9781766.119:66): avc:  denied  { write } for  pid=176 comm="lmkd" name="oom_score_adj" dev="proc" ino=12907 scontext=u:r:lmkd:s0 tcontext=u:r:system_app:s0 tclass=file
      <5>[  214.355236] type=1400 audit(9781766.119:67): avc:  denied  { open } for  pid=176 comm="lmkd" name="oom_score_adj" dev="proc" ino=12907 scontext=u:r:lmkd:s0 tcontext=u:r:system_app:s0 tclass=file
      <5>[  214.516920] type=1400 audit(9781766.279:68): avc:  denied  { search } for  pid=176 comm="lmkd" name="1907" dev="proc" ino=11742 scontext=u:r:lmkd:s0 tcontext=u:r:media_app:s0 tclass=dir
      <5>[  214.678861] type=1400 audit(9781766.439:69): avc:  denied  { write } for  pid=176 comm="lmkd" name="oom_score_adj" dev="proc" ino=12915 scontext=u:r:lmkd:s0 tcontext=u:r:media_app:s0 tclass=file
      <5>[  214.678992] type=1400 audit(9781766.439:70): avc:  denied  { open } for  pid=176 comm="lmkd" name="oom_score_adj" dev="proc" ino=12915 scontext=u:r:lmkd:s0 tcontext=u:r:media_app:s0 tclass=file
      <5>[  214.708284] type=1400 audit(9781766.469:71): avc:  denied  { search } for  pid=176 comm="lmkd" name="1765" dev="proc" ino=12851 scontext=u:r:lmkd:s0 tcontext=u:r:shared_app:s0 tclass=dir
      <5>[  214.708435] type=1400 audit(9781766.469:72): avc:  denied  { write } for  pid=176 comm="lmkd" name="oom_score_adj" dev="proc" ino=12870 scontext=u:r:lmkd:s0 tcontext=u:r:shared_app:s0 tclass=file
      <5>[  214.708648] type=1400 audit(9781766.469:73): avc:  denied  { open } for  pid=176 comm="lmkd" name="oom_score_adj" dev="proc" ino=12870 scontext=u:r:lmkd:s0 tcontext=u:r:shared_app:s0 tclass=file
      
      Change-Id: Ie3c1ab8ce9e77742d0cc3c73f40010afd018ccd4
      5467fce6
  27. Feb 11, 2014
    • Stephen Smalley's avatar
      Make lmkd permissive or unconfined. · 2561a9af
      Stephen Smalley authored
      
      Otherwise we'll never see denials in userdebug or eng builds and
      never make progress on confining it.  Of course we cannot truly
      test until it is released into AOSP, but this prepares the way
      and potentially allows for internal testing and collection of denials.
      
      Change-Id: Ic9d1ba872d43f322e39ca6cffa0e725f1e223e7b
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      2561a9af
  28. 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
Loading