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]
Message-ID: <1592263673.7698.5.camel@linux.ibm.com>
Date:   Mon, 15 Jun 2020 16:27:53 -0700
From:   James Bottomley <jejb@...ux.ibm.com>
To:     "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        Kashyap Desai <kashyap.desai@...adcom.com>,
        Sumit Saxena <sumit.saxena@...adcom.com>,
        Shivasharan S <shivasharan.srikanteshwara@...adcom.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>
Cc:     megaraidlinux.pdl@...adcom.com, linux-scsi@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        "Gustavo A. R. Silva" <gustavo@...eddedor.com>
Subject: Re: [PATCH] scsi: megaraid_sas: Use array_size() helper

On Mon, 2020-06-15 at 16:47 -0500, Gustavo A. R. Silva wrote:
> The get_order() function has no 2-factor argument form, so
> multiplication
> factors need to be wrapped in array_size().
> 
> This issue was found with the help of Coccinelle and, audited and
> fixed
> manually.
> 
> Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83
> Signed-off-by: Gustavo A. R. Silva <gustavoars@...nel.org>
> ---
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index 319f241da4b6..6de44ed4cde7 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -5180,8 +5180,8 @@ megasas_alloc_fusion_context(struct
> megasas_instance *instance)
>  
>  	fusion = instance->ctrl_context;
>  
> -	fusion->log_to_span_pages = get_order(MAX_LOGICAL_DRIVES_EXT
> *
> -					      sizeof(LD_SPAN_INFO));
> +	fusion->log_to_span_pages =
> get_order(array_size(MAX_LOGICAL_DRIVES_EXT,
> +					      sizeof(LD_SPAN_INFO)))
> ;

What's the point of this?  You're replacing a constant multiplication
the compiler can compute with one it can't on the theory there might be
an overflow, which is pretty far fetched given MAX_LOGICAL_DRIVES_EXT
is 256 and sizeof(LD_SPAN_INFO) is around 82.

I thought the whole point of overflow detection was to use it for
instances where we could be tricked into triggering one by userspace
which may result in a buffer under or overflow ... this is two
constants, how could this ever be a source of an exploit?

James

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ