From nobody Mon Nov 23 04:34:28 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792821186; cv=none; d=zohomail.com; s=zohoarc; b=jCFDWpYZUiHFJaiqmZrs6imWabsioh65U6lXyTOulAd6EshHL988ClsLHUyHsiciTqFtUFqvGmR/K5ETs5ThX5uyeN8wdWbSo8nf6nLDD7NiBccisz0ILncewaVl+8jtshsjAp0+lR6t/hCGrolVp4U44A/dF/w0m6vxrId0Wo4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792821186; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Pqf2OrQ1HcXnkJiM3BanGdDHyjWQfGQ64eMyeSn5Q+8=; b=HJ6Y4QM4GeBt2qKG4icATD9PGZxhgWpuEYCANR/rz+jXCNt6wtAnmE8l/L8Q4qsCOlMBea6Mf7GE2pDn0StuaOtihjjMvPs7PbUVlrxBrAKKWsPel9K68a93VBFdySdE8HAxTttD7cUyhhfUFmH4mwyrvwDV0E9y3JM84yL1Jr0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792821182652131.27802493067009; Fri, 23 Oct 2026 22:53:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xKUfs-0007Br-WC; Sat, 24 Oct 2026 01:52:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xKUfl-0007B7-KJ for qemu-devel@nongnu.org; Sat, 24 Oct 2026 01:52:06 -0400 Received: from isrv.corpit.ru ([212.248.84.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xKUfi-0002k9-Md for qemu-devel@nongnu.org; Sat, 24 Oct 2026 01:52:05 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id D7E9D1E0975; Sat, 24 Oct 2026 08:51:57 +0300 (MSK) Received: from [192.168.177.130] (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with ESMTP id CB187449AEC; Sat, 24 Oct 2026 08:51:57 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tls.msk.ru; s=202602; t=1792821117; bh=KHAyM9NCoeJvdlm1NZrUUY5fDEGS6cRceGmriqDQDEI=; h=Date:To:Cc:From:Subject; b=J3bURhhmu70bsda5Wz5ILwF6j6IM9j1xM3qjVl5OwLjYpLDjh3nU9eusyLI+GN4eP imNEsykUtBtFddJ8zh8kpHjABl3BJhOeiThOGiCI/ADVAL6a5LdVZqNL1ejc/uNbCc kT9VA/GGQfe/Jq+JFRr1ZPGbjO/p2aM7hw8LKLMGpDPzfko2/h5XaZ596xp52LfR9w b28UAKsD+xpb5NR8iw/EK+fO9pNaFZLGXXs6rlbpjjQ5U+Yl5i4tOPF3eI3WKnMReC 3ZcOlwqD+pPInjc1/w4D6EkHRcoaKmyXgx9GMlfnN7oT9JW68OqnU2V5t8oKHfPK2c hcptfdKNxXatw== Message-ID: Date: Sat, 24 Oct 2026 08:51:57 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US, ru-RU To: qemu-devel Cc: Richard Henderson From: Michael Tokarev Subject: linux-user/vdso: reproducible? Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=212.248.84.144; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @tls.msk.ru) X-ZM-MESSAGEID: 1792821199981158500 Hi! Once again I'm trying to fix a long-standing issue in debian & ubuntu with vdso files build. One of the requirements here is to build everything from source, ensuring the things can be rebuild and are reproducible (that is, the shipped binari= es can actually be produced from the provided source and not something else with a hidden backdoor). It'd be nice to just build the vdso.so files during regular package build. But this does not work correctly neither in debian nor in ubuntu infrastruc= ture due to several reasons. The main problem is that to build all vdso files, one need to have cross-compilers for all architectures on every host architecture for which qemu-user packages are produced, which is problematic (especially for lower-power, or "small", architectures). Additionally, llvm/clang, which can produce binaries for multiple architect= ures and is available on all host architectures on debian, does not handle sh4 a= nd hpps which are currently needed to rebuild vdso files in qemu, so it is also not an option, at least not yet (sh4 support hopefully will be available so= on). I'm using tricks to build vdso files on one architecture and use the result when building linux-user packages on all architectures. But this does not work correctly neither in debian nor in ubuntu. An alternative is to actually use the binaries provided in qemu source tarball. However in order to do that, I have to actually verify if the binaries are produced from the actual source shipped with these binaries. It doesn't seem to be a difficult task because of the similicity of the sources - it is a simple assembler-language file which - in theory - should be trivially reproducible. However, when I build a vdso file locally with the same compiler options and compare it with the binary shipped with qemu, I see this: linux-user/aarch64 $ diffoscope vdso-be.so* 2026-10-23 18:59:46 E: diffoscope.comparators.elf: Command '['objdump --lin= e-numbers --disassemble --demangle --reloc --no-show-raw-insn=20 --section=3D.text {}']' returned non-zero exit status 1. 2026-10-23 18:59:46 E: diffoscope.comparators.elf: Command '['objdump --dis= assemble --demangle --no-show-raw-insn --section=3D.text {}']' returned=20 non-zero exit status 1. --- vdso-be.so +++ vdso-be.so.mjt =E2=94=9C=E2=94=80=E2=94=80 readelf --wide --symbols {} =E2=94=82 @@ -19,15 +19,15 @@ =E2=94=82 6: 0000000000000380 0 SECTION LOCAL DEFAULT 6 .gnu.= hash =E2=94=82 7: 00000000000003b8 0 SECTION LOCAL DEFAULT 7 .dyns= tr =E2=94=82 8: 0000000000000430 0 SECTION LOCAL DEFAULT 8 .gnu.= version =E2=94=82 9: 0000000000000440 0 SECTION LOCAL DEFAULT 9 .gnu.= version_d =E2=94=82 10: 0000000000000478 0 SECTION LOCAL DEFAULT 10 .eh_f= rame_hdr =E2=94=82 11: 0000000000000490 0 SECTION LOCAL DEFAULT 11 .eh_f= rame =E2=94=82 12: 00000000000004b8 0 SECTION LOCAL DEFAULT 12 .text =E2=94=82 - 13: 0000000000000000 0 FILE LOCAL DEFAULT ABS cc0Lc= fxq.o =E2=94=82 + 13: 0000000000000000 0 FILE LOCAL DEFAULT ABS ccuck= KYd.o =E2=94=82 14: 0000000000000158 0 NOTYPE LOCAL DEFAULT 1 $d =E2=94=82 15: 00000000000004b8 0 NOTYPE LOCAL DEFAULT 12 $x =E2=94=82 16: 00000000000004f0 0 NOTYPE LOCAL DEFAULT 12 sigre= turn_region_start =E2=94=82 17: 00000000000004f4 0 NOTYPE LOCAL DEFAULT 12 sigre= turn_region_end =E2=94=82 18: 00000000000004a4 0 NOTYPE LOCAL DEFAULT 11 $d =E2=94=82 19: 0000000000000000 0 FILE LOCAL DEFAULT ABS =E2=94=82 20: 00000000000001a0 0 OBJECT LOCAL DEFAULT ABS _DYNA= MIC =E2=94=9C=E2=94=80=E2=94=80 strings --all --bytes=3D8 {} =E2=94=82 @@ -1,14 +1,14 @@ =E2=94=82 __kernel_gettimeofday =E2=94=82 __kernel_clock_gettime =E2=94=82 __kernel_clock_getres =E2=94=82 __kernel_rt_sigreturn =E2=94=82 linux-vdso.so.1 =E2=94=82 LINUX_2.6.39 =E2=94=82 -cc0Lcfxq.o =E2=94=82 +ccuckKYd.o =E2=94=82 sigreturn_region_start =E2=94=82 sigreturn_region_end =E2=94=82 _DYNAMIC =E2=94=82 __GNU_EH_FRAME_HDR =E2=94=82 _GLOBAL_OFFSET_TABLE_ =E2=94=82 LINUX_2.6.39 =E2=94=82 __kernel_clock_getres =E2=94=9C=E2=94=80=E2=94=80 readelf --wide --decompress --hex-dump=3D.strta= b {} =E2=94=82 @@ -1,10 +1,10 @@ =E2=94=82 =E2=94=82 Hex dump of section '.strtab': =E2=94=82 - 0x00000000 00636330 4c636678 712e6f00 24640024 .cc0Lcfxq.o.$d.$ =E2=94=82 + 0x00000000 00636375 636b4b59 642e6f00 24640024 .ccuckKYd.o.$d.$ =E2=94=82 0x00000010 78007369 67726574 75726e5f 72656769 x.sigreturn_regi =E2=94=82 0x00000020 6f6e5f73 74617274 00736967 72657475 on_start.sigretu =E2=94=82 0x00000030 726e5f72 6567696f 6e5f656e 64005f44 rn_region_end._D =E2=94=82 0x00000040 594e414d 4943005f 5f474e55 5f45485f YNAMIC.__GNU_EH_ =E2=94=82 0x00000050 4652414d 455f4844 52005f47 4c4f4241 FRAME_HDR._GLOBA =E2=94=82 0x00000060 4c5f4f46 46534554 5f544142 4c455f00 L_OFFSET_TABLE_. =E2=94=82 0x00000070 4c494e55 585f322e 362e3339 005f5f6b LINUX_2.6.39.__k So basically, the difference is just in the temporary .o filename used during the build process, and that name is random. After stripping both files from debug info (aarch64-linux-gnu-strip), things becomes exactly the same. Can't we strip them during build anyway? (I'm not an expert with these reproducible build thing, maybe they have more ways to handle differences like this, and maybe more suggestions to further improve the situation besides stripping - asked them too). It's interesting that adding -s switch to gcc produces slightly different binary than not using -s and stripping after the link explicitly. linux-user/aarch64$ diffoscope --tool-prefix-binutils=3Daarch64-linux-gnu- = vdso-be.so* 2026-10-23 19:06:01 E: diffoscope.comparators.elf: Command '['objdump --lin= e-numbers --disassemble --demangle --reloc --no-show-raw-insn=20 --section=3D.text {}']' returned non-zero exit status 1. 2026-10-23 19:06:01 E: diffoscope.comparators.elf: Command '['objdump --dis= assemble --demangle --no-show-raw-insn --section=3D.text {}']' returned=20 non-zero exit status 1. --- vdso-be.so +++ vdso-be.so.mjt =E2=94=82=E2=94=84 xxd not available in path. Falling back to Python hexlif= y. =E2=94=82=E2=94=84 Format-specific differences are supported for ELF binari= es but no file-specific differences were detected; falling back to a binary= diff. file(1)=20 reports: ELF 64-bit MSB shared object, ARM aarch64, version 1 (SYSV), dynam= ically linked, BuildID[sha1]=3Dba5dd46a2ef8dde79536f81dd8126e0ee2f3df39, st= ripped @@ -6,15 +6,15 @@ 00000000000004f40000000000001000000000020000000400000000000001a0 00000000000001a000000000000001a000000000000001000000000000000100 00000000000000086474e5500000000400000000000004780000000000000478 0000000000000478000000000000001400000000000000140000000000000004 0000000400000004000000000000015800000000000001580000000000000158 0000000000000044000000000000004400000000000000080000000400000010 00000005474e5500c00000000000000400000003000000000000000400000014 -00000003474e5500ba5dd46a2ef8dde79536f81dd8126e0ee2f3df3900000000 +00000003474e550047654bef50c6d25c99110c67c0eddb8e67b78bab00000000 000000000000000e000000000000005a00000000000000040000000000000350 000000006ffffef50000000000000380000000000000000500000000000003b8 000000000000000600000000000002a0000000000000000a0000000000000077 000000000000000b0000000000000018000000006ffffffc0000000000000440 000000006ffffffd0000000000000002000000006ffffff00000000000000430 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 So, can we at least strip the files? Something like this (for all files): diff --git a/linux-user/aarch64/Makefile.vdso b/linux-user/aarch64/Makefile= .vdso index 82ed2011087..e5655888eb4 100644 --- a/linux-user/aarch64/Makefile.vdso +++ b/linux-user/aarch64/Makefile.vdso @@ -10,7 +10,9 @@ LDFLAGS =3D -nostdlib -shared -Wl,-h,linux-vdso.so.1 \ -Wl,-z,max-page-size=3D4096 -Wl,-T,$(SUBDIR)/vdso.ld $(SUBDIR)/vdso-be.so: vdso.S vdso.ld - $(CC) -o $@ $(LDFLAGS) -mbig-endian $< + $(CC) -o $@.tmp $(LDFLAGS) -mbig-endian $< + $(STRIP) $@.tmp && mv -f $@.tmp $@ $(SUBDIR)/vdso-le.so: vdso.S vdso.ld - $(CC) -o $@ $(LDFLAGS) -mlittle-endian $< + $(CC) -o $@.tmp $(LDFLAGS) -mlittle-endian $< + $(STRIP) $@.tmp && mv -f $@.tmp $@ Or maybe we can use something else to make this "more reproducible". Thanks, /mjt