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:   Sun, 17 Sep 2023 19:58:26 -0600
From:   "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To:     Leon Romanovsky <leon@...nel.org>
Cc:     Kees Cook <keescook@...omium.org>,
        "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        Jason Gunthorpe <jgg@...pe.ca>, linux-rdma@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v2][next] RDMA/core: Use size_{add,mul}() in calls to
 struct_size()



On 9/18/23 06:41, Leon Romanovsky wrote:
> On Sun, Sep 17, 2023 at 01:59:26PM -0600, Gustavo A. R. Silva wrote:
>>
>>
>> On 9/18/23 04:49, Leon Romanovsky wrote:
>>> On Fri, Sep 15, 2023 at 12:06:21PM -0600, Gustavo A. R. Silva wrote:
>>>>
>>>>
>>>> On 9/14/23 21:29, Kees Cook wrote:
>>>>> On Mon, Sep 11, 2023 at 05:27:59PM -0600, Gustavo A. R. Silva wrote:
>>>>>> Harden calls to struct_size() with size_add() and size_mul().
>>>>>
>>>>> Specifically, make sure that open-coded arithmetic cannot cause an
>>>>> overflow/wraparound. (i.e. it will stay saturated at SIZE_MAX.)
>>>>
>>>> Yep; I have another patch where I explain this in similar terms.
>>>>
>>>> I'll send it, shortly.
>>>
>>> You missed other places with similar arithmetic.
>>> drivers/infiniband/core/device.c:       pdata_rcu = kzalloc(struct_size(pdata_rcu, pdata,
>>> drivers/infiniband/core/device.c-                                       rdma_end_port(device) + 1),
>>> drivers/infiniband/core/device.c-                           GFP_KERNEL);
>>>
>>> drivers/infiniband/core/sa_query.c:     sa_dev = kzalloc(struct_size(sa_dev, port, e - s + 1), GFP_KERNEL);
>>> drivers/infiniband/core/user_mad.c:     umad_dev = kzalloc(struct_size(umad_dev, ports, e - s + 1), GFP_KERNEL);
>>
>> I haven't sent all my patches.
> 
> Please sent one patch for whole drivers/infiniband/core/ folder as your
> title: "RDMA/core ..." suggests.

OK. Done:

https://lore.kernel.org/linux-hardening/ZQdt4NsJFwwOYxUR@work/

Thanks
--
Gustavo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ