From patchwork Fri Dec 8 18:13:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 175992 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5632138vqy; Fri, 8 Dec 2023 10:13:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IHgLYBe8duuSNsHHyQAaRyw1Vr43pmRonBGf1ZDBf606ot9c9QQMtNc5YBkPt8rn0TZ0qqw X-Received: by 2002:a17:90b:384e:b0:286:6cc1:26d with SMTP id nl14-20020a17090b384e00b002866cc1026dmr526569pjb.56.1702059216248; Fri, 08 Dec 2023 10:13:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702059216; cv=none; d=google.com; s=arc-20160816; b=p918ucDTd5r0U9nNqlHqg71y4nAqtHI+PF9QZuTdFLumKsILmaA/i4DuQfHhLSQoWu HmCejHjPeR7b0GmIcWeTI9R1zHHHEXvpYUmjzJRw6xbUPLA9OIBUha/mofI7kp9QioLQ OfoPDdVBzj81oC4rTLdF6QLqXpMMQH70zdpXF6+OJMMD8pvyMh+o1uwueOvD8jbFNKxE hW3Gs7A/H1wKh5q75gM887QfkZrUYuHLrbmc/GJIakm1LYkFJ4Qzj+GJf364Z/pFBbvx C6gSd5fmJhc72sDqEc0cR5JnGPvw+1bVSnCcQeI5O6KvrGyuJsPuqXgk5rMh36q4zm5e lXvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:cc:subject:to:reply-to:sender:from :dkim-signature:dkim-signature:date; bh=ZQXZPXMdeQWj4ugI1z+dfinMnf9b1h8LiYzaMCwoG1I=; fh=hn3ZTCDvW0hC41yL0ykftNb5fxg3Gx13GvpmJEtNY0A=; b=S7LLgpPFkkqearCIlO3VO0TdQt8FAu3fZqR77EF3N9YqqVttz13UckMSu8LSJmGOFE xCN9l7I97gAjkQWQfMpaWVxWpejvdWx5nJcJG2jjj5TlH+EUJunMJE4DjaRT2Z+p616d JQx1MCKQFPOoQdXFMNF6X0zFF5ZoMCD4HYC+wHn5e27Vlg2TOklMwrJ9skaMDmCkklsH WOoI3QI/9c07ITTdee2rjyuPBpU2XK6ixpUJUgH6O7+QjOVtfmJ68qQ65KWHpVlDuUwG b+9Mf9YBccnGpznLVVZW5zKpbc9T9gDKiYdOfowwMUONMF6Q1mBIiIPNWDstyksVhI0c 1Jtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=o9cRehzZ; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id h21-20020a17090ac39500b00286a26df523si2012504pjt.188.2023.12.08.10.13.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 10:13:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=o9cRehzZ; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 31D42819D22C; Fri, 8 Dec 2023 10:13:31 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574574AbjLHSNV (ORCPT + 99 others); Fri, 8 Dec 2023 13:13:21 -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 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 08 Dec 2023 10:13:31 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784738444505052594 X-GMAIL-MSGID: 1784738444505052594 The following commit has been merged into the x86/sgx branch of tip: Commit-ID: 853a57a43ebdb8c024160c1a0990bae85f4bcc2f Gitweb: https://git.kernel.org/tip/853a57a43ebdb8c024160c1a0990bae85f4bcc2f 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.kuleuven.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/selftests/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 = 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; }