From: sashiko-bot@kernel.org
To: peterz@infradead.org, "Longjun Luo" <luolongjuna@gmail.com>,
jpoimboe@kernel.org
Cc: linux-kernel@vger.kernel.org, song@kernel.org,
live-patching@vger.kernel.org, pmladek@suse.com,
jikos@kernel.org
Subject: Re: [PATCH] objtool/klp: Fix missed changes to same-named symbol references
Date: Thu, 10 Sep 2026 09:02:04 +0000 [thread overview]
Message-ID: <20260910090204.B58EF1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260910085218.66565-1-luolongjuna@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] `__checksum_update_object_symbol()` unintentionally hashes the `offset` parameter (the relocation's position in the object) using `sizeof(offset)`. Since `offset` is an `unsigned long`, this introduces host-dependent hashing (4 bytes on 32-bit hosts, 8 bytes on 64-bit hosts), which breaks reproducible builds when cross-compiling. Furthermore, this behavior is inconsistent with `__checksum_update_object()` (used for string section relocations), which only uses the offset for debugging and does not hash it.
--
commit 84526b95607bbfd01a9cb5c2ebf122ffa01327c1
Author: Longjun Luo <luolongjuna@gmail.com>
objtool/klp: Fix missed changes to same-named symbol references
This commit modifies objtool to hash referenced symbols using both the
filename and the demangled name. This aims to prevent false negatives
when a function or data object changes its target to a same-named
static function.
> diff --git a/tools/objtool/include/objtool/checksum.h b/tools/objtool/include/objtool/checksum.h
> index d46293f547166..1834d34dfd478 100644
> --- a/tools/objtool/include/objtool/checksum.h
> +++ b/tools/objtool/include/objtool/checksum.h
[ ... ]
> @@ -38,6 +56,15 @@ static inline void __checksum_update_object(struct symbol *sym,
> dbg_checksum_object(sym, offset, what, XXH3_64bits_digest(sym->csum.state));
> }
>
> +static inline void __checksum_update_object_symbol(struct symbol *sym,
> + unsigned long offset,
> + struct symbol *target)
> +{
> + __checksum_update(sym, &offset, sizeof(offset));
[Severity: Medium]
Can hashing the offset parameter here introduce host-dependent behavior?
Since offset is an unsigned long, sizeof(offset) is 4 bytes on 32-bit hosts
and 8 bytes on 64-bit hosts. This can cause the generated livepatch checksums
to vary depending on the build host, which breaks reproducible builds when
cross-compiling.
Before this change, __checksum_update_object() received sym_offset but only
used it for debugging output without hashing it. Should this offset be
excluded from the hash calculation here as well to ensure consistent
checksums across different build hosts?
> + __checksum_update_symbol_identity(sym, target);
> + dbg_checksum_object(sym, offset, "reloc name", XXH3_64bits_digest(sym->csum.state));
> +}
> +
> diff --git a/tools/objtool/klp-checksum.c b/tools/objtool/klp-checksum.c
> index b8e47f28997e9..3da3fe11bf762 100644
> --- a/tools/objtool/klp-checksum.c
> +++ b/tools/objtool/klp-checksum.c
[ ... ]
> @@ -206,9 +203,7 @@ static void checksum_update_object(struct objtool_file *file, struct symbol *sym
> offset -= target->offset;
> }
>
> - __checksum_update_object(sym, sym_offset, "reloc name",
> - target->demangled_name,
> - strlen(target->demangled_name));
> + __checksum_update_object_symbol(sym, sym_offset, target);
> __checksum_update_object(sym, sym_offset, "reloc addend",
> &offset, sizeof(offset));
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260910085218.66565-1-luolongjuna@gmail.com?part=1
next prev parent reply other threads:[~2026-09-10 9:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 8:52 Longjun Luo
2026-09-10 9:02 ` sashiko-bot [this message]
2026-09-10 9:32 ` Longjun Luo
2026-09-14 0:26 ` Josh Poimboeuf
2026-09-14 12:12 ` Longjun Luo
2026-09-14 19:55 ` Josh Poimboeuf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260910090204.B58EF1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=jikos@kernel.org \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=luolongjuna@gmail.com \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=song@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®