Received: by 10.223.185.116 with SMTP id b49csp2203383wrg; Mon, 12 Feb 2018 06:08:07 -0800 (PST) X-Google-Smtp-Source: AH8x225YnjxEjbGT2bcSBnSQ6ydEJwpkfafLWbmGN9FrSOFzPQGfNB7l2ZWowSepQN1PMBkmrsAM X-Received: by 10.99.61.75 with SMTP id k72mr9129984pga.384.1518444487035; Mon, 12 Feb 2018 06:08:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518444486; cv=none; d=google.com; s=arc-20160816; b=WfNxl5HwpKOskLC3lfpOuxryXemk94+4pf0fm90VpdKWRZnX0exsNvxqP1yBa3pFIe V6OzU1rpIPauQph7wxjSWdHnGiV5fdvel3dBT/5ALrTeVrty4VF4M8PIdAtmCVU4umEt 5FBRbNXVN75iqL0IB4OkkouBMpVVu2wz84dSUYIRJVXGEYTs09MF11qy5erACd6UXKJv jNM7LEBEuJcNmFNA/Wxb4n5Dm42Wt+hs4zoBRKEiT8T3l7/Bf0dW1OJViOHvFKTekOme HzHeWsxenSEdc9e1Fn129oME6HUrDl24n64AnOI3jMjamo2fqcDN9RWIZ8tHvNEn/KO2 od+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender: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=jfdI3Jsz3rzUFwd/b9RlwG2NJQalkBnKd+cLc/zjm9a2jKWJkA7zZD7pmAXK9hBj2r q6ocU7wKRfeu2F93iEjHXvlQQ//W1Vtj04E+6ImOlUl9NSUCzUONsH9VPVX5Q2PMAgyp sRUqQtLkAKkS69WGStWiD1VP2n+zmPUCy4RxJ4TnoD1OEK8TflNp4sbP3RzIzY1TRtic MRsQIoTAIw4NutEnPTyS3vPN2nLDMR7LoBGX+rdqrGDccU0rNoY5LyFacacMtoWuR2Te pFyysK9ZC4xYMKoP12bk4v5qtB4aelbm4zSSaZs8+Vk7lV8cd8Hpf+U0btlMNxpJYUkE Nh/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tP0aU7pM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3-v6si2531161pli.338.2018.02.12.06.07.46; Mon, 12 Feb 2018 06:08:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tP0aU7pM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934994AbeBLMzX (ORCPT + 99 others); Mon, 12 Feb 2018 07:55:23 -0500 Received: from mail-lf0-f43.google.com ([209.85.215.43]:37804 "EHLO mail-lf0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933341AbeBLMzO (ORCPT ); Mon, 12 Feb 2018 07:55:14 -0500 Received: by mail-lf0-f43.google.com with SMTP id f137so20298184lfe.4; Mon, 12 Feb 2018 04:55:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=iNObf1JEqzy7w4FU7NZgpGlEogROWKrEz1AaYN3QEP0=; b=tP0aU7pMITax+IN+pXj1CYzJZkXgDcabY0U7qVU0Dv9XmUxdwZr+tBB2PyW+fAU0PK hO6On//lAdov0LjJqnSoTnrVPkkoU9OtSemJyRkQZ3f5gvyXn8pOAXheZulwjudJFend DupQesBtC44BgxPoTLNZzU32B4G8GAepRxP3BjjXbB2CqGzEsLb8dh8XvcO5jKWlrd7W cGH9Mq6We0SeqV7DuCMchgsl9q2N1aeVXN8n0awPo22VDhjyPPKg7OVgFdou6j6kq477 L5lat20IqBPtYCaLfWuL8Rzot4fuQEtjo1D9fZZSACfJCm4wjkBMHcm94JSMx4Y+DzRP 8aPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=iNObf1JEqzy7w4FU7NZgpGlEogROWKrEz1AaYN3QEP0=; b=nfqIkG8rABXizaIiqJH9e4c+qEBx0qXuKVJ+/lwpYWce3AhGQ166pWoyNiffa63IR+ UxDsPfDW9pgq1K4bGnqSV+oKfk5dKN7gYpvcGeVDidzSMu6nhdPuxI8fuphSGIjIgACS FBAQ/WC8mq29uHptK2407rBhxWsLcTFJnNMzS6ckvUlmdXFoOvBpzFZvkoyc5jLOfgc2 Kvon+6ETKH2MNZJ+zzX9O+1aMcFoinLohUNfZvOqyq+Ev/lmVe3gSUZVTxeunm/48nR+ sgmZijkf6nKaJmOzDwYCWp69u1f6f7mrHaaSqYXJidHinglI/ibg2rMPCeBf6YGJP01H xoIQ== X-Gm-Message-State: APf1xPDlwYi597cN6EdAkmN5VWR5YghAjH/Jk+xIQeT8N8JulRa1JwVK ZfkzJl9TRE/uWrJPMgxe90k= X-Received: by 10.46.125.3 with SMTP id y3mr7899288ljc.23.1518440112477; Mon, 12 Feb 2018 04:55:12 -0800 (PST) Received: from huvuddator (ua-213-113-106-221.cust.bredbandsbolaget.se. [213.113.106.221]) by smtp.gmail.com with ESMTPSA id h11sm1663410lfd.53.2018.02.12.04.55.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 04:55:11 -0800 (PST) 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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