Message ID | 20230328152153.618269-1-mkp@redhat.com |
---|---|
State | Accepted |
Commit | 306583b56868edc5f9bcc2a21ac07e334891a6c7 |
Headers | show |
Series | [ovs-dev,v2] netdev-tc-offloads: Fix misaligned 8 byte read. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | fail | github build: failed |
ovsrobot/intel-ovs-compilation | success | test: success |
On 28 Mar 2023, at 17:21, 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 <mkp@redhat.com> Change looks good to me! Acked-by: Eelco Chaudron <echaudro@redhat.com>
On 3/29/23 11:16, Eelco Chaudron wrote: > > > On 28 Mar 2023, at 17:21, 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 <mkp@redhat.com> > > Change looks good to me! > > Acked-by: Eelco Chaudron <echaudro@redhat.com> Thanks! I added a missing 'Fixes:' tag and applied the change. Backported down to 2.17. Best regards, Ilya Maximets.
diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c index 247c1ff8b..4721f0160 100644 --- a/lib/netdev-offload-tc.c +++ b/lib/netdev-offload-tc.c @@ -1282,8 +1282,8 @@ netdev_tc_flow_dump_next(struct netdev_flow_dump *dump, continue; } - if (flower.act_cookie.len) { - *ufid = *((ovs_u128 *) flower.act_cookie.data); + if (flower.act_cookie.len >= sizeof *ufid) { + *ufid = get_32aligned_u128(flower.act_cookie.data); } else if (!find_ufid(netdev, &id, ufid)) { continue; }
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 <mkp@redhat.com> --- Since v1: - Changed memcpy to get_32aligned_u128 - Checked full size of cookie length --- lib/netdev-offload-tc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)