Received: by 10.213.65.68 with SMTP id h4csp19370imn; Tue, 27 Mar 2018 20:35:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx49H2oNLo1gCaFPKtgGLtbJm52swEAgS/lt46ZNyWHFAITg+RZhyyzJ5vKdNhvBsiZWqQWPB X-Received: by 10.98.217.139 with SMTP id b11mr1560460pfl.113.1522208143422; Tue, 27 Mar 2018 20:35:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522208143; cv=none; d=google.com; s=arc-20160816; b=GVRGlCA7eZ3W3Ch2i23HEQCtDXjvbLw9PUYeo2qxd9lqMV5LG9EmEMx8KG10V6Iqqj qO0Z2YfV9OTG38boDueokfsJi0i2wyKqulOc2yFPMDPyLlz99OOr/H+ARvnMRKg2hRH1 03it82IatIrEAtfJEkLGOZRsnucOjDZ9fmjaNyUv9pbZCkebX80yfNF1cOZmuAfqHqjw ahfJK0CYbush9aVxFdsjHt5uMoge5evEUurp4s6X6zwEhE4R/5zFk12W6MTqzUL6uZlP fLwjPiDyl4Fn8pUcoQ3bjwojZ6HEcOWNE0NG1hRrb8E2GAZSPE0fQrjn/nyuwIzNnPhB bh5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=R53ac+YG9eGsavk1O/uXCKuTO10ROlgzoAzMiev7iGU=; b=GQpJ/46hR53iRgwAqmZChp2iiI1W72AVxRQxdZTC8IYbWFbDaA1aydLH0jIkXZIr5I 9Q1SAvgoEQSCkhLbYcYUcRUunztQiXkqKMvQD6U59KxKzq2gQdlnLyNx7AkxCsgdsm9Z /TUxLVcmtOtwmpxJ1DVjOI6csw815xVf4ACv+HOPsX1rFqLcc/2/7CrRXzGjMXD9mFjc Of1FEqFiCc3oQ52JXO1wu1TDpoxmpzTl06kUTeR8Q/+EzTfL5DExg1wLODKchfiMvyZx gPybyv0rdN10dAqVWXBqfUF6qDfsPQlyEYaznTxo12O4sOYsEekK8SUyDa/nsQ7fZ04l VeUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=NhFdrqSV; dkim=fail header.i=@chromium.org header.s=google header.b=ZMR1amzH; 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=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c11-v6si2352742pls.97.2018.03.27.20.35.27; Tue, 27 Mar 2018 20:35:43 -0700 (PDT) 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=fail header.i=@google.com header.s=20161025 header.b=NhFdrqSV; dkim=fail header.i=@chromium.org header.s=google header.b=ZMR1amzH; 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=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752484AbeC1Dd6 (ORCPT + 99 others); Tue, 27 Mar 2018 23:33:58 -0400 Received: from mail-vk0-f68.google.com ([209.85.213.68]:34328 "EHLO mail-vk0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751973AbeC1Dd4 (ORCPT ); Tue, 27 Mar 2018 23:33:56 -0400 Received: by mail-vk0-f68.google.com with SMTP id z190so612229vkg.1 for ; Tue, 27 Mar 2018 20:33:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=R53ac+YG9eGsavk1O/uXCKuTO10ROlgzoAzMiev7iGU=; b=NhFdrqSVOX9sErR8FP/LMWft2sAUcX0+Q9iawf5QGfjNUMo7jg9Vwp9nnWnuFqA3Uz ZSQsIcxtC4DK7+W7vRNuNUMfQZKsSl7e554wGXjqLT/O6pzfgnKT2uj+E/klR755Bxc7 ONq6WOELlx8l/oAt1g0HADBzX/y9NrJfrOyHYdNWWFxZOcDBuwXqBflVK4Y9phM4tGRc vfDuJcmXkHoev+gepFudumFgMdF0D1mVRidYhMWCYl8rnrtDHdYgahiXSu5LunRKDO8l X75f5rtEXyS3lT6tTx4EoRs2ofaeWaqoreS/peMoMTyLWGfWvTESKYhgNre8wykC6/89 CAkg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=R53ac+YG9eGsavk1O/uXCKuTO10ROlgzoAzMiev7iGU=; b=ZMR1amzHLt+JWS/mNX5lsL7Or3af/QacMZjXr9WNwzR7jAMIiWcmGz6mDREOvx/NlV N+pa2S7fq1UR3K3Tk7StBxNig8GfvfMIS0fIKv9v+ZnrQO7T46mz/6yOMRveo7ZU4ZUB MIDLj1/aiKtn3fdbknwK8jgPeYm74lSi3ldrY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=R53ac+YG9eGsavk1O/uXCKuTO10ROlgzoAzMiev7iGU=; b=sOra6hzDkQx1+S0vhlGAYp/YH5o92pMoGGcwsiryVGyu21n+9O97ku7HYRB/b+WBe7 bGNyeX2a2lmFVGWNCn5fqgfxMtTGRRHmjlMr2rFzN0qxvqOb+aiv9txPVegTtEjcko8H UkNy0LQQmZ+XZT+T2wjq8NURbsUyza3dsq40esf2saouCONP7ije9pWYvlDA7j8ug0VX EjwCUCfLQ56Xl3WixYX8SHIwh5f+pvPHd6uauEA+8CeEf6F1m0WDg5HPezW6DgPl0RkR 0CrMB9RNr27WMFKry+rtO3Xy9ZGp1V+hnK8mytmB9dozITitDA8DhPelmij95AOPYd+W NuXA== X-Gm-Message-State: AElRT7H7cLntGdY8mrx7lmx5rpZzcaUv96OJfXlTgh9AQUh1zvmrq5n2 +WWaRGdwX6r7CEiAjxYeS2RBMe042+kxa1aKd+mZGA== X-Received: by 10.31.83.197 with SMTP id h188mr1268304vkb.84.1522208035021; Tue, 27 Mar 2018 20:33:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.129.9 with HTTP; Tue, 27 Mar 2018 20:33:54 -0700 (PDT) In-Reply-To: <1522128575-5326-5-git-send-email-yamada.masahiro@socionext.com> References: <1522128575-5326-1-git-send-email-yamada.masahiro@socionext.com> <1522128575-5326-5-git-send-email-yamada.masahiro@socionext.com> From: Kees Cook Date: Tue, 27 Mar 2018 20:33:54 -0700 X-Google-Sender-Auth: rQHAEFjisRRFl5M-Oc5QNib_6No Message-ID: Subject: Re: [PATCH v2 04/21] kconfig: reference environments directly and remove 'option env=' syntax To: Masahiro Yamada Cc: linux-kbuild , Sam Ravnborg , Linus Torvalds , Arnd Bergmann , Ulf Magnusson , Thomas Gleixner , Greg Kroah-Hartman , Randy Dunlap , "Luis R . Rodriguez" , Nicolas Pitre , LKML , Ingo Molnar Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 26, 2018 at 10:29 PM, Masahiro Yamada wrote: > To get an environment value, Kconfig needs to define a symbol using > "option env=" syntax. It is tedious to add a config entry for each > environment given that we need more environments such as 'CC', 'AS', > 'srctree' etc. to evaluate the compiler capability in Kconfig. > > Adding '$' to symbols is weird. Kconfig can reference symbols directly > like this: > > config FOO > string > default BAR > > So, I want to use the following syntax to get environment 'BAR' from > the system: > > config FOO > string > default $BAR > > Looking at the code, the symbols prefixed with 'S' are expanded by: > - conf_expand_value() > This is used to expand 'arch/$ARCH/defconfig' and 'defconfig_list' > - expand_string_value() > This is used to expand strings in 'source' and 'mainmenu' > > All of them are fixed values independent of user configuration. So, > this kind of syntax should be moved to simply take the environment. > > This change makes the code much cleaner. The bounce symbols 'SRCARCH', > 'ARCH', 'SUBARCH', 'KERNELVERSION' are gone. > > sym_init() hard-coding 'UNAME_RELEASE' is also gone. 'UNAME_RELEASE' > should be be given from the environment. > > ARCH_DEFCONFIG is a normal symbol, so it should be simply referenced > by 'default ARCH_DEFCONFIG'. > > The environments are expanding in the lexer; when '$' is encountered, > it is expanded, and resulted strings are pushed back to the input > stream. This makes the implementation simpler. > > For example, the following code works. > > [Example code] > > config TOOLCHAIN_LIST > string > default "My tools: CC=$CC, AS=$AS, CPP=$CPP" > > [Result] > > $ make -s alldefconfig && tail -n 1 .config > CONFIG_TOOLCHAIN_LIST="My tools: CC=gcc, AS=as, CPP=gcc -E" > > Signed-off-by: Masahiro Yamada For easier review this patch could maybe get split into a couple (i.e. refactoring of things like env_write_dep()) but it's probably fine as-is. :) Reviewed-by: Kees Cook -Kees -- Kees Cook Pixel Security