From: 黄涛 Date: Sat, 30 Jul 2011 14:56:13 +0000 (+0800) Subject: Revert "Grants system server access to /proc//oom_adj for Android applications." X-Git-Tag: firefly_0821_release~9886 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=30cfd24af4596b26f385f41d6003575bf873cc67;p=firefly-linux-kernel-4.4.55.git Revert "Grants system server access to /proc//oom_adj for Android applications." This reverts commit 004f0ae31748b0f2d77c3bf3bff927b6ce2780bc. --- diff --git a/fs/proc/base.c b/fs/proc/base.c index c16bde58ffdb..af643b5aefe8 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -128,12 +128,6 @@ struct pid_entry { NULL, &proc_single_file_operations, \ { .proc_show = show } ) -/* ANDROID is for special files in /proc. */ -#define ANDROID(NAME, MODE, OTYPE) \ - NOD(NAME, (S_IFREG|(MODE)), \ - &proc_##OTYPE##_inode_operations, \ - &proc_##OTYPE##_operations, {}) - /* * Count the number of hardlinks for the pid_entry table, excluding the . * and .. links. @@ -1067,33 +1061,6 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf, return count; } -static int oom_adjust_permission(struct inode *inode, int mask) -{ - uid_t uid; - struct task_struct *p = get_proc_task(inode); - if(p) { - uid = task_uid(p); - put_task_struct(p); - } - - /* - * System Server (uid == 1000) is granted access to oom_adj of all - * android applications (uid > 10000) as and services (uid >= 1000) - */ - if (p && (current_fsuid() == 1000) && (uid >= 1000)) { - if (inode->i_mode >> 6 & mask) { - return 0; - } - } - - /* Fall back to default. */ - return generic_permission(inode, mask, NULL); -} - -static const struct inode_operations proc_oom_adjust_inode_operations = { - .permission = oom_adjust_permission, -}; - static const struct file_operations proc_oom_adjust_operations = { .read = oom_adjust_read, .write = oom_adjust_write, @@ -2581,7 +2548,7 @@ static const struct pid_entry tgid_base_stuff[] = { REG("cgroup", S_IRUGO, proc_cgroup_operations), #endif INF("oom_score", S_IRUGO, proc_oom_score), - ANDROID("oom_adj",S_IRUGO|S_IWUSR, oom_adjust), + REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adjust_operations), #ifdef CONFIG_AUDITSYSCALL REG("loginuid", S_IWUSR|S_IRUGO, proc_loginuid_operations), REG("sessionid", S_IRUGO, proc_sessionid_operations),