OSDN Git Service

dumpstate: execute procrank using su
authorNick Kralevich <nnk@google.com>
Wed, 7 Oct 2015 23:38:42 +0000 (16:38 -0700)
committerNick Kralevich <nnk@google.com>
Wed, 7 Oct 2015 23:54:06 +0000 (16:54 -0700)
procrank is a setuid binary which only exists on userdebug/eng
builds. Instead of executing the setuid binary, run the binary using
the su command. This eliminates one more setuid binary, and allows
the tightening of the SELinux policy.

Bug: 18342188
Change-Id: I81d06196a29489feaefb2fea0cf5c4ff1e273d2f

cmds/dumpstate/dumpstate.c

index ef8db06..01df639 100644 (file)
@@ -299,7 +299,7 @@ static void dumpstate() {
     dump_files("UPTIME MMC PERF", mmcblk0, skip_not_stat, dump_stat_from_fd);
     dump_file("MEMORY INFO", "/proc/meminfo");
     run_command("CPU INFO", 10, "top", "-n", "1", "-d", "1", "-m", "30", "-t", NULL);
-    run_command("PROCRANK", 20, "procrank", NULL);
+    run_command("PROCRANK", 20, SU_PATH, "root", "procrank", NULL);
     dump_file("VIRTUAL MEMORY STATS", "/proc/vmstat");
     dump_file("VMALLOC INFO", "/proc/vmallocinfo");
     dump_file("SLAB INFO", "/proc/slabinfo");