public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] configs/debug: Refresh debug config dependencies
@ 2025-04-22 16:54 Kees Cook
  2025-04-22 17:15 ` Matthieu Baerts
  0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2025-04-22 16:54 UTC (permalink / raw)
  To: Matthieu Baerts (NGI0)
  Cc: Kees Cook, Jakub Kicinski, Masahiro Yamada, Simon Horman,
	Anshuman Khandual, Stanislav Fomichev, Lukas Bulwahn,
	Borislav Petkov, Nicolas Schier, Michael Ellerman, Andrew Morton,
	Joel Fernandes (Google), linux-kernel, linux-hardening

Many of the CONFIG_DEBUG* options need CONFIG_DEBUG_KERNEL=y to be set,
so enable it explicitly. Similarly for CONFIG_NET* options, enable
CONFIG_NET=y. Finally, remove CONFIG_DEBUG_VM_VMACACHE, since it was
removed in commit 7964cf8caa4d ("mm: remove vmacache").

Signed-off-by: Kees Cook <kees@kernel.org>
---
Cc: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Simon Horman <horms@kernel.org>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Stanislav Fomichev <sdf@fomichev.me>
Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Nicolas Schier <nicolas.schier@linux.dev>
Cc: Michael Ellerman <mpe@ellerman.id.au>
---
 kernel/configs/debug.config     | 3 ++-
 kernel/configs/x86_debug.config | 1 -
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/configs/debug.config b/kernel/configs/debug.config
index e81327d2cd63..1a8724f29137 100644
--- a/kernel/configs/debug.config
+++ b/kernel/configs/debug.config
@@ -26,6 +26,7 @@ CONFIG_SECTION_MISMATCH_WARN_ONLY=y
 #
 # Generic Kernel Debugging Instruments
 #
+CONFIG_DEBUG_KERNEL=y
 # CONFIG_UBSAN_ALIGNMENT is not set
 # CONFIG_UBSAN_DIV_ZERO is not set
 # CONFIG_UBSAN_TRAP is not set
@@ -42,6 +43,7 @@ CONFIG_UBSAN_UNREACHABLE=y
 #
 # Networking Debugging
 #
+CONFIG_NET=y
 CONFIG_NET_DEV_REFCNT_TRACKER=y
 CONFIG_NET_NS_REFCNT_TRACKER=y
 CONFIG_DEBUG_NET=y
@@ -72,7 +74,6 @@ CONFIG_DEBUG_VIRTUAL=y
 CONFIG_DEBUG_VM=y
 CONFIG_DEBUG_VM_PGFLAGS=y
 CONFIG_DEBUG_VM_RB=y
-CONFIG_DEBUG_VM_VMACACHE=y
 CONFIG_KASAN=y
 CONFIG_KASAN_GENERIC=y
 CONFIG_KASAN_INLINE=y
diff --git a/kernel/configs/x86_debug.config b/kernel/configs/x86_debug.config
index 35f48671b8d5..28d1c6ba3bf0 100644
--- a/kernel/configs/x86_debug.config
+++ b/kernel/configs/x86_debug.config
@@ -2,7 +2,6 @@
 CONFIG_X86_DEBUG_FPU=y
 CONFIG_LOCK_STAT=y
 CONFIG_DEBUG_VM=y
-CONFIG_DEBUG_VM_VMACACHE=y
 CONFIG_DEBUG_VM_RB=y
 CONFIG_DEBUG_SLAB=y
 CONFIG_DEBUG_KMEMLEAK=y
-- 
2.34.1


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

* Re: [PATCH] configs/debug: Refresh debug config dependencies
  2025-04-22 16:54 [PATCH] configs/debug: Refresh debug config dependencies Kees Cook
@ 2025-04-22 17:15 ` Matthieu Baerts
  2025-04-22 17:52   ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Matthieu Baerts @ 2025-04-22 17:15 UTC (permalink / raw)
  To: Kees Cook
  Cc: Jakub Kicinski, Masahiro Yamada, Simon Horman, Anshuman Khandual,
	Stanislav Fomichev, Lukas Bulwahn, Borislav Petkov,
	Nicolas Schier, Michael Ellerman, Andrew Morton,
	Joel Fernandes (Google), linux-kernel, linux-hardening

Hi Kees,

Thank you for sharing this patch!

On 22/04/2025 18:54, Kees Cook wrote:
> Many of the CONFIG_DEBUG* options need CONFIG_DEBUG_KERNEL=y to be set,

Good point! I guess it has not been seen before because it is usually
enabled in the different _defconfig files. So probably no need to
backport this I guess, right?


> so enable it explicitly. Similarly for CONFIG_NET* options, enable
> CONFIG_NET=y.

I'm not sure about that one: if I'm not mistaken, the net debugging
options have been added for CIs using network features, to find bugs in
this area. In other words, I don't think it is needed to add a
dependence to CONFIG_NET. If it is enabled, then some extra debugging
options should be enabled to get more debug. If not, no need to force
having CONFIG_NET, no?

(On the other hand, CONFIG_NET is very likely needed for a CI, and it is
typically enabled in the different _defconfig and kvm_guest.config. I
guess adding this dependence will very likely not annoy anybody, so up
to you :) )


> Finally, remove CONFIG_DEBUG_VM_VMACACHE, since it was
> removed in commit 7964cf8caa4d ("mm: remove vmacache").

Good catch!

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.


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

* Re: [PATCH] configs/debug: Refresh debug config dependencies
  2025-04-22 17:15 ` Matthieu Baerts
@ 2025-04-22 17:52   ` Kees Cook
  0 siblings, 0 replies; 3+ messages in thread
From: Kees Cook @ 2025-04-22 17:52 UTC (permalink / raw)
  To: Matthieu Baerts
  Cc: Jakub Kicinski, Masahiro Yamada, Simon Horman, Anshuman Khandual,
	Stanislav Fomichev, Lukas Bulwahn, Borislav Petkov,
	Nicolas Schier, Michael Ellerman, Andrew Morton,
	Joel Fernandes (Google), linux-kernel, linux-hardening, kunit-dev

On Tue, Apr 22, 2025 at 07:15:44PM +0200, Matthieu Baerts wrote:
> Hi Kees,
> 
> Thank you for sharing this patch!
> 
> On 22/04/2025 18:54, Kees Cook wrote:
> > Many of the CONFIG_DEBUG* options need CONFIG_DEBUG_KERNEL=y to be set,
> 
> Good point! I guess it has not been seen before because it is usually
> enabled in the different _defconfig files. So probably no need to
> backport this I guess, right?
> 
> 
> > so enable it explicitly. Similarly for CONFIG_NET* options, enable
> > CONFIG_NET=y.
> 
> I'm not sure about that one: if I'm not mistaken, the net debugging
> options have been added for CIs using network features, to find bugs in
> this area. In other words, I don't think it is needed to add a
> dependence to CONFIG_NET. If it is enabled, then some extra debugging
> options should be enabled to get more debug. If not, no need to force
> having CONFIG_NET, no?
> 
> (On the other hand, CONFIG_NET is very likely needed for a CI, and it is
> typically enabled in the different _defconfig and kvm_guest.config. I
> guess adding this dependence will very likely not annoy anybody, so up
> to you :) )

Thanks for making me double-check this... it seems what was missing was
defconfig. :P

I noticed all of these from trying to run kunit like this:

$ ./tools/testing/kunit/kunit.py run --arch=x86_64 \
	--kunitconfig kernel/configs/debug.config \
	fortify

But it seems I need something closer to:

$ ./tools/testing/kunit/kunit.py run --arch=x86_64 \
	--kunitconfig arch/x86/configs/x86_64_defconfig \
	--kunitconfig kernel/configs/debug.config \
	fortify

> > Finally, remove CONFIG_DEBUG_VM_VMACACHE, since it was
> > removed in commit 7964cf8caa4d ("mm: remove vmacache").
> 
> Good catch!

Thanks! I'll nail this down a bit more and send a v2.

-- 
Kees Cook

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

end of thread, other threads:[~2025-04-22 17:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-22 16:54 [PATCH] configs/debug: Refresh debug config dependencies Kees Cook
2025-04-22 17:15 ` Matthieu Baerts
2025-04-22 17:52   ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox