From patchwork Thu Feb 22 23:14:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 10236577 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 2281860224 for ; Thu, 22 Feb 2018 23:15:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09F6429067 for ; Thu, 22 Feb 2018 23:15:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F317E2906A; Thu, 22 Feb 2018 23:15:25 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 1D84B29068 for ; Thu, 22 Feb 2018 23:15:24 +0000 (UTC) Received: (qmail 26330 invoked by uid 550); 22 Feb 2018 23:15:07 -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: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 26188 invoked from network); 22 Feb 2018 23:15:05 -0000 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5YOeevrqZi799dJ1qmBDUQWzlEE7klKrb7ijIiodFEc=; b=rjq2wuRYNHKCgCffvLp9v1jVBnXNXm6cCWNp/3GAvXguZJbYVjQe1jClvJfBEJDMKG Z+L9Hdc/LV1TamVV+gIWP3z5zr3QCvIk2oLvF2xZHMDpgLZ5GYhr4Xz6XsKZKgiRVLgc WDhesDnStp+R+e8f05la3er88CXgnbTd7ryfQTQ2bx6yBqONaycETaU42LSoiQvwZIi/ 1ADQX9J2gliLu8IbKe7fEFnSV9p5I/V8vzJMJjQhESXM2NjjDBNN7GFgGzEwEWowsD32 owAJz0WHrSZrZBY9B6wQUf82E377vUjxojkFvYxjJvHSAhZIOks05OeleiBtFSrIaaWr mW+A== X-Gm-Message-State: APf1xPA+vdNEcHMVrK+NwdZQVv16PfzWnm/mC71ORf8IMIk5Rgv/mTVo /26GMrcVfXJVjSi6CaMsvufkHQ== X-Google-Smtp-Source: AH8x2272zwwEc7m9l/qavCwJrQsoQoti8i48+67bJ0fFRpjMzr7ylt+k3nCnNUeHRBTUnbNHNdimCw== X-Received: by 10.202.53.67 with SMTP id c64mr5971324oia.241.1519341293571; Thu, 22 Feb 2018 15:14:53 -0800 (PST) From: Laura Abbott To: Alexander Popov , Kees Cook , kernel-hardening@lists.openwall.com Cc: Laura Abbott Subject: [PATCH 2/2] gcc-plugins: stackleak: Update for gcc-8 Date: Thu, 22 Feb 2018 15:14:42 -0800 Message-Id: <20180222231442.29507-3-labbott@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180222231442.29507-1-labbott@redhat.com> References: <20180222231442.29507-1-labbott@redhat.com> X-Virus-Scanned: ClamAV using ClamSMTP - Use the new cgraph_create_edge API - Account for the change in type for get_frame_size Signed-off-by: Laura Abbott --- scripts/gcc-plugins/stackleak_plugin.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/scripts/gcc-plugins/stackleak_plugin.c b/scripts/gcc-plugins/stackleak_plugin.c index 6fc991c98d8b..4ea2fdb987e6 100644 --- a/scripts/gcc-plugins/stackleak_plugin.c +++ b/scripts/gcc-plugins/stackleak_plugin.c @@ -69,8 +69,13 @@ static void stackleak_check_alloca(gimple_stmt_iterator *gsi) node = cgraph_get_create_node(check_function_decl); gcc_assert(node); frequency = compute_call_stmt_bb_frequency(current_function_decl, bb); +#if BUILDING_GCC_VERSION >= 8000 + cgraph_create_edge(cgraph_get_node(current_function_decl), node, + check_alloca, bb->count, bb->loop_depth); +#else cgraph_create_edge(cgraph_get_node(current_function_decl), node, check_alloca, bb->count, frequency, bb->loop_depth); +#endif } static void stackleak_add_instrumentation(gimple_stmt_iterator *gsi, bool after) @@ -94,8 +99,13 @@ static void stackleak_add_instrumentation(gimple_stmt_iterator *gsi, bool after) node = cgraph_get_create_node(track_function_decl); gcc_assert(node); frequency = compute_call_stmt_bb_frequency(current_function_decl, bb); +#if BUILDING_GCC_VERSION >= 8000 + cgraph_create_edge(cgraph_get_node(current_function_decl), node, + track_stack, bb->count, bb->loop_depth); +#else cgraph_create_edge(cgraph_get_node(current_function_decl), node, track_stack, bb->count, frequency, bb->loop_depth); +#endif } static bool is_alloca(gimple stmt) @@ -203,6 +213,18 @@ static unsigned int stackleak_tree_instrument_execute(void) return 0; } + +#if BUILDING_GCC_VERSION >= 8000 +bool check_frame_size() +{ + return maybe_ge(get_frame_size(), track_frame_size); +} +#else +bool check_frame_size() +{ + return get_frame_size() >= track_frame_size; +} +#endif /* * Work with the RTL representation of the code. * Remove the unneeded track_stack() calls from the functions which don't @@ -215,7 +237,7 @@ static unsigned int stackleak_final_execute(void) if (cfun->calls_alloca) return 0; - if (get_frame_size() >= track_frame_size) + if (check_frame_size()) return 0; /*