On 27 Mar 2023, at 22:32, Mike Pattrick wrote:

> UB Sanitizer report:
>
> lib/netdev-offload-tc.c:1276:19: runtime error: load of misaligned
> address 0x7f74e801976c for type 'union ovs_u128', which requires 8 byte
> alignment
>
>     #0 in netdev_tc_flow_dump_next lib/netdev-offload-tc.c:1276
>     #1 in netdev_flow_dump_next lib/netdev-offload.c:303
>     #2 in dpif_netlink_flow_dump_next lib/dpif-netlink.c:1921
>     [...]
>
> Signed-off-by: Mike Pattrick <m...@redhat.com>
> ---
>  lib/netdev-offload-tc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c
> index 4fb9d9f21..506b74ce7 100644
> --- a/lib/netdev-offload-tc.c
> +++ b/lib/netdev-offload-tc.c
> @@ -1273,7 +1273,7 @@ netdev_tc_flow_dump_next(struct netdev_flow_dump *dump,
>          }
>
>          if (flower.act_cookie.len) {

The fix looks good to me, but should we maybe also add some minimal size check?

If (flower.act_cokkie.len >= sizeof(ovs_u128), or an exact match assuming this 
really is a ufid? The latter might need some research to make sure we are not 
returning a longer length due to some padding that could happen, etc.

> -            *ufid = *((ovs_u128 *) flower.act_cookie.data);
> +            memcpy(ufid, flower.act_cookie.data, sizeof(ovs_u128));
>          } else if (!find_ufid(netdev, &id, ufid)) {
>              continue;
>          }
> -- 
> 2.39.1
>
> _______________________________________________
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to