From: Kingsley Cheung <kingsley@aurema.com>
To: linux-kernel@vger.kernel.org
Cc: trivial@rustcorp.com.au
Subject: [PATCH] setrlimit incorrectly allows hard limits to exceed soft limits
Date: Mon, 11 Nov 2002 15:10:05 +1100 [thread overview]
Message-ID: <20021111151005.B14949@aurema.com> (raw)
Hi,
In 2.4.19 (also 2.5.46) setrlimit code only ever makes a comparison to
check the old soft limit with the new soft limit and the new hard
limit with the old hard limit. There is never a check to ensure the
new soft limit never exceeds the new hard limit.
Just try "ulimit -H -m 10000" for memory limits that were not
previously set. You end up with (hard limit = 10000) < (soft limit =
unlimited).
Fix is trivial.
--- sys.c Sat Aug 3 10:39:46 2002
+++ edited.sys.c Mon Nov 11 14:49:19 2002
@@ -1118,6 +1118,8 @@
if (resource >= RLIM_NLIMITS)
return -EINVAL;
+ if (new_rlim.rlim_cur > new_rlim.rlim_max)
+ return -EINVAL;
if(copy_from_user(&new_rlim, rlim, sizeof(*rlim)))
return -EFAULT;
old_rlim = current->rlim + resource;
--
Kingsley
next reply other threads:[~2002-11-11 4:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-11 4:10 Kingsley Cheung [this message]
2002-11-11 4:59 ` [PATCH] setrlimit incorrectly allows hard limits to exceed soft limits Kingsley Cheung
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20021111151005.B14949@aurema.com \
--to=kingsley@aurema.com \
--cc=linux-kernel@vger.kernel.org \
--cc=trivial@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.