Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp624839pxb; Wed, 22 Sep 2021 09:22:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7rTO/1K0hTvm/MhDGLytjxsZGdguVOYd9NTzyEvh8HVagkK8zSykNprwAfFctLstTWmnF X-Received: by 2002:a50:bf02:: with SMTP id f2mr121191edk.98.1632327720948; Wed, 22 Sep 2021 09:22:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632327720; cv=none; d=google.com; s=arc-20160816; b=amTu86xosGE7d6l/hFgrIklzygcYiFz9givNEnhXWnaH4e8Z+oAftjH5vxfL1K0oTZ 1mi4kwJxs3LPbo75D/HqKdl+EmdpJKeJp6r0Wru0I216YgNpEahl5H1wwFYDhVRFHjW3 rJVlRuF9G0tlHsFlyhGQTf/IpJiXfupTNyZQNKDxEbdkwkwfgNKFFSPoMkBHn2y4o/AY 3cDRfJOr74PSOGKUk7gEItubRv8H1CW5ZkJlRSVY+zU8rKgagERRhPH0pWHCqvJCanfW PMg2OcGZQ1PQynf/i61LIpFOHMcO0TduCyc2sCbo9xs2mvyo6Tl27FQHWpDaadK1YQ4q tRdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date; bh=UXTqdvAt+KA8euY7zhip3JkOY42+VdR5SPJ+DVdL2+c=; b=E+b9+xJEJMMgq8Re6rW12Du9lIhVrmxGiHUpm4j3amwnApRq6pphQkug0uA771gCYX /heNONjgH0ICrZOZeFdmglhBR086MDjZD4AhY1xvonS02dnwfBUGeoeddG/Kw1D85SOd JOAGuwbToOGBaEpMNOZNiXeGlpb5F8W7eMJ/ufEOW9WwSeGb/kQ+1PcuGKkd15OGGfAH P6xiGxfO8uQL+bpqVEcvtfaHfDDRntpXA9O0nazfsFd7CbS5hq28J4+pLS2HU3VJBWAU V8S/9XL6KOkbASIhC4ydqVa4gvWgitXdyQcYLbY4uRg/yFauiULECMvLNTP/jjjKMitx /bfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x20si3119650ejy.481.2021.09.22.09.21.26; Wed, 22 Sep 2021 09:22:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236612AbhIVQTO convert rfc822-to-8bit (ORCPT + 99 others); Wed, 22 Sep 2021 12:19:14 -0400 Received: from lithops.sigma-star.at ([195.201.40.130]:38220 "EHLO lithops.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236523AbhIVQTN (ORCPT ); Wed, 22 Sep 2021 12:19:13 -0400 Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 9A7306171B1D; Wed, 22 Sep 2021 18:17:41 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id g_Xj6GkVOxov; Wed, 22 Sep 2021 18:17:41 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 0FFDE6171AF5; Wed, 22 Sep 2021 18:17:41 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Czl4Cj8z4wMN; Wed, 22 Sep 2021 18:17:40 +0200 (CEST) Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lithops.sigma-star.at (Postfix) with ESMTP id DA4B860F6B83; Wed, 22 Sep 2021 18:17:40 +0200 (CEST) Date: Wed, 22 Sep 2021 18:17:40 +0200 (CEST) From: Richard Weinberger To: Boris Kolpackov Cc: masahiroy , linux-kernel , linux-kbuild Message-ID: <1942256037.97524.1632327460626.JavaMail.zimbra@nod.at> In-Reply-To: References: <20210920213957.1064-1-richard@nod.at> <20210920213957.1064-2-richard@nod.at> <1402570794.96583.1632295660867.JavaMail.zimbra@nod.at> Subject: Re: [PATCH 2/2] kconfig: Deny command substitution in string values MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Originating-IP: [195.201.40.130] X-Mailer: Zimbra 8.8.12_GA_3807 (ZimbraWebClient - FF92 (Linux)/8.8.12_GA_3809) Thread-Topic: kconfig: Deny command substitution in string values Thread-Index: UN+UPErbzOHavDcXoin7FTqpapyswg== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Boris, ----- Ursprüngliche Mail ----- > Von: "Boris Kolpackov" > An: "richard" > CC: "masahiroy" , "linux-kernel" , "linux-kbuild" > > Gesendet: Mittwoch, 22. September 2021 17:18:43 > Betreff: Re: [PATCH 2/2] kconfig: Deny command substitution in string values > Richard Weinberger writes: > >> > So effectively it's now impossible to include ` or $ in kconfig >> > string values. Seems like a major, backwards-incompatible >> > restriction. >> >> Do you have a working example? > > You mean of a project that uses kconfig and that is capable of > handling string values with these characters? If so, then yes, > see for example, libbuild2-kconfig[1] which is a build system > module that implements kconfig-based configuration support for > build2. In particular, it exposes values from .config as > buildfile variables but it doesn't do this by sourcing .config. > Instead it loads .config using the kconfig API and then sets > the corresponding buildfile variables programmatically. I had a config setting of Linux in mind. :-) > >> Since the config is sourced in the scripts/setlocalversion it will >> not work correctly anyway. > > The actual file being sources is include/config/auto.conf, not > .config, right? > Yes. auto.conf is .config post processed. This is exactly where my mitigation takes place. >> > I think if this is really desired, then it should be re-done with >> > escaping (similar to ") rather than outright banning inconvenient >> > characters. >> >> Escaping is not so easy since the very same content is included >> in shell scripts (sertlocalversion), in Makefiles and in C files. > > Again, I don't think it's .config that gets included in C files but > rather include/generated/autoconf.h, right? > Yes. But the key/values are taken as-is. Just add some odd characters to your .config, build the kernel and observe the breakage at different levels. Or something like CONFIG_DEFAULT_HOSTNAME="`touch owned`". ;-) >> At least I didn't find find a good way to escape these characters >> such that all three programming environments will accept it. > > If my understanding is correct, then you are concerned with the > autoconf functionality: the auto.conf makefile and autoconf.h > header, and not the .config file itself. Perhaps it will be less > disruptive to do the escaping (or banning) at that level? My concern is that currently a .config file can contain hostile content that will get executed at build time. .config files are often blindly shared across untrusted developers. So I thought that mitigating this whole is worth it. > Specifically: > > 1. If you do escaping at that level, then you can do it differently > for auto.conf and autoconf.h. Though auto.conf still seems to be > read by both make and shell. I need to think about that. Thanks for the pointer. Thanks, //richard