From: Kees Cook <kees@kernel.org>
To: Julian Braha <julianbraha@gmail.com>
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: Sat, 19 Sep 2026 20:40:13 -0700 [thread overview]
Message-ID: <202609191431.C3BCBCD@keescook> (raw)
In-Reply-To: <cdebaad4-00c2-4b80-b688-0f5a723d6009@gmail.com>
On Sat, Sep 19, 2026 at 04:34:54PM +0100, Julian Braha wrote:
> On 9/19/26 01:59, Kees Cook wrote:
> [...]
> the X condition here only applies to the value of y, but not to the type
> declaration of bool. Besides hurting readability, I can imagine a user
> making a mistake by attempting something like this:
>
> def_bool 'y' if X
> def_tristate 'y' if !X
>
> thinking that they're making the type conditional. Of course, the
> interpreter warns if this is attempted, so you won't actually find any
> of these in the tree.
Yeah, _this_ case is warned on, so no real issue there.
> 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.)
> > Signed-off-by: Kees Cook <kees@kernel.org>
>
> Tested-by: Julian Braha <julianbraha@gmail.com>
> Reviewed-by: Julian Braha <julianbraha@gmail.com>
Thanks!
--
Kees Cook
next prev parent reply other threads:[~2026-09-20 3:40 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 [this message]
2026-09-21 10:25 ` Julian Braha
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=202609191431.C3BCBCD@keescook \
--to=kees@kernel.org \
--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=julianbraha@gmail.com \
--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 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.