Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1683490pxb; Wed, 9 Feb 2022 02:06:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJwXBkNEHIDXVQTnA0mgK37gc++I+mbmkw3wFwruIJG5SABbAHXUV/G/qrJj+4iz/apeKKae X-Received: by 2002:a17:90b:1954:: with SMTP id nk20mr1647716pjb.187.1644401170320; Wed, 09 Feb 2022 02:06:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644401170; cv=none; d=google.com; s=arc-20160816; b=y+9SXazAYrFmy8m5hkaCKkqDtXgqUvagQd2zcPrgG3HoVIEIC3v9qGU+5PypQ59lfq 2FERTFI1/z2SUY2x5QCaWI9n8m9ayiM/lrCPyJy3yYcqab/jEVcE8ZH7hARyE7gUvFcX xdJRGqUrBo6bFIL5nTiR8ikp+ccxAkuNXQ7ZT40/QAwh8ohVv1mrhneg+AWq9F1gVgw7 XhwmVsJYVcfAIMBzS2w+LKd5tflmUsVJ+0bdc0A9b2B1IbBOLrBpDG6gvvBrT0Y9JWMl yWWiP7mQkviS/ke+9zAKOT7YJxy/7+Z9Se+hDjBm74q4KwyuVgVkqv+bry8ZCZfi7fVw l5nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GTRkZ/Q0BX6l7e020gPPA7YXNaL7nRkihwl+nLsH5Fg=; b=Zttg9qDB8IpOIr+VNPNCDzUFK3TrHZFCiD4UYyEks/g3sleJ3OMo5qgQZHX9XyS4wV 7jpywpVLNI1DVx654UfQuCgT/KqqSKdl0kXYK2WmREIHFOruiKKxANShphCEWl7yMJAK GfP5Zz8uVaCtxGez2K4M4/RN902h47iArLMILWZ4ZO64Ty6el6qjZU/wRNv8OrX3NCmD kTbFI0TSxdQAtlzP+idoKr+lz3oDumgHAQVW9JSbY/kxPYpQmsax2aKZl0NCanCNWceq sIHj5cQ6r0iCrgv3DcFtFFjDZdp4tNXCxZ18pe4lWX0Afe3cz34jyLmQJN0olohlwexb 1p8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="X/4Mnzc0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k190si961350pgd.202.2022.02.09.02.05.57; Wed, 09 Feb 2022 02:06:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="X/4Mnzc0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386605AbiBHWaY (ORCPT + 99 others); Tue, 8 Feb 2022 17:30:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387031AbiBHVsw (ORCPT ); Tue, 8 Feb 2022 16:48:52 -0500 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 407AEC0612BC; Tue, 8 Feb 2022 13:48:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644356932; x=1675892932; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=s0tX+0pl5bXcA0SPU+yggYgA8LCS4TYSxMJl38V+Muc=; b=X/4Mnzc08m2lRQCs30OFD+Obo+g30ysvf4C05wOviQS7+0qC7UHLExcS 8QjigbILEgk9ofUxUkxK2qTGaVEggdW/94ql+9FYeF2JF+rXtoFw470ID fePBugZAJpiQNcb9psfEyaWJycQSnFiOStcHZlwsjz7vqUyvaiTr+7Yme HVnE1jIlN3qEJTPcThxxMc1YtwawTZR3EeieucqWTqenCYJu1JPmfr6Z0 nX8aES+BC0QSMFYc52EEbPQYqtzH2C6GvsjGZN1bpIDowcb0MpE0PM2MF xes0XaGuEOjWIe50XCTcJz829UX6bVJSEdQnUZrlH4MM9lmA2gp0U9d01 g==; X-IronPort-AV: E=McAfee;i="6200,9189,10252"; a="309805368" X-IronPort-AV: E=Sophos;i="5.88,353,1635231600"; d="scan'208";a="309805368" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2022 13:48:49 -0800 X-IronPort-AV: E=Sophos;i="5.88,353,1635231600"; d="scan'208";a="632992867" Received: from rchatre-ws.ostc.intel.com ([10.54.69.144]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2022 13:48:49 -0800 From: Reinette Chatre To: dave.hansen@linux.intel.com, jarkko@kernel.org, tglx@linutronix.de, bp@alien8.de, luto@kernel.org, mingo@redhat.com, linux-sgx@vger.kernel.org, x86@kernel.org, shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V3 3/4] selftests/sgx: Ensure enclave data available during debug print Date: Tue, 8 Feb 2022 13:48:41 -0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In support of debugging the SGX tests print details from the enclave and its memory mappings if any failure is encountered during enclave loading. When a failure is encountered no data is printed because the printing of the data is preceded by cleanup of the data. Move the data cleanup after the data print. Fixes: 147172148909 ("selftests/sgx: Dump segments and /proc/self/maps only on failure") Acked-by: Shuah Khan Signed-off-by: Reinette Chatre --- Changes since V2: - Add Acked-by from Shuah. tools/testing/selftests/sgx/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/sgx/main.c b/tools/testing/selftests/sgx/main.c index a7cd2c3e6f7e..b0bd95a4730d 100644 --- a/tools/testing/selftests/sgx/main.c +++ b/tools/testing/selftests/sgx/main.c @@ -186,8 +186,6 @@ static bool setup_test_encl(unsigned long heap_size, struct encl *encl, return true; err: - encl_delete(encl); - for (i = 0; i < encl->nr_segments; i++) { seg = &encl->segment_tbl[i]; @@ -208,6 +206,8 @@ static bool setup_test_encl(unsigned long heap_size, struct encl *encl, TH_LOG("Failed to initialize the test enclave.\n"); + encl_delete(encl); + return false; } -- 2.25.1