From: w15303746062 <w15303746062@163.com>
To: maarten.lankhorst@linux.intel.com, mripard@kernel.org,
tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch
Cc: zack.rusin@broadcom.com, bcm-kernel-feedback-list@broadcom.com,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org,
"Mingyu Wang" <25181214217@stu.xidian.edu.cn>
Subject: Re:Re:[PATCH v2] drm/vblank: Reject 0-period timers to prevent hrtimer storm
Date: Mon, 27 Jul 2026 14:51:34 +0800 (CST) [thread overview]
Message-ID: <238fcbf9.514c.19fa257da64.Coremail.w15303746062@163.com> (raw)
In-Reply-To: <33239270.5344.19e9683e439.Coremail.w15303746062@163.com>
Hi Maarten, Maxime, Thomas, and all,
Resending this v2 patch as it has been a while since the submission
(May 23) and my previous ping (June 5).
This patch addresses an hrtimer storm and RCU stall issue in the DRM core
triggered by malformed userspace display modes. Since it just adds a
straightforward sanity check, the impact on existing code is minimal.
Could anyone please take a look when you have a moment?
Best regards,
Mingyu
>At 2026-05-23 10:54:47, w15303746062@163.com wrote:
>>From: Mingyu Wang <25181214217@stu.xidian.edu.cn>
>>
>>Fuzzers like Syzkaller can submit extremely malicious display modes
>>through DRM_IOCTL_MODE_SETCRTC. If userspace passes a mode with a
>>massive pixel clock (crtc_clock) and small resolution (htotal/vtotal),
>>the integer division in drm_calc_timestamping_constants() truncates
>>the resulting frame duration (vblank->framedur_ns) to 0.
>>
>>When virtual display drivers (such as vmwgfx or vkms) rely on the DRM
>>core's software vblank simulation, drm_crtc_vblank_start_timer() is
>>called. It blindly converts this 0-ns framedur_ns into a ktime interval
>>and starts the hrtimer. An hrtimer with a 0-period fires instantly and
>>continuously. Since hrtimer_forward_now() cannot advance time for a
>>0-period, the CPU gets locked in an infinite hard-IRQ loop, starving
>>the system and causing massive RCU stalls.
>>
>>Fix this DoS vulnerability by adding a defensive sanity check in
>>drm_crtc_vblank_start_timer() to reject a 0-ns frame duration, allowing
>>the DRM core to gracefully reject the malicious mode.
>>
>>Signed-off-by: Mingyu Wang <25181214217@stu.xidian.edu.cn>
>>---
>>Changes in v2:
>>- Moved the defensive check from vmwgfx to drm_vblank.c. The timer
>> logic was refactored into the DRM core, so placing the check here
>> protects all drivers relying on the core software vblank timer.
>>- Dropped WARN_ON_ONCE() to prevent unprivileged userspace from easily
>> triggering kernel panics on systems with panic_on_warn enabled.
>>
>> drivers/gpu/drm/drm_vblank.c | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>>diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
>>index f90fb2d13e42..b38d0b30a651 100644
>>--- a/drivers/gpu/drm/drm_vblank.c
>>+++ b/drivers/gpu/drm/drm_vblank.c
>>@@ -2241,6 +2241,16 @@ int drm_crtc_vblank_start_timer(struct drm_crtc *crtc)
>>
>> drm_calc_timestamping_constants(crtc, &crtc->mode);
>>
>>+ /*
>>+ * DEFENSIVE CHECK:
>>+ * drm_calc_timestamping_constants() truncates framedur_ns to 0 if
>>+ * userspace provides a malicious mode with a huge crtc_clock and
>>+ * small htotal/vtotal. Prevent an infinite hard-IRQ loop from a
>>+ * 0-period hrtimer by rejecting such modes.
>>+ */
>>+ if (unlikely(vblank->framedur_ns == 0))
>>+ return -EINVAL;
>>+
>> spin_lock_irqsave(&vtimer->interval_lock, flags);
>> vtimer->interval = ns_to_ktime(vblank->framedur_ns);
>> spin_unlock_irqrestore(&vtimer->interval_lock, flags);
>>--
>>2.34.1
prev parent reply other threads:[~2026-07-27 6:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 7:17 [PATCH] drm/vmwgfx: Fix hrtimer interrupt storm due to 0-period vblank w15303746062
2026-05-22 8:22 ` Thomas Zimmermann
2026-05-23 2:54 ` [PATCH v2] drm/vblank: Reject 0-period timers to prevent hrtimer storm w15303746062
2026-06-05 6:41 ` w15303746062
2026-07-27 6:51 ` w15303746062 [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=238fcbf9.514c.19fa257da64.Coremail.w15303746062@163.com \
--to=w15303746062@163.com \
--cc=25181214217@stu.xidian.edu.cn \
--cc=airlied@gmail.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=stable@vger.kernel.org \
--cc=tzimmermann@suse.de \
--cc=zack.rusin@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®