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:   Tue, 7 Mar 2023 09:42:18 +0800
From:   Yu Kuai <yukuai1@...weicloud.com>
To:     Julian Ruess <julianr@...ux.ibm.com>,
        Alexander Egorenkov <egorenar@...ux.ibm.com>,
        syzbot+2bcc0d79e548c4f62a59@...kaller.appspotmail.com
Cc:     axboe@...nel.dk, linux-block@...r.kernel.org,
        linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com,
        jack@...e.cz, hch@....de, Niklas Schnelle <schnelle@...ux.ibm.com>,
        Gerd Bayer <gbayer@...ux.ibm.com>,
        "yukuai (C)" <yukuai3@...wei.com>
Subject: Re: [syzbot] [block?] WARNING in blkdev_put (2)

Hi,

在 2023/03/06 23:00, Julian Ruess 写道:
> On Thu, 2023-03-02 at 20:33 +0100, Alexander Egorenkov wrote:
>>
>> Hi,
>>
>> we are seeing a similar problem on s390x architecture when
>> partitioning
>> a NVMe disk on linux-next.
>>
>>
>>    [   70.403015]  nvme0n1: p1
>>    [   70.403197] ------------[ cut here ]------------
>>    [   70.403199] WARNING: CPU: 8 PID: 2452 at block/bdev.c:845
>> blkdev_put+0x280/0x298
> 
> ...
> 
>> The problem appeared about a week ago.
>>
>> Regards
>> Alex
> 
> Hi all,
> 
> I bisected this to:
> 
> commit e5cfefa97bccf956ea0bb6464c1f6c84fd7a8d9f
> Author: Yu Kuai <yukuai3@...wei.com>
> Date:   Fri Feb 17 10:22:00 2023 +0800
>                                                                                        
>      block: fix scan partition for exclusively open device again

Yes, thanks for the report, I figure out that I made a mistake here.

Following patch should fix this problem:

diff --git a/block/genhd.c b/block/genhd.c
index 3ee5577e1586..02d9cfb9e077 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -385,7 +385,7 @@ int disk_scan_partitions(struct gendisk *disk, 
fmode_t mode)
         if (IS_ERR(bdev))
                 ret =  PTR_ERR(bdev);
         else
-               blkdev_put(bdev, mode);
+               blkdev_put(bdev, mode & ~FMODE_EXCL);

Thanks,
Kuai
>                                                                                        
>      As explained in commit 36369f46e917 ("block: Do not reread
> partition table
>      on exclusively open device"), reread partition on the device that
> is
>      exclusively opened by someone else is problematic.
>                                                                                        
>      This patch will make sure partition scan will only be proceed if
> current
>      thread open the device exclusively, or the device is not opened
>      exclusively, and in the later case, other scanners and exclusive
> openers
>      will be blocked temporarily until partition scan is done.
>                                                                                        
>      Fixes: 10c70d95c0f2 ("block: remove the bd_openers checks in
> blk_drop_partitions")
>      Cc: <stable@...r.kernel.org>
>      Suggested-by: Jan Kara <jack@...e.cz>
>      Signed-off-by: Yu Kuai <yukuai3@...wei.com>
>      Reviewed-by: Christoph Hellwig <hch@....de>
>      Link:
> https://lore.kernel.org/r/20230217022200.3092987-3-yukuai1@huaweicloud.com
>   
>      Signed-off-by: Jens Axboe <axboe@...nel.dk>
> 
> 
> 
> Regards
> Julian
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ