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

Issue with check-endbr.sh during Xen build


  • To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Tue, 5 Jul 2022 13:56:39 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; 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=sF58efq28Kqz77hh5t3+w9/PYs/O0V/yxFSFpda/52s=; b=myCeGcA94n7aji3A5v6tv7WSkxbaeFkliVXtgL8Se+/o4h8iXlvoy4ylzYW4b/7/WL4Le9p2SKfeLNyNKdjyGOpuVsqcFPpp85/0ftVArbpFHh/4ZG/QhM743f5gOFMDWj0X6rWBYK9cz+zsxo1wdB6xW7NLh/qGUC7GmgrrvozPVpxAYwzJuuEruy1Mkxr1D5fviDrLTUGAelIRZpFBOV0nxHSNCz0EmKtmEMUFSy/JDqztxodSqbIouhc5dc3TXOU4Olwun6Rh4wK6g3WD0P6PyClKeYJxLR5g+DB51vak3NzdHStUwqPRkhwXdChgaK9aVww59PB/QhuZpC4imQ==
  • 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=sF58efq28Kqz77hh5t3+w9/PYs/O0V/yxFSFpda/52s=; b=XECkKj9Eltw7hdj/P06qqB0VRixw67biVAcg3UPNLciNiQ4TmEzFWZhaW3SN0Kw9n2ofS2TvsEMAnLg8yW2HnH6Qu70HYVsnVEy1ccjctaLoa7bTwEfdqldnfjkfPTPVXKlkso6GojOyZyDBbPG56yaw/+T1tqn1OKOinSBm9ECQQikFH/5N8zejDXlJzSMa++60LS3OxjnXpLzk88/owODIXq2kt5UYgzt+11GGgFrWP/CzthiI+miGQ+yMYac6Wf3RGKs9PT7fgqbNRI4BIyZRUFTsSAZ5yOqn5GxLXHFJIhNdqZl1CtZe2FGtoa6AabwJaC58nPT9H51jpiDgvw==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=bmiyuYlBPOhSoifMc8WoC9uzY7Orz4/K61/mVnVyZXtlSBqI25SKnHsvs4qmq8n57hygWZaJy1vXn/ZkjQ3whaAyOcRKVnXZMFhfynnh3F8g3t2Z8Fh1yIUfsHmbj8rizU/aJ3aZIpVezl7WgEkLtsbNCXW5FNdRCIIl/HnNPRcn80WRYCFXZ8O0W+cGFLvy/ewDbfmfNOU+58QKqKRMjWLOTaeZ+HbN7+eI5eOxxeCtbvj+9JzQxL1Vt4ADEHgXbNWyZTGsOlw7c0qVfdTxRHIKQxdc5wcWbnebPDHM4Emp7FwT/PxdPOP1CcJF//x1RSL9ifIk2NkqqMXuYvXPEw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E9tl0Qw28IJhf36kccuJ2tOkUla02JXjKqHDr4GsGRKpRBYQhWptynH5dZpuW90/03sGdXJs1WYIRYe/x+DPgGZGvfpUhkjA2MbWd8Cgrx78lN/cbJKaQpGrLHijfusl3u4jvQtdsr7VW/UbRrG43NUIRJETyNG4W34UljUlmPoB/+bokMSM2/tpceapoqJ8hAQ6Pir927+3h9Kqr+qNI7V4vMFcI7MsBvL+5wZyi4yOVTwuAoPHS8Vf850+Hm+3fM5cDVSueeldoGQv39HjGcFhgaGpy96QNUYBji8k9zdEC9eThbNh/JUDmMQEvo8R2aRgPChMR7hJ9q2afz/T4A==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 05 Jul 2022 13:56:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYkHcMKffnFiUSAU+E175V5Z5atg==
  • Thread-topic: Issue with check-endbr.sh during Xen build

Hi all,

I’ve encountered an issue building Xen for x86_64, basically the script 
check-endbr.sh was returning an error:
“Error: More valid-addrs than all-addrs”.

I have found a solution but I’m writing anyway to you to make you aware of the 
issue.

In my setup I’m using a docker container with base image from ubuntu:22.04, 
when I build from the container it
Is failing, instead when I’m building from my machine it is working fine.

So I’ve set -x in the script to trace it and I have this for my host machine 
(xen_x86-docker is just xen-syms):

$ ./xen/xen/tools/check-endbr.sh tmp_files/xen_x86-docker
+ MSG_PFX=check-endbr.sh xen_x86-docker
+ OBJCOPY=objcopy
+ OBJDUMP=objdump
+ ADDR2LINE=addr2line
+ mktemp -d
+ D=/tmp/tmp.3TmVp2idCm
+ trap rm -rf /tmp/tmp.3TmVp2idCm EXIT
+ TEXT_BIN=/tmp/tmp.3TmVp2idCm/xen-syms.text
+ VALID=/tmp/tmp.3TmVp2idCm/valid-addrs
+ ALL=/tmp/tmp.3TmVp2idCm/all-addrs
+ BAD=/tmp/tmp.3TmVp2idCm/bad-addrs
+ echo X
+ grep -aob X -q
+ perl_re=true
+ echo X
+ grep -aobP \x58 -q
+ objdump -j .text tmp_files/xen_x86-docker -d -w
+ grep  endbr64 *$
+ cut -f 1 -d :
+ objdump -j .text tmp_files/xen_x86-docker -h
+ awk $2 == ".text" {printf "vma_hi=%s\nvma_lo=%s\n", substr($4, 1, 8), 
substr($4, 9, 16)}
+ eval vma_hi=ffff82d0 vma_lo=40200000
+ vma_hi=ffff82d0 vma_lo=40200000
+ objcopy -j .text tmp_files/xen_x86-docker -O binary 
/tmp/tmp.3TmVp2idCm/xen-syms.text
+ true
+ LC_ALL=C grep -aobP \xf3\x0f\x1e(\xfa|\xfb)|\x66\x0f\x1f\x01 
/tmp/tmp.3TmVp2idCm/xen-syms.text
+ awk -F: {printf "%s%x\n", "ffff82d0", int(0x40200000) + $1}
+ wait
+ stat -c %s /tmp/tmp.3TmVp2idCm/valid-addrs
+ val_sz=24004
+ stat -c %s /tmp/tmp.3TmVp2idCm/all-addrs
+ all_sz=24004
+ [ 24004 -eq 0 ]
+ [ 24004 -eq 0 ]
+ [ 24004 -lt 24004 ]
+ sort /tmp/tmp.3TmVp2idCm/valid-addrs /tmp/tmp.3TmVp2idCm/all-addrs
+ uniq -u
+ wc -l
+ nr_bad=0
+ [ 0 -eq 0 ]
+ exit 0
+ rm -rf /tmp/tmp.3TmVp2idCm

And I have this from my docker container:

# ./xen/xen/tools/check-endbr.sh tmp_files/xen_x86-docker
+ MSG_PFX='check-endbr.sh xen_x86-docker'
+ OBJCOPY=objcopy
+ OBJDUMP=objdump
+ ADDR2LINE=addr2line
++ mktemp -d
+ D=/tmp/tmp.tR0Vt8l2ie
+ trap 'rm -rf /tmp/tmp.tR0Vt8l2ie' EXIT
+ TEXT_BIN=/tmp/tmp.tR0Vt8l2ie/xen-syms.text
+ VALID=/tmp/tmp.tR0Vt8l2ie/valid-addrs
+ ALL=/tmp/tmp.tR0Vt8l2ie/all-addrs
+ BAD=/tmp/tmp.tR0Vt8l2ie/bad-addrs
+ echo X
+ grep -aob X -q
+ perl_re=true
+ echo X
+ grep -aobP '\x58' -q
+ objdump -j .text tmp_files/xen_x86-docker -d -w
+ grep '        endbr64 *$'
+ cut -f 1 -d :
++ objdump -j .text tmp_files/xen_x86-docker -h
++ awk '$2 == ".text" {printf "vma_hi=%s\nvma_lo=%s\n", substr($4, 1, 8), 
substr($4, 9, 16)}'
+ eval vma_hi=ffff82d0 vma_lo=40200000
++ vma_hi=ffff82d0
++ vma_lo=40200000
+ objcopy -j .text tmp_files/xen_x86-docker -O binary 
/tmp/tmp.tR0Vt8l2ie/xen-syms.text
+ true
+ LC_ALL=C
+ grep -aobP '\xf3\x0f\x1e(\xfa|\xfb)|\x66\x0f\x1f\x01' 
/tmp/tmp.tR0Vt8l2ie/xen-syms.text
+ awk -F: '{printf "%s%x\n", "ffff82d0", int(0x40200000) + $1}'
+ wait
++ stat -c %s /tmp/tmp.tR0Vt8l2ie/valid-addrs
+ val_sz=24004
++ stat -c %s /tmp/tmp.tR0Vt8l2ie/all-addrs
+ all_sz=19686
+ '[' 24004 -eq 0 ']'
+ '[' 19686 -eq 0 ']'
+ '[' 19686 -lt 24004 ']'
+ echo 'check-endbr.sh xen_x86-docker Error: More valid-addrs than all-addrs'
check-endbr.sh xen_x86-docker Error: More valid-addrs than all-addrs
+ exit 1
+ rm -rf /tmp/tmp.tR0Vt8l2ie


After spending a bit of time to understand what the script does, I’ve checked 
the awk version
and seems that the script is failing in the Docker container because there is 
mawk there:
# awk -W version
mawk 1.3.4 20200120
Copyright 2008-2019,2020, Thomas E. Dickey
Copyright 1991-1996,2014, Michael D. Brennan

random-funcs:       srandom/random
regex-funcs:        internal
compiled limits:
sprintf buffer      8192
maximum-integer     2147483647

Instead in my host machine there is gawk:
$ awk -W version
GNU Awk 4.1.4, API: 1.1 (GNU MPFR 4.0.1, GNU MP 6.1.2)
[…]


So there seems to be a dependency on the interpreter (or at least it doesn’t 
work with that version of mawk).

My solution was to install gawk in the container and everything was working 
fine afterwards.

Cheers,
Luca




 


Rackspace

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