Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1714580pxb; Wed, 9 Feb 2022 02:57:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJyziqJxj9MVIJyPHIt7/7TRU0MMS4WaJ4BUZZ7OoHduDkrfBMFYgT2W5bw57zifsJ2nEqiQ X-Received: by 2002:a65:480d:: with SMTP id h13mr1413577pgs.231.1644404244444; Wed, 09 Feb 2022 02:57:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644404244; cv=none; d=google.com; s=arc-20160816; b=0eBsjY1Lrglk113GeJuMG8oa9HdUqjZDrmTq2aYOVBkOohIOMsROrrw+t9NaB+O+2e X4neOR2CAYCfdB+Ri3EHteGnbOcim80D+DohV4MCOb2kvhjgCMW4rIaZWbxh2nxXX9CM YIRxCFbwYYwbAS0q84slFXNgs3wFFta608IR9ouJIFXReXMhIbpz30feYL5c+qHbV2+N KBu1w5zkBJOW62OnDQRFEGeLyJPhhlIQZyk0ZkVvjj/ZSxaaE5xWkoFTW8N3FE7jmrHx Dsqdnew6h20Av7eE4pCi4qzQhqgKNqvXGIg3xNJD0C03ZKI9dBwL4LVC7hKi0duyk9d2 VNJQ== 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=Sa1F9JuSBACv1F+rDG/iDBJ8jEkfQV7EMmRGV3GDrao=; b=MMz7VAl1QRbOSjLx6XusCwLMfXPjLHtOIRYY9gA2TijCmubLP7hFpYuwTQWaZ+RVo0 gDiDv0740OTg5njzeiljIkuYYdH1czFOOOCTwsv94wm8ZsxymDXTp9ApfkrK1DcLIr+G owfphxyRPrmRxnKylxI9hdNO+WLXA5ULCYEnonWIprz00k08Lbrp7w4yIMHo7FCyybcC suZi+YCK3o/vwNaEng43EehV2iNxQqdPWrKD6MpNlsLQk0bP2PdOUX9MEigMH/5lmbI9 S8EMyfuRo0pssb3gFKxc5o+Quq+Fy6KgQc54gMA+xGY8SYrYgESyHJ2k/Z1WvYcaeHC4 SDOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NgvC2HhJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 144si15699253pga.249.2022.02.09.02.57.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 02:57:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NgvC2HhJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7B4D9E05BBE2; Wed, 9 Feb 2022 01:29:24 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387555AbiBHW2f (ORCPT + 99 others); Tue, 8 Feb 2022 17:28:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387030AbiBHVsw (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 11888C0612B8; Tue, 8 Feb 2022 13:48:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644356931; x=1675892931; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SE5sCiy+dRL7r3+PSeTM1Kw96jjyzlor4t7Em7ahwY0=; b=NgvC2HhJQ/nPf0Tn24dRwSO2IKLF/JF9gUUq47TS6DZYRM6/V2HGZVNR NG8BWPKtsa/SmldJyjtonna6TGdtbLaPMY3SZBBrx4nCBFwhZ6RkP6y6V a4XkYyuk7yXBf6Jw/KBvi5n+1txxrNTcpQ4uEzf8ZSJSLfFeOdZKn+dui 96j3KM6q5khZg//6zMbDAyR2+qgCaK11inbrUwuTDvL/rcqSwGz+Lx2iH 5cgWW+E7fACoFfTd2dF5QszLe6hBZo61mJqyP/0xWtvsGbr8IXDDnd7Ps JAis5tVHvU7kfGaXhMOFwsabNMb+LYv4kb0W9IMT8msXP7Mp+K9iJpclE w==; X-IronPort-AV: E=McAfee;i="6200,9189,10252"; a="309805367" X-IronPort-AV: E=Sophos;i="5.88,353,1635231600"; d="scan'208";a="309805367" 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="632992866" 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 2/4] selftests/sgx: Do not attempt enclave build without valid enclave Date: Tue, 8 Feb 2022 13:48:40 -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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 It is not possible to build an enclave if it was not possible to load the binary from which it should be constructed. Do not attempt to make further progress but instead return with failure. A "return false" from setup_test_encl() is expected to trip an ASSERT_TRUE() and abort the rest of the test. Fixes: 1b35eb719549 ("selftests/sgx: Encpsulate the test enclave creation") Acked-by: Dave Hansen Acked-by: Shuah Khan Signed-off-by: Reinette Chatre --- Changes since V2: - Add Acked-by from Shuah. Changes since V1: - Add Acked-by from Dave. - Detail in commit log what callers will see with this change (Dave). tools/testing/selftests/sgx/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/sgx/main.c b/tools/testing/selftests/sgx/main.c index 370c4995f7c4..a7cd2c3e6f7e 100644 --- a/tools/testing/selftests/sgx/main.c +++ b/tools/testing/selftests/sgx/main.c @@ -147,6 +147,7 @@ static bool setup_test_encl(unsigned long heap_size, struct encl *encl, if (!encl_load("test_encl.elf", encl, heap_size)) { encl_delete(encl); TH_LOG("Failed to load the test enclave.\n"); + return false; } if (!encl_measure(encl)) -- 2.25.1