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]
Date:	Wed, 17 Sep 2014 22:18:23 +0900
From:	Roman Peniaev <r.peniaev@...il.com>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	Ming Lei <ming.lei@...onical.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] init: fix race between rootfs mount and firmware loading

On Tue, Sep 16, 2014 at 1:39 AM, Oleg Nesterov <oleg@...hat.com> wrote:
> On 09/15, Roman Pen wrote:
>>
>> +static DECLARE_COMPLETION(rootfs_mounted);
>> +
>> +void wait_for_rootfs(void)
>> +{
>> +     /* Avoid waiting for ourselves */
>> +     if (is_global_init(current))
>> +             pr_warn("it is not a good idea to wait for rootfs mount from init task\n");
>> +     else
>> +             wait_for_completion(&rootfs_mounted);
>> +}
>> +
>> +static inline void wake_up_rootfs_waiters(void)
>> +{
>> +     complete(&rootfs_mounted);
>> +}
>
> Probably you need complete_all() ?

Yes, of course. My fault.

>
> Otherwise wait_for_rootfs() can return only once, the next call will block
> forever. And perhaps it would be better to use another primitive, even if
> UINT_MAX/2 should be enough.

And why do you think completion is not good for this?
Seems it is impossible to have so many threads on early init, which wait
for rootfs.

Oleg, I prepared version 2 (will be in reply to this email). What I did there:

1/ wait_for_rootfs should be exported, because framework_class.c is a tristate,
    thus can be built as module.

2/ replaced completion on wait_event and wake_up_all pair.

3/ did some minor tweaks.

--
Roman
--
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