From nobody Sat Jun 13 07:52:24 2026 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 865793FA5DE; Fri, 8 May 2026 15:03:06 +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=1778252589; cv=none; b=uNem0h8P9QgkwLDl6s2KX36e52uYu4iSli3AVyS/rh5YcIV1X2rib6j3xjXM+2NlyEwaVCvHpxzHa8HC4vnjIRDxOor194IP/pp4CnX1Zz3epu3EaicuwzQ2Dt8ppEDoKIFoc9kYqwfcH/7c+MCRxsklqAz/NhGyagsXDKAHrmg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778252589; c=relaxed/simple; bh=L7rsZRB2dHe3RPpo2tDTyODV6zz7mUCGEpIfxmBdMiQ=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=CupWzMgmSQRyzVou1GnnjifJo8j1QkW6VMeilk9hUYBylRlSSW/v6dplaaSd+dSFUJwcPh6SoGIEfGctBKtFUWLOm4rA4uVehqNNTK+uXYHxIMYR6DXZ4krgv5z8JZKWCImOnUC6YYXrBGSZpptuBJHvT5do6xN6fwnh8ioTGDQ= 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=ueX4ykxZ; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=elJVadnN; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ueX4ykxZ"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="elJVadnN" Date: Fri, 08 May 2026 15:02:57 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1778252578; 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=cMtNhQ7tQCdnjwTIeuoUlz2hN5nvoxkWO1MsorI0QBM=; b=ueX4ykxZJnfNmycLDbVqcxjYD5zOzevsl20aWRrIlvDQCy09WgBS5fX/bLPGyhlgZ0hFjy QftSYCazy1hWvR53XM3PxvZjABOLxSlMUpqO4ssLLCCb+pPunNFAxptwPoE5wtrBNhcL7F O3qmOUFkShQzizgOK8jH7a7lQt2lumqoHW4lC5pJ2tH85TvYpsy3N5zkZENITcy8ob1rMr mhm1ozWQG/X/GTa1kTYatyLDzZntehLvOx8fwelK0KKFBoITyCFTY+fVWxaQnqKWjkLnGF dbjrgEkk33IY6hCLdohMaP5pbI4eL1VAehOxEApWniKCBL5zN43ksAbQ0ZjvZA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1778252578; 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=cMtNhQ7tQCdnjwTIeuoUlz2hN5nvoxkWO1MsorI0QBM=; b=elJVadnNeKA5pqZNU1/SKwg/XzQUoXIMuynz7oM7ffZaCg0/+/V4wYx8yaql3mb+7NCzjb rPHvJnt04YWIU6BA== From: "tip-bot2 for David Woodhouse" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/kexec: Push kjump return address even for non-kjump kexec Cc: Rohan Kakulawaram , David Woodhouse , "Borislav Petkov (AMD)" , Dave Hansen , , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <32d627134143ffd957891cb697138e839c623211.camel@infradead.org> References: <32d627134143ffd957891cb697138e839c623211.camel@infradead.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177825257720.864.5314098246384103904.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 786a45757dcdf8f2beb9d4a6db605db16c18b2b4 Gitweb: https://git.kernel.org/tip/786a45757dcdf8f2beb9d4a6db605db16= c18b2b4 Author: David Woodhouse AuthorDate: Tue, 28 Apr 2026 21:59:52 +01:00 Committer: Borislav Petkov (AMD) CommitterDate: Fri, 08 May 2026 17:00:12 +02:00 x86/kexec: Push kjump return address even for non-kjump kexec The version of purgatory code shipped by kexec-tools attempts to look above the top of its stack to find a return address for a kjump, even in a non-kj= ump kexec. After the commit in Fixes: the word above the stack might not be there, leading to a fault (which is at least now caught by my exception-handling c= ode in kexec). That commit fixed things for the actual kjump path, but no longer "gratuitously" pushes the unused return address to the stack in the non-kju= mp path. Put that *back* in the non-kjump path, to prevent purgatory from crashing when trying to access it. Fixes: 2cacf7f23a02 ("x86/kexec: Fix stack and handling of re-entry point f= or ::preserve_context") Reported-by: Rohan Kakulawaram Signed-off-by: David Woodhouse Signed-off-by: Borislav Petkov (AMD) Acked-by: Dave Hansen Tested-by: Rohan Kakulawaram Cc: Link: https://patch.msgid.link/32d627134143ffd957891cb697138e839c623211.cam= el@infradead.org --- arch/x86/kernel/relocate_kernel_64.S | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/x86/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocat= e_kernel_64.S index 4ffba68..eaeb774 100644 --- a/arch/x86/kernel/relocate_kernel_64.S +++ b/arch/x86/kernel/relocate_kernel_64.S @@ -136,6 +136,14 @@ SYM_CODE_START_LOCAL_NOALIGN(identity_mapped) * %r13 original CR4 when relocate_kernel() was invoked */ =20 + /* + * Set return address to 0 if not preserving context. The purgatory + * shipped in kexec-tools will unconditionally look for the return + * address on the stack and set a kexec_jump_back_entry=3D command + * line option if it's non-zero. There's no other way that it can + * tell a preserve-context (kjump) kexec from a normal one. + */ + pushq $0 /* store the start address on the stack */ pushq %rdx =20