From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74676 invoked by alias); 21 Mar 2016 12:49:39 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 74661 invoked by uid 89); 21 Mar 2016 12:49:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=sk:hsa_sta, kernarg_region, sk:HSA_STA, sk:hsa_ker X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Mon, 21 Mar 2016 12:49:29 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 13C1CABD3 for ; Mon, 21 Mar 2016 12:49:24 +0000 (UTC) To: GCC Patches Cc: Martin Jambor From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Subject: [HSA, PATCH] Allocate memory for shadow arg (PR hsa/70337) Message-ID: <56EFEDD5.8010508@suse.cz> Date: Mon, 21 Mar 2016 13:05:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020509060907060102020200" X-IsSubscribed: yes X-SW-Source: 2016-03/txt/msg01163.txt.bz2 This is a multi-part message in MIME format. --------------020509060907060102020200 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-length: 171 Hello. Following patch fixes an invalid write in HSA plug-in. I've been running bootstrap and regression tests on x86-linux-gnu. Ready after it finishes? Thanks, Martin --------------020509060907060102020200 Content-Type: text/x-patch; name="0001-Allocate-memory-for-shadow-arg-PR-hsa-70337.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Allocate-memory-for-shadow-arg-PR-hsa-70337.patch" Content-length: 1315 >From 2674ceb5fddeaeb26ff87d26a43bddaf40060ea2 Mon Sep 17 00:00:00 2001 From: marxin Date: Mon, 21 Mar 2016 13:34:04 +0100 Subject: [PATCH] Allocate memory for shadow arg (PR hsa/70337) libgomp/ChangeLog: 2016-03-21 Martin Liska PR hsa/70337 * plugin/plugin-hsa.c (create_single_kernel_dispatch): Allocate memory for hsa_kernel_runtime * argument. --- libgomp/plugin/plugin-hsa.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libgomp/plugin/plugin-hsa.c b/libgomp/plugin/plugin-hsa.c index d888493..36b3cf4 100644 --- a/libgomp/plugin/plugin-hsa.c +++ b/libgomp/plugin/plugin-hsa.c @@ -884,9 +884,10 @@ create_single_kernel_dispatch (struct kernel_info *kernel, shadow->private_segment_size = kernel->private_segment_size; shadow->group_segment_size = kernel->group_segment_size; - status - = hsa_memory_allocate (agent->kernarg_region, kernel->kernarg_segment_size, - &shadow->kernarg_address); + size_t kernarg_size = kernel->kernarg_segment_size + + sizeof (struct hsa_kernel_runtime *); + status = hsa_memory_allocate (agent->kernarg_region, kernarg_size, + &shadow->kernarg_address); if (status != HSA_STATUS_SUCCESS) hsa_fatal ("Could not allocate memory for HSA kernel arguments", status); -- 2.7.1 --------------020509060907060102020200--