From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 291E1C02192 for ; Mon, 3 Feb 2025 13:55:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 751DB280002; Mon, 3 Feb 2025 08:55:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 701A0280001; Mon, 3 Feb 2025 08:55:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C977280002; Mon, 3 Feb 2025 08:55:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 3FB21280001 for ; Mon, 3 Feb 2025 08:55:55 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 1E26316190D for ; Mon, 3 Feb 2025 13:50:24 +0000 (UTC) X-FDA: 83078768010.28.826CF82 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf12.hostedemail.com (Postfix) with ESMTP id 006AE40004 for ; Mon, 3 Feb 2025 13:50:21 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=YPpXSpjZ; dkim=pass header.d=linutronix.de header.s=2020e header.b=zpOBiFzq; spf=pass (imf12.hostedemail.com: domain of t-8ch@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=t-8ch@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1738590622; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ZQrfcOY2FHWEyibchfnDOta6mFsV+KBdbtmBdSk0oiU=; b=SiANDGH7zJrgs3Anl4W4yMDRvlaMwS5AvkTZbz71+UqyQzTIkg92nV3wFYAUm9WR2kx/kS W+RLfNWVGdND2WZs0RtItGdohnR6pfNqTh00sVyPqzlcKh61j29ETJ6gOh0I3l5pUUCoCm UsFuGifGD7Fp5hlH3+L/Y62yiPQJZHQ= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=YPpXSpjZ; dkim=pass header.d=linutronix.de header.s=2020e header.b=zpOBiFzq; spf=pass (imf12.hostedemail.com: domain of t-8ch@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=t-8ch@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738590622; a=rsa-sha256; cv=none; b=QUx3SsMXytcQuodWaDK/JKkppKTmy2d+W1RAolQps0jeOLHICHTJbjfcgQbZ365/jU+lS9 SpcAtN/qOzy6/BTihWK5hSM4oYuIGMi/eBHQ+nUeeqkzqQhtMkaLLLm7zC8FOjqBe7nZMz 97NZg1lvGIYZ6VxXE5ZAU3ePj6jz6qI= Date: Mon, 3 Feb 2025 14:50:16 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1738590618; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZQrfcOY2FHWEyibchfnDOta6mFsV+KBdbtmBdSk0oiU=; b=YPpXSpjZ0wzBy4i8ZEGZe/u1qrkNxIslNFF/UDtZTHdW0VLlZT5yRwiaAXsn/twnpPhfSp ZGnL5wODQkps5Jjcja0NMEDmdPrr8M2E6S1bkQ/i/YbxQ0AkIdTIUK2jnucFNUUg1eArsU Bk8j13Vusd2XQHjUG6DaahEBrQ/RdklJuQlVfb1Jz8jlSg6N8kzk7ovAHBfrZSm871ejTs z7+PnSuYLQNsKdEcyJXSinH2tZ/lylpVUkI0M8kZVPZZe57W9UlPml9zY4pW5l5N/1l199 iWeimxH0IFa0nl6Ds3kBhPShEcYqFdpHUmqpzEuCrJ+pwUjuNFTX4FiJ3hiX2w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1738590618; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZQrfcOY2FHWEyibchfnDOta6mFsV+KBdbtmBdSk0oiU=; b=zpOBiFzqOW/f8piH0OJQXhdrOuRqtzwchGmFzVAfGVF4jCmrbXF//XpS3g+xALDkpSvFsV HS3pxrQy5AuuvFBA== From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Christophe Leroy Cc: Kees Cook , Eric Biederman , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH 00/16] selftests: vDSO: parse_vdso: Make compatible with nolibc Message-ID: <20250203143640-70c59c53-af45-40cb-9a52-6395b3fdd263@linutronix.de> References: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 006AE40004 X-Stat-Signature: pyyh99h86h9k51ntxdym85e4acopffre X-Rspam-User: X-HE-Tag: 1738590621-519144 X-HE-Me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6KoOzYx8q+z+Ndw/LBckMZ+ZxbfLuHWqvaYdFDdGz0DXExX2ypvbkaexhqJy/jedRr3Irde6UYI+UilcRhOQ5jE6obYUYP4Twa8kZVLqUpf+5AifLtc7L8+EthhM6CWeXcF6+jMFSy/SlS2S/dk5/2anIyxOF664UZi2Lj3y2t2MgWLfzwuAQ9oNQGbdoZdOukE8n3DDJkmlbrpC408mC73tvi9ViYNXB/VPNJONCbEdI5XXuiP9YEFXSifieAa4PHh9AcvHZxIHLiPbwoNmqqdW2jx88Hw/slylfRwCnuf01TXYZQLINhAEdmVCHqX/WRN+4c2DEEJdPkT7Il5lDZ4O0DpDTLHusAWpZgEMRO8P/NN6rrhJ/jhcpY/wT+ot0yU2AcevCZPNO2KfevZ+N9Y25haLW1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Mon, Feb 03, 2025 at 12:23:29PM +0100, Christophe Leroy wrote: > Le 03/02/2025 à 10:05, Thomas Weißschuh a écrit : > > For testing the functionality of the vDSO, it is necessary to build > > userspace programs for multiple different architectures. > > It is additional work to acquire matching userspace cross-compilers with > > full C libraries and then building root images out of those. > > The kernel tree already contains nolibc, a small, header-only C library. > > By using it, it is possible to build userspace programs without any > > additional dependencies. > > For example the kernel.org crosstools or multi-target clang can be used > > to build test programs for a multitude of architectures. > > While nolibc is very limited, it is enough for many selftests. > > With some minor adjustments it is possible to make parse_vdso.c > > compatible with nolibc. > > As an example, vdso_standalone_test_x86 is now built from the same C > > code as the regular vdso_test_gettimeofday, while still being completely > > standalone. > > > > This should probably go through the kselftest tree. > > Not sure what are the expectations with this series. In general it should also work for PPC, thanks for testing it. > I gave it a try with vdso_test_gettimeofday and get the following: > > $ powerpc64-linux-gcc -nostdlib -nostdinc -ffreestanding > -fno-asynchronous-unwind-tables -fno-stack-protector -include /home/chleroy/linux-powerpc/tools/testing/selftests/../../../tools/include/nolibc/nolibc.h -I/home/chleroy/linux-powerpc/tools/testing/selftests/../../../tools/include/nolibc/ > -isystem > /home/chleroy/linux-powerpc/tools/testing/selftests/../../../usr/include > -std=gnu99 -O2 -D_GNU_SOURCE= -isystem /home/chleroy/linux-powerpc/tools/testing/selftests/../../../tools/include/uapi > vdso_test_gettimeofday.c parse_vdso.c -o /home/chleroy/linux-powerpc/tools/testing/selftests/vDSO/vdso_test_gettimeofday > > make: Entering directory > '/home/chleroy/linux-powerpc/tools/testing/selftests/vDSO' > powerpc64-linux-gcc -nostdlib -nostdinc -ffreestanding > -fno-asynchronous-unwind-tables -fno-stack-protector -include /home/chleroy/linux-powerpc/tools/testing/selftests/../../../tools/include/nolibc/nolibc.h -I/home/chleroy/linux-powerpc/tools/testing/selftests/../../../tools/include/nolibc/ > -isystem > /home/chleroy/linux-powerpc/tools/testing/selftests/../../../usr/include > -std=gnu99 -O2 -D_GNU_SOURCE= -isystem /home/chleroy/linux-powerpc/tools/testing/selftests/../../../tools/include/uapi > vdso_test_gettimeofday.c parse_vdso.c -o /home/chleroy/linux-powerpc/tools/testing/selftests/vDSO/vdso_test_gettimeofday This log is confusing. It contains traces of "make" output but no "make" invocation. I'm also not sure if there were two different compilations or only one. Can you give the full commandline? For your testing it should be enough to enable "vdso_test_standalone_x86" in the Makefile for PPC. > parse_vdso.c:38:34: error: unknown type name 'Elf64_Versym' > 38 | #define ELF_BITS_XFORM2(bits, x) Elf##bits##_##x > | ^~~ > parse_vdso.c:39:33: note: in expansion of macro 'ELF_BITS_XFORM2' > 39 | #define ELF_BITS_XFORM(bits, x) ELF_BITS_XFORM2(bits, x) > | ^~~~~~~~~~~~~~~ > parse_vdso.c:40:16: note: in expansion of macro 'ELF_BITS_XFORM' > 40 | #define ELF(x) ELF_BITS_XFORM(ELF_BITS, x) > | ^~~~~~~~~~~~~~ > parse_vdso.c:63:9: note: in expansion of macro 'ELF' > 63 | ELF(Versym) *versym; > | ^~~ > parse_vdso.c:38:34: error: unknown type name 'Elf64_Verdef' > 38 | #define ELF_BITS_XFORM2(bits, x) Elf##bits##_##x > | ^~~ > parse_vdso.c:39:33: note: in expansion of macro 'ELF_BITS_XFORM2' > 39 | #define ELF_BITS_XFORM(bits, x) ELF_BITS_XFORM2(bits, x) > | ^~~~~~~~~~~~~~~ > parse_vdso.c:40:16: note: in expansion of macro 'ELF_BITS_XFORM' > 40 | #define ELF(x) ELF_BITS_XFORM(ELF_BITS, x) > | ^~~~~~~~~~~~~~ > parse_vdso.c:64:9: note: in expansion of macro 'ELF' > 64 | ELF(Verdef) *verdef; > | ^~~ > parse_vdso.c: In function 'vdso_init_from_sysinfo_ehdr': > parse_vdso.c:38:34: error: 'Elf64_Versym' undeclared (first use in this > function); did you mean 'Elf64_Sym'? > 38 | #define ELF_BITS_XFORM2(bits, x) Elf##bits##_##x > | ^~~ > parse_vdso.c:39:33: note: in expansion of macro 'ELF_BITS_XFORM2' > 39 | #define ELF_BITS_XFORM(bits, x) ELF_BITS_XFORM2(bits, x) > | ^~~~~~~~~~~~~~~ > parse_vdso.c:40:16: note: in expansion of macro 'ELF_BITS_XFORM' > 40 | #define ELF(x) ELF_BITS_XFORM(ELF_BITS, x) > | ^~~~~~~~~~~~~~ > parse_vdso.c:150:45: note: in expansion of macro 'ELF' > 150 | vdso_info.versym = (ELF(Versym) *) > | ^~~ > parse_vdso.c:38:34: note: each undeclared identifier is reported only once > for each function it appears in > 38 | #define ELF_BITS_XFORM2(bits, x) Elf##bits##_##x > | ^~~ > parse_vdso.c:39:33: note: in expansion of macro 'ELF_BITS_XFORM2' > 39 | #define ELF_BITS_XFORM(bits, x) ELF_BITS_XFORM2(bits, x) > | ^~~~~~~~~~~~~~~ > parse_vdso.c:40:16: note: in expansion of macro 'ELF_BITS_XFORM' > 40 | #define ELF(x) ELF_BITS_XFORM(ELF_BITS, x) > | ^~~~~~~~~~~~~~ > parse_vdso.c:150:45: note: in expansion of macro 'ELF' > 150 | vdso_info.versym = (ELF(Versym) *) > | ^~~ > parse_vdso.c:150:58: error: expected expression before ')' token > 150 | vdso_info.versym = (ELF(Versym) *) > | ^ > parse_vdso.c:38:34: error: 'Elf64_Verdef' undeclared (first use in this > function); did you mean 'Elf64_Word'? > 38 | #define ELF_BITS_XFORM2(bits, x) Elf##bits##_##x > | ^~~ > parse_vdso.c:39:33: note: in expansion of macro 'ELF_BITS_XFORM2' > 39 | #define ELF_BITS_XFORM(bits, x) ELF_BITS_XFORM2(bits, x) > | ^~~~~~~~~~~~~~~ > parse_vdso.c:40:16: note: in expansion of macro 'ELF_BITS_XFORM' > 40 | #define ELF(x) ELF_BITS_XFORM(ELF_BITS, x) > | ^~~~~~~~~~~~~~ > parse_vdso.c:155:45: note: in expansion of macro 'ELF' > 155 | vdso_info.verdef = (ELF(Verdef) *) > | ^~~ > parse_vdso.c:155:58: error: expected expression before ')' token > 155 | vdso_info.verdef = (ELF(Verdef) *) > | ^ > parse_vdso.c: At top level: > parse_vdso.c:38:34: error: unknown type name 'Elf64_Versym'; did you mean > 'Elf64_Sym'? > 38 | #define ELF_BITS_XFORM2(bits, x) Elf##bits##_##x > | ^~~ > parse_vdso.c:39:33: note: in expansion of macro 'ELF_BITS_XFORM2' > 39 | #define ELF_BITS_XFORM(bits, x) ELF_BITS_XFORM2(bits, x) > | ^~~~~~~~~~~~~~~ > parse_vdso.c:40:16: note: in expansion of macro 'ELF_BITS_XFORM' > 40 | #define ELF(x) ELF_BITS_XFORM(ELF_BITS, x) > | ^~~~~~~~~~~~~~ > parse_vdso.c:177:32: note: in expansion of macro 'ELF' > 177 | static bool vdso_match_version(ELF(Versym) ver, > | ^~~ > parse_vdso.c: In function 'vdso_sym': > parse_vdso.c:224:25: error: 'STN_UNDEF' undeclared (first use in this > function); did you mean 'SHN_UNDEF'? > 224 | for (; chain != STN_UNDEF; chain = vdso_info.chain[chain]) { > | ^~~~~~~~~ > | SHN_UNDEF > parse_vdso.c:240:25: warning: implicit declaration of function > 'vdso_match_version' [-Wimplicit-function-declaration] > 240 | && !vdso_match_version(vdso_info.versym[chain], > | ^~~~~~~~~~~~~~~~~~ > make: *** [../lib.mk:222: /home/chleroy/linux-powerpc/tools/testing/selftests/vDSO/vdso_test_gettimeofday] > Error 1 > make: Leaving directory > '/home/chleroy/linux-powerpc/tools/testing/selftests/vDSO' > > Christophe > > > > > Signed-off-by: Thomas Weißschuh > > --- > > Thomas Weißschuh (16): > > MAINTAINERS: Add vDSO selftests > > elf, uapi: Add definition for STN_UNDEF > > elf, uapi: Add definition for DT_GNU_HASH > > elf, uapi: Add definitions for VER_FLG_BASE and VER_FLG_WEAK > > elf, uapi: Add type ElfXX_Versym > > elf, uapi: Add types ElfXX_Verdef and ElfXX_Veraux > > tools/include: Add uapi/linux/elf.h > > selftests: Add headers target > > selftests: vDSO: vdso_standalone_test_x86: Use vdso_init_form_sysinfo_ehdr > > selftests: vDSO: parse_vdso: Drop vdso_init_from_auxv() > > selftests: vDSO: parse_vdso: Use UAPI headers instead of libc headers > > selftests: vDSO: parse_vdso: Test __SIZEOF_LONG__ instead of ULONG_MAX > > selftests: vDSO: parse_vdso: Make compatible with nolibc > > selftests: vDSO: vdso_test_gettimeofday: Clean up includes > > selftests: vDSO: vdso_test_gettimeofday: Make compatible with nolibc > > selftests: vDSO: vdso_standalone_test_x86: Switch to nolibc > > > > MAINTAINERS | 1 + > > include/uapi/linux/elf.h | 38 ++ > > tools/include/uapi/linux/elf.h | 524 +++++++++++++++++++++ > > tools/testing/selftests/lib.mk | 5 +- > > tools/testing/selftests/vDSO/Makefile | 11 +- > > tools/testing/selftests/vDSO/parse_vdso.c | 21 +- > > tools/testing/selftests/vDSO/parse_vdso.h | 1 - > > .../selftests/vDSO/vdso_standalone_test_x86.c | 143 +----- > > .../selftests/vDSO/vdso_test_gettimeofday.c | 4 +- > > 9 files changed, 584 insertions(+), 164 deletions(-) > > --- > > base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b > > change-id: 20241017-parse_vdso-nolibc-e069baa7ff48 > > > > Best regards, >