From patchwork Wed Jan 31 21:14:43 2024 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: 194938 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:106:209c:c626 with SMTP id mn5csp29622dyc; Wed, 31 Jan 2024 13:17:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IGNJGl1y4nGJe/jQEvFqB81+uXf6f6sA1kG5etFC4hBTPmUMX1R2BYLKggM10P3XHmfDl1O X-Received: by 2002:ae9:f808:0:b0:783:fa44:b578 with SMTP id x8-20020ae9f808000000b00783fa44b578mr428944qkh.34.1706735822599; Wed, 31 Jan 2024 13:17:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706735822; cv=pass; d=google.com; s=arc-20160816; b=DC1ouDc95Di4W0BTfkMkS3yNyW+ZCAQD+uSrhI8m8QE8xVdb/PWKpUP0jMWpQ+AW5k A64f6rIuAO44aAYJaGmmuU7afDwm96hCHe6UzAJTcdFhKx1eGZlaheCddHugDgFUDwvW 2IlUB1oga4d8ym45CMmeQK3eC84DTukgkPbKzSzhRMdlSpgQkJgTe5wTSylymAe9SQEA GyTbLjoZOqzFHYFHsRQERezYMOj5Bt9wEcNKRp68XyyGpX2zn3pT+fX8vaZLiW0WIR7F Zzl3W92taTONR9+0LtIbBBB0Q4f0minwK2GC37gBiNgj6zP8u/GDJ3DWLH8XNf0BcqeQ I/8Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=Q6qCoPTML8h57sp9oE2AUKoqeoqQdIRMSvCJ/ZD1qmw=; fh=da3srK9e/nC3LEhGGa7wFMxPPQnIkhVd/5a/I+8SZeE=; b=D6734Agr3xJAGadVzSFK9J3VYKUfI6eYMJy1np01knf3J2AnLQkteRNxMkPhPaBsdD ti4fFuyXPDpGPX1hBJgtHZJ5T08mEQbV7Jn7emLEaItI0b9XBupt/4ERbapopw5D/N5J a+77Y6n72hkG2EOcfmHbZTUD3tpWVJvYlRU0uVN4t03G6npUQ1UjS9Br1QNR3BFrl0l4 5jZOUHX0/hsXO9oxquy8rwFKrV0hYa8oAPDcFQwEZrC8IHQJw+umMlbcaC5wUbQQdJ0k Fi7xYrwgcgLeIO5Z3rQP4Iq+j4ca3HeS/uCKPa9zwCP4vBTVCmzKx0Hj4a+PJOE2ZNQH zEwA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vkBlf001; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-47123-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47123-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de X-Forwarded-Encrypted: i=1; AJvYcCW8uWviVzbonPB9LedhQbFaHvdlOpWW0UPh+RRe+U2N5qlX7FCDMV/wyGjHCAO78ulIdfIW3lpKkYjkWnviBotCD66hHQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id p3-20020a05620a112300b00783f4af008esi9190210qkk.619.2024.01.31.13.17.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 13:17:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47123-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vkBlf001; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-47123-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47123-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 62E4C1C23167 for ; Wed, 31 Jan 2024 21:17:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B94943AC1A; Wed, 31 Jan 2024 21:14:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="vkBlf001"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="f1FRmEVt" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 A48A739FC0; Wed, 31 Jan 2024 21:14:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706735687; cv=none; b=u0zyEvSlFZchawL2dYTkfAxTpJpbX14w+Hjn5c4iknP6MZE/HjjiCceoaEV/NFd1lDusCXnxymTkYl3NpuOEeZ5xaHGsIwA+IbHrFdZL4ATgOU9Y1SOor0Oa/IRo93L81mDdOra/Q9kUY6GEzSoH0m/M69y/CeUm4DF4LhYB1U4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706735687; c=relaxed/simple; bh=3z4c8NO4/2R13Yelyydbzr9ZVNwLoneQ4Xa1c16NM3U=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=McqJlxcFL6xiLcX0AElcpLxXaczDnlTX3nY8HYdVMsPSPfw4/gqaSCoKHht6O4l+H4W9+d9NhHcqkUqcrmSwbiCBNE7PSfFKfkZXsmY0lHPfrpQE4PrxiaBJQAeeL0k5MGMvIKlgfQXvZH6laBikgA3d0aaq4VnGiUClzrURP6w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=vkBlf001; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=f1FRmEVt; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Wed, 31 Jan 2024 21:14:43 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706735684; 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: in-reply-to:in-reply-to:references:references; bh=Q6qCoPTML8h57sp9oE2AUKoqeoqQdIRMSvCJ/ZD1qmw=; b=vkBlf0012Qi0FmwSzpEy1H+VSBXnLrfcppB68n9ADdkK1oOThVhDCIOpi0gUYY5uME7AIG J3pPfhRudXFslbD4riSmqOAZ8YfzK9e1FsQCnMR9HtyNAXCB4gbWmd7p09SYRJ7o9sW9BV HbOPPTHL68Ja2MoFwPYuTmS+PEO1yoD80PrcTZFfeZEb5Pc6sh/tbM4dTBJyrjUm2S15kM K85YFJ3JZ9dNaJ8qARWAav0THOFJZ9nxqhi8aJH0BzwWR4sThIj3kxJb6mlYv0Y79wMa6N VdZfJvqby34jN5zgkyJ++JI4T1QJ1Y9Gkm7ZY+urX071J1ImvH903PYLxlKOHQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706735684; 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: in-reply-to:in-reply-to:references:references; bh=Q6qCoPTML8h57sp9oE2AUKoqeoqQdIRMSvCJ/ZD1qmw=; b=f1FRmEVtgWgdmUZwhyiGYkufPFPVY8K+Jayh6CcWRoNppBJlG3PoXpgbT8TMaLrWSDDs9/ EDhVYgEHpFVW50CQ== From: "tip-bot2 for H. Peter Anvin (Intel)" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/fred] x86/fred: Let ret_from_fork_asm() jmp to asm_fred_exit_user when FRED is enabled Cc: "H. Peter Anvin (Intel)" , Xin Li , Thomas Gleixner , "Borislav Petkov (AMD)" , Shan Kang , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231205105030.8698-29-xin3.li@intel.com> References: <20231205105030.8698-29-xin3.li@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170673568329.398.1021316577676211303.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784440889941421256 X-GMAIL-MSGID: 1789642221778858307 The following commit has been merged into the x86/fred branch of tip: Commit-ID: 51ef2a4da7ec347e3315af69a426ac36fab98a6c Gitweb: https://git.kernel.org/tip/51ef2a4da7ec347e3315af69a426ac36fab98a6c Author: H. Peter Anvin (Intel) AuthorDate: Tue, 05 Dec 2023 02:50:17 -08:00 Committer: Borislav Petkov (AMD) CommitterDate: Wed, 31 Jan 2024 22:02:59 +01:00 x86/fred: Let ret_from_fork_asm() jmp to asm_fred_exit_user when FRED is enabled Let ret_from_fork_asm() jmp to asm_fred_exit_user when FRED is enabled, otherwise the existing IDT code is chosen. Signed-off-by: H. Peter Anvin (Intel) Signed-off-by: Xin Li Signed-off-by: Thomas Gleixner Signed-off-by: Borislav Petkov (AMD) Tested-by: Shan Kang Link: https://lore.kernel.org/r/20231205105030.8698-29-xin3.li@intel.com --- arch/x86/entry/entry_64.S | 6 ++++++ arch/x86/entry/entry_64_fred.S | 1 + 2 files changed, 7 insertions(+) diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index 29ce68f..7c4b726 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -247,7 +247,13 @@ SYM_CODE_START(ret_from_fork_asm) * and unwind should work normally. */ UNWIND_HINT_REGS + +#ifdef CONFIG_X86_FRED + ALTERNATIVE "jmp swapgs_restore_regs_and_return_to_usermode", \ + "jmp asm_fred_exit_user", X86_FEATURE_FRED +#else jmp swapgs_restore_regs_and_return_to_usermode +#endif SYM_CODE_END(ret_from_fork_asm) .popsection diff --git a/arch/x86/entry/entry_64_fred.S b/arch/x86/entry/entry_64_fred.S index c1ddaf6..2271a1c 100644 --- a/arch/x86/entry/entry_64_fred.S +++ b/arch/x86/entry/entry_64_fred.S @@ -32,6 +32,7 @@ SYM_CODE_START_NOALIGN(asm_fred_entrypoint_user) FRED_ENTER call fred_entry_from_user +SYM_INNER_LABEL(asm_fred_exit_user, SYM_L_GLOBAL) FRED_EXIT ERETU SYM_CODE_END(asm_fred_entrypoint_user)