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]
Message-ID: <0255091d-e3df-7a4a-fa4c-7f9ae7226c73@embeddedor.com>
Date:   Thu, 1 Sep 2022 23:12:30 +0100
From:   "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To:     Kees Cook <keescook@...omium.org>,
        Bradley Grove <linuxdrivers@...otech.com>
Cc:     "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-hardening@...r.kernel.org
Subject: Re: [PATCH] esas2r: Use flex array destination for memcpy()



On 9/1/22 15:57, Kees Cook wrote:
> In preparation for FORTIFY_SOURCE performing run-time destination buffer
> bounds checking for memcpy(), specify the destination output buffer
> explicitly, instead of asking memcpy() to write past the end of what
> looked like a fixed-size object. Silences future run-time warning:
> 
>    memcpy: detected field-spanning write (size 80) of single field "trc + 1" (size 64)
> 
> There is no binary code output differences from this change.
> 
> Cc: Bradley Grove <linuxdrivers@...otech.com>
> Cc: "James E.J. Bottomley" <jejb@...ux.ibm.com>
> Cc: "Martin K. Petersen" <martin.petersen@...cle.com>
> Cc: linux-scsi@...r.kernel.org
> Signed-off-by: Kees Cook <keescook@...omium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@...nel.org>

Thanks
--
Gustavo

> ---
>   drivers/scsi/esas2r/atioctl.h      | 1 +
>   drivers/scsi/esas2r/esas2r_ioctl.c | 3 +--
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/esas2r/atioctl.h b/drivers/scsi/esas2r/atioctl.h
> index ff2ad9b38575..dd3437412ffc 100644
> --- a/drivers/scsi/esas2r/atioctl.h
> +++ b/drivers/scsi/esas2r/atioctl.h
> @@ -831,6 +831,7 @@ struct __packed atto_hba_trace {
>   	u32 total_length;
>   	u32 trace_mask;
>   	u8 reserved2[48];
> +	u8 contents[];
>   };
>   
>   #define ATTO_FUNC_SCSI_PASS_THRU     0x04
> diff --git a/drivers/scsi/esas2r/esas2r_ioctl.c b/drivers/scsi/esas2r/esas2r_ioctl.c
> index 08f4e43c7d9e..e003d923acbf 100644
> --- a/drivers/scsi/esas2r/esas2r_ioctl.c
> +++ b/drivers/scsi/esas2r/esas2r_ioctl.c
> @@ -947,10 +947,9 @@ static int hba_ioctl_callback(struct esas2r_adapter *a,
>   					break;
>   				}
>   
> -				memcpy(trc + 1,
> +				memcpy(trc->contents,
>   				       a->fw_coredump_buff + offset,
>   				       len);
> -
>   				hi->data_length = len;
>   			} else if (trc->trace_func == ATTO_TRC_TF_RESET) {
>   				memset(a->fw_coredump_buff, 0,

Powered by blists - more mailing lists