mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Voegtle <tv@lio96.de>
To: Borislav Petkov <bp@suse.de>
Cc: "Michal Marek" <mmarek@suse.cz>, "Måns Rullgård" <mans@mansr.com>,
	"Markus Trippelsdorf" <markus@trippelsdorf.de>,
	linux-kernel@vger.kernel.org, x86-ml <x86@kernel.org>
Subject: Re: [RFC PATCH] x86/kconfig: Sanity-check config file during oldconfig
Date: Mon, 18 Jan 2016 14:36:09 +0100 (CET)	[thread overview]
Message-ID: <alpine.LSU.2.11.1601181433590.26335@er-systems.de> (raw)
In-Reply-To: <20160114184350.GB12109@pd.tnic>

[-- Attachment #1: Type: text/plain, Size: 3426 bytes --]

On Thu, 14 Jan 2016, Borislav Petkov wrote:

> From: Borislav Petkov <bp@suse.de>
>
> Thomas Voegtle reported that doing oldconfig with a .config which has
> CONFIG_MICROCODE enabled but BLK_DEV_INITRD disabled prevents the
> microcode loading mechanism from being built.
>
> Add a short script which hooks into the "make oldconfig" handling and
> sanity-checks the config file for that discrepancy. It issues a message
> which should hopefully sensitize the user to that issue and point her
> into the right direction.
>
> The other useful thing with this solution is that it can be extended to
> other config file sanity-checking, should the need arise.
>
> Reported-by: Thomas Voegtle <tv@lio96.de>
> Cc: Markus Trippelsdorf <markus@trippelsdorf.de>
> Cc: Måns Rullgård <mans@mansr.com>
> Signed-off-by: Borislav Petkov <bp@suse.de>
> ---
> arch/x86/scripts/check-configs.sh | 44 +++++++++++++++++++++++++++++++++++++++
> scripts/kconfig/Makefile          |  3 +++
> 2 files changed, 47 insertions(+)
> create mode 100644 arch/x86/scripts/check-configs.sh
>
> diff --git a/arch/x86/scripts/check-configs.sh b/arch/x86/scripts/check-configs.sh
> new file mode 100644
> index 000000000000..775d07e37df5
> --- /dev/null
> +++ b/arch/x86/scripts/check-configs.sh
> @@ -0,0 +1,44 @@
> +#!/bin/bash
> +
> +if [ "$1" != "oldconfig" ]; then
> +	exit 0
> +fi
> +
> +srctree=$2
> +ARCH="$3"
> +UNAME_RELEASE=$(uname -r)
> +
> +CONFIGS=".config /lib/modules/$UNAME_RELEASE/.config /etc/kernel-config /boot/config-$UNAME_RELEASE"
> +
> +if [ "$ARCH" = "X86_32" ]; then
> +	CONFIGS="$CONFIGS $srctree/arch/x86/configs/i386_defconfig"
> +else
> +	CONFIGS="$CONFIGS $srctree/arch/x86/configs/x86_64_defconfig"
> +fi
> +
> +for c in $CONFIGS;
> +do
> +	if [ -e $c ]; then
> +		OLD_CONFIG=$c
> +		break
> +	fi
> +done
> +
> +if [ -z "$OLD_CONFIG" ]; then exit 0; fi
> +
> +# Check optimal microcode loader .config settings
> +if ! grep -v "^#" $OLD_CONFIG | grep -q MICROCODE; then
> +	exit 0
> +fi
> +
> +MSG="\nYou have CONFIG_MICROCODE enabled without BLK_DEV_INITRD. The preferred\n\
> +way is to enable it and make sure microcode is added to your initrd as\n\
> +explained in Documentation/x86/early-microcode.txt. This is also the\n\
> +most tested method as the majority of distros do it. Alternatively, and\n\
> +if you don't want to enable modules, you should make sure the microcode\n\
> +is built into the kernel.\n"
> +
> +if ! grep -v "^#" $OLD_CONFIG | grep -q BLK_DEV_INITRD; then
> +	echo -e $MSG
> +	read -p "Press any key... "
> +fi
> diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> index d79cba4ce3eb..136ae9744efc 100644
> --- a/scripts/kconfig/Makefile
> +++ b/scripts/kconfig/Makefile
> @@ -81,6 +81,9 @@ simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
> PHONY += $(simple-targets)
>
> $(simple-targets): $(obj)/conf
> +ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/scripts/check-configs.sh),)
> +	$(Q)$(CONFIG_SHELL) $(srctree)/arch/$(SRCARCH)/scripts/check-configs.sh $@ $(srctree) $(ARCH)
> +endif
> 	$< $(silent) --$@ $(Kconfig)
>
> PHONY += oldnoconfig savedefconfig defconfig
>


My problem was, CONFIG_MICROCODE got dropped silently, and yes that is
fixed for me with this patch.
But I think this is a little bit odd way to fix it, but I don't have a 
better idea.

What's with olddefconfig and silentoldconfig ?

btw that patch has to go to stable 4.4, too


   Thomas


  reply	other threads:[~2016-01-18 13:36 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-19 21:43 x86/microcode update on systems without INITRD Markus Trippelsdorf
2015-11-19 21:55 ` Borislav Petkov
2015-11-19 22:58   ` Borislav Petkov
2015-11-20  7:19     ` Markus Trippelsdorf
2015-11-20  8:27       ` Borislav Petkov
2015-11-20  8:33         ` Markus Trippelsdorf
2015-11-20  8:48           ` Borislav Petkov
2015-11-20 11:24             ` [PATCH] x86/microcode: Initialize the driver late when facilities are up Borislav Petkov
2015-11-23 16:28               ` [tip:x86/urgent] " tip-bot for Borislav Petkov
2016-01-07 12:12         ` x86/microcode update on systems without INITRD Thomas Voegtle
2016-01-07 12:18           ` Borislav Petkov
2016-01-07 12:36             ` Thomas Voegtle
2016-01-07 12:41               ` Markus Trippelsdorf
2016-01-08  9:33                 ` Thomas Voegtle
2016-01-08 12:18                 ` Mike Keehan
2016-01-08 12:20                   ` Markus Trippelsdorf
2016-01-08 10:59               ` Borislav Petkov
2016-01-08 11:18                 ` Måns Rullgård
2016-01-08 11:36                   ` Borislav Petkov
2016-01-08 11:46                     ` Måns Rullgård
2016-01-08 12:08                       ` Borislav Petkov
2016-01-08 12:16                         ` Markus Trippelsdorf
2016-01-08 12:27                           ` Borislav Petkov
2016-01-08 12:28                             ` Måns Rullgård
2016-01-08 12:48                             ` Michal Marek
2016-01-08 13:37                               ` Borislav Petkov
2016-01-08 14:48                                 ` Michal Marek
2016-01-11 19:43                                   ` Borislav Petkov
2016-01-11 20:29                                     ` Måns Rullgård
2016-01-11 20:59                                       ` Borislav Petkov
2016-01-11 21:04                                         ` Måns Rullgård
2016-01-11 21:17                                           ` Borislav Petkov
2016-01-14 18:43                                             ` [RFC PATCH] x86/kconfig: Sanity-check config file during oldconfig Borislav Petkov
2016-01-18 13:36                                               ` Thomas Voegtle [this message]
2016-01-18 14:06                                                 ` Borislav Petkov
2016-01-18 14:11                                                   ` Måns Rullgård
2016-01-18 14:28                                                     ` Borislav Petkov
2016-01-18 14:41                                                     ` Borislav Petkov
2016-01-18 14:51                                                       ` Måns Rullgård
2016-01-18 15:39                                                         ` Borislav Petkov
2016-01-18 15:42                                                           ` Måns Rullgård
2016-01-19  8:20                                               ` [RFC] CONFIG_FORCE_MINIMALLY_SANE_CONFIG=y (was: Re: [RFC PATCH] x86/kconfig: Sanity-check config file during oldconfig) Ingo Molnar
2016-01-19  8:40                                                 ` Markus Trippelsdorf
2016-01-19  8:54                                                   ` Ingo Molnar
2016-01-19  9:45                                                     ` Borislav Petkov
2016-01-19  9:01                                                 ` Peter Zijlstra
2016-01-19  9:14                                                   ` Ingo Molnar
2016-01-19  9:43                                                 ` Borislav Petkov
2016-01-19  9:57                                                 ` [RFC] CONFIG_FORCE_MINIMALLY_SANE_CONFIG=y Michal Marek
2016-01-19 10:30                                                   ` [RFC] CONFIG_GENERIC_BOOTABLE_CONFIG=y Ingo Molnar
2016-01-19 17:22                                                     ` Linus Torvalds
2016-01-19 17:52                                                       ` Austin S. Hemmelgarn
2016-01-19 12:29                                                 ` [RFC] CONFIG_FORCE_MINIMALLY_SANE_CONFIG=y Måns Rullgård
2016-01-19 12:43                                                   ` Michal Marek
2016-01-19 12:57                                                     ` Måns Rullgård
2016-01-21 22:06                                                 ` [RFC] CONFIG_FORCE_MINIMALLY_SANE_CONFIG=y (was: Re: [RFC PATCH] x86/kconfig: Sanity-check config file during oldconfig) Kirill A. Shutemov
2016-03-09 13:08                                                   ` Ingo Molnar
2016-01-08 12:18                         ` x86/microcode update on systems without INITRD Måns Rullgård
2016-01-19 17:43           ` Borislav Petkov
2016-01-20  9:14             ` Thomas Voegtle
2016-01-20 11:15               ` Borislav Petkov

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=alpine.LSU.2.11.1601181433590.26335@er-systems.de \
    --to=tv@lio96.de \
    --cc=bp@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mans@mansr.com \
    --cc=markus@trippelsdorf.de \
    --cc=mmarek@suse.cz \
    --cc=x86@kernel.org \
    /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

Powered by JetHome