| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/11/06 22:55 | flow | patch-triage |
3mArgs:null Results: {
"EnableConfigs": [
"NET_SCH_TAPRIO",
"NET_SCHED"
],
"FocusSymbols": [
"taprio_change",
"advance_sched",
"parse_taprio_schedule",
"taprio_advance_one_entry",
"taprio_fast_forward_sched",
"taprio_sync_sched_to_time",
"get_packet_txtime",
"is_valid_interval",
"taprio_enqueue"
],
"KMSANReasoning": "The patch series modifies the taprio qdisc (net/sched/sch_taprio.c) to improve interval validation (enforcing a minimum interval in software mode to avoid hrtimer storms), handle schedule fast-forwarding when timers lag behind, fix cleanup/rollback on configuration failures, and safely stage queue/traffic-class configurations.\n\nThere are no uninitialized memory risks or kernel-to-user info-leaks introduced or exposed by these changes:\n1. No uninitialized memory is exported to user space. Netlink dump paths emit scalar fields individually via nla_put_* helpers. Stack arrays introduced in taprio_change (max_sdu and fp) are explicitly zero-initialized (`= { }`) before being populated and written to the qdisc state.\n2. Control flow variables (such as timestamps, loop limits, and gate entry pointers) are strictly initialized before use in condition checks and time comparisons.\n3. Heap allocations for schedule entries and gate lists continue to be allocated with zeroed memory (kzalloc_obj).\n4. Potential bugs related to list management, timer expiry handling, state cleanup, or offload callbacks fall strictly into the domain of KASAN (use-after-free, out-of-bounds), LOCKDEP (locking/deadlock), or UBSAN, which are already covered by standard KASAN fuzzing. Dedicated KMSAN fuzzing is not justified.",
"NeedsKMSAN": false,
"Reasoning": "The patch significantly modifies the TAPRIO (Time Aware Priority) packet scheduler (net/sched/sch_taprio.c). It restructures schedule parsing, validation, and error recovery in taprio_change(), updates time calculations and schedule-switching checks in txtime/enqueue paths, and overhauls the hrtimer advance_sched() routine with new scheduling algorithms (taprio_advance_one_entry, taprio_fast_forward_sched, taprio_sync_sched_to_time) to handle timer drift and prevent CPU starvation. The code is fully reachable in standard virtualized environments via rtnetlink qdisc configuration and packet transmission.",
"WorthFuzzing": true
} |
| 1/1 | 2026/11/06 22:55 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 884ebe33e538fc6cfee1c0bc395c028146e11df8\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Fri Nov 6 22:55:46 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c\nindex 39ac5b97aa3af8..b0806ea0460bce 100644\n--- a/net/sched/sch_taprio.c\n+++ b/net/sched/sch_taprio.c\n@@ -48,6 +48,10 @@ static struct static_key_false taprio_have_working_mqprio;\n * 60 * 17 \u003e PSEC_PER_NSEC (1000)\n */\n #define TAPRIO_PICOS_PER_BYTE_MIN 17\n+/* Minimum interval for software mode (hrtimer-driven advance_sched) to\n+ * avoid hrtimer interrupt storms and CPU starvation.\n+ */\n+#define TAPRIO_MIN_SW_INTERVAL_NS (10 * NSEC_PER_USEC)\n \n struct sched_entry {\n \t/* Durations between this GCL entry and the GCL entry where the\n@@ -117,10 +121,9 @@ struct __tc_taprio_qopt_offload {\n };\n \n static void taprio_calculate_gate_durations(struct taprio_sched *q,\n-\t\t\t\t\t struct sched_gate_list *sched)\n+\t\t\t\t\t struct sched_gate_list *sched,\n+\t\t\t\t\t int num_tc)\n {\n-\tstruct net_device *dev = qdisc_dev(q-\u003eroot);\n-\tint num_tc = netdev_get_num_tc(dev);\n \tstruct sched_entry *entry, *cur;\n \tint tc;\n \n@@ -259,6 +262,17 @@ static int length_to_duration(struct taprio_sched *q, int len)\n \treturn div_u64(len * atomic64_read(\u0026q-\u003epicos_per_byte), PSEC_PER_NSEC);\n }\n \n+static int taprio_min_interval(struct taprio_sched *q)\n+{\n+\tint min_duration = length_to_duration(q, ETH_ZLEN);\n+\n+\tif (!FULL_OFFLOAD_IS_ENABLED(q-\u003eflags) \u0026\u0026\n+\t !TXTIME_ASSIST_IS_ENABLED(q-\u003eflags))\n+\t\tmin_duration = max_t(int, min_duration, TAPRIO_MIN_SW_INTERVAL_NS);\n+\n+\treturn min_duration;\n+}\n+\n static int duration_to_length(struct taprio_sched *q, u64 duration)\n {\n \treturn div_u64(duration * PSEC_PER_NSEC, atomic64_read(\u0026q-\u003epicos_per_byte));\n@@ -270,17 +284,18 @@ static int duration_to_length(struct taprio_sched *q, u64 duration)\n */\n static void taprio_update_queue_max_sdu(struct taprio_sched *q,\n \t\t\t\t\tstruct sched_gate_list *sched,\n-\t\t\t\t\tstruct qdisc_size_table *stab)\n+\t\t\t\t\tstruct qdisc_size_table *stab,\n+\t\t\t\t\tconst u32 max_sdu_user[TC_MAX_QUEUE],\n+\t\t\t\t\tint num_tc)\n {\n \tstruct net_device *dev = qdisc_dev(q-\u003eroot);\n-\tint num_tc = netdev_get_num_tc(dev);\n \tu32 max_sdu_from_user;\n \tu32 max_sdu_dynamic;\n \tu32 max_sdu;\n \tint tc;\n \n \tfor (tc = 0; tc \u003c num_tc; tc++) {\n-\t\tmax_sdu_from_user = q-\u003emax_sdu[tc] ?: U32_MAX;\n+\t\tmax_sdu_from_user = max_sdu_user[tc] ?: U32_MAX;\n \n \t\t/* TC gate never closes =\u003e keep the queueMaxSDU\n \t\t * selected by the user\n@@ -357,7 +372,7 @@ static struct sched_entry *find_entry_to_transmit(struct sk_buff *skb,\n \t\tcurr_intv_end = get_interval_end_time(sched, admin, entry,\n \t\t\t\t\t\t curr_intv_start);\n \n-\t\tif (ktime_after(curr_intv_start, cycle_end))\n+\t\tif (ktime_compare(curr_intv_start, cycle_end) \u003e= 0)\n \t\t\tbreak;\n \n \t\tif (!(entry-\u003egate_mask \u0026 BIT(tc)) ||\n@@ -366,10 +381,10 @@ static struct sched_entry *find_entry_to_transmit(struct sk_buff *skb,\n \n \t\ttxtime = entry-\u003enext_txtime;\n \n-\t\tif (ktime_before(txtime, time) || validate_interval) {\n+\t\tif (!ktime_after(txtime, time) || validate_interval) {\n \t\t\ttransmit_end_time = ktime_add_ns(time, packet_transmit_time);\n-\t\t\tif ((ktime_before(curr_intv_start, time) \u0026\u0026\n-\t\t\t ktime_before(transmit_end_time, curr_intv_end)) ||\n+\t\t\tif ((!ktime_after(curr_intv_start, time) \u0026\u0026\n+\t\t\t !ktime_after(transmit_end_time, curr_intv_end)) ||\n \t\t\t (ktime_after(curr_intv_start, time) \u0026\u0026 !validate_interval)) {\n \t\t\t\tentry_found = entry;\n \t\t\t\t*interval_start = curr_intv_start;\n@@ -405,8 +420,19 @@ static bool is_valid_interval(struct sk_buff *skb, struct Qdisc *sch)\n \tstruct sched_entry *entry;\n \n \trcu_read_lock();\n-\tsched = rcu_dereference(q-\u003eoper_sched);\n \tadmin = rcu_dereference(q-\u003eadmin_sched);\n+\tsched = rcu_dereference(q-\u003eoper_sched);\n+\n+\tif (admin \u0026\u0026 !ktime_before(skb-\u003etstamp, admin-\u003ebase_time)) {\n+\t\tsched = admin;\n+\t\tadmin = NULL;\n+\t}\n+\n+\t/* Until the schedule starts, all the queues are open */\n+\tif (!sched || ktime_before(skb-\u003etstamp, sched-\u003ebase_time)) {\n+\t\trcu_read_unlock();\n+\t\treturn true;\n+\t}\n \n \tentry = find_entry_to_transmit(skb, sch, sched, admin, skb-\u003etstamp,\n \t\t\t\t \u0026interval_start, \u0026interval_end, true);\n@@ -484,7 +510,7 @@ static long get_packet_txtime(struct sk_buff *skb, struct Qdisc *sch)\n \trcu_read_lock();\n \tadmin = rcu_dereference(q-\u003eadmin_sched);\n \tsched = rcu_dereference(q-\u003eoper_sched);\n-\tif (admin \u0026\u0026 ktime_after(minimum_time, admin-\u003ebase_time))\n+\tif (admin \u0026\u0026 !ktime_before(minimum_time, admin-\u003ebase_time))\n \t\tswitch_schedules(q, \u0026admin, \u0026sched);\n \n \t/* Until the schedule starts, all the queues are open */\n@@ -513,8 +539,9 @@ static long get_packet_txtime(struct sk_buff *skb, struct Qdisc *sch)\n \t\ttxtime = max_t(ktime_t, txtime, interval_start);\n \n \t\tif (admin \u0026\u0026 admin != sched \u0026\u0026\n-\t\t ktime_after(txtime, admin-\u003ebase_time)) {\n+\t\t !ktime_before(txtime, admin-\u003ebase_time)) {\n \t\t\tsched = admin;\n+\t\t\tadmin = NULL;\n \t\t\tsched_changed = true;\n \t\t\tcontinue;\n \t\t}\n@@ -876,7 +903,7 @@ static bool should_restart_cycle(const struct sched_gate_list *oper,\n \tif (list_is_last(\u0026entry-\u003elist, \u0026oper-\u003eentries))\n \t\treturn true;\n \n-\tif (ktime_compare(entry-\u003eend_time, oper-\u003ecycle_end_time) == 0)\n+\tif (ktime_compare(entry-\u003eend_time, oper-\u003ecycle_end_time) \u003e= 0)\n \t\treturn true;\n \n \treturn false;\n@@ -888,7 +915,7 @@ static bool should_change_schedules(const struct sched_gate_list *admin,\n {\n \tktime_t next_base_time, extension_time;\n \n-\tif (!admin)\n+\tif (!admin || !oper)\n \t\treturn false;\n \n \tnext_base_time = sched_base_time(admin);\n@@ -916,6 +943,162 @@ static bool should_change_schedules(const struct sched_gate_list *admin,\n \treturn false;\n }\n \n+static void taprio_set_entry_state(struct taprio_sched *q,\n+\t\t\t\t struct sched_gate_list *oper,\n+\t\t\t\t struct sched_entry *next,\n+\t\t\t\t ktime_t cur_start,\n+\t\t\t\t ktime_t end_time,\n+\t\t\t\t int num_tc)\n+{\n+\tint tc;\n+\n+\tfor (tc = 0; tc \u003c num_tc; tc++) {\n+\t\tif (next-\u003egate_duration[tc] == oper-\u003ecycle_time)\n+\t\t\tnext-\u003egate_close_time[tc] = KTIME_MAX;\n+\t\telse\n+\t\t\tnext-\u003egate_close_time[tc] = ktime_add_ns(cur_start,\n+\t\t\t\t\t\t\t\t next-\u003egate_duration[tc]);\n+\t}\n+\n+\tnext-\u003eend_time = end_time;\n+\ttaprio_set_budgets(q, oper, next);\n+}\n+\n+static void taprio_advance_one_entry(struct taprio_sched *q,\n+\t\t\t\t struct sched_gate_list **p_oper,\n+\t\t\t\t struct sched_gate_list **p_admin,\n+\t\t\t\t struct sched_entry **p_entry,\n+\t\t\t\t struct sched_entry **p_next,\n+\t\t\t\t ktime_t *p_end_time,\n+\t\t\t\t int num_tc)\n+{\n+\tstruct sched_gate_list *oper = *p_oper;\n+\tstruct sched_gate_list *admin = *p_admin;\n+\tstruct sched_entry *entry = *p_entry;\n+\tktime_t cur_start, end_time;\n+\tstruct sched_entry *next;\n+\n+\tif (!oper-\u003ecycle_end_time)\n+\t\toper-\u003ecycle_end_time = ktime_add_ns(sched_base_time(oper),\n+\t\t\t\t\t\t oper-\u003ecycle_time);\n+\n+\tif (should_restart_cycle(oper, entry)) {\n+\t\tnext = list_first_entry(\u0026oper-\u003eentries, struct sched_entry,\n+\t\t\t\t\tlist);\n+\t\toper-\u003ecycle_end_time = ktime_add_ns(oper-\u003ecycle_end_time,\n+\t\t\t\t\t\t oper-\u003ecycle_time);\n+\t} else {\n+\t\tnext = list_next_entry(entry, list);\n+\t}\n+\n+\tcur_start = entry-\u003eend_time;\n+\tend_time = ktime_add_ns(cur_start, next-\u003einterval);\n+\tend_time = min_t(ktime_t, end_time, oper-\u003ecycle_end_time);\n+\n+\tif (should_change_schedules(admin, oper, end_time)) {\n+\t\tswitch_schedules(q, \u0026admin, \u0026oper);\n+\t\tif (!oper-\u003ecycle_end_time)\n+\t\t\toper-\u003ecycle_end_time = ktime_add_ns(sched_base_time(oper),\n+\t\t\t\t\t\t\t oper-\u003ecycle_time);\n+\t\tcur_start = ktime_sub_ns(oper-\u003ecycle_end_time,\n+\t\t\t\t\t oper-\u003ecycle_time);\n+\t\tnext = list_first_entry(\u0026oper-\u003eentries, struct sched_entry, list);\n+\t\tend_time = ktime_add_ns(cur_start, next-\u003einterval);\n+\t\tend_time = min_t(ktime_t, end_time, oper-\u003ecycle_end_time);\n+\t\t*p_admin = admin;\n+\t\t*p_oper = oper;\n+\t}\n+\n+\ttaprio_set_entry_state(q, oper, next, cur_start, end_time, num_tc);\n+\n+\t*p_entry = next;\n+\t*p_next = next;\n+\t*p_end_time = end_time;\n+}\n+\n+static void taprio_sync_sched_to_time(struct taprio_sched *q,\n+\t\t\t\t struct sched_gate_list *sched,\n+\t\t\t\t ktime_t now,\n+\t\t\t\t struct sched_entry **p_next,\n+\t\t\t\t ktime_t *p_end_time,\n+\t\t\t\t int num_tc)\n+{\n+\tktime_t base = sched_base_time(sched);\n+\tstruct sched_entry *entry, *next;\n+\tktime_t cur_start, end_time;\n+\n+\tif (ktime_compare(now, base) \u003c 0) {\n+\t\tcur_start = base;\n+\t\tsched-\u003ecycle_end_time = ktime_add_ns(base, sched-\u003ecycle_time);\n+\t\tnext = list_first_entry(\u0026sched-\u003eentries, struct sched_entry,\n+\t\t\t\t\tlist);\n+\t\tend_time = ktime_add_ns(cur_start, next-\u003einterval);\n+\t\tend_time = min_t(ktime_t, end_time, sched-\u003ecycle_end_time);\n+\t} else {\n+\t\tu64 cycles = div64_u64(ktime_sub_ns(now, base),\n+\t\t\t\t sched-\u003ecycle_time);\n+\n+\t\tcur_start = ktime_add_ns(base, cycles * sched-\u003ecycle_time);\n+\t\tsched-\u003ecycle_end_time = ktime_add_ns(cur_start,\n+\t\t\t\t\t\t sched-\u003ecycle_time);\n+\t\tnext = list_last_entry(\u0026sched-\u003eentries, struct sched_entry,\n+\t\t\t\t list);\n+\t\tend_time = sched-\u003ecycle_end_time;\n+\n+\t\tlist_for_each_entry(entry, \u0026sched-\u003eentries, list) {\n+\t\t\tktime_t cur_end = ktime_add_ns(cur_start,\n+\t\t\t\t\t\t entry-\u003einterval);\n+\n+\t\t\tif (list_is_last(\u0026entry-\u003elist, \u0026sched-\u003eentries))\n+\t\t\t\tcur_end = sched-\u003ecycle_end_time;\n+\t\t\telse\n+\t\t\t\tcur_end = min_t(ktime_t, cur_end,\n+\t\t\t\t\t\tsched-\u003ecycle_end_time);\n+\n+\t\t\tif (ktime_compare(cur_end, now) \u003e 0) {\n+\t\t\t\tnext = entry;\n+\t\t\t\tend_time = cur_end;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t\tcur_start = cur_end;\n+\t\t}\n+\t}\n+\n+\ttaprio_set_entry_state(q, sched, next, cur_start, end_time, num_tc);\n+\t*p_next = next;\n+\t*p_end_time = end_time;\n+}\n+\n+static void taprio_fast_forward_sched(struct taprio_sched *q,\n+\t\t\t\t struct sched_gate_list **p_oper,\n+\t\t\t\t struct sched_gate_list **p_admin,\n+\t\t\t\t struct sched_entry **p_next,\n+\t\t\t\t ktime_t *p_end_time,\n+\t\t\t\t ktime_t now,\n+\t\t\t\t int num_tc)\n+{\n+\tstruct sched_gate_list *oper = *p_oper;\n+\tstruct sched_gate_list *admin = *p_admin;\n+\tstruct sched_entry *next;\n+\tktime_t end_time;\n+\n+\tif (admin \u0026\u0026 ktime_compare(sched_base_time(admin), now) \u003c= 0)\n+\t\tswitch_schedules(q, \u0026admin, \u0026oper);\n+\n+\ttaprio_sync_sched_to_time(q, oper, now, \u0026next, \u0026end_time, num_tc);\n+\n+\tif (should_change_schedules(admin, oper, end_time)) {\n+\t\tswitch_schedules(q, \u0026admin, \u0026oper);\n+\t\ttaprio_sync_sched_to_time(q, oper, now, \u0026next, \u0026end_time,\n+\t\t\t\t\t num_tc);\n+\t}\n+\n+\t*p_oper = oper;\n+\t*p_admin = admin;\n+\t*p_next = next;\n+\t*p_end_time = end_time;\n+}\n+\n static enum hrtimer_restart advance_sched(struct hrtimer *timer)\n {\n \tstruct taprio_sched *q = container_of(timer, struct taprio_sched,\n@@ -925,8 +1108,7 @@ static enum hrtimer_restart advance_sched(struct hrtimer *timer)\n \tint num_tc = netdev_get_num_tc(dev);\n \tstruct sched_entry *entry, *next;\n \tstruct Qdisc *sch = q-\u003eroot;\n-\tktime_t end_time;\n-\tint tc;\n+\tktime_t end_time, now;\n \n \tspin_lock(\u0026q-\u003ecurrent_entry_lock);\n \tentry = rcu_dereference_protected(q-\u003ecurrent_entry,\n@@ -939,6 +1121,11 @@ static enum hrtimer_restart advance_sched(struct hrtimer *timer)\n \tif (!oper)\n \t\tswitch_schedules(q, \u0026admin, \u0026oper);\n \n+\tif (unlikely(!oper)) {\n+\t\tspin_unlock(\u0026q-\u003ecurrent_entry_lock);\n+\t\treturn HRTIMER_NORESTART;\n+\t}\n+\n \t/* This can happen in two cases: 1. this is the very first run\n \t * of this function (i.e. we weren't running any schedule\n \t * previously); 2. The previous schedule just ended. The first\n@@ -946,49 +1133,117 @@ static enum hrtimer_restart advance_sched(struct hrtimer *timer)\n \t * schedule initialization.\n \t */\n \tif (unlikely(!entry || entry-\u003eend_time == oper-\u003ebase_time)) {\n-\t\tnext = list_first_entry(\u0026oper-\u003eentries, struct sched_entry,\n-\t\t\t\t\tlist);\n-\t\tend_time = next-\u003eend_time;\n-\t\tgoto first_run;\n-\t}\n+\t\tktime_t cur_start;\n \n-\tif (should_restart_cycle(oper, entry)) {\n+\t\tif (!oper-\u003ecycle_end_time)\n+\t\t\toper-\u003ecycle_end_time = ktime_add_ns(sched_base_time(oper),\n+\t\t\t\t\t\t\t oper-\u003ecycle_time);\n+\t\tcur_start = ktime_sub_ns(oper-\u003ecycle_end_time,\n+\t\t\t\t\t oper-\u003ecycle_time);\n \t\tnext = list_first_entry(\u0026oper-\u003eentries, struct sched_entry,\n \t\t\t\t\tlist);\n-\t\toper-\u003ecycle_end_time = ktime_add_ns(oper-\u003ecycle_end_time,\n-\t\t\t\t\t\t oper-\u003ecycle_time);\n+\t\tend_time = ktime_add_ns(cur_start, next-\u003einterval);\n+\t\tend_time = min_t(ktime_t, end_time, oper-\u003ecycle_end_time);\n+\n+\t\tif (should_change_schedules(admin, oper, end_time)) {\n+\t\t\tswitch_schedules(q, \u0026admin, \u0026oper);\n+\t\t\tif (!oper-\u003ecycle_end_time)\n+\t\t\t\toper-\u003ecycle_end_time = ktime_add_ns(sched_base_time(oper),\n+\t\t\t\t\t\t\t\t oper-\u003ecycle_time);\n+\t\t\tcur_start = ktime_sub_ns(oper-\u003ecycle_end_time,\n+\t\t\t\t\t\t oper-\u003ecycle_time);\n+\t\t\tnext = list_first_entry(\u0026oper-\u003eentries,\n+\t\t\t\t\t\tstruct sched_entry, list);\n+\t\t\tend_time = ktime_add_ns(cur_start, next-\u003einterval);\n+\t\t\tend_time = min_t(ktime_t, end_time,\n+\t\t\t\t\t oper-\u003ecycle_end_time);\n+\t\t}\n+\n+\t\ttaprio_set_entry_state(q, oper, next, cur_start, end_time,\n+\t\t\t\t num_tc);\n \t} else {\n-\t\tnext = list_next_entry(entry, list);\n+\t\ttaprio_advance_one_entry(q, \u0026oper, \u0026admin, \u0026entry, \u0026next,\n+\t\t\t\t\t \u0026end_time, num_tc);\n \t}\n \n-\tend_time = ktime_add_ns(entry-\u003eend_time, next-\u003einterval);\n-\tend_time = min_t(ktime_t, end_time, oper-\u003ecycle_end_time);\n+\tnow = taprio_get_time(q);\n+\tif (unlikely(ktime_compare(end_time, now) \u003c= 0)) {\n+\t\tsize_t max_steps = min_t(size_t, oper-\u003enum_entries, 32);\n+\t\tsize_t i;\n+\n+\t\tfor (i = 0; i \u003c max_steps \u0026\u0026 ktime_compare(end_time, now) \u003c= 0; i++) {\n+\t\t\tentry = next;\n+\t\t\ttaprio_advance_one_entry(q, \u0026oper, \u0026admin, \u0026entry, \u0026next,\n+\t\t\t\t\t\t \u0026end_time, num_tc);\n+\t\t}\n \n-\tfor (tc = 0; tc \u003c num_tc; tc++) {\n-\t\tif (next-\u003egate_duration[tc] == oper-\u003ecycle_time)\n-\t\t\tnext-\u003egate_close_time[tc] = KTIME_MAX;\n-\t\telse\n-\t\t\tnext-\u003egate_close_time[tc] = ktime_add_ns(entry-\u003eend_time,\n-\t\t\t\t\t\t\t\t next-\u003egate_duration[tc]);\n+\t\tnow = taprio_get_time(q);\n+\t\tif (ktime_compare(end_time, now) \u003c= 0) {\n+\t\t\ttaprio_fast_forward_sched(q, \u0026oper, \u0026admin, \u0026next,\n+\t\t\t\t\t\t \u0026end_time, now, num_tc);\n+\t\t\tnow = taprio_get_time(q);\n+\t\t\tif (unlikely(ktime_compare(end_time, now) \u003c= 0)) {\n+\t\t\t\tentry = next;\n+\t\t\t\ttaprio_advance_one_entry(q, \u0026oper, \u0026admin,\n+\t\t\t\t\t\t\t \u0026entry, \u0026next,\n+\t\t\t\t\t\t\t \u0026end_time, num_tc);\n+\t\t\t}\n+\t\t}\n \t}\n \n-\tif (should_change_schedules(admin, oper, end_time)) {\n-\t\tswitch_schedules(q, \u0026admin, \u0026oper);\n-\t\t/* After changing schedules, the next entry is the first one\n-\t\t * in the new schedule, with a pre-calculated end_time.\n-\t\t */\n-\t\tnext = list_first_entry(\u0026oper-\u003eentries, struct sched_entry, list);\n-\t\tend_time = next-\u003eend_time;\n-\t}\n+\tnow = taprio_get_time(q);\n+\tif (unlikely(ktime_compare(end_time, now) \u003c= 0)) {\n+\t\tktime_t fallback_end = ktime_add_ns(now,\n+\t\t\t\t\t\t taprio_min_interval(q));\n+\n+\t\tif (should_change_schedules(admin, oper, fallback_end)) {\n+\t\t\tswitch_schedules(q, \u0026admin, \u0026oper);\n+\t\t\ttaprio_sync_sched_to_time(q, oper, now, \u0026next,\n+\t\t\t\t\t\t \u0026end_time, num_tc);\n+\t\t} else {\n+\t\t\ts64 diff;\n+\n+\t\t\tend_time = fallback_end;\n+\t\t\tif (!oper-\u003ecycle_end_time)\n+\t\t\t\toper-\u003ecycle_end_time =\n+\t\t\t\t\tktime_add_ns(sched_base_time(oper),\n+\t\t\t\t\t\t oper-\u003ecycle_time);\n+\t\t\tdiff = ktime_sub(end_time, oper-\u003ecycle_end_time);\n+\t\t\tif (diff \u003e 0) {\n+\t\t\t\tu64 cycles = div64_u64(diff +\n+\t\t\t\t\t\t oper-\u003ecycle_time - 1,\n+\t\t\t\t\t\t oper-\u003ecycle_time);\n+\n+\t\t\t\toper-\u003ecycle_end_time =\n+\t\t\t\t\tktime_add_ns(oper-\u003ecycle_end_time,\n+\t\t\t\t\t\t cycles * oper-\u003ecycle_time);\n+\t\t\t}\n+\t\t\ttaprio_set_entry_state(q, oper, next, now,\n+\t\t\t\t\t end_time, num_tc);\n+\t\t}\n \n-\tnext-\u003eend_time = end_time;\n-\ttaprio_set_budgets(q, oper, next);\n+\t\tnow = taprio_get_time(q);\n+\t\tif (unlikely(ktime_compare(end_time, now) \u003c= 0)) {\n+\t\t\ts64 diff;\n \n-first_run:\n-\trcu_assign_pointer(q-\u003ecurrent_entry, next);\n-\tspin_unlock(\u0026q-\u003ecurrent_entry_lock);\n+\t\t\tend_time = ktime_add_ns(now, taprio_min_interval(q));\n+\t\t\tdiff = ktime_sub(end_time, oper-\u003ecycle_end_time);\n+\t\t\tif (diff \u003e 0) {\n+\t\t\t\tu64 cycles = div64_u64(diff +\n+\t\t\t\t\t\t oper-\u003ecycle_time - 1,\n+\t\t\t\t\t\t oper-\u003ecycle_time);\n \n+\t\t\t\toper-\u003ecycle_end_time =\n+\t\t\t\t\tktime_add_ns(oper-\u003ecycle_end_time,\n+\t\t\t\t\t\t cycles * oper-\u003ecycle_time);\n+\t\t\t}\n+\t\t\tnext-\u003eend_time = end_time;\n+\t\t}\n+\t}\n+\n+\trcu_assign_pointer(q-\u003ecurrent_entry, next);\n \thrtimer_set_expires(\u0026q-\u003eadvance_timer, end_time);\n+\tspin_unlock(\u0026q-\u003ecurrent_entry_lock);\n \n \trcu_read_lock();\n \t__netif_schedule(sch);\n@@ -1130,7 +1385,11 @@ static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb,\n \t\t\t\t struct sched_gate_list *new,\n \t\t\t\t struct netlink_ext_ack *extack)\n {\n+\tint min_duration = taprio_min_interval(q);\n+\tstruct sched_entry *entry, *n;\n+\ts64 elapsed = 0;\n \tint err = 0;\n+\tint i = 0;\n \n \tif (tb[TCA_TAPRIO_ATTR_SCHED_SINGLE_ENTRY]) {\n \t\tNL_SET_ERR_MSG(extack, \"Adding a single entry is not supported\");\n@@ -1152,8 +1411,12 @@ static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb,\n \tif (err \u003c 0)\n \t\treturn err;\n \n+\tif (list_empty(\u0026new-\u003eentries)) {\n+\t\tNL_SET_ERR_MSG(extack, \"There should be at least one entry in the schedule\");\n+\t\treturn -EINVAL;\n+\t}\n+\n \tif (!new-\u003ecycle_time) {\n-\t\tstruct sched_entry *entry;\n \t\tktime_t cycle = 0;\n \n \t\tlist_for_each_entry(entry, \u0026new-\u003eentries, list)\n@@ -1167,12 +1430,45 @@ static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb,\n \t\tnew-\u003ecycle_time = cycle;\n \t}\n \n-\tif (new-\u003ecycle_time \u003c new-\u003enum_entries * length_to_duration(q, ETH_ZLEN)) {\n+\tif (new-\u003ecycle_time \u003c min_duration) {\n \t\tNL_SET_ERR_MSG(extack, \"'cycle_time' is too small\");\n \t\treturn -EINVAL;\n \t}\n \n-\ttaprio_calculate_gate_durations(q, new);\n+\tlist_for_each_entry_safe(entry, n, \u0026new-\u003eentries, list) {\n+\t\tif (elapsed \u003e= new-\u003ecycle_time) {\n+\t\t\tlist_del(\u0026entry-\u003elist);\n+\t\t\tkfree(entry);\n+\t\t\tnew-\u003enum_entries--;\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tif (elapsed + entry-\u003einterval \u003e new-\u003ecycle_time) {\n+\t\t\tentry-\u003einterval = new-\u003ecycle_time - elapsed;\n+\t\t\telapsed = new-\u003ecycle_time;\n+\t\t} else {\n+\t\t\telapsed += entry-\u003einterval;\n+\t\t}\n+\t}\n+\n+\tif (list_empty(\u0026new-\u003eentries)) {\n+\t\tNL_SET_ERR_MSG(extack, \"There should be at least one entry in the schedule\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (elapsed \u003c new-\u003ecycle_time) {\n+\t\tentry = list_last_entry(\u0026new-\u003eentries, struct sched_entry, list);\n+\t\tentry-\u003einterval += new-\u003ecycle_time - elapsed;\n+\t}\n+\n+\tlist_for_each_entry(entry, \u0026new-\u003eentries, list) {\n+\t\tif (entry-\u003einterval \u003c min_duration) {\n+\t\t\tNL_SET_ERR_MSG(extack, \"Invalid interval for schedule entry\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tentry-\u003eindex = i++;\n+\t}\n+\tnew-\u003enum_entries = i;\n \n \treturn 0;\n }\n@@ -1256,7 +1552,7 @@ static void setup_first_end_time(struct taprio_sched *q,\n \t/* FIXME: find a better place to do this */\n \tsched-\u003ecycle_end_time = ktime_add_ns(base, cycle);\n \n-\tfirst-\u003eend_time = ktime_add_ns(base, first-\u003einterval);\n+\tfirst-\u003eend_time = ktime_add_ns(base, min_t(s64, first-\u003einterval, cycle));\n \ttaprio_set_budgets(q, sched, first);\n \n \tfor (tc = 0; tc \u003c num_tc; tc++) {\n@@ -1349,11 +1645,13 @@ static int taprio_dev_notifier(struct notifier_block *nb, unsigned long event,\n \t\trcu_read_lock();\n \t\toper = rcu_dereference(q-\u003eoper_sched);\n \t\tif (oper)\n-\t\t\ttaprio_update_queue_max_sdu(q, oper, stab);\n+\t\t\ttaprio_update_queue_max_sdu(q, oper, stab, q-\u003emax_sdu,\n+\t\t\t\t\t\t netdev_get_num_tc(dev));\n \n \t\tadmin = rcu_dereference(q-\u003eadmin_sched);\n \t\tif (admin)\n-\t\t\ttaprio_update_queue_max_sdu(q, admin, stab);\n+\t\t\ttaprio_update_queue_max_sdu(q, admin, stab, q-\u003emax_sdu,\n+\t\t\t\t\t\t netdev_get_num_tc(dev));\n \t\trcu_read_unlock();\n \n \t\tbreak;\n@@ -1456,10 +1754,29 @@ static u32 tc_map_to_queue_mask(struct net_device *dev, u32 tc_mask)\n \treturn queue_mask;\n }\n \n+static u32 qopt_tc_map_to_queue_mask(const struct tc_mqprio_qopt *qopt,\n+\t\t\t\t u32 tc_mask)\n+{\n+\tu32 i, queue_mask = 0;\n+\n+\tfor (i = 0; i \u003c qopt-\u003enum_tc; i++) {\n+\t\tu16 offset = qopt-\u003eoffset[i];\n+\t\tu16 count = qopt-\u003ecount[i];\n+\n+\t\tif (!(tc_mask \u0026 BIT(i)))\n+\t\t\tcontinue;\n+\n+\t\tqueue_mask |= GENMASK(offset + count - 1, offset);\n+\t}\n+\n+\treturn queue_mask;\n+}\n+\n static void taprio_sched_to_offload(struct net_device *dev,\n \t\t\t\t struct sched_gate_list *sched,\n \t\t\t\t struct tc_taprio_qopt_offload *offload,\n-\t\t\t\t const struct tc_taprio_caps *caps)\n+\t\t\t\t const struct tc_taprio_caps *caps,\n+\t\t\t\t bool has_mqprio)\n {\n \tstruct sched_entry *entry;\n \tint i = 0;\n@@ -1474,8 +1791,10 @@ static void taprio_sched_to_offload(struct net_device *dev,\n \t\te-\u003ecommand = entry-\u003ecommand;\n \t\te-\u003einterval = entry-\u003einterval;\n \t\tif (caps-\u003egate_mask_per_txq)\n-\t\t\te-\u003egate_mask = tc_map_to_queue_mask(dev,\n-\t\t\t\t\t\t\t entry-\u003egate_mask);\n+\t\t\te-\u003egate_mask = has_mqprio ?\n+\t\t\t\tqopt_tc_map_to_queue_mask(\u0026offload-\u003emqprio.qopt,\n+\t\t\t\t\t\t\t entry-\u003egate_mask) :\n+\t\t\t\ttc_map_to_queue_mask(dev, entry-\u003egate_mask);\n \t\telse\n \t\t\te-\u003egate_mask = entry-\u003egate_mask;\n \n@@ -1516,6 +1835,9 @@ static void taprio_cleanup_broken_mqprio(struct taprio_sched *q)\n static int taprio_enable_offload(struct net_device *dev,\n \t\t\t\t struct taprio_sched *q,\n \t\t\t\t struct sched_gate_list *sched,\n+\t\t\t\t const struct tc_mqprio_qopt *mqprio,\n+\t\t\t\t const u32 max_sdu[TC_MAX_QUEUE],\n+\t\t\t\t u32 fp[TC_QOPT_MAX_QUEUE],\n \t\t\t\t struct netlink_ext_ack *extack)\n {\n \tconst struct net_device_ops *ops = dev-\u003enetdev_ops;\n@@ -1534,7 +1856,7 @@ static int taprio_enable_offload(struct net_device *dev,\n \n \tif (!caps.supports_queue_max_sdu) {\n \t\tfor (tc = 0; tc \u003c TC_MAX_QUEUE; tc++) {\n-\t\t\tif (q-\u003emax_sdu[tc]) {\n+\t\t\tif (max_sdu[tc]) {\n \t\t\t\tNL_SET_ERR_MSG_MOD(extack,\n \t\t\t\t\t\t \"Device does not handle queueMaxSDU\");\n \t\t\t\treturn -EOPNOTSUPP;\n@@ -1550,13 +1872,16 @@ static int taprio_enable_offload(struct net_device *dev,\n \t}\n \toffload-\u003ecmd = TAPRIO_CMD_REPLACE;\n \toffload-\u003eextack = extack;\n-\tmqprio_qopt_reconstruct(dev, \u0026offload-\u003emqprio.qopt);\n+\tif (mqprio)\n+\t\toffload-\u003emqprio.qopt = *mqprio;\n+\telse\n+\t\tmqprio_qopt_reconstruct(dev, \u0026offload-\u003emqprio.qopt);\n \toffload-\u003emqprio.extack = extack;\n-\ttaprio_sched_to_offload(dev, sched, offload, \u0026caps);\n-\tmqprio_fp_to_offload(q-\u003efp, \u0026offload-\u003emqprio);\n+\ttaprio_sched_to_offload(dev, sched, offload, \u0026caps, mqprio != NULL);\n+\tmqprio_fp_to_offload(fp, \u0026offload-\u003emqprio);\n \n \tfor (tc = 0; tc \u003c TC_MAX_QUEUE; tc++)\n-\t\toffload-\u003emax_sdu[tc] = q-\u003emax_sdu[tc];\n+\t\toffload-\u003emax_sdu[tc] = max_sdu[tc];\n \n \terr = ops-\u003endo_setup_tc(dev, TC_SETUP_QDISC_TAPRIO, offload);\n \tif (err \u003c 0) {\n@@ -1747,14 +2072,14 @@ static int taprio_parse_tc_entry(struct Qdisc *sch,\n \n static int taprio_parse_tc_entries(struct Qdisc *sch,\n \t\t\t\t struct nlattr *opt,\n+\t\t\t\t u32 max_sdu[TC_MAX_QUEUE],\n+\t\t\t\t u32 fp[TC_QOPT_MAX_QUEUE],\n \t\t\t\t struct netlink_ext_ack *extack)\n {\n \tstruct taprio_sched *q = qdisc_priv(sch);\n \tstruct net_device *dev = qdisc_dev(sch);\n-\tu32 max_sdu[TC_QOPT_MAX_QUEUE];\n \tbool have_preemption = false;\n \tunsigned long seen_tcs = 0;\n-\tu32 fp[TC_QOPT_MAX_QUEUE];\n \tstruct nlattr *n;\n \tint tc, rem;\n \tint err = 0;\n@@ -1772,8 +2097,6 @@ static int taprio_parse_tc_entries(struct Qdisc *sch,\n \t}\n \n \tfor (tc = 0; tc \u003c TC_QOPT_MAX_QUEUE; tc++) {\n-\t\tWRITE_ONCE(q-\u003emax_sdu[tc], max_sdu[tc]);\n-\t\tWRITE_ONCE(q-\u003efp[tc], fp[tc]);\n \t\tif (fp[tc] != TC_FP_EXPRESS)\n \t\t\thave_preemption = true;\n \t}\n@@ -1792,7 +2115,7 @@ static int taprio_parse_tc_entries(struct Qdisc *sch,\n \t\t}\n \t}\n \n-\treturn err;\n+\treturn 0;\n }\n \n static int taprio_mqprio_cmp(const struct net_device *dev,\n@@ -1823,15 +2146,28 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,\n \t\t\t struct netlink_ext_ack *extack)\n {\n \tstruct qdisc_size_table *stab = rtnl_dereference(sch-\u003estab);\n+\tstruct sched_gate_list *oper, *admin, *new_admin = NULL;\n \tstruct nlattr *tb[TCA_TAPRIO_ATTR_MAX + 1] = { };\n-\tstruct sched_gate_list *oper, *admin, *new_admin;\n \tstruct taprio_sched *q = qdisc_priv(sch);\n \tstruct net_device *dev = qdisc_dev(sch);\n \tstruct tc_mqprio_qopt *mqprio = NULL;\n+\tu32 max_sdu[TC_MAX_QUEUE] = { };\n+\tu32 fp[TC_QOPT_MAX_QUEUE] = { };\n+\tbool initial_setup, tc_configured = false;\n+\tenum tk_offsets old_tk_offset;\n+\tint old_clockid, num_tc, i, err;\n \tunsigned long flags;\n \tu32 taprio_flags;\n+\tu32 old_flags;\n \tktime_t start;\n-\tint i, err;\n+\n+\toper = rtnl_dereference(q-\u003eoper_sched);\n+\tadmin = rtnl_dereference(q-\u003eadmin_sched);\n+\tinitial_setup = (!oper \u0026\u0026 !admin);\n+\n+\told_flags = q-\u003eflags;\n+\told_clockid = q-\u003eclockid;\n+\told_tk_offset = q-\u003etk_offset;\n \n \terr = nla_parse_nested_deprecated(tb, TCA_TAPRIO_ATTR_MAX, opt,\n \t\t\t\t\t taprio_policy, extack);\n@@ -1866,54 +2202,44 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,\n \t\tWRITE_ONCE(q-\u003eflags, taprio_flags);\n \t}\n \n+\tif (tb[TCA_TAPRIO_ATTR_TXTIME_DELAY]) {\n+\t\tif (!TXTIME_ASSIST_IS_ENABLED(q-\u003eflags)) {\n+\t\t\tNL_SET_ERR_MSG_MOD(extack,\n+\t\t\t\t\t \"txtime-delay can only be set when txtime-assist mode is enabled\");\n+\t\t\terr = -EINVAL;\n+\t\t\tgoto free_sched;\n+\t\t}\n+\t}\n+\n \t/* Needed for length_to_duration() during netlink attribute parsing */\n \ttaprio_set_picos_per_byte(dev, q, extack);\n \n \terr = taprio_parse_mqprio_opt(dev, mqprio, extack, q-\u003eflags);\n \tif (err \u003c 0)\n-\t\treturn err;\n+\t\tgoto free_sched;\n \n-\terr = taprio_parse_tc_entries(sch, opt, extack);\n+\terr = taprio_parse_tc_entries(sch, opt, max_sdu, fp, extack);\n \tif (err)\n-\t\treturn err;\n+\t\tgoto free_sched;\n \n \tnew_admin = kzalloc_obj(*new_admin);\n \tif (!new_admin) {\n \t\tNL_SET_ERR_MSG(extack, \"Not enough memory for a new schedule\");\n-\t\treturn -ENOMEM;\n+\t\terr = -ENOMEM;\n+\t\tgoto free_sched;\n \t}\n \tINIT_LIST_HEAD(\u0026new_admin-\u003eentries);\n \n-\toper = rtnl_dereference(q-\u003eoper_sched);\n-\tadmin = rtnl_dereference(q-\u003eadmin_sched);\n-\n \t/* no changes - no new mqprio settings */\n \tif (!taprio_mqprio_cmp(dev, mqprio))\n \t\tmqprio = NULL;\n \n-\tif (mqprio \u0026\u0026 (oper || admin)) {\n+\tif (mqprio \u0026\u0026 !initial_setup) {\n \t\tNL_SET_ERR_MSG(extack, \"Changing the traffic mapping of a running schedule is not supported\");\n \t\terr = -ENOTSUPP;\n \t\tgoto free_sched;\n \t}\n \n-\tif (mqprio) {\n-\t\terr = netdev_set_num_tc(dev, mqprio-\u003enum_tc);\n-\t\tif (err)\n-\t\t\tgoto free_sched;\n-\t\tfor (i = 0; i \u003c mqprio-\u003enum_tc; i++) {\n-\t\t\tnetdev_set_tc_queue(dev, i,\n-\t\t\t\t\t mqprio-\u003ecount[i],\n-\t\t\t\t\t mqprio-\u003eoffset[i]);\n-\t\t\tq-\u003ecur_txq[i] = mqprio-\u003eoffset[i];\n-\t\t}\n-\n-\t\t/* Always use supplied priority mappings */\n-\t\tfor (i = 0; i \u003c= TC_BITMASK; i++)\n-\t\t\tnetdev_set_prio_tc_map(dev, i,\n-\t\t\t\t\t mqprio-\u003eprio_tc_map[i]);\n-\t}\n-\n \terr = parse_taprio_schedule(q, tb, new_admin, extack);\n \tif (err \u003c 0)\n \t\tgoto free_sched;\n@@ -1928,27 +2254,45 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,\n \tif (err \u003c 0)\n \t\tgoto free_sched;\n \n-\ttaprio_update_queue_max_sdu(q, new_admin, stab);\n+\tnum_tc = mqprio ? mqprio-\u003enum_tc : netdev_get_num_tc(dev);\n+\n+\ttaprio_calculate_gate_durations(q, new_admin, num_tc);\n+\n+\ttaprio_update_queue_max_sdu(q, new_admin, stab, max_sdu, num_tc);\n \n \tif (FULL_OFFLOAD_IS_ENABLED(q-\u003eflags))\n-\t\terr = taprio_enable_offload(dev, q, new_admin, extack);\n+\t\terr = taprio_enable_offload(dev, q, new_admin, mqprio, max_sdu,\n+\t\t\t\t\t fp, extack);\n \telse\n \t\terr = taprio_disable_offload(dev, q, extack);\n \tif (err)\n \t\tgoto free_sched;\n \n+\tif (mqprio) {\n+\t\terr = netdev_set_num_tc(dev, mqprio-\u003enum_tc);\n+\t\tif (err)\n+\t\t\tgoto free_sched;\n+\t\ttc_configured = true;\n+\t\tfor (i = 0; i \u003c mqprio-\u003enum_tc; i++) {\n+\t\t\tnetdev_set_tc_queue(dev, i,\n+\t\t\t\t\t mqprio-\u003ecount[i],\n+\t\t\t\t\t mqprio-\u003eoffset[i]);\n+\t\t\tq-\u003ecur_txq[i] = mqprio-\u003eoffset[i];\n+\t\t}\n+\n+\t\t/* Always use supplied priority mappings */\n+\t\tfor (i = 0; i \u003c= TC_BITMASK; i++)\n+\t\t\tnetdev_set_prio_tc_map(dev, i,\n+\t\t\t\t\t mqprio-\u003eprio_tc_map[i]);\n+\t}\n+\n \t/* Protects against enqueue()/dequeue() */\n \tspin_lock_bh(qdisc_lock(sch));\n \n-\tif (tb[TCA_TAPRIO_ATTR_TXTIME_DELAY]) {\n-\t\tif (!TXTIME_ASSIST_IS_ENABLED(q-\u003eflags)) {\n-\t\t\tNL_SET_ERR_MSG_MOD(extack, \"txtime-delay can only be set when txtime-assist mode is enabled\");\n-\t\t\terr = -EINVAL;\n-\t\t\tgoto unlock;\n-\t\t}\n-\n-\t\tWRITE_ONCE(q-\u003etxtime_delay,\n-\t\t\t nla_get_u32(tb[TCA_TAPRIO_ATTR_TXTIME_DELAY]));\n+\terr = taprio_get_start_time(sch, new_admin, \u0026start);\n+\tif (err \u003c 0) {\n+\t\tNL_SET_ERR_MSG(extack, \"Internal error: failed get start time\");\n+\t\tgoto unlock;\n \t}\n \n \tif (!TXTIME_ASSIST_IS_ENABLED(q-\u003eflags) \u0026\u0026\n@@ -1957,11 +2301,14 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,\n \t\thrtimer_setup(\u0026q-\u003eadvance_timer, advance_sched, q-\u003eclockid, HRTIMER_MODE_ABS);\n \t}\n \n-\terr = taprio_get_start_time(sch, new_admin, \u0026start);\n-\tif (err \u003c 0) {\n-\t\tNL_SET_ERR_MSG(extack, \"Internal error: failed get start time\");\n-\t\tgoto unlock;\n-\t}\n+\tif (tb[TCA_TAPRIO_ATTR_TXTIME_DELAY])\n+\t\tWRITE_ONCE(q-\u003etxtime_delay,\n+\t\t\t nla_get_u32(tb[TCA_TAPRIO_ATTR_TXTIME_DELAY]));\n+\n+\tfor (i = 0; i \u003c TC_MAX_QUEUE; i++)\n+\t\tWRITE_ONCE(q-\u003emax_sdu[i], max_sdu[i]);\n+\tfor (i = 0; i \u003c TC_QOPT_MAX_QUEUE; i++)\n+\t\tWRITE_ONCE(q-\u003efp[i], fp[i]);\n \n \tsetup_txtime(q, new_admin, start);\n \n@@ -2008,6 +2355,18 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,\n \tspin_unlock_bh(qdisc_lock(sch));\n \n free_sched:\n+\tif (err) {\n+\t\tif (initial_setup) {\n+\t\t\tif (q-\u003eoffloaded)\n+\t\t\t\ttaprio_disable_offload(dev, q, NULL);\n+\t\t\tif (tc_configured)\n+\t\t\t\tnetdev_reset_tc(dev);\n+\t\t}\n+\t\tWRITE_ONCE(q-\u003eflags, old_flags);\n+\t\tq-\u003eclockid = old_clockid;\n+\t\tWRITE_ONCE(q-\u003etk_offset, old_tk_offset);\n+\t}\n+\n \tif (new_admin)\n \t\tcall_rcu(\u0026new_admin-\u003ercu, taprio_free_sched_cb);\n \n@@ -2054,11 +2413,12 @@ static void taprio_destroy(struct Qdisc *sch)\n \t}\n \tq-\u003eqdiscs = NULL;\n \n-\tnetdev_reset_tc(dev);\n-\n \toper = rtnl_dereference(q-\u003eoper_sched);\n \tadmin = rtnl_dereference(q-\u003eadmin_sched);\n \n+\tif (oper || admin)\n+\t\tnetdev_reset_tc(dev);\n+\n \tif (oper)\n \t\tcall_rcu(\u0026oper-\u003ercu, taprio_free_sched_cb);\n \n"
} |
| 2/1 | 2026/11/06 22:55 | agent | patch-evaluator |
1mModel:core Args: null Results: {
"EnableConfigs": [
"NET_SCH_TAPRIO",
"NET_SCHED"
],
"FocusSymbols": [
"taprio_change",
"advance_sched",
"parse_taprio_schedule",
"taprio_advance_one_entry",
"taprio_fast_forward_sched",
"taprio_sync_sched_to_time",
"get_packet_txtime",
"is_valid_interval",
"taprio_enqueue"
],
"Reasoning": "The patch significantly modifies the TAPRIO (Time Aware Priority) packet scheduler (net/sched/sch_taprio.c). It restructures schedule parsing, validation, and error recovery in taprio_change(), updates time calculations and schedule-switching checks in txtime/enqueue paths, and overhauls the hrtimer advance_sched() routine with new scheduling algorithms (taprio_advance_one_entry, taprio_fast_forward_sched, taprio_sync_sched_to_time) to handle timer drift and prevent CPU starvation. The code is fully reachable in standard virtualized environments via rtnetlink qdisc configuration and packet transmission.",
"WorthFuzzing": true
}Instruction: You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.
IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.
================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.
- REACHABILITY IS THE PRIMARY GATE:
Fuzzing can only discover bugs in code that can actually execute in standard virtualized
environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
regardless of whether it adds assertions or complex logic.
- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
Patch authors routinely label changes as "cleanups", "refactorings", or state
"No functional change intended". Do NOT take these claims at face value.
Code refactorings that rearrange logic, introduce helper functions, or alter state management
in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
If reachable executable code is modified or refactored, it MUST be fuzzed.
- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
Even if the author believes the invariant always holds, fuzzing is essential to verify whether
an unusual sequence of operations can violate it.
================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:
- Non-kernel and non-executable changes:
* Modifications to Documentation/, comments, or spelling fixes.
* User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
that do not affect the compiled kernel image (vmlinux) or kernel modules.
* Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
that do not alter control flow or data structures.
* Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
* Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
* Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
physical PCI hot-unplug or manual sysfs driver unbinding.
* Code paths exclusive to architectures other than the target architecture.
================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
* Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
* Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
* Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
* Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).
================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:
- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
Do NOT list generic, ubiquitous functions called by almost every program in the corpus
(including, but not limited to: general memory allocators and deallocators, page fault
and trap handlers, or core synchronization primitives; this is not an exhaustive list).
Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
which severely dilutes fuzzing effort away from the actual changes.
- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
List functions that specifically implement the logic being added or altered, or direct API entrypoints
for the subsystem feature under review.
- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).
================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit 884ebe33e538fc6cfee1c0bc395c028146e11df8
Author: syz-cluster <triage@syzkaller.com>
Date: Fri Nov 6 22:55:46 2026 +0000
syz-cluster: applied patch under review
diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 39ac5b97aa3af8..b0806ea0460bce 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -48,6 +48,10 @@ static struct static_key_false taprio_have_working_mqprio;
* 60 * 17 > PSEC_PER_NSEC (1000)
*/
#define TAPRIO_PICOS_PER_BYTE_MIN 17
+/* Minimum interval for software mode (hrtimer-driven advance_sched) to
+ * avoid hrtimer interrupt storms and CPU starvation.
+ */
+#define TAPRIO_MIN_SW_INTERVAL_NS (10 * NSEC_PER_USEC)
struct sched_entry {
/* Durations between this GCL entry and the GCL entry where the
@@ -117,10 +121,9 @@ struct __tc_taprio_qopt_offload {
};
static void taprio_calculate_gate_durations(struct taprio_sched *q,
- struct sched_gate_list *sched)
+ struct sched_gate_list *sched,
+ int num_tc)
{
- struct net_device *dev = qdisc_dev(q->root);
- int num_tc = netdev_get_num_tc(dev);
struct sched_entry *entry, *cur;
int tc;
@@ -259,6 +262,17 @@ static int length_to_duration(struct taprio_sched *q, int len)
return div_u64(len * atomic64_read(&q->picos_per_byte), PSEC_PER_NSEC);
}
+static int taprio_min_interval(struct taprio_sched *q)
+{
+ int min_duration = length_to_duration(q, ETH_ZLEN);
+
+ if (!FULL_OFFLOAD_IS_ENABLED(q->flags) &&
+ !TXTIME_ASSIST_IS_ENABLED(q->flags))
+ min_duration = max_t(int, min_duration, TAPRIO_MIN_SW_INTERVAL_NS);
+
+ return min_duration;
+}
+
static int duration_to_length(struct taprio_sched *q, u64 duration)
{
return div_u64(duration * PSEC_PER_NSEC, atomic64_read(&q->picos_per_byte));
@@ -270,17 +284,18 @@ static int duration_to_length(struct taprio_sched *q, u64 duration)
*/
static void taprio_update_queue_max_sdu(struct taprio_sched *q,
struct sched_gate_list *sched,
- struct qdisc_size_table *stab)
+ struct qdisc_size_table *stab,
+ const u32 max_sdu_user[TC_MAX_QUEUE],
+ int num_tc)
{
struct net_device *dev = qdisc_dev(q->root);
- int num_tc = netdev_get_num_tc(dev);
u32 max_sdu_from_user;
u32 max_sdu_dynamic;
u32 max_sdu;
int tc;
for (tc = 0; tc < num_tc; tc++) {
- max_sdu_from_user = q->max_sdu[tc] ?: U32_MAX;
+ max_sdu_from_user = max_sdu_user[tc] ?: U32_MAX;
/* TC gate never closes => keep the queueMaxSDU
* selected by the user
@@ -357,7 +372,7 @@ static struct sched_entry *find_entry_to_transmit(struct sk_buff *skb,
curr_intv_end = get_interval_end_time(sched, admin, entry,
curr_intv_start);
- if (ktime_after(curr_intv_start, cycle_end))
+ if (ktime_compare(curr_intv_start, cycle_end) >= 0)
break;
if (!(entry->gate_mask & BIT(tc)) ||
@@ -366,10 +381,10 @@ static struct sched_entry *find_entry_to_transmit(struct sk_buff *skb,
txtime = entry->next_txtime;
- if (ktime_before(txtime, time) || validate_interval) {
+ if (!ktime_after(txtime, time) || validate_interval) {
transmit_end_time = ktime_add_ns(time, packet_transmit_time);
- if ((ktime_before(curr_intv_start, time) &&
- ktime_before(transmit_end_time, curr_intv_end)) ||
+ if ((!ktime_after(curr_intv_start, time) &&
+ !ktime_after(transmit_end_time, curr_intv_end)) ||
(ktime_after(curr_intv_start, time) && !validate_interval)) {
entry_found = entry;
*interval_start = curr_intv_start;
@@ -405,8 +420,19 @@ static bool is_valid_interval(struct sk_buff *skb, struct Qdisc *sch)
struct sched_entry *entry;
rcu_read_lock();
- sched = rcu_dereference(q->oper_sched);
admin = rcu_dereference(q->admin_sched);
+ sched = rcu_dereference(q->oper_sched);
+
+ if (admin && !ktime_before(skb->tstamp, admin->base_time)) {
+ sched = admin;
+ admin = NULL;
+ }
+
+ /* Until the schedule starts, all the queues are open */
+ if (!sched || ktime_before(skb->tstamp, sched->base_time)) {
+ rcu_read_unlock();
+ return true;
+ }
entry = find_entry_to_transmit(skb, sch, sched, admin, skb->tstamp,
&interval_start, &interval_end, true);
@@ -484,7 +510,7 @@ static long get_packet_txtime(struct sk_buff *skb, struct Qdisc *sch)
rcu_read_lock();
admin = rcu_dereference(q->admin_sched);
sched = rcu_dereference(q->oper_sched);
- if (admin && ktime_after(minimum_time, admin->base_time))
+ if (admin && !ktime_before(minimum_time, admin->base_time))
switch_schedules(q, &admin, &sched);
/* Until the schedule starts, all the queues are open */
@@ -513,8 +539,9 @@ static long get_packet_txtime(struct sk_buff *skb, struct Qdisc *sch)
txtime = max_t(ktime_t, txtime, interval_start);
if (admin && admin != sched &&
- ktime_after(txtime, admin->base_time)) {
+ !ktime_before(txtime, admin->base_time)) {
sched = admin;
+ admin = NULL;
sched_changed = true;
continue;
}
@@ -876,7 +903,7 @@ static bool should_restart_cycle(const struct sched_gate_list *oper,
if (list_is_last(&entry->list, &oper->entries))
return true;
- if (ktime_compare(entry->end_time, oper->cycle_end_time) == 0)
+ if (ktime_compare(entry->end_time, oper->cycle_end_time) >= 0)
return true;
return false;
@@ -888,7 +915,7 @@ static bool should_change_schedules(const struct sched_gate_list *admin,
{
ktime_t next_base_time, extension_time;
- if (!admin)
+ if (!admin || !oper)
return false;
next_base_time = sched_base_time(admin);
@@ -916,6 +943,162 @@ static bool should_change_schedules(const struct sched_gate_list *admin,
return false;
}
+static void taprio_set_entry_state(struct taprio_sched *q,
+ struct sched_gate_list *oper,
+ struct sched_entry *next,
+ ktime_t cur_start,
+ ktime_t end_time,
+ int num_tc)
+{
+ int tc;
+
+ for (tc = 0; tc < num_tc; tc++) {
+ if (next->gate_duration[tc] == oper->cycle_time)
+ next->gate_close_time[tc] = KTIME_MAX;
+ else
+ next->gate_close_time[tc] = ktime_add_ns(cur_start,
+ next->gate_duration[tc]);
+ }
+
+ next->end_time = end_time;
+ taprio_set_budgets(q, oper, next);
+}
+
+static void taprio_advance_one_entry(struct taprio_sched *q,
+ struct sched_gate_list **p_oper,
+ struct sched_gate_list **p_admin,
+ struct sched_entry **p_entry,
+ struct sched_entry **p_next,
+ ktime_t *p_end_time,
+ int num_tc)
+{
+ struct sched_gate_list *oper = *p_oper;
+ struct sched_gate_list *admin = *p_admin;
+ struct sched_entry *entry = *p_entry;
+ ktime_t cur_start, end_time;
+ struct sched_entry *next;
+
+ if (!oper->cycle_end_time)
+ oper->cycle_end_time = ktime_add_ns(sched_base_time(oper),
+ oper->cycle_time);
+
+ if (should_restart_cycle(oper, entry)) {
+ next = list_first_entry(&oper->entries, struct sched_entry,
+ list);
+ oper->cycle_end_time = ktime_add_ns(oper->cycle_end_time,
+ oper->cycle_time);
+ } else {
+ next = list_next_entry(entry, list);
+ }
+
+ cur_start = entry->end_time;
+ end_time = ktime_add_ns(cur_start, next->interval);
+ end_time = min_t(ktime_t, end_time, oper->cycle_end_time);
+
+ if (should_change_schedules(admin, oper, end_time)) {
+ switch_schedules(q, &admin, &oper);
+ if (!oper->cycle_end_time)
+ oper->cycle_end_time = ktime_add_ns(sched_base_time(oper),
+ oper->cycle_time);
+ cur_start = ktime_sub_ns(oper->cycle_end_time,
+ oper->cycle_time);
+ next = list_first_entry(&oper->entries, struct sched_entry, list);
+ end_time = ktime_add_ns(cur_start, next->interval);
+ end_time = min_t(ktime_t, end_time, oper->cycle_end_time);
+ *p_admin = admin;
+ *p_oper = oper;
+ }
+
+ taprio_set_entry_state(q, oper, next, cur_start, end_time, num_tc);
+
+ *p_entry = next;
+ *p_next = next;
+ *p_end_time = end_time;
+}
+
+static void taprio_sync_sched_to_time(struct taprio_sched *q,
+ struct sched_gate_list *sched,
+ ktime_t now,
+ struct sched_entry **p_next,
+ ktime_t *p_end_time,
+ int num_tc)
+{
+ ktime_t base = sched_base_time(sched);
+ struct sched_entry *entry, *next;
+ ktime_t cur_start, end_time;
+
+ if (ktime_compare(now, base) < 0) {
+ cur_start = base;
+ sched->cycle_end_time = ktime_add_ns(base, sched->cycle_time);
+ next = list_first_entry(&sched->entries, struct sched_entry,
+ list);
+ end_time = ktime_add_ns(cur_start, next->interval);
+ end_time = min_t(ktime_t, end_time, sched->cycle_end_time);
+ } else {
+ u64 cycles = div64_u64(ktime_sub_ns(now, base),
+ sched->cycle_time);
+
+ cur_start = ktime_add_ns(base, cycles * sched->cycle_time);
+ sched->cycle_end_time = ktime_add_ns(cur_start,
+ sched->cycle_time);
+ next = list_last_entry(&sched->entries, struct sched_entry,
+ list);
+ end_time = sched->cycle_end_time;
+
+ list_for_each_entry(entry, &sched->entries, list) {
+ ktime_t cur_end = ktime_add_ns(cur_start,
+ entry->interval);
+
+ if (list_is_last(&entry->list, &sched->entries))
+ cur_end = sched->cycle_end_time;
+ else
+ cur_end = min_t(ktime_t, cur_end,
+ sched->cycle_end_time);
+
+ if (ktime_compare(cur_end, now) > 0) {
+ next = entry;
+ end_time = cur_end;
+ break;
+ }
+ cur_start = cur_end;
+ }
+ }
+
+ taprio_set_entry_state(q, sched, next, cur_start, end_time, num_tc);
+ *p_next = next;
+ *p_end_time = end_time;
+}
+
+static void taprio_fast_forward_sched(struct taprio_sched *q,
+ struct sched_gate_list **p_oper,
+ struct sched_gate_list **p_admin,
+ struct sched_entry **p_next,
+ ktime_t *p_end_time,
+ ktime_t now,
+ int num_tc)
+{
+ struct sched_gate_list *oper = *p_oper;
+ struct sched_gate_list *admin = *p_admin;
+ struct sched_entry *next;
+ ktime_t end_time;
+
+ if (admin && ktime_compare(sched_base_time(admin), now) <= 0)
+ switch_schedules(q, &admin, &oper);
+
+ taprio_sync_sched_to_time(q, oper, now, &next, &end_time, num_tc);
+
+ if (should_change_schedules(admin, oper, end_time)) {
+ switch_schedules(q, &admin, &oper);
+ taprio_sync_sched_to_time(q, oper, now, &next, &end_time,
+ num_tc);
+ }
+
+ *p_oper = oper;
+ *p_admin = admin;
+ *p_next = next;
+ *p_end_time = end_time;
+}
+
static enum hrtimer_restart advance_sched(struct hrtimer *timer)
{
struct taprio_sched *q = container_of(timer, struct taprio_sched,
@@ -925,8 +1108,7 @@ static enum hrtimer_restart advance_sched(struct hrtimer *timer)
int num_tc = netdev_get_num_tc(dev);
struct sched_entry *entry, *next;
struct Qdisc *sch = q->root;
- ktime_t end_time;
- int tc;
+ ktime_t end_time, now;
spin_lock(&q->current_entry_lock);
entry = rcu_dereference_protected(q->current_entry,
@@ -939,6 +1121,11 @@ static enum hrtimer_restart advance_sched(struct hrtimer *timer)
if (!oper)
switch_schedules(q, &admin, &oper);
+ if (unlikely(!oper)) {
+ spin_unlock(&q->current_entry_lock);
+ return HRTIMER_NORESTART;
+ }
+
/* This can happen in two cases: 1. this is the very first run
* of this function (i.e. we weren't running any schedule
* previously); 2. The previous schedule just ended. The first
@@ -946,49 +1133,117 @@ static enum hrtimer_restart advance_sched(struct hrtimer *timer)
* schedule initialization.
*/
if (unlikely(!entry || entry->end_time == oper->base_time)) {
- next = list_first_entry(&oper->entries, struct sched_entry,
- list);
- end_time = next->end_time;
- goto first_run;
- }
+ ktime_t cur_start;
- if (should_restart_cycle(oper, entry)) {
+ if (!oper->cycle_end_time)
+ oper->cycle_end_time = ktime_add_ns(sched_base_time(oper),
+ oper->cycle_time);
+ cur_start = ktime_sub_ns(oper->cycle_end_time,
+ oper->cycle_time);
next = list_first_entry(&oper->entries, struct sched_entry,
list);
- oper->cycle_end_time = ktime_add_ns(oper->cycle_end_time,
- oper->cycle_time);
+ end_time = ktime_add_ns(cur_start, next->interval);
+ end_time = min_t(ktime_t, end_time, oper->cycle_end_time);
+
+ if (should_change_schedules(admin, oper, end_time)) {
+ switch_schedules(q, &admin, &oper);
+ if (!oper->cycle_end_time)
+ oper->cycle_end_time = ktime_add_ns(sched_base_time(oper),
+ oper->cycle_time);
+ cur_start = ktime_sub_ns(oper->cycle_end_time,
+ oper->cycle_time);
+ next = list_first_entry(&oper->entries,
+ struct sched_entry, list);
+ end_time = ktime_add_ns(cur_start, next->interval);
+ end_time = min_t(ktime_t, end_time,
+ oper->cycle_end_time);
+ }
+
+ taprio_set_entry_state(q, oper, next, cur_start, end_time,
+ num_tc);
} else {
- next = list_next_entry(entry, list);
+ taprio_advance_one_entry(q, &oper, &admin, &entry, &next,
+ &end_time, num_tc);
}
- end_time = ktime_add_ns(entry->end_time, next->interval);
- end_time = min_t(ktime_t, end_time, oper->cycle_end_time);
+ now = taprio_get_time(q);
+ if (unlikely(ktime_compare(end_time, now) <= 0)) {
+ size_t max_steps = min_t(size_t, oper->num_entries, 32);
+ size_t i;
+
+ for (i = 0; i < max_steps && ktime_compare(end_time, now) <= 0; i++) {
+ entry = next;
+ taprio_advance_one_entry(q, &oper, &admin, &entry, &next,
+ &end_time, num_tc);
+ }
- for (tc = 0; tc < num_tc; tc++) {
- if (next->gate_duration[tc] == oper->cycle_time)
- next->gate_close_time[tc] = KTIME_MAX;
- else
- next->gate_close_time[tc] = ktime_add_ns(entry->end_time,
- next->gate_duration[tc]);
+ now = taprio_get_time(q);
+ if (ktime_compare(end_time, now) <= 0) {
+ taprio_fast_forward_sched(q, &oper, &admin, &next,
+ &end_time, now, num_tc);
+ now = taprio_get_time(q);
+ if (unlikely(ktime_compare(end_time, now) <= 0)) {
+ entry = next;
+ taprio_advance_one_entry(q, &oper, &admin,
+ &entry, &next,
+ &end_time, num_tc);
+ }
+ }
}
- if (should_change_schedules(admin, oper, end_time)) {
- switch_schedules(q, &admin, &oper);
- /* After changing schedules, the next entry is the first one
- * in the new schedule, with a pre-calculated end_time.
- */
- next = list_first_entry(&oper->entries, struct sched_entry, list);
- end_time = next->end_time;
- }
+ now = taprio_get_time(q);
+ if (unlikely(ktime_compare(end_time, now) <= 0)) {
+ ktime_t fallback_end = ktime_add_ns(now,
+ taprio_min_interval(q));
+
+ if (should_change_schedules(admin, oper, fallback_end)) {
+ switch_schedules(q, &admin, &oper);
+ taprio_sync_sched_to_time(q, oper, now, &next,
+ &end_time, num_tc);
+ } else {
+ s64 diff;
+
+ end_time = fallback_end;
+ if (!oper->cycle_end_time)
+ oper->cycle_end_time =
+ ktime_add_ns(sched_base_time(oper),
+ oper->cycle_time);
+ diff = ktime_sub(end_time, oper->cycle_end_time);
+ if (diff > 0) {
+ u64 cycles = div64_u64(diff +
+ oper->cycle_time - 1,
+ oper->cycle_time);
+
+ oper->cycle_end_time =
+ ktime_add_ns(oper->cycle_end_time,
+ cycles * oper->cycle_time);
+ }
+ taprio_set_entry_state(q, oper, next, now,
+ end_time, num_tc);
+ }
- next->end_time = end_time;
- taprio_set_budgets(q, oper, next);
+ now = taprio_get_time(q);
+ if (unlikely(ktime_compare(end_time, now) <= 0)) {
+ s64 diff;
-first_run:
- rcu_assign_pointer(q->current_entry, next);
- spin_unlock(&q->current_entry_lock);
+ end_time = ktime_add_ns(now, taprio_min_interval(q));
+ diff = ktime_sub(end_time, oper->cycle_end_time);
+ if (diff > 0) {
+ u64 cycles = div64_u64(diff +
+ oper->cycle_time - 1,
+ oper->cycle_time);
+ oper->cycle_end_time =
+ ktime_add_ns(oper->cycle_end_time,
+ cycles * oper->cycle_time);
+ }
+ next->end_time = end_time;
+ }
+ }
+
+ rcu_assign_pointer(q->current_entry, next);
hrtimer_set_expires(&q->advance_timer, end_time);
+ spin_unlock(&q->current_entry_lock);
rcu_read_lock();
__netif_schedule(sch);
@@ -1130,7 +1385,11 @@ static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb,
struct sched_gate_list *new,
struct netlink_ext_ack *extack)
{
+ int min_duration = taprio_min_interval(q);
+ struct sched_entry *entry, *n;
+ s64 elapsed = 0;
int err = 0;
+ int i = 0;
if (tb[TCA_TAPRIO_ATTR_SCHED_SINGLE_ENTRY]) {
NL_SET_ERR_MSG(extack, "Adding a single entry is not supported");
@@ -1152,8 +1411,12 @@ static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb,
if (err < 0)
return err;
+ if (list_empty(&new->entries)) {
+ NL_SET_ERR_MSG(extack, "There should be at least one entry in the schedule");
+ return -EINVAL;
+ }
+
if (!new->cycle_time) {
- struct sched_entry *entry;
ktime_t cycle = 0;
list_for_each_entry(entry, &new->entries, list)
@@ -1167,12 +1430,45 @@ static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb,
new->cycle_time = cycle;
}
- if (new->cycle_time < new->num_entries * length_to_duration(q, ETH_ZLEN)) {
+ if (new->cycle_time < min_duration) {
NL_SET_ERR_MSG(extack, "'cycle_time' is too small");
return -EINVAL;
}
- taprio_calculate_gate_durations(q, new);
+ list_for_each_entry_safe(entry, n, &new->entries, list) {
+ if (elapsed >= new->cycle_time) {
+ list_del(&entry->list);
+ kfree(entry);
+ new->num_entries--;
+ continue;
+ }
+
+ if (elapsed + entry->interval > new->cycle_time) {
+ entry->interval = new->cycle_time - elapsed;
+ elapsed = new->cycle_time;
+ } else {
+ elapsed += entry->interval;
+ }
+ }
+
+ if (list_empty(&new->entries)) {
+ NL_SET_ERR_MSG(extack, "There should be at least one entry in the schedule");
+ return -EINVAL;
+ }
+
+ if (elapsed < new->cycle_time) {
+ entry = list_last_entry(&new->entries, struct sched_entry, list);
+ entry->interval += new->cycle_time - elapsed;
+ }
+
+ list_for_each_entry(entry, &new->entries, list) {
+ if (entry->interval < min_duration) {
+ NL_SET_ERR_MSG(extack, "Invalid interval for schedule entry");
+ return -EINVAL;
+ }
+ entry->index = i++;
+ }
+ new->num_entries = i;
return 0;
}
@@ -1256,7 +1552,7 @@ static void setup_first_end_time(struct taprio_sched *q,
/* FIXME: find a better place to do this */
sched->cycle_end_time = ktime_add_ns(base, cycle);
- first->end_time = ktime_add_ns(base, first->interval);
+ first->end_time = ktime_add_ns(base, min_t(s64, first->interval, cycle));
taprio_set_budgets(q, sched, first);
for (tc = 0; tc < num_tc; tc++) {
@@ -1349,11 +1645,13 @@ static int taprio_dev_notifier(struct notifier_block *nb, unsigned long event,
rcu_read_lock();
oper = rcu_dereference(q->oper_sched);
if (oper)
- taprio_update_queue_max_sdu(q, oper, stab);
+ taprio_update_queue_max_sdu(q, oper, stab, q->max_sdu,
+ netdev_get_num_tc(dev));
admin = rcu_dereference(q->admin_sched);
if (admin)
- taprio_update_queue_max_sdu(q, admin, stab);
+ taprio_update_queue_max_sdu(q, admin, stab, q->max_sdu,
+ netdev_get_num_tc(dev));
rcu_read_unlock();
break;
@@ -1456,10 +1754,29 @@ static u32 tc_map_to_queue_mask(struct net_device *dev, u32 tc_mask)
return queue_mask;
}
+static u32 qopt_tc_map_to_queue_mask(const struct tc_mqprio_qopt *qopt,
+ u32 tc_mask)
+{
+ u32 i, queue_mask = 0;
+
+ for (i = 0; i < qopt->num_tc; i++) {
+ u16 offset = qopt->offset[i];
+ u16 count = qopt->count[i];
+
+ if (!(tc_mask & BIT(i)))
+ continue;
+
+ queue_mask |= GENMASK(offset + count - 1, offset);
+ }
+
+ return queue_mask;
+}
+
static void taprio_sched_to_offload(struct net_device *dev,
struct sched_gate_list *sched,
struct tc_taprio_qopt_offload *offload,
- const struct tc_taprio_caps *caps)
+ const struct tc_taprio_caps *caps,
+ bool has_mqprio)
{
struct sched_entry *entry;
int i = 0;
@@ -1474,8 +1791,10 @@ static void taprio_sched_to_offload(struct net_device *dev,
e->command = entry->command;
e->interval = entry->interval;
if (caps->gate_mask_per_txq)
- e->gate_mask = tc_map_to_queue_mask(dev,
- entry->gate_mask);
+ e->gate_mask = has_mqprio ?
+ qopt_tc_map_to_queue_mask(&offload->mqprio.qopt,
+ entry->gate_mask) :
+ tc_map_to_queue_mask(dev, entry->gate_mask);
else
e->gate_mask = entry->gate_mask;
@@ -1516,6 +1835,9 @@ static void taprio_cleanup_broken_mqprio(struct taprio_sched *q)
static int taprio_enable_offload(struct net_device *dev,
struct taprio_sched *q,
struct sched_gate_list *sched,
+ const struct tc_mqprio_qopt *mqprio,
+ const u32 max_sdu[TC_MAX_QUEUE],
+ u32 fp[TC_QOPT_MAX_QUEUE],
struct netlink_ext_ack *extack)
{
const struct net_device_ops *ops = dev->netdev_ops;
@@ -1534,7 +1856,7 @@ static int taprio_enable_offload(struct net_device *dev,
if (!caps.supports_queue_max_sdu) {
for (tc = 0; tc < TC_MAX_QUEUE; tc++) {
- if (q->max_sdu[tc]) {
+ if (max_sdu[tc]) {
NL_SET_ERR_MSG_MOD(extack,
"Device does not handle queueMaxSDU");
return -EOPNOTSUPP;
@@ -1550,13 +1872,16 @@ static int taprio_enable_offload(struct net_device *dev,
}
offload->cmd = TAPRIO_CMD_REPLACE;
offload->extack = extack;
- mqprio_qopt_reconstruct(dev, &offload->mqprio.qopt);
+ if (mqprio)
+ offload->mqprio.qopt = *mqprio;
+ else
+ mqprio_qopt_reconstruct(dev, &offload->mqprio.qopt);
offload->mqprio.extack = extack;
- taprio_sched_to_offload(dev, sched, offload, &caps);
- mqprio_fp_to_offload(q->fp, &offload->mqprio);
+ taprio_sched_to_offload(dev, sched, offload, &caps, mqprio != NULL);
+ mqprio_fp_to_offload(fp, &offload->mqprio);
for (tc = 0; tc < TC_MAX_QUEUE; tc++)
- offload->max_sdu[tc] = q->max_sdu[tc];
+ offload->max_sdu[tc] = max_sdu[tc];
err = ops->ndo_setup_tc(dev, TC_SETUP_QDISC_TAPRIO, offload);
if (err < 0) {
@@ -1747,14 +2072,14 @@ static int taprio_parse_tc_entry(struct Qdisc *sch,
static int taprio_parse_tc_entries(struct Qdisc *sch,
struct nlattr *opt,
+ u32 max_sdu[TC_MAX_QUEUE],
+ u32 fp[TC_QOPT_MAX_QUEUE],
struct netlink_ext_ack *extack)
{
struct taprio_sched *q = qdisc_priv(sch);
struct net_device *dev = qdisc_dev(sch);
- u32 max_sdu[TC_QOPT_MAX_QUEUE];
bool have_preemption = false;
unsigned long seen_tcs = 0;
- u32 fp[TC_QOPT_MAX_QUEUE];
struct nlattr *n;
int tc, rem;
int err = 0;
@@ -1772,8 +2097,6 @@ static int taprio_parse_tc_entries(struct Qdisc *sch,
}
for (tc = 0; tc < TC_QOPT_MAX_QUEUE; tc++) {
- WRITE_ONCE(q->max_sdu[tc], max_sdu[tc]);
- WRITE_ONCE(q->fp[tc], fp[tc]);
if (fp[tc] != TC_FP_EXPRESS)
have_preemption = true;
}
@@ -1792,7 +2115,7 @@ static int taprio_parse_tc_entries(struct Qdisc *sch,
}
}
- return err;
+ return 0;
}
static int taprio_mqprio_cmp(const struct net_device *dev,
@@ -1823,15 +2146,28 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
struct netlink_ext_ack *extack)
{
struct qdisc_size_table *stab = rtnl_dereference(sch->stab);
+ struct sched_gate_list *oper, *admin, *new_admin = NULL;
struct nlattr *tb[TCA_TAPRIO_ATTR_MAX + 1] = { };
- struct sched_gate_list *oper, *admin, *new_admin;
struct taprio_sched *q = qdisc_priv(sch);
struct net_device *dev = qdisc_dev(sch);
struct tc_mqprio_qopt *mqprio = NULL;
+ u32 max_sdu[TC_MAX_QUEUE] = { };
+ u32 fp[TC_QOPT_MAX_QUEUE] = { };
+ bool initial_setup, tc_configured = false;
+ enum tk_offsets old_tk_offset;
+ int old_clockid, num_tc, i, err;
unsigned long flags;
u32 taprio_flags;
+ u32 old_flags;
ktime_t start;
- int i, err;
+
+ oper = rtnl_dereference(q->oper_sched);
+ admin = rtnl_dereference(q->admin_sched);
+ initial_setup = (!oper && !admin);
+
+ old_flags = q->flags;
+ old_clockid = q->clockid;
+ old_tk_offset = q->tk_offset;
err = nla_parse_nested_deprecated(tb, TCA_TAPRIO_ATTR_MAX, opt,
taprio_policy, extack);
@@ -1866,54 +2202,44 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
WRITE_ONCE(q->flags, taprio_flags);
}
+ if (tb[TCA_TAPRIO_ATTR_TXTIME_DELAY]) {
+ if (!TXTIME_ASSIST_IS_ENABLED(q->flags)) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "txtime-delay can only be set when txtime-assist mode is enabled");
+ err = -EINVAL;
+ goto free_sched;
+ }
+ }
+
/* Needed for length_to_duration() during netlink attribute parsing */
taprio_set_picos_per_byte(dev, q, extack);
err = taprio_parse_mqprio_opt(dev, mqprio, extack, q->flags);
if (err < 0)
- return err;
+ goto free_sched;
- err = taprio_parse_tc_entries(sch, opt, extack);
+ err = taprio_parse_tc_entries(sch, opt, max_sdu, fp, extack);
if (err)
- return err;
+ goto free_sched;
new_admin = kzalloc_obj(*new_admin);
if (!new_admin) {
NL_SET_ERR_MSG(extack, "Not enough memory for a new schedule");
- return -ENOMEM;
+ err = -ENOMEM;
+ goto free_sched;
}
INIT_LIST_HEAD(&new_admin->entries);
- oper = rtnl_dereference(q->oper_sched);
- admin = rtnl_dereference(q->admin_sched);
-
/* no changes - no new mqprio settings */
if (!taprio_mqprio_cmp(dev, mqprio))
mqprio = NULL;
- if (mqprio && (oper || admin)) {
+ if (mqprio && !initial_setup) {
NL_SET_ERR_MSG(extack, "Changing the traffic mapping of a running schedule is not supported");
err = -ENOTSUPP;
goto free_sched;
}
- if (mqprio) {
- err = netdev_set_num_tc(dev, mqprio->num_tc);
- if (err)
- goto free_sched;
- for (i = 0; i < mqprio->num_tc; i++) {
- netdev_set_tc_queue(dev, i,
- mqprio->count[i],
- mqprio->offset[i]);
- q->cur_txq[i] = mqprio->offset[i];
- }
-
- /* Always use supplied priority mappings */
- for (i = 0; i <= TC_BITMASK; i++)
- netdev_set_prio_tc_map(dev, i,
- mqprio->prio_tc_map[i]);
- }
-
err = parse_taprio_schedule(q, tb, new_admin, extack);
if (err < 0)
goto free_sched;
@@ -1928,27 +2254,45 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
if (err < 0)
goto free_sched;
- taprio_update_queue_max_sdu(q, new_admin, stab);
+ num_tc = mqprio ? mqprio->num_tc : netdev_get_num_tc(dev);
+
+ taprio_calculate_gate_durations(q, new_admin, num_tc);
+
+ taprio_update_queue_max_sdu(q, new_admin, stab, max_sdu, num_tc);
if (FULL_OFFLOAD_IS_ENABLED(q->flags))
- err = taprio_enable_offload(dev, q, new_admin, extack);
+ err = taprio_enable_offload(dev, q, new_admin, mqprio, max_sdu,
+ fp, extack);
else
err = taprio_disable_offload(dev, q, extack);
if (err)
goto free_sched;
+ if (mqprio) {
+ err = netdev_set_num_tc(dev, mqprio->num_tc);
+ if (err)
+ goto free_sched;
+ tc_configured = true;
+ for (i = 0; i < mqprio->num_tc; i++) {
+ netdev_set_tc_queue(dev, i,
+ mqprio->count[i],
+ mqprio->offset[i]);
+ q->cur_txq[i] = mqprio->offset[i];
+ }
+
+ /* Always use supplied priority mappings */
+ for (i = 0; i <= TC_BITMASK; i++)
+ netdev_set_prio_tc_map(dev, i,
+ mqprio->prio_tc_map[i]);
+ }
+
/* Protects against enqueue()/dequeue() */
spin_lock_bh(qdisc_lock(sch));
- if (tb[TCA_TAPRIO_ATTR_TXTIME_DELAY]) {
- if (!TXTIME_ASSIST_IS_ENABLED(q->flags)) {
- NL_SET_ERR_MSG_MOD(extack, "txtime-delay can only be set when txtime-assist mode is enabled");
- err = -EINVAL;
- goto unlock;
- }
-
- WRITE_ONCE(q->txtime_delay,
- nla_get_u32(tb[TCA_TAPRIO_ATTR_TXTIME_DELAY]));
+ err = taprio_get_start_time(sch, new_admin, &start);
+ if (err < 0) {
+ NL_SET_ERR_MSG(extack, "Internal error: failed get start time");
+ goto unlock;
}
if (!TXTIME_ASSIST_IS_ENABLED(q->flags) &&
@@ -1957,11 +2301,14 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
hrtimer_setup(&q->advance_timer, advance_sched, q->clockid, HRTIMER_MODE_ABS);
}
- err = taprio_get_start_time(sch, new_admin, &start);
- if (err < 0) {
- NL_SET_ERR_MSG(extack, "Internal error: failed get start time");
- goto unlock;
- }
+ if (tb[TCA_TAPRIO_ATTR_TXTIME_DELAY])
+ WRITE_ONCE(q->txtime_delay,
+ nla_get_u32(tb[TCA_TAPRIO_ATTR_TXTIME_DELAY]));
+
+ for (i = 0; i < TC_MAX_QUEUE; i++)
+ WRITE_ONCE(q->max_sdu[i], max_sdu[i]);
+ for (i = 0; i < TC_QOPT_MAX_QUEUE; i++)
+ WRITE_ONCE(q->fp[i], fp[i]);
setup_txtime(q, new_admin, start);
@@ -2008,6 +2355,18 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
spin_unlock_bh(qdisc_lock(sch));
free_sched:
+ if (err) {
+ if (initial_setup) {
+ if (q->offloaded)
+ taprio_disable_offload(dev, q, NULL);
+ if (tc_configured)
+ netdev_reset_tc(dev);
+ }
+ WRITE_ONCE(q->flags, old_flags);
+ q->clockid = old_clockid;
+ WRITE_ONCE(q->tk_offset, old_tk_offset);
+ }
+
if (new_admin)
call_rcu(&new_admin->rcu, taprio_free_sched_cb);
@@ -2054,11 +2413,12 @@ static void taprio_destroy(struct Qdisc *sch)
}
q->qdiscs = NULL;
- netdev_reset_tc(dev);
-
oper = rtnl_dereference(q->oper_sched);
admin = rtnl_dereference(q->admin_sched);
+ if (oper || admin)
+ netdev_reset_tc(dev);
+
if (oper)
call_rcu(&oper->rcu, taprio_free_sched_cb);
|
| 3/2 | 2026/11/06 22:55 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 15011 output: 28 thoughts: 656 Thoughts: **Analyzing the Potential for Syzkaller Fuzzing: TAPRIO Scheduler Patch** Okay, so I've got this patch for `net/sched/sch_taprio.c`, and the question is whether it's worth throwing it at syzkaller. My initial instinct is leaning towards "yes," but let's break it down. First, I need to understand what's *actually* changing in the code. I see a lot of modifications, which is good: * There's a new `TAPRIO_MIN_SW_INTERVAL_NS` constant being defined, which hints at some low-level timing tweaks. * We're seeing updated function parameters in places like `taprio_calculate_gate_durations`, `taprio_update_queue_max_sdu`, and a new `num_tc` argument popping up. That likely means the internal data structures and logic are evolving. * Crucially, there are a bunch of fixes related to time comparisons and interval handling (`find_entry_to_transmit`, `is_valid_interval`, `get_packet_txtime`, `should_restart_cycle`, `should_change_schedules`). This is where timing bugs and race conditions often hide, so it's a prime target. * We're seeing entirely new functions being added: `taprio_set_entry_state`, `taprio_advance_one_entry`, `taprio_sync_sched_to_time`, `taprio_fast_forward_sched`. These additions scream "complex new logic," which is a siren call for fuzzers. * The `advance_sched` hrtimer handler got a serious rewrite. Starvation and storm issues are mentioned, which immediately flags this as an area of high risk. This now includes things like entry advancing, looping with `taprio_advance_one_entry`, fallback logic with `taprio_fast_forward_sched`, and handling time drift/catch-up. That's a lot of new surface area to explore. * `parse_taprio_schedule` is now validating entries, trimming, and doing some interesting checks. That kind of input validation is often where you can trigger some nasty edge cases. * Finally, `taprio_change` has transaction rollback/error handling, and `taprio_destroy` does a conditional `netdev_reset_tc(dev)`. That's a strong indicator there might be concurrency issues that are tricky to resolve. The core question is if this is reachable code: can syzkaller actually *get* to this stuff? Thankfully, `sch_taprio` is a standard tc qdisc. That's fantastic! Syzkaller is *already* hitting these things hard via netlink (`RTM_NEWQDISC`, etc.), and we've got the usual QEMU setups with network devices (dummy, veth, etc.) where this qdisc can be attached. That's a massive green flag. I'll need to double-check that `sch_taprio` isn't guarded by any obscure CONFIG options, so I'll quickly look in `net/sched/Kconfig` and `Makefile`, but my expectation is that it's broadly available. I'd be very surprised if it wasn't. Given the substantial changes, the potential for timing-related bugs, the increased complexity, and the established syzkaller attack surface, I'm confident that this is a very strong candidate for fuzzing. |
| 4/2 | 2026/11/06 22:55 | tool | grepper |
0mArgs:{
"Expression": "sch_taprio",
"PathPrefixes": [
"net/sched"
]
}Results: {
"Output": "net/sched/Kconfig=172=config NET_SCH_TAPRIO\n--\nnet/sched/Kconfig-178-\nnet/sched/Kconfig:179:\t See the top of \u003cfile:net/sched/sch_taprio.c\u003e for more details.\nnet/sched/Kconfig-180-\nnet/sched/Kconfig-181-\t To compile this code as a module, choose M here: the\nnet/sched/Kconfig:182:\t module will be called sch_taprio.\nnet/sched/Kconfig-183-\n--\nnet/sched/Makefile=63=obj-$(CONFIG_NET_SCH_ETF)\t+= sch_etf.o\nnet/sched/Makefile:64:obj-$(CONFIG_NET_SCH_TAPRIO)\t+= sch_taprio.o\nnet/sched/Makefile-65-obj-$(CONFIG_NET_SCH_BPF)\t+= bpf_qdisc.o\n--\nnet/sched/sch_taprio.c-2-\nnet/sched/sch_taprio.c:3:/* net/sched/sch_taprio.c\t Time Aware Priority Scheduler\nnet/sched/sch_taprio.c-4- *\n"
} |
| 5/2 | 2026/11/06 22:55 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 16752 output: 34 thoughts: 27 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience: **Investigating a Network Scheduler Configuration Option** Right, let's dive straight in. My instinct is telling me to zero in on the `net/sched/Kconfig` file, specifically around line 172. I need to get the definitive truth, the granular detail. I'm after the precise name of the config option we're dealing with, and critically, what its dependencies are. No assumptions, I need to see the dependencies, how it's interlinked with other kernel modules. This is the starting point for understanding how a specific networking scheduler is enabled and behaves. I’ll look for any relationships that might be blocking this feature. |
| 6/2 | 2026/11/06 22:56 | tool | read-file |
0mArgs:{
"File": "net/sched/Kconfig",
"FirstLine": 168,
"LineCount": 20
}Results: {
"Contents": " 168:\t\ttristate\n 169:\t\thelp\n 170:\t\t Common library for manipulating mqprio queue configurations.\n 171:\t\n 172:\tconfig NET_SCH_TAPRIO\n 173:\t\ttristate \"Time Aware Priority (taprio) Scheduler\"\n 174:\t\tselect NET_SCH_MQPRIO_LIB\n 175:\t\thelp\n 176:\t\t Say Y here if you want to use the Time Aware Priority (taprio) packet\n 177:\t\t scheduling algorithm.\n 178:\t\n 179:\t\t See the top of \u003cfile:net/sched/sch_taprio.c\u003e for more details.\n 180:\t\n 181:\t\t To compile this code as a module, choose M here: the\n 182:\t\t module will be called sch_taprio.\n 183:\t\n 184:\tconfig NET_SCH_GRED\n 185:\t\ttristate \"Generic Random Early Detection (GRED)\"\n 186:\t\thelp\n 187:\t\t Say Y here if you want to use the Generic Random Early Detection\n"
} |
| 7/2 | 2026/11/06 22:56 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 17270 output: 32 thoughts: 66 Thoughts: **Analyzing the `CONFIG_NET_SCH_TAPRIO` Configuration Option** Okay, so I need to understand the configuration dependencies for `CONFIG_NET_SCH_TAPRIO`. My instinct is to trace its ancestry. Where does it live? Ah, right, that would be in `net/sched/Kconfig`. Let's confirm it's nested under `menuconfig NET_SCHED`. Always good to double-check that higher-level structure. Gotta make sure I fully grasp the encompassing context before digging into the specifics of this taprio option. Okay, I'll go take a look at the top of that Kconfig file. Let's see what we're dealing with. |
| 8/2 | 2026/11/06 22:56 | tool | read-file |
0mArgs:{
"File": "net/sched/Kconfig",
"FirstLine": 1,
"LineCount": 40
}Results: {
"Contents": " 1:\t# SPDX-License-Identifier: GPL-2.0-only\n 2:\t#\n 3:\t# Traffic control configuration.\n 4:\t#\n 5:\t\n 6:\tmenuconfig NET_SCHED\n 7:\t\tbool \"QoS and/or fair queueing\"\n 8:\t\tselect NET_SCH_FIFO\n 9:\t\thelp\n 10:\t\t When the kernel has several packets to send out over a network\n 11:\t\t device, it has to decide which ones to send first, which ones to\n 12:\t\t delay, and which ones to drop. This is the job of the queueing\n 13:\t\t disciplines, several different algorithms for how to do this\n 14:\t\t \"fairly\" have been proposed.\n 15:\t\n 16:\t\t If you say N here, you will get the standard packet scheduler, which\n 17:\t\t is a FIFO (first come, first served). If you say Y here, you will be\n 18:\t\t able to choose from among several alternative algorithms which can\n 19:\t\t then be attached to different network devices. This is useful for\n 20:\t\t example if some of your network devices are real time devices that\n 21:\t\t need a certain minimum data flow rate, or if you need to limit the\n 22:\t\t maximum data flow rate for traffic which matches specified criteria.\n 23:\t\t This code is considered to be experimental.\n 24:\t\n 25:\t\t To administer these schedulers, you'll need the user-level utilities\n 26:\t\t from the package iproute2+tc at\n 27:\t\t \u003chttps://www.kernel.org/pub/linux/utils/net/iproute2/\u003e. That package\n 28:\t\t also contains some documentation; for more, check out\n 29:\t\t \u003chttp://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2\u003e.\n 30:\t\n 31:\t\t This Quality of Service (QoS) support will enable you to use\n 32:\t\t Differentiated Services (diffserv) and Resource Reservation Protocol\n 33:\t\t (RSVP) on your Linux router if you also say Y to the corresponding\n 34:\t\t classifiers below. Documentation and software is at\n 35:\t\t \u003chttp://diffserv.sourceforge.net/\u003e.\n 36:\t\n 37:\t\t If you say Y here and to \"/proc file system\" below, you will be able\n 38:\t\t to read status information about packet schedulers from the file\n 39:\t\t /proc/net/psched.\n 40:\t\n"
} |
| 9/2 | 2026/11/06 22:56 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 18172 output: 38 thoughts: 694 Thoughts: **Taprio Qdisc Fuzzing Analysis** Okay, so I'm looking at `NET_SCHED` and specifically `NET_SCH_TAPRIO`. My initial thought is, "Is this ripe for fuzzing?" The answer is a resounding *yes*. This is core traffic control code, and it touches a significant number of crucial functions within `net/sched/sch_taprio.c`: `parse_taprio_schedule`, `advance_sched`, `taprio_change`, `taprio_fast_forward_sched`, `taprio_sync_sched_to_time`, `taprio_advance_one_entry`, `taprio_set_entry_state`, `find_entry_to_transmit`, `is_valid_interval`, `get_packet_txtime`, `taprio_enable_offload`, and `taprio_destroy`. This is all accessed through the `AF_NETLINK` socket and `rtnetlink` interface (`RTM_NEWQDISC`, etc.), so setting up and configuring the `taprio` qdisc on network interfaces is how we'll trigger it. The complexity is immediately apparent: timers, list manipulations (like `list_del` and `kfree`), interval updates, schedule advance logic, fast-forward calculations, cycle wrapping, 64-bit division, synchronization with locks and RCU, and offload configuration. It's a perfect storm for concurrency bugs, potential division-by-zero errors, infinite loops, memory corruption, and assertion failures. Now, let's identify the right entrypoints for `FocusSymbols`. I need to find the functions that are good, non-ubiquitous entrypoints or that modify internal state. I'll check if they are static or not and if they are visible in the symbol table (i.e. not inlined). Here are the key functions I've identified that we want to keep in mind: * `advance_sched`: This is a static `hrtimer` callback, passed to `hrtimer_setup`. It's definitely in the vmlinux symbol table since its address is taken. * `taprio_change`: A `qdisc_ops` callback, and its address is taken in `struct Qdisc_ops taprio_qdisc_ops`. * `taprio_destroy`: Another `qdisc_ops` callback, also in the `qdisc_ops`. * `parse_taprio_schedule`: This is called by `taprio_change`. * `taprio_fast_forward_sched`: This is called by `advance_sched`. * `taprio_sync_sched_to_time`: This is called by both `taprio_fast_forward_sched` and `advance_sched`. * `taprio_advance_one_entry`: Called by `advance_sched`. * `taprio_set_entry_state`: Called by `taprio_advance_one_entry`, `taprio_sync_sched_to_time`, and `advance_sched`. * `taprio_enqueue`: Qdisc enqueue function, which calls `find_entry_to_transmit` or uses `get_packet_txtime`. * `taprio_dequeue`: Qdisc dequeue function. * `taprio_init`: Qdisc init function. I need to confirm the definition of `taprio_qdisc_ops` within `sch_taprio.c` now to solidify my understanding of the interface. This will give me all the information I need to construct my fuzzing strategy. |
| 10/2 | 2026/11/06 22:56 | tool | grepper |
0mArgs:{
"Expression": "taprio_qdisc_ops",
"PathPrefixes": [
"net/sched/sch_taprio.c"
]
}Results: {
"Output": "net/sched/sch_taprio.c=2896=static const struct Qdisc_class_ops taprio_class_ops = {\n--\nnet/sched/sch_taprio.c-2905-\nnet/sched/sch_taprio.c:2906:static struct Qdisc_ops taprio_qdisc_ops __read_mostly = {\nnet/sched/sch_taprio.c-2907-\t.cl_ops\t\t= \u0026taprio_class_ops,\n--\nnet/sched/sch_taprio.c=2928=static int __init taprio_module_init(void)\n--\nnet/sched/sch_taprio.c-2934-\nnet/sched/sch_taprio.c:2935:\treturn register_qdisc(\u0026taprio_qdisc_ops);\nnet/sched/sch_taprio.c-2936-}\n--\nnet/sched/sch_taprio.c=2938=static void __exit taprio_module_exit(void)\nnet/sched/sch_taprio.c-2939-{\nnet/sched/sch_taprio.c:2940:\tunregister_qdisc(\u0026taprio_qdisc_ops);\nnet/sched/sch_taprio.c-2941-\tunregister_netdevice_notifier(\u0026taprio_device_notifier);\n"
} |
| 11/2 | 2026/11/06 22:56 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 20025 output: 39 thoughts: 22 Thoughts: Okay, let's dive into this. Here's my summary, taking an expert's perspective: **Diving into the `taprio_qdisc_ops` Definition** Alright, I need to get a handle on this `taprio_qdisc_ops` structure. My immediate instinct is to jump to the code itself, specifically around line 2906, if I recall correctly from my previous review. I need to refresh my memory of its layout and function pointers. Understanding that structure is fundamental to grasping how the TAPRIO scheduler operates internally. I need to see the entry points for enqueueing, dequeuing, and configuring packets. I'm looking for clues about the scheduling algorithms and any specific optimizations implemented within the TAPRIO qdisc. Knowing this will give me a better understanding of how it fits into the broader network stack and its performance characteristics in real-world scenarios. It could also reveal potential areas for tuning or, frankly, even bugs I need to watch out for. Time to dig in and see what's there. |
| 12/2 | 2026/11/06 22:56 | tool | read-file |
0mArgs:{
"File": "net/sched/sch_taprio.c",
"FirstLine": 2905,
"LineCount": 25
}Results: {
"Contents": "2905:\t\n2906:\tstatic struct Qdisc_ops taprio_qdisc_ops __read_mostly = {\n2907:\t\t.cl_ops\t\t= \u0026taprio_class_ops,\n2908:\t\t.id\t\t= \"taprio\",\n2909:\t\t.priv_size\t= sizeof(struct taprio_sched),\n2910:\t\t.init\t\t= taprio_init,\n2911:\t\t.change\t\t= taprio_change,\n2912:\t\t.destroy\t= taprio_destroy,\n2913:\t\t.reset\t\t= taprio_reset,\n2914:\t\t.attach\t\t= taprio_attach,\n2915:\t\t.peek\t\t= taprio_peek,\n2916:\t\t.dequeue\t= taprio_dequeue,\n2917:\t\t.enqueue\t= taprio_enqueue,\n2918:\t\t.dump\t\t= taprio_dump,\n2919:\t\t.dump_stats\t= taprio_dump_stats,\n2920:\t\t.owner\t\t= THIS_MODULE,\n2921:\t};\n2922:\tMODULE_ALIAS_NET_SCH(\"taprio\");\n2923:\t\n2924:\tstatic struct notifier_block taprio_device_notifier = {\n2925:\t\t.notifier_call = taprio_dev_notifier,\n2926:\t};\n2927:\t\n2928:\tstatic int __init taprio_module_init(void)\n2929:\t{\n"
} |
| 13/2 | 2026/11/06 22:56 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 20701 output: 45 thoughts: 34 Thoughts: Okay, here's my thought process on that: **Investigating Call Sites in `sch_taprio.c`** Alright, I need to understand the usage of `find_entry_to_transmit` and `get_packet_txtime` within `sch_taprio.c`. My immediate goal is to trace their call paths. It's crucial for understanding how the scheduler interacts with the packet transmission process. I'll be diving into the code to locate every instance where these functions are invoked. I'm looking for the contexts, parameters, and return value handling to get a complete picture of their roles. I expect to be able to then infer the overall control flow related to packet scheduling and transmission. Understanding how this scheduler makes these decisions is critical for a number of high-level tasks. I'm thinking, in the bigger picture, of possible optimizations or potential bottlenecks. This analysis should give me the foundation I need. |
| 14/2 | 2026/11/06 22:56 | tool | grepper |
0mArgs:{
"Expression": "find_entry_to_transmit|get_packet_txtime",
"PathPrefixes": [
"net/sched/sch_taprio.c"
]
}Results: {
"Output": "net/sched/sch_taprio.c=285=static void taprio_update_queue_max_sdu(struct taprio_sched *q,\n--\nnet/sched/sch_taprio.c-337- */\nnet/sched/sch_taprio.c:338:static struct sched_entry *find_entry_to_transmit(struct sk_buff *skb,\nnet/sched/sch_taprio.c-339-\t\t\t\t\t\t struct Qdisc *sch,\n--\nnet/sched/sch_taprio.c=415=static bool is_valid_interval(struct sk_buff *skb, struct Qdisc *sch)\n--\nnet/sched/sch_taprio.c-436-\nnet/sched/sch_taprio.c:437:\tentry = find_entry_to_transmit(skb, sch, sched, admin, skb-\u003etstamp,\nnet/sched/sch_taprio.c-438-\t\t\t\t \u0026interval_start, \u0026interval_end, true);\n--\nnet/sched/sch_taprio.c=445=static ktime_t get_tcp_tstamp(struct taprio_sched *q, struct sk_buff *skb)\n--\nnet/sched/sch_taprio.c-493- */\nnet/sched/sch_taprio.c:494:static long get_packet_txtime(struct sk_buff *skb, struct Qdisc *sch)\nnet/sched/sch_taprio.c-495-{\n--\nnet/sched/sch_taprio.c-527-\nnet/sched/sch_taprio.c:528:\t\tentry = find_entry_to_transmit(skb, sch, sched, admin,\nnet/sched/sch_taprio.c-529-\t\t\t\t\t minimum_time,\n--\nnet/sched/sch_taprio.c=588=static int taprio_enqueue_one(struct sk_buff *skb, struct Qdisc *sch,\n--\nnet/sched/sch_taprio.c-597-\t} else if (TXTIME_ASSIST_IS_ENABLED(q-\u003eflags)) {\nnet/sched/sch_taprio.c:598:\t\tskb-\u003etstamp = get_packet_txtime(skb, sch);\nnet/sched/sch_taprio.c-599-\t\tif (!skb-\u003etstamp)\n"
} |
| 15/2 | 2026/11/06 22:56 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 21573 output: 36 thoughts: 13 Thoughts: Here's my take on the thought process, summarized as you requested: **Digging into `is_valid_interval`** Okay, time to get to the bottom of this. The first step is clear: I need to understand how `is_valid_interval` is *actually* being used. I need to trace its call graph and see who's invoking this function. I have a hunch, and this is the best way to validate it and see its uses. Time to check `is_valid_interval` callers. Let's see what the system has to tell me! |
| 16/2 | 2026/11/06 22:56 | tool | grepper |
0mArgs:{
"Expression": "is_valid_interval",
"PathPrefixes": [
"net/sched/sch_taprio.c"
]
}Results: {
"Output": "net/sched/sch_taprio.c=338=static struct sched_entry *find_entry_to_transmit(struct sk_buff *skb,\n--\nnet/sched/sch_taprio.c-414-\nnet/sched/sch_taprio.c:415:static bool is_valid_interval(struct sk_buff *skb, struct Qdisc *sch)\nnet/sched/sch_taprio.c-416-{\n--\nnet/sched/sch_taprio.c=588=static int taprio_enqueue_one(struct sk_buff *skb, struct Qdisc *sch,\n--\nnet/sched/sch_taprio.c-594-\tif (skb-\u003esk \u0026\u0026 sk_fullsock(skb-\u003esk) \u0026\u0026 sock_flag(skb-\u003esk, SOCK_TXTIME)) {\nnet/sched/sch_taprio.c:595:\t\tif (!is_valid_interval(skb, sch))\nnet/sched/sch_taprio.c-596-\t\t\treturn qdisc_drop(skb, sch, to_free);\n"
} |
| 17/2 | 2026/11/06 22:56 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 22024 output: 31 thoughts: 384 Thoughts: **My Assessment of the `taprio` Scheduler for Fuzzing** Okay, so here's the lay of the land with this `taprio` scheduler. I see that `is_valid_interval` and `get_packet_txtime` are key functions called within the `taprio_enqueue_one` function, which in turn feeds into `taprio_enqueue`. The `advance_sched` function is the crucial HRTimer callback, and `taprio_change` is the netlink configuration entrypoint. We also have `parse_taprio_schedule`, which handles the parsing of the schedule entries themselves, and these new helper functions: `taprio_sync_sched_to_time`, `taprio_fast_forward_sched`, and `taprio_advance_one_entry`. Sounds like we are dealing with a significant chunk of logic here. Now, let's get down to brass tacks: `WorthFuzzing` is definitely `true`. We are talking about the core network traffic control subsystem, specifically within `net/sched/sch_taprio.c`. This code is responsible for handling network packets and responding to those netlink rtnetlink configuration commands coming from user-space. The icing on the cake is that it's *fully reachable* in QEMU/KVM virtualized environments – meaning we can reliably set up testbeds with loopback, veth, dummy, macvlan interfaces, etc. to exercise it. Given the sheer volume of changes – schedule parsing, entry calculation, timer advancement, schedule fast-forwarding, interval validation, error handling rollback – this is ripe for fuzzing. Moving on to configurations: `NET_SCH_TAPRIO` and `NET_SCHED` are obviously important. I'll need to check for dependencies of `NET_SCH_TAPRIO`. I'm seeing that `config NET_SCH_TAPRIO` selects `NET_SCH_MQPRIO_LIB` within `net/sched/Kconfig`, which is nested inside `menuconfig NET_SCHED`. Now, is there anything else I'm missing? I should probably take a look at the wider `net/Kconfig` or similar files just to be absolutely certain I have all the relevant config options. |
| 18/2 | 2026/11/06 22:56 | tool | grepper |
0mArgs:{
"Expression": "source \"net/sched/Kconfig\"",
"PathPrefixes": [
"net"
]
}Results: {
"Output": "net/Kconfig=269=source \"net/mac802154/Kconfig\"\nnet/Kconfig:270:source \"net/sched/Kconfig\"\nnet/Kconfig-271-source \"net/dcb/Kconfig\"\n"
} |
| 19/2 | 2026/11/06 22:56 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 22997 output: 32 thoughts: 17 Thoughts: Here's a summary of my thought process, tailored for an expert like you: **Diving into the Kernel Configuration Landscape** Okay, so I need to understand something related to the kernel configuration process. A good starting point is usually the `net/Kconfig` file, since it seems likely that the relevant functionality is within the networking subsystem. Specifically, my intuition tells me that the key could be around line 270. Let's start there. I'll focus on what's defined and how it's being used in that vicinity. Understanding that context is crucial for resolving the issue at hand. |
| 20/2 | 2026/11/06 22:56 | tool | read-file |
0mArgs:{
"File": "net/Kconfig",
"FirstLine": 265,
"LineCount": 10
}Results: {
"Contents": " 265:\tsource \"net/lapb/Kconfig\"\n 266:\tsource \"net/phonet/Kconfig\"\n 267:\tsource \"net/6lowpan/Kconfig\"\n 268:\tsource \"net/ieee802154/Kconfig\"\n 269:\tsource \"net/mac802154/Kconfig\"\n 270:\tsource \"net/sched/Kconfig\"\n 271:\tsource \"net/dcb/Kconfig\"\n 272:\tsource \"net/dns_resolver/Kconfig\"\n 273:\tsource \"net/batman-adv/Kconfig\"\n 274:\tsource \"net/openvswitch/Kconfig\"\n"
} |
| 21/2 | 2026/11/06 22:56 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 23373 output: 261 thoughts: 1077 Thoughts: **TAPRIO Queueing Discipline Fuzzing Target Identification** Okay, let's break this down. We're looking at `NET_SCH_TAPRIO`, which relies on the standard `NET` networking stack, meaning we're dealing with a specific queuing discipline. The core question is: is this patch fuzzable? First, I need to identify the critical functions. From the diff, I've identified several key modifications and additions: `taprio_min_interval`, `taprio_advance_one_entry`, `taprio_sync_sched_to_time`, `taprio_fast_forward_sched`, `taprio_set_entry_state`, `advance_sched`, `parse_taprio_schedule`, `taprio_change`, `taprio_destroy`, `find_entry_to_transmit`, `is_valid_interval`, `get_packet_txtime`, and `taprio_enqueue`. Now, let's categorize those. Functions like `advance_sched`, `taprio_change`, `taprio_destroy`, and `taprio_enqueue` are likely function pointers in `taprio_qdisc_ops` or hrtimer callbacks, and the others, such as `parse_taprio_schedule`, `taprio_fast_forward_sched`, and `taprio_sync_sched_to_time`, are helpers within the scheduler's logic. Based on this, I've selected the best focus symbols: `taprio_change` (configuration entrypoint), `advance_sched` (the hrtimer handler), `taprio_fast_forward_sched`, `taprio_advance_one_entry`, `taprio_sync_sched_to_time`, `parse_taprio_schedule`, `get_packet_txtime`, `is_valid_interval`, and `taprio_enqueue`. These functions are central to the patch's changes, including schedule parsing, advancement, and transmission. A quick check confirms these aren't ubiquitous kernel primitives like memory allocators or synchronization locks – they're specific to the TAPRIO subsystem. This is good; we're targeting a well-defined area. The patch's logic introduces several new helpers and fundamentally alters the hrtimer callback, `advance_sched`, to prevent CPU starvation. The code is triggered by user space via rtnetlink (`RTM_NEWQDISC`) and packet transmission paths, so there's clear user-space interaction. That confirms my assessment. It is definitely fuzzable! The reasoning is concise: refactoring and modification of schedule parsing, validation, entry advancement, fast-forwarding, error rollback, and time synchronization logic. We're now set with the right configurations and symbols. And after that sanity check, everything is completely aligned with the requirements. It's fuzzable. |
| 22/2 | 2026/11/06 22:57 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"NET_SCH_TAPRIO",
"NET_SCHED"
],
"FocusSymbols": [
"taprio_change",
"advance_sched",
"parse_taprio_schedule",
"taprio_advance_one_entry",
"taprio_fast_forward_sched",
"taprio_sync_sched_to_time",
"get_packet_txtime",
"is_valid_interval",
"taprio_enqueue"
],
"Reasoning": "The patch significantly modifies the TAPRIO (Time Aware Priority) packet scheduler (net/sched/sch_taprio.c). It restructures schedule parsing, validation, and error recovery in taprio_change(), updates time calculations and schedule-switching checks in txtime/enqueue paths, and overhauls the hrtimer advance_sched() routine with new scheduling algorithms (taprio_advance_one_entry, taprio_fast_forward_sched, taprio_sync_sched_to_time) to handle timer drift and prevent CPU starvation. The code is fully reachable in standard virtualized environments via rtnetlink qdisc configuration and packet transmission.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"NET_SCH_TAPRIO",
"NET_SCHED"
],
"FocusSymbols": [
"taprio_change",
"advance_sched",
"parse_taprio_schedule",
"taprio_advance_one_entry",
"taprio_fast_forward_sched",
"taprio_sync_sched_to_time",
"get_packet_txtime",
"is_valid_interval",
"taprio_enqueue"
],
"Reasoning": "The patch significantly modifies the TAPRIO (Time Aware Priority) packet scheduler (net/sched/sch_taprio.c). It restructures schedule parsing, validation, and error recovery in taprio_change(), updates time calculations and schedule-switching checks in txtime/enqueue paths, and overhauls the hrtimer advance_sched() routine with new scheduling algorithms (taprio_advance_one_entry, taprio_fast_forward_sched, taprio_sync_sched_to_time) to handle timer drift and prevent CPU starvation. The code is fully reachable in standard virtualized environments via rtnetlink qdisc configuration and packet transmission.",
"WorthFuzzing": true
} |
| 23/1 | 2026/11/06 22:57 | action | If |
2mArgs:{
"WorthFuzzing": true
}Results: null |
| 24/2 | 2026/11/06 22:57 | agent | kmsan-evaluator |
2mModel:core Args: null Results: {
"KMSANReasoning": "The patch series modifies the taprio qdisc (net/sched/sch_taprio.c) to improve interval validation (enforcing a minimum interval in software mode to avoid hrtimer storms), handle schedule fast-forwarding when timers lag behind, fix cleanup/rollback on configuration failures, and safely stage queue/traffic-class configurations.\n\nThere are no uninitialized memory risks or kernel-to-user info-leaks introduced or exposed by these changes:\n1. No uninitialized memory is exported to user space. Netlink dump paths emit scalar fields individually via nla_put_* helpers. Stack arrays introduced in taprio_change (max_sdu and fp) are explicitly zero-initialized (`= { }`) before being populated and written to the qdisc state.\n2. Control flow variables (such as timestamps, loop limits, and gate entry pointers) are strictly initialized before use in condition checks and time comparisons.\n3. Heap allocations for schedule entries and gate lists continue to be allocated with zeroed memory (kzalloc_obj).\n4. Potential bugs related to list management, timer expiry handling, state cleanup, or offload callbacks fall strictly into the domain of KASAN (use-after-free, out-of-bounds), LOCKDEP (locking/deadlock), or UBSAN, which are already covered by standard KASAN fuzzing. Dedicated KMSAN fuzzing is not justified.",
"NeedsKMSAN": false
}Instruction: You are an expert Linux kernel security engineer specializing in kernel memory
error detectors (KASAN and KMSAN). Your job is to review the provided patch series and
determine if the code changes justify spawning a dedicated KMSAN (KernelMemorySanitizer)
fuzzing session in addition to standard KASAN fuzzing.
CRITICAL DISTINCTION BETWEEN KASAN AND KMSAN:
- Standard KASAN kernel builds (upstream-apparmor-kasan.config) already enable
a comprehensive suite of debugging tools and sanitizers, including KASAN
(out-of-bounds accesses, use-after-free, double free, invalid free), LOCKDEP
(locking bugs and deadlocks), UB-sanitizers, and memory corruption checks.
- KMSAN (KernelMemorySanitizer) detects reads of UNINITIALIZED memory (stack, heap,
or page allocations) and kernel-to-user memory info-leaks.
Rule: THERE IS NO SENSE IN RUNNING A KMSAN SESSION IF A BUG CAN BE CAUGHT BY KASAN,
LOCKDEP, OR OTHER STANDARD BUG DETECTORS.
A dedicated KMSAN fuzzing session incurs significant resource costs. You must ONLY
set NeedsKMSAN=true if the code changes introduce or expose UNINITIALIZED MEMORY risks
that are detected ONLY by KMSAN.
Look holistically at the patch series and surrounding code. Even if no direct
uninitialized field accesses or new buffer allocations are added in the diff itself,
a patch may alter control flow, bounds checking, or data length calculations in ways
that change how the rest of the code operates on existing buffers (e.g. allowing
uninitialized stack/heap memory to be read, copied to user space, or used in control
flow). Do not hesitate to use your code access tools to inspect the surrounding code,
called functions, and callers.
Set NeedsKMSAN=true ONLY IF the patch introduces or modifies:
1. Kernel structures sent to user space (via copy_to_user, put_user, netlink skb
attributes, ioctl output arguments, socket options, or BPF buffers) where fields
or structure padding might not be fully initialized/zeroed.
2. Conditional logic or branching that depends on potentially uninitialized variables
or struct fields.
3. Allocation or initialization of complex data structures where uninitialized fields
could be read later in reachable code paths.
4. Bounds checks, lengths, or logic in a way that allows surrounding code to access
uninitialized bytes of existing buffers.
Set NeedsKMSAN=false IF:
- The code changes primarily risk out-of-bounds access, array overflows, NULL pointer
dereferences, locking deadlocks, or use-after-free bugs (these are already caught
by KASAN, LOCKDEP, or standard bug detectors).
- All stack/heap structures touched or introduced by the patch are fully zeroed
or initialized (e.g. using = {0}, memset, kzalloc) before being read or copied.
- The patch does not introduce any risk of uninitialized memory usage or info-leaks.
Use your code access tools to inspect the surrounding code if necessary, then provide
detailed KMSANReasoning contrasting KASAN vs KMSAN applicability for this patch.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit 884ebe33e538fc6cfee1c0bc395c028146e11df8
Author: syz-cluster <triage@syzkaller.com>
Date: Fri Nov 6 22:55:46 2026 +0000
syz-cluster: applied patch under review
diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 39ac5b97aa3af8..b0806ea0460bce 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -48,6 +48,10 @@ static struct static_key_false taprio_have_working_mqprio;
* 60 * 17 > PSEC_PER_NSEC (1000)
*/
#define TAPRIO_PICOS_PER_BYTE_MIN 17
+/* Minimum interval for software mode (hrtimer-driven advance_sched) to
+ * avoid hrtimer interrupt storms and CPU starvation.
+ */
+#define TAPRIO_MIN_SW_INTERVAL_NS (10 * NSEC_PER_USEC)
struct sched_entry {
/* Durations between this GCL entry and the GCL entry where the
@@ -117,10 +121,9 @@ struct __tc_taprio_qopt_offload {
};
static void taprio_calculate_gate_durations(struct taprio_sched *q,
- struct sched_gate_list *sched)
+ struct sched_gate_list *sched,
+ int num_tc)
{
- struct net_device *dev = qdisc_dev(q->root);
- int num_tc = netdev_get_num_tc(dev);
struct sched_entry *entry, *cur;
int tc;
@@ -259,6 +262,17 @@ static int length_to_duration(struct taprio_sched *q, int len)
return div_u64(len * atomic64_read(&q->picos_per_byte), PSEC_PER_NSEC);
}
+static int taprio_min_interval(struct taprio_sched *q)
+{
+ int min_duration = length_to_duration(q, ETH_ZLEN);
+
+ if (!FULL_OFFLOAD_IS_ENABLED(q->flags) &&
+ !TXTIME_ASSIST_IS_ENABLED(q->flags))
+ min_duration = max_t(int, min_duration, TAPRIO_MIN_SW_INTERVAL_NS);
+
+ return min_duration;
+}
+
static int duration_to_length(struct taprio_sched *q, u64 duration)
{
return div_u64(duration * PSEC_PER_NSEC, atomic64_read(&q->picos_per_byte));
@@ -270,17 +284,18 @@ static int duration_to_length(struct taprio_sched *q, u64 duration)
*/
static void taprio_update_queue_max_sdu(struct taprio_sched *q,
struct sched_gate_list *sched,
- struct qdisc_size_table *stab)
+ struct qdisc_size_table *stab,
+ const u32 max_sdu_user[TC_MAX_QUEUE],
+ int num_tc)
{
struct net_device *dev = qdisc_dev(q->root);
- int num_tc = netdev_get_num_tc(dev);
u32 max_sdu_from_user;
u32 max_sdu_dynamic;
u32 max_sdu;
int tc;
for (tc = 0; tc < num_tc; tc++) {
- max_sdu_from_user = q->max_sdu[tc] ?: U32_MAX;
+ max_sdu_from_user = max_sdu_user[tc] ?: U32_MAX;
/* TC gate never closes => keep the queueMaxSDU
* selected by the user
@@ -357,7 +372,7 @@ static struct sched_entry *find_entry_to_transmit(struct sk_buff *skb,
curr_intv_end = get_interval_end_time(sched, admin, entry,
curr_intv_start);
- if (ktime_after(curr_intv_start, cycle_end))
+ if (ktime_compare(curr_intv_start, cycle_end) >= 0)
break;
if (!(entry->gate_mask & BIT(tc)) ||
@@ -366,10 +381,10 @@ static struct sched_entry *find_entry_to_transmit(struct sk_buff *skb,
txtime = entry->next_txtime;
- if (ktime_before(txtime, time) || validate_interval) {
+ if (!ktime_after(txtime, time) || validate_interval) {
transmit_end_time = ktime_add_ns(time, packet_transmit_time);
- if ((ktime_before(curr_intv_start, time) &&
- ktime_before(transmit_end_time, curr_intv_end)) ||
+ if ((!ktime_after(curr_intv_start, time) &&
+ !ktime_after(transmit_end_time, curr_intv_end)) ||
(ktime_after(curr_intv_start, time) && !validate_interval)) {
entry_found = entry;
*interval_start = curr_intv_start;
@@ -405,8 +420,19 @@ static bool is_valid_interval(struct sk_buff *skb, struct Qdisc *sch)
struct sched_entry *entry;
rcu_read_lock();
- sched = rcu_dereference(q->oper_sched);
admin = rcu_dereference(q->admin_sched);
+ sched = rcu_dereference(q->oper_sched);
+
+ if (admin && !ktime_before(skb->tstamp, admin->base_time)) {
+ sched = admin;
+ admin = NULL;
+ }
+
+ /* Until the schedule starts, all the queues are open */
+ if (!sched || ktime_before(skb->tstamp, sched->base_time)) {
+ rcu_read_unlock();
+ return true;
+ }
entry = find_entry_to_transmit(skb, sch, sched, admin, skb->tstamp,
&interval_start, &interval_end, true);
@@ -484,7 +510,7 @@ static long get_packet_txtime(struct sk_buff *skb, struct Qdisc *sch)
rcu_read_lock();
admin = rcu_dereference(q->admin_sched);
sched = rcu_dereference(q->oper_sched);
- if (admin && ktime_after(minimum_time, admin->base_time))
+ if (admin && !ktime_before(minimum_time, admin->base_time))
switch_schedules(q, &admin, &sched);
/* Until the schedule starts, all the queues are open */
@@ -513,8 +539,9 @@ static long get_packet_txtime(struct sk_buff *skb, struct Qdisc *sch)
txtime = max_t(ktime_t, txtime, interval_start);
if (admin && admin != sched &&
- ktime_after(txtime, admin->base_time)) {
+ !ktime_before(txtime, admin->base_time)) {
sched = admin;
+ admin = NULL;
sched_changed = true;
continue;
}
@@ -876,7 +903,7 @@ static bool should_restart_cycle(const struct sched_gate_list *oper,
if (list_is_last(&entry->list, &oper->entries))
return true;
- if (ktime_compare(entry->end_time, oper->cycle_end_time) == 0)
+ if (ktime_compare(entry->end_time, oper->cycle_end_time) >= 0)
return true;
return false;
@@ -888,7 +915,7 @@ static bool should_change_schedules(const struct sched_gate_list *admin,
{
ktime_t next_base_time, extension_time;
- if (!admin)
+ if (!admin || !oper)
return false;
next_base_time = sched_base_time(admin);
@@ -916,6 +943,162 @@ static bool should_change_schedules(const struct sched_gate_list *admin,
return false;
}
+static void taprio_set_entry_state(struct taprio_sched *q,
+ struct sched_gate_list *oper,
+ struct sched_entry *next,
+ ktime_t cur_start,
+ ktime_t end_time,
+ int num_tc)
+{
+ int tc;
+
+ for (tc = 0; tc < num_tc; tc++) {
+ if (next->gate_duration[tc] == oper->cycle_time)
+ next->gate_close_time[tc] = KTIME_MAX;
+ else
+ next->gate_close_time[tc] = ktime_add_ns(cur_start,
+ next->gate_duration[tc]);
+ }
+
+ next->end_time = end_time;
+ taprio_set_budgets(q, oper, next);
+}
+
+static void taprio_advance_one_entry(struct taprio_sched *q,
+ struct sched_gate_list **p_oper,
+ struct sched_gate_list **p_admin,
+ struct sched_entry **p_entry,
+ struct sched_entry **p_next,
+ ktime_t *p_end_time,
+ int num_tc)
+{
+ struct sched_gate_list *oper = *p_oper;
+ struct sched_gate_list *admin = *p_admin;
+ struct sched_entry *entry = *p_entry;
+ ktime_t cur_start, end_time;
+ struct sched_entry *next;
+
+ if (!oper->cycle_end_time)
+ oper->cycle_end_time = ktime_add_ns(sched_base_time(oper),
+ oper->cycle_time);
+
+ if (should_restart_cycle(oper, entry)) {
+ next = list_first_entry(&oper->entries, struct sched_entry,
+ list);
+ oper->cycle_end_time = ktime_add_ns(oper->cycle_end_time,
+ oper->cycle_time);
+ } else {
+ next = list_next_entry(entry, list);
+ }
+
+ cur_start = entry->end_time;
+ end_time = ktime_add_ns(cur_start, next->interval);
+ end_time = min_t(ktime_t, end_time, oper->cycle_end_time);
+
+ if (should_change_schedules(admin, oper, end_time)) {
+ switch_schedules(q, &admin, &oper);
+ if (!oper->cycle_end_time)
+ oper->cycle_end_time = ktime_add_ns(sched_base_time(oper),
+ oper->cycle_time);
+ cur_start = ktime_sub_ns(oper->cycle_end_time,
+ oper->cycle_time);
+ next = list_first_entry(&oper->entries, struct sched_entry, list);
+ end_time = ktime_add_ns(cur_start, next->interval);
+ end_time = min_t(ktime_t, end_time, oper->cycle_end_time);
+ *p_admin = admin;
+ *p_oper = oper;
+ }
+
+ taprio_set_entry_state(q, oper, next, cur_start, end_time, num_tc);
+
+ *p_entry = next;
+ *p_next = next;
+ *p_end_time = end_time;
+}
+
+static void taprio_sync_sched_to_time(struct taprio_sched *q,
+ struct sched_gate_list *sched,
+ ktime_t now,
+ struct sched_entry **p_next,
+ ktime_t *p_end_time,
+ int num_tc)
+{
+ ktime_t base = sched_base_time(sched);
+ struct sched_entry *entry, *next;
+ ktime_t cur_start, end_time;
+
+ if (ktime_compare(now, base) < 0) {
+ cur_start = base;
+ sched->cycle_end_time = ktime_add_ns(base, sched->cycle_time);
+ next = list_first_entry(&sched->entries, struct sched_entry,
+ list);
+ end_time = ktime_add_ns(cur_start, next->interval);
+ end_time = min_t(ktime_t, end_time, sched->cycle_end_time);
+ } else {
+ u64 cycles = div64_u64(ktime_sub_ns(now, base),
+ sched->cycle_time);
+
+ cur_start = ktime_add_ns(base, cycles * sched->cycle_time);
+ sched->cycle_end_time = ktime_add_ns(cur_start,
+ sched->cycle_time);
+ next = list_last_entry(&sched->entries, struct sched_entry,
+ list);
+ end_time = sched->cycle_end_time;
+
+ list_for_each_entry(entry, &sched->entries, list) {
+ ktime_t cur_end = ktime_add_ns(cur_start,
+ entry->interval);
+
+ if (list_is_last(&entry->list, &sched->entries))
+ cur_end = sched->cycle_end_time;
+ else
+ cur_end = min_t(ktime_t, cur_end,
+ sched->cycle_end_time);
+
+ if (ktime_compare(cur_end, now) > 0) {
+ next = entry;
+ end_time = cur_end;
+ break;
+ }
+ cur_start = cur_end;
+ }
+ }
+
+ taprio_set_entry_state(q, sched, next, cur_start, end_time, num_tc);
+ *p_next = next;
+ *p_end_time = end_time;
+}
+
+static void taprio_fast_forward_sched(struct taprio_sched *q,
+ struct sched_gate_list **p_oper,
+ struct sched_gate_list **p_admin,
+ struct sched_entry **p_next,
+ ktime_t *p_end_time,
+ ktime_t now,
+ int num_tc)
+{
+ struct sched_gate_list *oper = *p_oper;
+ struct sched_gate_list *admin = *p_admin;
+ struct sched_entry *next;
+ ktime_t end_time;
+
+ if (admin && ktime_compare(sched_base_time(admin), now) <= 0)
+ switch_schedules(q, &admin, &oper);
+
+ taprio_sync_sched_to_time(q, oper, now, &next, &end_time, num_tc);
+
+ if (should_change_schedules(admin, oper, end_time)) {
+ switch_schedules(q, &admin, &oper);
+ taprio_sync_sched_to_time(q, oper, now, &next, &end_time,
+ num_tc);
+ }
+
+ *p_oper = oper;
+ *p_admin = admin;
+ *p_next = next;
+ *p_end_time = end_time;
+}
+
static enum hrtimer_restart advance_sched(struct hrtimer *timer)
{
struct taprio_sched *q = container_of(timer, struct taprio_sched,
@@ -925,8 +1108,7 @@ static enum hrtimer_restart advance_sched(struct hrtimer *timer)
int num_tc = netdev_get_num_tc(dev);
struct sched_entry *entry, *next;
struct Qdisc *sch = q->root;
- ktime_t end_time;
- int tc;
+ ktime_t end_time, now;
spin_lock(&q->current_entry_lock);
entry = rcu_dereference_protected(q->current_entry,
@@ -939,6 +1121,11 @@ static enum hrtimer_restart advance_sched(struct hrtimer *timer)
if (!oper)
switch_schedules(q, &admin, &oper);
+ if (unlikely(!oper)) {
+ spin_unlock(&q->current_entry_lock);
+ return HRTIMER_NORESTART;
+ }
+
/* This can happen in two cases: 1. this is the very first run
* of this function (i.e. we weren't running any schedule
* previously); 2. The previous schedule just ended. The first
@@ -946,49 +1133,117 @@ static enum hrtimer_restart advance_sched(struct hrtimer *timer)
* schedule initialization.
*/
if (unlikely(!entry || entry->end_time == oper->base_time)) {
- next = list_first_entry(&oper->entries, struct sched_entry,
- list);
- end_time = next->end_time;
- goto first_run;
- }
+ ktime_t cur_start;
- if (should_restart_cycle(oper, entry)) {
+ if (!oper->cycle_end_time)
+ oper->cycle_end_time = ktime_add_ns(sched_base_time(oper),
+ oper->cycle_time);
+ cur_start = ktime_sub_ns(oper->cycle_end_time,
+ oper->cycle_time);
next = list_first_entry(&oper->entries, struct sched_entry,
list);
- oper->cycle_end_time = ktime_add_ns(oper->cycle_end_time,
- oper->cycle_time);
+ end_time = ktime_add_ns(cur_start, next->interval);
+ end_time = min_t(ktime_t, end_time, oper->cycle_end_time);
+
+ if (should_change_schedules(admin, oper, end_time)) {
+ switch_schedules(q, &admin, &oper);
+ if (!oper->cycle_end_time)
+ oper->cycle_end_time = ktime_add_ns(sched_base_time(oper),
+ oper->cycle_time);
+ cur_start = ktime_sub_ns(oper->cycle_end_time,
+ oper->cycle_time);
+ next = list_first_entry(&oper->entries,
+ struct sched_entry, list);
+ end_time = ktime_add_ns(cur_start, next->interval);
+ end_time = min_t(ktime_t, end_time,
+ oper->cycle_end_time);
+ }
+
+ taprio_set_entry_state(q, oper, next, cur_start, end_time,
+ num_tc);
} else {
- next = list_next_entry(entry, list);
+ taprio_advance_one_entry(q, &oper, &admin, &entry, &next,
+ &end_time, num_tc);
}
- end_time = ktime_add_ns(entry->end_time, next->interval);
- end_time = min_t(ktime_t, end_time, oper->cycle_end_time);
+ now = taprio_get_time(q);
+ if (unlikely(ktime_compare(end_time, now) <= 0)) {
+ size_t max_steps = min_t(size_t, oper->num_entries, 32);
+ size_t i;
+
+ for (i = 0; i < max_steps && ktime_compare(end_time, now) <= 0; i++) {
+ entry = next;
+ taprio_advance_one_entry(q, &oper, &admin, &entry, &next,
+ &end_time, num_tc);
+ }
- for (tc = 0; tc < num_tc; tc++) {
- if (next->gate_duration[tc] == oper->cycle_time)
- next->gate_close_time[tc] = KTIME_MAX;
- else
- next->gate_close_time[tc] = ktime_add_ns(entry->end_time,
- next->gate_duration[tc]);
+ now = taprio_get_time(q);
+ if (ktime_compare(end_time, now) <= 0) {
+ taprio_fast_forward_sched(q, &oper, &admin, &next,
+ &end_time, now, num_tc);
+ now = taprio_get_time(q);
+ if (unlikely(ktime_compare(end_time, now) <= 0)) {
+ entry = next;
+ taprio_advance_one_entry(q, &oper, &admin,
+ &entry, &next,
+ &end_time, num_tc);
+ }
+ }
}
- if (should_change_schedules(admin, oper, end_time)) {
- switch_schedules(q, &admin, &oper);
- /* After changing schedules, the next entry is the first one
- * in the new schedule, with a pre-calculated end_time.
- */
- next = list_first_entry(&oper->entries, struct sched_entry, list);
- end_time = next->end_time;
- }
+ now = taprio_get_time(q);
+ if (unlikely(ktime_compare(end_time, now) <= 0)) {
+ ktime_t fallback_end = ktime_add_ns(now,
+ taprio_min_interval(q));
+
+ if (should_change_schedules(admin, oper, fallback_end)) {
+ switch_schedules(q, &admin, &oper);
+ taprio_sync_sched_to_time(q, oper, now, &next,
+ &end_time, num_tc);
+ } else {
+ s64 diff;
+
+ end_time = fallback_end;
+ if (!oper->cycle_end_time)
+ oper->cycle_end_time =
+ ktime_add_ns(sched_base_time(oper),
+ oper->cycle_time);
+ diff = ktime_sub(end_time, oper->cycle_end_time);
+ if (diff > 0) {
+ u64 cycles = div64_u64(diff +
+ oper->cycle_time - 1,
+ oper->cycle_time);
+
+ oper->cycle_end_time =
+ ktime_add_ns(oper->cycle_end_time,
+ cycles * oper->cycle_time);
+ }
+ taprio_set_entry_state(q, oper, next, now,
+ end_time, num_tc);
+ }
- next->end_time = end_time;
- taprio_set_budgets(q, oper, next);
+ now = taprio_get_time(q);
+ if (unlikely(ktime_compare(end_time, now) <= 0)) {
+ s64 diff;
-first_run:
- rcu_assign_pointer(q->current_entry, next);
- spin_unlock(&q->current_entry_lock);
+ end_time = ktime_add_ns(now, taprio_min_interval(q));
+ diff = ktime_sub(end_time, oper->cycle_end_time);
+ if (diff > 0) {
+ u64 cycles = div64_u64(diff +
+ oper->cycle_time - 1,
+ oper->cycle_time);
+ oper->cycle_end_time =
+ ktime_add_ns(oper->cycle_end_time,
+ cycles * oper->cycle_time);
+ }
+ next->end_time = end_time;
+ }
+ }
+
+ rcu_assign_pointer(q->current_entry, next);
hrtimer_set_expires(&q->advance_timer, end_time);
+ spin_unlock(&q->current_entry_lock);
rcu_read_lock();
__netif_schedule(sch);
@@ -1130,7 +1385,11 @@ static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb,
struct sched_gate_list *new,
struct netlink_ext_ack *extack)
{
+ int min_duration = taprio_min_interval(q);
+ struct sched_entry *entry, *n;
+ s64 elapsed = 0;
int err = 0;
+ int i = 0;
if (tb[TCA_TAPRIO_ATTR_SCHED_SINGLE_ENTRY]) {
NL_SET_ERR_MSG(extack, "Adding a single entry is not supported");
@@ -1152,8 +1411,12 @@ static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb,
if (err < 0)
return err;
+ if (list_empty(&new->entries)) {
+ NL_SET_ERR_MSG(extack, "There should be at least one entry in the schedule");
+ return -EINVAL;
+ }
+
if (!new->cycle_time) {
- struct sched_entry *entry;
ktime_t cycle = 0;
list_for_each_entry(entry, &new->entries, list)
@@ -1167,12 +1430,45 @@ static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb,
new->cycle_time = cycle;
}
- if (new->cycle_time < new->num_entries * length_to_duration(q, ETH_ZLEN)) {
+ if (new->cycle_time < min_duration) {
NL_SET_ERR_MSG(extack, "'cycle_time' is too small");
return -EINVAL;
}
- taprio_calculate_gate_durations(q, new);
+ list_for_each_entry_safe(entry, n, &new->entries, list) {
+ if (elapsed >= new->cycle_time) {
+ list_del(&entry->list);
+ kfree(entry);
+ new->num_entries--;
+ continue;
+ }
+
+ if (elapsed + entry->interval > new->cycle_time) {
+ entry->interval = new->cycle_time - elapsed;
+ elapsed = new->cycle_time;
+ } else {
+ elapsed += entry->interval;
+ }
+ }
+
+ if (list_empty(&new->entries)) {
+ NL_SET_ERR_MSG(extack, "There should be at least one entry in the schedule");
+ return -EINVAL;
+ }
+
+ if (elapsed < new->cycle_time) {
+ entry = list_last_entry(&new->entries, struct sched_entry, list);
+ entry->interval += new->cycle_time - elapsed;
+ }
+
+ list_for_each_entry(entry, &new->entries, list) {
+ if (entry->interval < min_duration) {
+ NL_SET_ERR_MSG(extack, "Invalid interval for schedule entry");
+ return -EINVAL;
+ }
+ entry->index = i++;
+ }
+ new->num_entries = i;
return 0;
}
@@ -1256,7 +1552,7 @@ static void setup_first_end_time(struct taprio_sched *q,
/* FIXME: find a better place to do this */
sched->cycle_end_time = ktime_add_ns(base, cycle);
- first->end_time = ktime_add_ns(base, first->interval);
+ first->end_time = ktime_add_ns(base, min_t(s64, first->interval, cycle));
taprio_set_budgets(q, sched, first);
for (tc = 0; tc < num_tc; tc++) {
@@ -1349,11 +1645,13 @@ static int taprio_dev_notifier(struct notifier_block *nb, unsigned long event,
rcu_read_lock();
oper = rcu_dereference(q->oper_sched);
if (oper)
- taprio_update_queue_max_sdu(q, oper, stab);
+ taprio_update_queue_max_sdu(q, oper, stab, q->max_sdu,
+ netdev_get_num_tc(dev));
admin = rcu_dereference(q->admin_sched);
if (admin)
- taprio_update_queue_max_sdu(q, admin, stab);
+ taprio_update_queue_max_sdu(q, admin, stab, q->max_sdu,
+ netdev_get_num_tc(dev));
rcu_read_unlock();
break;
@@ -1456,10 +1754,29 @@ static u32 tc_map_to_queue_mask(struct net_device *dev, u32 tc_mask)
return queue_mask;
}
+static u32 qopt_tc_map_to_queue_mask(const struct tc_mqprio_qopt *qopt,
+ u32 tc_mask)
+{
+ u32 i, queue_mask = 0;
+
+ for (i = 0; i < qopt->num_tc; i++) {
+ u16 offset = qopt->offset[i];
+ u16 count = qopt->count[i];
+
+ if (!(tc_mask & BIT(i)))
+ continue;
+
+ queue_mask |= GENMASK(offset + count - 1, offset);
+ }
+
+ return queue_mask;
+}
+
static void taprio_sched_to_offload(struct net_device *dev,
struct sched_gate_list *sched,
struct tc_taprio_qopt_offload *offload,
- const struct tc_taprio_caps *caps)
+ const struct tc_taprio_caps *caps,
+ bool has_mqprio)
{
struct sched_entry *entry;
int i = 0;
@@ -1474,8 +1791,10 @@ static void taprio_sched_to_offload(struct net_device *dev,
e->command = entry->command;
e->interval = entry->interval;
if (caps->gate_mask_per_txq)
- e->gate_mask = tc_map_to_queue_mask(dev,
- entry->gate_mask);
+ e->gate_mask = has_mqprio ?
+ qopt_tc_map_to_queue_mask(&offload->mqprio.qopt,
+ entry->gate_mask) :
+ tc_map_to_queue_mask(dev, entry->gate_mask);
else
e->gate_mask = entry->gate_mask;
@@ -1516,6 +1835,9 @@ static void taprio_cleanup_broken_mqprio(struct taprio_sched *q)
static int taprio_enable_offload(struct net_device *dev,
struct taprio_sched *q,
struct sched_gate_list *sched,
+ const struct tc_mqprio_qopt *mqprio,
+ const u32 max_sdu[TC_MAX_QUEUE],
+ u32 fp[TC_QOPT_MAX_QUEUE],
struct netlink_ext_ack *extack)
{
const struct net_device_ops *ops = dev->netdev_ops;
@@ -1534,7 +1856,7 @@ static int taprio_enable_offload(struct net_device *dev,
if (!caps.supports_queue_max_sdu) {
for (tc = 0; tc < TC_MAX_QUEUE; tc++) {
- if (q->max_sdu[tc]) {
+ if (max_sdu[tc]) {
NL_SET_ERR_MSG_MOD(extack,
"Device does not handle queueMaxSDU");
return -EOPNOTSUPP;
@@ -1550,13 +1872,16 @@ static int taprio_enable_offload(struct net_device *dev,
}
offload->cmd = TAPRIO_CMD_REPLACE;
offload->extack = extack;
- mqprio_qopt_reconstruct(dev, &offload->mqprio.qopt);
+ if (mqprio)
+ offload->mqprio.qopt = *mqprio;
+ else
+ mqprio_qopt_reconstruct(dev, &offload->mqprio.qopt);
offload->mqprio.extack = extack;
- taprio_sched_to_offload(dev, sched, offload, &caps);
- mqprio_fp_to_offload(q->fp, &offload->mqprio);
+ taprio_sched_to_offload(dev, sched, offload, &caps, mqprio != NULL);
+ mqprio_fp_to_offload(fp, &offload->mqprio);
for (tc = 0; tc < TC_MAX_QUEUE; tc++)
- offload->max_sdu[tc] = q->max_sdu[tc];
+ offload->max_sdu[tc] = max_sdu[tc];
err = ops->ndo_setup_tc(dev, TC_SETUP_QDISC_TAPRIO, offload);
if (err < 0) {
@@ -1747,14 +2072,14 @@ static int taprio_parse_tc_entry(struct Qdisc *sch,
static int taprio_parse_tc_entries(struct Qdisc *sch,
struct nlattr *opt,
+ u32 max_sdu[TC_MAX_QUEUE],
+ u32 fp[TC_QOPT_MAX_QUEUE],
struct netlink_ext_ack *extack)
{
struct taprio_sched *q = qdisc_priv(sch);
struct net_device *dev = qdisc_dev(sch);
- u32 max_sdu[TC_QOPT_MAX_QUEUE];
bool have_preemption = false;
unsigned long seen_tcs = 0;
- u32 fp[TC_QOPT_MAX_QUEUE];
struct nlattr *n;
int tc, rem;
int err = 0;
@@ -1772,8 +2097,6 @@ static int taprio_parse_tc_entries(struct Qdisc *sch,
}
for (tc = 0; tc < TC_QOPT_MAX_QUEUE; tc++) {
- WRITE_ONCE(q->max_sdu[tc], max_sdu[tc]);
- WRITE_ONCE(q->fp[tc], fp[tc]);
if (fp[tc] != TC_FP_EXPRESS)
have_preemption = true;
}
@@ -1792,7 +2115,7 @@ static int taprio_parse_tc_entries(struct Qdisc *sch,
}
}
- return err;
+ return 0;
}
static int taprio_mqprio_cmp(const struct net_device *dev,
@@ -1823,15 +2146,28 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
struct netlink_ext_ack *extack)
{
struct qdisc_size_table *stab = rtnl_dereference(sch->stab);
+ struct sched_gate_list *oper, *admin, *new_admin = NULL;
struct nlattr *tb[TCA_TAPRIO_ATTR_MAX + 1] = { };
- struct sched_gate_list *oper, *admin, *new_admin;
struct taprio_sched *q = qdisc_priv(sch);
struct net_device *dev = qdisc_dev(sch);
struct tc_mqprio_qopt *mqprio = NULL;
+ u32 max_sdu[TC_MAX_QUEUE] = { };
+ u32 fp[TC_QOPT_MAX_QUEUE] = { };
+ bool initial_setup, tc_configured = false;
+ enum tk_offsets old_tk_offset;
+ int old_clockid, num_tc, i, err;
unsigned long flags;
u32 taprio_flags;
+ u32 old_flags;
ktime_t start;
- int i, err;
+
+ oper = rtnl_dereference(q->oper_sched);
+ admin = rtnl_dereference(q->admin_sched);
+ initial_setup = (!oper && !admin);
+
+ old_flags = q->flags;
+ old_clockid = q->clockid;
+ old_tk_offset = q->tk_offset;
err = nla_parse_nested_deprecated(tb, TCA_TAPRIO_ATTR_MAX, opt,
taprio_policy, extack);
@@ -1866,54 +2202,44 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
WRITE_ONCE(q->flags, taprio_flags);
}
+ if (tb[TCA_TAPRIO_ATTR_TXTIME_DELAY]) {
+ if (!TXTIME_ASSIST_IS_ENABLED(q->flags)) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "txtime-delay can only be set when txtime-assist mode is enabled");
+ err = -EINVAL;
+ goto free_sched;
+ }
+ }
+
/* Needed for length_to_duration() during netlink attribute parsing */
taprio_set_picos_per_byte(dev, q, extack);
err = taprio_parse_mqprio_opt(dev, mqprio, extack, q->flags);
if (err < 0)
- return err;
+ goto free_sched;
- err = taprio_parse_tc_entries(sch, opt, extack);
+ err = taprio_parse_tc_entries(sch, opt, max_sdu, fp, extack);
if (err)
- return err;
+ goto free_sched;
new_admin = kzalloc_obj(*new_admin);
if (!new_admin) {
NL_SET_ERR_MSG(extack, "Not enough memory for a new schedule");
- return -ENOMEM;
+ err = -ENOMEM;
+ goto free_sched;
}
INIT_LIST_HEAD(&new_admin->entries);
- oper = rtnl_dereference(q->oper_sched);
- admin = rtnl_dereference(q->admin_sched);
-
/* no changes - no new mqprio settings */
if (!taprio_mqprio_cmp(dev, mqprio))
mqprio = NULL;
- if (mqprio && (oper || admin)) {
+ if (mqprio && !initial_setup) {
NL_SET_ERR_MSG(extack, "Changing the traffic mapping of a running schedule is not supported");
err = -ENOTSUPP;
goto free_sched;
}
- if (mqprio) {
- err = netdev_set_num_tc(dev, mqprio->num_tc);
- if (err)
- goto free_sched;
- for (i = 0; i < mqprio->num_tc; i++) {
- netdev_set_tc_queue(dev, i,
- mqprio->count[i],
- mqprio->offset[i]);
- q->cur_txq[i] = mqprio->offset[i];
- }
-
- /* Always use supplied priority mappings */
- for (i = 0; i <= TC_BITMASK; i++)
- netdev_set_prio_tc_map(dev, i,
- mqprio->prio_tc_map[i]);
- }
-
err = parse_taprio_schedule(q, tb, new_admin, extack);
if (err < 0)
goto free_sched;
@@ -1928,27 +2254,45 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
if (err < 0)
goto free_sched;
- taprio_update_queue_max_sdu(q, new_admin, stab);
+ num_tc = mqprio ? mqprio->num_tc : netdev_get_num_tc(dev);
+
+ taprio_calculate_gate_durations(q, new_admin, num_tc);
+
+ taprio_update_queue_max_sdu(q, new_admin, stab, max_sdu, num_tc);
if (FULL_OFFLOAD_IS_ENABLED(q->flags))
- err = taprio_enable_offload(dev, q, new_admin, extack);
+ err = taprio_enable_offload(dev, q, new_admin, mqprio, max_sdu,
+ fp, extack);
else
err = taprio_disable_offload(dev, q, extack);
if (err)
goto free_sched;
+ if (mqprio) {
+ err = netdev_set_num_tc(dev, mqprio->num_tc);
+ if (err)
+ goto free_sched;
+ tc_configured = true;
+ for (i = 0; i < mqprio->num_tc; i++) {
+ netdev_set_tc_queue(dev, i,
+ mqprio->count[i],
+ mqprio->offset[i]);
+ q->cur_txq[i] = mqprio->offset[i];
+ }
+
+ /* Always use supplied priority mappings */
+ for (i = 0; i <= TC_BITMASK; i++)
+ netdev_set_prio_tc_map(dev, i,
+ mqprio->prio_tc_map[i]);
+ }
+
/* Protects against enqueue()/dequeue() */
spin_lock_bh(qdisc_lock(sch));
- if (tb[TCA_TAPRIO_ATTR_TXTIME_DELAY]) {
- if (!TXTIME_ASSIST_IS_ENABLED(q->flags)) {
- NL_SET_ERR_MSG_MOD(extack, "txtime-delay can only be set when txtime-assist mode is enabled");
- err = -EINVAL;
- goto unlock;
- }
-
- WRITE_ONCE(q->txtime_delay,
- nla_get_u32(tb[TCA_TAPRIO_ATTR_TXTIME_DELAY]));
+ err = taprio_get_start_time(sch, new_admin, &start);
+ if (err < 0) {
+ NL_SET_ERR_MSG(extack, "Internal error: failed get start time");
+ goto unlock;
}
if (!TXTIME_ASSIST_IS_ENABLED(q->flags) &&
@@ -1957,11 +2301,14 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
hrtimer_setup(&q->advance_timer, advance_sched, q->clockid, HRTIMER_MODE_ABS);
}
- err = taprio_get_start_time(sch, new_admin, &start);
- if (err < 0) {
- NL_SET_ERR_MSG(extack, "Internal error: failed get start time");
- goto unlock;
- }
+ if (tb[TCA_TAPRIO_ATTR_TXTIME_DELAY])
+ WRITE_ONCE(q->txtime_delay,
+ nla_get_u32(tb[TCA_TAPRIO_ATTR_TXTIME_DELAY]));
+
+ for (i = 0; i < TC_MAX_QUEUE; i++)
+ WRITE_ONCE(q->max_sdu[i], max_sdu[i]);
+ for (i = 0; i < TC_QOPT_MAX_QUEUE; i++)
+ WRITE_ONCE(q->fp[i], fp[i]);
setup_txtime(q, new_admin, start);
@@ -2008,6 +2355,18 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
spin_unlock_bh(qdisc_lock(sch));
free_sched:
+ if (err) {
+ if (initial_setup) {
+ if (q->offloaded)
+ taprio_disable_offload(dev, q, NULL);
+ if (tc_configured)
+ netdev_reset_tc(dev);
+ }
+ WRITE_ONCE(q->flags, old_flags);
+ q->clockid = old_clockid;
+ WRITE_ONCE(q->tk_offset, old_tk_offset);
+ }
+
if (new_admin)
call_rcu(&new_admin->rcu, taprio_free_sched_cb);
@@ -2054,11 +2413,12 @@ static void taprio_destroy(struct Qdisc *sch)
}
q->qdiscs = NULL;
- netdev_reset_tc(dev);
-
oper = rtnl_dereference(q->oper_sched);
admin = rtnl_dereference(q->admin_sched);
+ if (oper || admin)
+ netdev_reset_tc(dev);
+
if (oper)
call_rcu(&oper->rcu, taprio_free_sched_cb);
|
| 25/3 | 2026/11/06 22:57 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 14223 output: 35 thoughts: 997 Thoughts: **KMSAN Fuzzing Session Assessment for TAPRIO Patch Series** Okay, so I need to decide if this TAPRIO patch series warrants a dedicated KMSAN fuzzing session. Let's break it down methodically. Target architecture is amd64, and the changes are focused on `net/sched/sch_taprio.c`. First, I need to read carefully to understand what has changed: * There's a new define for `TAPRIO_MIN_SW_INTERVAL_NS`. * Several function signature changes, particularly passing `int num_tc` instead of relying on `netdev_get_num_tc(dev)`. This is a pattern I need to watch closely for potential issues around incorrect `num_tc` values. * Functions related to calculating intervals (`taprio_calculate_gate_durations`, `taprio_min_interval`, and various `txtime` comparisons) have been modified. These comparisons are concerning, given their complex nature and potential to result in incorrect behaviors that might result in memory corruption. * The `taprio_update_queue_max_sdu` function now handles `max_sdu_user` and `num_tc`. * There's a series of time comparison changes in `find_entry_to_transmit`, `should_restart_cycle` and other related functions. I need to pay very close attention to how these handle edge cases. * Logic for determining if a schedule is valid (`is_valid_interval`, `should_change_schedules`) has been added/modified. * The software scheduling helpers and cycle fast-forwarding logic (`taprio_set_entry_state`, `taprio_advance_one_entry`, etc.) have been updated. These are also very interesting candidates for fuzzing since complex timer and scheduling calculations are involved. * `parse_taprio_schedule` is now validating intervals against `min_duration` and adjusting schedules. * `setup_first_end_time` has new logic using `ktime_add_ns`. * `taprio_dev_notifier` is updated to pass the `max_sdu` variable. * There are new parameters in some of the functions now, like `has_mqprio` in `taprio_sched_to_offload` or arrays such as `u32 max_sdu[TC_MAX_QUEUE]` and `u32 fp[TC_QOPT_MAX_QUEUE]` in `taprio_parse_tc_entries` * `taprio_change` has local `max_sdu` and `fp` variables and validates them. * `taprio_destroy` resets tc only if `oper || admin`. Now, the crucial question is, are there any potential uninitialized variables or information leaks to user space? I remember this type of case often leads to problems in network code. Since this touches scheduling and time comparisons, I'm particularly concerned about timing-related bugs and potential race conditions. I need to check if we are sending kernel structures to userspace and if the fields might not be initialized/zeroed. No obvious issues are apparent so far. I should check `taprio_dump` just to be completely sure. `taprio_dump` is not touched. I should still inspect the `taprio_dump` function, just to be sure there are no other issues with dumping `max_sdu`, `fp` and entry data. Given the scope of the changes, the numerous time-related comparisons, scheduling logic, and the introduction of new parameters/variables, I'm leaning towards the conclusion that this patch series *does* warrant a dedicated KMSAN fuzzing session. There are numerous opportunities for subtle bugs related to uninitialized memory, improper time calculations and state transitions that would be extremely difficult to catch without specialized fuzzing. I'll need to develop some specific fuzzing targets for this. |
| 26/3 | 2026/11/06 22:57 | tool | grepper |
0mArgs:{
"Expression": "taprio_dump",
"PathPrefixes": [
"net/sched/sch_taprio.c"
]
}Results: {
"Output": "net/sched/sch_taprio.c=2617=static int dump_schedule(struct sk_buff *msg,\n--\nnet/sched/sch_taprio.c-2652-\nnet/sched/sch_taprio.c:2653:static int taprio_dump_tc_entries(struct sk_buff *skb,\nnet/sched/sch_taprio.c-2654-\t\t\t\t const struct taprio_sched *q,\n--\nnet/sched/sch_taprio.c=2686=static int taprio_put_stat(struct sk_buff *skb, u64 val, u16 attrtype)\n--\nnet/sched/sch_taprio.c-2694-\nnet/sched/sch_taprio.c:2695:static int taprio_dump_xstats(struct Qdisc *sch, struct gnet_dump *d,\nnet/sched/sch_taprio.c-2696-\t\t\t struct tc_taprio_qopt_offload *offload,\n--\nnet/sched/sch_taprio.c-2742-\nnet/sched/sch_taprio.c:2743:static int taprio_dump_stats(struct Qdisc *sch, struct gnet_dump *d)\nnet/sched/sch_taprio.c-2744-{\n--\nnet/sched/sch_taprio.c-2748-\nnet/sched/sch_taprio.c:2749:\treturn taprio_dump_xstats(sch, d, \u0026offload, \u0026offload.stats);\nnet/sched/sch_taprio.c-2750-}\nnet/sched/sch_taprio.c-2751-\nnet/sched/sch_taprio.c:2752:static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb)\nnet/sched/sch_taprio.c-2753-{\n--\nnet/sched/sch_taprio.c-2786-\nnet/sched/sch_taprio.c:2787:\tif (oper \u0026\u0026 taprio_dump_tc_entries(skb, q, oper))\nnet/sched/sch_taprio.c-2788-\t\tgoto options_error_rcu;\n--\nnet/sched/sch_taprio.c=2834=static unsigned long taprio_find(struct Qdisc *sch, u32 classid)\n--\nnet/sched/sch_taprio.c-2842-\nnet/sched/sch_taprio.c:2843:static int taprio_dump_class(struct Qdisc *sch, unsigned long cl,\nnet/sched/sch_taprio.c-2844-\t\t\t struct sk_buff *skb, struct tcmsg *tcm)\n--\nnet/sched/sch_taprio.c-2854-\nnet/sched/sch_taprio.c:2855:static int taprio_dump_class_stats(struct Qdisc *sch, unsigned long cl,\nnet/sched/sch_taprio.c-2856-\t\t\t\t struct gnet_dump *d)\n--\nnet/sched/sch_taprio.c-2871-\nnet/sched/sch_taprio.c:2872:\treturn taprio_dump_xstats(sch, d, \u0026offload, \u0026offload.queue_stats.stats);\nnet/sched/sch_taprio.c-2873-}\n--\nnet/sched/sch_taprio.c=2896=static const struct Qdisc_class_ops taprio_class_ops = {\n--\nnet/sched/sch_taprio.c-2900-\t.walk\t\t= taprio_walk,\nnet/sched/sch_taprio.c:2901:\t.dump\t\t= taprio_dump_class,\nnet/sched/sch_taprio.c:2902:\t.dump_stats\t= taprio_dump_class_stats,\nnet/sched/sch_taprio.c-2903-\t.select_queue\t= taprio_select_queue,\n--\nnet/sched/sch_taprio.c=2906=static struct Qdisc_ops taprio_qdisc_ops __read_mostly = {\n--\nnet/sched/sch_taprio.c-2917-\t.enqueue\t= taprio_enqueue,\nnet/sched/sch_taprio.c:2918:\t.dump\t\t= taprio_dump,\nnet/sched/sch_taprio.c:2919:\t.dump_stats\t= taprio_dump_stats,\nnet/sched/sch_taprio.c-2920-\t.owner\t\t= THIS_MODULE,\n"
} |
| 27/3 | 2026/11/06 22:57 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 17275 output: 39 thoughts: 25 Thoughts: Okay, let's dive into these functions, `taprio_dump_tc_entries` and `taprio_parse_tc_entries`. I need to understand how TAPRIO traffic control entries are being handled. My initial thought is that the first function, `taprio_dump_tc_entries`, probably extracts the data, likely by traversing some internal data structure related to traffic control configurations. I'm guessing it might serialize these entries into a human-readable or machine-readable format – perhaps JSON, a custom format, or maybe even raw binary data, depending on the needs of the system it's interfacing with. The output format is key here; it tells me a lot about the intended use of the "dump." Then, `taprio_parse_tc_entries` must be the counterpart to `taprio_dump_tc_entries`. It sounds like it's taking a previously "dumped" representation of TAPRIO traffic control entries and reconstructing them within the kernel or the relevant control plane. I'm expecting it to handle error checking and validation during the parsing process, as well as ensure that the format it's reading conforms to the expected standard. The parsing function's implementation has to correctly interpret the data, reconstruct the TC entries into a suitable internal representation. The correctness of the entries is critical for the function to correctly configure the device with the settings that are provided. I'm particularly interested in how these functions interact. Is there a defined serialization format they adhere to? Are they tightly coupled, or can I swap out different parsing or dumping mechanisms if required? And, of course, are there any potential vulnerabilities or race conditions that I should be looking out for? I'll probably start by looking at the input/output signatures and data structures used, then dive into the actual algorithms for each. This is where the devil's in the details. I expect these will likely be quite nuanced; these functions often involve complex bit manipulation, memory management, and potentially some subtleties related to kernel data structures. |
| 28/3 | 2026/11/06 22:57 | tool | read-file |
0mArgs:{
"File": "net/sched/sch_taprio.c",
"FirstLine": 2065,
"LineCount": 55
}Results: {
"Contents": "2065:\t\t}\n2066:\t\n2067:\t\tif (tb[TCA_TAPRIO_TC_ENTRY_FP])\n2068:\t\t\tfp[tc] = nla_get_u32(tb[TCA_TAPRIO_TC_ENTRY_FP]);\n2069:\t\n2070:\t\treturn 0;\n2071:\t}\n2072:\t\n2073:\tstatic int taprio_parse_tc_entries(struct Qdisc *sch,\n2074:\t\t\t\t\t struct nlattr *opt,\n2075:\t\t\t\t\t u32 max_sdu[TC_MAX_QUEUE],\n2076:\t\t\t\t\t u32 fp[TC_QOPT_MAX_QUEUE],\n2077:\t\t\t\t\t struct netlink_ext_ack *extack)\n2078:\t{\n2079:\t\tstruct taprio_sched *q = qdisc_priv(sch);\n2080:\t\tstruct net_device *dev = qdisc_dev(sch);\n2081:\t\tbool have_preemption = false;\n2082:\t\tunsigned long seen_tcs = 0;\n2083:\t\tstruct nlattr *n;\n2084:\t\tint tc, rem;\n2085:\t\tint err = 0;\n2086:\t\n2087:\t\tfor (tc = 0; tc \u003c TC_QOPT_MAX_QUEUE; tc++) {\n2088:\t\t\tmax_sdu[tc] = q-\u003emax_sdu[tc];\n2089:\t\t\tfp[tc] = q-\u003efp[tc];\n2090:\t\t}\n2091:\t\n2092:\t\tnla_for_each_nested_type(n, TCA_TAPRIO_ATTR_TC_ENTRY, opt, rem) {\n2093:\t\t\terr = taprio_parse_tc_entry(sch, n, max_sdu, fp, \u0026seen_tcs,\n2094:\t\t\t\t\t\t extack);\n2095:\t\t\tif (err)\n2096:\t\t\t\treturn err;\n2097:\t\t}\n2098:\t\n2099:\t\tfor (tc = 0; tc \u003c TC_QOPT_MAX_QUEUE; tc++) {\n2100:\t\t\tif (fp[tc] != TC_FP_EXPRESS)\n2101:\t\t\t\thave_preemption = true;\n2102:\t\t}\n2103:\t\n2104:\t\tif (have_preemption) {\n2105:\t\t\tif (!FULL_OFFLOAD_IS_ENABLED(q-\u003eflags)) {\n2106:\t\t\t\tNL_SET_ERR_MSG(extack,\n2107:\t\t\t\t\t \"Preemption only supported with full offload\");\n2108:\t\t\t\treturn -EOPNOTSUPP;\n2109:\t\t\t}\n2110:\t\n2111:\t\t\tif (!ethtool_dev_mm_supported(dev)) {\n2112:\t\t\t\tNL_SET_ERR_MSG(extack,\n2113:\t\t\t\t\t \"Device does not support preemption\");\n2114:\t\t\t\treturn -EOPNOTSUPP;\n2115:\t\t\t}\n2116:\t\t}\n2117:\t\n2118:\t\treturn 0;\n2119:\t}\n"
} |
| 29/3 | 2026/11/06 22:57 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 18603 output: 44 thoughts: 159 Thoughts: **Investigating Potential Queue Array Bounds Issues in TAPRIO**
Okay, here's what's catching my eye in this `taprio_change` function. I see these two array declarations: `u32 max_sdu[TC_MAX_QUEUE] = { };` and `u32 fp[TC_QOPT_MAX_QUEUE] = { };`. Then, within `taprio_parse_tc_entries`, I'm seeing a loop where we're copying data: `for (tc = 0; tc < TC_QOPT_MAX_QUEUE; tc++) { max_sdu[tc] = q->max_sdu[tc]; fp[tc] = q->fp[tc]; }`.
My initial thought is, *wait a minute*, we have these two constants, `TC_MAX_QUEUE` and `TC_QOPT_MAX_QUEUE`, and they're being used as array bounds. But there's a difference between how these are declared versus how they are used. The loop iterates up to `TC_QOPT_MAX_QUEUE`, but `max_sdu` is only declared with size `TC_MAX_QUEUE`.
This is a red flag. I need to understand what these constants actually mean. It looks like a potential buffer overflow vulnerability. I need to immediately find out the definitions of `TC_MAX_QUEUE` and `TC_QOPT_MAX_QUEUE` to determine if we have a mismatch that could lead to writing out of bounds on `max_sdu`, or `fp`. Time to look those up and figure out if this could be an actual issue!
|
| 30/3 | 2026/11/06 22:57 | tool | grepper |
0mArgs:{
"Expression": "TC_MAX_QUEUE|TC_QOPT_MAX_QUEUE",
"PathPrefixes": [
"include/",
"net/sched/"
]
}Results: {
"Output": "\nFull output is too long, showing 200 out of 216 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (7 files in total):\ninclude/linux/netdevice.h:2\ninclude/net/pkt_sched.h:3\ninclude/uapi/linux/pkt_sched.h:3\nnet/sched/sch_mqprio.c:15\nnet/sched/sch_mqprio_lib.c:3\nnet/sched/sch_mqprio_lib.h:1\nnet/sched/sch_taprio.c:27\n\ninclude/linux/netdevice.h=816=struct xps_dev_maps {\n--\ninclude/linux/netdevice.h-830-\ninclude/linux/netdevice.h:831:#define TC_MAX_QUEUE\t16\ninclude/linux/netdevice.h-832-#define TC_BITMASK\t15\n--\ninclude/linux/netdevice.h=2158=struct net_device {\n--\ninclude/linux/netdevice.h-2186-\tunsigned short\t\tneeded_headroom;\ninclude/linux/netdevice.h:2187:\tstruct netdev_tc_txq\ttc_to_txq[TC_MAX_QUEUE];\ninclude/linux/netdevice.h-2188-#ifdef CONFIG_XPS\n--\ninclude/net/pkt_sched.h=165=struct tc_mqprio_qopt_offload {\n--\ninclude/net/pkt_sched.h-171-\tu32 flags;\ninclude/net/pkt_sched.h:172:\tu64 min_rate[TC_QOPT_MAX_QUEUE];\ninclude/net/pkt_sched.h:173:\tu64 max_rate[TC_QOPT_MAX_QUEUE];\ninclude/net/pkt_sched.h-174-\tunsigned long preemptible_tcs;\n--\ninclude/net/pkt_sched.h=221=struct tc_taprio_qopt_offload {\n--\ninclude/net/pkt_sched.h-235-\t\t\tu64 cycle_time_extension;\ninclude/net/pkt_sched.h:236:\t\t\tu32 max_sdu[TC_MAX_QUEUE];\ninclude/net/pkt_sched.h-237-\n--\ninclude/uapi/linux/pkt_sched.h=592=struct tc_drr_stats {\n--\ninclude/uapi/linux/pkt_sched.h-597-#define TC_QOPT_BITMASK 15\ninclude/uapi/linux/pkt_sched.h:598:#define TC_QOPT_MAX_QUEUE 16\ninclude/uapi/linux/pkt_sched.h-599-\n--\ninclude/uapi/linux/pkt_sched.h=629=struct tc_mqprio_qopt {\n--\ninclude/uapi/linux/pkt_sched.h-632-\t__u8\thw;\ninclude/uapi/linux/pkt_sched.h:633:\t__u16\tcount[TC_QOPT_MAX_QUEUE];\ninclude/uapi/linux/pkt_sched.h:634:\t__u16\toffset[TC_QOPT_MAX_QUEUE];\ninclude/uapi/linux/pkt_sched.h-635-};\n--\nnet/sched/sch_mqprio.c=23=struct mqprio_sched {\n--\nnet/sched/sch_mqprio.c-28-\tu32 flags;\nnet/sched/sch_mqprio.c:29:\tu64 min_rate[TC_QOPT_MAX_QUEUE];\nnet/sched/sch_mqprio.c:30:\tu64 max_rate[TC_QOPT_MAX_QUEUE];\nnet/sched/sch_mqprio.c:31:\tu32 fp[TC_QOPT_MAX_QUEUE];\nnet/sched/sch_mqprio.c-32-};\n--\nnet/sched/sch_mqprio.c=153=nla_policy mqprio_tc_entry_policy[TCA_MQPRIO_TC_ENTRY_MAX + 1] = {\nnet/sched/sch_mqprio.c-154-\t[TCA_MQPRIO_TC_ENTRY_INDEX]\t= NLA_POLICY_MAX(NLA_U32,\nnet/sched/sch_mqprio.c:155:\t\t\t\t\t\t\t TC_QOPT_MAX_QUEUE - 1),\nnet/sched/sch_mqprio.c-156-\t[TCA_MQPRIO_TC_ENTRY_FP]\t= NLA_POLICY_RANGE(NLA_U32,\n--\nnet/sched/sch_mqprio.c=161=static const struct nla_policy mqprio_policy[TCA_MQPRIO_MAX + 1] = {\n--\nnet/sched/sch_mqprio.c-168-\nnet/sched/sch_mqprio.c:169:static int mqprio_parse_tc_entry(u32 fp[TC_QOPT_MAX_QUEUE],\nnet/sched/sch_mqprio.c-170-\t\t\t\t struct nlattr *opt,\n--\nnet/sched/sch_mqprio.c=202=static int mqprio_parse_tc_entries(struct Qdisc *sch, struct nlattr *nlattr_opt,\n--\nnet/sched/sch_mqprio.c-209-\tunsigned long seen_tcs = 0;\nnet/sched/sch_mqprio.c:210:\tu32 fp[TC_QOPT_MAX_QUEUE];\nnet/sched/sch_mqprio.c-211-\tstruct nlattr *n;\n--\nnet/sched/sch_mqprio.c-214-\nnet/sched/sch_mqprio.c:215:\tfor (tc = 0; tc \u003c TC_QOPT_MAX_QUEUE; tc++)\nnet/sched/sch_mqprio.c-216-\t\tfp[tc] = priv-\u003efp[tc];\n--\nnet/sched/sch_mqprio.c-224-\nnet/sched/sch_mqprio.c:225:\tfor (tc = 0; tc \u003c TC_QOPT_MAX_QUEUE; tc++) {\nnet/sched/sch_mqprio.c-226-\t\tpriv-\u003efp[tc] = fp[tc];\n--\nnet/sched/sch_mqprio.c=345=static int mqprio_init(struct Qdisc *sch, struct nlattr *opt,\n--\nnet/sched/sch_mqprio.c-356-\nnet/sched/sch_mqprio.c:357:\tBUILD_BUG_ON(TC_MAX_QUEUE != TC_QOPT_MAX_QUEUE);\nnet/sched/sch_mqprio.c-358-\tBUILD_BUG_ON(TC_BITMASK != TC_QOPT_BITMASK);\n--\nnet/sched/sch_mqprio.c-372-\nnet/sched/sch_mqprio.c:373:\tfor (tc = 0; tc \u003c TC_QOPT_MAX_QUEUE; tc++)\nnet/sched/sch_mqprio.c-374-\t\tpriv-\u003efp[tc] = TC_FP_EXPRESS;\n--\nnet/sched/sch_mqprio.c=525=static int mqprio_dump_tc_entries(struct mqprio_sched *priv,\n--\nnet/sched/sch_mqprio.c-530-\nnet/sched/sch_mqprio.c:531:\tfor (tc = 0; tc \u003c TC_QOPT_MAX_QUEUE; tc++) {\nnet/sched/sch_mqprio.c-532-\t\tn = nla_nest_start(skb, TCA_MQPRIO_TC_ENTRY);\n--\nnet/sched/sch_mqprio.c=721=static void mqprio_walk(struct Qdisc *sch, struct qdisc_walker *arg)\n--\nnet/sched/sch_mqprio.c-736-\t/* Pad the values and skip over unused traffic classes */\nnet/sched/sch_mqprio.c:737:\tif (ntx \u003c TC_MAX_QUEUE) {\nnet/sched/sch_mqprio.c:738:\t\targ-\u003ecount = TC_MAX_QUEUE;\nnet/sched/sch_mqprio.c:739:\t\tntx = TC_MAX_QUEUE;\nnet/sched/sch_mqprio.c-740-\t}\n--\nnet/sched/sch_mqprio.c-742-\t/* Reset offset, sort out remaining per-queue qdiscs */\nnet/sched/sch_mqprio.c:743:\tfor (ntx -= TC_MAX_QUEUE; ntx \u003c dev-\u003enum_tx_queues; ntx++) {\nnet/sched/sch_mqprio.c-744-\t\tif (arg-\u003efn(sch, ntx + 1, arg) \u003c 0) {\n--\nnet/sched/sch_mqprio_lib.c=68=int mqprio_validate_qopt(struct net_device *dev, struct tc_mqprio_qopt *qopt,\n--\nnet/sched/sch_mqprio_lib.c-75-\t/* Verify num_tc is not out of max range */\nnet/sched/sch_mqprio_lib.c:76:\tif (qopt-\u003enum_tc \u003e TC_MAX_QUEUE) {\nnet/sched/sch_mqprio_lib.c-77-\t\tNL_SET_ERR_MSG(extack,\n--\nnet/sched/sch_mqprio_lib.c=119=EXPORT_SYMBOL_GPL(mqprio_qopt_reconstruct);\nnet/sched/sch_mqprio_lib.c-120-\nnet/sched/sch_mqprio_lib.c:121:void mqprio_fp_to_offload(u32 fp[TC_QOPT_MAX_QUEUE],\nnet/sched/sch_mqprio_lib.c-122-\t\t\t struct tc_mqprio_qopt_offload *mqprio)\n--\nnet/sched/sch_mqprio_lib.c-126-\nnet/sched/sch_mqprio_lib.c:127:\tfor (tc = 0; tc \u003c TC_QOPT_MAX_QUEUE; tc++)\nnet/sched/sch_mqprio_lib.c-128-\t\tif (fp[tc] == TC_FP_PREEMPTIBLE)\n--\nnet/sched/sch_mqprio_lib.h=15=void mqprio_qopt_reconstruct(struct net_device *dev,\nnet/sched/sch_mqprio_lib.h-16-\t\t\t struct tc_mqprio_qopt *qopt);\nnet/sched/sch_mqprio_lib.h:17:void mqprio_fp_to_offload(u32 fp[TC_QOPT_MAX_QUEUE],\nnet/sched/sch_mqprio_lib.h-18-\t\t\t struct tc_mqprio_qopt_offload *mqprio);\n--\nnet/sched/sch_taprio.c=56=struct sched_entry {\n--\nnet/sched/sch_taprio.c-59-\t */\nnet/sched/sch_taprio.c:60:\tu64 gate_duration[TC_MAX_QUEUE];\nnet/sched/sch_taprio.c:61:\tatomic_t budget[TC_MAX_QUEUE];\nnet/sched/sch_taprio.c-62-\t/* The qdisc makes some effort so that no packet leaves\n--\nnet/sched/sch_taprio.c-64-\t */\nnet/sched/sch_taprio.c:65:\tktime_t gate_close_time[TC_MAX_QUEUE];\nnet/sched/sch_taprio.c-66-\tstruct list_head list;\n--\nnet/sched/sch_taprio.c=76=struct sched_gate_list {\n--\nnet/sched/sch_taprio.c-79-\t */\nnet/sched/sch_taprio.c:80:\tu64 max_open_gate_duration[TC_MAX_QUEUE];\nnet/sched/sch_taprio.c:81:\tu32 max_frm_len[TC_MAX_QUEUE]; /* for the fast path */\nnet/sched/sch_taprio.c:82:\tu32 max_sdu[TC_MAX_QUEUE]; /* for dump */\nnet/sched/sch_taprio.c-83-\tstruct rcu_head rcu;\n--\nnet/sched/sch_taprio.c=92=struct taprio_sched {\n--\nnet/sched/sch_taprio.c-111-\tstruct list_head taprio_list;\nnet/sched/sch_taprio.c:112:\tint cur_txq[TC_MAX_QUEUE];\nnet/sched/sch_taprio.c:113:\tu32 max_sdu[TC_MAX_QUEUE]; /* save info from the user */\nnet/sched/sch_taprio.c:114:\tu32 fp[TC_QOPT_MAX_QUEUE]; /* only for dump and offloading */\nnet/sched/sch_taprio.c-115-\tu32 txtime_delay;\n--\nnet/sched/sch_taprio.c=285=static void taprio_update_queue_max_sdu(struct taprio_sched *q,\n--\nnet/sched/sch_taprio.c-287-\t\t\t\t\tstruct qdisc_size_table *stab,\nnet/sched/sch_taprio.c:288:\t\t\t\t\tconst u32 max_sdu_user[TC_MAX_QUEUE],\nnet/sched/sch_taprio.c-289-\t\t\t\t\tint num_tc)\n--\nnet/sched/sch_taprio.c=1262=static const struct nla_policy taprio_tc_policy[TCA_TAPRIO_TC_ENTRY_MAX + 1] = {\nnet/sched/sch_taprio.c-1263-\t[TCA_TAPRIO_TC_ENTRY_INDEX]\t = NLA_POLICY_MAX(NLA_U32,\nnet/sched/sch_taprio.c:1264:\t\t\t\t\t\t\t TC_QOPT_MAX_QUEUE - 1),\nnet/sched/sch_taprio.c-1265-\t[TCA_TAPRIO_TC_ENTRY_MAX_SDU]\t = { .type = NLA_U32 },\n--\nnet/sched/sch_taprio.c=1835=static int taprio_enable_offload(struct net_device *dev,\n--\nnet/sched/sch_taprio.c-1838-\t\t\t\t const struct tc_mqprio_qopt *mqprio,\nnet/sched/sch_taprio.c:1839:\t\t\t\t const u32 max_sdu[TC_MAX_QUEUE],\nnet/sched/sch_taprio.c:1840:\t\t\t\t u32 fp[TC_QOPT_MAX_QUEUE],\nnet/sched/sch_taprio.c-1841-\t\t\t\t struct netlink_ext_ack *extack)\n--\nnet/sched/sch_taprio.c-1857-\tif (!caps.supports_queue_max_sdu) {\nnet/sched/sch_taprio.c:1858:\t\tfor (tc = 0; tc \u003c TC_MAX_QUEUE; tc++) {\nnet/sched/sch_taprio.c-1859-\t\t\tif (max_sdu[tc]) {\n--\nnet/sched/sch_taprio.c-1882-\nnet/sched/sch_taprio.c:1883:\tfor (tc = 0; tc \u003c TC_MAX_QUEUE; tc++)\nnet/sched/sch_taprio.c-1884-\t\toffload-\u003emax_sdu[tc] = max_sdu[tc];\n--\nnet/sched/sch_taprio.c=2026=static int taprio_parse_tc_entry(struct Qdisc *sch,\nnet/sched/sch_taprio.c-2027-\t\t\t\t struct nlattr *opt,\nnet/sched/sch_taprio.c:2028:\t\t\t\t u32 max_sdu[TC_QOPT_MAX_QUEUE],\nnet/sched/sch_taprio.c:2029:\t\t\t\t u32 fp[TC_QOPT_MAX_QUEUE],\nnet/sched/sch_taprio.c-2030-\t\t\t\t unsigned long *seen_tcs,\n--\nnet/sched/sch_taprio.c=2073=static int taprio_parse_tc_entries(struct Qdisc *sch,\nnet/sched/sch_taprio.c-2074-\t\t\t\t struct nlattr *opt,\nnet/sched/sch_taprio.c:2075:\t\t\t\t u32 max_sdu[TC_MAX_QUEUE],\nnet/sched/sch_taprio.c:2076:\t\t\t\t u32 fp[TC_QOPT_MAX_QUEUE],\nnet/sched/sch_taprio.c-2077-\t\t\t\t struct netlink_ext_ack *extack)\n--\nnet/sched/sch_taprio.c-2086-\nnet/sched/sch_taprio.c:2087:\tfor (tc = 0; tc \u003c TC_QOPT_MAX_QUEUE; tc++) {\nnet/sched/sch_taprio.c-2088-\t\tmax_sdu[tc] = q-\u003emax_sdu[tc];\n--\nnet/sched/sch_taprio.c-2098-\nnet/sched/sch_taprio.c:2099:\tfor (tc = 0; tc \u003c TC_QOPT_MAX_QUEUE; tc++) {\nnet/sched/sch_taprio.c-2100-\t\tif (fp[tc] != TC_FP_EXPRESS)\n--\nnet/sched/sch_taprio.c=2145=static int taprio_change(struct Qdisc *sch, struct nlattr *opt,\n--\nnet/sched/sch_taprio.c-2153-\tstruct tc_mqprio_qopt *mqprio = NULL;\nnet/sched/sch_taprio.c:2154:\tu32 max_sdu[TC_MAX_QUEUE] = { };\nnet/sched/sch_taprio.c:2155:\tu32 fp[TC_QOPT_MAX_QUEUE] = { };\nnet/sched/sch_taprio.c-2156-\tbool initial_setup, tc_configured = false;\n--\nnet/sched/sch_taprio.c-2307-\n\n"
} |
| 31/3 | 2026/11/06 22:57 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 23856 output: 39 thoughts: 335 Thoughts: **Analyzing TAPRIO Queue Initialization and Schedule Parsing**
Okay, so I'm looking at how the TAPRIO queue parameters are set up and how the scheduling information is parsed and applied. My initial observation is that `TC_MAX_QUEUE` and `TC_QOPT_MAX_QUEUE` are both defined as 16. That makes the array sizes easily understood for the purposes of the rest of the code.
In `taprio_change`, I see that `max_sdu` and `fp` arrays, both of size 16, are declared with explicit zero initialization: `= { };`. This is good, ensuring a clean slate. Then, `taprio_parse_tc_entries` is called. This function *overwrites* any pre-existing values using data from `q->max_sdu` and `q->fp`. Effectively, it's copying values into these arrays. Finally, at line 2307, `taprio_change` writes these potentially modified values back to the queue parameters using `WRITE_ONCE`. So, initialization is complete with these steps.
Now, my focus shifts to understanding how the actual schedule is parsed and the impact of the entries being allocated and modified. To that end, I need to delve into `parse_taprio_schedule` within `sch_taprio.c`. This is where the core logic of schedule interpretation should reside, and is the key to any security implications.
|
| 32/3 | 2026/11/06 22:57 | tool | read-file |
0mArgs:{
"File": "net/sched/sch_taprio.c",
"FirstLine": 1380,
"LineCount": 90
}Results: {
"Contents": "1380:\t\n1381:\t\treturn i;\n1382:\t}\n1383:\t\n1384:\tstatic int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb,\n1385:\t\t\t\t\t struct sched_gate_list *new,\n1386:\t\t\t\t\t struct netlink_ext_ack *extack)\n1387:\t{\n1388:\t\tint min_duration = taprio_min_interval(q);\n1389:\t\tstruct sched_entry *entry, *n;\n1390:\t\ts64 elapsed = 0;\n1391:\t\tint err = 0;\n1392:\t\tint i = 0;\n1393:\t\n1394:\t\tif (tb[TCA_TAPRIO_ATTR_SCHED_SINGLE_ENTRY]) {\n1395:\t\t\tNL_SET_ERR_MSG(extack, \"Adding a single entry is not supported\");\n1396:\t\t\treturn -ENOTSUPP;\n1397:\t\t}\n1398:\t\n1399:\t\tif (tb[TCA_TAPRIO_ATTR_SCHED_BASE_TIME])\n1400:\t\t\tnew-\u003ebase_time = nla_get_s64(tb[TCA_TAPRIO_ATTR_SCHED_BASE_TIME]);\n1401:\t\n1402:\t\tif (tb[TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION])\n1403:\t\t\tnew-\u003ecycle_time_extension = nla_get_s64(tb[TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION]);\n1404:\t\n1405:\t\tif (tb[TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME])\n1406:\t\t\tnew-\u003ecycle_time = nla_get_s64(tb[TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME]);\n1407:\t\n1408:\t\tif (tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST])\n1409:\t\t\terr = parse_sched_list(q, tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST],\n1410:\t\t\t\t\t new, extack);\n1411:\t\tif (err \u003c 0)\n1412:\t\t\treturn err;\n1413:\t\n1414:\t\tif (list_empty(\u0026new-\u003eentries)) {\n1415:\t\t\tNL_SET_ERR_MSG(extack, \"There should be at least one entry in the schedule\");\n1416:\t\t\treturn -EINVAL;\n1417:\t\t}\n1418:\t\n1419:\t\tif (!new-\u003ecycle_time) {\n1420:\t\t\tktime_t cycle = 0;\n1421:\t\n1422:\t\t\tlist_for_each_entry(entry, \u0026new-\u003eentries, list)\n1423:\t\t\t\tcycle = ktime_add_ns(cycle, entry-\u003einterval);\n1424:\t\n1425:\t\t\tif (cycle \u003c 0 || cycle \u003e INT_MAX) {\n1426:\t\t\t\tNL_SET_ERR_MSG(extack, \"'cycle_time' is too big\");\n1427:\t\t\t\treturn -EINVAL;\n1428:\t\t\t}\n1429:\t\n1430:\t\t\tnew-\u003ecycle_time = cycle;\n1431:\t\t}\n1432:\t\n1433:\t\tif (new-\u003ecycle_time \u003c min_duration) {\n1434:\t\t\tNL_SET_ERR_MSG(extack, \"'cycle_time' is too small\");\n1435:\t\t\treturn -EINVAL;\n1436:\t\t}\n1437:\t\n1438:\t\tlist_for_each_entry_safe(entry, n, \u0026new-\u003eentries, list) {\n1439:\t\t\tif (elapsed \u003e= new-\u003ecycle_time) {\n1440:\t\t\t\tlist_del(\u0026entry-\u003elist);\n1441:\t\t\t\tkfree(entry);\n1442:\t\t\t\tnew-\u003enum_entries--;\n1443:\t\t\t\tcontinue;\n1444:\t\t\t}\n1445:\t\n1446:\t\t\tif (elapsed + entry-\u003einterval \u003e new-\u003ecycle_time) {\n1447:\t\t\t\tentry-\u003einterval = new-\u003ecycle_time - elapsed;\n1448:\t\t\t\telapsed = new-\u003ecycle_time;\n1449:\t\t\t} else {\n1450:\t\t\t\telapsed += entry-\u003einterval;\n1451:\t\t\t}\n1452:\t\t}\n1453:\t\n1454:\t\tif (list_empty(\u0026new-\u003eentries)) {\n1455:\t\t\tNL_SET_ERR_MSG(extack, \"There should be at least one entry in the schedule\");\n1456:\t\t\treturn -EINVAL;\n1457:\t\t}\n1458:\t\n1459:\t\tif (elapsed \u003c new-\u003ecycle_time) {\n1460:\t\t\tentry = list_last_entry(\u0026new-\u003eentries, struct sched_entry, list);\n1461:\t\t\tentry-\u003einterval += new-\u003ecycle_time - elapsed;\n1462:\t\t}\n1463:\t\n1464:\t\tlist_for_each_entry(entry, \u0026new-\u003eentries, list) {\n1465:\t\t\tif (entry-\u003einterval \u003c min_duration) {\n1466:\t\t\t\tNL_SET_ERR_MSG(extack, \"Invalid interval for schedule entry\");\n1467:\t\t\t\treturn -EINVAL;\n1468:\t\t\t}\n1469:\t\t\tentry-\u003eindex = i++;\n"
} |
| 33/3 | 2026/11/06 22:57 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 25960 output: 36 thoughts: 37 Thoughts: Okay, let's dive into this `parse_sched_list` function. My main concern right now is understanding how `struct sched_entry` instances are actually created and managed within it. I need to trace the allocation process, understand where these structures are coming from. The core question is: how are these things getting on the list, and ultimately, how is memory managed in this particular part of the code? Let's go through the code step by step and trace what happens in `parse_sched_list`. |
| 34/3 | 2026/11/06 22:57 | tool | grepper |
0mArgs:{
"Expression": "parse_sched_list",
"PathPrefixes": [
"net/sched/sch_taprio.c"
]
}Results: {
"Output": "net/sched/sch_taprio.c=1325=static int parse_sched_entry(struct taprio_sched *q, struct nlattr *n,\n--\nnet/sched/sch_taprio.c-1343-\nnet/sched/sch_taprio.c:1344:static int parse_sched_list(struct taprio_sched *q, struct nlattr *list,\nnet/sched/sch_taprio.c-1345-\t\t\t struct sched_gate_list *sched,\n--\nnet/sched/sch_taprio.c=1384=static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb,\n--\nnet/sched/sch_taprio.c-1408-\tif (tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST])\nnet/sched/sch_taprio.c:1409:\t\terr = parse_sched_list(q, tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST],\nnet/sched/sch_taprio.c-1410-\t\t\t\t new, extack);\n"
} |
| 35/3 | 2026/11/06 22:57 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 26428 output: 39 thoughts: 19 Thoughts: Okay, here's my take on those functions, thinking through it as you asked: **Analyzing `parse_sched_entry` and `parse_sched_list`** Alright, let's dive into these functions. I'm going to carefully read `parse_sched_entry` and `parse_sched_list`. The core of any scheduling system hinges on effectively interpreting and managing these kinds of data structures, so this is where the action is. I want to understand how they’re approaching the parsing process. Are they using a state machine? Regular expressions? Tokenizing? What's the error handling like? How robust is the input validation? I'm particularly interested in how they handle edge cases – malformed entries, missing fields, unexpected formats. Any shortcuts or clever tricks? Efficiency is key, so I'll be keeping an eye on the complexity of the parsing algorithms. I'll be looking for potential bottlenecks. The interface and data structures being employed will also need careful consideration, since there are many ways of approaching this task. I want to see how these functions fit into the larger scheduling framework – are they tightly coupled, or designed for modularity? Good parsing is essential to the health of the scheduler, so I'm paying close attention to these building blocks. Let's see what's what. |
| 36/3 | 2026/11/06 22:58 | tool | read-file |
0mArgs:{
"File": "net/sched/sch_taprio.c",
"FirstLine": 1320,
"LineCount": 50
}Results: {
"Contents": "1320:\t\tentry-\u003einterval = interval;\n1321:\t\n1322:\t\treturn 0;\n1323:\t}\n1324:\t\n1325:\tstatic int parse_sched_entry(struct taprio_sched *q, struct nlattr *n,\n1326:\t\t\t\t struct sched_entry *entry, int index,\n1327:\t\t\t\t struct netlink_ext_ack *extack)\n1328:\t{\n1329:\t\tstruct nlattr *tb[TCA_TAPRIO_SCHED_ENTRY_MAX + 1] = { };\n1330:\t\tint err;\n1331:\t\n1332:\t\terr = nla_parse_nested_deprecated(tb, TCA_TAPRIO_SCHED_ENTRY_MAX, n,\n1333:\t\t\t\t\t\t entry_policy, NULL);\n1334:\t\tif (err \u003c 0) {\n1335:\t\t\tNL_SET_ERR_MSG(extack, \"Could not parse nested entry\");\n1336:\t\t\treturn -EINVAL;\n1337:\t\t}\n1338:\t\n1339:\t\tentry-\u003eindex = index;\n1340:\t\n1341:\t\treturn fill_sched_entry(q, tb, entry, extack);\n1342:\t}\n1343:\t\n1344:\tstatic int parse_sched_list(struct taprio_sched *q, struct nlattr *list,\n1345:\t\t\t\t struct sched_gate_list *sched,\n1346:\t\t\t\t struct netlink_ext_ack *extack)\n1347:\t{\n1348:\t\tstruct nlattr *n;\n1349:\t\tint err, rem;\n1350:\t\tint i = 0;\n1351:\t\n1352:\t\tif (!list)\n1353:\t\t\treturn -EINVAL;\n1354:\t\n1355:\t\tnla_for_each_nested(n, list, rem) {\n1356:\t\t\tstruct sched_entry *entry;\n1357:\t\n1358:\t\t\tif (nla_type(n) != TCA_TAPRIO_SCHED_ENTRY) {\n1359:\t\t\t\tNL_SET_ERR_MSG(extack, \"Attribute is not of type 'entry'\");\n1360:\t\t\t\tcontinue;\n1361:\t\t\t}\n1362:\t\n1363:\t\t\tentry = kzalloc_obj(*entry);\n1364:\t\t\tif (!entry) {\n1365:\t\t\t\tNL_SET_ERR_MSG(extack, \"Not enough memory for entry\");\n1366:\t\t\t\treturn -ENOMEM;\n1367:\t\t\t}\n1368:\t\n1369:\t\t\terr = parse_sched_entry(q, n, entry, i, extack);\n"
} |
| 37/3 | 2026/11/06 22:58 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 27494 output: 40 thoughts: 62 Thoughts: Here's my analysis of the provided code snippet: **Memory Allocation Concerns** Okay, so I see `kzalloc_obj(*entry)` being used to allocate memory for `entry`, which is standard practice for zero-initializing the memory. Similarly, `new_admin = kzalloc_obj(*new_admin);` is doing the same thing for `new_admin`. That's good; it confirms that we're properly initializing those data structures. Now, the question that pops into my head is, what's happening within `taprio_calculate_gate_durations`? It's critical to ensure that function doesn't rely on uninitialized memory or have any hidden allocation/deallocation issues within its logic. I need to take a closer look at that function to confirm it's memory-safe. Let's dig into that and make sure it's all handled cleanly and without leaks. |
| 38/3 | 2026/11/06 22:58 | tool | grepper |
0mArgs:{
"Expression": "taprio_calculate_gate_durations",
"PathPrefixes": [
"net/sched/sch_taprio.c"
]
}Results: {
"Output": "net/sched/sch_taprio.c=118=struct __tc_taprio_qopt_offload {\n--\nnet/sched/sch_taprio.c-122-\nnet/sched/sch_taprio.c:123:static void taprio_calculate_gate_durations(struct taprio_sched *q,\nnet/sched/sch_taprio.c-124-\t\t\t\t\t struct sched_gate_list *sched,\n--\nnet/sched/sch_taprio.c=2145=static int taprio_change(struct Qdisc *sch, struct nlattr *opt,\n--\nnet/sched/sch_taprio.c-2258-\nnet/sched/sch_taprio.c:2259:\ttaprio_calculate_gate_durations(q, new_admin, num_tc);\nnet/sched/sch_taprio.c-2260-\n"
} |
| 39/3 | 2026/11/06 22:58 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 28022 output: 38 thoughts: 22 Thoughts: Okay, let's dive into this code. **Analyzing `taprio_calculate_gate_durations`** Alright, I need to get a handle on this `taprio_calculate_gate_durations` function. I see it starts around line 123. Given my experience, I'm expecting this function to be the core logic for determining the durations of gates, likely within the TAPRIO (Time-Aware Priority and Reservation) scheduling context. I'll need to understand how it takes inputs – probably some sort of task or flow characteristics, timing parameters, and possibly reservation configurations. The output, of course, *should* be the calculated gate durations. I'll be looking closely at how it handles potential timing constraints, and how it deals with the specific intricacies of TAPRIO's priority and reservation schemes to ensure correct results. I'll mentally map out the key variables being used, making sure there aren't any obvious integer overflows or floating-point precision issues lurking about. Let's see if the code makes the best use of any optimization techniques, in a well-defined format, without any unneeded steps. |
| 40/3 | 2026/11/06 22:58 | tool | read-file |
0mArgs:{
"File": "net/sched/sch_taprio.c",
"FirstLine": 120,
"LineCount": 50
}Results: {
"Contents": " 120:\t\tstruct tc_taprio_qopt_offload offload;\n 121:\t};\n 122:\t\n 123:\tstatic void taprio_calculate_gate_durations(struct taprio_sched *q,\n 124:\t\t\t\t\t\t struct sched_gate_list *sched,\n 125:\t\t\t\t\t\t int num_tc)\n 126:\t{\n 127:\t\tstruct sched_entry *entry, *cur;\n 128:\t\tint tc;\n 129:\t\n 130:\t\tlist_for_each_entry(entry, \u0026sched-\u003eentries, list) {\n 131:\t\t\tu32 gates_still_open = entry-\u003egate_mask;\n 132:\t\n 133:\t\t\t/* For each traffic class, calculate each open gate duration,\n 134:\t\t\t * starting at this schedule entry and ending at the schedule\n 135:\t\t\t * entry containing a gate close event for that TC.\n 136:\t\t\t */\n 137:\t\t\tcur = entry;\n 138:\t\n 139:\t\t\tdo {\n 140:\t\t\t\tif (!gates_still_open)\n 141:\t\t\t\t\tbreak;\n 142:\t\n 143:\t\t\t\tfor (tc = 0; tc \u003c num_tc; tc++) {\n 144:\t\t\t\t\tif (!(gates_still_open \u0026 BIT(tc)))\n 145:\t\t\t\t\t\tcontinue;\n 146:\t\n 147:\t\t\t\t\tif (cur-\u003egate_mask \u0026 BIT(tc))\n 148:\t\t\t\t\t\tentry-\u003egate_duration[tc] += cur-\u003einterval;\n 149:\t\t\t\t\telse\n 150:\t\t\t\t\t\tgates_still_open \u0026= ~BIT(tc);\n 151:\t\t\t\t}\n 152:\t\n 153:\t\t\t\tcur = list_next_entry_circular(cur, \u0026sched-\u003eentries, list);\n 154:\t\t\t} while (cur != entry);\n 155:\t\n 156:\t\t\t/* Keep track of the maximum gate duration for each traffic\n 157:\t\t\t * class, taking care to not confuse a traffic class which is\n 158:\t\t\t * temporarily closed with one that is always closed.\n 159:\t\t\t */\n 160:\t\t\tfor (tc = 0; tc \u003c num_tc; tc++)\n 161:\t\t\t\tif (entry-\u003egate_duration[tc] \u0026\u0026\n 162:\t\t\t\t sched-\u003emax_open_gate_duration[tc] \u003c entry-\u003egate_duration[tc])\n 163:\t\t\t\t\tsched-\u003emax_open_gate_duration[tc] = entry-\u003egate_duration[tc];\n 164:\t\t}\n 165:\t}\n 166:\t\n 167:\tstatic bool taprio_entry_allows_tx(ktime_t skb_end_time,\n 168:\t\t\t\t\t struct sched_entry *entry, int tc)\n 169:\t{\n"
} |
| 41/3 | 2026/11/06 22:58 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 29066 output: 38 thoughts: 197 Thoughts: Okay, let me break this down. **Analyzing the `taprio_change` Patch: A Deep Dive** Right, so I'm looking at this `taprio_change` function and immediately I see a crucial shift. Before, it seems `taprio_calculate_gate_durations` was buried *inside* `parse_taprio_schedule`. And the crucial thing is, it was getting called *before* `num_tc` was correctly initialized and passed. Now, the patch has wisely moved `taprio_calculate_gate_durations` to *after* the `num_tc` determination. We're now setting `num_tc` using either `mqprio` or `netdev_get_num_tc(dev)`, and *then* passing it explicitly to `taprio_calculate_gate_durations`. The code now looks like this: `num_tc = mqprio ? mqprio->num_tc : netdev_get_num_tc(dev);` `taprio_calculate_gate_durations(q, new_admin, num_tc);` `taprio_update_queue_max_sdu(q, new_admin, stab, max_sdu, num_tc);` Excellent! This is a good change. The implications are significant, it means that `taprio_calculate_gate_durations` is now getting accurate data for `num_tc`. It seems this was likely a bug fix and, ideally, should improve timing calculations, reducing potential issues related to traffic control gate scheduling. Now, my next question is whether `taprio_update_queue_max_sdu` also benefits from this updated `num_tc`. It's receiving `num_tc` as well. I'm going to dig into the implementation of that function, as that's the next logical step to understand the full impact of this change. Let's see how `num_tc` is actually *used* within `taprio_update_queue_max_sdu` to determine if any of the assumptions in the previous call have carried through. |
| 42/3 | 2026/11/06 22:58 | tool | read-file |
0mArgs:{
"File": "net/sched/sch_taprio.c",
"FirstLine": 285,
"LineCount": 40
}Results: {
"Contents": " 285:\tstatic void taprio_update_queue_max_sdu(struct taprio_sched *q,\n 286:\t\t\t\t\t\tstruct sched_gate_list *sched,\n 287:\t\t\t\t\t\tstruct qdisc_size_table *stab,\n 288:\t\t\t\t\t\tconst u32 max_sdu_user[TC_MAX_QUEUE],\n 289:\t\t\t\t\t\tint num_tc)\n 290:\t{\n 291:\t\tstruct net_device *dev = qdisc_dev(q-\u003eroot);\n 292:\t\tu32 max_sdu_from_user;\n 293:\t\tu32 max_sdu_dynamic;\n 294:\t\tu32 max_sdu;\n 295:\t\tint tc;\n 296:\t\n 297:\t\tfor (tc = 0; tc \u003c num_tc; tc++) {\n 298:\t\t\tmax_sdu_from_user = max_sdu_user[tc] ?: U32_MAX;\n 299:\t\n 300:\t\t\t/* TC gate never closes =\u003e keep the queueMaxSDU\n 301:\t\t\t * selected by the user\n 302:\t\t\t */\n 303:\t\t\tif (sched-\u003emax_open_gate_duration[tc] == sched-\u003ecycle_time) {\n 304:\t\t\t\tmax_sdu_dynamic = U32_MAX;\n 305:\t\t\t} else {\n 306:\t\t\t\tu32 max_frm_len;\n 307:\t\n 308:\t\t\t\tmax_frm_len = duration_to_length(q, sched-\u003emax_open_gate_duration[tc]);\n 309:\t\t\t\t/* Compensate for L1 overhead from size table,\n 310:\t\t\t\t * but don't let the frame size go negative\n 311:\t\t\t\t */\n 312:\t\t\t\tif (stab) {\n 313:\t\t\t\t\tmax_frm_len -= stab-\u003eszopts.overhead;\n 314:\t\t\t\t\tmax_frm_len = max_t(int, max_frm_len,\n 315:\t\t\t\t\t\t\t dev-\u003ehard_header_len + 1);\n 316:\t\t\t\t}\n 317:\t\t\t\tmax_sdu_dynamic = max_frm_len - dev-\u003ehard_header_len;\n 318:\t\t\t\tif (max_sdu_dynamic \u003e dev-\u003emax_mtu)\n 319:\t\t\t\t\tmax_sdu_dynamic = U32_MAX;\n 320:\t\t\t}\n 321:\t\n 322:\t\t\tmax_sdu = min(max_sdu_dynamic, max_sdu_from_user);\n 323:\t\n 324:\t\t\tif (max_sdu != U32_MAX) {\n"
} |
| 43/3 | 2026/11/06 22:58 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 30455 output: 39 thoughts: 51 Thoughts: Here's my take on those thoughts: **Analyzing the TAPRIO Dump Process** Okay, so I need to understand how the `taprio_dump` function handles things like `max_sdu` and the `fp` values. My instinct is that I should dive into the code and see exactly how those are being extracted and formatted. Specifically, I'll be looking at the functions `taprio_dump_tc_entries` and `taprio_dump`. Those seem like the logical places where the specific details of the Traffic Class (TC) entries would be output. I want to see what kind of data structures they're using and if there's any implicit information that needs unpacking. Time to start digging! |
| 44/3 | 2026/11/06 22:58 | tool | read-file |
0mArgs:{
"File": "net/sched/sch_taprio.c",
"FirstLine": 2650,
"LineCount": 45
}Results: {
"Contents": "2650:\t\treturn -1;\n2651:\t}\n2652:\t\n2653:\tstatic int taprio_dump_tc_entries(struct sk_buff *skb,\n2654:\t\t\t\t\t const struct taprio_sched *q,\n2655:\t\t\t\t\t const struct sched_gate_list *sched)\n2656:\t{\n2657:\t\tstruct nlattr *n;\n2658:\t\tint tc;\n2659:\t\n2660:\t\tfor (tc = 0; tc \u003c TC_MAX_QUEUE; tc++) {\n2661:\t\t\tn = nla_nest_start(skb, TCA_TAPRIO_ATTR_TC_ENTRY);\n2662:\t\t\tif (!n)\n2663:\t\t\t\treturn -EMSGSIZE;\n2664:\t\n2665:\t\t\tif (nla_put_u32(skb, TCA_TAPRIO_TC_ENTRY_INDEX, tc))\n2666:\t\t\t\tgoto nla_put_failure;\n2667:\t\n2668:\t\t\tif (nla_put_u32(skb, TCA_TAPRIO_TC_ENTRY_MAX_SDU,\n2669:\t\t\t\t\tREAD_ONCE(sched-\u003emax_sdu[tc])))\n2670:\t\t\t\tgoto nla_put_failure;\n2671:\t\n2672:\t\t\tif (nla_put_u32(skb, TCA_TAPRIO_TC_ENTRY_FP,\n2673:\t\t\t\t\tREAD_ONCE(q-\u003efp[tc])))\n2674:\t\t\t\tgoto nla_put_failure;\n2675:\t\n2676:\t\t\tnla_nest_end(skb, n);\n2677:\t\t}\n2678:\t\n2679:\t\treturn 0;\n2680:\t\n2681:\tnla_put_failure:\n2682:\t\tnla_nest_cancel(skb, n);\n2683:\t\treturn -EMSGSIZE;\n2684:\t}\n2685:\t\n2686:\tstatic int taprio_put_stat(struct sk_buff *skb, u64 val, u16 attrtype)\n2687:\t{\n2688:\t\tif (val == TAPRIO_STAT_NOT_SET)\n2689:\t\t\treturn 0;\n2690:\t\tif (nla_put_u64_64bit(skb, attrtype, val, TCA_TAPRIO_OFFLOAD_STATS_PAD))\n2691:\t\t\treturn -EMSGSIZE;\n2692:\t\treturn 0;\n2693:\t}\n2694:\t\n"
} |
| 45/3 | 2026/11/06 22:58 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 31395 output: 35 thoughts: 81 Thoughts: Here's my thought process, as an expert in this area: **Deconstructing the Data Structures in Taprio** Okay, so I'm digging into how `sched->max_sdu` and `q->fp` are handled in this `taprio` code. I need to understand where these critical fields are allocated and initialized. Let's see... I've established that `sched->max_sdu` is nestled inside `struct sched_gate_list`, and that struct was created using `kzalloc_obj` applied to `*new_admin`. That means we're dealing with memory that's zeroed out initially, which is generally a good sign for preventing unexpected garbage values, but still needs to be initialized. On the other hand, `q->fp` is a field within `q`, and `q` itself got allocated by `kzalloc` when the qdisc was initialized. The code specifically mentions that `taprio_change` handles the initialization of `q->fp`. So, it's not a default zero state here, we're likely setting it up dynamically based on configuration. To get a clearer picture of how these fields are set up, I should take a look at the `taprio_init` function. It seems like the natural next step. I'll check how the system is put together. |
| 46/3 | 2026/11/06 22:58 | tool | grepper |
0mArgs:{
"Expression": "taprio_init",
"PathPrefixes": [
"net/sched/sch_taprio.c"
]
}Results: {
"Output": "net/sched/sch_taprio.c=2391=static void taprio_destroy(struct Qdisc *sch)\n--\nnet/sched/sch_taprio.c-2400-\t/* Note that taprio_reset() might not be called if an error\nnet/sched/sch_taprio.c:2401:\t * happens in qdisc_create(), after taprio_init() has been called.\nnet/sched/sch_taprio.c-2402-\t */\n--\nnet/sched/sch_taprio.c-2430-\nnet/sched/sch_taprio.c:2431:static int taprio_init(struct Qdisc *sch, struct nlattr *opt,\nnet/sched/sch_taprio.c-2432-\t\t struct netlink_ext_ack *extack)\n--\nnet/sched/sch_taprio.c=2906=static struct Qdisc_ops taprio_qdisc_ops __read_mostly = {\n--\nnet/sched/sch_taprio.c-2909-\t.priv_size\t= sizeof(struct taprio_sched),\nnet/sched/sch_taprio.c:2910:\t.init\t\t= taprio_init,\nnet/sched/sch_taprio.c-2911-\t.change\t\t= taprio_change,\n"
} |
| 47/3 | 2026/11/06 22:58 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 32140 output: 39 thoughts: 54 Thoughts: Okay, here's my interpretation of that thought process, assuming I'm already quite familiar with the kernel's traffic control (tc) and scheduler infrastructure: **Diving into Taprio's Initialization** Alright, so `priv_size` is directly linked to the size of `struct taprio_sched`. That much is straightforward. I need to refresh my memory on exactly how `tc qdisc` allocates memory. Right, `qdisc_alloc` uses `kzalloc`, which means it allocates memory for both the generic `qdisc` structure *and* the private data (`priv`) all in one go, and initializes it to zero. I should double-check that this allocation strategy is indeed what `taprio_init` expects. Let me quickly jump into that function and verify that the `priv` pointer is being handled correctly within the `taprio_sched` context. No surprises there, but it's always good to confirm assumptions about memory layout when dealing with `tc qdisc` code. |
| 48/3 | 2026/11/06 22:58 | tool | read-file |
0mArgs:{
"File": "net/sched/sch_taprio.c",
"FirstLine": 2430,
"LineCount": 45
}Results: {
"Contents": "2430:\t\n2431:\tstatic int taprio_init(struct Qdisc *sch, struct nlattr *opt,\n2432:\t\t\t struct netlink_ext_ack *extack)\n2433:\t{\n2434:\t\tstruct taprio_sched *q = qdisc_priv(sch);\n2435:\t\tstruct net_device *dev = qdisc_dev(sch);\n2436:\t\tint i, tc;\n2437:\t\n2438:\t\tspin_lock_init(\u0026q-\u003ecurrent_entry_lock);\n2439:\t\n2440:\t\thrtimer_setup(\u0026q-\u003eadvance_timer, advance_sched, CLOCK_TAI, HRTIMER_MODE_ABS);\n2441:\t\n2442:\t\tq-\u003eroot = sch;\n2443:\t\n2444:\t\t/* We only support static clockids. Use an invalid value as default\n2445:\t\t * and get the valid one on taprio_change().\n2446:\t\t */\n2447:\t\tq-\u003eclockid = -1;\n2448:\t\tq-\u003eflags = TAPRIO_FLAGS_INVALID;\n2449:\t\n2450:\t\tlist_add(\u0026q-\u003etaprio_list, \u0026taprio_list);\n2451:\t\n2452:\t\tif (sch-\u003eparent != TC_H_ROOT) {\n2453:\t\t\tNL_SET_ERR_MSG_MOD(extack, \"Can only be attached as root qdisc\");\n2454:\t\t\treturn -EOPNOTSUPP;\n2455:\t\t}\n2456:\t\n2457:\t\tif (!netif_is_multiqueue(dev)) {\n2458:\t\t\tNL_SET_ERR_MSG_MOD(extack, \"Multi-queue device is required\");\n2459:\t\t\treturn -EOPNOTSUPP;\n2460:\t\t}\n2461:\t\n2462:\t\tq-\u003eqdiscs = kzalloc_objs(q-\u003eqdiscs[0], dev-\u003enum_tx_queues);\n2463:\t\tif (!q-\u003eqdiscs)\n2464:\t\t\treturn -ENOMEM;\n2465:\t\n2466:\t\tif (!opt)\n2467:\t\t\treturn -EINVAL;\n2468:\t\n2469:\t\tfor (i = 0; i \u003c dev-\u003enum_tx_queues; i++) {\n2470:\t\t\tstruct netdev_queue *dev_queue;\n2471:\t\t\tstruct Qdisc *qdisc;\n2472:\t\n2473:\t\t\tdev_queue = netdev_get_tx_queue(dev, i);\n2474:\t\t\tqdisc = qdisc_create_dflt(dev_queue,\n"
} |
| 49/3 | 2026/11/06 22:58 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 33162 output: 39 thoughts: 18 Thoughts: Okay, here's the summary, rendered as if I am the one thinking it, tailored for an expert audience: **Focused Review of Specific Code Lines** Alright, I need to zoom in on a particular section. My intuition is telling me to double-check lines 2475 through 2510. It's likely this area contains the crucial logic or a potential point of failure. Time to meticulously dissect the code within that range. I'll be looking for any edge cases, unexpected interactions, or deviations from the expected behavior. My years of experience tell me this warrants more than a cursory glance. Let's see what gems or issues lie within this specific block. |
| 50/3 | 2026/11/06 22:58 | tool | read-file |
0mArgs:{
"File": "net/sched/sch_taprio.c",
"FirstLine": 2475,
"LineCount": 40
}Results: {
"Contents": "2475:\t\t\t\t\t\t \u0026pfifo_qdisc_ops,\n2476:\t\t\t\t\t\t TC_H_MAKE(TC_H_MAJ(sch-\u003ehandle),\n2477:\t\t\t\t\t\t\t TC_H_MIN(i + 1)),\n2478:\t\t\t\t\t\t extack);\n2479:\t\t\tif (!qdisc)\n2480:\t\t\t\treturn -ENOMEM;\n2481:\t\n2482:\t\t\tif (i \u003c dev-\u003ereal_num_tx_queues)\n2483:\t\t\t\tqdisc_hash_add(qdisc, false);\n2484:\t\n2485:\t\t\tq-\u003eqdiscs[i] = qdisc;\n2486:\t\t}\n2487:\t\n2488:\t\tfor (tc = 0; tc \u003c TC_QOPT_MAX_QUEUE; tc++)\n2489:\t\t\tq-\u003efp[tc] = TC_FP_EXPRESS;\n2490:\t\n2491:\t\ttaprio_detect_broken_mqprio(q);\n2492:\t\n2493:\t\treturn taprio_change(sch, opt, extack);\n2494:\t}\n2495:\t\n2496:\tstatic void taprio_attach(struct Qdisc *sch)\n2497:\t{\n2498:\t\tstruct taprio_sched *q = qdisc_priv(sch);\n2499:\t\tstruct net_device *dev = qdisc_dev(sch);\n2500:\t\tunsigned int ntx;\n2501:\t\n2502:\t\t/* Attach underlying qdisc */\n2503:\t\tfor (ntx = 0; ntx \u003c dev-\u003enum_tx_queues; ntx++) {\n2504:\t\t\tstruct netdev_queue *dev_queue = netdev_get_tx_queue(dev, ntx);\n2505:\t\t\tstruct Qdisc *old, *dev_queue_qdisc;\n2506:\t\n2507:\t\t\tif (FULL_OFFLOAD_IS_ENABLED(q-\u003eflags)) {\n2508:\t\t\t\tstruct Qdisc *qdisc = q-\u003eqdiscs[ntx];\n2509:\t\n2510:\t\t\t\t/* In offload mode, the root taprio qdisc is bypassed\n2511:\t\t\t\t * and the netdev TX queues see the children directly\n2512:\t\t\t\t */\n2513:\t\t\t\tqdisc-\u003eflags |= TCQ_F_ONETXQUEUE | TCQ_F_NOPARENT;\n2514:\t\t\t\tdev_queue_qdisc = qdisc;\n"
} |
| 51/3 | 2026/11/06 22:58 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 34020 output: 36 thoughts: 1183 Thoughts: **Analyzing the TAPRIO Diff: A Quick Audit** Okay, let's break down these changes methodically. I need to make sure this diff doesn't introduce any subtle regressions or potential issues, especially related to timing or data integrity. First, `taprio_calculate_gate_durations` got a new argument, `num_tc`. Right away, I'm thinking about the implications. It's used in the loop, so I need to verify how `num_tc` is set. Looks like it's derived either from `mqprio` (and validated) or `netdev_get_num_tc(dev)`. The loop now iterates from `0` to `num_tc - 1`. However, `entry->gate_duration[tc]` has a size of `TC_MAX_QUEUE`. This raises a flag: what happens if `num_tc` is *less* than `TC_MAX_QUEUE`? Are we initializing the entire array, or only up to `num_tc`? The initial allocation via `kzalloc_obj` seems to zero out all fields, so that's good, but it still means we are potentially writing only up to `num_tc` entries, which might be a source of problems in some edge cases. I'll need to check where `gate_close_time` is read to be sure. `taprio_min_interval` is a straightforward calculation. Reads `q->picos_per_byte` via `atomic64_read`, so no immediate concerns there. `taprio_update_queue_max_sdu` has also received the argument `num_tc`. We are passing `max_sdu` to it in `taprio_change`. Inside the function, a loop iterates up to `num_tc`. The code checks the values passed to it using the ternary operator. No concerns with uninitialized memory. `find_entry_to_transmit` has a few `ktime_t` comparisons. It seems the code is correctly using these timestamps. It looks safe. `is_valid_interval` also involves comparisons with timestamps, which appear properly initialized and handled. `get_packet_txtime` is about scheduling logic, so I'll need a deeper look later, but nothing immediately jumps out. `should_restart_cycle` uses `ktime_compare` on the end times, and it looks safe. `should_change_schedules` has a new null check on `admin` and `oper`, which is good defensive programming, preventing potential dereference of NULL pointers. Finally, `taprio_set_entry_state` seems similar to `taprio_calculate_gate_durations`, it calculates `gate_close_time`. Similar to the previous case, inside this function we are iterating from `0` to `num_tc`. This means that `gate_close_time` and `end_time` are calculated for the first `num_tc` TCs, and the budgets are also set. Again, the question is: what is the use case of `gate_close_time` for any `tc >= num_tc`? I must check where this array is accessed and how it is used. This is a potential issue I want to address before signing off on this diff. I will focus my further analysis on where `gate_close_time` is read. |
| 52/3 | 2026/11/06 22:58 | tool | grepper |
0mArgs:{
"Expression": "gate_close_time",
"PathPrefixes": [
"net/sched/sch_taprio.c"
]
}Results: {
"Output": "net/sched/sch_taprio.c=56=struct sched_entry {\n--\nnet/sched/sch_taprio.c-64-\t */\nnet/sched/sch_taprio.c:65:\tktime_t gate_close_time[TC_MAX_QUEUE];\nnet/sched/sch_taprio.c-66-\tstruct list_head list;\n--\nnet/sched/sch_taprio.c=167=static bool taprio_entry_allows_tx(ktime_t skb_end_time,\n--\nnet/sched/sch_taprio.c-169-{\nnet/sched/sch_taprio.c:170:\treturn ktime_before(skb_end_time, entry-\u003egate_close_time[tc]);\nnet/sched/sch_taprio.c-171-}\n--\nnet/sched/sch_taprio.c=946=static void taprio_set_entry_state(struct taprio_sched *q,\n--\nnet/sched/sch_taprio.c-956-\t\tif (next-\u003egate_duration[tc] == oper-\u003ecycle_time)\nnet/sched/sch_taprio.c:957:\t\t\tnext-\u003egate_close_time[tc] = KTIME_MAX;\nnet/sched/sch_taprio.c-958-\t\telse\nnet/sched/sch_taprio.c:959:\t\t\tnext-\u003egate_close_time[tc] = ktime_add_ns(cur_start,\nnet/sched/sch_taprio.c-960-\t\t\t\t\t\t\t\t next-\u003egate_duration[tc]);\n--\nnet/sched/sch_taprio.c=1538=static void setup_first_end_time(struct taprio_sched *q,\n--\nnet/sched/sch_taprio.c-1559-\t\tif (first-\u003egate_duration[tc] == sched-\u003ecycle_time)\nnet/sched/sch_taprio.c:1560:\t\t\tfirst-\u003egate_close_time[tc] = KTIME_MAX;\nnet/sched/sch_taprio.c-1561-\t\telse\nnet/sched/sch_taprio.c:1562:\t\t\tfirst-\u003egate_close_time[tc] = ktime_add_ns(base, first-\u003egate_duration[tc]);\nnet/sched/sch_taprio.c-1563-\t}\n"
} |
| 53/3 | 2026/11/06 22:58 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 36566 output: 36 thoughts: 1515 Thoughts: **My Analysis of TAPRIO Scheduler Code** Okay, let's break down this TAPRIO scheduler code piece by piece, ensuring everything is properly initialized and handled, particularly around time-related variables and schedule switching. First, I'm confident about the validity of traffic class `tc` values passed to `taprio_entry_allows_tx`. It appears they're always derived from a valid source, either from the device or skb prio. Also, since entries are allocated with `kzalloc_obj`, the `gate_close_time[tc]` values are inherently zero, and are properly updated for valid TCs. I recall a previous iteration where all TCs were iterated in a loop, and then factored that code into `taprio_set_entry_state`, which streamlined the logic. Next, I examined `taprio_advance_one_entry`, seeing that it correctly handles pointers and updates them in place, which is expected. `taprio_sync_sched_to_time` is also straightforward; its local variables `entry`, `next`, `cur_start`, and `end_time` are all initialized as they should be. The conditional branches and the subsequent loop ensure that `next` and `end_time` are reliably assigned before being returned via the pointers. Now, looking at `taprio_fast_forward_sched`, I see that `next` and `end_time` are correctly set by `taprio_sync_sched_to_time`. The surrounding logic correctly handles schedule switching (`switch_schedules`), based on appropriate time comparisons. I then turned my attention to the `advance_sched` function. Here, `end_time` is always properly initialized, regardless of whether a current entry exists, and is then passed to `hrtimer_set_expires`. It seems there's no risk of reading uninitialized values here. In `parse_taprio_schedule`, I verify that after trimming/modification, intervals are adjusted, and deleted entries are freed using `kfree`, preventing any memory leaks or unexpected states. Finally, I checked `qopt_tc_map_to_queue_mask`, confirming `queue_mask` is initialized to zero, and that the `qopt` structure is either valid or reconstructed as needed. Also, I made a mental note to check where `offload` is allocated, since `taprio_enable_offload` sets `offload->mqprio.qopt` either directly or indirectly, and I wanted to ensure this memory is properly managed. Let's make sure `taprio_enable_offload` is checked! |
| 54/3 | 2026/11/06 22:59 | tool | grepper |
0mArgs:{
"Expression": "kzalloc.*offload",
"PathPrefixes": [
"net/sched/sch_taprio.c"
]
}Results: {
"Output": "net/sched/sch_taprio.c=1675=static struct tc_taprio_qopt_offload *taprio_offload_alloc(int num_entries)\n--\nnet/sched/sch_taprio.c-1678-\nnet/sched/sch_taprio.c:1679:\t__offload = kzalloc_flex(*__offload, offload.entries, num_entries);\nnet/sched/sch_taprio.c-1680-\tif (!__offload)\n"
} |
| 55/3 | 2026/11/06 22:59 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 38809 output: 34 thoughts: 479 Thoughts: **Analyzing `taprio_change` and Data Exposure** Okay, so `taprio_offload_alloc` is using `kzalloc_flex`, meaning anything allocated for the offload is fully zeroed out, which is good. Now, let's dive into `taprio_change`. I want to see if there are any potential vulnerabilities there. First, I see the declaration of a bunch of variables: `mqprio`, `max_sdu`, `fp`, `initial_setup`, `tc_configured`, `old_tk_offset`, `old_clockid`, `num_tc`, `i`, `err`, `flags`, `taprio_flags`, `old_flags`, `start`. It looks like we're setting up the context for a change to the Taprio scheduler. We're getting pointers to `oper_sched` and `admin_sched`, and setting `initial_setup` based on whether they are set. `old_flags`, `old_clockid`, and `old_tk_offset` are initialized right at the start. I'm noting that if an error happens before `taprio_get_start_time`, the `start` variable doesn't get used. In the error handling section labeled `free_sched`, if there's an error, we revert the configuration changes. Specifically, if it's the `initial_setup` phase and there was an offload attempt, we disable it. Then, we reset the TC configuration and revert `q->flags`, `q->clockid`, and `q->tk_offset` to their old values. So it looks like everything is rolled back correctly on error. Now, the crucial question: are we copying any data to userspace in this process? I need to check `dump_schedule`. This is the place where potentially sensitive data could be leaked through netlink dumps. I'll need to analyze `dump_schedule` next. |
| 56/3 | 2026/11/06 22:59 | tool | grepper |
0mArgs:{
"Expression": "dump_schedule",
"PathPrefixes": [
"net/sched/sch_taprio.c"
]
}Results: {
"Output": "net/sched/sch_taprio.c=2587=static int dump_entry(struct sk_buff *msg,\n--\nnet/sched/sch_taprio.c-2616-\nnet/sched/sch_taprio.c:2617:static int dump_schedule(struct sk_buff *msg,\nnet/sched/sch_taprio.c-2618-\t\t\t const struct sched_gate_list *root)\n--\nnet/sched/sch_taprio.c=2752=static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb)\n--\nnet/sched/sch_taprio.c-2789-\nnet/sched/sch_taprio.c:2790:\tif (oper \u0026\u0026 dump_schedule(skb, oper))\nnet/sched/sch_taprio.c-2791-\t\tgoto options_error_rcu;\n--\nnet/sched/sch_taprio.c-2799-\nnet/sched/sch_taprio.c:2800:\tif (dump_schedule(skb, admin))\nnet/sched/sch_taprio.c-2801-\t\tgoto admin_error;\n"
} |
| 57/3 | 2026/11/06 22:59 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 40042 output: 39 thoughts: 15 Thoughts: Okay, here's my interpretation of those thoughts, tailored for an expert audience, and delivered as a first-person summary: **Initial Assessment and Methodical Approach** Alright, so the first step is clear: I'm diving into `dump_schedule` and `dump_entry`. My mind's immediately mapping out the potential landscape. I'm expecting `dump_schedule` to likely handle the overall scheduling metadata – things like runtimes, priorities, perhaps dependencies between tasks, maybe some logging configurations, and of course where the actual entries live. `dump_entry`, on the other hand, is probably more granular. I anticipate it'll deal with individual task details: its specific command or function to execute, its input data, where the output goes, status flags, and possibly any error handling specifics. I'm curious to see how the two interact; the scheduling information will surely drive the individual entries, but might the entries report status back up to the schedule? I'll be looking for concurrency handling too. |
| 58/3 | 2026/11/06 22:59 | tool | read-file |
0mArgs:{
"File": "net/sched/sch_taprio.c",
"FirstLine": 2585,
"LineCount": 50
}Results: {
"Contents": "2585:\t}\n2586:\t\n2587:\tstatic int dump_entry(struct sk_buff *msg,\n2588:\t\t\t const struct sched_entry *entry)\n2589:\t{\n2590:\t\tstruct nlattr *item;\n2591:\t\n2592:\t\titem = nla_nest_start_noflag(msg, TCA_TAPRIO_SCHED_ENTRY);\n2593:\t\tif (!item)\n2594:\t\t\treturn -ENOSPC;\n2595:\t\n2596:\t\tif (nla_put_u32(msg, TCA_TAPRIO_SCHED_ENTRY_INDEX, entry-\u003eindex))\n2597:\t\t\tgoto nla_put_failure;\n2598:\t\n2599:\t\tif (nla_put_u8(msg, TCA_TAPRIO_SCHED_ENTRY_CMD, entry-\u003ecommand))\n2600:\t\t\tgoto nla_put_failure;\n2601:\t\n2602:\t\tif (nla_put_u32(msg, TCA_TAPRIO_SCHED_ENTRY_GATE_MASK,\n2603:\t\t\t\tentry-\u003egate_mask))\n2604:\t\t\tgoto nla_put_failure;\n2605:\t\n2606:\t\tif (nla_put_u32(msg, TCA_TAPRIO_SCHED_ENTRY_INTERVAL,\n2607:\t\t\t\tentry-\u003einterval))\n2608:\t\t\tgoto nla_put_failure;\n2609:\t\n2610:\t\treturn nla_nest_end(msg, item);\n2611:\t\n2612:\tnla_put_failure:\n2613:\t\tnla_nest_cancel(msg, item);\n2614:\t\treturn -1;\n2615:\t}\n2616:\t\n2617:\tstatic int dump_schedule(struct sk_buff *msg,\n2618:\t\t\t\t const struct sched_gate_list *root)\n2619:\t{\n2620:\t\tstruct nlattr *entry_list;\n2621:\t\tstruct sched_entry *entry;\n2622:\t\n2623:\t\tif (nla_put_s64(msg, TCA_TAPRIO_ATTR_SCHED_BASE_TIME,\n2624:\t\t\t\troot-\u003ebase_time, TCA_TAPRIO_PAD))\n2625:\t\t\treturn -1;\n2626:\t\n2627:\t\tif (nla_put_s64(msg, TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME,\n2628:\t\t\t\troot-\u003ecycle_time, TCA_TAPRIO_PAD))\n2629:\t\t\treturn -1;\n2630:\t\n2631:\t\tif (nla_put_s64(msg, TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION,\n2632:\t\t\t\troot-\u003ecycle_time_extension, TCA_TAPRIO_PAD))\n2633:\t\t\treturn -1;\n2634:\t\n"
} |
| 59/3 | 2026/11/06 22:59 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 41096 output: 319 thoughts: 817 Thoughts: **KMSAN Needs Analysis for Taprio Scheduler Patch Series** Okay, let's break this down. My analysis indicates that this patch series, focusing on improvements to the taprio scheduler, doesn't warrant enabling KMSAN. Here's my reasoning, and I need to make it crystal clear. First, I looked at the core changes. This series touches on interval validation, fast-forwarding the schedule, error handling with rollback and cleanup, and decoupling/validating TC and queue configurations. Nothing inherently sounds like an uninitialized memory issue, but I have to be thorough. I went through the KMSAN criteria methodically: 1. **User-Space Data:** Absolutely no raw kernel structures are being copied directly to user space. Netlink communication handles this carefully, using `nla_put_*` calls for individual fields (`u32`, `s64`, etc.). There are no struct padding landmines here. Any local arrays used (like `max_sdu`, `fp` in `taprio_change`) are properly value-initialized and then copied into `q` which itself was zeroed using `kzalloc`. Clean. 2. **Conditional Logic:** The code relies on variables being fully initialized before use in conditional branches. I carefully reviewed the logic with timestamps, booleans, error codes, and structure pointers. All variables used in branching are assigned values. 3. **Data Structure Initialization:** I checked how these modifications deal with allocations. Everything new and modified uses `kzalloc_obj`, which is a rock-solid method for zeroing memory. No risk of reading uninitialized fields from newly allocated structures. 4. **Bounds Checks & Memory Access:** The code changes schedule timing checks, adds a software minimum interval check, fast-forwards schedules, re-indexes entries, and handles traffic classes / mqprio rollback. The code is carefully designed and does not introduce any access to uninitialized buffer memory. So, I don't see any KMSAN-specific vulnerabilities in these areas. The kinds of issues I *do* see a potential for - deadlocks/spinlock problems, timer/scheduling loops/arithmetic overflow, out-of-bounds/use-after-free list manipulations, and memory leaks - are all caught by existing KASAN, LOCKDEP, UBSAN, and KMEMLEAK. KMSAN's focus is on those uninitialized memory reads or leaks to userspace. I don't see them here. Therefore, `NeedsKMSAN=false` is correct. The patches touch `nla_put_*` on specific fields, all allocation is zero-initialized and any other bugs would be caught by existing debug tools. This reasoning is sound. Now, let's prepare the reasoning clearly so I can call `set-results`. |
| 60/3 | 2026/11/06 22:59 | tool | set-results |
0mArgs:{
"KMSANReasoning": "The patch series modifies the taprio qdisc (net/sched/sch_taprio.c) to improve interval validation (enforcing a minimum interval in software mode to avoid hrtimer storms), handle schedule fast-forwarding when timers lag behind, fix cleanup/rollback on configuration failures, and safely stage queue/traffic-class configurations.\n\nThere are no uninitialized memory risks or kernel-to-user info-leaks introduced or exposed by these changes:\n1. No uninitialized memory is exported to user space. Netlink dump paths emit scalar fields individually via nla_put_* helpers. Stack arrays introduced in taprio_change (max_sdu and fp) are explicitly zero-initialized (`= { }`) before being populated and written to the qdisc state.\n2. Control flow variables (such as timestamps, loop limits, and gate entry pointers) are strictly initialized before use in condition checks and time comparisons.\n3. Heap allocations for schedule entries and gate lists continue to be allocated with zeroed memory (kzalloc_obj).\n4. Potential bugs related to list management, timer expiry handling, state cleanup, or offload callbacks fall strictly into the domain of KASAN (use-after-free, out-of-bounds), LOCKDEP (locking/deadlock), or UBSAN, which are already covered by standard KASAN fuzzing. Dedicated KMSAN fuzzing is not justified.",
"NeedsKMSAN": false
}Results: {
"KMSANReasoning": "The patch series modifies the taprio qdisc (net/sched/sch_taprio.c) to improve interval validation (enforcing a minimum interval in software mode to avoid hrtimer storms), handle schedule fast-forwarding when timers lag behind, fix cleanup/rollback on configuration failures, and safely stage queue/traffic-class configurations.\n\nThere are no uninitialized memory risks or kernel-to-user info-leaks introduced or exposed by these changes:\n1. No uninitialized memory is exported to user space. Netlink dump paths emit scalar fields individually via nla_put_* helpers. Stack arrays introduced in taprio_change (max_sdu and fp) are explicitly zero-initialized (`= { }`) before being populated and written to the qdisc state.\n2. Control flow variables (such as timestamps, loop limits, and gate entry pointers) are strictly initialized before use in condition checks and time comparisons.\n3. Heap allocations for schedule entries and gate lists continue to be allocated with zeroed memory (kzalloc_obj).\n4. Potential bugs related to list management, timer expiry handling, state cleanup, or offload callbacks fall strictly into the domain of KASAN (use-after-free, out-of-bounds), LOCKDEP (locking/deadlock), or UBSAN, which are already covered by standard KASAN fuzzing. Dedicated KMSAN fuzzing is not justified.",
"NeedsKMSAN": false
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|