Re: [PATCH] selinux: init target class when add avc callback

From: Andrew Morton
Date: Tue Mar 06 2012 - 19:49:16 EST


On Tue, 06 Mar 2012 19:41:33 -0500
Eric Paris <eparis@xxxxxxxxxxxxxx> wrote:

> __initcall() functions aren't serialized? I guess that would be bad and
> we would need a lock. I wonder if there are other places I assumed
> __initcall() would be serialized (note that all of these call sites are
> built in and not modules if that makes a difference)

There's plenty of code in the kernel which assumes that initcalls
are singly-threaded. And init/main.c:do_initcalls() is very
singly-threaded! It's less clear when the initcall is executed by
modprobe, but presumably there's something in the module code which
prevents concurrent execution of module_init() functions.

So I think the list management code is acceptable, as long as we ensure
that the function is only ever called from initcall functions. We can
add a comment, but a neat way of ensuring this is to mark the function
__init. This saves memory and will cause a build-time warning if we
screw up.

My point was that given that this function is only ever called from
initcalls, that weak GFP_ATOMIC could/should be replaced with
GFP_KERNEL.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/