[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 2/2] tools/symbols: skip names exceeding the runtime limit


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Mykola Kvach <Mykola_Kvach@xxxxxxxx>
  • Date: Mon, 16 Nov 2026 19:24:38 +0000
  • Accept-language: en-US, uk-UA
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=J2gxiEEpuuT+ze5mDTwwNf8zgj7+LHEBsAKJPicWPBc=; b=hJbOLp7/aJ6TMee6KrGdej+iAdv0p65hmtMHji8403AAu7bfJQAXbdqqH6n+mIqd6/I+JqdXagPgPx8XCOUdPUmrseG55eBxALSX5Qzs+b1bnTUYiBBF1rHdtZLfUImQArUQasNqD6JZ006+MAWdyysiMPVBsf11/fiBpEFmVmTRrEdRF5U/UgyUs9OUwXHmakjbAs74CLs9fuA29HoNT/fOULw4Gz5l4MDZAhNAxWObHZz0lqsfasixQS0G1NHfXuYDUbS8gXYEQVBDWLqVBJxdHU6K4hQqKq2hp3wehjel7iRHyfwbpilw79fpkQmL/ouKRtFiY/49gqncKlX0bw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=I94j+n9GZaih/42kiGr3/qUQ3og80Fd/HeGBnr9EsxtlIM3obYj0Tw+EFZWP4yCmYhVP+qb9B74YLD4lkKjQopV8jeN8hPr1Cp65tlnXbEdsSTzkwicPjl+QlFbtZE1eTxV3NDhYGSJ4E8qFpSw80PfX8liGlZ4BFZBUJhQzxWoxe2IwP8UBuE633SdQpLAD6xTTERIGkzyKvtogmMRtlLpyYWwuhw+P79XbHFPg1V9GTUYsZ/Y6EptiQbelMSPzIgjJHvgZ5IoyJDp60DcFdi8B+3UDce5jteFyBOY/xSi6Tn7FE5O7HXoToZwgMDmpttsCsSxKUf/oyykEPOAW4w==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Mon, 16 Nov 2026 19:24:41 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHddgAf4/QhwuDeUkK131GKYPgPzA==
  • Thread-topic: [PATCH v2 2/2] tools/symbols: skip names exceeding the runtime limit

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>
---
Changes in v2:
- Previously patch 1; move it after the KSYM_NAME_LEN conversion.
- Report and skip oversized names instead of failing the build (Jan).
- Move the check from build_initial_tok_table() to read_symbol(), after
  adding the filename prefix (Jan).
- Use the NUL-inclusive KSYM_NAME_LEN in the check and diagnostic.

 xen/tools/symbols.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/tools/symbols.c b/xen/tools/symbols.c
index 14a045f098..860e9d9224 100644
--- 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. */
-- 
2.53.0

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.