Messages in this thread | | | Date | Tue, 4 Jan 2005 14:17:12 -0800 | From | Chris Wright <> | Subject | Re: [RFC] [PATCH] merge *_vm_enough_memory()s into a common helper |
| |
* 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 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |