android_kernel_motorola_sm6375/net/sched
Repository files (latest commit first)
Filename Latest commit message Latest commit date
William Liu ad340a4b4a net/sched: Restrict conditions for adding duplicating netems to qdisc tree
[ Upstream commit ec8e0e3d7adef940cdf9475e2352c0680189d14e ]

netem_enqueue's duplication prevention logic breaks when a netem
resides in a qdisc tree with other netems - this can lead to a
soft lockup and OOM loop in netem_dequeue, as seen in [1].
Ensure that a duplicating netem cannot exist in a tree with other
netems.

Previous approaches suggested in discussions in chronological order:

1) Track duplication status or ttl in the sk_buff struct. Considered
too specific a use case to extend such a struct, though this would
be a resilient fix and address other previous and potential future
DOS bugs like the one described in loopy fun [2].

2) Restrict netem_enqueue recursion depth like in act_mirred with a
per cpu variable. However, netem_dequeue can call enqueue on its
child, and the depth restriction could be bypassed if the child is a
netem.

3) Use the same approach as in 2, but add metadata in netem_skb_cb
to handle the netem_dequeue case and track a packet's involvement
in duplication. This is an overly complex approach, and Jamal
notes that the skb cb can be overwritten to circumvent this
safeguard.

4) Prevent the addition of a netem to a qdisc tree if its ancestral
path contains a netem. However, filters and actions can cause a
packet to change paths when re-enqueued to the root from netem
duplication, leading us to the current solution: prevent a
duplicating netem from inhabiting the same tree as other netems.

[1] https://lore.kernel.org/netdev/8DuRWwfqjoRDLDmBMlIfbrsZg9Gx50DHJc1ilxsEBNe2D6NMoigR_eIRIG0LOjMc3r10nUUZtArXx4oZBIdUfZQrwjcQhdinnMis_0G7VEk=@willsroot.io/
[2] https://lwn.net/Articles/719297/

Fixes: 0afb51e728 ("[PKT_SCHED]: netem: reinsert for duplication")
Reported-by: William Liu <will@willsroot.io>
Reported-by: Savino Dicanosa <savy@syst3mfailure.io>
Signed-off-by: William Liu <will@willsroot.io>
Signed-off-by: Savino Dicanosa <savy@syst3mfailure.io>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Link: https://patch.msgid.link/20250708164141.875402-1-will@willsroot.io
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-08-28 16:21:19 +02:00
..
act_api.c
act_bpf.c
act_connmark.c
act_csum.c
act_ct.c
act_ctinfo.c
act_gact.c
act_ife.c
act_ipt.c
act_meta_mark.c
act_meta_skbprio.c
act_meta_skbtcindex.c
act_mirred.c
act_mpls.c
act_nat.c
act_pedit.c
act_police.c
act_sample.c
act_simple.c
act_skbedit.c
act_skbmod.c
act_tunnel_key.c
act_vlan.c
cls_api.c
cls_basic.c
cls_bpf.c
cls_cgroup.c
cls_flow.c net_sched: cls_flow: validate TCA_FLOW_RSHIFT attribute 2025-02-01 18:18:45 +01:00
cls_flower.c net: extract port range fields from fl_flow_key 2025-03-13 12:43:23 +01:00
cls_fw.c
cls_matchall.c
cls_route.c
cls_u32.c
em_canid.c
em_cmp.c
em_ipset.c
em_ipt.c
em_meta.c net: annotate lockless accesses to sk->sk_max_ack_backlog 2024-11-08 16:20:46 +01:00
em_nbyte.c
em_text.c
em_u32.c
ematch.c
Kconfig
Makefile
sch_api.c net/sched: Abort __tc_modify_qdisc if parent class does not exist 2025-07-17 18:25:02 +02:00
sch_blackhole.c
sch_cake.c sched: sch_cake: add bounds checks to host bulk flow fairness counts 2025-03-13 12:43:04 +01:00
sch_cbs.c net/sched: cbs: Fix integer overflow in cbs_set_port_rate() 2024-12-14 19:44:51 +01:00
sch_choke.c net: sched: fix ordering of qlen adjustment 2025-01-09 13:23:26 +01:00
sch_codel.c
sch_drr.c net_sched: drr: Fix double list add in class with netem as child qdisc 2025-06-04 14:32:24 +02:00
sch_etf.c
sch_fifo.c pfifo_tail_enqueue: Drop new packet when sch->limit == 0 2025-03-13 12:43:25 +01:00
sch_fq.c
sch_fq_codel.c
sch_generic.c
sch_gred.c
sch_hfsc.c net_sched: hfsc: Address reentrant enqueue adding class to eltree twice 2025-06-04 14:32:36 +02:00
sch_hhf.c
sch_htb.c net/sched: Return NULL when htb_lookup_leaf encounters an empty rbtree 2025-08-28 16:21:16 +02:00
sch_ingress.c
sch_mq.c
sch_mqprio.c
sch_multiq.c
sch_netem.c net/sched: Restrict conditions for adding duplicating netems to qdisc tree 2025-08-28 16:21:19 +02:00
sch_pie.c
sch_plug.c
sch_prio.c net_sched: prio: fix a race in prio_tune() 2025-06-27 11:02:49 +01:00
sch_qfq.c net/sched: sch_qfq: Avoid triggering might_sleep in atomic context in qfq_delete_class 2025-08-28 16:21:17 +02:00
sch_red.c net_sched: red: fix a race in __red_change() 2025-06-27 11:02:50 +01:00
sch_sfb.c
sch_sfq.c net_sched: sch_sfq: reject invalid perturb period 2025-08-28 16:21:17 +02:00
sch_skbprio.c net_sched: skbprio: Remove overly strict queue assertions 2025-04-10 14:29:43 +02:00
sch_taprio.c net: sched: fix use-after-free in taprio_change() 2024-11-08 16:20:51 +01:00
sch_tbf.c net_sched: tbf: fix a race in tbf_change() 2025-06-27 11:02:50 +01:00
sch_teql.c