net/sched: ets: Always remove class from active list before deleting in ets_qdisc_change
Subsystems (3)
Jamal Hadi Salim
maintainerPATCH 1/1 net/sched: ets: Always remove class from active list before deleting in ets_qdisc_change
[email protected] says:
The vulnerability is a race condition between ets_qdisc_dequeue and ets_qdisc_change. It leads to UAF on struct Qdisc object. Attacker requires the capability to create new user and network namespace in order to trigger the bug.
See my additional commentary at the end of the analysis.
Analysis:
static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt,
struct netlink_ext_ack *extack)
{
...
// (1) this lock is preventing .change handler (`ets_qdisc_change`)
//to race with .dequeue handler (`ets_qdisc_dequeue`)
sch_tree_lock(sch);
for (i = nbands; i < oldbands; i++) {
if (i >= q->nstrict && q->classes[i].qdisc->q.qlen)
list_del_init(&q->classes[i].alist);
qdisc_purge_queue(q->classes[i].qdisc);
}
WRITE_ONCE(q->nbands, nbands);
for (i = nstrict; i < q->nstrict; i++) {
if (q->classes[i].qdisc->q.qlen) {
// (2) the class is added to the q->active
list_add_tail(&q->classes[i].alist, &q->active);
q->classes[i].deficit = quanta[i];
}
}
WRITE_ONCE(q->nstrict, nstrict);
memcpy(q->prio2band, priomap, sizeof(priomap));
for (i = 0; i < q->nbands; i++)
WRITE_ONCE(q->classes[i].quantum, quanta[i]);
for (i = oldbands; i < q->nbands; i++) {
q->classes[i].qdisc = queues[i];
if (q->classes[i].qdisc != &noop_qdisc)
qdisc_hash_add(q->classes[i].qdisc, true);
}
// (3) the qdisc is unlocked, now dequeue can be called in parallel
// to the rest of .change handler
sch_tree_unlock(sch);
ets_offload_change(sch);
for (i = q->nbands; i < oldbands; i++) {
// (4) we're reducing the refcount for our class's qdisc and
// freeing it
qdisc_put(q->classes[i].qdisc);
// (5) If we call .dequeue between (4) and (5), we will have
// a strong UAF and we can control RIP
q->classes[i].qdisc = NULL;
WRITE_ONCE(q->classes[i].quantum, 0);
q->classes[i].deficit = 0;
gnet_stats_basic_sync_init(&q->classes[i].bstats);
memset(&q->classes[i].qstats, 0, sizeof(q->classes[i].qstats));
}
return 0;
}Comment:
This happens because some of the classes have their qdiscs assigned to NULL, but remain in the active list. This commit fixes this issue by always removing the class from the active list before deleting and freeing its associated qdisc
Reproducer Steps
(trimmed version of what was sent by [email protected])
```
DEV="${DEV:-lo}"
ROOT_HANDLE="${ROOT_HANDLE:-1:}"
BAND2_HANDLE="${BAND2_HANDLE:-20:}" # child under 1:2
PING_BYTES="${PING_BYTES:-48}"
PING_COUNT="${PING_COUNT:-200000}"
PING_DST="${PING_DST:-127.0.0.1}"
SLOW_TBF_RATE="${SLOW_TBF_RATE:-8bit}"
SLOW_TBF_BURST="${SLOW_TBF_BURST:-100b}"
SLOW_TBF_LAT="${SLOW_TBF_LAT:-1s}"
cleanup() {
tc qdisc del dev "$DEV" root 2>/dev/null
}
trap cleanup EXIT
ip link set "$DEV" up
tc qdisc del dev "$DEV" root 2>/dev/null || true
tc qdisc add dev "$DEV" root handle "$ROOT_HANDLE" ets bands 2 strict 2
tc qdisc add dev "$DEV" parent 1:2 handle "$BAND2_HANDLE" \
tbf rate "$SLOW_TBF_RATE" burst "$SLOW_TBF_BURST" latency "$SLOW_TBF_LAT"
tc filter add dev "$DEV" parent 1: protocol all prio 1 u32 match u32 0 0 flowid 1:2
tc -s qdisc ls dev $DEV
ping -I "$DEV" -f -c "$PING_COUNT" -s "$PING_BYTES" -W 0.001 "$PING_DST" \
>/dev/null 2>&1 &
tc qdisc change dev "$DEV" root handle "$ROOT_HANDLE" ets bands 2 strict 0
tc qdisc change dev "$DEV" root handle "$ROOT_HANDLE" ets bands 2 strict 2
tc -s qdisc ls dev $DEV
tc qdisc del dev "$DEV" parent 1:2 || true
tc -s qdisc ls dev $DEV
tc qdisc change dev "$DEV" root handle "$ROOT_HANDLE" ets bands 1 strict 1
```KASAN report
```
==================================================================
BUG: KASAN: slab-use-after-free in ets_qdisc_dequeue+0x1071/0x11b0 kernel/net/sched/sch_ets.c:481 Read of size 8 at addr ffff8880502fc018 by task ping/12308
Quoted 1 line
CPU: 0 UID: 0 PID: 12308 Comm: ping Not tainted 6.18.0-rc4-dirty #1 PREEMPT(full) Hardware name: QEMU Ubuntu 25.04 PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: <IRQ> __dump_stack kernel/lib/dump_stack.c:94 dump_stack_lvl+0x100/0x190 kernel/lib/dump_stack.c:120 print_address_description kernel/mm/kasan/report.c:378 print_report+0x156/0x4c9 kernel/mm/kasan/report.c:482 kasan_report+0xdf/0x110 kernel/mm/kasan/report.c:595 ets_qdisc_dequeue+0x1071/0x11b0 kernel/net/sched/sch_ets.c:481 dequeue_skb kernel/net/sched/sch_generic.c:294 qdisc_restart kernel/net/sched/sch_generic.c:399 __qdisc_run+0x1c9/0x1b00 kernel/net/sched/sch_generic.c:417 __dev_xmit_skb kernel/net/core/dev.c:4221 __dev_queue_xmit+0x2848/0x4410 kernel/net/core/dev.c:4729 dev_queue_xmit kernel/./include/linux/netdevice.h:3365
[...]
Allocated by task 17115: kasan_save_stack+0x30/0x50 kernel/mm/kasan/common.c:56 kasan_save_track+0x14/0x30 kernel/mm/kasan/common.c:77 poison_kmalloc_redzone kernel/mm/kasan/common.c:400 __kasan_kmalloc+0xaa/0xb0 kernel/mm/kasan/common.c:417 kasan_kmalloc kernel/./include/linux/kasan.h:262 __do_kmalloc_node kernel/mm/slub.c:5642 __kmalloc_node_noprof+0x34e/0x990 kernel/mm/slub.c:5648 kmalloc_node_noprof kernel/./include/linux/slab.h:987 qdisc_alloc+0xb8/0xc30 kernel/net/sched/sch_generic.c:950 qdisc_create_dflt+0x93/0x490 kernel/net/sched/sch_generic.c:1012 ets_class_graft+0x4fd/0x800 kernel/net/sched/sch_ets.c:261 qdisc_graft+0x3e4/0x1780 kernel/net/sched/sch_api.c:1196
[...]
Freed by task 9905: kasan_save_stack+0x30/0x50 kernel/mm/kasan/common.c:56 kasan_save_track+0x14/0x30 kernel/mm/kasan/common.c:77 __kasan_save_free_info+0x3b/0x70 kernel/mm/kasan/generic.c:587 kasan_save_free_info kernel/mm/kasan/kasan.h:406 poison_slab_object kernel/mm/kasan/common.c:252 __kasan_slab_free+0x5f/0x80 kernel/mm/kasan/common.c:284 kasan_slab_free kernel/./include/linux/kasan.h:234 slab_free_hook kernel/mm/slub.c:2539 slab_free kernel/mm/slub.c:6630 kfree+0x144/0x700 kernel/mm/slub.c:6837 rcu_do_batch kernel/kernel/rcu/tree.c:2605 rcu_core+0x7c0/0x1500 kernel/kernel/rcu/tree.c:2861 handle_softirqs+0x1ea/0x8a0 kernel/kernel/softirq.c:622 __do_softirq kernel/kernel/softirq.c:656
[...]
Commentary:
1. Maher Azzouzi working with Trend Micro Zero Day Initiative was reported as the person who found the issue. I requested to get a proper email to add to the reported-by tag but got no response. For this reason i will credit the person i exchanged emails with i.e [email protected]
2. Neither i nor Victor who did a much more thorough testing was able to reproduce a UAF with the PoC or other approaches we tried. We were both able to reproduce a null ptr deref. After exchange with [email protected] they sent a small change to be made to the code to add an extra delay which was able to simulate the UAF. i.e, this:
qdisc_put(q->classes[i].qdisc);
mdelay(90);
q->classes[i].qdisc = NULL;
I was informed by Thomas Gleixner([email protected]) that adding delays was acceptable approach for demonstrating the bug, quote:
"Adding such delays is common exploit validation practice"
The equivalent delay could happen "by virt scheduling the vCPU out, SMIs, NMIs, PREEMPT_RT enabled kernel"
3. I asked the OP to test and report back but got no response and after a few days gave up and proceeded to submit this fix.
--- net/sched/sch_ets.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_ets.c +1 -1
@@ -652,7 +652,7 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt,sch_tree_lock (sch);for (i = nbands; i < oldbands; i++) { -if (i >= q->nstrict && q->classes[i].qdisc->q.qlen) +if (cl_is_active (&q->classes[i]))list_del_init (&q->classes[i].alist);qdisc_purge_queue (q->classes[i].qdisc); }
Signature · 1 line
2.34.1
Quoted 7 lines · Jamal Hadi Salim
[email protected] says:
The vulnerability is a race condition between
ets_qdisc_dequeueandets_qdisc_change. It leads to UAF onstruct Qdiscobject. Attacker requires the capability to create new user and network namespace in order to trigger the bug.
See my additional commentary at the end of the analysis.
hello, thanks for your patch!
[...]
Quoted 14 lines
Fixes de6d25924c2a ("net/sched: sch_ets: don't peek at classes beyond 'nbands'")Reported-by [email protected]Tested-by Victor Nogueira <[email protected]>Signed-off-by Jamal Hadi Salim <[email protected]>--- net/sched/sch_ets.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/sched/sch_ets.c +0
-0
net/sched/sch_ets.c static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt, · line 658
Quoted 8 lines
net/sched/sch_ets.c +1
-1@@ -652,7 +652,7 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt,sch_tree_lock (sch);for (i = nbands; i < oldbands; i++) { -if (i >= q->nstrict && q->classes[i].qdisc->q.qlen) +if (cl_is_active (&q->classes[i]))list_del_init (&q->classes[i].alist);qdisc_purge_queue (q->classes[i].qdisc); }
(nit)
the reported problem is NULL dereference of q->classes[i].qdisc, then
probably the 'Fixes' tag is an hash precedent to de6d25924c2a ("net/sched: sch_ets: don't peek at classes beyond 'nbands'"). My understanding is: the test on 'q->classes[i].qdisc' is no more NULL-safe after 103406b38c60 ("net/sched: Always pass notifications when child class becomes empty"). So we might help our friends planning backports with something like:
WDYT?
Signature · 1 line
davide
Jamal Hadi Salim
maintainerHi Davide,
Quoted 45 lines · Davide Caratti
Quoted 7 lines · Jamal Hadi Salim
[email protected] says:
The vulnerability is a race condition between
ets_qdisc_dequeueandets_qdisc_change. It leads to UAF onstruct Qdiscobject. Attacker requires the capability to create new user and network namespace in order to trigger the bug.
See my additional commentary at the end of the analysis.hello, thanks for your patch!
[...]
Quoted 14 lines
Fixes de6d25924c2a ("net/sched: sch_ets: don't peek at classes beyond 'nbands'")Reported-by [email protected]Tested-by Victor Nogueira <[email protected]>Signed-off-by Jamal Hadi Salim <[email protected]>--- net/sched/sch_ets.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/sched/sch_ets.c +0
-0net/sched/sch_ets.c static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt, · line 658
Quoted 8 lines
net/sched/sch_ets.c +1
-1@@ -652,7 +652,7 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt,sch_tree_lock (sch);for (i = nbands; i < oldbands; i++) { -if (i >= q->nstrict && q->classes[i].qdisc->q.qlen) +if (cl_is_active (&q->classes[i]))list_del_init (&q->classes[i].alist);qdisc_purge_queue (q->classes[i].qdisc); }(nit)
the reported problem is NULL dereference of q->classes[i].qdisc, then
probably the 'Fixes' tag is an hash precedent tode6d25924c2a("net/sched:sch_ets: don't peek at classes beyond 'nbands'"). My understanding is: the test on 'q->classes[i].qdisc' is no more NULL-safe after103406b38c60("net/sched: Always pass notifications when child class becomes empty"). So we might help our friends planning backports with something like:
Quoted 4 lines
Fixes de6d25924c2a ("net/sched: sch_ets: don't peek at classes beyond 'nbands'")Fixes c062f2a0b04d ("net/sched: sch_ets: don't remove idle classes from the round-robin list")WDYT?
I may be misreading your thought process, seems you are thinking the null ptr deref is in change()?
The null ptr deref (and the uaf if you add a delay) is in dequeue (ets_qdisc_dequeue()) i.e not in change.
If that makes sense, what would be a more appropriate Fixes?
BTW, is that q->classes[i].qdisc = NULL even needed after this? It was not clear whether it guards against something else that was not obvious from inspection.
cheers,
jamal
Quoted 3 lines
--
davide
Quoted 3 lines · Jamal Hadi Salim
Hi Davide,
On Fri, Nov 28, 2025 at 12:25 PM Davide Caratti <[email protected]> wrote:
hello Jamal, thanks for your patience!
[...]
Quoted 25 lines
Quoted 25 lines
net/sched/sch_ets.c static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt, · line 658
Quoted 13 lines
net/sched/sch_ets.c +1
-1@@ -652,7 +652,7 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt,sch_tree_lock (sch);for (i = nbands; i < oldbands; i++) { -if (i >= q->nstrict && q->classes[i].qdisc->q.qlen) +if (cl_is_active (&q->classes[i]))list_del_init (&q->classes[i].alist);qdisc_purge_queue (q->classes[i].qdisc); }(nit)
the reported problem is NULL dereference of q->classes[i].qdisc, then
probably the 'Fixes' tag is an hash precedent tode6d25924c2a("net/sched:sch_ets: don't peek at classes beyond 'nbands'"). My understanding is: the test on 'q->classes[i].qdisc' is no more NULL-safe after103406b38c60("net/sched: Always pass notifications when child class becomes empty"). So we might help our friends planning backports with something like:Fixes de6d25924c2a ("net/sched: sch_ets: don't peek at classes beyond 'nbands'")Fixes c062f2a0b04d ("net/sched: sch_ets: don't remove idle classes from the round-robin list")
Quoted 6 lines
Quoted 1 line
WDYT?
I may be misreading your thought process, seems you are thinking the null ptr deref is in
change()?
The null ptr deref (and the uaf if you add a delay) is in dequeue (ets_qdisc_dequeue()) i.e not in change.
I understand this - it happens to DRR classes that are beyond 'nbands' after the call to ets_qdisc_change(). Since those queues can have some packets stored, in ets_qdisc_dequeue() you might have observed:
480 cl = list_first_entry(&q->active, struct ets_class, alist);
481 skb = cl->qdisc->ops->peek(cl->qdisc);
with a "problematic" value in cl->qdisc. That's why I suggest to add
[1] Fixes: de6d25924c2a ("net/sched: sch_ets: don't peek at classes beyond 'nbands'")
in the metadata.
Quoted 1 line
If that makes sense, what would be a more appropriate Fixes?
the line you are changing in the patch above was added with:
c062f2a0b04d ("net/sched: sch_ets: don't remove idle classes from the round-robin list")
and the commit message said:
<< we can remove 'q->classes[i].alist' only if DRR class 'i' was part of the active
list. In the ETS scheduler DRR classes belong to that list only if the queue length is greater than zero >>
this assumption on the queue length is no more valid, maybe it has never been valid :), hence my suggestion to add also
[2] Fixes: c062f2a0b04d ("net/sched: sch_ets: don't remove idle classes from the round-robin list")
Quoted 3 lines
BTW, is that q->classes[i].qdisc = NULL even needed after this? It was not clear whether it guards against something else that was not obvious from inspection.
That NULL assignment is done in ets_qdisc_change() since the beginning: for classes beyond 'nbands' we had
for (i = q->nbands; i < oldbands; i++) {
qdisc_put(q->classes[i].qdisc);
memset(&q->classes[i], 0, sizeof(q->classes[i]));in the very first implementation of sch_ets that memset() was wrongly overwriting 'alist'. The NULL assignment is not strictly necessary, but any value of 'q->classes[i].qdisc' is either a UAF or a NULL dereference when 'i' is greater or equal to 'q->nbands'. I see that ETS sometimes assigns the noop qdisc there: maybe we can assign that to 'q->classes[i].qdisc' when 'i' is greater or equal to 'q->nbands', instead of NULL ? so the value of 'q->classes[i].qdisc' is a valid pointer all the times? In case it makes some sense, that would be a follow-up patch targeting net-next that I can test and send. Any feedback appreciated!
thanks,
Signature · 1 line
davide
Jamal Hadi Salim
maintainerSorry, I totally forgot to add Petr in the original post, he's on Cc now..
Quoted 46 lines · Davide Caratti
Quoted 3 lines · Jamal Hadi Salim
Hi Davide,
On Fri, Nov 28, 2025 at 12:25 PM Davide Caratti <[email protected]> wrote:
hello Jamal, thanks for your patience!
[...]
Quoted 25 lines
Quoted 25 lines
net/sched/sch_ets.c static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt, · line 658
Quoted 13 lines
net/sched/sch_ets.c +1
-1@@ -652,7 +652,7 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt,sch_tree_lock (sch);for (i = nbands; i < oldbands; i++) { -if (i >= q->nstrict && q->classes[i].qdisc->q.qlen) +if (cl_is_active (&q->classes[i]))list_del_init (&q->classes[i].alist);qdisc_purge_queue (q->classes[i].qdisc); }(nit)
the reported problem is NULL dereference of q->classes[i].qdisc, then
probably the 'Fixes' tag is an hash precedent tode6d25924c2a("net/sched:sch_ets: don't peek at classes beyond 'nbands'"). My understanding is: the test on 'q->classes[i].qdisc' is no more NULL-safe after103406b38c60("net/sched: Always pass notifications when child class becomes empty"). So we might help our friends planning backports with something like:Fixes de6d25924c2a ("net/sched: sch_ets: don't peek at classes beyond 'nbands'")Fixes c062f2a0b04d ("net/sched: sch_ets: don't remove idle classes from the round-robin list")Quoted 6 lines
Quoted 1 line
WDYT?
I may be misreading your thought process, seems you are thinking the null ptr deref is in
change()?
The null ptr deref (and the uaf if you add a delay) is in dequeue (ets_qdisc_dequeue()) i.e not in change.I understand this - it happens to DRR classes that are beyond 'nbands' after the call to
ets_qdisc_change(). Since those queues can have some packets stored, inets_qdisc_dequeue()you might have observed:
Quoted 7 lines
480 cl =
list_first_entry(&q->active, struct ets_class, alist);
481 skb =cl->qdisc->ops->peek(cl->qdisc);with a "problematic" value in
cl->qdisc. That's why I suggest to add[1] Fixes:
de6d25924c2a("net/sched:sch_ets: don't peek at classes beyond 'nbands'")
Ok, so that was the initial attempt to fix this issue?
Quoted 11 lines
in the metadata.
Quoted 1 line
If that makes sense, what would be a more appropriate Fixes?
the line you are changing in the patch above was added with:
c062f2a0b04d("net/sched:sch_ets: don't remove idle classes from the round-robin list")and the commit message said:
Quoted 9 lines
<< we can remove 'q->classes[i].alist' only if DRR class 'i' was part of the active
list. In the ETS scheduler DRR classes belong to that list only if the queue length is greater than zero >>this assumption on the queue length is no more valid, maybe it has never been valid :), hence my suggestion to add also
[2] Fixes:
c062f2a0b04d("net/sched:sch_ets: don't remove idle classes from the round-robin list")
ok, so this seems to be a followup attempt to the first one. I have a question: Shouldnt we be listing all the commits in Fixes if subsequent patches are fixing a previous one? Example, this one has a
fine to only mention c062f2a0b04d and not de6d25924c2a?
Quoted 4 lines
Quoted 3 lines
BTW, is that q->classes[i].qdisc = NULL even needed after this? It was not clear whether it guards against something else that was not obvious from inspection.
Quoted 8 lines
That NULL assignment is done in
ets_qdisc_change()since the beginning: for classes beyond 'nbands' we hadfor (i = q->nbands; i < oldbands; i++) { qdisc_put(q->classes[i].qdisc); memset(&q->classes[i], 0, sizeof(q->classes[i]));in the very first implementation of
sch_etsthatmemset()was wrongly overwriting 'alist'.
Ok. makes sense - i see it in the original patch from Petr.
Quoted 2 lines
The NULL assignment is not strictly necessary, but any value of 'q->classes[i].qdisc' is either a UAF or a NULL dereference when 'i' is greater or equal to '
q->nbands'.
I agree - before this one liner fix. I do think it is not necessary any longer, but wont touch it for now in case there are other dependencies
Quoted 2 lines
I see that ETS sometimes assigns the noop qdisc there: maybe we can assign that to 'q->classes[i].qdisc' when 'i' is greater or equal to '
q->nbands', instead of NULL ?
I wouldnt go that far. What i can tell you is removing it didnt matter in both what i and Victor tested.
Quoted 1 line
so the value of 'q->classes[i].qdisc' is a valid pointer all the times?
Well, I don't think the nstrict classes should have gone into that alist to begin with (looking at the trick test that made you issue the first commit - that is what the test was achieving) and since that doesnt happen anymore we dont need to worry about it.
Quoted 4 lines
In case it makes some
sense, that would be a follow-up patch targeting net-next that I can test and send. Any feedback appreciated!
We'll see if it is worth it. Some more testing is needed.
cheers,
jamal
Quoted 5 lines
thanks,
--
davide
Davide Caratti
Reviewed-byQuoted 14 lines · Jamal Hadi Salim
Quoted 14 lines
the line you are changing in the patch above was added with:
c062f2a0b04d("net/sched:sch_ets: don't remove idle classes from the round-robin list")and the commit message said:
<< we can remove 'q->classes[i].alist' only if DRR class 'i' was part of the active
list. In the ETS scheduler DRR classes belong to that list only if the queue length is greater than zero >>this assumption on the queue length is no more valid, maybe it has never been valid :), hence my suggestion to add also
Quoted 8 lines
Quoted 2 lines
[2] Fixes:
c062f2a0b04d("net/sched:sch_ets: don't remove idle classes from the round-robin list")ok, so this seems to be a followup attempt to the first one. I have a question: Shouldnt we be listing all the commits in Fixes if subsequent patches are fixing a previous one? Example, this one has a
Fixes de6d25924c2a - which is the previous one? IOW, would it not befine to only mention
c062f2a0b04dand notde6d25924c2a?
right - I didn't see that c062f2a0b04d has the 'Fixes' tag for de6d25924c2a. Then also the single 'Fixes' tag equal to de6d25924c2a should be sufficient to track all the needed backports.
Quoted 29 lines
Quoted 5 lines
Quoted 4 lines
BTW, is that q->classes[i].qdisc = NULL even needed after this? It was not clear whether it guards against something else that was not obvious from inspection.
Quoted 8 lines
That NULL assignment is done in
ets_qdisc_change()since the beginning: for classes beyond 'nbands' we hadfor (i = q->nbands; i < oldbands; i++) { qdisc_put(q->classes[i].qdisc); memset(&q->classes[i], 0, sizeof(q->classes[i]));in the very first implementation of
sch_etsthatmemset()was wrongly overwriting 'alist'.Ok. makes sense - i see it in the original patch from Petr.
Quoted 2 lines
The NULL assignment is not strictly necessary, but any value of 'q->classes[i].qdisc' is either a UAF or a NULL dereference when 'i' is greater or equal to '
q->nbands'.I agree - before this one liner fix. I do think it is not necessary any longer, but wont touch it for now in case there are other dependencies
Quoted 2 lines
I see that ETS sometimes assigns the noop qdisc there: maybe we can assign that to 'q->classes[i].qdisc' when 'i' is greater or equal to '
q->nbands', instead of NULL ?I wouldnt go that far. What i can tell you is removing it didnt matter in both what i and Victor tested.
Quoted 6 lines
Quoted 1 line
so the value of 'q->classes[i].qdisc' is a valid pointer all the times?
Well, I don't think the nstrict classes should have gone into that alist to begin with (looking at the trick test that made you issue the first commit - that is what the test was achieving) and since that doesnt happen anymore we dont need to worry about it.
right, because cl_is_active() would return false for strict priority classes.
thanks for fixing this!
Signature · 1 line
davide
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 9 lines · On Fri, 28 Nov 2025 10:19:19 -0500 you wrote:
[email protected] says:
The vulnerability is a race condition between
ets_qdisc_dequeueandets_qdisc_change. It leads to UAF onstruct Qdiscobject. Attacker requires the capability to create new user and network namespace in order to trigger the bug.
See my additional commentary at the end of the analysis.[...]
Here is the summary with links:
- [net] net/sched: ets: Always remove class from active list before deleting in ets_qdisc_change
https://git.kernel.org/netdev/net/c/ce052b9402e4
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html