lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202308251121.23BAF46E@keescook>
Date:   Fri, 25 Aug 2023 11:23:17 -0700
From:   Kees Cook <keescook@...omium.org>
To:     Nicolas Schier <n.schier@....de>
Cc:     Masahiro Yamada <masahiroy@...nel.org>, x86@...nel.org,
        linux-arm-kernel@...ts.infradead.org,
        linuxppc-dev@...ts.ozlabs.org, linux-riscv@...ts.infradead.org,
        linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-kbuild@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] kbuild: Show Kconfig fragments in "help"

On Fri, Aug 25, 2023 at 07:44:06AM +0200, Nicolas Schier wrote:
> On Thu, Aug 24, 2023 at 03:36:10PM -0700, Kees Cook wrote:
> > Doing a "make help" would show only hard-coded Kconfig targets and
> > depended on the archhelp target to include ".config" targets. There was
> > nothing showing global kernel/configs/ targets. Solve this by walking
> > the wildcard list and include them in the output, using the first comment
> > line as the help text.
> > [...]
> 
> Thanks for that patch!  Several times I found myself searching the tree
> to find a specific kconfig fragment; I think you found a nice solution.
> Two minor things below.
> 
> [...]
> > diff --git a/kernel/configs/tiny-base.config b/kernel/configs/tiny-base.config
> > index 2f0e6bf6db2c..ac4d254abc3f 100644
> > --- a/kernel/configs/tiny-base.config
> > +++ b/kernel/configs/tiny-base.config
> > @@ -1 +1,2 @@
> > +# Minimal options for tiny systems
> >  CONFIG_EMBEDDED=y
> 
> (just a note: Randy prepared a patch for removing CONFIG_EMBEDDED:
> https://lore.kernel.org/linux-kbuild/20230816055010.31534-1-rdunlap@infradead.org/)

Ah yeah, I'll rebase this after the merge window, I guess...

> > diff --git a/kernel/configs/tiny.config b/kernel/configs/tiny.config
> > index 00009f7d0835..ea643e8f7f14 100644
> > --- a/kernel/configs/tiny.config
> > +++ b/kernel/configs/tiny.config
> > @@ -1,3 +1,5 @@
> > +# Smallest possible kernel image
> 
> For this fragment alone (not within 'tinyconfig'), "Size-optimize kernel
> image" possibly fits better?

Sounds good to me!

> > diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> > index af1c96198f49..c523f24b504a 100644
> > --- a/scripts/kconfig/Makefile
> > +++ b/scripts/kconfig/Makefile
> > @@ -93,11 +93,11 @@ endif
> >  %_defconfig: $(obj)/conf
> >  	$(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
> >  
> > -configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/configs/$@)
> > +configfiles=$(wildcard $(srctree)/kernel/configs/$(1) $(srctree)/arch/$(SRCARCH)/configs/$(1))
> >  
> >  %.config: $(obj)/conf
> > -	$(if $(call configfiles),, $(error No configuration exists for this target on this architecture))
> > -	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m .config $(configfiles)
> > +	$(if $(call configfiles,$@),, $(error No configuration exists for this target on this architecture))
> > +	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m .config $(call configfiles,$@)
> >  	$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
> >  
> >  PHONY += tinyconfig
> > @@ -115,6 +115,7 @@ clean-files += tests/.cache
> >  
> >  # Help text used by make help
> >  help:
> > +	@echo  'Configuration targets:'
> >  	@echo  '  config	  - Update current config utilising a line-oriented program'
> >  	@echo  '  nconfig         - Update current config utilising a ncurses menu based program'
> >  	@echo  '  menuconfig	  - Update current config utilising a menu based program'
> > @@ -141,6 +142,12 @@ help:
> >  	@echo  '                    default value without prompting'
> >  	@echo  '  tinyconfig	  - Configure the tiniest possible kernel'
> >  	@echo  '  testconfig	  - Run Kconfig unit tests (requires python3 and pytest)'
> > +	@echo  ''
> > +	@echo  'Configuration fragment targets (for enabling various Kconfig items):'
> > +	@$(foreach c, $(call configfiles,*.config), \
> > +		printf "  %-20s - %s\\n" \
> > +			$(shell basename $(c)) \
> > +			"$(subst # ,,$(shell grep -m1 '^# ' $(c)))";)
> 
> Better use '$(notdir $(c))` instead of forking a shell with
> '$(shell basename $(c))'.

Ah! Thank you. I *knew* there was a function for this but couldn't find
it for some reason. :)

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ