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: <202308251357.38AF364@keescook>
Date:   Fri, 25 Aug 2023 14:03:23 -0700
From:   Kees Cook <keescook@...omium.org>
To:     James Seo <james@...iv.tech>
Cc:     Sathya Prakash <sathya.prakash@...adcom.com>,
        Sreekanth Reddy <sreekanth.reddy@...adcom.com>,
        Suganath Prabu Subramani 
        <suganath-prabu.subramani@...adcom.com>,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        MPT-FusionLinux.pdl@...adcom.com, linux-scsi@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 03/12] scsi: mpt3sas: Make
 MPI2_CONFIG_PAGE_RAID_VOL_0::PhysDisk[] a flexible array

On Sun, Aug 06, 2023 at 10:05:55AM -0700, James Seo wrote:
> This terminal 1-length variable array can be directly converted into
> a C99 flexible array member.
> 
> As all users of MPI2_CONFIG_PAGE_RAID_VOL_0 (Mpi2RaidVolPage0_t)
> either calculate its size without depending on its sizeof() or do not
> use PhysDisk[], no further source changes are required:

Tons of binary changes in this file too. I see this:

        Mpi2RaidVolPage0_t config_page;
	...
        r = _config_request(ioc, &mpi_request, &mpi_reply,
            MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT, &config_page,
            sizeof(Mpi2RaidVolPage0_t));

So it's already changing this size (and possibly under-allocating now).

> - mpt3sas_config.c:mpt3sas_config_get_number_pds() fetches a
>   Mpi2RaidVolPage0_t for itself, but does not use PhysDisk[].

Is it certain that _config_request()'s use of mpt3sas_wait_for_ioc()
won't result in the hardware being upset that config_page_sz shrank?

> @@ -1826,8 +1823,7 @@ typedef struct _MPI2_CONFIG_PAGE_RAID_VOL_0 {
>  	U8                      Reserved2;         /*0x25 */
>  	U8                      Reserved3;         /*0x26 */
>  	U8                      InactiveStatus;    /*0x27 */
> -	MPI2_RAIDVOL0_PHYS_DISK
> -	PhysDisk[MPI2_RAID_VOL_PAGE_0_PHYSDISK_MAX]; /*0x28 */
> +	MPI2_RAIDVOL0_PHYS_DISK PhysDisk[];        /*0x28 */
>  } MPI2_CONFIG_PAGE_RAID_VOL_0,

Without the mpt3sas maintainers chiming in on this, I think the only
safe changes to make here are those with 0 binary differences. So for
things like this, it'll need to be:

-	MPI2_RAIDVOL0_PHYS_DISK
-	PhysDisk[MPI2_RAID_VOL_PAGE_0_PHYSDISK_MAX]; /*0x28 */
+	union {
+		MPI2_RAIDVOL0_PHYS_DISK legacy_padding;        /*0x28 */
+		DECLARE_FLEX_ARRAY(MPI2_RAIDVOL0_PHYS_DISK, PhysDisk);
+	};

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ