From: sashiko-bot@kernel.org
To: "Thomas Zimmermann" <tzimmermann@suse.de>
Cc: intel-xe@lists.freedesktop.org, ojeda@kernel.org,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
imx@lists.linux.dev, Frank.Li@kernel.org,
wsa+renesas@sang-engineering.com, linux-hyperv@vger.kernel.org
Subject: Re: [PATCH v2 13/13] drm/panic: Compile KUnit tests as module
Date: Mon, 24 Aug 2026 14:11:25 +0000 [thread overview]
Message-ID: <20260824141126.817C91F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260824125201.218863-14-tzimmermann@suse.de>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Dangling pointer in panic_msg array causes use-after-free during kernel panic after the test module is unloaded.
--
--- Patch [13]: [PATCH v2 13/13] drm/panic: Compile KUnit tests as module ---
commit 9a00d4c3f17fad5dbc6e3335649c2316482a4fad
Author: Thomas Zimmermann <tzimmermann@suse.de>
Subject: drm/panic: Compile KUnit tests as module
Fix dependency of the panic-helper KUnit tests on CONFIG_DRM_KUNIT_TEST=y
and make them build as a module. Export the necessary interfaces from the
panic helpers iff the KUnit framework has been enabled.
> diff --git a/drivers/gpu/drm/drm_panic_helper.c b/drivers/gpu/drm/drm_panic_helper.c
> index 669f09225f8ed..253262b7e0d4c 100644
> --- a/drivers/gpu/drm/drm_panic_helper.c
> +++ b/drivers/gpu/drm/drm_panic_helper.c
[ ... ]
> -static void drm_panic_helper_set_description(const char *description)
> +VISIBLE_IF_KUNIT void drm_panic_helper_set_description(const char *description)
> {
> u32 len;
>
> if (description) {
> struct drm_panic_line *desc_line = &panic_msg[panic_msg_lines - 1];
>
> desc_line->txt = description;
> len = strlen(description);
> /* ignore the last newline character */
> if (len && description[len - 1] == '\n')
> len -= 1;
> desc_line->len = len;
> }
> }
> +EXPORT_SYMBOL_IF_KUNIT(drm_panic_helper_set_description);
[Severity: High]
This is a pre-existing issue, but since the test can now be built as a module,
does unloading it leave a dangling pointer in the global panic_msg array?
In drivers/gpu/drm/tests/drm_panic_helper_test.c, drm_test_panic_init()
calls drm_panic_helper_set_description("Kunit testing"), which stores a
pointer to the test module's .rodata.
When the drm_panic_helper_test module is unloaded, this memory is freed. Since
the test suite lacks an .exit callback to call
drm_panic_helper_clear_description(), the dangling pointer remains in the
global array.
If a real kernel panic occurs later where detail->description is NULL (such as
via kmsg_dump(KMSG_DUMP_PANIC) on some architectures), this function silently
ignores the NULL input and leaves the dangling pointer intact.
Will this cause a use-after-free read when the panic screen rendering
dereferences desc_line->txt, potentially preventing the panic screen from
displaying during an actual crash?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260824125201.218863-1-tzimmermann@suse.de?part=13
prev parent reply other threads:[~2026-08-24 14:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 12:43 [PATCH v2 00/13] drm/panic: Split into core and helpers Thomas Zimmermann
2026-08-24 12:43 ` [PATCH v2 01/13] drm/panic: Do not use un-escaped URL as format string Thomas Zimmermann
2026-08-24 12:43 ` [PATCH v2 02/13] drm/panic: Test address from kmap op for NULL Thomas Zimmermann
2026-08-24 12:43 ` [PATCH v2 03/13] drm/panic: Return -EINVAL if font is not available Thomas Zimmermann
2026-08-24 12:43 ` [PATCH v2 04/13] drm/panic: Return errno codes if panic output fails Thomas Zimmermann
2026-08-24 13:15 ` sashiko-bot
2026-08-24 12:43 ` [PATCH v2 05/13] drm/panic: Pass colors to draw_panic_dispatch() Thomas Zimmermann
2026-08-24 13:13 ` sashiko-bot
2026-08-24 12:43 ` [PATCH v2 06/13] drm/panic: Pass global module parameters to drm_panic_dispatch() Thomas Zimmermann
2026-08-24 12:43 ` [PATCH v2 07/13] drm/panic: Retry in dispatch function if panic output fails Thomas Zimmermann
2026-08-24 13:21 ` sashiko-bot
2026-08-24 12:43 ` [PATCH v2 08/13] drm/panic: Split draw_panic_plane() Thomas Zimmermann
2026-08-24 12:43 ` [PATCH v2 09/13] drm/panic: Restrict to primary planes; unconditionally unregister Thomas Zimmermann
2026-08-24 13:31 ` sashiko-bot
2026-08-24 12:43 ` [PATCH v2 10/13] drm/panic: Display panic screen via per-plane callback Thomas Zimmermann
2026-08-24 12:43 ` [PATCH v2 11/13] drm/panic: Internalize panic locking in DRM core and helpers Thomas Zimmermann
2026-08-24 12:43 ` [PATCH v2 12/13] drm/panic: Move panic display code into helper library Thomas Zimmermann
2026-08-24 12:43 ` [PATCH v2 13/13] drm/panic: Compile KUnit tests as module Thomas Zimmermann
2026-08-24 14:11 ` sashiko-bot [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=20260824141126.817C91F00A3A@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox