diff options
author | Ilya Maximets <i.maximets@ovn.org> | 2023-01-25 14:48:52 +0100 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2023-01-27 16:21:35 +0100 |
commit | a1d00b9d9bafa83d2ad40eb38274202bae5785d8 (patch) | |
tree | 4cdf1bd4a94dbb60fc55ed30074df7e5ace89e85 | |
parent | 9e0986eebb8cc52940b1144b07a2ff5d5f5a2474 (diff) | |
download | openvswitch-a1d00b9d9bafa83d2ad40eb38274202bae5785d8.tar.gz |
netdev-offload-tc: Fix misaligned access to ct label.
UndefinedBehaviorSanitizer:
lib/netdev-offload-tc.c:1356:50: runtime error:
member access within misaligned address 0x60700001a89c for type
'const struct (unnamed struct at lib/netdev-offload-tc.c:1350:27)',
which requires 8 byte alignment 0x60700001a89c: note: pointer points here
24 00 04 00 01 00 00 05 00 00 0d 00 0a 00 00 00 00 00 00 00 ...
^
0 0xd5d183 in parse_put_flow_ct_action lib/netdev-offload-tc.c:1356:50
1 0xd5783f in netdev_tc_parse_nl_actions lib/netdev-offload-tc.c:2015:19
2 0xd4027c in netdev_tc_flow_put lib/netdev-offload-tc.c:2355:11
3 0x9666d7 in netdev_flow_put lib/netdev-offload.c:318:14
4 0xcd4c0a in parse_flow_put lib/dpif-netlink.c:2297:11
5 0xcd4c0a in try_send_to_netdev lib/dpif-netlink.c:2384:15
6 0xcd4c0a in dpif_netlink_operate lib/dpif-netlink.c:2455:23
7 0x87d40e in dpif_operate lib/dpif.c:1372:13
8 0x6d43e9 in handle_upcalls ofproto/ofproto-dpif-upcall.c:1674:5
9 0x6d43e9 in recv_upcalls ofproto/ofproto-dpif-upcall.c:905:9
10 0x6cf6ea in udpif_upcall_handler ofproto/ofproto-dpif-upcall.c:801:13
11 0xb6d7ea in ovsthread_wrapper lib/ovs-thread.c:423:12
12 0x7f5ccf017801 in start_thread
13 0x7f5ccefb744f in __GI___clone3
Fixes: 9221c721bec0 ("netdev-offload-tc: Add conntrack label and mark support")
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
-rw-r--r-- | lib/netdev-offload-tc.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c index f6f90a741..81a2575e6 100644 --- a/lib/netdev-offload-tc.c +++ b/lib/netdev-offload-tc.c @@ -822,13 +822,13 @@ parse_tc_flower_to_actions__(struct tc_flower *flower, struct ofpbuf *buf, struct { ovs_u128 key; ovs_u128 mask; - } *ct_label; + } ct_label = { + .key = action->ct.label, + .mask = action->ct.label_mask, + }; - ct_label = nl_msg_put_unspec_uninit(buf, - OVS_CT_ATTR_LABELS, - sizeof *ct_label); - ct_label->key = action->ct.label; - ct_label->mask = action->ct.label_mask; + nl_msg_put_unspec(buf, OVS_CT_ATTR_LABELS, + &ct_label, sizeof ct_label); } if (action->ct.nat_type) { @@ -1318,13 +1318,14 @@ parse_put_flow_ct_action(struct tc_flower *flower, break; case OVS_CT_ATTR_LABELS: { const struct { - ovs_u128 key; - ovs_u128 mask; + ovs_32aligned_u128 key; + ovs_32aligned_u128 mask; } *ct_label; ct_label = nl_attr_get_unspec(ct_attr, sizeof *ct_label); - action->ct.label = ct_label->key; - action->ct.label_mask = ct_label->mask; + action->ct.label = get_32aligned_u128(&ct_label->key); + action->ct.label_mask = + get_32aligned_u128(&ct_label->mask); } break; } |