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] [day] [month] [year] [list]
Date:   Wed, 31 May 2017 16:31:18 +0800
From:   Jia-Ju Bai <baijiaju1990@....com>
To:     Jia-Ju Bai <baijiaju1990@....com>
CC:     kent.overstreet@...il.com, shli@...nel.org, axboe@...com,
        mchristi@...hat.com, git@...ux.ewheeler.net, colyli@...e.de,
        akpm@...ux-foundation.org, wangyijing@...wei.com, mingo@...nel.org,
        mhocko@...e.com, linux-bcache@...r.kernel.org,
        linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bcache: Fix a sleep-in-atomic bug

On 05/31/2017 03:23 PM, Jia-Ju Bai wrote:
> The driver may sleep under a spin lock, and the function call path is:
> journal_wait_for_write (acquire the lock by spin_lock)
>    closure_sync
>      schedule -->  may sleep
>
> To fix it, the lock is released before "closure_sync", and the lock is
> acquired again after this function.
>
> Signed-off-by: Jia-Ju Bai<baijiaju1990@....com>
> ---
>   drivers/md/bcache/journal.c |    1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c
> index 1198e53..ad47c36 100644
> --- a/drivers/md/bcache/journal.c
> +++ b/drivers/md/bcache/journal.c
> @@ -724,6 +724,7 @@ static struct journal_write *journal_wait_for_write(struct cache_set *c,
>   			btree_flush_write(c);
>   		}
>
> +		spin_unlock(&c->journal.lock);
>   		closure_sync(&cl);
>   		spin_lock(&c->journal.lock);
>   		wait = true;

Sorry, my patch is not correct, and it will cause double unlock.
Please ignore my patch.


Jia-Ju Bai

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ