[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 0/2] tools/symbols: fix oversized names and token expansion
- To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Mykola Kvach <Mykola_Kvach@xxxxxxxx>
- Date: Mon, 16 Nov 2026 19:24:17 +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=Nw9wrOQdTHZ76IDcphyY/4sKgzOP6dXyZFGetDyAu8E=; b=FK6raDN7kQ9cAfF5i7RF/TYqSFgHQm61vSC8zXTptr7qt2Emu554rMhOFmJwsNjALkqS8osBIpZMdEq5QYJX7BmUzBj/09WvYpvO5E0Y2Tqy8qN88Bmof/WiSs5xcuuP0akYqYF/MyQpF0fZnZi2rSg4EescdyVnNXTVwfEAERe+uvQnkw1zZX+Zb5Bgp8e9GGOr5OC6kRSD3XZkPPvfqQqgiKBCldRJMpRw5PmHB/gV3kd7ORnVmOPLa1F2rOW1n4pgrcI5f6jIeFR9FFgnD9MgUn0jcAz87cZp6bJ0ciGgCz9oQAlatnDrTU9FcYsltymrNUALSctohp1aZRVYCA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vrCSfO7hYUDTnI+7GoajXSr0vZQMoF5A10CVEg1e36PRkj5rSVbs06QxprR+ia8SBL0quBlNK75fGs6VcNDngd4on9vUkmC7uiHieIrNRsrRtd67QxrLdRL3oArXDSK91IovYeW0aC1sm9L69ZocyS2slBUtppAnbBV0LqdgHKEuuNTH+SrRdI6uRTdSsOBarC/B1r+5wemoWKKtU4k2KCsLsAhv7GPyU3Lx1B7MZ29YAQw7hy8afzFGk5PNyBHMvtfj4pMCD3J7Wf9s5PfXsoDM0B0VDk7fDBJv0+AvTSuxWPDzRK5USdStB/7Dj38BteBR+Lq1OBDMHusNZ3oT9Q==
- 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>, Teddy Astie <teddy.astie@xxxxxxxxxx>
- Delivery-date: Mon, 16 Nov 2026 19:24:27 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHddgASYmrr0ohkDk+QiVyeCn9meg==
- Thread-topic: [PATCH v2 0/2] tools/symbols: fix oversized names and token expansion
Hi all,
This series fixes two buffer overflows in Xen's symbol handling.
Thanks to Jan for the review of v1.
Patch 1 makes KSYM_NAME_LEN include the terminating NUL, following
Linux's convention. The runtime lookup buffers stay at 128 bytes.
The token expansion buffer grows to 129 bytes to hold the type,
a 127-byte name and the NUL.
Patch 2 reports and skips names longer than 127 bytes in read_symbol(),
including the filename prefix added to local SYSV symbols. This avoids
generating a table that can overflow the runtime lookup buffers. A long
absolute source path caused this overflow during the boot self-tests
on an Orange Pi 5 debug build. Human-readable --xensyms maps keep names
longer than this limit.
Changes in v2:
- Reorder the patches so the name-length check uses the final
KSYM_NAME_LEN convention from the start.
- Patch 1 (v1 patch 2): make KSYM_NAME_LEN include the NUL and update
its users. The token buffer is KSYM_NAME_LEN + 1, with the extra byte
for the type, as discussed with Jan.
- Patch 2 (v1 patch 1): report and skip oversized names instead of
failing the build, and move the check to read_symbol(), as suggested
by Jan.
Testing:
- Built the host generator with GCC 15.2.0 and tested it under ASan/UBSan.
- Checked BSD and SYSV input at the 127/128-byte boundary, --xensyms,
--sort-by-name and --error-dup.
- Reproduced the token overflow with 64 identical 127-byte names of
type T; the fixed generator processes the same input without errors.
Best regards,
Mykola
Mykola Kvach (2):
symbols: make KSYM_NAME_LEN include the trailing NUL
tools/symbols: skip names exceeding the runtime limit
xen/arch/x86/platform_hypercall.c | 2 +-
xen/common/symbols.c | 6 +++---
xen/common/vsprintf.c | 2 +-
xen/include/xen/symbols.h | 3 ++-
xen/tools/symbols.c | 11 ++++++++++-
5 files changed, 17 insertions(+), 7 deletions(-)
--
2.53.0
|