lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5668ab98-3ebe-4f02-a759-5dfb2e21134b@amd.com>
Date: Tue, 10 Jun 2025 15:01:01 +0200
From: Christian König <christian.koenig@....com>
To: Arnd Bergmann <arnd@...nel.org>,
 Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
 Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
 David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
 Alex Deucher <alexander.deucher@....com>
Cc: Arnd Bergmann <arnd@...db.de>, dri-devel@...ts.freedesktop.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/test: reduce stack size in drm_exec_test

On 6/10/25 11:33, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
> 
> test_prepare_array() is one of the functions that uses more than
> a kilobyte of stack on 64-bit machines, though it stays under
> the usual warning limit of 2KB:
> 
> drivers/gpu/drm/tests/drm_exec_test.c: In function 'test_prepare_array':
> drivers/gpu/drm/tests/drm_exec_test.c:171:1: error: the frame size of 1304 bytes is larger than 1280 bytes [-Werror=frame-larger-than=]
> 
> In order to eventually lower that limit, change the two large
> drm_gem_object objects to be statically allocated. This works here
> because the tests are always called sequentially, and it is simpler than
> using kzalloc().
> 
> Fixes: 9710631cc8f3 ("drm: add drm_exec selftests v4")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>

Maybe kzalloc() would be cleaner, but it certainly isn't a must have.

Acked-by: Christian König <christian.koenig@....com>

> ---
>  drivers/gpu/drm/tests/drm_exec_test.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tests/drm_exec_test.c b/drivers/gpu/drm/tests/drm_exec_test.c
> index d6c4dd1194a0..f2ac06a07707 100644
> --- a/drivers/gpu/drm/tests/drm_exec_test.c
> +++ b/drivers/gpu/drm/tests/drm_exec_test.c
> @@ -18,6 +18,8 @@
>  
>  #include "../lib/drm_random.h"
>  
> +static struct drm_gem_object gobj, gobj2;
> +
>  struct drm_exec_priv {
>  	struct device *dev;
>  	struct drm_device *drm;
> @@ -54,7 +56,6 @@ static void sanitycheck(struct kunit *test)
>  static void test_lock(struct kunit *test)
>  {
>  	struct drm_exec_priv *priv = test->priv;
> -	struct drm_gem_object gobj = { };
>  	struct drm_exec exec;
>  	int ret;
>  
> @@ -74,7 +75,6 @@ static void test_lock(struct kunit *test)
>  static void test_lock_unlock(struct kunit *test)
>  {
>  	struct drm_exec_priv *priv = test->priv;
> -	struct drm_gem_object gobj = { };
>  	struct drm_exec exec;
>  	int ret;
>  
> @@ -101,7 +101,6 @@ static void test_lock_unlock(struct kunit *test)
>  static void test_duplicates(struct kunit *test)
>  {
>  	struct drm_exec_priv *priv = test->priv;
> -	struct drm_gem_object gobj = { };
>  	struct drm_exec exec;
>  	int ret;
>  
> @@ -128,7 +127,6 @@ static void test_duplicates(struct kunit *test)
>  static void test_prepare(struct kunit *test)
>  {
>  	struct drm_exec_priv *priv = test->priv;
> -	struct drm_gem_object gobj = { };
>  	struct drm_exec exec;
>  	int ret;
>  
> @@ -150,13 +148,11 @@ static void test_prepare(struct kunit *test)
>  static void test_prepare_array(struct kunit *test)
>  {
>  	struct drm_exec_priv *priv = test->priv;
> -	struct drm_gem_object gobj1 = { };
> -	struct drm_gem_object gobj2 = { };
> -	struct drm_gem_object *array[] = { &gobj1, &gobj2 };
> +	struct drm_gem_object *array[] = { &gobj, &gobj2 };
>  	struct drm_exec exec;
>  	int ret;
>  
> -	drm_gem_private_object_init(priv->drm, &gobj1, PAGE_SIZE);
> +	drm_gem_private_object_init(priv->drm, &gobj, PAGE_SIZE);
>  	drm_gem_private_object_init(priv->drm, &gobj2, PAGE_SIZE);
>  
>  	drm_exec_init(&exec, DRM_EXEC_INTERRUPTIBLE_WAIT, 0);
> @@ -166,7 +162,7 @@ static void test_prepare_array(struct kunit *test)
>  	KUNIT_EXPECT_EQ(test, ret, 0);
>  	drm_exec_fini(&exec);
>  
> -	drm_gem_private_object_fini(&gobj1);
> +	drm_gem_private_object_fini(&gobj);
>  	drm_gem_private_object_fini(&gobj2);
>  }
>  


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ