Re: [PATCH v7 1/3] kallsyms: Match compressed tokens on the fly during binary search
From: Kees Cook
Date: Wed Sep 30 2026 - 02:26:44 EST
On Tue, Sep 29, 2026 at 12:07:30PM -0600, Jim Cromie via B4 Relay wrote:
> So we introduce kallsyms_strcmp_symbol() to compare ASCII search_name
> against tokenized symbols on the fly. Like strcmp, it tests the
> strings char by char, but when it hits a token in the symbol-string,
> it continues the char-test against that token-string, which is in
> kallsyms_token_table[]. It returns +- on 1st mismatch.
>
> Measured across all ~184k symbols via CONFIG_KALLSYMS_SELFTEST, this
> shaves ~530 ns (~14%) off average kallsyms_lookup_name() latency (from
> ~3810 ns to ~3280 ns on the default 256:1 baseline) and drops the
> 512-byte namebuf buffer stack-alloc in kallsyms_lookup_names().
>
> Signed-off-by: Jim Cromie <jim.cromie@xxxxxxxxx>
Reviewed-by: Kees Cook <kees@xxxxxxxxxx>
This is a nice win with no downside. :)
--
Kees Cook