From nobody Wed Feb 11 08:33:20 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 E5F2B46BF; Tue, 28 Jan 2025 22:22:51 +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=1738102973; cv=none; b=UEqLN/IW+kTwfMMAym3PbXWU4TcBiQgitd7iQgfIaS5YqinxT/tNJeffKL5//pvxTbgMQMyoJCClcDrLRstU8gUk16naiPXjlRQVE8BOJeDeKXV0/ViYqd8J4U95pIzLHUJaVc7S8O8/R5lIjN/xplRbfpIidXhZWf8EWq3LuwE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738102973; c=relaxed/simple; bh=yd5YE3bcC4czv8PWxHTRHQ8XvV1JX8+CVosiUn4ri9w=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=qMHzsmleyUQzAhiVYV3L5bqfUhC2/MU1vQFK/iTyo4IiwUPOBYIAayuTspXYO1gC8VDlnoyhSqstsDLmvFbUjrwyOOrczXqhEf04uwehwLQYdhW6FPNTusxIN/ilUBqCta1tQlzNpyEbzAncywQrBnwq8QEpPLrxr1Yox7lwLuc= 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=3Db59PVj; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=nIqerQIc; 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="3Db59PVj"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="nIqerQIc" Date: Tue, 28 Jan 2025 22:22:45 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1738102969; 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=mR+kVi9+qfuGse3IV27ZeOMISzc/YhCUyv5Ovby2JBU=; b=3Db59PVjNQLiY/YUSSpvrF9j+FPFp8+MYIZyxZTRtS1dvhVMOoW3YWHP6jPobhyRVkFDFp pRmTiEeJc1t11u/wYMmy1ZOflXiyuQCnauuoGBgwlt5Re4LjU9VEs9h0nEZ0Z5sA7wrm9e ZOIz9p4YNGFM3vpDIAU3rTNsn8Gc6GIM2WH73/bpj05cjb+KuqzUinOAELSQp3GIagd7Sx mfUVU7fk94PfNqY9iB8Pbmr8lPw/mBiw62n9YR/8XG+Q8XQICqfIo3m3aAtu+puBDAD8z0 c4aSsYQ1UZxoAmzxE/fIlw+4uL3T6ia7YZwubRPEauFVf/cBKkXdFtejUH8DKA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1738102969; 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=mR+kVi9+qfuGse3IV27ZeOMISzc/YhCUyv5Ovby2JBU=; b=nIqerQIcsTI+iKKKdxzkyufEE+RB6/vnyl9kd6hhjEodcLT4b8/TK8w+DW6SlPhhYkCyhm brxLAmalAdKJUKAw== From: "tip-bot2 for Ard Biesheuvel" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/sev: Disable jump tables in SEV startup code Cc: Linus Torvalds , Ard Biesheuvel , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20250127114334.1045857-6-ardb+git@google.com> References: <20250127114334.1045857-6-ardb+git@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <173810296584.31546.2403049266146362118.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: 1105ab42a84bc11c62597005f78ccad2434fbd66 Gitweb: https://git.kernel.org/tip/1105ab42a84bc11c62597005f78ccad24= 34fbd66 Author: Ard Biesheuvel AuthorDate: Mon, 27 Jan 2025 12:43:37 +01:00 Committer: Ingo Molnar CommitterDate: Tue, 28 Jan 2025 23:10:29 +01:00 x86/sev: Disable jump tables in SEV startup code When retpolines and IBT are both disabled, the compiler is free to use jump tables to optimize switch instructions. However, these are emitted by Clang as absolute references into .rodata: jmp *-0x7dfffe90(,%r9,8) R_X86_64_32S .rodata+0x170 Given that this code will execute before that address in .rodata has even been mapped, it is guaranteed to crash a SEV-SNP guest in a way that is difficult to diagnose. So disable jump tables when building this code. It would be better if we could attach this annotation to the __head macro but this appears to be impossible. Reported-by: Linus Torvalds Tested-by: Linus Torvalds Signed-off-by: Ard Biesheuvel Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20250127114334.1045857-6-ardb+git@google.com --- arch/x86/coco/sev/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/coco/sev/Makefile b/arch/x86/coco/sev/Makefile index 08de375..dcb06dc 100644 --- a/arch/x86/coco/sev/Makefile +++ b/arch/x86/coco/sev/Makefile @@ -2,6 +2,10 @@ =20 obj-y +=3D core.o =20 +# jump tables are emitted using absolute references in non-PIC code +# so they cannot be used in the early SEV startup code +CFLAGS_core.o +=3D -fno-jump-tables + ifdef CONFIG_FUNCTION_TRACER CFLAGS_REMOVE_core.o =3D -pg endif