rild: enable tombstone on RIL crash
Since Android L, process dumpable flag is verified in case of
crash before requesting tombstone capture by debuggerd.
As setuid operation clears dumpable flag for a process, reenable
flag in rild after its switch to UID radio (debuggable build only)
Change-Id: Id86b697e2a1e11744ccc50a3c9ef04faf079ed94
diff --git a/rild/rild.c b/rild/rild.c
index 8e479dc..5757a39 100644
--- a/rild/rild.c
+++ b/rild/rild.c
@@ -93,6 +93,8 @@
* Our group, cache, was set by init.
*/
void switchUser() {
+ char debuggable[PROP_VALUE_MAX];
+
prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);
setuid(AID_RADIO);
@@ -114,6 +116,15 @@
RLOGE("capset failed: %s", strerror(errno));
exit(EXIT_FAILURE);
}
+
+ /*
+ * Debuggable build only:
+ * Set DUMPABLE that was cleared by setuid() to have tombstone on RIL crash
+ */
+ property_get("ro.debuggable", debuggable, "0");
+ if (strcmp(debuggable, "1") == 0) {
+ prctl(PR_SET_DUMPABLE, 1, 0, 0, 0);
+ }
}
int main(int argc, char **argv)