All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] gpu: GPU_BUDDY_KUNIT_TEST should not select GPU_BUDDY
@ 2026-08-25 15:29 Geert Uytterhoeven
  2026-08-25 15:40 ` sashiko-bot
  2026-08-25 18:55 ` Andi Shyti
  0 siblings, 2 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2026-08-25 15:29 UTC (permalink / raw)
  To: David Airlie, Simona Vetter, Krzysztof Karas, Sebastian Brzezinka,
	Krzysztof Niemiec, Maarten Lankhorst, Andi Shyti
  Cc: dri-devel, linux-kernel, Geert Uytterhoeven

Enabling a (modular) test should not silently enable additional kernel
functionality, as that may increase the attack vector for a product.

Fix this by reverting the select to a dependency.  Make sure the GPU
buddy allocator can be tested without enabling another driver that uses
DRM_BUDDY by making GPU_BUDDY visible if KUNIT is enabled.

The page based buddy allocator for GPU memory is only used by DRM.
Hence add a dependency on DRM to GPU_BUDDY, to prevent asking the user
about this code when configuring a kernel without DRM support.

Update drivers/gpu/tests/.kunitconfig accordingly.

Fixes: 8fe3fc37564920ae ("gpu: Fix dependencies in CONFIG_GPU_BUDDY_KUNIT_TEST")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
v2:
  - Update drivers/gpu/tests/.kunitconfig.
---
 drivers/gpu/Kconfig            | 5 +++--
 drivers/gpu/tests/.kunitconfig | 2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/Kconfig b/drivers/gpu/Kconfig
index 3bcf08260d73a782..d881ab6f7a006a3b 100644
--- a/drivers/gpu/Kconfig
+++ b/drivers/gpu/Kconfig
@@ -1,14 +1,15 @@
 # SPDX-License-Identifier: GPL-2.0
 
 config GPU_BUDDY
-       bool
+       bool "Page based buddy allocator for GPU memory" if KUNIT
+       depends on DRM || COMPILE_TEST
        help
          A page based buddy allocator for GPU memory.
 
 config GPU_BUDDY_KUNIT_TEST
        tristate "KUnit tests for GPU buddy allocator" if !KUNIT_ALL_TESTS
        depends on KUNIT
-       select GPU_BUDDY
+       depends on GPU_BUDDY
        default KUNIT_ALL_TESTS
        help
          KUnit tests for the GPU buddy allocator.
diff --git a/drivers/gpu/tests/.kunitconfig b/drivers/gpu/tests/.kunitconfig
index fd611b3dfe09c4f6..c103afc02c9ede16 100644
--- a/drivers/gpu/tests/.kunitconfig
+++ b/drivers/gpu/tests/.kunitconfig
@@ -1,2 +1,4 @@
 CONFIG_KUNIT=y
+CONFIG_COMPILE_TEST=y
+CONFIG_GPU_BUDDY=y
 CONFIG_GPU_BUDDY_KUNIT_TEST=y
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] gpu: GPU_BUDDY_KUNIT_TEST should not select GPU_BUDDY
  2026-08-25 15:29 [PATCH v2] gpu: GPU_BUDDY_KUNIT_TEST should not select GPU_BUDDY Geert Uytterhoeven
@ 2026-08-25 15:40 ` sashiko-bot
  2026-08-25 18:55 ` Andi Shyti
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-08-25 15:40 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Adding `depends on DRM || COMPILE_TEST` to the `bool` symbol `GPU_BUDDY` causes a Kconfig unmet direct dependencies warning when `DRM=m`, and breaks manual selection of the KUnit test.
--

--- Patch [1]: [PATCH v2] gpu: GPU_BUDDY_KUNIT_TEST should not select GPU_BUDDY ---
commit 0c0f9dc26f6481afe68d4de6c66198acb6cb9883
Author: Geert Uytterhoeven <geert@linux-m68k.org>

gpu: GPU_BUDDY_KUNIT_TEST should not select GPU_BUDDY

This commit changes GPU_BUDDY_KUNIT_TEST to depend on GPU_BUDDY instead
of selecting it. It also adds a dependency on DRM or COMPILE_TEST to
GPU_BUDDY and makes it user-visible when KUNIT is enabled.

> diff --git a/drivers/gpu/Kconfig b/drivers/gpu/Kconfig
> index 3bcf08260d73a..d881ab6f7a006 100644
> --- a/drivers/gpu/Kconfig
> +++ b/drivers/gpu/Kconfig
> @@ -1,14 +1,15 @@
>  # SPDX-License-Identifier: GPL-2.0
>  
>  config GPU_BUDDY
> -       bool
> +       bool "Page based buddy allocator for GPU memory" if KUNIT
> +       depends on DRM || COMPILE_TEST

[Severity: Low]
Does adding this dependency cause a Kconfig warning when DRM is configured
as a module?

Because GPU_BUDDY is a boolean symbol, this dependency restriction evaluates
to 'm' when CONFIG_DRM=m and CONFIG_COMPILE_TEST=n. This causes a conflict
with the 'select' from DRM_BUDDY, resulting in an unmet direct dependencies
warning.

Additionally, could this prevent developers from manually enabling the KUnit
test when DRM=m without COMPILE_TEST?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/e67a2cb0d599b75ae365882913c543e7b0c5b8a3.1787671708.git.geert@linux-m68k.org?part=1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] gpu: GPU_BUDDY_KUNIT_TEST should not select GPU_BUDDY
  2026-08-25 15:29 [PATCH v2] gpu: GPU_BUDDY_KUNIT_TEST should not select GPU_BUDDY Geert Uytterhoeven
  2026-08-25 15:40 ` sashiko-bot
@ 2026-08-25 18:55 ` Andi Shyti
  1 sibling, 0 replies; 3+ messages in thread
From: Andi Shyti @ 2026-08-25 18:55 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: David Airlie, Simona Vetter, Krzysztof Karas, Sebastian Brzezinka,
	Krzysztof Niemiec, Maarten Lankhorst, Andi Shyti, dri-devel,
	linux-kernel

Hi Geert,

On Tue, Aug 25, 2026 at 05:29:59PM +0200, Geert Uytterhoeven wrote:
> Enabling a (modular) test should not silently enable additional kernel
> functionality, as that may increase the attack vector for a product.
> 
> Fix this by reverting the select to a dependency.  Make sure the GPU
> buddy allocator can be tested without enabling another driver that uses
> DRM_BUDDY by making GPU_BUDDY visible if KUNIT is enabled.
> 
> The page based buddy allocator for GPU memory is only used by DRM.
> Hence add a dependency on DRM to GPU_BUDDY, to prevent asking the user
> about this code when configuring a kernel without DRM support.
> 
> Update drivers/gpu/tests/.kunitconfig accordingly.
> 
> Fixes: 8fe3fc37564920ae ("gpu: Fix dependencies in CONFIG_GPU_BUDDY_KUNIT_TEST")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

I tested sashiko's statement and I guess it got it wrong.

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>

Thanks,
Andi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-25 18:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-25 15:29 [PATCH v2] gpu: GPU_BUDDY_KUNIT_TEST should not select GPU_BUDDY Geert Uytterhoeven
2026-08-25 15:40 ` sashiko-bot
2026-08-25 18:55 ` Andi Shyti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.