Vlad Buslov
9453d45ecb
net: zero-initialize tc skb extension on allocation
Function skb_ext_add() doesn't initialize created skb extension with any
value and leaves it up to the user. However, since extension of type
TC_SKB_EXT originally contained only single value tc_skb_ext->chain its
users used to just assign the chain value without setting whole extension
memory to zero first. This assumption changed when TC_SKB_EXT extension was
extended with additional fields but not all users were updated to
initialize the new fields which leads to use of uninitialized memory
afterwards. UBSAN log:
[ 778.299821] UBSAN: invalid-load in net/openvswitch/flow.c:899:28
[ 778.301495] load of value 107 is not a valid value for type '_Bool'
[ 778.303215] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.12.0-rc7+ #2
[ 778.304933] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
[ 778.307901] Call Trace:
[ 778.308680] <IRQ>
[ 778.309358] dump_stack+0xbb/0x107
[ 778.310307] ubsan_epilogue+0x5/0x40
[ 778.311167] __ubsan_handle_load_invalid_value.cold+0x43/0x48
[ 778.312454] ? memset+0x20/0x40
[ 778.313230] ovs_flow_key_extract.cold+0xf/0x14 [openvswitch]
[ 778.314532] ovs_vport_receive+0x19e/0x2e0 [openvswitch]
[ 778.315749] ? ovs_vport_find_upcall_portid+0x330/0x330 [openvswitch]
[ 778.317188] ? create_prof_cpu_mask+0x20/0x20
[ 778.318220] ? arch_stack_walk+0x82/0xf0
[ 778.319153] ? secondary_startup_64_no_verify+0xb0/0xbb
[ 778.320399] ? stack_trace_save+0x91/0xc0
[ 778.321362] ? stack_trace_consume_entry+0x160/0x160
[ 778.322517] ? lock_release+0x52e/0x760
[ 778.323444] netdev_frame_hook+0x323/0x610 [openvswitch]
[ 778.324668] ? ovs_netdev_get_vport+0xe0/0xe0 [openvswitch]
[ 778.325950] __netif_receive_skb_core+0x771/0x2db0
[ 778.327067] ? lock_downgrade+0x6e0/0x6f0
[ 778.328021] ? lock_acquire+0x565/0x720
[ 778.328940] ? generic_xdp_tx+0x4f0/0x4f0
[ 778.329902] ? inet_gro_receive+0x2a7/0x10a0
[ 778.330914] ? lock_downgrade+0x6f0/0x6f0
[ 778.331867] ? udp4_gro_receive+0x4c4/0x13e0
[ 778.332876] ? lock_release+0x52e/0x760
[ 778.333808] ? dev_gro_receive+0xcc8/0x2380
[ 778.334810] ? lock_downgrade+0x6f0/0x6f0
[ 778.335769] __netif_receive_skb_list_core+0x295/0x820
[ 778.336955] ? process_backlog+0x780/0x780
[ 778.337941] ? mlx5e_rep_tc_netdevice_event_unregister+0x20/0x20 [mlx5_core]
[ 778.339613] ? seqcount_lockdep_reader_access.constprop.0+0xa7/0xc0
[ 778.341033] ? kvm_clock_get_cycles+0x14/0x20
[ 778.342072] netif_receive_skb_list_internal+0x5f5/0xcb0
[ 778.343288] ? __kasan_kmalloc+0x7a/0x90
[ 778.344234] ? mlx5e_handle_rx_cqe_mpwrq+0x9e0/0x9e0 [mlx5_core]
[ 778.345676] ? mlx5e_xmit_xdp_frame_mpwqe+0x14d0/0x14d0 [mlx5_core]
[ 778.347140] ? __netif_receive_skb_list_core+0x820/0x820
[ 778.348351] ? mlx5e_post_rx_mpwqes+0xa6/0x25d0 [mlx5_core]
[ 778.349688] ? napi_gro_flush+0x26c/0x3c0
[ 778.350641] napi_complete_done+0x188/0x6b0
[ 778.351627] mlx5e_napi_poll+0x373/0x1b80 [mlx5_core]
[ 778.352853] __napi_poll+0x9f/0x510
[ 778.353704] ? mlx5_flow_namespace_set_mode+0x260/0x260 [mlx5_core]
[ 778.355158] net_rx_action+0x34c/0xa40
[ 778.356060] ? napi_threaded_poll+0x3d0/0x3d0
[ 778.357083] ? sched_clock_cpu+0x18/0x190
[ 778.358041] ? __common_interrupt+0x8e/0x1a0
[ 778.359045] __do_softirq+0x1ce/0x984
[ 778.359938] __irq_exit_rcu+0x137/0x1d0
[ 778.360865] irq_exit_rcu+0xa/0x20
[ 778.361708] common_interrupt+0x80/0xa0
[ 778.362640] </IRQ>
[ 778.363212] asm_common_interrupt+0x1e/0x40
[ 778.364204] RIP: 0010:native_safe_halt+0xe/0x10
[ 778.365273] Code: 4f ff ff ff 4c 89 e7 e8 50 3f 40 fe e9 dc fe ff ff 48 89 df e8 43 3f 40 fe eb 90 cc e9 07 00 00 00 0f 00 2d 74 05 62 00 fb f4 <c3> 90 e9 07 00 00 00 0f 00 2d 64 05 62 00 f4 c3 cc cc 0f 1f 44 00
[ 778.369355] RSP: 0018:ffffffff84407e48 EFLAGS: 00000246
[ 778.370570] RAX: ffff88842de46a80 RBX: ffffffff84425840 RCX: ffffffff83418468
[ 778.372143] RDX: 000000000026f1da RSI: 0000000000000004 RDI: ffffffff8343af5e
[ 778.373722] RBP: fffffbfff0884b08 R08: 0000000000000000 R09: ffff88842de46bcb
[ 778.375292] R10: ffffed1085bc8d79 R11: 0000000000000001 R12: 0000000000000000
[ 778.376860] R13: ffffffff851124a0 R14: 0000000000000000 R15: dffffc0000000000
[ 778.378491] ? rcu_eqs_enter.constprop.0+0xb8/0xe0
[ 778.379606] ? default_idle_call+0x5e/0xe0
[ 778.380578] default_idle+0xa/0x10
[ 778.381406] default_idle_call+0x96/0xe0
[ 778.382350] do_idle+0x3d4/0x550
[ 778.383153] ? arch_cpu_idle_exit+0x40/0x40
[ 778.384143] cpu_startup_entry+0x19/0x20
[ 778.385078] start_kernel+0x3c7/0x3e5
[ 778.385978] secondary_startup_64_no_verify+0xb0/0xbb
Fix the issue by providing new function tc_skb_ext_alloc() that allocates
tc skb extension and initializes its memory to 0 before returning it to the
caller. Change all existing users to use new API instead of calling
skb_ext_add() directly.
Fixes: 038ebb1a71 ("net/sched: act_ct: fix miss set mru for ovs after defrag in act_ct")
Fixes: d29334c15d ("net/sched: act_api: fix miss set post_ct for ovs after do conntrack in act_ct")
Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
Acked-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-05-25 15:36:42 -07:00
..
2020-11-19 17:21:34 +01:00
2021-04-08 12:26:34 +02:00
2020-09-29 14:02:53 -07:00
2021-01-28 20:36:21 -08:00
2021-05-14 01:34:26 +02:00
2021-04-26 03:20:47 +02:00
2021-05-17 13:56:29 -07:00
2019-06-05 17:37:07 +02:00
2021-04-30 15:06:34 -07:00
2021-03-13 14:18:09 -08:00
2020-02-28 14:51:30 +01:00
2021-04-08 13:47:33 -07:00
2021-04-27 14:02:06 -07:00
2019-05-30 11:26:41 -07:00
2021-04-23 10:17:26 +01:00
2020-02-28 12:12:53 -08:00
2019-12-11 15:01:23 -08:00
2017-11-02 11:10:55 +01:00
2019-11-06 16:14:48 -08:00
2017-11-02 11:10:55 +01:00
2019-01-23 11:18:00 -08:00
2019-06-19 17:09:55 +02:00
2020-07-21 18:30:47 -07:00
2019-05-24 17:37:53 +02:00
2020-05-01 12:15:37 -07:00
2019-07-04 12:30:48 -07:00
2021-01-18 20:48:40 -08:00
2021-03-26 17:43:55 +01:00
2020-12-01 15:51:19 +01:00
2019-05-21 11:28:45 +02:00
2019-06-19 17:09:55 +02:00
2021-05-11 20:13:03 +02:00
2020-02-29 14:39:08 +01:00
2020-08-20 15:45:15 -04:00
2020-07-15 07:45:24 -07:00
2020-03-27 19:40:38 -07:00
2020-11-23 13:31:54 -08:00
2017-11-02 11:10:55 +01:00
2019-05-30 11:29:52 -07:00
2019-05-30 11:29:52 -07:00
2021-04-24 00:58:53 -07:00
2017-11-02 11:10:55 +01:00
2020-02-29 21:52:20 -08:00
2017-11-02 11:10:55 +01:00
2019-05-21 11:52:39 +02:00
2019-05-21 11:52:39 +02:00
2017-11-04 09:26:51 +09:00
2021-04-27 14:10:15 -07:00
2019-12-16 16:09:44 -08:00
2018-03-05 12:52:45 -05:00
2017-11-04 09:26:51 +09:00
2020-05-08 21:33:33 -07:00
2021-03-10 12:24:18 -08:00
2020-05-05 13:23:29 -07:00
2020-02-19 13:52:32 +01:00
2020-04-20 07:34:16 +02:00
2019-06-19 17:09:55 +02:00
2018-05-28 22:59:54 -04:00
2019-12-24 22:37:30 -08:00
2020-07-28 17:42:31 -07:00
2017-11-02 11:10:55 +01:00
2021-03-14 14:46:32 -07:00
2021-03-24 12:48:39 -07:00
2021-04-19 12:25:11 +02:00
2017-11-02 11:10:55 +01:00
2021-01-21 13:33:45 +01:00
2021-01-21 13:33:45 +01:00
2019-12-09 10:36:44 -08:00
2019-11-05 18:20:55 -08:00
2021-02-12 16:31:46 -08:00
2019-03-22 12:09:31 -07:00
2021-01-29 20:39:14 -08:00
2017-11-02 11:10:55 +01:00
2021-03-18 19:51:12 -07:00
2017-11-02 11:10:55 +01:00
2020-06-22 21:12:44 -07:00
2019-10-25 16:24:32 -07:00
2021-02-23 11:29:52 -08:00
2020-11-06 11:01:01 +01:00
2019-05-30 11:26:41 -07:00
2021-03-26 15:14:56 -07:00
2019-04-22 21:50:53 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2020-03-30 13:45:04 -07:00
2021-01-27 18:18:15 -08:00
2021-03-15 14:34:29 -07:00
2020-12-14 18:38:58 -08:00
2020-12-12 15:08:54 -08:00
2020-11-23 16:32:33 -08:00
2020-08-26 07:33:19 -07:00
2019-09-27 12:05:02 +02:00
2019-02-08 21:50:15 -08:00
2020-06-20 17:47:53 -07:00
2021-02-08 16:47:03 -08:00
2021-01-26 18:39:45 -08:00
2019-06-18 20:48:45 -04:00
2021-02-08 16:47:03 -08:00
2020-11-19 19:08:46 -08:00
2021-02-04 18:37:57 -08:00
2020-11-10 17:56:54 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-11-19 10:49:50 -08:00
2021-03-30 13:29:39 -07:00
2021-03-11 16:09:21 -08:00
2020-02-05 14:28:09 +01:00
2018-03-27 09:51:23 +02:00
2019-06-19 17:09:55 +02:00
2020-06-20 17:22:22 -07:00
2018-07-11 23:10:19 -07:00
2021-03-23 14:14:50 -07:00
2017-11-02 11:10:55 +01:00
2019-10-08 13:23:05 -07:00
2018-09-13 09:04:58 -07:00
2020-03-29 22:30:57 -07:00
2021-04-19 12:03:13 +02:00
2019-05-30 11:26:41 -07:00
2020-03-26 20:17:36 -07:00
2020-03-02 11:16:27 -08:00
2021-03-26 15:14:56 -07:00
2020-02-28 12:08:37 -08:00
2020-05-29 21:20:20 -07:00
2021-04-07 14:09:39 -07:00
2019-12-09 10:36:44 -08:00
2017-11-02 11:10:55 +01:00
2020-08-24 06:40:07 -07:00
2020-11-13 14:24:39 -08:00
2018-05-28 22:59:54 -04:00
2021-04-09 16:34:56 -07:00
2017-11-02 11:10:55 +01:00
2018-08-01 09:52:30 -07:00
2019-05-21 11:28:45 +02:00
2020-11-16 08:08:54 -08:00
2019-11-12 08:18:03 -08:00
2019-04-11 13:59:49 -07:00
2021-03-28 17:53:39 -07:00
2017-11-08 16:12:33 +09:00
2017-11-02 11:10:55 +01:00
2021-04-30 11:20:43 -07:00
2020-03-04 13:25:55 -08:00
2019-05-30 11:26:32 -07:00
2021-05-25 15:36:42 -07:00
2021-05-14 15:05:46 -07:00
2017-11-02 11:10:55 +01:00
2019-05-30 11:26:32 -07:00
2021-03-14 15:00:43 -07:00
2017-11-02 11:10:55 +01:00
2019-05-30 11:26:32 -07:00
2017-11-02 11:10:55 +01:00
2021-03-25 17:40:43 -07:00
2020-07-31 09:24:23 +02:00
2020-08-24 14:35:00 -07:00
2018-05-16 07:23:35 +02:00
2020-11-23 18:36:21 -05:00
2020-06-23 20:27:09 -07:00
2018-03-13 18:37:02 +02:00
2021-04-08 13:52:36 -07:00
2019-04-22 21:47:25 -07:00
2021-05-14 15:05:46 -07:00
2020-07-13 11:03:44 -07:00
2017-11-02 11:10:55 +01:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2020-06-04 15:39:32 -07:00
2021-04-28 14:06:45 -07:00
2018-04-11 10:33:46 -04:00
2020-09-28 15:19:03 -07:00
2019-10-05 16:29:00 -07:00
2020-02-29 21:52:19 -08:00
2021-05-12 13:48:58 -07:00
2018-03-01 21:21:36 -05:00
2017-11-02 11:10:55 +01:00
2019-06-19 17:09:55 +02:00
2021-04-16 15:15:45 -07:00
2019-05-30 11:26:32 -07:00
2021-04-12 17:34:27 +02:00
2019-05-30 11:26:32 -07:00
2018-05-08 00:02:41 -04:00
2019-10-04 14:07:07 -07:00
2020-11-27 18:25:27 -08:00
2020-06-23 20:10:15 -07:00
2020-06-18 20:46:23 -07:00
2021-02-04 18:37:14 -08:00
2021-04-12 17:34:27 +02:00
2018-02-16 15:57:42 -05:00
2019-11-14 18:12:17 -08:00
2020-09-14 16:49:39 -07:00
2018-01-24 19:13:45 -05:00
2019-12-09 10:28:43 -08:00
2017-11-02 11:10:55 +01:00
2019-11-16 12:39:10 -08:00
2020-11-17 22:07:40 +01:00
2021-03-10 01:06:34 +01:00
2021-02-04 01:00:07 +01:00
2021-03-24 10:00:24 +01:00
2020-12-18 16:10:21 +01:00