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 277F8C54E94 for ; Tue, 24 Jan 2023 02:27:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231508AbjAXC1x (ORCPT ); Mon, 23 Jan 2023 21:27:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229603AbjAXC1u (ORCPT ); Mon, 23 Jan 2023 21:27:50 -0500 Received: from gnuweeb.org (gnuweeb.org [51.81.211.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A72A7298; Mon, 23 Jan 2023 18:27:49 -0800 (PST) Received: from localhost.localdomain (unknown [182.253.88.152]) by gnuweeb.org (Postfix) with ESMTPSA id 7E07682EF0; Tue, 24 Jan 2023 02:27:42 +0000 (UTC) X-GW-Data: lPqxHiMPbJw1wb7CM9QUryAGzr0yq5atzVDdxTR0iA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1674527268; bh=lfJPIxz6SznwA800g3Y9BeouGUR6bkc7dvZhqtUjmII=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EAnyk8BQaiFAL/LUCIygK5N/vVI+cKscritKaCGXcIYPcl3l+ykpJeILaANYlIfQp W+2avU1oitGYw37+2u13JOuxFF4i4yKZqg55p8Pc91Po1cjCgRbpYb6VRBIjh3fV7g evNAijLWDotdDU96WF58MH/Y82WQmHRKs/jL6pqR95ET/qyE5vp0i0goGOZzXYlVyU FTN54xIEIEbxYeyPsQTJETG7kOcAt1X58ymgPXwFj6PhTmhsleg96kxB67oazhezPL EqpY9QExvPhMiEGCN9gr2NI60Mvwp5MuUg9j+kwGh4s01VtHxvauC/XMhUexqkESCF FGdVrdC/qliUA== From: Ammar Faizi To: "H. Peter Anvin" , x86 Mailing List Cc: Ammar Faizi , Dave Hansen , Dave Hansen , Xin Li , Thomas Gleixner , Andrew Cooper , Brian Gerst , Ingo Molnar , Borislav Petkov , Peter Zijlstra , Shuah Khan , Ingo Molnar , Andy Lutomirski , "Kirill A. Shutemov" , Linux Kselftest Mailing List , Linux Kernel Mailing List Subject: [RFC PATCH v2 0/2] selftests/x86: sysret_rip update for FRED system Date: Tue, 24 Jan 2023 09:27:27 +0700 Message-Id: <20230124022729.596997-1-ammarfaizi2@gnuweeb.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <5ecc383c-621b-57d9-7f6d-d63496fca3b3@zytor.com> References: <5d4ad3e3-034f-c7da-d141-9c001c2343af@intel.com> <18B5DB6D-AEBD-4A67-A7B3-CE64940819B7@zytor.com> <25b96960-a07e-a952-5c23-786b55054126@zytor.com> <6cd0db14-c9e2-3598-fd10-4b473d78c373@citrix.com> <5ecc383c-621b-57d9-7f6d-d63496fca3b3@zytor.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ammar Faizi This is an RFC patchset v2. Xin Li reported sysret_rip test fails at: assert(ctx->uc_mcontext.gregs[REG_EFL] == ctx->uc_mcontext.gregs[REG_R11]); in a FRED system. Handle the FRED system scenario too. There are two patches in this series. Comments welcome... Note: This patchset is only tested for 'syscall' sets %rcx=%rip and %r11=%rflags case. I don't have a FRED system to test it. How to test this: $ make -C tools/testing/selftests/x86 $ tools/testing/selftests/x86/sysret_rip_64 Link: https://lore.kernel.org/lkml/5d4ad3e3-034f-c7da-d141-9c001c2343af@intel.com Signed-off-by: Ammar Faizi --- ## Changelog v2: - Use "+r"(rsp) as the right way to avoid redzone problems per Andrew's comment (hpa). (Ref: https://lore.kernel.org/lkml/8f5c24df-514d-5d89-f58f-ec8c3eb1e049@zytor.com ) --- Ammar Faizi (2): selftests/x86: sysret_rip: Handle syscall in a FRED system selftests/x86: sysret_rip: Add more syscall tests with respect to `%rcx` and `%r11` tools/testing/selftests/x86/sysret_rip.c | 105 ++++++++++++++++++++++- 1 file changed, 104 insertions(+), 1 deletion(-) base-commit: e12ad468c22065a2826b2fc4c11d2113a7975301 -- Ammar Faizi