platform_system_core/llkd/llkd.rc
Mark Salyzyn 96505fad80 llkd: Add stack symbol checking
Feature outlined here is only available on userdebug or eng builds.
Blocked for security reasons because requires ptrace capabilities.

Add ro.llk.stack to list a set of symbols that should rarely happen
but if persistent in multiple checks, indicates a live lock condition.
At ro.llk.stack.timeout_ms the process is sent a kill, if it remains,
then panic the kernel.

There is no ABA detection in the paths, the condition for the
stack symbol being present instantaneously must be its rarity of
being caught.  If a livelock occurs in the path of the symbol, then
it is possible more than one path could be stuck in the state, but
the best candidate symbols are found underneath a lock resulting in
only one process being the culprit, and the best aim.  There may be
processes that induce a look of persistence, if so the symbol is not
a candidate for checking.

Add ro.llk.blacklist.process.stack to list process names we want
to skip checking.  This configuration parameter is also used to
prevent sepolicy noise when trying to acquire stacks from non
ptrace'able services.

Test: gTest llkd_unit_tests
Bug: 33808187
Bug: 111910505
Bug: 80502612
Change-Id: Ie71221e371b189bbdda2a1155d47826997842dcc
2018-08-30 13:53:19 -07:00

45 lines
1.2 KiB
Text

# eng default for ro.llk.enable and ro.khungtask.enable
on property:ro.debuggable=*
setprop llk.enable ${ro.llk.enable:-0}
setprop khungtask.enable ${ro.khungtask.enable:-0}
on property:ro.llk.enable=true
setprop llk.enable true
on property:llk.enable=1
setprop llk.enable true
on property:llk.enable=0
setprop llk.enable false
on property:ro.khungtask.enable=true
setprop khungtask.enable true
on property:khungtask.enable=1
setprop khungtask.enable true
on property:khungtask.enable=0
setprop khungtask.enable false
# Configure [khungtaskd]
on property:khungtask.enable=true
write /proc/sys/kernel/hung_task_timeout_secs ${ro.khungtask.timeout:-720}
write /proc/sys/kernel/hung_task_warnings 65535
write /proc/sys/kernel/hung_task_check_count 65535
write /proc/sys/kernel/hung_task_panic 1
on property:khungtask.enable=false
write /proc/sys/kernel/hung_task_panic 0
on property:llk.enable=true
start llkd-${ro.debuggable:-0}
service llkd-0 /system/bin/llkd
class late_start
disabled
user llkd
group llkd readproc
capabilities KILL IPC_LOCK
file /dev/kmsg w
file /proc/sysrq-trigger w
writepid /dev/cpuset/system-background/tasks