From: sashiko-bot@kernel.org
To: "Thomas Zimmermann" <tzimmermann@suse.de>
Cc: intel-xe@lists.freedesktop.org, ojeda@kernel.org,
linux-hyperv@vger.kernel.org, Frank.Li@kernel.org,
intel-gfx@lists.freedesktop.org,
wsa+renesas@sang-engineering.com,
dri-devel@lists.freedesktop.org, imx@lists.linux.dev
Subject: Re: [PATCH 06/12] drm/panic: Pass global module parameters to drm_panic_dispatch()
Date: Tue, 18 Aug 2026 13:09:15 +0000 [thread overview]
Message-ID: <20260818130916.110771F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260818125012.468092-7-tzimmermann@suse.de>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Concurrent debugfs writes or KUnit tests across multiple DRM devices race on global static buffers without adequate synchronization.
--
--- Patch [6]: [PATCH 06/12] drm/panic: Pass global module parameters to drm_panic_dispatch() ---
commit 9f2a1b5158feac614c09a17c83f387591642e034
Author: Thomas Zimmermann <tzimmermann@suse.de>
drm/panic: Pass global module parameters to drm_panic_dispatch()
This patch sets the panic type and QR version in draw_panic_plane() as a single
point of truth, passing these values into the individual drawing functions.
In the test case, it always creates a QR code with version 40.
> diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c
> index ede620b27515a..12c39217cbcb5 100644
> --- a/drivers/gpu/drm/drm_panic.c
> +++ b/drivers/gpu/drm/drm_panic.c
[ ... ]
> @@ -951,6 +955,11 @@ static void draw_panic_plane(struct drm_plane *plane, const char *description)
> #else
> u32 bg_color = 0x00000000;
> #endif
> +#if IS_ENABLED(CONFIG_DRM_PANIC_SCREEN_QR_CODE)
> + unsigned int qr_version = panic_qr_version;
> +#else
> + unsigned int qr_version = 0;
> +#endif
>
> if (!drm_panic_trylock(plane->dev, flags))
> return;
> @@ -966,7 +975,7 @@ static void draw_panic_plane(struct drm_plane *plane, const char *description)
>
> drm_panic_set_description(description);
>
> - ret = draw_panic_dispatch(&sb, fg_color, bg_color);
> + ret = draw_panic_dispatch(&sb, drm_panic_type, fg_color, bg_color, qr_version);
[Severity: High]
This is a pre-existing issue, but does the per-device locking in
drm_panic_trylock() adequately protect the global buffers?
Since the lock is per-device (plane->dev->mode_config.panic_lock), concurrent
debugfs writes across multiple DRM devices can still race and mutate global
static variables, such as the zlib stream workspace (struct z_stream_s stream)
or qrbuf1 and qrbuf2.
If a real kernel panic occurs while a debugfs write is concurrently using these
buffers, the true panic handler could inherit a corrupted zlib workspace state,
which might lead to a recursive fault and failure to display the panic screen.
Could this be protected by a global lock for non-panic paths?
[ ... ]
> diff --git a/drivers/gpu/drm/tests/drm_panic_test.c b/drivers/gpu/drm/tests/drm_panic_test.c
> index 969a096ec840f..196496238d231 100644
> --- a/drivers/gpu/drm/tests/drm_panic_test.c
> +++ b/drivers/gpu/drm/tests/drm_panic_test.c
> @@ -58,7 +58,7 @@ static int draw_panic_screen_kmsg_default(struct drm_scanout_buffer *sb)
> #if IS_ENABLED(CONFIG_DRM_PANIC_SCREEN_QR_CODE)
> static int draw_panic_screen_qr_code_default(struct drm_scanout_buffer *sb)
> {
> - return draw_panic_screen_qr_code(sb, 0x00ffffff, 0x00000000);
> + return draw_panic_screen_qr_code(sb, 0x00ffffff, 0x00000000, 40);
> }
> #endif
[Severity: High]
This isn't a bug introduced by this patch, but do the KUnit tests safely access
the global drawing state?
It appears the KUnit tests bypass draw_panic_plane() entirely and directly call
drawing functions like draw_panic_screen_qr_code() without acquiring any locks.
Could running the tests race on the global buffers and corrupt the zlib
workspace?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260818125012.468092-1-tzimmermann@suse.de?part=6
next prev parent reply other threads:[~2026-08-18 13:09 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 12:27 [PATCH 00/12] drm/panic: Split into core and helpers Thomas Zimmermann
2026-08-18 12:27 ` Thomas Zimmermann
2026-08-18 12:27 ` [PATCH 01/12] drm/panic: Allocate QR-code buffers statically Thomas Zimmermann
2026-08-18 12:27 ` Thomas Zimmermann
2026-08-18 13:09 ` sashiko-bot
2026-08-18 12:28 ` [PATCH 02/12] drm/panic: Make allocation of zlib workspace more robust Thomas Zimmermann
2026-08-18 12:28 ` Thomas Zimmermann
2026-08-18 12:28 ` [PATCH 03/12] drm/panic: Return -EINVAL if font is not available Thomas Zimmermann
2026-08-18 12:28 ` Thomas Zimmermann
2026-08-18 13:04 ` sashiko-bot
2026-08-18 12:28 ` [PATCH 04/12] drm/panic: Return errno codes if panic output fails Thomas Zimmermann
2026-08-18 12:28 ` Thomas Zimmermann
2026-08-18 13:03 ` sashiko-bot
2026-08-18 12:28 ` [PATCH 05/12] drm/panic: Pass colors to draw_panic_dispatch() Thomas Zimmermann
2026-08-18 12:28 ` Thomas Zimmermann
2026-08-18 12:28 ` [PATCH 06/12] drm/panic: Pass global module parameters to drm_panic_dispatch() Thomas Zimmermann
2026-08-18 12:28 ` Thomas Zimmermann
2026-08-18 13:09 ` sashiko-bot [this message]
2026-08-18 12:28 ` [PATCH 07/12] drm/panic: Retry in dispatch function if panic output fails Thomas Zimmermann
2026-08-18 12:28 ` Thomas Zimmermann
2026-08-18 13:05 ` sashiko-bot
2026-08-18 12:28 ` [PATCH 08/12] drm/panic: Split draw_panic_plane() Thomas Zimmermann
2026-08-18 12:28 ` Thomas Zimmermann
2026-08-18 13:14 ` sashiko-bot
2026-08-18 12:28 ` [PATCH 09/12] drm/panic: Display panic screen via per-plane callback Thomas Zimmermann
2026-08-18 12:28 ` Thomas Zimmermann
2026-08-18 13:19 ` sashiko-bot
2026-08-18 12:28 ` [PATCH 10/12] drm/panic: Internalize panic locking in DRM core and helpers Thomas Zimmermann
2026-08-18 12:28 ` Thomas Zimmermann
2026-08-18 12:28 ` [PATCH 11/12] drm/panic: Move panic display code into helper library Thomas Zimmermann
2026-08-18 12:28 ` Thomas Zimmermann
2026-08-18 13:13 ` sashiko-bot
2026-08-18 15:55 ` Randy Dunlap
2026-08-18 12:28 ` [PATCH 12/12] drm/panic: Compile KUnit tests as module Thomas Zimmermann
2026-08-18 12:28 ` Thomas Zimmermann
2026-08-18 13:18 ` sashiko-bot
2026-08-18 13:28 ` ✗ Fi.CI.BUILD: failure for drm/panic: Split into core and helpers Patchwork
2026-08-18 14:23 ` ✗ CI.checkpatch: warning " Patchwork
2026-08-18 14:24 ` ✗ CI.KUnit: failure " Patchwork
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=20260818130916.110771F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=imx@lists.linux.dev \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tzimmermann@suse.de \
--cc=wsa+renesas@sang-engineering.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.