From nobody Sat Jun 13 22:12:58 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 525EA481A8E; Tue, 5 May 2026 10:56:44 +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=1777978605; cv=none; b=jwnIMBUJ9pde+tvMutJtEUkgPbMHfMwDmpdm3qbMM5LFIirGYOzDeem5K1kJII6ppYvLJ7oImEazA76P5NHIh8oAYycOKKma4hIa5oj41Us7QWPqOIurZqmi1VbcK6nQBuidgH/F60p87DJPr/iMhOirOXErN1Rvs2p2HujDlVI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777978605; c=relaxed/simple; bh=r+4hgb11IlpcAxVEuQ9/xIwg7lFtT5TmeikcS4213KQ=; h=Date:From:To:Subject:Cc:MIME-Version:Message-ID:Content-Type; b=oVvwGLKayaceh9Ja1US9UEC/66OHM5LHDfnrygXgtnB8gbKVBufKbG1X2qUPUvtLMYWSWm/UMB10uXSzdaBRvUEr6sbjDPaD8R08UagmjQKfajniR+bZyxSPJ2PFX4GfLNLEzjwXOuwxgVqnUNXP3FsBXmRlER3qGT5LQM5XT0E= 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=rWMjmTef; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=TeBmmcPn; 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="rWMjmTef"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="TeBmmcPn" Date: Tue, 05 May 2026 10:56:41 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1777978603; 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=bCdOtrLISAHQzn/RN4XTfuAyHi+oNR8SyDkQMqHvfQo=; b=rWMjmTefNrORXqkndZ02tFf1ySEPYPIeoOJVdTNZzim/oaUXxV2AEea7cBONJc/fqwkKvf BjFL0qCuKdXosvfCPMRTjNScSBc0C/JFKJ0q/OYxNY4V7GnH6ryaPPGBTefWN9SwAVBiJE HYiB6SUSB1y5xikyFMJn0AKEqJqaBCOzBz6SL6bWVapmo080s54s99EBhppuAp6rFBeRf5 uNsIEWJ/6EEyzOqSZFPYDUJNXDl0L2/Okd0WQq8Cem7wZiak6j1TBSGVX9VseXvCpCuY/v BxMQH2b82oywRUml6BR7cKjaceGIJIFVwPH3iXq9rNTKGYjhw/DS/p1l1nvjyw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1777978603; 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=bCdOtrLISAHQzn/RN4XTfuAyHi+oNR8SyDkQMqHvfQo=; b=TeBmmcPn7BxIy+UWMu4+RyhKKFg7pSlNK/qCRz0cmn9JzyLj/VoOsLdlXLhSYlx1FPIeQQ Yj1J0loAdD/GAIAg== 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 handling of zero-length .altinstr_replacement sections Cc: Song Liu , Miroslav Benes , 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: <177797860178.424702.14674339944716483573.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: c4c02d4450b5b7e2fbde578252f71a5697180112 Gitweb: https://git.kernel.org/tip/c4c02d4450b5b7e2fbde578252f71a569= 7180112 Author: Josh Poimboeuf AuthorDate: Thu, 09 Apr 2026 18:34:50 -07:00 Committer: Josh Poimboeuf CommitterDate: Mon, 04 May 2026 21:16:00 -07:00 objtool/klp: Fix handling of zero-length .altinstr_replacement sections When a section is empty (e.g. only zero-length alternative replacements), there are no symbols to convert a section symbol reference to. Skip the reloc instead of erroring out. Fixes: dd590d4d57eb ("objtool/klp: Introduce klp diff subcommand for diffin= g object files") Acked-by: Song Liu Reviewed-by: Miroslav Benes Signed-off-by: Josh Poimboeuf --- tools/objtool/klp-diff.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/objtool/klp-diff.c b/tools/objtool/klp-diff.c index 30ce234..a226e99 100644 --- a/tools/objtool/klp-diff.c +++ b/tools/objtool/klp-diff.c @@ -1006,6 +1006,13 @@ static int convert_reloc_secsym_to_sym(struct elf *e= lf, struct reloc *reloc) sym =3D find_symbol_containing(sec, arch_adjusted_addend(reloc)); if (!sym) { /* + * This is presumably an .altinstr_replacement section which is + * empty due to it only having zero-length replacement(s). + */ + if (!sec_size(sec)) + return 1; + + /* * This can happen for special section references to weak code * whose symbol has been stripped by the linker. */ @@ -1265,6 +1272,7 @@ static int clone_sym_relocs(struct elfs *e, struct sy= mbol *patched_sym) =20 for_each_reloc(patched_rsec, patched_reloc) { unsigned long offset; + int ret; =20 if (reloc_offset(patched_reloc) < start || reloc_offset(patched_reloc) >=3D end) @@ -1278,12 +1286,15 @@ static int clone_sym_relocs(struct elfs *e, struct = symbol *patched_sym) !strcmp(patched_reloc->sym->sec->name, ".altinstr_aux")) continue; =20 - if (convert_reloc_sym(e->patched, patched_reloc)) { + ret =3D convert_reloc_sym(e->patched, patched_reloc); + if (ret < 0) { ERROR_FUNC(patched_rsec->base, reloc_offset(patched_reloc), "failed to convert reloc sym '%s' to its proper format", patched_reloc->sym->name); return -1; } + if (ret > 0) + continue; =20 offset =3D out_sym->offset + (reloc_offset(patched_reloc) - patched_sym-= >offset); =20