From nobody Sat Jun 13 22:16: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 995383E9F98; Tue, 5 May 2026 10:55:55 +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=1777978556; cv=none; b=IhDePxjka/gBzwLhp7n5PIyrRDr8i56i4jo9Yzw8AgAxlc2RgZ5rFK5bUSrykGC/ZjeHkFjcOS8l1OAMCtHfxo5zTbnWQnX8yev3zIs1lRKIERJ9/p2XQcWVy7jXYXr0mS96AZo4ShOz4f6by6Opo59+6v9PxiBzRRqjGStMbi0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777978556; c=relaxed/simple; bh=9SfDjEtx3detrhgt6uTkOdcCn65M/t0S3/AGIL4ej5U=; h=Date:From:To:Subject:Cc:MIME-Version:Message-ID:Content-Type; b=D5/YNL1J6qsw/JQ27zOqlv+PpnbWkMPhbPauJ+ZnijwJdA6KUT5iFiOCZuQdX+g5LMw9fhoIg//bxKp6fWwZ3wRTBy3W7WV0dvvY4ybCe+nWx+N/9n2a86EMv7O+Rigr+SKVWOfh2pQmOL6euTruY/ylZbwrKyTY5bFIzDwN5J0= 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=mB8g9PjE; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=toZEtoai; 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="mB8g9PjE"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="toZEtoai" Date: Tue, 05 May 2026 10:55:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1777978554; 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; bh=HODrZNRG3dDN8QIyxksB7g9BJR+1U812MyI1a+P7CuA=; b=mB8g9PjEg0/D+Jn+wP8Ac6+GrHftW2Rs9nCrowkCy+BAnx2Zz9+qwG6u0SH/o5nboCSgUo znARRPIlR3RlLmcnwKSxVoPeccSNVeN+q/rUPtmmq4kMjXCUGz+3DrMz1hGh2Rz6jGYyiO Ay2atfQkBYXLrOZ9sQHSqLvXnU6GdfbnNT947vH2n3I3ZMRzFOUfh8cbH2wdiH6n7HEuJD 9TKoM52PUTubyV4+lK82+XKlmnmgXw1+/hkJMioa34RR0LceFWQNLZyY2YW9YS2DqEcJhO ZhG9iI+ljx1BqNbghS4viqQiM69ejaE5lHl093fmyy1IpfWj0X6Dyg3oJv2WDA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1777978554; 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; bh=HODrZNRG3dDN8QIyxksB7g9BJR+1U812MyI1a+P7CuA=; b=toZEtoaicfib6SFK4RdbgMq7mtwvyMOAAZNN4qZkXgRTWtVwm1SSDivKlm+vWTxoNnH16Q p02q9rI9Oa27vJAw== From: "tip-bot2 for Josh Poimboeuf" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: objtool/core] objtool/klp: Fix kCFI prefix finding/cloning Cc: Song Liu , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177797855309.424702.16968718716996491933.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 objtool/core branch of tip: Commit-ID: f7ceffd21a8a59ba1e92078750eef86e628dea80 Gitweb: https://git.kernel.org/tip/f7ceffd21a8a59ba1e92078750eef86e6= 28dea80 Author: Josh Poimboeuf AuthorDate: Mon, 27 Apr 2026 21:15:52 -07:00 Committer: Josh Poimboeuf CommitterDate: Mon, 04 May 2026 21:16:07 -07:00 objtool/klp: Fix kCFI prefix finding/cloning With CFI+CALL_PADDING, Clang places .Ltmp labels at the start of the NOP padding (offset 5) between the __cfi_ prefix and the function entry point. get_func_prefix() only checks the immediately previous symbol, so the intervening .Ltmp label causes it to miss the __cfi_ prefix symbol. This results in klp-diff not cloning the kCFI type hash into the livepatch module, causing a CFI failure at module load when calling callback functions through indirect calls: CFI failure at __klp_enable_patch+0xab/0x140 (target: pre_patch_callback+0x0/0x80 [livepatch_combined]; expected type: 0xde073954) Instead of walking backward through the section's symbol list, just use find_func_containing() for the byte before the function. This works now that __cfi_ symbols are being grown by objtool to fill the padding. Acked-by: Song Liu Signed-off-by: Josh Poimboeuf --- tools/objtool/include/objtool/elf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/ob= jtool/elf.h index 305183f..fccf72c 100644 --- a/tools/objtool/include/objtool/elf.h +++ b/tools/objtool/include/objtool/elf.h @@ -539,10 +539,10 @@ static inline struct symbol *get_func_prefix(struct s= ymbol *func) { struct symbol *prev; =20 - if (!is_func_sym(func)) + if (!is_func_sym(func) || !func->offset) return NULL; =20 - prev =3D sec_prev_sym(func); + prev =3D find_func_containing(func->sec, func->offset - 1); if (prev && is_prefix_func(prev)) return prev; =20