lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD6h2NRGiD=hDOjF8CBDrKuBZm-ALOdcj8mT=h6Cde4PuU=AHw@mail.gmail.com>
Date:	Tue, 12 Feb 2013 10:52:10 +0800
From:	Haojian Zhuang <haojian.zhuang@...aro.org>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	viro@...iv.linux.org.uk, rusty@...tcorp.com.au,
	hpa@...ux.intel.com, jim.cromie@...il.com,
	linux-kernel@...r.kernel.org,
	Russell King - ARM Linux <linux@....linux.org.uk>,
	Linus Walleij <linus.walleij@...aro.org>,
	Grant Likely <grant.likely@...retlab.ca>, arnd@...db.de,
	broonie@...nsource.wolfsonmicro.com,
	Patch Tracking <patches@...aro.org>
Subject: Re: [PATCH] driver core: add wait event for deferred probe

On 12 February 2013 07:10, Andrew Morton <akpm@...ux-foundation.org> wrote:
> On Sun, 10 Feb 2013 00:57:57 +0800
> Haojian Zhuang <haojian.zhuang@...aro.org> wrote:
>
>> do_initcalls() could call all driver initialization code in kernel_init
>> thread. It means that probe() function will be also called from that
>> time. After this, kernel could access console & release __init section
>> in the same thread.
>>
>> But if device probe fails and moves into deferred probe list, a new
>> thread is created to reinvoke probe. If the device is serial console,
>> kernel has to open console failure & release __init section before
>> reinvoking failure. Because there's no synchronization mechanism.
>> Now add wait event to synchronize after do_initcalls().
>
> It sounds like this:
>
> static int __ref kernel_init(void *unused)
> {
>         kernel_init_freeable();
>         /* need to finish all async __init code before freeing the memory */
>         async_synchronize_full();
>
> is designed to prevent the problem you describe?
>
It can't prevent the problem that I described. Because deferred_probe()
is introduced recently.

All synchronization should be finished just after do_initcalls(). Since
load_default_modules() is also called in the end of kernel_init_freeable(),
I'm not sure that whether I could remove async_synchronize_full()
here. So I didn't touch it.

>> --- a/init/main.c
>> +++ b/init/main.c
>> @@ -786,6 +786,7 @@ static void __init do_basic_setup(void)
>>       do_ctors();
>>       usermodehelper_enable();
>>       do_initcalls();
>> +     wait_for_device_probe();
>>  }
>
> Needs a nice comment here explaining what's going on.

No problem. I'll add comment here.

Regards
Haojian
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ