1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-17 21:11:34 +03:00
mobile-nixos/devices/asus-z00t/kernel/0001-Revert-Grants-system-server-access-to-proc-pid-oom_a.patch
Samuel Dionne-Riel fb79113a00 asus-z00t: Fixes compilation with USER_NS
This is dumb... These are all android/google/qualcomm/asus "features"
added to the kernel with no concern about actually being compatible
with the kernel. They all assume no USER_NS stuff.

Fun!
2019-10-09 22:12:48 -04:00

77 lines
2.2 KiB
Diff

From 1f49c9dd4d5074f15de3231d08435e2d02c62534 Mon Sep 17 00:00:00 2001
From: Samuel Dionne-Riel <samuel@dionne-riel.com>
Date: Wed, 9 Oct 2019 20:50:37 -0400
Subject: [PATCH] Revert "Grants system server access to /proc/<pid>/oom_adj
for Android applications."
This reverts commit aa3305f2ba5976a95637c69c63409fdf007e1414.
---
fs/proc/base.c | 37 +------------------------------------
1 file changed, 1 insertion(+), 36 deletions(-)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 870abad7717..174364d1314 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -139,12 +139,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.
@@ -1012,35 +1006,6 @@ out:
return err < 0 ? err : count;
}
-static int oom_adjust_permission(struct inode *inode, int mask)
-{
- uid_t uid;
- struct task_struct *p;
-
- 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);
-}
-
-static const struct inode_operations proc_oom_adj_inode_operations = {
- .permission = oom_adjust_permission,
-};
-
static const struct file_operations proc_oom_adj_operations = {
.read = oom_adj_read,
.write = oom_adj_write,
@@ -2793,7 +2758,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_adj),
+ REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adj_operations),
REG("oom_score_adj", S_IRUGO|S_IWUSR, proc_oom_score_adj_operations),
#ifdef CONFIG_AUDITSYSCALL
REG("loginuid", S_IWUSR|S_IRUGO, proc_loginuid_operations),
--
2.23.0