From: Andries Brouwer <Andries.Brouwer@cwi.nl>
To: Nikita Danilov <nikita@clusterfs.com>, torvalds@osdl.org
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@osdl.org>,
Andries.Brouwer@cwi.nl
Subject: [PATCH] remove duplicated patch fragment
Date: Tue, 4 Jan 2005 18:26:14 +0100 [thread overview]
Message-ID: <20050104172614.GB12861@apps.cwi.nl> (raw)
In-Reply-To: <m14qhxmkw4.fsf@clusterfs.com>
On Tue, Jan 04, 2005 at 03:36:11PM +0300, Nikita Danilov wrote:
> /*
> * Leave the last 3% for root
> */
> if (!capable(CAP_SYS_ADMIN))
> allowed -= allowed / 32;
>
> /* Leave the last 3% for root */
> if (current->euid)
> allowed -= allowed / 32;
>
> in security/commoncaps.c (and similarly in security/dummy.c). Why
> "super-user" reservation is handled twice, and with that antiquated
> current->euid check instead of capabilities? Broken merge?
Yes - sorry. The first of these two semi-identical fragments
is from Alan and appeared in patch-2.6.9, two weeks after
the patch under discussion was made. So, the second half
can be dropped. Below a patch.
> On another account, shouldn't capable(CAP_SYS_ADMIN) checks in
> cap_vm_enough_memory() be replaced with capable(CAP_SYS_RESOURCE):
> (CAP_SYS_RESOURCE is used by file systems to control reserved disk
> blocks)?
The use of current->euid comes from the use of current->euid in dummy.c
a few lines higher up in the same routine.
The use of CAP_SYS_ADMIN comes from the use of CAP_SYS_ADMIN in
commoncap.c a few lines higher up in the same routine.
I have no strong opinion about what is best.
Andries
diff -uprN -X /linux/dontdiff a/security/commoncap.c b/security/commoncap.c
--- a/security/commoncap.c 2005-01-04 18:33:40.000000000 +0100
+++ b/security/commoncap.c 2005-01-04 18:35:49.000000000 +0100
@@ -386,10 +386,6 @@ int cap_vm_enough_memory(long pages)
allowed -= allowed / 32;
allowed += total_swap_pages;
- /* Leave the last 3% for root */
- if (current->euid)
- allowed -= allowed / 32;
-
/* Don't let a single process grow too big:
leave 3% of the size of this process for other processes */
allowed -= current->mm->total_vm / 32;
next prev parent reply other threads:[~2005-01-04 17:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200501040611.j046BHoq005158@hera.kernel.org>
2005-01-04 12:36 ` [PATCH] mm: overcommit updates Nikita Danilov
2005-01-04 17:26 ` Andries Brouwer [this message]
2005-01-04 22:21 ` [PATCH] remove duplicated patch fragment Chris Wright
2005-01-04 22:35 ` Chris Wright
2005-01-04 22:03 ` [PATCH] mm: overcommit updates Alan Cox
2005-01-04 23:38 ` Andries Brouwer
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=20050104172614.GB12861@apps.cwi.nl \
--to=andries.brouwer@cwi.nl \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nikita@clusterfs.com \
--cc=torvalds@osdl.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).