From patchwork Sun Jun 26 15:38:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emese Revfy X-Patchwork-Id: 9199551 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DF59F607D3 for ; Sun, 26 Jun 2016 15:32:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C582C28544 for ; Sun, 26 Jun 2016 15:32:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5E1E2854D; Sun, 26 Jun 2016 15:32:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id AC57E28544 for ; Sun, 26 Jun 2016 15:32:14 +0000 (UTC) Received: (qmail 10218 invoked by uid 550); 26 Jun 2016 15:32:12 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: kernel-hardening@lists.openwall.com Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 10188 invoked from network); 26 Jun 2016 15:32:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version :content-transfer-encoding; bh=omHiJzN6VjbgTro8aTAXHq0dyno92XjDQ59CTAIN0L4=; b=k6xllXGw1Ic6X9JaNcJu+8S2nRr4wjgGGpAZRF8bXcjQS6+4vjsdj4873H3jHIXHfC tJSv8uqGdgTtzcmYtEk2XXHwRg/Jxlf/r/YF8JsrqAUB3Vib4HRJ93BSyjiUSKk5Ks8j F75k68GgXul8PGY2AoWAvqdJ/URQFz2DiV5rC1Y+OuaFkyIO7sgocfMIROe9Sk0ryZQ2 YtYqklK3778zfkfCS4EQbkChOj+OrtKiuUjzWT3rZmF3N3PLZFfw5Du7SSzCX1ADy0Gd 7No752M/b6RVDGef9yvLaVJiR7+raqS8/MNBdgKelsW8gsjsJHVv855CiiSjIBMZ9S8G kcvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-transfer-encoding; bh=omHiJzN6VjbgTro8aTAXHq0dyno92XjDQ59CTAIN0L4=; b=lbsXvKLNQjkOvvsTZpjX4FDv4sFJIepo0+4KZdmJO3IMCSfKOwwBWUwR6z2d/m4IzT uO6R3Ryu8VDsMQM9nUo2Tbyau9xdvRWa452Y8XdTXZmxz7sbK2XbgV/gheT38krkm/tM JRpJ1+VlMcdhwK/TV87B/qd5kPJQJKsrFzqvAswSX3N8t2NQ5+y1hZItRaTD8psD7T4O XhH71zhHrsTG+YnU1nFL1zFk0OEAHki8hUzcZVU/u0Auah5dyj/Jl4zaAWdP7DSdeO4R aIMmNDei3trpENvzpgkO0sJr8rEYbiPYLdu785mFOhCmUkbIeEXGkYcS6So/Sc+jc9mN 7sbA== X-Gm-Message-State: ALyK8tKwOa3Z33oMQLpH47F9fFDiNhadHnehgcL+LOZxvn9E/w52LBi9OJKbIOvXPO001A== X-Received: by 10.194.178.199 with SMTP id da7mr11847749wjc.123.1466955107538; Sun, 26 Jun 2016 08:31:47 -0700 (PDT) Date: Sun, 26 Jun 2016 17:38:20 +0200 From: Emese Revfy To: keescook@chromium.org Cc: mmarek@suse.com, linux-kbuild@vger.kernel.org, kernel-hardening@lists.openwall.com, pageexec@freemail.hu Message-Id: <20160626173820.13ad67e14e7a29a6563fe129@gmail.com> X-Mailer: Sylpheed 3.5.0 (GTK+ 2.24.30; x86_64-pc-linux-gnu) Mime-Version: 1.0 Subject: [kernel-hardening] [PATCH] Add support for complex gcc plugins that don't fit in a single file X-Virus-Scanned: ClamAV using ClamSMTP Reported-by: PaX Team Signed-off-by: Emese Revfy --- scripts/Makefile.gcc-plugins | 3 ++- scripts/gcc-plugins/Makefile | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/Makefile.gcc-plugins b/scripts/Makefile.gcc-plugins index 61fc4bb..1f922df 100644 --- a/scripts/Makefile.gcc-plugins +++ b/scripts/Makefile.gcc-plugins @@ -27,7 +27,7 @@ ifdef CONFIG_GCC_PLUGINS GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y)) - export PLUGINCC GCC_PLUGINS_CFLAGS GCC_PLUGIN SANCOV_PLUGIN DISABLE_LATENT_ENTROPY_PLUGIN + export PLUGINCC GCC_PLUGINS_CFLAGS GCC_PLUGIN GCC_PLUGIN_SUBDIR SANCOV_PLUGIN DISABLE_LATENT_ENTROPY_PLUGIN ifneq ($(PLUGINCC),) # SANCOV_PLUGIN can be only in CFLAGS_KCOV because avoid duplication. @@ -36,6 +36,7 @@ ifdef CONFIG_GCC_PLUGINS KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS) GCC_PLUGIN := $(gcc-plugin-y) + GCC_PLUGIN_SUBDIR := $(gcc-plugin-subdir-y) endif # If plugins aren't supported, abort the build before hard-to-read compiler diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile index 898449d..94fa139 100644 --- a/scripts/gcc-plugins/Makefile +++ b/scripts/gcc-plugins/Makefile @@ -12,14 +12,17 @@ else export HOST_EXTRACXXFLAGS endif -export GCCPLUGINS_DIR HOSTLIBS - ifneq ($(CFLAGS_KCOV), $(SANCOV_PLUGIN)) GCC_PLUGIN := $(filter-out $(SANCOV_PLUGIN), $(GCC_PLUGIN)) endif -$(HOSTLIBS)-y := $(GCC_PLUGIN) +export HOSTLIBS + +$(HOSTLIBS)-y := $(foreach p,$(GCC_PLUGIN),$(if $(findstring /,$(p)),,$(p))) always := $($(HOSTLIBS)-y) $(foreach p,$($(HOSTLIBS)-y:%.so=%),$(eval $(p)-objs := $(p).o)) +subdir-y := $(GCC_PLUGIN_SUBDIR) +subdir- += $(GCC_PLUGIN_SUBDIR) + clean-files += *.so