summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorIlya Maximets <i.maximets@ovn.org>2023-01-25 14:48:52 +0100
committerIlya Maximets <i.maximets@ovn.org>2023-01-27 16:57:27 +0100
commit9117f4d54f6af76d3ba0bf2e1732cb16440b87f8 (patch)
tree120984cb7639a097fd93923d839151bb2a8726d9 /lib
parent3beff0a6b09e183f46249b94865b56ea7c4c0350 (diff)
downloadopenvswitch-9117f4d54f6af76d3ba0bf2e1732cb16440b87f8.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>
Diffstat (limited to 'lib')
-rw-r--r--lib/netdev-offload-tc.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c
index ce7f8ad97..15d1c36aa 100644
--- a/lib/netdev-offload-tc.c
+++ b/lib/netdev-offload-tc.c
@@ -843,13 +843,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) {
@@ -1339,13 +1339,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;
}