[dm-devel] [PATCH 4/4] libmpathpersist: ABI change: limit data-in/out size to 8192 bytes

Benjamin Marzinski bmarzins at redhat.com
Sun Mar 15 00:19:35 UTC 2020


On Sat, Mar 07, 2020 at 12:06:05AM +0100, mwilck at suse.com wrote:
> From: Martin Wilck <mwilck at suse.com>
> 
> Make sure that data structures used for PERSISTENT RESERVE IN/OUT
> fit into 8k buffers.
> 
> This patch breaks the libmpathpersist ABI.
>

I'm not super worried about this.  I don't really see a way for users to
hurt themselves because of this change, without making some pretty odd
assumptions.  Am I missing something?

Reviewed-by: Benjamin Marzinski <bmarzins at redhat.com>
> Signed-off-by: Martin Wilck <mwilck at suse.com>
> ---
>  libmpathpersist/mpath_persist.h | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/libmpathpersist/mpath_persist.h b/libmpathpersist/mpath_persist.h
> index 7cf4faf9..bdf4069d 100644
> --- a/libmpathpersist/mpath_persist.h
> +++ b/libmpathpersist/mpath_persist.h
> @@ -92,7 +92,7 @@ struct prin_readdescr
>  	uint32_t prgeneration;
>  	uint32_t additional_length;	/* The value should be either 0 or divisible by 8.
>  					   0 indicates no registered reservation key. */
> -	uint8_t	 key_list[MPATH_MAX_PARAM_LEN];
> +	uint8_t	 key_list[MPATH_MAX_PARAM_LEN - 2 * sizeof(uint32_t)];
>  };
>  
>  struct prin_resvdescr
> @@ -141,7 +141,9 @@ struct print_fulldescr_list
>  {
>  	uint32_t prgeneration;
>  	uint32_t number_of_descriptor;
> -	uint8_t private_buffer[MPATH_MAX_PARAM_LEN]; /*Private buffer for list storage*/
> +	/* Data-in; Private buffer for list storage */
> +	uint8_t private_buffer[MPATH_MAX_PARAM_LEN - 2 * sizeof(uint32_t)];
> +	/* array of pointers into private_buffer */
>  	struct prin_fulldescr *descriptors[];
>  };
>  
> @@ -163,8 +165,13 @@ struct prout_param_descriptor {		/* PROUT parameter descriptor */
>  	uint8_t	 sa_flags;
>  	uint8_t _reserved;
>  	uint16_t _obsolete1;
> -	uint8_t  private_buffer[MPATH_MAX_PARAM_LEN]; /*private buffer for list storage*/
> -	uint32_t num_transportid;	/* Number of Transport ID listed in trnptid_list[]*/
> +	/*private buffer for list storage; data-out */
> +	/* 24: offsetof (struct prout_param_descriptor, private_buffer) */
> +	uint8_t  private_buffer[MPATH_MAX_PARAM_LEN - 24];
> +	/* Internal use below here */
> +	/* Number of Transport ID listed in trnptid_list[] */
> +	uint32_t num_transportid;
> +	/* pointers into private_buffer */
>  	struct transportid *trnptid_list[];
>  };
>  
> -- 
> 2.25.1




More information about the dm-devel mailing list