From nobody Sat Jun 13 22:14:55 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 2A8B147ECDC; Tue, 5 May 2026 10:56:31 +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=1777978592; cv=none; b=EYAqFEVySxlBSBEdsm7May9lEV+YVl+dFjy61EQGrVs2CcJsdmGwQnpy3QLi1K6nAU4eqxT9FGkUCUAhlmo56vuQ1mkTAMWMoiO2BSjQJosOkzGIuS1fz+5wPxcRfvnhtWs4LPjGXfJTT+SKPE0yvrUSQ5Ma53V+ZR+SKrJ4j40= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777978592; c=relaxed/simple; bh=wcYj+RAx4oZe41R5BeurOevg3GBk+Ou+3DX7MTyKxhM=; h=Date:From:To:Subject:Cc:MIME-Version:Message-ID:Content-Type; b=WNB/ppP/xKof++RzQPc7Y0JHXqQlmzEA4/LqW3YCz22rvRxHXpPDXnUwy9aWxOqpljDiRSeCuc1EkZeSwGbUtQgeMfOqG+yFjEsB3D26eAfYmfJN/bAtmoNZbmXybbl2qC5HHz0ofzQ1YHV7FoKHF4ot3aD/cjihesDZ5BOfp80= 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=fkM+8XfO; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=D92YL6lw; 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="fkM+8XfO"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="D92YL6lw" Date: Tue, 05 May 2026 10:56:28 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1777978590; 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=IAtS6s8E4l6gvc9WTnZTcdpbf6Dg1TOYB+7lG5R2zLI=; b=fkM+8XfO/swwPQQfR+j9huPaqJkFeABXxQKKnjIJMZGHNQiFZx3dK2R86MyXQCeZuLacLP bm9h3n9YUIzvqjd9xtV4EHl82Id0VA7Nzw2BtqeKEopquNaym6f+8HWqxvwxPQBiMgXyrY oFbCRWx5TZ1d6Y219k2CC42aS3VUmgHMAaEjxhyHnEKFH1rjU9YLIbzIJV7hHDu56J0z0/ vpsyMcSM14vPwHEQc+6fe+2LeX6RXq5sPXL7jr2Fa/fMeZVOZFKZa88oFoRET6pNFpp8CB jp5pNjoSkyoQL7ZidRCUjwztsz4w+Ydto+mY/peglLtDS0UGHQvaghTCA452NQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1777978590; 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=IAtS6s8E4l6gvc9WTnZTcdpbf6Dg1TOYB+7lG5R2zLI=; b=D92YL6lwQm236bAoKpCdrbVAHhFtIUHs6B1AkbtknFrjjveBz7H/uTQlXcCnz9gmueW+l1 Blhgt3DdqE08bDAA== 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: Fix reloc hash collision in find_reloc_by_dest_range() Cc: "Peter Zijlstra (Intel)" , 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: <177797858868.424702.8040675994241982253.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: a375e327b63e0da29b82a92b569bfdf4628fa38a Gitweb: https://git.kernel.org/tip/a375e327b63e0da29b82a92b569bfdf46= 28fa38a Author: Josh Poimboeuf AuthorDate: Tue, 21 Apr 2026 07:21:19 -07:00 Committer: Josh Poimboeuf CommitterDate: Mon, 04 May 2026 21:16:02 -07:00 objtool: Fix reloc hash collision in find_reloc_by_dest_range() In find_reloc_by_dest_range(), hash collisions can cause a high-offset relocation to appear when probing a low-offset hash bucket. Only return early when the best match found so far genuinely belongs to the current bucket (its offset is within the bucket's stride range). Otherwise, continue scanning later buckets which may contain lower-offset matches. This ensures the first reloc in the range gets returned. Fixes: 74b873e49d92 ("objtool: Optimize find_rela_by_dest_range()") Acked-by: Peter Zijlstra (Intel) Acked-by: Song Liu Reviewed-by: Miroslav Benes Signed-off-by: Josh Poimboeuf --- tools/objtool/elf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 5a20dab..f41280e 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -315,8 +315,9 @@ struct symbol *find_global_symbol_by_name(const struct = elf *elf, const char *nam return NULL; } =20 +/* If there are multiple matches, return the first one in the range */ struct reloc *find_reloc_by_dest_range(const struct elf *elf, struct secti= on *sec, - unsigned long offset, unsigned int len) + unsigned long offset, unsigned int len) { struct reloc *reloc, *r =3D NULL; struct section *rsec; @@ -338,11 +339,11 @@ struct reloc *find_reloc_by_dest_range(const struct e= lf *elf, struct section *se r =3D reloc; } } - if (r) + if (r && (reloc_offset(r) & OFFSET_STRIDE_MASK) =3D=3D o) return r; } =20 - return NULL; + return r; } =20 struct reloc *find_reloc_by_dest(const struct elf *elf, struct section *se= c, unsigned long offset)