Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp326004pxb; Wed, 15 Sep 2021 03:03:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCgZE91nLI3qbA/sAB/FwDS6/aJh0WTqFp/9fiHnmy+/a2qkHU/jF5cIRKX/gahJTpFDhu X-Received: by 2002:a05:6638:1403:: with SMTP id k3mr9778156jad.102.1631700187683; Wed, 15 Sep 2021 03:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631700187; cv=none; d=google.com; s=arc-20160816; b=0JQWlOlm3+9FRdRjZJXvGXu5uAz/dYZnRP/zXj7xlapSkqTiG6WVmFKu/6q6512JkA +8/SSQQV3cnGKr+1cL216/Pdjk2CB2WhRK0Re7UcLNQPKkowP7nHXpnNN8Fo3su3J3qU b0Z3B9pG1k1vkfnTFos0xMDGrzBSMGmGJWDmLxOGmv/DEnbkf/BMJCKhmkjbsSUHTxTf k/L3iMMZqkBvwGxovplB5jOSGufuCdCVnKMSBv9H/LgtQ8Or+SkFucxXfz8CacApA9B4 NzRc2SYYYIZhOkVRik9GEXcASNsdEiVHDwCANURYR9jfmGDoSwrfg0I3r2rlIkWu2A3A EBOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature:dkim-filter; bh=wp9HdqRiV5c4MgPEn1AmkZJuSoNc1KqDtu2wyZund3I=; b=Z5AcPqRu8GuCtPTEPJrVwuzv1heyj5qaI7OkSyYgUzz9OXKcZgfLq7bH+ipsFLKNoz lWUpg7ayBQDPZqWHhpjBe3qSydiCJGwX6NsGs0MQ66gcEc66ve8645da+3tnMS7dsV8U r7GqnQtpo4wa7oPP6R9AeM5hHns/X2C/mAzf8Vcvn41kgf1CQ96WXOO56+3uMjFTTlmb dH8NRprdwQCiV6Bb6PRzN4H6mw9X9T0V7D4+63TokEaKYMXDeRWxe18/c75Y1NAuNj7a BIpTEqMqKsaxfjgmXE0J8vyIWEzXl02iIPdDIZ18jg268ORoOnT2fffPCxYZBRiPLzPu CpSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=CiTfzkGD; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i11si13481998ilb.173.2021.09.15.03.02.47; Wed, 15 Sep 2021 03:03:07 -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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=CiTfzkGD; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237273AbhIOKDC (ORCPT + 99 others); Wed, 15 Sep 2021 06:03:02 -0400 Received: from conssluserg-01.nifty.com ([210.131.2.80]:27986 "EHLO conssluserg-01.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232046AbhIOKDA (ORCPT ); Wed, 15 Sep 2021 06:03:00 -0400 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (authenticated) by conssluserg-01.nifty.com with ESMTP id 18FA1SSg012501; Wed, 15 Sep 2021 19:01:28 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-01.nifty.com 18FA1SSg012501 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1631700088; bh=wp9HdqRiV5c4MgPEn1AmkZJuSoNc1KqDtu2wyZund3I=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=CiTfzkGDxBFjrgjd/TYw1evotQSFwFxDfqE88vcjMZm9z75WjrSEv/VsYx5KiX1B7 hZ0YwdQ2xHFHjNTbQHBcg+fKeWpUL3Wjuq7bwilVBI/Uw5W8z42XvWUQJfxuiuB32Q a6hxouxgPoxrCVPt8PUWyBS7xjTBSMbAPQLQ+puTx7QW5l8+q6x9EncJWHIsVSvwuT pFf7Sl5xOARbD3rS+HqGhYjxpbdAtDhGfGr9viBj7HnML30U9vOs7OYpnE9seyzaAq M1hg4sgfUdvktZrDR6wAPHzPrThCw7qzRrs8Tib0sfo8GLP96ahh47lWmp9Wbd8sQ7 E0fBcofGZdiHQ== X-Nifty-SrcIP: [209.85.214.172] Received: by mail-pl1-f172.google.com with SMTP id bg1so1271434plb.13; Wed, 15 Sep 2021 03:01:28 -0700 (PDT) X-Gm-Message-State: AOAM531R0XXKztICRFbJB+248gxVcNFultOPNKziNq7B0BaM5rnYYghv 17gGvGDaC2b1T1Qu/oey3Df7Qf/4lZmq+UvudDM= X-Received: by 2002:a17:90a:d307:: with SMTP id p7mr7549265pju.144.1631700087759; Wed, 15 Sep 2021 03:01:27 -0700 (PDT) MIME-Version: 1.0 References: <1631697827-96324-1-git-send-email-ashimida@linux.alibaba.com> In-Reply-To: <1631697827-96324-1-git-send-email-ashimida@linux.alibaba.com> From: Masahiro Yamada Date: Wed, 15 Sep 2021 19:00:51 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] [RFC] Add additional include path for gcc plugins To: Dan Li Cc: Michal Marek , Kees Cook , Linux Kbuild mailing list , Linux Kernel Mailing List , linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 15, 2021 at 6:23 PM Dan Li wrote: > > When kernel enables gcc plugin, some header files are missing in some > tool chains (as in the following example) > > These header files can be found in other toolchains, and sometimes > the md5hash of these files are same(in most versions). > > Should we add a parameter to plugin to allow users to import their own > header file directories? > > --- > HOSTCXX scripts/gcc-plugins/stackleak_plugin.so > In file included from scripts/gcc-plugins/gcc-common.h:103:0, > from scripts/gcc-plugins/stackleak_plugin.c:30: > /workspace/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin/../ > lib/gcc/aarch64-none-linux-gnu/9.2.1/plugin/include/builtins.h:23:17: > fatal error: mpc.h: No such file or directory > #include gcc-plugins are compiled by the host compiler (usually g++). Kbuild already provides 'HOSTCXXFLAGS' to pass-in additional flags to it. But, if you need to tweak include paths, you are already screwed up, maybe. Some time ago, I got a question about plugin builds failing due to missing gmp.h but it was solvable by installing a package. https://lore.kernel.org/all/CAK7LNART2qQBY7Vc8rhMiXS_Fwty7qpWjwwfPrUegTb-gjy6sA@mail.gmail.com/ > Signed-off-by: Dan Li > --- > Makefile | 3 +++ > scripts/gcc-plugins/Makefile | 2 +- > 2 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/Makefile b/Makefile > index 09bb314..e6134f3 100644 > --- a/Makefile > +++ b/Makefile > @@ -1036,6 +1036,9 @@ include-$(CONFIG_UBSAN) += scripts/Makefile.ubsan > include-$(CONFIG_KCOV) += scripts/Makefile.kcov > include-$(CONFIG_GCC_PLUGINS) += scripts/Makefile.gcc-plugins > > +GCC_PLUGINS_EXT_CFLAGS= > +export GCC_PLUGINS_EXT_CFLAGS > + > include $(addprefix $(srctree)/, $(include-y)) > > # scripts/Makefile.gcc-plugins is intentionally included last. > diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile > index 1952d3b..0b3e27a 100644 > --- a/scripts/gcc-plugins/Makefile > +++ b/scripts/gcc-plugins/Makefile > @@ -23,7 +23,7 @@ GCC_PLUGINS_DIR = $(shell $(CC) -print-file-name=plugin) > > plugin_cxxflags = -Wp,-MMD,$(depfile) $(KBUILD_HOSTCXXFLAGS) -fPIC \ > -include $(srctree)/include/linux/compiler-version.h \ > - -I $(GCC_PLUGINS_DIR)/include -I $(obj) -std=gnu++11 \ > + -I $(GCC_PLUGINS_DIR)/include -I $(obj) $(GCC_PLUGINS_EXT_CFLAGS) -std=gnu++11 \ > -fno-rtti -fno-exceptions -fasynchronous-unwind-tables \ > -ggdb -Wno-narrowing -Wno-unused-variable \ > -Wno-format-diag > -- > 2.7.4 > -- Best Regards Masahiro Yamada