[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Xine.LNX.4.64.0803040906380.21610@us.intercode.com.au>
Date: Tue, 4 Mar 2008 09:16:19 +1100 (EST)
From: James Morris <jmorris@...ei.org>
To: "Ahmed S. Darwish" <darwish.07@...il.com>
cc: Stephen Smalley <sds@...ho.nsa.gov>,
Casey Schaufler <casey@...aufler-ca.com>,
Adrian Bunk <bunk@...nel.org>,
Chris Wright <chrisw@...s-sol.org>,
Eric Paris <eparis@...isplace.org>,
Alexey Dobriyan <adobriyan@...ru>,
LKML <linux-kernel@...r.kernel.org>,
LSM-ML <linux-security-module@...r.kernel.org>,
Anrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH -v4 -mm] LSM: Add security= boot parameter
On Mon, 3 Mar 2008, Ahmed S. Darwish wrote:
> static inline int verify(struct security_operations *ops)
> {
> /* verify the security_operations structure exists */
> - if (!ops)
> + if (!ops || !ops->name)
> return -EINVAL;
verify() will now be called after ops->name has been referenced, so these
checks won't be necessary now.
> +int security_module_enable(struct security_operations *ops)
> +{
> + if (!ops || !ops->name) {
> + BUG();
> + return 0;
> + }
It's not going to return after BUG(), and actually, you can probably just
rely on the subsequent oops (i.e. no check needed).
> +
> + if (!*chosen_lsm && atomic_inc_and_test(&security_ops_enabled))
> + return 1;
> +
> + if (!strncmp(ops->name, chosen_lsm, SECURITY_NAME_MAX))
> + return 1;
I still think you should use a spinlock here to make the semantics
simpler. Dispense with the confusingly named security_ops_enabled, and
fill chosen_lsm in with the first lsm to regsiter if none chosen at boot.
> + printk(KERN_INFO "SELinux: Another security module was chosen.\n");
> + printk(KERN_INFO "SELinux: Use security=%s to force loading "
> + "SELinux on boot.\n", selinux_ops.name);
These messages are not going to scale, e.g. what if there are 20 LSMs
compiled in, and they all print this on boot? Just print the chosen LSM
in security_module_enabled().
- James
--
James Morris
<jmorris@...ei.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists