Eric Dumazet
07b218db54
net/sched: sch_taprio: fix undefined behavior in ktime_mono_to_any
[ Upstream commit 6dc25401cba4d428328eade8ceae717633fdd702 ]
1) if q->tk_offset == TK_OFFS_MAX, then get_tcp_tstamp() calls
ktime_mono_to_any() with out-of-bound value.
2) if q->tk_offset is changed in taprio_parse_clockid(),
taprio_get_time() might also call ktime_mono_to_any()
with out-of-bound value as sysbot found:
UBSAN: array-index-out-of-bounds in kernel/time/timekeeping.c:908:27
index 3 is out of range for type 'ktime_t *[3]'
CPU: 1 PID: 25668 Comm: kworker/u4:0 Not tainted 5.15.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: bat_events batadv_iv_send_outstanding_bat_ogm_packet
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
ubsan_epilogue+0xb/0x5a lib/ubsan.c:151
__ubsan_handle_out_of_bounds.cold+0x62/0x6c lib/ubsan.c:291
ktime_mono_to_any+0x1d4/0x1e0 kernel/time/timekeeping.c:908
get_tcp_tstamp net/sched/sch_taprio.c:322 [inline]
get_packet_txtime net/sched/sch_taprio.c:353 [inline]
taprio_enqueue_one+0x5b0/0x1460 net/sched/sch_taprio.c:420
taprio_enqueue+0x3b1/0x730 net/sched/sch_taprio.c:485
dev_qdisc_enqueue+0x40/0x300 net/core/dev.c:3785
__dev_xmit_skb net/core/dev.c:3869 [inline]
__dev_queue_xmit+0x1f6e/0x3630 net/core/dev.c:4194
batadv_send_skb_packet+0x4a9/0x5f0 net/batman-adv/send.c:108
batadv_iv_ogm_send_to_if net/batman-adv/bat_iv_ogm.c:393 [inline]
batadv_iv_ogm_emit net/batman-adv/bat_iv_ogm.c:421 [inline]
batadv_iv_send_outstanding_bat_ogm_packet+0x6d7/0x8e0 net/batman-adv/bat_iv_ogm.c:1701
process_one_work+0x9b2/0x1690 kernel/workqueue.c:2298
worker_thread+0x658/0x11f0 kernel/workqueue.c:2445
kthread+0x405/0x4f0 kernel/kthread.c:327
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
Fixes: 7ede7b0348 ("taprio: make clock reference conversions easier")
Fixes: 5400206610 ("taprio: Adjust timestamps for TCP packets")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Vedang Patel <vedang.patel@intel.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Reviewed-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Link: https://lore.kernel.org/r/20211108180815.1822479-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
|
2021-11-17 09:48:48 +01:00 |
| .. |
|
act_api.c
|
net_sched: check error pointer in tcf_dump_walker()
|
2021-08-04 12:27:37 +02:00 |
|
act_bpf.c
|
net_sched: defer tcf_idr_insert() in tcf_action_init_1()
|
2020-10-14 10:33:06 +02:00 |
|
act_connmark.c
|
net_sched: defer tcf_idr_insert() in tcf_action_init_1()
|
2020-10-14 10:33:06 +02:00 |
|
act_csum.c
|
net_sched: defer tcf_idr_insert() in tcf_action_init_1()
|
2020-10-14 10:33:06 +02:00 |
|
act_ct.c
|
net/sched: act_ct: fix err check for nf_conntrack_confirm
|
2021-07-25 14:35:14 +02:00 |
|
act_ctinfo.c
|
net_sched: defer tcf_idr_insert() in tcf_action_init_1()
|
2020-10-14 10:33:06 +02:00 |
|
act_gact.c
|
net_sched: defer tcf_idr_insert() in tcf_action_init_1()
|
2020-10-14 10:33:06 +02:00 |
|
act_ife.c
|
net_sched: defer tcf_idr_insert() in tcf_action_init_1()
|
2020-10-14 10:33:06 +02:00 |
|
act_ipt.c
|
net_sched: defer tcf_idr_insert() in tcf_action_init_1()
|
2020-10-14 10:33:06 +02:00 |
|
act_meta_mark.c
|
|
|
|
act_meta_skbprio.c
|
|
|
|
act_meta_skbtcindex.c
|
|
|
|
act_mirred.c
|
net: sched: act_mirred: Reset ct info when mirror/redirect skb
|
2021-08-18 08:56:59 +02:00 |
|
act_mpls.c
|
net/sched: act_mpls: ensure LSE is pullable before reading it
|
2020-12-08 10:40:27 +01:00 |
|
act_nat.c
|
net_sched: defer tcf_idr_insert() in tcf_action_init_1()
|
2020-10-14 10:33:06 +02:00 |
|
act_pedit.c
|
net_sched: defer tcf_idr_insert() in tcf_action_init_1()
|
2020-10-14 10:33:06 +02:00 |
|
act_police.c
|
net_sched: defer tcf_idr_insert() in tcf_action_init_1()
|
2020-10-14 10:33:06 +02:00 |
|
act_sample.c
|
net_sched: defer tcf_idr_insert() in tcf_action_init_1()
|
2020-10-14 10:33:06 +02:00 |
|
act_simple.c
|
net_sched: defer tcf_idr_insert() in tcf_action_init_1()
|
2020-10-14 10:33:06 +02:00 |
|
act_skbedit.c
|
net_sched: defer tcf_idr_insert() in tcf_action_init_1()
|
2020-10-14 10:33:06 +02:00 |
|
act_skbmod.c
|
net/sched: act_skbmod: Skip non-Ethernet packets
|
2021-07-28 13:30:57 +02:00 |
|
act_tunnel_key.c
|
net/sched: act_tunnel_key: fix OOB write in case of IPv6 ERSPAN tunnels
|
2020-10-29 09:57:26 +01:00 |
|
act_vlan.c
|
net/sched: act_vlan: Fix modify to allow 0
|
2021-07-14 16:53:27 +02:00 |
|
cls_api.c
|
net: sched: cls_api: Fix the the wrong parameter
|
2021-07-28 13:30:58 +02:00 |
|
cls_basic.c
|
|
|
|
cls_bpf.c
|
|
|
|
cls_cgroup.c
|
|
|
|
cls_flow.c
|
|
|
|
cls_flower.c
|
net: sched: flower: protect fl_walk() with rcu
|
2021-10-06 15:42:35 +02:00 |
|
cls_fw.c
|
|
|
|
cls_matchall.c
|
|
|
|
cls_route.c
|
|
|
|
cls_rsvp.c
|
|
|
|
cls_rsvp.h
|
|
|
|
cls_rsvp6.c
|
|
|
|
cls_tcindex.c
|
net: sched: fix memory leak in tcindex_partial_destroy_work
|
2021-07-28 13:30:56 +02:00 |
|
cls_u32.c
|
|
|
|
em_canid.c
|
|
|
|
em_cmp.c
|
|
|
|
em_ipset.c
|
|
|
|
em_ipt.c
|
|
|
|
em_meta.c
|
|
|
|
em_nbyte.c
|
|
|
|
em_text.c
|
|
|
|
em_u32.c
|
|
|
|
ematch.c
|
|
|
|
Kconfig
|
|
|
|
Makefile
|
|
|
|
sch_api.c
|
net: prevent user from passing illegal stab size
|
2021-10-17 10:42:34 +02:00 |
|
sch_atm.c
|
|
|
|
sch_blackhole.c
|
|
|
|
sch_cake.c
|
sch_cake: Fix out of bounds when parsing TCP options and header
|
2021-06-23 14:41:25 +02:00 |
|
sch_cbq.c
|
net: sched: Fix qdisc_rate_table refcount leak when get tcf_block failed
|
2021-09-15 09:47:38 +02:00 |
|
sch_cbs.c
|
|
|
|
sch_choke.c
|
net: sched: validate stab values
|
2021-03-30 14:35:25 +02:00 |
|
sch_codel.c
|
|
|
|
sch_drr.c
|
|
|
|
sch_dsmark.c
|
sch_dsmark: fix a NULL deref in qdisc_reset()
|
2021-06-03 08:59:15 +02:00 |
|
sch_etf.c
|
|
|
|
sch_fifo.c
|
net_sched: fix NULL deref in fifo_set_limit()
|
2021-10-13 10:08:18 +02:00 |
|
sch_fq.c
|
|
|
|
sch_fq_codel.c
|
fq_codel: reject silly quantum parameters
|
2021-09-22 12:26:45 +02:00 |
|
sch_generic.c
|
net: sched: update default qdisc visibility after Tx queue cnt changes
|
2021-11-17 09:48:28 +01:00 |
|
sch_gred.c
|
net: sched: validate stab values
|
2021-03-30 14:35:25 +02:00 |
|
sch_hfsc.c
|
|
|
|
sch_hhf.c
|
|
|
|
sch_htb.c
|
|
|
|
sch_ingress.c
|
|
|
|
sch_mq.c
|
net: sched: update default qdisc visibility after Tx queue cnt changes
|
2021-11-17 09:48:28 +01:00 |
|
sch_mqprio.c
|
net: sched: update default qdisc visibility after Tx queue cnt changes
|
2021-11-17 09:48:28 +01:00 |
|
sch_multiq.c
|
|
|
|
sch_netem.c
|
netem: fix zero division in tabledist
|
2020-11-01 12:01:03 +01:00 |
|
sch_pie.c
|
|
|
|
sch_plug.c
|
|
|
|
sch_prio.c
|
|
|
|
sch_qfq.c
|
pkt_sched: sch_qfq: fix qfq_change_class() error path
|
2021-07-14 16:53:31 +02:00 |
|
sch_red.c
|
net: sched: validate stab values
|
2021-03-30 14:35:25 +02:00 |
|
sch_sfb.c
|
|
|
|
sch_sfq.c
|
net: sched: validate stab values
|
2021-03-30 14:35:25 +02:00 |
|
sch_skbprio.c
|
|
|
|
sch_taprio.c
|
net/sched: sch_taprio: fix undefined behavior in ktime_mono_to_any
|
2021-11-17 09:48:48 +01:00 |
|
sch_tbf.c
|
|
|
|
sch_teql.c
|
net: sched: sch_teql: fix null-pointer dereference
|
2021-04-14 08:24:12 +02:00 |