mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julian Braha <julianbraha@gmail.com>
To: Kees Cook <kees@kernel.org>
Cc: "Nathan Chancellor" <nathan@kernel.org>,
	"Nicolas Schier" <nsc@kernel.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"Masahiro Yamada" <masahiroy@kernel.org>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Nicolas Pitre" <nico@fluxnic.net>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Andrew Jones" <andrew.jones@linux.dev>,
	linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org,
	"Lorenzo Stoakes (ARM)" <ljs@kernel.org>,
	"Vegard Nossum" <vegard.nossum@oracle.com>,
	"Nauman Sabir" <officialnaumansabir@gmail.com>,
	"Tejun Heo" <tj@kernel.org>,
	"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
	"Matthew Maurer" <mmaurer@google.com>,
	"Graham Roff" <grahamr@qti.qualcomm.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Borislav Petkov (AMD)" <bp@alien8.de>,
	"Gary Guo" <gary@garyguo.net>,
	linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org,
	conor.dooley@microchip.com
Subject: Re: [PATCH 1/3] kconfig: Add "def_string", "def_int" and "def_hex"
Date: Mon, 21 Sep 2026 11:25:41 +0100	[thread overview]
Message-ID: <c3ed62e7-732c-40fe-ba1e-f820b9473cc9@gmail.com> (raw)
In-Reply-To: <202609191431.C3BCBCD@keescook>

On 9/20/26 04:40, Kees Cook wrote:

>> The second problem, is that since the order of defaults matters and
>> conditions can shadow each other, def_<type> makes it harder for users
>> to get defaults right. In the past, I've seen several config options
>> with bugged defaults due to 'default' + 'def_<type>' [2][3][4].
> 
> This is the one I, too, got worried about. From your example:
> 
>  config GUEST_STATE_BUFFER_TEST
> -	def_tristate n
> +	def_tristate KUNIT_ALL_TESTS
>  	prompt "Enable Guest State Buffer unit tests"
>  	depends on KUNIT
>  	depends on KVM_BOOK3S_HV_POSSIBLE
> -	default KUNIT_ALL_TESTS
>  	help
> 
> Is there a way to detect this state? (I assume as a follow-up; it's a
> general problem.)

Unfortunately there's no way to avoid some false alarms when checking
these due to macros.

Example:

    config TUNE_CPU
        string
        depends on POWERPC64_CPU
        default "-mtune=power10" if $(cc-option,-mtune=power10)
        default "-mtune=power9"  if $(cc-option,-mtune=power9)
        default "-mtune=power8"  if $(cc-option,-mtune=power8)

These macros get evaluated during preprocessing, which is ahead of when
the parse tree is finished and analysis can run.

Though a check for it is included in kconfirm (if merged) [1], and I've
also been thinking about making this part of an optional KCONFIG_LINT
setting, where some false positives could be acceptable.

[1]
https://lore.kernel.org/all/20260727001623.2794156-1-julianbraha@gmail.com/

- Julian Braha

  reply	other threads:[~2026-09-21 10:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-19  0:59 [PATCH 0/3] kconfig: Introduce cc-option-str Kees Cook
2026-09-19  0:59 ` [PATCH 1/3] kconfig: Add "def_string", "def_int" and "def_hex" Kees Cook
2026-09-19 15:34   ` Julian Braha
2026-09-20  3:40     ` Kees Cook
2026-09-21 10:25       ` Julian Braha [this message]
2026-09-19  0:59 ` [PATCH 2/3] kconfig: Replace "cc-option-bit" with "cc-option-str" Kees Cook
2026-09-21 12:09   ` Julian Braha
2026-09-19  0:59 ` [PATCH 3/3] kconfig: Add "ld-option-str" Kees Cook
2026-09-21 12:27   ` Julian Braha
2026-09-19  1:25 ` [PATCH 0/3] kconfig: Introduce cc-option-str Nathan Chancellor
2026-09-19 13:31   ` Lorenzo Stoakes (ARM)
2026-09-24 15:41 ` Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c3ed62e7-732c-40fe-ba1e-f820b9473cc9@gmail.com \
    --to=julianbraha@gmail.com \
    --cc=andrew.jones@linux.dev \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=conor.dooley@microchip.com \
    --cc=corbet@lwn.net \
    --cc=gary@garyguo.net \
    --cc=grahamr@qti.qualcomm.com \
    --cc=kees@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ljs@kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=mmaurer@google.com \
    --cc=nathan@kernel.org \
    --cc=nico@fluxnic.net \
    --cc=nsc@kernel.org \
    --cc=officialnaumansabir@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    --cc=thomas.weissschuh@linutronix.de \
    --cc=tj@kernel.org \
    --cc=vegard.nossum@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®