mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxime Ripard <mripard@kernel.org>
To: "Maíra Canal" <mcanal@igalia.com>
Cc: Dave Stevenson <dave.stevenson@raspberrypi.com>,
	 Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	 Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>,
	 Simona Vetter <simona@ffwll.ch>,
	Dmitry Baryshkov <lumag@kernel.org>,
	 dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	 Catalin Marinas <catalin.marinas@arm.com>
Subject: Re: [PATCH] drm/vc4: tests: pv_muxing: Fix locking
Date: Tue, 27 May 2025 15:57:30 +0200	[thread overview]
Message-ID: <20250527-fractal-quick-trogon-67aeeb@houat> (raw)
In-Reply-To: <0a55c763-c1c1-48dc-bad0-d993b4fc4f87@igalia.com>

[-- Attachment #1: Type: text/plain, Size: 1975 bytes --]

On Sat, May 24, 2025 at 08:09:36AM -0300, Maíra Canal wrote:
> On 20/05/25 09:08, Maxime Ripard wrote:
> > Commit 30188df0c387 ("drm/tests: Drop drm_kunit_helper_acquire_ctx_alloc()")
> > removed a kunit-managed function to get a drm_modeset_acquire_ctx.
> > 
> > It converted the vc4_pv_muxing_test_init() function, used by
> > drm_vc4_test_pv_muxing() and drm_vc4_test_pv_muxing_invalid(). However,
> > during that conversion, it went from being kzalloc'd to being allocated
> > on the stack.
> > 
> > vc4_pv_muxing_test_init() then uses that context to allocate a
> > drm_atomic_state using drm_kunit_helper_atomic_state_alloc(), which
> > stores a pointer to the locking context in the allocated state.
> > 
> > However, since vc4_pv_muxing_test_init() is a test init function, the
> > context is then cleared when we leave the function, and before executing
> > the test. We're then running the test with a dangling pointer, which
> > then leads to various crashes.
> > 
> > Rework the context initialization and state allocation to move them to
> > drm_vc4_test_pv_muxing() and drm_vc4_test_pv_muxing_invalid().
> > 
> > Fixes: 30188df0c387 ("drm/tests: Drop drm_kunit_helper_acquire_ctx_alloc()")
> > Reported-by: Catalin Marinas <catalin.marinas@arm.com>
> > Closes: https://lore.kernel.org/r/Z_95jWM2YMTGy3pi@arm.com/
> > Signed-off-by: Maxime Ripard <mripard@kernel.org>
> > ---
> >   drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c | 38 ++++++++++++++++----------
> >   1 file changed, 24 insertions(+), 14 deletions(-)
> 
> Hi Maxime,
> 
> Didn't you fix this issue in commit 7e0351ae91ed ("drm/vc4: tests: Stop
> allocating the state in test init") [1]?
> 
> [1] https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/7e0351ae91ed2b6178abbfae96c3c6aaa1652567

I did, and forgot I guess.. :/

It should be on its way to 6.16-rc1 already, so hopefully it'll get
picked up by the stable kernel team at some point.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

      reply	other threads:[~2025-05-27 13:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-20 12:08 Maxime Ripard
2025-05-22 14:09 ` Catalin Marinas
2025-05-24 11:09 ` Maíra Canal
2025-05-27 13:57   ` Maxime Ripard [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=20250527-fractal-quick-trogon-67aeeb@houat \
    --to=mripard@kernel.org \
    --cc=airlied@gmail.com \
    --cc=catalin.marinas@arm.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel-list@raspberrypi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lumag@kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mcanal@igalia.com \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /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®