![]() | |||||||||||||
Messages in this thread |
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
| ||||||||||||
| Last update: 2008-03-02 08:55 [from the cache] ©2003-2008 | |||||||||||||