Skip to contentSkip to conversation

init: Do not select DEBUG_KERNEL by default

PATCH Superseded Sinan Kaya 4 participants 11 messages Apr 10, 2019 – Apr 11, 2019 Library code

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Sinan Kaya

author
#0 lore raw

PATCH v2 1/1 init: Do not select DEBUG_KERNEL by default

We can't seem to have a kernel with CONFIG_EXPERT set but CONFIG_DEBUG_KERNEL unset these days.

While some of the features under the CONFIG_EXPERT require CONFIG_DEBUG_KERNEL, it doesn't apply for all features.

It looks like CONFIG_KALLSYMS_ALL is the only feature that requires CONFIG_DEBUG_KERNEL.

Select CONFIG_EXPERT when CONFIG_DEBUG is chosen but you can still choose CONFIG_EXPERT without CONFIG_DEBUG.

---
 init/Kconfig      | 2 --
 lib/Kconfig.debug | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)
init/Kconfig +0 -2
index 4592bf7997c0..37e10a8391a3 100644
@@ -1206,8 +1206,6 @@ config BPF
 
 menuconfig EXPERT
 	bool "Configure standard kernel features (expert users)"
-	# Unhide debug options, to make the on-by-default options visible
-	select DEBUG_KERNEL
 	help
 	  This option allows certain base kernel options and settings
           to be disabled or tweaked. This is for specialized
lib/Kconfig.debug +1 -0
index 0d9e81779e37..9fbf3499ec8d 100644
@@ -434,6 +434,7 @@ config MAGIC_SYSRQ_SERIAL
 
 config DEBUG_KERNEL
 	bool "Kernel debugging"
+	default EXPERT
 	help
 	  Say Y here if you are developing drivers or trying to debug and
 	  identify kernel problems.
Signature · 1 line
2.21.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 11 lines · Sinan Kaya

We can't seem to have a kernel with CONFIG_EXPERT set but CONFIG_DEBUG_KERNEL unset these days.

While some of the features under the CONFIG_EXPERT require CONFIG_DEBUG_KERNEL, it doesn't apply for all features.

It looks like CONFIG_KALLSYMS_ALL is the only feature that requires CONFIG_DEBUG_KERNEL.

Select CONFIG_EXPERT when CONFIG_DEBUG is chosen but you can

Typo: CONFIG_DEBUG_KERNEL

Quoted 1 line

still choose CONFIG_EXPERT without CONFIG_DEBUG.

same.

Quoted 2 lines

But with those fixed, looks good to me. Adding Josh (and others) to CC since he originally added the linkage to EXPERT in commit f505c553dbe2.

-Kees

Quoted 33 lines
---
 init/Kconfig      | 2 --
 lib/Kconfig.debug | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)
init/Kconfig +0 -2
index 4592bf7997c0..37e10a8391a3 100644
@@ -1206,8 +1206,6 @@ config BPF
 
 menuconfig EXPERT
        bool "Configure standard kernel features (expert users)"
-       # Unhide debug options, to make the on-by-default options visible
-       select DEBUG_KERNEL
        help
          This option allows certain base kernel options and settings
           to be disabled or tweaked. This is for specialized
lib/Kconfig.debug +1 -1
index 0d9e81779e37..9fbf3499ec8d 100644
@@ -434,6 +434,7 @@ config MAGIC_SYSRQ_SERIAL
 
 config DEBUG_KERNEL
        bool "Kernel debugging"
+       default EXPERT
        help
          Say Y here if you are developing drivers or trying to debug and
          identify kernel problems.
--

2.21.0

Signature · 1 line
Kees Cook
#2 lore raw
Quoted 17 lines · Kees Cook
Quoted 11 lines · Sinan Kaya

We can't seem to have a kernel with CONFIG_EXPERT set but CONFIG_DEBUG_KERNEL unset these days.

While some of the features under the CONFIG_EXPERT require CONFIG_DEBUG_KERNEL, it doesn't apply for all features.

It looks like CONFIG_KALLSYMS_ALL is the only feature that requires CONFIG_DEBUG_KERNEL.

Select CONFIG_EXPERT when CONFIG_DEBUG is chosen but you can

Typo: CONFIG_DEBUG_KERNEL

Quoted 1 line

still choose CONFIG_EXPERT without CONFIG_DEBUG.

Quoted 8 lines

same.

Quoted 2 lines

But with those fixed, looks good to me. Adding Josh (and others) to CC since he originally added the linkage to EXPERT in commit f505c553dbe2.

CONFIG_DEBUG_KERNEL shouldn't affect code generation in any way; it should only make more options appear in kconfig. I originally added this to ensure that features you might want to *disable* aren't hidden, as part of the tinification effort.

What specific problem does having CONFIG_DEBUG_KERNEL enabled cause for you? I'd still prefer to have a single switch for "don't hide things I might want to disable", rather than several.

This would also need checking to make sure it doesn't grow tinyconfig.

#3 lore raw
Quoted 24 lines · Josh Triplett
Quoted 22 lines · Kees Cook
Quoted 11 lines · Sinan Kaya

We can't seem to have a kernel with CONFIG_EXPERT set but CONFIG_DEBUG_KERNEL unset these days.

While some of the features under the CONFIG_EXPERT require CONFIG_DEBUG_KERNEL, it doesn't apply for all features.

It looks like CONFIG_KALLSYMS_ALL is the only feature that requires CONFIG_DEBUG_KERNEL.

Select CONFIG_EXPERT when CONFIG_DEBUG is chosen but you can

Typo: CONFIG_DEBUG_KERNEL

Quoted 1 line

still choose CONFIG_EXPERT without CONFIG_DEBUG.

same.

Quoted 2 lines
Quoted 7 lines
Quoted 3 lines

But with those fixed, looks good to me. Adding Josh (and others) to CC since he originally added the linkage to EXPERT in commit f505c553dbe2.

CONFIG_DEBUG_KERNEL shouldn't affect code generation in any way; it should only make more options appear in kconfig. I originally added this to ensure that features you might want to *disable* aren't hidden, as part of the tinification effort.

What specific problem does having CONFIG_DEBUG_KERNEL enabled cause for you? I'd still prefer to have a single switch for "don't hide things I might want to disable", rather than several.

See earlier in the thread: code generation depends on CONFIG_DEBUG_KERNEL now unfortunately.

Signature · 1 line
Kees Cook
#4 lore raw
Quoted 37 lines · Kees Cook
Quoted 2 lines · Josh Triplett

On April 10, 2019 3:58:55 PM PDT, Kees Cook <[email protected]>

Quoted 15 lines · wrote:
Quoted 15 lines · Sinan Kaya
Quoted 11 lines

We can't seem to have a kernel with CONFIG_EXPERT set but CONFIG_DEBUG_KERNEL unset these days.

While some of the features under the CONFIG_EXPERT require CONFIG_DEBUG_KERNEL, it doesn't apply for all features.

It looks like CONFIG_KALLSYMS_ALL is the only feature that requires CONFIG_DEBUG_KERNEL.

Select CONFIG_EXPERT when CONFIG_DEBUG is chosen but you can

Typo: CONFIG_DEBUG_KERNEL

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

still choose CONFIG_EXPERT without CONFIG_DEBUG.

same.

Quoted 2 lines

But with those fixed, looks good to me. Adding Josh (and others) to

CC

Quoted 4 lines
Quoted 2 lines

since he originally added the linkage to EXPERT in commit f505c553dbe2.

CONFIG_DEBUG_KERNEL shouldn't affect code generation in any way; it

should only make more options appear in kconfig. I originally added this to ensure that features you might want to *disable* aren't hidden, as part of the tinification effort.

Quoted 1 line
Quoted 6 lines
Quoted 1 line

What specific problem does having CONFIG_DEBUG_KERNEL enabled cause

for you? I'd still prefer to have a single switch for "don't hide things I might want to disable", rather than several.

See earlier in the thread: code generation depends on CONFIG_DEBUG_KERNEL now unfortunately.

Then let's fix *that*, and get checkpatch to help enforce it in the future. EXPERT doesn't affect code generation, and neither should this.

author
#5 lore raw
Quoted 1 line · Josh Triplett

Then let's fix*that*, and get checkpatch to help enforce it in the future. EXPERT doesn't affect code generation, and neither should this.

I think we have to do both. We need to go after the users as well as solve the immediate problem per this patch.

As Mathieu identified, CONFIG_DEBUG_KERNEL is being used all over the place and getting subsystem owners to remove let alone add a check to checkpatch is just going to take time.

Please let us know if you are OK with this plan.

#6 lore raw
Quoted 11 lines · Sinan Kaya
Quoted 1 line · Josh Triplett

Then let's fix*that*, and get checkpatch to help enforce it in the future. EXPERT doesn't affect code generation, and neither should this.

I think we have to do both. We need to go after the users as well as solve the immediate problem per this patch.

As Mathieu identified, CONFIG_DEBUG_KERNEL is being used all over the place and getting subsystem owners to remove let alone add a check to checkpatch is just going to take time.

Please let us know if you are OK with this plan.

I'm not OK with this plan. Turning on EXPERT should make the options under DEBUG_KERNEL visible; it's a bug that DEBUG_KERNEL affects code generation as well.

Proposed alternative plan: let's add a new symbol, something like DEBUG_MISC ("Miscellaneous debug code that should be under a more specific debug option but isn't"), make it depend on DEBUG_KERNEL and be "default DEBUG_KERNEL" but allow itself to be turned off, and then mechanically change the small handful of "#ifdef CONFIG_DEBUG_KERNEL" to "#ifdef CONFIG_DEBUG_MISC".

Does that sound like an appropriately rapid solution for this bug?

#7 lore raw
Quoted 18 lines · Josh Triplett
Quoted 11 lines · Sinan Kaya
Quoted 1 line · Josh Triplett

Then let's fix*that*, and get checkpatch to help enforce it in the future. EXPERT doesn't affect code generation, and neither should this.

I think we have to do both. We need to go after the users as well as solve the immediate problem per this patch.

As Mathieu identified, CONFIG_DEBUG_KERNEL is being used all over the place and getting subsystem owners to remove let alone add a check to checkpatch is just going to take time.

Please let us know if you are OK with this plan.

I'm not OK with this plan. Turning on EXPERT should make the options under DEBUG_KERNEL visible; it's a bug that DEBUG_KERNEL affects code generation as well.

Quoted 8 lines

Proposed alternative plan: let's add a new symbol, something like DEBUG_MISC ("Miscellaneous debug code that should be under a more specific debug option but isn't"), make it depend on DEBUG_KERNEL and be "default DEBUG_KERNEL" but allow itself to be turned off, and then mechanically change the small handful of "#ifdef CONFIG_DEBUG_KERNEL" to "#ifdef CONFIG_DEBUG_MISC".

Does that sound like an appropriately rapid solution for this bug?

Sure, that sounds fine to me. Sinan can you take care of that for v4?

Signature · 1 line
Kees Cook
author
#8 lore raw
Quoted 9 lines · Kees Cook
Quoted 8 lines

Proposed alternative plan: let's add a new symbol, something like DEBUG_MISC ("Miscellaneous debug code that should be under a more specific debug option but isn't"), make it depend on DEBUG_KERNEL and be "default DEBUG_KERNEL" but allow itself to be turned off, and then mechanically change the small handful of "#ifdef CONFIG_DEBUG_KERNEL" to "#ifdef CONFIG_DEBUG_MISC".

Does that sound like an appropriately rapid solution for this bug?

Sure, that sounds fine to me. Sinan can you take care of that for v4?

Sure, let me work on this.

#9 lore raw
Quoted 8 lines · Sinan Kaya
Quoted 7 lines · Kees Cook
Quoted 7 lines

Proposed alternative plan: let's add a new symbol, something like DEBUG_MISC ("Miscellaneous debug code that should be under a more specific debug option but isn't"), make it depend on DEBUG_KERNEL and be "default DEBUG_KERNEL" but allow itself to be turned off, and then mechanically change the small handful of "#ifdef CONFIG_DEBUG_KERNEL" to "#ifdef CONFIG_DEBUG_MISC".

Quoted 4 lines
Quoted 2 lines
Quoted 1 line

Does that sound like an appropriately rapid solution for this bug?

Sure, that sounds fine to me. Sinan can you take care of that for v4?

Sure, let me work on this.

Thank you both! I really appreciate that.

#10 lore raw
In reply to Josh Triplett
Quoted 38 lines · Josh Triplett
Quoted 37 lines · Kees Cook
Quoted 2 lines · Josh Triplett

On April 10, 2019 3:58:55 PM PDT, Kees Cook <[email protected]>

Quoted 15 lines · wrote:
Quoted 15 lines · Sinan Kaya
Quoted 11 lines

We can't seem to have a kernel with CONFIG_EXPERT set but CONFIG_DEBUG_KERNEL unset these days.

While some of the features under the CONFIG_EXPERT require CONFIG_DEBUG_KERNEL, it doesn't apply for all features.

It looks like CONFIG_KALLSYMS_ALL is the only feature that requires CONFIG_DEBUG_KERNEL.

Select CONFIG_EXPERT when CONFIG_DEBUG is chosen but you can

Typo: CONFIG_DEBUG_KERNEL

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

still choose CONFIG_EXPERT without CONFIG_DEBUG.

same.

Quoted 2 lines

But with those fixed, looks good to me. Adding Josh (and others) to

CC

Quoted 4 lines
Quoted 2 lines

since he originally added the linkage to EXPERT in commit f505c553dbe2.

CONFIG_DEBUG_KERNEL shouldn't affect code generation in any way; it

should only make more options appear in kconfig. I originally added this to ensure that features you might want to *disable* aren't hidden, as part of the tinification effort.

Quoted 1 line
Quoted 9 lines
Quoted 6 lines
Quoted 1 line

What specific problem does having CONFIG_DEBUG_KERNEL enabled cause

for you? I'd still prefer to have a single switch for "don't hide things I might want to disable", rather than several.

See earlier in the thread: code generation depends on CONFIG_DEBUG_KERNEL now unfortunately.

Then let's fix *that*, and get checkpatch to help enforce it in the future. EXPERT doesn't affect code generation, and neither should this.

checkpatch is not an enforcer. It takes maintainers to do that.

Signature · 1 line
~Randy