From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.71 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796299182; b=HYNh1NYtMTrCORv6+1RseEzs3aq0OhbvchQg3wxqcD93PO6VrHfnKj0rjIi5QYjExfyV OFArquLM6b65+lxraWSaj5igyBqgrf5BxI8nrf8vDjAxQHHnMbXe5Sff+m8g+KZm4YLx/ IiJv1kDpwCIw8yDDdADSYnR7AGkEavoAe7ucyEH4cHj5vnAsfDo01re9nPDM4l6NcuECt CAVujyDyLQzI50hNnipTewpoclszQpyEkWpScmQQmcyeNRp3dg0Bbjn1dnRzvH1/2IU5A qHSbQ33NwYdFpGU5E9OoGKS6EoNo4plpY0w2kAc6RyDwTFtMKJrI2vgfp2R+8y7GmNA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796299182; h=DMARC-Filter:Received:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:MIME-Version:X-Received:Date:In-Reply-To: X-Google-Appengine-App-Id:X-Google-Appengine-App-Id-Alias:Message-ID: Subject:From:To:Cc:Content-Type; bh=m92ZRGzyGsw4a0pi/Afv1PxQ0e9BaFUpYjgN4UB2SPA=; b=pQ71IRGXMDbyvWNT8jGhoY40q7xEQrQp6ilNzVk/EC3VEjsw6/SwOUms5PwOK9JxEbfe nybef+y8yKefBhRyS+2oZPZVa7qtivn7o80ESNWSO6vyJeJNB6ejoljOEZDub1wU2szAj T6NxcNBmGMPwaI0vJscHEpMrrSYrVYgBD2996A+ABW6mAwgTbXON8Ql+PmlYd/a4FnOUq 1Nlwj3Xqdu4qMhvqsXuZm2+MLht80F08pQQaOQMs8TToTYQll+pwxtu9lEJaTGvGKji+x QbUgPqqJ+Mo0uox/cHk8Ne94LyVO/FZALA6ISeuS0XA/8PqJKamrOGthhaLcKAf1sFQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.remote-ip=209.85.160.71 Received: from mail-oa1-f71.google.com (mail-oa1-f71.google.com [209.85.160.71]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 442D8606A32F for ; Thu, 3 Dec 2026 11:59:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 442D8606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oa1-f71.google.com with SMTP id 586e51a60fabf-448d51840c4so8909098fac.1 for ; Thu, 03 Dec 2026 03:59:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796299180; x=1796903980; h=content-type:cc:to:from:subject:message-id:in-reply-to:date :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=m92ZRGzyGsw4a0pi/Afv1PxQ0e9BaFUpYjgN4UB2SPA=; b=eqz+ELwYHezdPt1no23M6tXbT34RLseKJIm5ZvpIS6e29X/LTm7o/nVesRSouewV/S yg+ZWm/5Q/zS9Flpm6xnNQGwQKdqu99T5D147ySEWwmzYvs7JWaMw2zV0Jry7Q5B1rmA QJwlMNFyHFlGrCR91WbAAdbrR6RsqOILGh3pL378Tl0Nuk4x5HLPCU3DmTmelbysibju q8MPPG/0jdUlin/odPpySOkiuquCYjI0uG8h20yWA+qHcuRdodyXbaW98R2dqfMcO2UO GVro45bWzvjIUPTqjViGFA3dId/Ffq7z+y8ZLHaFcAx1hmQUQTRs6ZGs70phnsYTOUzF jzFw== X-Forwarded-Encrypted: i=1; AL+hErF0BeKnMH2ptRkCmH4S6pB4uB0tdyzbzWLFFIKtsfLuf0ubWwQ/fZyml/JW3WzLJGvYfxuUeLOMj8Tjzbk=@vger.kernel.org X-Gm-Message-State: APuU4Z+dlUaTOsw9mzecrztAyMHlWgpDfFlnzw5TNBjMrE7DTJs0aoDA Lb34x4w3ZQ+cjJxoZ5+NljxL1LjSBPnYGiKuK/pL1tgh1lrJkTXhHR0tbWJF2sZ36EL3dLsE3Ht lCIndxos4IFRU0rigCpbrfnZha9Id2f8e8D/krBYlrQYCT1kOIDV2O5aY2JU= X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-Received: by 2002:a05:6820:5709:10b0:71a:f119:9c1c with SMTP id 006d021491bc7-71b3920f378mr26360944eaf.11.1796299180264; Thu, 03 Dec 2026 03:59:40 -0800 (PST) Date: Thu, 03 Dec 2026 03:59:40 -0800 In-Reply-To: <98324f0c-b0de-46e4-9a0f-88cb22766568@gmail.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6b1159ac.8744ccba.1c9cf9.00d1.GAE@google.com> Subject: Re: [PATCH RFC] net/sched: taprio: fix RCU stall due to small schedule intervals From: syzbot To: krystianmkaniewski@gmail.com Cc: krystianmkaniewski@gmail.com, syzbot@kernel.org, syzbot@lists.linux.dev, syzkaller-upstream-moderation@googlegroups.com, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" > On 5/22/26 09:30, syzbot wrote: >> The taprio qdisc allows configuring schedule intervals that are >> physically valid for high-speed links but are far too small for the >> software hrtimer subsystem to handle. For example, at 10 Gbps, the >> minimum duration for a 60-byte frame is 48 nanoseconds. If a user >> configures an interval of 255 nanoseconds, it passes the physical >> validation check. >> >> However, the execution overhead of the hrtimer interrupt itself is >> typically much larger than 255 nanoseconds. When the hrtimer fires, >> advance_sched() calculates the next end_time by adding the interval to >> the previous end_time. Because this advancement is smaller than the >> interrupt overhead, the newly calculated end_time is still in the past. >> When advance_sched() returns HRTIMER_RESTART, the hrtimer subsystem sees >> the timer is already expired and executes it again immediately. The >> timer never catches up to the current time, trapping the CPU in an >> infinite hrtimer interrupt loop and causing an RCU stall. >> >> Fix this by introducing a two-fold solution. First, in advance_sched(), >> introduce a loop to advance the schedule until the calculated end_time >> is strictly in the future. This ensures that if the hrtimer fires late, >> it will skip over schedule entries that are already in the past instead >> of blindly advancing by a single entry. Second, in fill_sched_entry(), >> enforce a minimum interval of 1 microsecond (NSEC_PER_USEC) when >> software scheduling is used. This prevents users from configuring >> schedules that the software cannot physically keep up with, avoiding >> excessive CPU time spent in the interrupt handler. >> >> Fixes: 5a781ccbd19e ("tc: Add support for configuring the taprio scheduler") >> Assisted-by: Gemini:gemini-3.1-pro-preview Gemini:gemini-3-flash-preview syzbot >> Reported-by: syzbot+2e90866706ad999df132@syzkaller.appspotmail.com >> Closes: https://syzkaller.appspot.com/bug?extid=2e90866706ad999df132 >> Link: https://syzkaller.appspot.com/ai_job?id=a76df798-c9cc-4943-937d-81102e228a11 >> To: "David S. Miller" >> To: "Eric Dumazet" >> To: "Jamal Hadi Salim" >> To: "Jiri Pirko" >> To: "Jakub Kicinski" >> To: >> To: "Paolo Abeni" >> To: "Vinicius Costa Gomes" >> Cc: "Simon Horman" >> Cc: >> >> --- >> diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c >> index 45245157e..9e298b0cf 100644 >> --- a/net/sched/sch_taprio.c >> +++ b/net/sched/sch_taprio.c >> @@ -925,6 +925,7 @@ static enum hrtimer_restart advance_sched(struct hrtimer *timer) >> struct sched_entry *entry, *next; >> struct Qdisc *sch = q->root; >> ktime_t end_time; >> + ktime_t now; >> int tc; >> >> spin_lock(&q->current_entry_lock); >> @@ -951,36 +952,44 @@ static enum hrtimer_restart advance_sched(struct hrtimer *timer) >> goto first_run; >> } >> >> - 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); >> - } >> + now = taprio_get_time(q); >> >> - end_time = ktime_add_ns(entry->end_time, next->interval); >> - end_time = min_t(ktime_t, end_time, oper->cycle_end_time); >> + do { >> + 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); >> + } >> >> - 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]); >> - } >> + end_time = ktime_add_ns(entry->end_time, 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); >> - /* 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; >> - } >> + 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]); >> + } >> + >> + 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; >> + } >> + >> + next->end_time = end_time; >> + entry = next; >> + } while (unlikely(ktime_compare(end_time, now) <= 0)); >> >> - next->end_time = end_time; >> taprio_set_budgets(q, oper, next); >> >> first_run: >> @@ -1061,6 +1070,13 @@ static int fill_sched_entry(struct taprio_sched *q, struct nlattr **tb, >> return -EINVAL; >> } >> >> + /* hrtimers cannot keep up with very small intervals */ >> + if (!FULL_OFFLOAD_IS_ENABLED(q->flags) && interval < NSEC_PER_USEC) { >> + NL_SET_ERR_MSG(extack, >> + "Invalid interval for software schedule entry"); >> + return -EINVAL; >> + } >> + >> entry->interval = interval; >> >> return 0; >> >> >> base-commit: 5200f5f493f79f14bbdc349e402a40dfb32f23c8 > #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git 7a48731e43e33ee28cb714654e9fb180b19c18ee Patch testing via #syz test is temporarily disabled. See https://github.com/google/syzkaller/issues/8122 for details. > > -- > Krystian Kaniewski > > -- > You received this message because you are subscribed to the Google Groups "syzkaller-upstream-moderation" group. > To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-upstream-moderation+unsubscribe@googlegroups.com. > To view this discussion visit https://groups.google.com/d/msgid/syzkaller-upstream-moderation/98324f0c-b0de-46e4-9a0f-88cb22766568%40gmail.com.