From: Chris Wright <chrisw@osdl.org>
To: "Serge E. Hallyn" <serue@us.ibm.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
chrisw@osdl.org, sds@epoch.ncsc.mil
Subject: Re: [RFC] [PATCH] merge *_vm_enough_memory()s into a common helper
Date: Tue, 4 Jan 2005 14:17:12 -0800 [thread overview]
Message-ID: <20050104141712.E469@build.pdx.osdl.net> (raw)
In-Reply-To: <20050104214833.GA3420@IBM-BWN8ZTBWA01.austin.ibm.com>; from serue@us.ibm.com on Tue, Jan 04, 2005 at 03:48:33PM -0600
* Serge E. Hallyn (serue@us.ibm.com) wrote:
I'm fine with this with a few nits. Although I don't think it will apply
to current bk which has merge error in this area right now. Stephen,
are you ok with the way this one generates audit messages?
> + return __vm_enough_memory(pages,
> + (cap_capable(current, CAP_SYS_ADMIN) == 0));
A temp variable isn't going to be costly and makes it easier to read.
> + return __vm_enough_memory(pages,
> + (dummy_capable(current, CAP_SYS_ADMIN) == 0));
same here
> + * Note that secondary_ops->capable and task_has_perm return 0 if
> + * the capability is granted, but __vm_enough_memory requires 1 if
> + * the capability is granted.
> */
> static int selinux_vm_enough_memory(long pages)
> {
> - unsigned long free, allowed;
> - int rc;
> + int rc, cap_sys_admin = 0;
<snip>
> + rc = secondary_ops->capable(current, CAP_SYS_ADMIN);
> + if (rc == 0)
> + cap_sys_admin = avc_has_perm_noaudit(tsec->sid, tsec->sid,
> + SECCLASS_CAPABILITY,
> + CAP_TO_MASK(CAP_SYS_ADMIN),
> + NULL);
>
> - vm_unacct_memory(pages);
> + if (rc == 0)
> + cap_sys_admin = 1;
This sure looks wrong. Did you mean rc = avc_has_perm_noaudit()?
thanks,
-chris
--
Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net
next prev parent reply other threads:[~2005-01-04 22:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-04 21:48 [RFC] [PATCH] merge *_vm_enough_memory()s into a common helper Serge E. Hallyn
2005-01-04 22:10 ` Stephen Smalley
2005-01-04 22:17 ` Chris Wright [this message]
2005-01-04 22:17 ` Stephen Smalley
2005-01-04 22:26 ` Chris Wright
2005-01-04 22:59 ` Nikita Danilov
2005-01-05 0:15 ` Alan Cox
2005-01-05 11:25 ` Christoph Hellwig
2005-01-05 13:17 ` Hugh Dickins
2005-01-05 16:30 ` Serge E. Hallyn
2005-01-05 19:24 ` Chris Wright
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=20050104141712.E469@build.pdx.osdl.net \
--to=chrisw@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sds@epoch.ncsc.mil \
--cc=serue@us.ibm.com \
/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