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

Re: [PATCH] symbols: discard stray file symbols


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 21 Oct 2025 10:56:28 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=q6Rf6PVv7a2t+qr29NjigOfDiFIdJWfUU2V1r+0wO38=; b=vl55A6+50Fti/ElxQat23RljlSbfURcyGilm1ZeMGRd9vsb4Mk7QamkcW6FzRWyPFfe0vFFQCXupcayAJOXNI1uVX15yEx+2gg1z/ADSQ6dI1VWv/CSmMlOR8C3JkPSNqWvXYW4Y0usd0IyvuEer+0Gw2XZQTgTslv+q7KeW83+Qe6itPtM6Vd1JFHRWrGVjJ0uUTMOafhBomt+v9nsyICPwVOG/wj/uDITqXdwvT+o/AoCdLAFLFjJRDD2eBTeMIIs7boArXPh+NKPXx5sFNFXtxeCYykqGR9XvvC5J0ZqaeM2vhGMF44NdTioWdzhaalBDi3zQS/vuU8226dfTHA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bQf5vRR7BBJUcxELEbjWDWuI4zmALUDZRpX7EQ/w2tu5lqbdSlG9A8u/bfW8xSKlYjBr74TlmCiWtMAH2kVrB0LGl+Rmeemxz2ZDQbHO+YbwYV+2ogDyud1rSFVZHfZvxxqHqPMLRz1/HcvdAeGQ7wy/rpMnhbBJf9DowK8EVD66/ss1tSmk3J15XfsZyGxM0lww2ekLJvwEzHjiOkYwGo+7hv3kYobxtE2tEf3FdwFIN6ybkO8Bk69LVx5nbgckfKljECQMK+dMA5F7nXB3RNR5r0VwFejUI5pmq81wzMQZjRaiH8MfypZHKqM/UQmDHlriopGxY1oqZUhm+Lkseg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
  • Delivery-date: Tue, 21 Oct 2025 09:56:45 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Apr 16, 2025 at 11:00:57AM +0200, Jan Beulich wrote:
> By observation GNU ld 2.25 may emit file symbols for .data.read_mostly
> when linking xen.efi. Due to the nature of file symbols in COFF symbol
> tables (see the code comment) the symbols_offsets[] entries for such
> symbols would cause assembler warnings regarding value truncation. Of
> course the resulting entries would also be both meaningless and useless.
> Add a heuristic to get rid of them, really taking effect only when
> --all-symbols is specified (otherwise these symbols are discarded
> anyway).
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

> ---
> Factor 2 may in principle still be too small: We zap what looks like
> real file symbols already in read_symbol(), so table_cnt doesn't really
> reflect the number of symbol table entries encountered. It has proven to
> work for me in practice though, with still some leeway left.
> 
> --- a/xen/tools/symbols.c
> +++ b/xen/tools/symbols.c
> @@ -213,6 +213,16 @@ static int symbol_valid(struct sym_entry
>       if (strstr((char *)s->sym + offset, "_compiled."))
>               return 0;
>  
> +     /* At least GNU ld 2.25 may emit bogus file symbols referencing a
> +      * section name while linking xen.efi. In COFF symbol tables the
> +      * "value" of file symbols is a link (symbol table index) to the next
> +      * file symbol. Since file (and other) symbols (can) come with one
> +      * (or in principle more) auxiliary symbol table entries, the value in
> +      * this heuristic is bounded to twice the number of symbols we have
> +      * found. See also read_symbol() as to the '?' checked for here. */
> +     if (s->sym[0] == '?' && s->sym[1] == '.' && s->addr < table_cnt * 2)

Maybe a naive question, but couldn't you drop everything below
__XEN_VIRT_START, as we shouldn't have any symbols below that
address?

Thanks, Roger.



 


Rackspace

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