Merge changes from topic 'remove_cap'

* changes:
  libcutils: remove storaged caps
  storaged: reduce storaged privilege
This commit is contained in:
TreeHugger Robot 2017-02-28 00:45:24 +00:00 committed by Android (Google) Code Review
commit 390f926140
3 changed files with 2 additions and 23 deletions

View file

@ -149,10 +149,6 @@ static const struct fs_path_config android_files[] = {
"system/bin/run-as" },
{ 00700, AID_SYSTEM, AID_SHELL, CAP_MASK_LONG(CAP_BLOCK_SUSPEND),
"system/bin/inputflinger" },
{ 00750, AID_SYSTEM, AID_SHELL, CAP_MASK_LONG(CAP_SETUID) |
CAP_MASK_LONG(CAP_SETGID) |
CAP_MASK_LONG(CAP_SYS_PTRACE),
"system/bin/storaged" },
/* Support FIFO scheduling mode in SurfaceFlinger. */
{ 00755, AID_SYSTEM, AID_GRAPHICS, CAP_MASK_LONG(CAP_SYS_NICE),

View file

@ -44,20 +44,6 @@
storaged_t storaged;
static int drop_privs() {
// privilege setting
struct sched_param param;
memset(&param, 0, sizeof(param));
if (set_sched_policy(0, SP_BACKGROUND) < 0) return -1;
if (sched_setscheduler((pid_t) 0, SCHED_BATCH, &param) < 0) return -1;
if (setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_BACKGROUND) < 0) return -1;
return 0;
}
// Function of storaged's main thread
void* storaged_main(void* s) {
storaged_t* storaged = (storaged_t*)s;
@ -133,10 +119,6 @@ int main(int argc, char** argv) {
if (fd_emmc < 0)
fd_emmc = TEMP_FAILURE_RETRY(open(mmc0_ext_csd, O_RDONLY));
if (drop_privs() != 0) {
return -1;
}
storaged.set_privileged_fds(fd_emmc);
// Start the main thread of storaged

View file

@ -1,6 +1,7 @@
service storaged /system/bin/storaged
class main
priority 10
file /d/mmc0/mmc0:0001/ext_csd r
writepid /dev/cpuset/system-background/tasks
user root
group system package_info
group package_info