From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755305AbcARNgV (ORCPT ); Mon, 18 Jan 2016 08:36:21 -0500 Received: from er-systems.de ([148.251.68.21]:55556 "EHLO er-systems.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754902AbcARNgQ (ORCPT ); Mon, 18 Jan 2016 08:36:16 -0500 Date: Mon, 18 Jan 2016 14:36:09 +0100 (CET) From: Thomas Voegtle X-X-Sender: thomas@er-systems.de To: Borislav Petkov cc: Michal Marek , =?ISO-8859-15?Q?M=E5ns_Rullg=E5rd?= , Markus Trippelsdorf , linux-kernel@vger.kernel.org, x86-ml Subject: Re: [RFC PATCH] x86/kconfig: Sanity-check config file during oldconfig In-Reply-To: <20160114184350.GB12109@pd.tnic> Message-ID: References: <20160108121601.GC320@x4> <20160108122719.GG14673@pd.tnic> <568FB028.1030706@suse.cz> <20160108133725.GH14673@pd.tnic> <568FCC45.1010301@suse.cz> <20160111194311.GF4686@pd.tnic> <20160111205945.GH4686@pd.tnic> <20160111211712.GI4686@pd.tnic> <20160114184350.GB12109@pd.tnic> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="-74181308-2065680098-1453124172=:26335" X-Virus-Checker-Version: clamassassin 1.2.4 with clamdscan / ClamAV 0.99/21275/Mon Jan 18 06:35:28 2016 signatures 55. Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---74181308-2065680098-1453124172=:26335 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT On Thu, 14 Jan 2016, Borislav Petkov wrote: > From: Borislav Petkov > > 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 > Cc: Markus Trippelsdorf > Cc: Måns Rullgård > Signed-off-by: Borislav Petkov > --- > 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 ---74181308-2065680098-1453124172=:26335--