From patchwork Mon Jan 2 09:41:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 89457 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp7490542qgi; Mon, 2 Jan 2017 00:42:34 -0800 (PST) X-Received: by 10.55.72.141 with SMTP id v135mr51200398qka.50.1483346554038; Mon, 02 Jan 2017 00:42:34 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id u64si29736025qkl.104.2017.01.02.00.42.33; Mon, 02 Jan 2017 00:42:34 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id A1DA960BF7; Mon, 2 Jan 2017 08:42:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 16FCD60911; Mon, 2 Jan 2017 08:42:30 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id C95F860B2C; Mon, 2 Jan 2017 08:42:27 +0000 (UTC) Received: from mail-lf0-f53.google.com (mail-lf0-f53.google.com [209.85.215.53]) by lists.linaro.org (Postfix) with ESMTPS id 9B5D06090C for ; Mon, 2 Jan 2017 08:42:26 +0000 (UTC) Received: by mail-lf0-f53.google.com with SMTP id y21so266894697lfa.1 for ; Mon, 02 Jan 2017 00:42:26 -0800 (PST) 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; bh=zKHDBCpgSZxm6Xg1+fCCVmcfCBXt6k8/iUaSrk/XVdw=; b=ZMwej+3zxe60wWkC/pmwu6cWgxd8D5wwUGTv0JTPz98ziHsu1+OhHRgcsyqGv5EGMe HGe1RLWefBGcYY6SoQtubpi8AO66nTH96bSoyOa9YqB6Od06kHFc4UJ1MLipbajzXHDC jJdDIqzohuWzHAUJv8mUrjUaVW3Y+nbD0qW4vbE3H7U1rW9T0bIO4ceLS349ToBd1YB0 lis37V/xvhClwJ9kEJ20Qlh6MDKkGeyuER0kV/WrqsCc6jHFxeyMqbIR/kevCtNf0UuP 1Brd0u0FVdBlVoLrE7GJfR61sIT/CANv8WNHo2q6wbx/PJM/7sOKlCB41T0e92APAPNR g89w== X-Gm-Message-State: AIkVDXK/XNGCJJnfn9wDoz+Jb5uK4r8hFcSZQ19VOq2LacIpP/a3bqH76Nn28yXj9w1tKNrwtME= X-Received: by 10.25.72.74 with SMTP id v71mr21683607lfa.130.1483346545427; Mon, 02 Jan 2017 00:42:25 -0800 (PST) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-76-66.cust.bredband2.com. [83.233.76.66]) by smtp.gmail.com with ESMTPSA id z9sm15789592lja.1.2017.01.02.00.42.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Jan 2017 00:42:24 -0800 (PST) From: Christophe Milard To: mike.holmes@linaro.org, bill.fischofer@linaro.org, lng-odp@lists.linaro.org Date: Mon, 2 Jan 2017 10:41:42 +0100 Message-Id: <1483350102-22261-1-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [lng-odp] [API-NEXT] linux-gen: init: avoiding segfault if cleaning files X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" The call the the cleanup_files() function (which cleans up possible remaining file(s) from a defunc OPD with same pid) may use ODP_DBG and ODP_ERR functions, but is (before this patch) placed before these ODP_* functions are initialized. This would surely sigfault. The call the the cleanup_files() function is hence placed after ODP_DBG and ODP_ERR function initialization to avoid this situation. Signed-off-by: Christophe Milard --- platform/linux-generic/odp_init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.7.4 Reviewed-by: Bill Fischofer diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index 1b0d8f8..06c6143 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -73,7 +73,6 @@ int odp_init_global(odp_instance_t *instance, memset(&odp_global_data, 0, sizeof(struct odp_global_data_s)); odp_global_data.main_pid = getpid(); - cleanup_files(_ODP_TMPDIR, odp_global_data.main_pid); enum init_stage stage = NO_INIT; odp_global_data.log_fn = odp_override_log; @@ -86,6 +85,8 @@ int odp_init_global(odp_instance_t *instance, odp_global_data.abort_fn = params->abort_fn; } + cleanup_files(_ODP_TMPDIR, odp_global_data.main_pid); + if (odp_cpumask_init_global(params)) { ODP_ERR("ODP cpumask init failed.\n"); goto init_failed;