From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E116E133435; Tue, 23 Jan 2024 01:05:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705971909; cv=none; b=W9CMDIsBrjrqwd/qn6nRj/U1dSfaNHZ1bPiNHEI8G4owWBm/sb4MjNLdqrZwnebCKauF9HFVENiALC6qnIfV3RC35+dO1qurjllfFNzW2ANL1S+DMAElxchtX4xkHbvFDeNTGUiEKdZm4CPwrfOY2HXxm/RKLm8mqGVTBNSjzro= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705971909; c=relaxed/simple; bh=hTj07dtv/kd7XKpF6meTpFi31vOTj4hnvc6Pbo/xf1o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VGJwHBH6iuUhYFu6wCZLX69NXm4hWr9qqRLtsJexCrUwlNQiXpIwMxzWyVTVDyxekiyN+bFBeQ4giobS4sEUn0FInjfH5aCvxBzWyTHTWdLgax/wqDDMs0h3v4APf+wvZarhbZrEPVs1HMvkX9cNu7wuTXRm1UtPcCeM/lCtbWA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lbGkFO6D; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="lbGkFO6D" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9976FC433F1; Tue, 23 Jan 2024 01:05:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1705971908; bh=hTj07dtv/kd7XKpF6meTpFi31vOTj4hnvc6Pbo/xf1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lbGkFO6D+yQQJf18zoG1C748d95t1oDnB1MYA13h0/dXK3L+LrEltwwSbTQmi4Mnj XABAgMQjjEPOSy7U8C57/om2JsTA9BDaY3sGvTgl0pzEcCe7xID2/gmDk/0Qk+iZav SKyydjt0eHegby0N2c1QYjnvVSUXvp0U0sfXJhNo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jo Van Bulck , Dave Hansen , Kai Huang , Jarkko Sakkinen , Sasha Levin Subject: [PATCH 6.1 348/417] selftests/sgx: Include memory clobber for inline asm in test enclave Date: Mon, 22 Jan 2024 15:58:36 -0800 Message-ID: <20240122235803.838465709@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122235751.480367507@linuxfoundation.org> References: <20240122235751.480367507@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jo Van Bulck [ Upstream commit 853a57a43ebdb8c024160c1a0990bae85f4bcc2f ] 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.kuleuven.be Signed-off-by: Sasha Levin --- 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/selftests/sgx/test_encl.c index c0d6397295e3..ae791df3e5a5 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 = op->flags; 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 */); } static void do_encl_eaccept(void *_op) @@ -42,7 +43,8 @@ static void do_encl_eaccept(void *_op) : "=a" (rax) : "a" (EACCEPT), "b" (&secinfo), - "c" (op->epc_addr)); + "c" (op->epc_addr) + : "memory" /* read from secinfo pointer */); op->ret = rax; } -- 2.43.0