Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 2 Aug 2011 21:43:23 -1000
From: Linus Torvalds <>
To: Vasiliy Kulikov <>
Cc: Manuel Lauss <>,,
        Richard Weinberger <>,
        Marc Zyngier <>,
        Andrew Morton <>, Ingo Molnar <>,,
        "Paul E. McKenney" <>
Subject: Re: [PATCH] shm: fix a race between shm_exit() and shm_init()

On Tue, Aug 2, 2011 at 2:45 AM, Vasiliy Kulikov <> wrote:
> From: Vasiliy Kulikov <>
> Subject: [PATCH] shm: fix a race between shm_exit() and shm_init()

This patch is disgusting.

Doing things like this:

> +       /*
> +        * For init_ipc_ns shm_ids().rw_mutex is statically initialized
> +        * as kernel threads should be able to use it in do_exit() before
> +        * shm_init(), which is called on do_initcall()
> +        */
> +       if (ns == &init_ipc_ns)
> +               __ipc_init_ids(&shm_ids(ns));
> +       else
> +               ipc_init_ids(&shm_ids(ns));

should have told you that there is something totally wrong with your patch.

I'd prefer to really do the initialization in the allocator (at which
point it would be very natural to do the initialization statically for
a static allocation, and you wouldn't have the above kind of nasty
conditional stuff), but that whole namespace initialization and setup
just looks pretty nasty.

Looking at some of the other cases like net_ns_init(), maybe the
proper fix is to just make 'ipc_ns_init()' be a pure_initcall().

Does the attached patch work?


View attachment "patch.diff" of type "text/x-patch" (654 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.