summaryrefslogtreecommitdiffstats
path: root/kernel/sys.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-08-20 19:39:12 +0200
committerDavid S. Miller <davem@davemloft.net>2011-08-20 19:39:12 +0200
commit823dcd2506fa369aeb8cbd26da5663efe2fda9a9 (patch)
tree853b3e3c05f0b9ee1b5df8464db19b7acc57150c /kernel/sys.c
parenttg3: Update version to 3.120 (diff)
parentipv6: Fix ipv6_getsockopt for IPV6_2292PKTOPTIONS (diff)
downloadlinux-823dcd2506fa369aeb8cbd26da5663efe2fda9a9.tar.xz
linux-823dcd2506fa369aeb8cbd26da5663efe2fda9a9.zip
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'kernel/sys.c')
-rw-r--r--kernel/sys.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/kernel/sys.c b/kernel/sys.c
index a101ba36c444..dd948a1fca4c 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -621,11 +621,18 @@ static int set_user(struct cred *new)
if (!new_user)
return -EAGAIN;
+ /*
+ * We don't fail in case of NPROC limit excess here because too many
+ * poorly written programs don't check set*uid() return code, assuming
+ * it never fails if called by root. We may still enforce NPROC limit
+ * for programs doing set*uid()+execve() by harmlessly deferring the
+ * failure to the execve() stage.
+ */
if (atomic_read(&new_user->processes) >= rlimit(RLIMIT_NPROC) &&
- new_user != INIT_USER) {
- free_uid(new_user);
- return -EAGAIN;
- }
+ new_user != INIT_USER)
+ current->flags |= PF_NPROC_EXCEEDED;
+ else
+ current->flags &= ~PF_NPROC_EXCEEDED;
free_uid(new->user);
new->user = new_user;