Skip to content

Commit

Permalink
Revert "proc: Don't let Google Components run in the background"
Browse files Browse the repository at this point in the history
This reverts commit 83df8fc.

	modified:   fs/proc/base.c
  • Loading branch information
kerneltoast authored and ravindu644 committed Mar 5, 2024
1 parent be9eaf0 commit dae8166
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,6 @@
#include <linux/delayacct.h>
#endif

struct task_kill_info {
struct task_struct *task;
struct work_struct work;
};

static void proc_kill_task(struct work_struct *work)
{
struct task_kill_info *kinfo = container_of(work, typeof(*kinfo), work);
struct task_struct *task = kinfo->task;

send_sig(SIGKILL, task, 0);
put_task_struct(task);
kfree(kinfo);
}

/* NOTE:
* Implementing inode permission operations in /proc is almost
* certainly an error. Permission checks need to happen during
Expand Down Expand Up @@ -1117,7 +1102,6 @@ static int __set_oom_adj(struct file *file, int oom_adj, bool legacy)
static DEFINE_MUTEX(oom_adj_mutex);
struct mm_struct *mm = NULL;
struct task_struct *task;
char task_comm[TASK_COMM_LEN];
int err = 0;

task = get_proc_task(file_inode(file));
Expand Down Expand Up @@ -1167,8 +1151,6 @@ static int __set_oom_adj(struct file *file, int oom_adj, bool legacy)
if (!legacy && has_capability_noaudit(current, CAP_SYS_RESOURCE))
task->signal->oom_score_adj_min = (short)oom_adj;
trace_oom_score_adj_update(task);
if (oom_adj >= 700)
strncpy(task_comm, task->comm, TASK_COMM_LEN);

if (mm) {
struct task_struct *p;
Expand Down Expand Up @@ -1196,20 +1178,6 @@ static int __set_oom_adj(struct file *file, int oom_adj, bool legacy)
err_unlock:
mutex_unlock(&oom_adj_mutex);
put_task_struct(task);
/* These apps burn through CPU in the background. Don't let them. */
if (!err && oom_adj >= 700) {
if (!strcmp(task_comm, "vending:download_ser")) {
struct task_kill_info *kinfo;

kinfo = kmalloc(sizeof(*kinfo), GFP_KERNEL);
if (kinfo) {
get_task_struct(task);
kinfo->task = task;
INIT_WORK(&kinfo->work, proc_kill_task);
schedule_work(&kinfo->work);
}
}
}
return err;
}

Expand Down

0 comments on commit dae8166

Please sign in to comment.