From patchwork Fri Jan 13 22:13:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9516587 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 748DC60761 for ; Fri, 13 Jan 2017 22:14:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6678C28658 for ; Fri, 13 Jan 2017 22:14:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5AC80286F1; Fri, 13 Jan 2017 22:14:00 +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_SIGNED, 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 4823228658 for ; Fri, 13 Jan 2017 22:13:58 +0000 (UTC) Received: (qmail 9754 invoked by uid 550); 13 Jan 2017 22:13:57 -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 9723 invoked from network); 13 Jan 2017 22:13:55 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=eaNQM5mf/tN5xcOqHrbTUlQIOLLU3vc9Xi2dSxU0NK0=; b=EMxNApR2LWd7Qi1pWkJqu00UN8Mn5prdae7o2IctgqlwOS0wFdpzWdaYwANo0P02w9 DS7XmijdiW8jH89WtXFHO5xpVCYWd3yhBTUpRzCu0ri56PgvTfRUhiIpPHzBlP6NEchT pM18F0c25WCDeCmgFTp8IzyQOlLTBpQzwr++4= 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:mime-version :content-disposition; bh=eaNQM5mf/tN5xcOqHrbTUlQIOLLU3vc9Xi2dSxU0NK0=; b=o5uCjFGdKaE535WbUxI49+uiuXXGfd75IwhJ4N8+h2f+Ie2uCRs6NxcDVA/sjOk3sk 5uMS4Tbb/JsVSDOPcfjO8lugrJI6ZlucBtH9orC0bW3usILzcKIlLExNtX1Ic2sMrg4M cDetnXixRX9rADNy/aRIPIX31oKOTQcCRGI3yFVOexpKbyPeQqyMvIOZ3evy3El3xdz/ doW5uz7tUKDvy3E6QJ62mxDW8nqe37ISjCtbGCocOc0JYtgbTnGLsGLNqvXuNx2WBvY0 L/y8/jE07doG0BLLVuQvVpOjwLBM6rIVZt6XzqXqqFhJJ593KrmV8872D72xdyEimmSq jeSw== X-Gm-Message-State: AIkVDXLqGkPc4/3HEoUDcsh4d25/j4vtn5RQ1k8punAUPdooqwAdwqR2oNkL28KopW9AVzaI X-Received: by 10.99.238.17 with SMTP id e17mr27050692pgi.58.1484345623322; Fri, 13 Jan 2017 14:13:43 -0800 (PST) Date: Fri, 13 Jan 2017 14:13:42 -0800 From: Kees Cook To: kernel-hardening@lists.openwall.com Cc: PaX Team , Emese Revfy , linux-kernel@vger.kernel.org Message-ID: <20170113221342.GA67566@beast> MIME-Version: 1.0 Content-Disposition: inline Subject: [kernel-hardening] [PATCH] gcc-plugins: consolidate on PASS_INFO macro X-Virus-Scanned: ClamAV using ClamSMTP Now that PASS_INFO() exists, use it in the other existing gcc plugins, instead of always open coding the same thing. Based on updates to the grsecurity/PaX gcc plugins. Signed-off-by: Kees Cook --- scripts/gcc-plugins/cyc_complexity_plugin.c | 6 +----- scripts/gcc-plugins/sancov_plugin.c | 8 ++------ 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/scripts/gcc-plugins/cyc_complexity_plugin.c b/scripts/gcc-plugins/cyc_complexity_plugin.c index 8af7db06122d..1909ec617431 100644 --- a/scripts/gcc-plugins/cyc_complexity_plugin.c +++ b/scripts/gcc-plugins/cyc_complexity_plugin.c @@ -52,12 +52,8 @@ static unsigned int cyc_complexity_execute(void) __visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version) { const char * const plugin_name = plugin_info->base_name; - struct register_pass_info cyc_complexity_pass_info; - cyc_complexity_pass_info.pass = make_cyc_complexity_pass(); - cyc_complexity_pass_info.reference_pass_name = "ssa"; - cyc_complexity_pass_info.ref_pass_instance_number = 1; - cyc_complexity_pass_info.pos_op = PASS_POS_INSERT_AFTER; + PASS_INFO(cyc_complexity, "ssa", 1, PASS_POS_INSERT_AFTER); if (!plugin_default_version_check(version, &gcc_version)) { error(G_("incompatible gcc/plugin versions")); diff --git a/scripts/gcc-plugins/sancov_plugin.c b/scripts/gcc-plugins/sancov_plugin.c index 70f5fe0d590a..9b0b5cbc5b89 100644 --- a/scripts/gcc-plugins/sancov_plugin.c +++ b/scripts/gcc-plugins/sancov_plugin.c @@ -89,7 +89,6 @@ static void sancov_start_unit(void __unused *gcc_data, void __unused *user_data) __visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version) { int i; - struct register_pass_info sancov_plugin_pass_info; const char * const plugin_name = plugin_info->base_name; const int argc = plugin_info->argc; const struct plugin_argument * const argv = plugin_info->argv; @@ -107,14 +106,11 @@ __visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gc }; /* BBs can be split afterwards?? */ - sancov_plugin_pass_info.pass = make_sancov_pass(); #if BUILDING_GCC_VERSION >= 4009 - sancov_plugin_pass_info.reference_pass_name = "asan"; + PASS_INFO(sancov, "asan", 0, PASS_POS_INSERT_BEFORE); #else - sancov_plugin_pass_info.reference_pass_name = "nrv"; + PASS_INFO(sancov, "nrv", 1, PASS_POS_INSERT_BEFORE); #endif - sancov_plugin_pass_info.ref_pass_instance_number = 0; - sancov_plugin_pass_info.pos_op = PASS_POS_INSERT_BEFORE; if (!plugin_default_version_check(version, &gcc_version)) { error(G_("incompatible gcc/plugin versions"));