From nobody Tue Dec 16 18:24:55 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71707C4167B for ; Fri, 8 Dec 2023 18:13:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574595AbjLHSNX (ORCPT ); Fri, 8 Dec 2023 13:13:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233811AbjLHSNC (ORCPT ); Fri, 8 Dec 2023 13:13:02 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 185DF10EB; Fri, 8 Dec 2023 10:13:05 -0800 (PST) Date: Fri, 08 Dec 2023 18:13:02 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1702059183; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZQXZPXMdeQWj4ugI1z+dfinMnf9b1h8LiYzaMCwoG1I=; b=o9cRehzZDgPw5+O9jx8dfwsSlqDFVMzLDoI0nGSugJtTnY5pevm7aqg0QPbS3G/adRoehk WBUQYRwgaUIZSRuLVB17H15OQ9huo7e9ZjCnTpu8FNpm5iTHpLJiLAQsCt2R0SoiGZ/Xd+ iWTD7gwJ4CiSdukvYLs8yJb4ZxGa8r4N5912wjj1ijaS5pqbTSVXwmIqZKrfIBMXFfxlRx UvuB7/jqXg+IwgEVcpyM8qyF4wPGe+R7RPY+lJn9Gv5HLhbT3vihgBohlnRvHvBjrwyC1+ yFMhm8/zRNj8vPtsJidOxuk/uWiyAcKIUixbevOjbi6E1DKfGmSWm0mPzuPrnA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1702059183; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZQXZPXMdeQWj4ugI1z+dfinMnf9b1h8LiYzaMCwoG1I=; b=Zzgr0q3hvSyWNzH2myiWSYacG8lPK5CCvYh/+3s7s4G6hXzobYDtUQbdE5jAOBOqchT99s uJxUQjeIxs6kXuDw== From: "tip-bot2 for Jo Van Bulck" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/sgx] selftests/sgx: Include memory clobber for inline asm in test enclave Cc: Jo Van Bulck , Dave Hansen , Kai Huang , Jarkko Sakkinen , x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <170205918296.398.18099309646140167454.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/sgx branch of tip: Commit-ID: 853a57a43ebdb8c024160c1a0990bae85f4bcc2f Gitweb: https://git.kernel.org/tip/853a57a43ebdb8c024160c1a0990bae85= f4bcc2f Author: Jo Van Bulck AuthorDate: Thu, 05 Oct 2023 17:38:44 +02:00 Committer: Dave Hansen CommitterDate: Fri, 08 Dec 2023 10:05:26 -08:00 selftests/sgx: Include memory clobber for inline asm in test enclave Add the "memory" clobber to the EMODPE and EACCEPT asm blocks to tell the compiler the assembly code accesses to the secinfo struct. This ensures the compiler treats the asm block as a memory barrier and the write to secinfo will be visible to ENCLU. Fixes: 20404a808593 ("selftests/sgx: Add test for EPCM permission changes") Signed-off-by: Jo Van Bulck Signed-off-by: Dave Hansen Reviewed-by: Kai Huang Reviewed-by: Jarkko Sakkinen Link: https://lore.kernel.org/all/20231005153854.25566-4-jo.vanbulck%40cs.k= uleuven.be --- tools/testing/selftests/sgx/test_encl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/sgx/test_encl.c b/tools/testing/selfte= sts/sgx/test_encl.c index c0d6397..ae791df 100644 --- a/tools/testing/selftests/sgx/test_encl.c +++ b/tools/testing/selftests/sgx/test_encl.c @@ -24,10 +24,11 @@ static void do_encl_emodpe(void *_op) secinfo.flags =3D op->flags; =20 asm volatile(".byte 0x0f, 0x01, 0xd7" - : + : /* no outputs */ : "a" (EMODPE), "b" (&secinfo), - "c" (op->epc_addr)); + "c" (op->epc_addr) + : "memory" /* read from secinfo pointer */); } =20 static void do_encl_eaccept(void *_op) @@ -42,7 +43,8 @@ static void do_encl_eaccept(void *_op) : "=3Da" (rax) : "a" (EACCEPT), "b" (&secinfo), - "c" (op->epc_addr)); + "c" (op->epc_addr) + : "memory" /* read from secinfo pointer */); =20 op->ret =3D rax; }