From patchwork Wed Jan 31 07:21:11 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: 194546 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1722442dyb; Tue, 30 Jan 2024 23:23:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IFCv1NBYuQhpnhECq/ZZoAJLabNfjUOGdtIrqvgezewAEx9VhIcjAvTh3IXjomzbZGd5JZO X-Received: by 2002:a05:6a20:2a22:b0:19c:8a1a:d9a8 with SMTP id e34-20020a056a202a2200b0019c8a1ad9a8mr622780pzh.42.1706685813567; Tue, 30 Jan 2024 23:23:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706685813; cv=pass; d=google.com; s=arc-20160816; b=yVRF6r5bEQO3e25edARYUEUwCsp1gvfyxqFNczS0LnI8Pf093Yw5phU8wdwbGvcJbd R+RY/XyN/puBAgMdu6HEyX4AVjgM55Qph2+ctb4iBNLzkGHaXsvOSgJihaM6PsW+qOuP 0B4m4QBZOgl1C6fn7dtRw2qAr7ibEDES6LtSb8x8U0jH+vrmOSYxlcZuOoPrWGiHMdrq 8XJ+B+psmKW6sdkm+StTU64I4pr7p96nIEnFYUp9+tAkyMXTCZMb3u0K6EyKYYT8PTae dF+pnpfy0KmkLso5Janpn5ex+uaNWrCcTT5rVXnqWmdAw1iHRfE7OTOUv5jSKe76VX9X kpWg== 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=1XlbVEcqzK70Xd4/IoT+NiavE0+oU/y+jSQKIyn/+Go=; fh=AFDMKjyyPGcpfcgCB32cRXNsf3wsVBqKif3/do7lPUs=; b=IDuEQHKvmqfdaJDyRvGMS3GNfHwPSN4thSW43k2t6jZc1KJnYgmftyIJ2sXT197Mfl aWv/kJTMI4ujcruJm7yGSMbX2P1k4OsmlJjy+pC2jZ8dfVnbXSO6zNzEfEqYYTA3NEkT NsXOKBqJ7XYJyLrqNGgEhSwyi9kKNK33R6e3FtP4z2YfTrHieXHeAStoZ6jfMJz08LR8 xs0TKDacA/UL9jopuLMUVzns1Uu21TNexC6vOS6Vy9otQpL37eCNmlWfFEKizcqlfLpS YJCpWCOv4SqGWxdtfn5ay3TJe36j57DPQFM/mC7qb3CP9kFKDJzJm2ewEZqP7J+mh2sG YUmQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=GAekjjuz; 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-45897-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45897-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de X-Forwarded-Encrypted: i=1; AJvYcCVAFq1bERIgArBRnWUkv/MxwsXpimPz/RPuwyySEhmB7JIV1IJ37l79xIWCpp9jq2c+iS5PoNE6g5NXCG88DSWu738ahg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n18-20020a634d52000000b005d8e379746asi2696760pgl.630.2024.01.30.23.23.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 23:23:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45897-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=GAekjjuz; 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-45897-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45897-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 0F77428B5C9 for ; Wed, 31 Jan 2024 07:22:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C953864CC8; Wed, 31 Jan 2024 07:21:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="GAekjjuz"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Gag5/Fxf" 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 ECC4557895; Wed, 31 Jan 2024 07:21:13 +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=1706685675; cv=none; b=QJONrxDM/2Xfsu7tpOoA9XHvBUZ4NoD8RIOuOlLrYjbW88zT296v4HD4n5Ng9cNCnfeqTd7Yp/nnDtjZQ5Tyf+eRf64UIrNN/+HXIsVUcTaIqAfTlBAluUM258ZY4QiETONp3RbjsJdA6omcjqVKqcLaILGP73AFTBm+/Aunygw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706685675; c=relaxed/simple; bh=ZtKcR+gaBrCffk5+FcWQymIAZGh5FL7JvJ7v4IjK4hk=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=kKMuQ2Z4pUr/1YsptatYg6+t1hFPjikO44Z2pKgzKQF+4a3UptBht92OBca8c+cPQG5xAvR6rzvzSsY7spgumwI8Yn3cYD1mszmR6Odwy4/I9bzz3bs5mnxarwysX4pUCWuuGhBy3qgXcbsBHJCv67g26qmDODagu9z3/DKeEGQ= 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=GAekjjuz; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Gag5/Fxf; 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 07:21:11 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706685672; 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=1XlbVEcqzK70Xd4/IoT+NiavE0+oU/y+jSQKIyn/+Go=; b=GAekjjuz0ybuz7LASDJ1KiPru7qkye4TWjr/PT6j8+tgWZl4oSC8u6e5vvNA1j+eXZpX9z wfekvSo96eeYuqYq6/I1o03udgMOhZ0xPSMMd9QbqKHFNZGRAyNbsyBOYMy3F/h4SJGfnv AE4FUtknIkfPIdsULCIoenEHwgs2mFbaMBc3/xlUqCeJm77mu2H7wLq/nQN5XXGrSh7kqS +tsf7DtLt32sSbD2QOgmKDmEa7fyi8IY/4LPCN8uXefLTQtIAP3IrTdrL5l4s7QW8FR8sk /px3XUfNe4H9thgyvpCnER/5iCDJDaY1JMjsWqSqx6VwB2Umdl9YV73eXnMGMg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706685672; 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=1XlbVEcqzK70Xd4/IoT+NiavE0+oU/y+jSQKIyn/+Go=; b=Gag5/FxfamX284WGm1+59s3SfbEDN52XgRtURVu1wfAf8+k9//ZcmjB+9lxtdLj1zafRns iKJE704sp2AHA6AQ== 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 , 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: <170668567170.398.9402549096413117470.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: 1789589783814238875 The following commit has been merged into the x86/fred branch of tip: Commit-ID: 531ff17a705a0f0ecafb8823956f69d5fbfda6fd Gitweb: https://git.kernel.org/tip/531ff17a705a0f0ecafb8823956f69d5fbfda6fd Author: H. Peter Anvin (Intel) AuthorDate: Tue, 05 Dec 2023 02:50:17 -08:00 Committer: Borislav Petkov (AMD) CommitterDate: Tue, 30 Jan 2024 18:20:36 +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 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)