[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110127134710.GB519@camk.edu.pl>
Date: Thu, 27 Jan 2011 14:47:10 +0100
From: Kacper Kornet <kornet@...k.edu.pl>
To: linux-kernel@...r.kernel.org
Cc: Jiri Slaby <jslaby@...e.cz>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [PATCH] Fix prlimit64 for suid/sgid processes
Since check_prlimit_permission always fails in the case of SUID/GUID
processes, such processes are not able to read or set their own limits.
This commit changes this by assuming that process can always read/change
its own limits.
Signed-off-by: Kacper Kornet <kornet@...k.edu.pl>
---
kernel/sys.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/kernel/sys.c b/kernel/sys.c
index e9ad444..0aaafde 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1409,10 +1409,12 @@ SYSCALL_DEFINE4(prlimit64, pid_t, pid, unsigned int, resource,
rcu_read_unlock();
return -ESRCH;
}
- ret = check_prlimit_permission(tsk);
- if (ret) {
- rcu_read_unlock();
- return ret;
+ if (tsk != current) {
+ ret = check_prlimit_permission(tsk);
+ if (ret) {
+ rcu_read_unlock();
+ return ret;
+ }
}
get_task_struct(tsk);
rcu_read_unlock();
--
Kacper Kornet
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists