Message ID | 20230125134852.3852383-1-i.maximets@ovn.org |
---|---|
State | Accepted |
Commit | 9117f4d54f6af76d3ba0bf2e1732cb16440b87f8 |
Headers | show |
Series | [ovs-dev] netdev-offload-tc: Fix misaligned access to ct label. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
ovsrobot/intel-ovs-compilation | success | test: success |
On Wed, Jan 25, 2023 at 02:48:52PM +0100, Ilya Maximets wrote: > 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") > Signed-off-by: Ilya Maximets <i.maximets@ovn.org> Reviewed-by: Simon Horman <simon.horman@corigine.com>
On 25 Jan 2023, at 14:48, Ilya Maximets wrote: > 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") > Signed-off-by: Ilya Maximets <i.maximets@ovn.org> The changes look good to me. Acked-by: Eelco Chaudron <echaudro@redhat.com>
On 1/25/23 15:48, Eelco Chaudron wrote: > > > On 25 Jan 2023, at 14:48, Ilya Maximets wrote: > >> 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") >> Signed-off-by: Ilya Maximets <i.maximets@ovn.org> > > The changes look good to me. > > Acked-by: Eelco Chaudron <echaudro@redhat.com> > Thanks, Eelco and Simon! Applied and backported down to 2.17. Best regards, Ilya Maximets.
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; }
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") Signed-off-by: Ilya Maximets <i.maximets@ovn.org> --- lib/netdev-offload-tc.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)