Re: [ovs-dev] [PATCH] dpif-netlink: Fix incorrect bit shift in compat mode.

2022-08-04 Thread Ilya Maximets
On 8/3/22 17:28, Mike Pattrick wrote:
> On Thu, Jul 28, 2022 at 11:43 AM Ilya Maximets  wrote:
>>
>>  SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior in
>>  lib/dpif-netlink.c:1077:40: runtime error:
>>left shift of 1 by 31 places cannot be represented in type 'int'
>>
>>  #0  0x73fc31 in dpif_netlink_port_add_compat lib/dpif-netlink.c:1077:40
>>  #1  0x73fc31 in dpif_netlink_port_add lib/dpif-netlink.c:1132:17
>>  #2  0x2c1745 in dpif_port_add lib/dpif.c:597:13
>>  #3  0x07b279 in port_add ofproto/ofproto-dpif.c:3957:17
>>  #4  0x01b209 in ofproto_port_add ofproto/ofproto.c:2124:13
>>  #5  0xfdbfce in iface_do_create vswitchd/bridge.c:2066:13
>>  #6  0xfdbfce in iface_create vswitchd/bridge.c:2109:13
>>  #7  0xfdbfce in bridge_add_ports__ vswitchd/bridge.c:1173:21
>>  #8  0xfb5319 in bridge_add_ports vswitchd/bridge.c:1189:5
>>  #9  0xfb5319 in bridge_reconfigure vswitchd/bridge.c:901:9
>>  #10 0xfae0f9 in bridge_run vswitchd/bridge.c:3334:9
>>  #11 0xfe67dd in main vswitchd/ovs-vswitchd.c:129:9
>>  #12 0x4b6d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
>>  #13 0x4b6e3f in __libc_start_main 
>> (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
>>  #14 0x562594eed024 in _start (vswitchd/ovs-vswitchd+0x787024)
>>
>> Fixes: 526df7d8543f ("tunnel: Provide framework for tunnel extensions for 
>> VXLAN-GBP and others")
>> Signed-off-by: Ilya Maximets 
> 
> Acked-by: Mike Pattrick 

Thanks!  Applied and backported down to 2.13.

Best regards, Ilya Maximets.

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


Re: [ovs-dev] [PATCH] dpif-netlink: Fix incorrect bit shift in compat mode.

2022-08-03 Thread Mike Pattrick
On Thu, Jul 28, 2022 at 11:43 AM Ilya Maximets  wrote:
>
>  SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior in
>  lib/dpif-netlink.c:1077:40: runtime error:
>left shift of 1 by 31 places cannot be represented in type 'int'
>
>  #0  0x73fc31 in dpif_netlink_port_add_compat lib/dpif-netlink.c:1077:40
>  #1  0x73fc31 in dpif_netlink_port_add lib/dpif-netlink.c:1132:17
>  #2  0x2c1745 in dpif_port_add lib/dpif.c:597:13
>  #3  0x07b279 in port_add ofproto/ofproto-dpif.c:3957:17
>  #4  0x01b209 in ofproto_port_add ofproto/ofproto.c:2124:13
>  #5  0xfdbfce in iface_do_create vswitchd/bridge.c:2066:13
>  #6  0xfdbfce in iface_create vswitchd/bridge.c:2109:13
>  #7  0xfdbfce in bridge_add_ports__ vswitchd/bridge.c:1173:21
>  #8  0xfb5319 in bridge_add_ports vswitchd/bridge.c:1189:5
>  #9  0xfb5319 in bridge_reconfigure vswitchd/bridge.c:901:9
>  #10 0xfae0f9 in bridge_run vswitchd/bridge.c:3334:9
>  #11 0xfe67dd in main vswitchd/ovs-vswitchd.c:129:9
>  #12 0x4b6d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
>  #13 0x4b6e3f in __libc_start_main 
> (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
>  #14 0x562594eed024 in _start (vswitchd/ovs-vswitchd+0x787024)
>
> Fixes: 526df7d8543f ("tunnel: Provide framework for tunnel extensions for 
> VXLAN-GBP and others")
> Signed-off-by: Ilya Maximets 

Acked-by: Mike Pattrick 

> ---
>  lib/dpif-netlink.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
> index a498d5667..89e1d4325 100644
> --- a/lib/dpif-netlink.c
> +++ b/lib/dpif-netlink.c
> @@ -1074,7 +1074,7 @@ dpif_netlink_port_add_compat(struct dpif_netlink *dpif, 
> struct netdev *netdev,
>
>  ext_ofs = nl_msg_start_nested(, 
> OVS_TUNNEL_ATTR_EXTENSION);
>  for (i = 0; i < 32; i++) {
> -if (tnl_cfg->exts & (1 << i)) {
> +if (tnl_cfg->exts & (UINT32_C(1) << i)) {
>  nl_msg_put_flag(, i);
>  }
>  }
> --
> 2.34.3
>
> ___
> 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


[ovs-dev] [PATCH] dpif-netlink: Fix incorrect bit shift in compat mode.

2022-07-28 Thread Ilya Maximets
 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior in
 lib/dpif-netlink.c:1077:40: runtime error:
   left shift of 1 by 31 places cannot be represented in type 'int'

 #0  0x73fc31 in dpif_netlink_port_add_compat lib/dpif-netlink.c:1077:40
 #1  0x73fc31 in dpif_netlink_port_add lib/dpif-netlink.c:1132:17
 #2  0x2c1745 in dpif_port_add lib/dpif.c:597:13
 #3  0x07b279 in port_add ofproto/ofproto-dpif.c:3957:17
 #4  0x01b209 in ofproto_port_add ofproto/ofproto.c:2124:13
 #5  0xfdbfce in iface_do_create vswitchd/bridge.c:2066:13
 #6  0xfdbfce in iface_create vswitchd/bridge.c:2109:13
 #7  0xfdbfce in bridge_add_ports__ vswitchd/bridge.c:1173:21
 #8  0xfb5319 in bridge_add_ports vswitchd/bridge.c:1189:5
 #9  0xfb5319 in bridge_reconfigure vswitchd/bridge.c:901:9
 #10 0xfae0f9 in bridge_run vswitchd/bridge.c:3334:9
 #11 0xfe67dd in main vswitchd/ovs-vswitchd.c:129:9
 #12 0x4b6d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
 #13 0x4b6e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
 #14 0x562594eed024 in _start (vswitchd/ovs-vswitchd+0x787024)

Fixes: 526df7d8543f ("tunnel: Provide framework for tunnel extensions for 
VXLAN-GBP and others")
Signed-off-by: Ilya Maximets 
---
 lib/dpif-netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
index a498d5667..89e1d4325 100644
--- a/lib/dpif-netlink.c
+++ b/lib/dpif-netlink.c
@@ -1074,7 +1074,7 @@ dpif_netlink_port_add_compat(struct dpif_netlink *dpif, 
struct netdev *netdev,
 
 ext_ofs = nl_msg_start_nested(, OVS_TUNNEL_ATTR_EXTENSION);
 for (i = 0; i < 32; i++) {
-if (tnl_cfg->exts & (1 << i)) {
+if (tnl_cfg->exts & (UINT32_C(1) << i)) {
 nl_msg_put_flag(, i);
 }
 }
-- 
2.34.3

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