From: sashiko-bot@kernel.org
To: "Thomas Zimmermann" <tzimmermann@suse.de>
Cc: imx@lists.linux.dev, dri-devel@lists.freedesktop.org,
ojeda@kernel.org, Frank.Li@kernel.org,
intel-xe@lists.freedesktop.org, linux-hyperv@vger.kernel.org,
intel-gfx@lists.freedesktop.org,
wsa+renesas@sang-engineering.com
Subject: Re: [PATCH 01/12] drm/panic: Allocate QR-code buffers statically
Date: Tue, 18 Aug 2026 13:09:14 +0000 [thread overview]
Message-ID: <20260818130914.EEA891F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260818125012.468092-2-tzimmermann@suse.de>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but using the `CONFIG_DRM_PANIC_SCREEN_QR_CODE_URL` Kconfig macro directly as part of the format string in `snprintf` creates a format string vulnerability. If the configured URL contains URL-encoded characters that form valid format specifiers (e.g., `?reason=kernel%20panic`, where `%20p` is a format specifier for a padded pointer), `snprintf` will consume unintended arguments. This shifts the argument mapping for the explicit `%s` specifiers, causing them to read and dereference uninitialized stack memory, leading to a nested kernel oops during a panic.
--
--- Patch [1]: [PATCH 01/12] drm/panic: Allocate QR-code buffers statically ---
commit 8f4057e44664878e84dd3de301552d418b19254c
Author: Thomas Zimmermann <tzimmermann@suse.de>
drm/panic: Allocate QR-code buffers statically
Declare qrbuf1 and qrbuf2 as static arrays so that the module loader
allocates them for us. Avoids the kmalloc later on. Access the arrays
once with memset, so that the physical pages are available on a panic.
> diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c
> --- a/drivers/gpu/drm/drm_panic.c
> +++ b/drivers/gpu/drm/drm_panic.c
[ ... ]
> @@ -656,13 +655,17 @@ static int drm_panic_get_qr_code_url(u8 **qr_image)
> char url[256];
> size_t kmsg_len, max_kmsg_size;
> char *kmsg;
> - int max_qr_data_size, url_len;
> + int ret;
> + size_t max_qr_data_size, url_len;
>
> - url_len = snprintf(url, sizeof(url), CONFIG_DRM_PANIC_SCREEN_QR_CODE_URL "?a=%s&v=%s&z=",
> - utsname()->machine, utsname()->release);
> + ret = snprintf(url, sizeof(url), CONFIG_DRM_PANIC_SCREEN_QR_CODE_URL "?a=%s&v=%s&z=",
> + utsname()->machine, utsname()->release);
[Severity: High]
This isn't a bug introduced by this patch, but does constructing the
format string directly from CONFIG_DRM_PANIC_SCREEN_QR_CODE_URL create
a format string vulnerability in drm_panic_get_qr_code_url()?
If a system builder configures the url string with standard url-encoded
characters that happen to match valid format specifiers (such as %20p
or %20d), snprintf() will try to consume unintended arguments.
Could this shift the argument mapping for the explicit %s specifiers,
causing them to dereference uninitialized stack memory and trigger a
nested oops that prevents the panic screen from displaying?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260818125012.468092-1-tzimmermann@suse.de?part=1
next prev parent reply other threads:[~2026-08-18 13:09 UTC|newest]
Thread overview: 25+ 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 ` [PATCH 01/12] drm/panic: Allocate QR-code buffers statically Thomas Zimmermann
2026-08-18 13:09 ` sashiko-bot [this message]
2026-08-18 12:28 ` [PATCH 02/12] drm/panic: Make allocation of zlib workspace more robust Thomas Zimmermann
2026-08-18 12:28 ` [PATCH 03/12] drm/panic: Return -EINVAL if font is not available 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 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 ` [PATCH 06/12] drm/panic: Pass global module parameters to drm_panic_dispatch() Thomas Zimmermann
2026-08-18 13:09 ` sashiko-bot
2026-08-18 12:28 ` [PATCH 07/12] drm/panic: Retry in dispatch function if panic output fails 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 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 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 ` [PATCH 11/12] drm/panic: Move panic display code into helper library 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 13:18 ` sashiko-bot
2026-08-18 14:23 ` ✗ CI.checkpatch: warning for drm/panic: Split into core and helpers 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=20260818130914.EEA891F00A3A@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