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 A99522686AA; Tue, 8 Apr 2025 12:37:01 +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=1744115821; cv=none; b=sK+snPD9XWGzMvyzZg1RKik9Zce9veJ/vEFj7f1aFtNlk7DIlZtA77Qg4oTPPiNiA+GcDWqeuiMmAVTmuSOyiSIdjFajlKubLLVHCvmeAEu1iFb6CDHhVeYqGBSD0XgEhWG/kbNNb6Dt2XYPxqprhy75Eoc0vRiQa6H+VxF9AdM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744115821; c=relaxed/simple; bh=cP7WNSRK7LbILkQSB4VTIe/P0Wl2xy+8/X5UE3IPtzk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ScWjVNr+Qrsd7DoNO3dEIBZYJ5ya+ZfGCt6o58Cxyf7z1/yvLEjS5Q9rYzNJWZhiVnoqGxOYYt3Lj/i36f8x+Jc1/XLP7eHuwvu8WwGbgi366KI+q4Grt79aEpn0SckDU9ouzSmswm+ziYrtvXmeKAAoOcI/q05j+YaEF9zG2a0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=2CrZ65Zb; 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="2CrZ65Zb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10381C4CEE5; Tue, 8 Apr 2025 12:37:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744115821; bh=cP7WNSRK7LbILkQSB4VTIe/P0Wl2xy+8/X5UE3IPtzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2CrZ65ZbvputyXWogK6cMyS5wkGh7LWIwVHPXxKD/4u+iYzvJbR7xaJ1MlL4BGkFt uCgxL8+X3jlzSfEI8uWoGDuTwZEu+X5GeFkHedonfKLxTNT0wgdyBZ+9kfYN4AkdXL HQnFSmMjkuW/s8k9mnzEk1jtMlYwGtke7pXlfKeM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jann Horn , Ingo Molnar , Andy Lutomirski , Brian Gerst , Juergen Gross , "H. Peter Anvin" , Linus Torvalds , Kees Cook , Peter Zijlstra , Josh Poimboeuf , Sasha Levin Subject: [PATCH 6.1 077/204] x86/entry: Fix ORC unwinder for PUSH_REGS with save_ret=1 Date: Tue, 8 Apr 2025 12:50:07 +0200 Message-ID: <20250408104822.620167614@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250408104820.266892317@linuxfoundation.org> References: <20250408104820.266892317@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jann Horn [ Upstream commit 57e2428f8df8263275344566e02c277648a4b7f1 ] PUSH_REGS with save_ret=1 is used by interrupt entry helper functions that initially start with a UNWIND_HINT_FUNC ORC state. However, save_ret=1 means that we clobber the helper function's return address (and then later restore the return address further down on the stack); after that point, the only thing on the stack we can unwind through is the IRET frame, so use UNWIND_HINT_IRET_REGS until we have a full pt_regs frame. ( An alternate approach would be to move the pt_regs->di overwrite down such that it is the final step of pt_regs setup; but I don't want to rearrange entry code just to make unwinding a tiny bit more elegant. ) Fixes: 9e809d15d6b6 ("x86/entry: Reduce the code footprint of the 'idtentry' macro") Signed-off-by: Jann Horn Signed-off-by: Ingo Molnar Cc: Andy Lutomirski Cc: Brian Gerst Cc: Juergen Gross Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Kees Cook Cc: Peter Zijlstra Cc: Josh Poimboeuf Link: https://lore.kernel.org/r/20250325-2025-03-unwind-fixes-v1-1-acd774364768@google.com Signed-off-by: Sasha Levin --- arch/x86/entry/calling.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h index f6907627172ba..01e9593e2bd95 100644 --- a/arch/x86/entry/calling.h +++ b/arch/x86/entry/calling.h @@ -70,6 +70,8 @@ For 32-bit we have the following conventions - kernel is built with pushq %rsi /* pt_regs->si */ movq 8(%rsp), %rsi /* temporarily store the return address in %rsi */ movq %rdi, 8(%rsp) /* pt_regs->di (overwriting original return address) */ + /* We just clobbered the return address - use the IRET frame for unwinding: */ + UNWIND_HINT_IRET_REGS offset=3*8 .else pushq %rdi /* pt_regs->di */ pushq %rsi /* pt_regs->si */ -- 2.39.5