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: <a55923ae-61be-4792-8717-a6e134fc3585@intel.com>
Date: Mon, 8 Jan 2024 16:30:27 +0100
From: Alexander Lobakin <aleksander.lobakin@...el.com>
To: Pavan Kumar Linga <pavan.kumar.linga@...el.com>
CC: <intel-wired-lan@...ts.osuosl.org>, <pmenzel@...gen.mpg.de>,
	<netdev@...r.kernel.org>, <przemyslaw.kitszel@...el.com>,
	<emil.s.tantilov@...el.com>
Subject: Re: [Intel-wired-lan] [PATCH iwl-net v2] idpf: avoid compiler padding
 in virtchnl2_ptype struct

From: Pavan Kumar Linga <pavan.kumar.linga@...el.com>
Date: Thu,  4 Jan 2024 17:32:32 -0800

> In the arm random config file, kconfig option 'CONFIG_AEABI' is
> disabled which results in adding the compiler flag '-mabi=apcs-gnu'.
> This causes the compiler to add padding in virtchnl2_ptype
> structure to align it to 8 bytes, resulting in the following
> size check failure:

[...]

> diff --git a/drivers/net/ethernet/intel/idpf/virtchnl2.h b/drivers/net/ethernet/intel/idpf/virtchnl2.h
> index 8dc83788972..dd750e6dcd0 100644
> --- a/drivers/net/ethernet/intel/idpf/virtchnl2.h
> +++ b/drivers/net/ethernet/intel/idpf/virtchnl2.h
> @@ -978,7 +978,7 @@ struct virtchnl2_ptype {
>  	u8 proto_id_count;
>  	__le16 pad;
>  	__le16 proto_id[];
> -};
> +} __packed;

Try using `__packed __aligned(sizeof(__le16))`
(or just `__packed __aligned(2)`) here. It may generate more optimized
code than just __packed, as the latter assumes the structure address in
the memory can be `2n + 1`, while it fact it's aligned to 2 bytes.

(another virtchnl2 design fail anyway :D)

>  VIRTCHNL2_CHECK_STRUCT_LEN(6, virtchnl2_ptype);
>  
>  /**

Thanks,
Olek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ