From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: ARC-Seal: i=1; a=rsa-sha256; t=1518440112; cv=none; d=google.com; s=arc-20160816; b=nRSp9FBXV67vD/7Y+/vqmiD4zfgn5W2gdeEWV/fZ6qibVePDmYaxD+CdlujdTielqw tWAKoNckH08ASYQP8dbl/senq3vyi2Lf1zBImkfmY9NEFrEpIQaBpYBFG2QsfXg05/xZ s6lZT+miaY6xyYNDUp+dmmTfqDYd+XzsMLeunhGtGiJ8J9pqLQ+E6Uyu1UGCeSRMjiVP 6EuNpWeyFYmjZ5ox7xYUI8z5x1wH8XbqW9x+Mix56odr9+SGpWdPHdiXxgVkSo9MLsfi oQxQIVa/hjsliufOk1pLUatOzsHGPy/gcKB9I4nQ3A4NAzidonrEmB0557JgJAdPJKPx ebvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=iNObf1JEqzy7w4FU7NZgpGlEogROWKrEz1AaYN3QEP0=; b=LvM+nJT3w3UWYBSFeuScj4TPp3AmjwhRTMQmpJa/j5a6YhLwJnWEYDBEU3alMhPG8d KAlpzdk6mkYa+y6IbVy2IuuJ/BFPB6ZcU1xHUr2cVjBWeplXp6XO2vtHS2a5lsk1UgPK l3Zu9vla//Gs0FMQnLqoQDmwBiYTu6rV5TId8BuOFzl+qY9bi8g1scUUyy9dSSxZlbXY qJOSWwVzinqo2Zqt2sHuWrotiBu9HXqMV0ALwWl00QhKWsy5kW6flnHcGyxwOw58zoO0 kZtU4gWANmfU358Gv/lb8zRhPxyo7SvmP2Q2ZSmcDIfGspNOWlBjtk4gbgqq8LaHeRRA IJmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tP0aU7pM; spf=pass (google.com: domain of ulfalizer@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulfalizer@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tP0aU7pM; spf=pass (google.com: domain of ulfalizer@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulfalizer@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Google-Smtp-Source: AH8x224QRVa+mwokRKjVu+sTDWY7U5B0RN49wGnLH4k1Gve+hOFNYlkqXhMoGYSwDwedTqgD+xyERg== Date: Mon, 12 Feb 2018 13:54:58 +0100 From: Ulf Magnusson To: Kees Cook Cc: Linus Torvalds , Masahiro Yamada , Linux Kbuild mailing list , Greg Kroah-Hartman , Andrew Morton , Nicolas Pitre , "Luis R . Rodriguez" , Randy Dunlap , Sam Ravnborg , Michal Marek , Martin Schwidefsky , Pavel Machek , linux-s390 , Jiri Kosina , Linux Kernel Mailing List , Tejun Heo , Ingo Molnar , "Van De Ven, Arjan" , Arnd Bergmann Subject: Re: [RFC PATCH 4/7] kconfig: support new special property shell= Message-ID: <20180212125458.vb4ve3ieejvuvo65@huvuddator> References: <20180210085519.737ckf4bcl57h4g2@huvuddator> <20180211103432.pf2ot6nd7nbhdhsy@huvuddator> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1591850368607646970?= X-GMAIL-MSGID: =?utf-8?q?1592199859983260775?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: On Sun, Feb 11, 2018 at 09:42:09PM +0100, Ulf Magnusson wrote: > On Sun, Feb 11, 2018 at 9:29 PM, Ulf Magnusson wrote: > > On Sun, Feb 11, 2018 at 6:56 PM, Kees Cook wrote: > >> Another case I mentioned before that I just want to make sure we don't > >> reintroduce the problem of getting "stuck" with a bad .config file. > >> While adding _STRONG support, I discovered the two-phase Kconfig > >> resolution that happens during the build. If you selected _STRONG with > >> a strong-capable compiler, everything was fine. If you then tried to > >> build with an older compiler, you'd get stuck since _STRONG wasn't > >> support (as detected during the first Kconfig phase) so the > >> generated/autoconf.h would never get updated with the newly selected > >> _REGULAR). I moved the Makefile analysis of available stack-protector > >> options into the second phase (i.e. after all the Kconfig runs), and > >> that worked to both unstick such configs and provide a clear message > >> early in the build about what wasn't available. > >> > >> If all this detection is getting moved up into Kconfig, I'm worried > >> we'll end up in this state again. If the answer is "you have to delete > >> autoconf.h if you change compilers", then that's fine, but it sure > >> seems unfriendly. :) > > > > Did you mean include/config/auto.conf? That's the one that gets > > included by the Makefiles. > > > > If the feature detection is moved into Kconfig, you should only need > > to rerun the configuration (make menuconfig/oldconfig/olddefconfig) if > > you change the compiler. That will update .config while taking the new > > features into account, and then the second phase during 'make' will > > update include/config/auto.conf from .config. > > > > That second Kconfig phase generates include/generated/autoconf.h and > > include/config/. The include/config/ directory implements dependencies > > between source files and Kconfig symbols by turning the symbols into > > (empty) files. When building (during the "second phase"), Kconfig > > compares .config with include/config/auto.conf to see what changed, > > and signals the changes to 'make' by touch'ing the files corresponding > > to the changed symbols. The idea is to avoid having to do a full > > rebuild whenever the configuration is changed. > > > > Check out scripts/basic/fixdep.c as well if you want to understand how it works. > > > > Cheers, > > Ulf > > By the way: > > That second phase is also a "normal" Kconfig run in the sense that it > does all the usual dependency checking stuff. Even if .config doesn't > respect dependencies, include/config/auto.conf will. So I think you > might not even need to rerun the configuration (though .config will be > out-of-date until you do). > > Cheers, > Ulf Seems you'd have to rerun the configuration, because include/config/auto.conf is only regenerated if it's older than .config. Here's the bit in the root Makefile that does it (KCONFIG_CONFIG is .config). # If .config is newer than include/config/auto.conf, someone tinkered # with it and forgot to run make oldconfig. # if auto.conf.cmd is missing then we are probably in a cleaned tree so # we execute the config step to be sure to catch updated Kconfig files include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig silentoldconfig is a terrible name. What it actually does is run that "second phase" stuff. Pretty sure that comment lies by the way. 'make oldconfig' doesn't update include/config/auto.conf. It's probably outdated. I wonder if it would be simpler to just always run silentoldconfig when building. It's not that slow on my system: $ export ARCH=x86 SRCARCH=x86 KERNELVERSION=`make kernelversion` $ time scripts/kconfig/conf --silentoldconfig Kconfig real 0m0.167s user 0m0.162s sys 0m0.004s That'd both simplify the Makefiles, and make sure that the latest features are always used if you do feature testing in Kconfig. I don't know how strongly people feel about a few tenths of a second though. Cheers, Ulf