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:   Mon, 30 Oct 2023 17:26:51 +0800
From:   Yu Kuai <yukuai1@...weicloud.com>
To:     zhongjinghua <zhongjinghua@...weicloud.com>,
        Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
        axboe@...nel.dk
Cc:     linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
        zhongjinghua@...wei.com, yi.zhang@...wei.com,
        "yukuai (C)" <yukuai3@...wei.com>
Subject: Re: [PATCH] block: Fix minor range check in device_add_disk()

Hi,

在 2023/10/26 16:52, zhongjinghua 写道:
> 
> 在 2023/10/25 18:06, Tetsuo Handa 写道:
>> On 2023/10/25 17:46, Zhong Jinghua wrote:
>>> Checks added in patch:
>>> commit e338924bd05d ("block: check minor range in device_add_disk()")
>>> ignore the problem of first_minore < 0 and disk->minors < 0.
>> What is the problem of first_minor < 0 or disk->minors < 0 ?
>> Are negative values legal/illegal ?
> 
> These two values are used as the secondary device number and the maximum 
> number of partitions, which is illegal if negative. Then first_minore 
> and disk->minors are signed numbers, and the sum may be less than 
> MINORMASK to bypass the check.

Let me complement it, first_minor and minors can be set by driver, and
driver allow set them throuhh ioctl/sysfs from user parameters, for
example:

If user pass in -1, and each disk support 8 partitions, driver will
usually set:

disk->first_minor = -1 * 8 = -8;
disk->minors = 8;

Then first_minor + minors = 0, then the following condition can't detect
this case:

if (disk->first_minor + disk->minors > MINORMASK + 1)

By the way, we never limit how first_minor and minors is set by driver,
and it's illegal if driver set first_minor = -4, and minors = 8.

Thanks,
Kuai

> 
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ