[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250527-fractal-quick-trogon-67aeeb@houat>
Date: Tue, 27 May 2025 15:57:30 +0200
From: Maxime Ripard <mripard@...nel.org>
To: Maíra Canal <mcanal@...lia.com>
Cc: Dave Stevenson <dave.stevenson@...pberrypi.com>,
Raspberry Pi Kernel Maintenance <kernel-list@...pberrypi.com>, Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>, Dmitry Baryshkov <lumag@...nel.org>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
Catalin Marinas <catalin.marinas@....com>
Subject: Re: [PATCH] drm/vc4: tests: pv_muxing: Fix locking
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@....com>
> > Closes: https://lore.kernel.org/r/Z_95jWM2YMTGy3pi@arm.com/
> > Signed-off-by: Maxime Ripard <mripard@...nel.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
Download attachment "signature.asc" of type "application/pgp-signature" (274 bytes)
Powered by blists - more mailing lists