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 47AF0305E08 for ; Tue, 12 Aug 2025 16:12:54 +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=1755015174; cv=none; b=u+mzOehqnPTp6IjhI38mPMpsUq9sP69PPSE+mFa5EAQd4ubmrNY4R5TL/kneQ37XxVjms3V8FNZ4g9XYliamFRRQ1daw9dNCaU72rOmxsdzoEE9gJWMonqnBRe14ssKoVGEAl5HYrMfjGULmzO+r5jAzXOiozuf4U3R4qiw4mXs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755015174; c=relaxed/simple; bh=jgr/jIz9O7bGPOrPIUI/AV7CxhzqIk2pVaBVoF/r2Ok=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=Ey8TAzMW+GtCBFBUs113tpFP5Qm9CcEImi7o1+5RbhVVpkQH4dSKeDi/s7nHlBCVUllfUHwlrL+IAF15I5w1LxDWUokQ7papA8vSOlI/ow3YPsSGaFwsaGbsMx6Xdqbcq8cvX/VHkLvPykp8Tu4xVG+zIO0yszxQtw3VlCHsn44= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=S5gTtqBA; 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="S5gTtqBA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9C96C4CEF0; Tue, 12 Aug 2025 16:12:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1755015174; bh=jgr/jIz9O7bGPOrPIUI/AV7CxhzqIk2pVaBVoF/r2Ok=; h=Subject:To:Cc:From:Date:From; b=S5gTtqBAwRXTfn+Gpr+Of67I0nOhdu0wGPries5ZraN7Vqmwz5hy+mMvN4D+EWliQ kU/GZVM/F4aRhtXQLUq5eBbix3XewuSnXKEdzKS5in7O08x4KItLLJyrs3FVOQtnb1 cJ13sXe6eHLlgTmOvFTr/my1QqaiSr3jEhI74fok= Subject: FAILED: patch "[PATCH] x86/fpu: Delay instruction pointer fixup until after warning" failed to apply to 5.15-stable tree To: dave.hansen@linux.intel.com,alison.schofield@intel.com,chao.gao@intel.com,peterz@infradead.org Cc: From: Date: Tue, 12 Aug 2025 18:12:50 +0200 Message-ID: <2025081250-ominous-saddling-5ac5@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.15-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y git checkout FETCH_HEAD git cherry-pick -x 1cec9ac2d071cfd2da562241aab0ef701355762a # git commit -s git send-email --to '' --in-reply-to '2025081250-ominous-saddling-5ac5@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 1cec9ac2d071cfd2da562241aab0ef701355762a Mon Sep 17 00:00:00 2001 From: Dave Hansen Date: Tue, 24 Jun 2025 14:01:48 -0700 Subject: [PATCH] x86/fpu: Delay instruction pointer fixup until after warning Right now, if XRSTOR fails a console message like this is be printed: Bad FPU state detected at restore_fpregs_from_fpstate+0x9a/0x170, reinitializing FPU registers. However, the text location (...+0x9a in this case) is the instruction *AFTER* the XRSTOR. The highlighted instruction in the "Code:" dump also points one instruction late. The reason is that the "fixup" moves RIP up to pass the bad XRSTOR and keep on running after returning from the #GP handler. But it does this fixup before warning. The resulting warning output is nonsensical because it looks like the non-FPU-related instruction is #GP'ing. Do not fix up RIP until after printing the warning. Do this by using the more generic and standard ex_handler_default(). Fixes: d5c8028b4788 ("x86/fpu: Reinitialize FPU registers if restoring FPU state fails") Signed-off-by: Dave Hansen Reviewed-by: Chao Gao Acked-by: Alison Schofield Acked-by: Peter Zijlstra (Intel) Cc:stable@vger.kernel.org Link: https://lore.kernel.org/all/20250624210148.97126F9E%40davehans-spike.ostc.intel.com diff --git a/arch/x86/mm/extable.c b/arch/x86/mm/extable.c index bf8dab18be97..2fdc1f1f5adb 100644 --- a/arch/x86/mm/extable.c +++ b/arch/x86/mm/extable.c @@ -122,13 +122,12 @@ static bool ex_handler_sgx(const struct exception_table_entry *fixup, static bool ex_handler_fprestore(const struct exception_table_entry *fixup, struct pt_regs *regs) { - regs->ip = ex_fixup_addr(fixup); - WARN_ONCE(1, "Bad FPU state detected at %pB, reinitializing FPU registers.", (void *)instruction_pointer(regs)); fpu_reset_from_exception_fixup(); - return true; + + return ex_handler_default(fixup, regs); } /*