summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn2018-02-20 12:47:40 -0600
committerMark Salyzyn2018-04-18 16:01:56 -0500
commitf089e1403baa70864869aea4eb680c82f7debbb1 (patch)
treed2eeea01b5c75ea3a14498b091085473259a98d4 /llkd/Android.bp
parent4640149fd566cc1f73fa4ac972220acdcbb05b81 (diff)
downloadplatform-system-core-f089e1403baa70864869aea4eb680c82f7debbb1.tar.gz
platform-system-core-f089e1403baa70864869aea4eb680c82f7debbb1.tar.xz
platform-system-core-f089e1403baa70864869aea4eb680c82f7debbb1.zip
llkd: add live-lock daemon
Introduce a standalone live-lock daemon (llkd), to catch kernel or native user space deadlocks and take mitigating actions. Will also configure [khungtaskd] to fortify the actions. If a thread is in D or Z state with no forward progress for longer than ro.llk.timeout_ms, or ro.llk.[D|Z].timeout_ms, kill the process or parent process respectively. If another scan shows the same process continues to exist, then have a confirmed live-lock condition and need to panic. Panic the kernel in a manner to provide the greatest bugreporting details as to the condition. Add a alarm self watchdog should llkd ever get locked up that is double the expected time to flow through the mainloop. Sampling is every ro.llk_sample_ms. Default will not monitor init, or [kthreadd] and all that [kthreadd] spawns. This reduces the effectiveness of llkd by limiting its coverage. If in the future, if value in covering kthreadd spawned threads, the requirement will be to code drivers so that they do not remain in a persistent 'D' state, or that they have mechanisms to recover the thread should it be killed externally. Then the blacklists can be adjusted accordingly if these conditions are met. An accompanying gTest set have been added, and will setup a persistent D or Z process, with and without forward progress, but not in a live-lock state because that would require a buggy kernel, or a module or kernel modification to stimulate. Android Properties llkd respond to (*_ms parms are in milliseconds): - ro.config.low_ram default false, if true do not sysrq t (dump all threads). - ro.llk.enable default false, allow live-lock daemon to be enabled. - ro.khungtask.enable default false, allow [khungtaskd] to be enabled. - ro.llk.mlockall default true, allow mlock'd live-lock daemon. - ro.khungtask.timeout default 12 minutes. - ro.llk.timeout_ms default 10 minutes, D or Z maximum timelimit, double this value and it sets the alarm watchdog for llkd. - ro.llk.D.timeout_ms default ro.llk.timeout_ms, D maximum timelimit. - ro.llk.Z.timeout_ms default ro.llk.timeout_ms, Z maximum timelimit. - ro.llk.check_ms default 2 minutes sampling interval (ro.llk.timeout_ms / 5) for threads in D or Z state. - ro.llk.blacklist.process default 0,1,2 (kernel, init and [kthreadd]), and process names (/comm or /cmdline) init,[kthreadd], lmkd,lmkd.llkd,llkd,[khungtaskd],watchdogd,[watchdogd], [watchdogd/0] ... - ro.llk.blacklist.parent default 0,2 (kernel and [kthreadd]) and "[kthreadd]". A comma separated lists of process ids, /comm names or /cmdline names. - ro.llk.blacklist.uid default <empty>, comma separated list of uid numbers or names from getpwuid/getpwnam. Test: llkd_unit_test Bug: 33808187 Bug: 72838192 Change-Id: I32e8aa78aef10834e093265d0f3ed5b4199807c6
Diffstat (limited to 'llkd/Android.bp')
-rw-r--r--llkd/Android.bp42
1 files changed, 42 insertions, 0 deletions
diff --git a/llkd/Android.bp b/llkd/Android.bp
new file mode 100644
index 000000000..a6edd26ce
--- /dev/null
+++ b/llkd/Android.bp
@@ -0,0 +1,42 @@
1cc_library_headers {
2 name: "llkd_headers",
3
4 export_include_dirs: ["include"],
5}
6
7cc_library_static {
8 name: "libllkd",
9
10 srcs: [
11 "libllkd.cpp",
12 ],
13
14 shared_libs: [
15 "libbase",
16 "libcutils",
17 "liblog",
18 ],
19
20 export_include_dirs: ["include"],
21
22 cflags: ["-Werror"],
23}
24
25cc_binary {
26 name: "llkd",
27
28 srcs: [
29 "llkd.cpp",
30 ],
31 shared_libs: [
32 "libbase",
33 "libcutils",
34 "liblog",
35 ],
36 static_libs: [
37 "libllkd",
38 ],
39 cflags: ["-Werror"],
40
41 init_rc: ["llkd.rc"],
42}