public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* initcall dependency problem (ns vs. threads)
@ 2011-08-01 18:01 Vasiliy Kulikov
  2011-08-01 18:20 ` Andrew Morton
  0 siblings, 1 reply; 31+ messages in thread
From: Vasiliy Kulikov @ 2011-08-01 18:01 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Ingo Molnar, kernel-hardening, Paul E. McKenney, Manuel Lauss,
	linux-kernel, Richard Weinberger, torvalds, Marc Zyngier

Hi,

There were reported problems with recent shm changes, by Manuel
Lauss (on MIPS), Richard Weinberger (on UML), and Marc Zyngier (on ARM).

https://lkml.org/lkml/2011/8/1/149
https://lkml.org/lkml/2011/8/1/162
https://lkml.org/lkml/2011/8/1/210

The problem became visible on this patch:

    commit 5774ed014f02120db9a6945a1ecebeb97c2acccb
    Author: Vasiliy Kulikov <segoon@openwall.com>
    Date:   Fri Jul 29 03:55:31 2011 +0400

        shm: handle separate PID namespaces case

It started to use &shm_ids(ns).rw_mutex, which is not initialized yet.
Init IPC namespace is initialized as initcall() and some threads are
created as early_initcall().

I threat it is a dependency bug in the core kernel - kernel threads
should be able to use any namespace information, but currently there is
a race between namespace initialization code (which is initcall) and
kernel threads (which are early_initcall).

I don't feel enough experienced in init code dependencies, so I report
it to you.

    static int __init kernel_init(void * unused)
    {
        ...
        do_pre_smp_initcalls(); << threads start here
        ...
        do_basic_setup();


    static void __init do_basic_setup(void)
    {
        cpuset_init_smp();
        usermodehelper_init();
        init_tmpfs();
        driver_init();
        init_irq_proc();
        do_ctors();
        do_initcalls(); << namespace init here
    }

Thanks,

-- 
Vasiliy

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2011-08-04  8:26 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-01 18:01 initcall dependency problem (ns vs. threads) Vasiliy Kulikov
2011-08-01 18:20 ` Andrew Morton
2011-08-01 18:34   ` [kernel-hardening] " Vasiliy Kulikov
2011-08-01 19:03   ` Vasiliy Kulikov
2011-08-01 19:07     ` Andrew Morton
2011-08-01 19:22       ` Vasiliy Kulikov
2011-08-02  0:01     ` Linus Torvalds
2011-08-02 12:45       ` [PATCH] shm: fix a race between shm_exit() and shm_init() Vasiliy Kulikov
2011-08-02 12:51         ` Manuel Lauss
2011-08-02 13:23         ` Richard Weinberger
2011-08-02 13:29         ` Marc Zyngier
2011-08-02 20:33         ` Andrew Morton
2011-08-02 20:55         ` Andrew Morton
2011-08-03  5:30           ` Manuel Lauss
2011-08-03  8:05           ` Marc Zyngier
2011-08-03  8:19             ` Linus Torvalds
2011-08-03 10:04               ` Manuel Lauss
2011-08-03 10:30               ` Marc Zyngier
2011-08-03 13:13                 ` Thadeu Lima de Souza Cascardo
2011-08-03 13:33                   ` Kay Sievers
2011-08-03 13:45                     ` Richard Weinberger
2011-08-04  0:35                 ` Linus Torvalds
2011-08-04  0:50                   ` Andrew Morton
2011-08-04  1:01                     ` Linus Torvalds
2011-08-04  1:15                       ` Kay Sievers
2011-08-04  8:26                   ` Marc Zyngier
2011-08-03  7:43         ` Linus Torvalds
2011-08-03  7:50           ` Manuel Lauss
2011-08-03  8:00             ` Manuel Lauss
2011-08-03 19:33           ` Andrew Morton
2011-08-03 19:52             ` [kernel-hardening] " Vasiliy Kulikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox