[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080302074912.GA3215@ubuntu>
Date: Sun, 2 Mar 2008 09:49:12 +0200
From: "Ahmed S. Darwish" <darwish.07@...il.com>
To: Casey Schaufler <casey@...aufler-ca.com>
Cc: Adrian Bunk <bunk@...nel.org>, Chris Wright <chrisw@...s-sol.org>,
Stephen Smalley <sds@...ho.nsa.gov>,
James Morris <jmorris@...ei.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 -v2 -mm] LSM: Add security= boot parameter
On Sun, Mar 02, 2008 at 01:27:08AM +0200, Ahmed S. Darwish wrote:
> Hi!,
>
...
> LSM modules must check now if they are allowed to register
> by calling security_module_enable(ops) first. Modify SELinux
> and SMACK to do so.
>
...
>
> +/* Boot-time LSM user choice */
> +static char chosen_lsm[SECURITY_NAME_MAX + 1];
> +static atomic_t security_ops_registered = ATOMIC_INIT(0);
>
...
> +int security_module_enable(struct security_operations *ops)
> +{
> + if (!ops || !ops->name)
> + return 0;
> +
> + if (!*chosen_lsm && !atomic_read(&security_ops_registered))
> + return 1;
> +
...
> @@ -90,6 +134,7 @@ int register_security(struct security_operations *ops)
> return -EAGAIN;
>
> security_ops = ops;
> + atomic_inc(&security_ops_registered);
>
I'm worried about an implementation detail here. Must the LSM
init calls sequence:
asmlinkage void __init start_kernel(void)
{
preempt_disable();
...
security_init();
...
int __init security_init(void)
{
...
do_security_initcalls();
}
static void __init do_security_initcalls(void)
{
initcall_t *call;
call = __security_initcall_start;
while (call < __security_initcall_end) {
(*call) ();
call++;
}
}
be SMP safe ?
In other words, can the two LSMs 'security_initcall()'s
(i.e. smack_init() and selinux_init()) be executed concurrently ?
If so, this patch won't be safe.
I'll send a modified one once I know the answer.
Thanks everybody,
--
"Better to light a candle, than curse the darkness"
Ahmed S. Darwish
Homepage: http://darwish.07.googlepages.com
Blog: http://darwish-07.blogspot.com
--
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