|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 2/2] tools/symbols: skip names exceeding the runtime limit
Hi Jan,
On Tue, Dec 1, 2026 at 5:41 PM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>
> On 16.11.2026 20:24, Mykola Kvach wrote:
> > The runtime lookup buffers hold KSYM_NAME_LEN bytes (128), but the
> > generator accepts longer names. SYSV input prefixes local symbols
> > with their filename, so an absolute assembly source path can make a
> > name too long even when the symbol itself is short.
> >
> > On an Orange Pi 5 debug build this crashed Xen at boot: during the
> > test_symbols() constructor, symbols_lookup_by_name() expanded the
> > 145-byte name ending in mmu/head.S#identity_mapping_removed into a
> > 128-byte buffer, overwriting the saved frame pointer and return address.
> >
> > Report and skip names of KSYM_NAME_LEN bytes or more, as Linux does.
> > Check the complete name in read_symbol(), after adding the filename
> > prefix. Keep --xensyms maps complete: they are not loaded into Xen.
> >
> > Fixes: d37d63d4b548 ("symbols: prefix static symbols with their source file
> > names")
> > Assisted-by: Codex:GPT-6.1
> > Signed-off-by: Mykola Kvach <mykola_kvach@xxxxxxxx>
>
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
> with ...
>
> > --- a/xen/tools/symbols.c
> > +++ b/xen/tools/symbols.c
> > @@ -178,6 +178,14 @@ static int read_symbol(FILE *in, struct sym_entry *s)
> > *sym++ = '#';
> > }
> > strcpy(sym, str);
> > + /* Only the table loaded into Xen is limited, not --xensyms maps. */
> > + if (!map_only && s->len - 1 >= KSYM_NAME_LEN) {
> > + fprintf(stderr,
> > + "Ignoring symbol '%s': too long (%u bytes, maximum
> > %u)\n",
> > + SYMBOL_NAME(s), s->len - 1, KSYM_NAME_LEN - 1);
> > + free(s->sym);
> > + goto skip_tail;
> > + }
> > if (sort_by_name || map_only)
> > s->orig_symbol = strdup(SYMBOL_NAME(s));
> > s->type = stype; /* As s->sym[0] may end up mangled. */
>
> ... blank lines added before and after the code you add. Happy to do so
> while committing.
Thanks for the review. Sounds good to me.
Best regards,
Mykola
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |