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

Re: Build errors with fuzz/x86_instruction_emulator harness


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 14 Aug 2023 17:21:20 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=qMuCYPjsq/uoaxkV5cQCo+ZFI//TVApCj/i8xWKO1bg=; b=Ve/pGRqxRoISxlMex4q/7o+IQaQ22Fsj64c0PcORWvK0E/lPPRi5SHCIOllJjf1ipJP+Xr0de46DSzzPZvKwAFeJp3ga+r5kfnxtCed/HlFTleoXYy266kcun3U9Gy9MA9SpdO67pT1xUcSq+TJ1nRWITFASdC/uTlZW07isbZLNCCV8KaMZa7g0ddF3Ciq8N5iUwrAcxJIVTwdp/v8wtrKUxdfODe3wxjDD26LdKW5uOnAsmryNoMrnjju7ZYXFQFWp+crpwZ/qHWvFcZOMzpOmmlq9gsDaoOOmFBbMheyc8D8htPdJ0w0yj7KqtZwbdHfx6UmmDUXwJQv+OxC5gg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J2n9i/CIPa6pmBYhqOAAX69nPHhxKRmxQslOEtfW8RwjgZVYccoL6srnmOFhBX0htT5bjWogURNvmDSCUUOuiJTPfhN4ah3v1SKM8usGXBjHInqHa+cjBuooJM9UUSVTyJh8HHsFJC9LPBh4i8gbkK5C6+MtIcxVta/F9J2tXoR87lZEvOLh3VHXk6RUpwTg+6j2deo0sdtwAEOx2WYQzX3nXDkgfwbtwQGRTDUkbeu62pNGueqo25W3nHz+/FNL8Ja2vrBSQD/HITS2h6EBzAj/QHHncz73IFVg7AtavbhXmLlif6SsC/W65Mx0sun/W/ZNC5Q1OU8+KuEBPZwC5g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Mon, 14 Aug 2023 15:22:08 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.08.2023 16:52, Andrew Cooper wrote:
> See the attached log snippet.  This is current staging, with a GCC 13
> toolchain.
> 
> First of all, a minor issue.  Counting the number of
> `-D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__`'s, we
> have included CFLAGS on the CC line 4 times.  This is something that
> appears to be in common with all of tools/ and is probably the primary
> contributor to exceeding the Gitlab CI 4M log limit...
> 
> Next the error.  This doesn't build when CFLAGS coming in from the
> packaging environment include `-flto=auto`.
> 
> Clearly our wrapping trick doesn't work with LTO, but it's not obvious why.
> 
> readelf -Wa tools/fuzz/x86_instruction_emulator/wrappers.o | grep emul_
>   [223] .gnu.lto_emul_fwrite.38.43da3a7fd30cc0a1 PROGBITS       
> 0000000000000000 01c2ec 000194 00   E  0   0  1
>   [224] .gnu.lto_emul_memcmp.39.43da3a7fd30cc0a1 PROGBITS       
> 0000000000000000 01c480 0001a7 00   E  0   0  1
>   [225] .gnu.lto_emul_memcpy.40.43da3a7fd30cc0a1 PROGBITS       
> 0000000000000000 01c627 000175 00   E  0   0  1
>   [226] .gnu.lto_emul_memset.41.43da3a7fd30cc0a1 PROGBITS       
> 0000000000000000 01c79c 000186 00   E  0   0  1
>   [227] .gnu.lto_emul_printf.42.43da3a7fd30cc0a1 PROGBITS       
> 0000000000000000 01c922 0002cd 00   E  0   0  1
>   [228] .gnu.lto_emul_putchar.43.43da3a7fd30cc0a1 PROGBITS       
> 0000000000000000 01cbef 000216 00   E  0   0  1
>   [229] .gnu.lto_emul_puts.44.43da3a7fd30cc0a1 PROGBITS       
> 0000000000000000 01ce05 000180 00   E  0   0  1
> 
> shows that there's something relevant in the object file.

But only sections, no symbols. Doing a simple test with a trivial source
file, I observe that no actual code is emitted at all, and hence also no
symbols. Which means our trick - working entirely behind the back of the
compiler by inserting .equ in the assembly output - takes no effect on
our own sources. And really the errors in the log fragment you provided
all point back to standard library headers, where (just a guess)
something may be done that cause _some_ code to be emitted, for which
our overrides then take effect.

> Manual poking about in the build environment indicates that
> tools/tests/x86_instruction_emulator is similarly impacted.
> 
> Any ideas?
> 
> Obviously we can inhibit LTO for the x86_emul userspace, but that ought
> to be a last resort.

To get the build issue addressed, merely suppressing LTO for wrappers.o
may suffice (provided such mixing is permitted in the first place).
However, due to our overrides not taking effect (as per above) I can't
see how the resulting binaries then would work correctly.

Question therefore is whether we can find a way of effecting the needed
overrides (including for compiler generated calls) without resorting to
emitting .equ (or alike), and hence without doing it fully behind the
compiler's back.

Jan



 


Rackspace

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