From patchwork Mon Feb 3 09:05:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13957082 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 841CD35966; Mon, 3 Feb 2025 09:05:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573522; cv=none; b=QrY3WhCaHLFfPEyI835BkPCWmrck6IWguqLZgGTbopYBrvUK4hWT9+WR7maBhUgsSu2ZloCCBkAPpSsU7J3+MZBeBrBPdnfA09/pPITt0JcBNTyVzvsKt0MJeekfWYVWzo348z0Zzqb8DyHjskK6g7cwmqQPT5TCTkHHQqbkg/E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573522; c=relaxed/simple; bh=s3dkTBDXdzo+I16hjaEXfC4T5xD6NlAF4J47urRaCBo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qfeKn3Ok/LIcWHKlmx+qxu4ABsxEMomixjA8c7tD90pqw9lr+JCvoKB81VQ49IKQTIAzWvV7BuBemz3aFRW95MP3QQmtgn7xHZbXOXAu9CarQfbwTdNvHijYlTFmhe4gGNkbrID0cgLRegUHzeMfjTBA3f8fUT9/c/T7b+uE6X8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=zoNsH168; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=dQiCh/Sg; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="zoNsH168"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="dQiCh/Sg" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1738573518; 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=Mc60C8g9Fb1tmdPaCWjP2wsKb3/BHTAaOKy7dD4Q/9Y=; b=zoNsH1681N9Eilu+jpmlrd6H67exHHx840NRersYZZonixk2yo38qyL4oJzXRTX0CCBhDg 8qsZAYQm+27bS/AWWuprXH5VXYiVwLmJRJJm5sQFRsASggh6N2yOkwuh8Nnkr9MJlVh6qv VDp3mT/vLL3kFYuWN2aEdEmvGKgu5MpkjwUirsu7Ip2cnGxCazy9Q9qscaaFlaIGwr0FXT xTMnIlYR/hBkXE5BB+Eezd2gm1xSrB27mHjk0qTbd8hhNVTu94zx/3WsojVY1B/GaPPPxm 8oZjn5V6ifOvI6aWVXB8FtsceC7rNdVDMh+6WIMSQYQQN5nI0UbD183zqGlMDw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1738573518; 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=Mc60C8g9Fb1tmdPaCWjP2wsKb3/BHTAaOKy7dD4Q/9Y=; b=dQiCh/SgsPSRfDY6f/63PUhuYw/gLJsoDUfFCeBf7DmsRsV3NxAs/BfNh8PSR2PukMip5g G0WGODwQHG6PlNAA== Date: Mon, 03 Feb 2025 10:05:02 +0100 Subject: [PATCH 01/16] MAINTAINERS: Add vDSO selftests Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250203-parse_vdso-nolibc-v1-1-9cb6268d77be@linutronix.de> References: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> In-Reply-To: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> To: Kees Cook , Eric Biederman , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev, =?utf-8?q?Thomas_We?= =?utf-8?q?i=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1738573516; l=675; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=s3dkTBDXdzo+I16hjaEXfC4T5xD6NlAF4J47urRaCBo=; b=uYr9YEYfr4f5M2OlWjkTyacCJaqcjW8RwNjmPn99DBIa+vugRIRyNAt3CNSRblw+rHiZsR9YQ JnikGKZzAkFByb1eYxgRSoAJV30as8oY0tGYFXPa57Za4PGFtNNzWww X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= These currently have no maintainer besides the default kselftest ones. Add the general vDSO maintainers, too. Signed-off-by: Thomas Weißschuh --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 896a307fa06545e2861abe46ea7029f9b4d3628e..959c8a86844eb1e5c6218e8fdbde6c3ebf68e25d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9777,6 +9777,7 @@ F: include/asm-generic/vdso/vsyscall.h F: include/vdso/ F: kernel/time/vsyscall.c F: lib/vdso/ +F: tools/testing/selftests/vDSO/ GENWQE (IBM Generic Workqueue Card) M: Frank Haverkamp From patchwork Mon Feb 3 09:05:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13957083 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0365137932; Mon, 3 Feb 2025 09:05:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573522; cv=none; b=FysnNOO8bhyEACT4s4LyESv3zGPBL1XVf78W8ly6ng9SPuMv//XryM0ilTg9XiXuGbe+Wf6qGXfCxxZv+xsB+TFQEHzNrpYHRgbgrCNGzRMTbHNGuLs5tG3benVn2ys72fu41qfYB1qaqaNedzMHpz0VGKBcL2KHOXZwlpflXcg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573522; c=relaxed/simple; bh=FEaofIv+JUjjywiT6rS3O3D+OYARr4o4oDpoALKMPN0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tgt7bHpKOJNE939MJbY/sC6u6AwH3bWa5oLqNlQ7YIT7/Xqu4wCyZfTBpa+AAIWWwdiJFAYnpq7AHIUkEmmQ6wR/qtjUOd+cf4PaN75I9CkLZjs4Bw90V3PVS9S5WtRVuOrGqJY9iZkiPDytu8m10ZmRiJp9HoCM7sSYvbRBsPw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=3DWraR5V; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=LyOYwDg0; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="3DWraR5V"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="LyOYwDg0" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1738573519; 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=AqxvCmKG6a1x16hCjSThnsvuCnWxl1ds6KfWld3LsEI=; b=3DWraR5VL+9WHCcpWsJXy2P1Q24o82I0qjNBzIt9UikDP9RupiPDfU3dDc5C56/15JbM02 0/ODqp9vKX/deI0nUddGy0kI8ppPkcBsTHXoWM+FA+NV9IHhLlJk8zxDxNKFoUePmzTjvs ADvkS6GYonpLMgc4AsiMy4JlGfV+980qTyDm7KH3Ostxuml9JvWdeJ7NPDQEsJ5zv26nNp AD/uAb5Ca240xw6nfI0HsaTL8gm+3q1zTQbGx6lvqokEdEWdotjw9X8PY+WyQzNkpjLiDL Vc9e+dGqpNpM8EGWqWBHDGknzxVBbkx/D19go5Aml3dNibCagRXBb5lieeHecA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1738573519; 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=AqxvCmKG6a1x16hCjSThnsvuCnWxl1ds6KfWld3LsEI=; b=LyOYwDg0LcHjS4/3ejV510LsGVoFmPJ6cGGkE89Y6+lkjACch3UTwqaZdXpj2OuuMKnMLP kWzGO4vlbw6Q+jAg== Date: Mon, 03 Feb 2025 10:05:03 +0100 Subject: [PATCH 02/16] elf, uapi: Add definition for STN_UNDEF Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250203-parse_vdso-nolibc-v1-2-9cb6268d77be@linutronix.de> References: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> In-Reply-To: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> To: Kees Cook , Eric Biederman , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev, =?utf-8?q?Thomas_We?= =?utf-8?q?i=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1738573516; l=843; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=FEaofIv+JUjjywiT6rS3O3D+OYARr4o4oDpoALKMPN0=; b=6ap2E9pgBsF576nuzERSuthuwPkpinZdzn7NrB2VMb8kF8mXyyC+nPYOF8sHjgDC2J9KoaRAf yZYknsg9hz/Ay2rTTwdv3RYKMqDBf0baUssvsDbVjtBgdT9ts+wWDNr X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The definition is used by tools/testing/selftests/vDSO/parse_vdso.c. To be able to build the vDSO selftests without a libc dependency, add the definition to the kernels own UAPI headers. Link: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.symtab.html Signed-off-by: Thomas Weißschuh Reviewed-by: Kees Cook --- include/uapi/linux/elf.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h index b44069d29cecc0f9de90ee66bfffd2137f4275a8..448695c7364042b10682acc8223eb6053ad039dd 100644 --- a/include/uapi/linux/elf.h +++ b/include/uapi/linux/elf.h @@ -125,6 +125,8 @@ typedef __s64 Elf64_Sxword; #define STB_GLOBAL 1 #define STB_WEAK 2 +#define STN_UNDEF 0 + #define STT_NOTYPE 0 #define STT_OBJECT 1 #define STT_FUNC 2 From patchwork Mon Feb 3 09:05:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13957084 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A801A1BEF81; Mon, 3 Feb 2025 09:05:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573523; cv=none; b=ld/GiET477J2lcMmSBKxTQlqLNzZRw+/6nOBVV7wkXZavKi/jZ2po5iSMSWSo1nT6WaQK2vZze5FiNgHq5ZHDgbdNGfCesX/WZ4BzxDO3qgEJECIQqSwKHwIe4gjg7iMv6thmuVK7QQm1L+PQZfkLyW8uq+tMLd95j/ZUsCZbwU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573523; c=relaxed/simple; bh=JMbHB1Br8Acow0wMqe/kiUZgwM90Yb9A1GSnA5w9I4Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=D/d+7rdMNMfILQW8vlYYhwVZhNp51QYEL6/NWFsU/zU4QKozmyoe2C/xylHQfOfx6Eco8kAiXU3C1oUhtz0BNOUr6NtCOfUGFxLN1awyJ5Hpbcs/IhA0ZSwMeYC1f5Q0FsMzOA4qwHtl/Kk/4YvJnfsia0jI/bKYRYmP39EPbbU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=k77wwMju; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=3tjLF0Z6; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="k77wwMju"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="3tjLF0Z6" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1738573520; 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=J10i+JysPn/nrLdo5+XVJ5ePDiKPIoG49q3quxXjJvY=; b=k77wwMjuAYR3dfbz3vFjH0KLOHF7f+LP9plYpwf5GOdYCn+/saWY8VE7p5PPpkwvX48XfY Fzb8wzqnz1vxL/5Lkrwi5h6rLnxh8k26/IB5L4kQxQ4vf5JS0MrC2yZdsmY8A4Y2Wjyfjj ujABq+fsaGVUaD4JUH7WGzQZG5GHG9uFcBG3IzlOlbwe+XaODD0Ow+7qCaAGf+iCSViOi6 c27rh0qnBYMmjeAFTlW9ewIo0exWPsgHnNpQxhpzrnLOWlRcLqxZQXmineDBhmBwP1gJPS 6CgFdnl2rg5c572QjTFxVXsUgirz6gckNEz/VFXiB2vj1gsuHwJUqDzLYtQ3lQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1738573520; 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=J10i+JysPn/nrLdo5+XVJ5ePDiKPIoG49q3quxXjJvY=; b=3tjLF0Z6MOe6akUAJnTAJ+YeRh62eDgsNp1wdU/3GuKyz1vj5HyjSdJRmkKMN4CKqwLs06 l852tUDYjE+Lc5CA== Date: Mon, 03 Feb 2025 10:05:04 +0100 Subject: [PATCH 03/16] elf, uapi: Add definition for DT_GNU_HASH Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250203-parse_vdso-nolibc-v1-3-9cb6268d77be@linutronix.de> References: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> In-Reply-To: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> To: Kees Cook , Eric Biederman , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev, =?utf-8?q?Thomas_We?= =?utf-8?q?i=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1738573516; l=950; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=JMbHB1Br8Acow0wMqe/kiUZgwM90Yb9A1GSnA5w9I4Y=; b=h9BewK+FPT7QjjWxsuCY/mWK5QSeZBXsIegBdR0AGQ21P9tdaeW6ZkiP1NJ25/4kSh6yJZZO8 u93+1EXhA4bBD8fHAwKWvP/Myb4L+wr2P8ZqrfpF1WlpQe1DynvD327 X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The definition is used by tools/testing/selftests/vDSO/parse_vdso.c. To be able to build the vDSO selftests without a libc dependency, add the define to the kernels own UAPI headers. Link: https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/libc-ddefs.html Signed-off-by: Thomas Weißschuh Reviewed-by: Kees Cook --- include/uapi/linux/elf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h index 448695c7364042b10682acc8223eb6053ad039dd..c5383cc7bb13c931fea083de5243c4006f795006 100644 --- a/include/uapi/linux/elf.h +++ b/include/uapi/linux/elf.h @@ -107,6 +107,7 @@ typedef __s64 Elf64_Sxword; #define DT_VALRNGLO 0x6ffffd00 #define DT_VALRNGHI 0x6ffffdff #define DT_ADDRRNGLO 0x6ffffe00 +#define DT_GNU_HASH 0x6ffffef5 #define DT_ADDRRNGHI 0x6ffffeff #define DT_VERSYM 0x6ffffff0 #define DT_RELACOUNT 0x6ffffff9 From patchwork Mon Feb 3 09:05:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13957085 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46EFD1F3FC6; Mon, 3 Feb 2025 09:05:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573523; cv=none; b=N1XN5Bdog6xQXz/djSsz9DvKlqCBOFD9pj0ujeBGDmF/dgh/0AXiquU/imhxMarxWeWlSoXn1eFJzKxLbbONlVzKB7VoOsghfgNzHF3Hff/rpNMAigOI0Z4s6iL3xq4loYgiA7PpnjVNVpWYKENj+l1ZiDonMY9C9AvnKetmRgY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573523; c=relaxed/simple; bh=qvBznUpLU05pMIiidsZrHxM0XCMJ36Udyt/zDIm3nn4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UmypWf5UrSbm0965Mfw+PG2EOpa477ZPZpSdtfs+qMdGMYKLsfLoGO/3JletVXH2gwT3Yat8HuWdBMQljpPybVpvFsBKXwsv1fQLH/9tc6BBhEa64NjDn7vkxu1brkklu9y1L5llu8Pw8TWY1GYoI4EX9eHIXLv90MIsJL7krwg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=yGkuMvym; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Sjm68L9e; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="yGkuMvym"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Sjm68L9e" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1738573520; 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=28tf5lio+l75NgUgMkp1DazjisfzJIKMC2UwGQGfUyM=; b=yGkuMvymA01j+y2mo89y77NSpuStn+bRcHQ3bkpoWSL3HgdXmyi0t0YxEOwXVx8zMaFFqb QuT7HvSRxNAc9xwxtiOrKuqLoysP8WvW/V9DkFmO3V6rdGahxcx1rfc2Hx4xV6JPazmQJS EmbhDBDNWHE75uzzOJGGMtxDS2lCMhb63Em926JFnUgAXJSYkueTfJZ1U3VE3MgmxzGDEV zPkuP3A8bM8Ctux1JdIfvTkJNzTnsljZ9tspamGh3aAqqGoJ8mSLbXrG1wWzJLUjnsBDk+ NtxpQVjBWW+LloYH4IUQuSaVWT0Bod4eQQolUfkEhK5QzQjObymN6CmMAv6gsg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1738573520; 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=28tf5lio+l75NgUgMkp1DazjisfzJIKMC2UwGQGfUyM=; b=Sjm68L9eF/hUNa0nEAY0tzxfUbxDZYE1MUiD5Fk9SLOck/3PWCN3jpbY/bUS8SI5YVUbGF hCRi9fuEHqdq35BQ== Date: Mon, 03 Feb 2025 10:05:05 +0100 Subject: [PATCH 04/16] elf, uapi: Add definitions for VER_FLG_BASE and VER_FLG_WEAK Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250203-parse_vdso-nolibc-v1-4-9cb6268d77be@linutronix.de> References: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> In-Reply-To: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> To: Kees Cook , Eric Biederman , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev, =?utf-8?q?Thomas_We?= =?utf-8?q?i=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1738573516; l=934; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=qvBznUpLU05pMIiidsZrHxM0XCMJ36Udyt/zDIm3nn4=; b=N8EPe4SWUVakAB+4BPyrhp+oOoSFOcjUMNsXcY5d4XdoEUO4bPdfxTJ6W5cfbOZaySJ6omt62 ytTq7NtvGNkCW12u5RjsjBz7GO8xJJU+SKCKOKILAq4iUyh2Aw1gKGd X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The definitions are used by tools/testing/selftests/vDSO/parse_vdso.c. To be able to build the vDSO selftests without a libc dependency, add the definitions to the kernels own UAPI headers. Link: https://docs.oracle.com/cd/E19683-01/816-1386/chapter6-80869/index.html Signed-off-by: Thomas Weißschuh Reviewed-by: Kees Cook --- include/uapi/linux/elf.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h index c5383cc7bb13c931fea083de5243c4006f795006..d040f12ff1c0ae3dde5c371c81d6089118fbe8ed 100644 --- a/include/uapi/linux/elf.h +++ b/include/uapi/linux/elf.h @@ -136,6 +136,9 @@ typedef __s64 Elf64_Sxword; #define STT_COMMON 5 #define STT_TLS 6 +#define VER_FLG_BASE 0x1 +#define VER_FLG_WEAK 0x2 + #define ELF_ST_BIND(x) ((x) >> 4) #define ELF_ST_TYPE(x) ((x) & 0xf) #define ELF32_ST_BIND(x) ELF_ST_BIND(x) From patchwork Mon Feb 3 09:05:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13957086 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44FBE1FECCA; Mon, 3 Feb 2025 09:05:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573525; cv=none; b=rxjIWvJwVH8OvJYTApbh39Q+oWBGB79cfCbECwrEUJsrAojOWeszh6L3tdhlatmn7MjNKquI/jS4ZcIya8UjAjda8WKULeAm/UjnSH5JBLomQrYoOet00ARFPetTNWxzUKtSmz4PW6XbAKDbAuTBQ9XND64D5aV1Lfm8E1OfDCo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573525; c=relaxed/simple; bh=b9REhQdfZN7ermQyFmhBpR4szMBhcomhygovm/zRZzk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iIk8emxApeRaoyHaOZxwysRMXQDgSDw97BI1RZIVswp1ATg1WKrff+oRTdB8t8BfmJ7LjpzUtkOD3RkfZ2V3E4bcNM+g9Im//wPtzLU6n4/6dzb9OHGlyXI6Cmr0BdxPEhgE3Lc36QSTx39RqBEdndI0g01UvP2P6+zCraBD9T8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ahqWUTH1; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=iLkT9eF5; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ahqWUTH1"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="iLkT9eF5" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1738573521; 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=EaCxvI0b2Du7t844lWGxhhHOksYb2s9PM20EB1Ag6YY=; b=ahqWUTH1Sc8yeVAgvNolQlD1lh5COZPQXex+lsdiNCCZYRKR0eR0RrgWcPP1i88usBmIID G1nTxkJco2H2rEV5I+aAUQBk/PNnSFKx9T77umK3k5sukG/GDr0yyrIC5dAP79W1OPNPrb uBOpUwxFmddQr98FlYo13DnndyU93IrqlagcUqf9wczjefaV/8SLg3KOAMScLGy6viaN0T bpgimSBsaZf4F8FRh7CSQaKeNrTcbZIVmZWJPCcGOWNaLxHIjCuJ/G4Uqgjd67lxwvsIQK 4afg+qqMacB+SLKQClFUpNP4LEF3Ak4/NnpGe0jTuT4RkTG1H8t7p5STQ3hkJA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1738573521; 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=EaCxvI0b2Du7t844lWGxhhHOksYb2s9PM20EB1Ag6YY=; b=iLkT9eF5N07qKx2fnA5B+0n8MMjRdQODVIGY+wQe9CAlBfrfTfSV8t7Hk/hSlcwTZjy8j4 eWdu4JTfpLB4PjBw== Date: Mon, 03 Feb 2025 10:05:06 +0100 Subject: [PATCH 05/16] elf, uapi: Add type ElfXX_Versym Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250203-parse_vdso-nolibc-v1-5-9cb6268d77be@linutronix.de> References: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> In-Reply-To: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> To: Kees Cook , Eric Biederman , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev, =?utf-8?q?Thomas_We?= =?utf-8?q?i=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1738573516; l=1084; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=b9REhQdfZN7ermQyFmhBpR4szMBhcomhygovm/zRZzk=; b=V3fBkX6D/VOzq/MH28Rw6LWLDJwi3SlZrsvSPOMj0VsnXePwATYfkMvVDWwnZ+jD3rCmfrHTm FiV8OABOHWaDwvwDA5QdqMNyJEuqlJN43gl/R2FtOIEV5WxmSyC/WVG X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The types are used by tools/testing/selftests/vDSO/parse_vdso.c. To be able to build the vDSO selftests without a libc dependency, add the types to the kernels own UAPI headers. As documented by elf(5). Signed-off-by: Thomas Weißschuh Reviewed-by: Kees Cook --- include/uapi/linux/elf.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h index d040f12ff1c0ae3dde5c371c81d6089118fbe8ed..8846fe03ca5b836c96aad1be6d8fb9daf3d4b1d9 100644 --- a/include/uapi/linux/elf.h +++ b/include/uapi/linux/elf.h @@ -11,6 +11,7 @@ typedef __u16 Elf32_Half; typedef __u32 Elf32_Off; typedef __s32 Elf32_Sword; typedef __u32 Elf32_Word; +typedef __u16 Elf32_Versym; /* 64-bit ELF base types. */ typedef __u64 Elf64_Addr; @@ -21,6 +22,7 @@ typedef __s32 Elf64_Sword; typedef __u32 Elf64_Word; typedef __u64 Elf64_Xword; typedef __s64 Elf64_Sxword; +typedef __u16 Elf64_Versym; /* These constants are for the segment types stored in the image headers */ #define PT_NULL 0 From patchwork Mon Feb 3 09:05:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13957087 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97B071FF1AF; Mon, 3 Feb 2025 09:05:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573525; cv=none; b=C/QlNINq2n0B3x9cq+7V+s/KG21OCZ2cjP7a7b/i+G5S77N0zKj1+6vgktHuSEkSy613nXl4hd7hEZk3A83BKbKJi3tr2uhyEG1cv5a/MoQe9TLcCdIB21peGJnNnD86aQ50D10tSMybTEFR02QblZv4YUzFXFwHEcczRJE6zJk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573525; c=relaxed/simple; bh=FHjDFl0GoKn6nit/F9ipB8685b6fIBNR9d7/04YuOok=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=e8YcWWHjZbCv6lfRLDE8vdDwaFoLEH+wk0smj1BWZf+AK28Vd+MEd+SEJrnwf38iPgn1DR2ybhVMV2pjuUJrE3YUekPPvnbcFS8YARQ4gZozIvAr4Q5uw4Ne4ChYEGKJO7FEhappTQwqKT3rKs003VbhbqmBJMaRL+R12UX2EKk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=xGfx6yHi; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=94Z1dN2Q; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="xGfx6yHi"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="94Z1dN2Q" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1738573521; 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=VgSqTSk81su0MmtqYLownOdk49YkaFaYXYtHKJAxgm0=; b=xGfx6yHi7iZ3B50wSZNmDCxhoV3oerxbIl2ErFtWav52FPiddPhdhOciwkBMntgQhFximk yCTtzX4GgCWDIveJ8PZwLnNjl+aHmyPZkm0NlVbCpBf/zHfydpWcYv0XL5iSmTX9AgagXw LrEKVjWPLp/43xACs1aooe450j/1mUODTSBUMhqhA7Zf/a5xga8zhWb2EILAtQZEx/8s38 tFDUV2IDZ7dnXovL/3Qb/b6mCfnYNuLvG6ZTyMwvwC6NXeett0g/jCSBF3kB7rDL2ohhQl wKx6cgKzFN6dIOYFSEFug1EGJ4lt4oq2zS/yHOdm0gqeuht2HOa6Et91Az97Zw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1738573521; 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=VgSqTSk81su0MmtqYLownOdk49YkaFaYXYtHKJAxgm0=; b=94Z1dN2QIVLYeT7X8BukIFB1pvRBZ6naLClEBvXDwYwMHCHp2L4vY5GaF9jAJcIOiwyVCt YeoqYPpzVKYwMnCQ== Date: Mon, 03 Feb 2025 10:05:07 +0100 Subject: [PATCH 06/16] elf, uapi: Add types ElfXX_Verdef and ElfXX_Veraux Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250203-parse_vdso-nolibc-v1-6-9cb6268d77be@linutronix.de> References: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> In-Reply-To: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> To: Kees Cook , Eric Biederman , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev, =?utf-8?q?Thomas_We?= =?utf-8?q?i=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1738573516; l=1518; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=FHjDFl0GoKn6nit/F9ipB8685b6fIBNR9d7/04YuOok=; b=K34MIkI7ABRtpHTTzHhgAEtIuBVWA3OhksDhhthQLvZ5GSkDTjSWJ4guUs3+fffHpJGidwdBJ pKjCcN1XSZwCXzYW1BHvHOTiY17D9qpTzV9/nm9rj5CRqcZetbWcppf X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The types are used by tools/testing/selftests/vDSO/parse_vdso.c. To be able to build the vDSO selftests without a libc dependency, add the types to the kernels own UAPI headers. Link: https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/symversion.html#VERDEFEXTS Signed-off-by: Thomas Weißschuh Reviewed-by: Kees Cook --- include/uapi/linux/elf.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h index 8846fe03ca5b836c96aad1be6d8fb9daf3d4b1d9..49f9f90458d8ca8e7b8f823d32be0a719ff827b3 100644 --- a/include/uapi/linux/elf.h +++ b/include/uapi/linux/elf.h @@ -491,4 +491,34 @@ typedef struct elf64_note { /* Bits for GNU_PROPERTY_AARCH64_FEATURE_1_BTI */ #define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1U << 0) +typedef struct { + Elf32_Half vd_version; + Elf32_Half vd_flags; + Elf32_Half vd_ndx; + Elf32_Half vd_cnt; + Elf32_Word vd_hash; + Elf32_Word vd_aux; + Elf32_Word vd_next; +} Elf32_Verdef; + +typedef struct { + Elf64_Half vd_version; + Elf64_Half vd_flags; + Elf64_Half vd_ndx; + Elf64_Half vd_cnt; + Elf64_Word vd_hash; + Elf64_Word vd_aux; + Elf64_Word vd_next; +} Elf64_Verdef; + +typedef struct { + Elf32_Word vda_name; + Elf32_Word vda_next; +} Elf32_Verdaux; + +typedef struct { + Elf64_Word vda_name; + Elf64_Word vda_next; +} Elf64_Verdaux; + #endif /* _UAPI_LINUX_ELF_H */ From patchwork Mon Feb 3 09:05:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13957090 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFF3D1FF1C6; Mon, 3 Feb 2025 09:05:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573527; cv=none; b=hkcCuk9aZIoK/pDHbro1htbhNNFlwj9C4xrEIszPHabBx9RMDns2IHmAfqalWzq0M05eJXGgojfy373UZ5qvf7/9FvNHXSmtXXsBsCSt2hI08LgFOST6MwqHOezKgNW2myJqv8KT1314/y82co1Kh+Yq5x7bF2KWW3xztEN9L+w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573527; c=relaxed/simple; bh=5wSxSpPLrEhh+gEr44hMdOh4WtecZqa6aJNR6ugfHyA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=p22mbQ9YlWFoFUwxd2iAjau5r3+gFtD9vAUmMBaBdmwA4xlk7R3jweXtiH3mvz2Yn8n+mwV7xxe7H7xT1tFxhTNWqku9hLOa91AVv8PmMMT/80CSwAvH3lUNkOJ5A2jvc5JegrASleqr3fFvHArCo54zgiGqQlHWDrsZkvRIGwQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=pQFe4RYt; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Mqwvnx2y; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="pQFe4RYt"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Mqwvnx2y" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1738573522; 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=Sg4NMO0TZ19i20OrdzLqOif4PPEkfQYWtb9RkA9dHw4=; b=pQFe4RYtkli/7L/8nvrlxC65xZGHS7tv3o88G1Z23eHMo/j1gIotacrJYBPTF1O7CMwCak 7RTDxSd0+NlO2ueeK3SwvJg13f4nhZLytDd9OnzMVnYlhzQQQuBFUBc5WqWICFYOsTnpTr FjRxEFu4OMepbT5he3J6LwYr4M6vjCENcYY6VMc4c76Ix5+TFMqGkxm/dR+TInk3tfmv3h U02h8fBbguqipmck8GhKAEtzH47kCGfIGt3Q05Uw5IwdAT9Ojtupwv+9FnWlWhbqUMQt4f 8StVIyhuAYmjqQ1JRQRE1gZCokmCTzPD2jwNeHCso4Riqh1BFI62QaZv5UJp1Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1738573522; 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=Sg4NMO0TZ19i20OrdzLqOif4PPEkfQYWtb9RkA9dHw4=; b=Mqwvnx2yMYpGhhlC29uf7giTftCEuooFsZcxy75rKQBUYBXCrVO/twyW8D54coDwMGB0H2 /6mooRKR1hAkgaDQ== Date: Mon, 03 Feb 2025 10:05:08 +0100 Subject: [PATCH 07/16] tools/include: Add uapi/linux/elf.h Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250203-parse_vdso-nolibc-v1-7-9cb6268d77be@linutronix.de> References: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> In-Reply-To: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> To: Kees Cook , Eric Biederman , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev, =?utf-8?q?Thomas_We?= =?utf-8?q?i=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1738573516; l=18079; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=5wSxSpPLrEhh+gEr44hMdOh4WtecZqa6aJNR6ugfHyA=; b=aRQjkfiw/cFniPpVWqeKIcc3FHuRsfG+Ye1S7Y1XUo/L8L2N9dfCbBbaxknMjwZ66lb6x0HcN Sf1qFoUYmIADefrX2NkbUTjF9sSmpdDuyBajf0E+UeYFQjAELbr1YNQ X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= It will be used by the vDSO selftests. Signed-off-by: Thomas Weißschuh --- tools/include/uapi/linux/elf.h | 524 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 524 insertions(+) diff --git a/tools/include/uapi/linux/elf.h b/tools/include/uapi/linux/elf.h new file mode 100644 index 0000000000000000000000000000000000000000..3d0935a11613bbcf8c381188de3a10bafd6cc29f --- /dev/null +++ b/tools/include/uapi/linux/elf.h @@ -0,0 +1,524 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _LINUX_ELF_H +#define _LINUX_ELF_H + +#include +#include + +/* 32-bit ELF base types. */ +typedef __u32 Elf32_Addr; +typedef __u16 Elf32_Half; +typedef __u32 Elf32_Off; +typedef __s32 Elf32_Sword; +typedef __u32 Elf32_Word; +typedef __u16 Elf32_Versym; + +/* 64-bit ELF base types. */ +typedef __u64 Elf64_Addr; +typedef __u16 Elf64_Half; +typedef __s16 Elf64_SHalf; +typedef __u64 Elf64_Off; +typedef __s32 Elf64_Sword; +typedef __u32 Elf64_Word; +typedef __u64 Elf64_Xword; +typedef __s64 Elf64_Sxword; +typedef __u16 Elf64_Versym; + +/* These constants are for the segment types stored in the image headers */ +#define PT_NULL 0 +#define PT_LOAD 1 +#define PT_DYNAMIC 2 +#define PT_INTERP 3 +#define PT_NOTE 4 +#define PT_SHLIB 5 +#define PT_PHDR 6 +#define PT_TLS 7 /* Thread local storage segment */ +#define PT_LOOS 0x60000000 /* OS-specific */ +#define PT_HIOS 0x6fffffff /* OS-specific */ +#define PT_LOPROC 0x70000000 +#define PT_HIPROC 0x7fffffff +#define PT_GNU_EH_FRAME (PT_LOOS + 0x474e550) +#define PT_GNU_STACK (PT_LOOS + 0x474e551) +#define PT_GNU_RELRO (PT_LOOS + 0x474e552) +#define PT_GNU_PROPERTY (PT_LOOS + 0x474e553) + + +/* ARM MTE memory tag segment type */ +#define PT_AARCH64_MEMTAG_MTE (PT_LOPROC + 0x2) + +/* + * Extended Numbering + * + * If the real number of program header table entries is larger than + * or equal to PN_XNUM(0xffff), it is set to sh_info field of the + * section header at index 0, and PN_XNUM is set to e_phnum + * field. Otherwise, the section header at index 0 is zero + * initialized, if it exists. + * + * Specifications are available in: + * + * - Oracle: Linker and Libraries. + * Part No: 817–1984–19, August 2011. + * https://docs.oracle.com/cd/E18752_01/pdf/817-1984.pdf + * + * - System V ABI AMD64 Architecture Processor Supplement + * Draft Version 0.99.4, + * January 13, 2010. + * http://www.cs.washington.edu/education/courses/cse351/12wi/supp-docs/abi.pdf + */ +#define PN_XNUM 0xffff + +/* These constants define the different elf file types */ +#define ET_NONE 0 +#define ET_REL 1 +#define ET_EXEC 2 +#define ET_DYN 3 +#define ET_CORE 4 +#define ET_LOPROC 0xff00 +#define ET_HIPROC 0xffff + +/* This is the info that is needed to parse the dynamic section of the file */ +#define DT_NULL 0 +#define DT_NEEDED 1 +#define DT_PLTRELSZ 2 +#define DT_PLTGOT 3 +#define DT_HASH 4 +#define DT_STRTAB 5 +#define DT_SYMTAB 6 +#define DT_RELA 7 +#define DT_RELASZ 8 +#define DT_RELAENT 9 +#define DT_STRSZ 10 +#define DT_SYMENT 11 +#define DT_INIT 12 +#define DT_FINI 13 +#define DT_SONAME 14 +#define DT_RPATH 15 +#define DT_SYMBOLIC 16 +#define DT_REL 17 +#define DT_RELSZ 18 +#define DT_RELENT 19 +#define DT_PLTREL 20 +#define DT_DEBUG 21 +#define DT_TEXTREL 22 +#define DT_JMPREL 23 +#define DT_ENCODING 32 +#define OLD_DT_LOOS 0x60000000 +#define DT_LOOS 0x6000000d +#define DT_HIOS 0x6ffff000 +#define DT_VALRNGLO 0x6ffffd00 +#define DT_VALRNGHI 0x6ffffdff +#define DT_ADDRRNGLO 0x6ffffe00 +#define DT_GNU_HASH 0x6ffffef5 +#define DT_ADDRRNGHI 0x6ffffeff +#define DT_VERSYM 0x6ffffff0 +#define DT_RELACOUNT 0x6ffffff9 +#define DT_RELCOUNT 0x6ffffffa +#define DT_FLAGS_1 0x6ffffffb +#define DT_VERDEF 0x6ffffffc +#define DT_VERDEFNUM 0x6ffffffd +#define DT_VERNEED 0x6ffffffe +#define DT_VERNEEDNUM 0x6fffffff +#define OLD_DT_HIOS 0x6fffffff +#define DT_LOPROC 0x70000000 +#define DT_HIPROC 0x7fffffff + +/* This info is needed when parsing the symbol table */ +#define STB_LOCAL 0 +#define STB_GLOBAL 1 +#define STB_WEAK 2 + +#define STN_UNDEF 0 + +#define STT_NOTYPE 0 +#define STT_OBJECT 1 +#define STT_FUNC 2 +#define STT_SECTION 3 +#define STT_FILE 4 +#define STT_COMMON 5 +#define STT_TLS 6 + +#define VER_FLG_BASE 0x1 +#define VER_FLG_WEAK 0x2 + +#define ELF_ST_BIND(x) ((x) >> 4) +#define ELF_ST_TYPE(x) ((x) & 0xf) +#define ELF32_ST_BIND(x) ELF_ST_BIND(x) +#define ELF32_ST_TYPE(x) ELF_ST_TYPE(x) +#define ELF64_ST_BIND(x) ELF_ST_BIND(x) +#define ELF64_ST_TYPE(x) ELF_ST_TYPE(x) + +typedef struct { + Elf32_Sword d_tag; + union { + Elf32_Sword d_val; + Elf32_Addr d_ptr; + } d_un; +} Elf32_Dyn; + +typedef struct { + Elf64_Sxword d_tag; /* entry tag value */ + union { + Elf64_Xword d_val; + Elf64_Addr d_ptr; + } d_un; +} Elf64_Dyn; + +/* The following are used with relocations */ +#define ELF32_R_SYM(x) ((x) >> 8) +#define ELF32_R_TYPE(x) ((x) & 0xff) + +#define ELF64_R_SYM(i) ((i) >> 32) +#define ELF64_R_TYPE(i) ((i) & 0xffffffff) + +typedef struct elf32_rel { + Elf32_Addr r_offset; + Elf32_Word r_info; +} Elf32_Rel; + +typedef struct elf64_rel { + Elf64_Addr r_offset; /* Location at which to apply the action */ + Elf64_Xword r_info; /* index and type of relocation */ +} Elf64_Rel; + +typedef struct elf32_rela { + Elf32_Addr r_offset; + Elf32_Word r_info; + Elf32_Sword r_addend; +} Elf32_Rela; + +typedef struct elf64_rela { + Elf64_Addr r_offset; /* Location at which to apply the action */ + Elf64_Xword r_info; /* index and type of relocation */ + Elf64_Sxword r_addend; /* Constant addend used to compute value */ +} Elf64_Rela; + +typedef struct elf32_sym { + Elf32_Word st_name; + Elf32_Addr st_value; + Elf32_Word st_size; + unsigned char st_info; + unsigned char st_other; + Elf32_Half st_shndx; +} Elf32_Sym; + +typedef struct elf64_sym { + Elf64_Word st_name; /* Symbol name, index in string tbl */ + unsigned char st_info; /* Type and binding attributes */ + unsigned char st_other; /* No defined meaning, 0 */ + Elf64_Half st_shndx; /* Associated section index */ + Elf64_Addr st_value; /* Value of the symbol */ + Elf64_Xword st_size; /* Associated symbol size */ +} Elf64_Sym; + + +#define EI_NIDENT 16 + +typedef struct elf32_hdr { + unsigned char e_ident[EI_NIDENT]; + Elf32_Half e_type; + Elf32_Half e_machine; + Elf32_Word e_version; + Elf32_Addr e_entry; /* Entry point */ + Elf32_Off e_phoff; + Elf32_Off e_shoff; + Elf32_Word e_flags; + Elf32_Half e_ehsize; + Elf32_Half e_phentsize; + Elf32_Half e_phnum; + Elf32_Half e_shentsize; + Elf32_Half e_shnum; + Elf32_Half e_shstrndx; +} Elf32_Ehdr; + +typedef struct elf64_hdr { + unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */ + Elf64_Half e_type; + Elf64_Half e_machine; + Elf64_Word e_version; + Elf64_Addr e_entry; /* Entry point virtual address */ + Elf64_Off e_phoff; /* Program header table file offset */ + Elf64_Off e_shoff; /* Section header table file offset */ + Elf64_Word e_flags; + Elf64_Half e_ehsize; + Elf64_Half e_phentsize; + Elf64_Half e_phnum; + Elf64_Half e_shentsize; + Elf64_Half e_shnum; + Elf64_Half e_shstrndx; +} Elf64_Ehdr; + +/* These constants define the permissions on sections in the program + header, p_flags. */ +#define PF_R 0x4 +#define PF_W 0x2 +#define PF_X 0x1 + +typedef struct elf32_phdr { + Elf32_Word p_type; + Elf32_Off p_offset; + Elf32_Addr p_vaddr; + Elf32_Addr p_paddr; + Elf32_Word p_filesz; + Elf32_Word p_memsz; + Elf32_Word p_flags; + Elf32_Word p_align; +} Elf32_Phdr; + +typedef struct elf64_phdr { + Elf64_Word p_type; + Elf64_Word p_flags; + Elf64_Off p_offset; /* Segment file offset */ + Elf64_Addr p_vaddr; /* Segment virtual address */ + Elf64_Addr p_paddr; /* Segment physical address */ + Elf64_Xword p_filesz; /* Segment size in file */ + Elf64_Xword p_memsz; /* Segment size in memory */ + Elf64_Xword p_align; /* Segment alignment, file & memory */ +} Elf64_Phdr; + +/* sh_type */ +#define SHT_NULL 0 +#define SHT_PROGBITS 1 +#define SHT_SYMTAB 2 +#define SHT_STRTAB 3 +#define SHT_RELA 4 +#define SHT_HASH 5 +#define SHT_DYNAMIC 6 +#define SHT_NOTE 7 +#define SHT_NOBITS 8 +#define SHT_REL 9 +#define SHT_SHLIB 10 +#define SHT_DYNSYM 11 +#define SHT_NUM 12 +#define SHT_LOPROC 0x70000000 +#define SHT_HIPROC 0x7fffffff +#define SHT_LOUSER 0x80000000 +#define SHT_HIUSER 0xffffffff + +/* sh_flags */ +#define SHF_WRITE 0x1 +#define SHF_ALLOC 0x2 +#define SHF_EXECINSTR 0x4 +#define SHF_RELA_LIVEPATCH 0x00100000 +#define SHF_RO_AFTER_INIT 0x00200000 +#define SHF_MASKPROC 0xf0000000 + +/* special section indexes */ +#define SHN_UNDEF 0 +#define SHN_LORESERVE 0xff00 +#define SHN_LOPROC 0xff00 +#define SHN_HIPROC 0xff1f +#define SHN_LIVEPATCH 0xff20 +#define SHN_ABS 0xfff1 +#define SHN_COMMON 0xfff2 +#define SHN_HIRESERVE 0xffff + +typedef struct elf32_shdr { + Elf32_Word sh_name; + Elf32_Word sh_type; + Elf32_Word sh_flags; + Elf32_Addr sh_addr; + Elf32_Off sh_offset; + Elf32_Word sh_size; + Elf32_Word sh_link; + Elf32_Word sh_info; + Elf32_Word sh_addralign; + Elf32_Word sh_entsize; +} Elf32_Shdr; + +typedef struct elf64_shdr { + Elf64_Word sh_name; /* Section name, index in string tbl */ + Elf64_Word sh_type; /* Type of section */ + Elf64_Xword sh_flags; /* Miscellaneous section attributes */ + Elf64_Addr sh_addr; /* Section virtual addr at execution */ + Elf64_Off sh_offset; /* Section file offset */ + Elf64_Xword sh_size; /* Size of section in bytes */ + Elf64_Word sh_link; /* Index of another section */ + Elf64_Word sh_info; /* Additional section information */ + Elf64_Xword sh_addralign; /* Section alignment */ + Elf64_Xword sh_entsize; /* Entry size if section holds table */ +} Elf64_Shdr; + +#define EI_MAG0 0 /* e_ident[] indexes */ +#define EI_MAG1 1 +#define EI_MAG2 2 +#define EI_MAG3 3 +#define EI_CLASS 4 +#define EI_DATA 5 +#define EI_VERSION 6 +#define EI_OSABI 7 +#define EI_PAD 8 + +#define ELFMAG0 0x7f /* EI_MAG */ +#define ELFMAG1 'E' +#define ELFMAG2 'L' +#define ELFMAG3 'F' +#define ELFMAG "\177ELF" +#define SELFMAG 4 + +#define ELFCLASSNONE 0 /* EI_CLASS */ +#define ELFCLASS32 1 +#define ELFCLASS64 2 +#define ELFCLASSNUM 3 + +#define ELFDATANONE 0 /* e_ident[EI_DATA] */ +#define ELFDATA2LSB 1 +#define ELFDATA2MSB 2 + +#define EV_NONE 0 /* e_version, EI_VERSION */ +#define EV_CURRENT 1 +#define EV_NUM 2 + +#define ELFOSABI_NONE 0 +#define ELFOSABI_LINUX 3 + +#ifndef ELF_OSABI +#define ELF_OSABI ELFOSABI_NONE +#endif + +/* + * Notes used in ET_CORE. Architectures export some of the arch register sets + * using the corresponding note types via the PTRACE_GETREGSET and + * PTRACE_SETREGSET requests. + * The note name for these types is "LINUX", except NT_PRFPREG that is named + * "CORE". + */ +#define NT_PRSTATUS 1 +#define NT_PRFPREG 2 +#define NT_PRPSINFO 3 +#define NT_TASKSTRUCT 4 +#define NT_AUXV 6 +/* + * Note to userspace developers: size of NT_SIGINFO note may increase + * in the future to accomodate more fields, don't assume it is fixed! + */ +#define NT_SIGINFO 0x53494749 +#define NT_FILE 0x46494c45 +#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ +#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ +#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ +#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ +#define NT_PPC_TAR 0x103 /* Target Address Register */ +#define NT_PPC_PPR 0x104 /* Program Priority Register */ +#define NT_PPC_DSCR 0x105 /* Data Stream Control Register */ +#define NT_PPC_EBB 0x106 /* Event Based Branch Registers */ +#define NT_PPC_PMU 0x107 /* Performance Monitor Registers */ +#define NT_PPC_TM_CGPR 0x108 /* TM checkpointed GPR Registers */ +#define NT_PPC_TM_CFPR 0x109 /* TM checkpointed FPR Registers */ +#define NT_PPC_TM_CVMX 0x10a /* TM checkpointed VMX Registers */ +#define NT_PPC_TM_CVSX 0x10b /* TM checkpointed VSX Registers */ +#define NT_PPC_TM_SPR 0x10c /* TM Special Purpose Registers */ +#define NT_PPC_TM_CTAR 0x10d /* TM checkpointed Target Address Register */ +#define NT_PPC_TM_CPPR 0x10e /* TM checkpointed Program Priority Register */ +#define NT_PPC_TM_CDSCR 0x10f /* TM checkpointed Data Stream Control Register */ +#define NT_PPC_PKEY 0x110 /* Memory Protection Keys registers */ +#define NT_PPC_DEXCR 0x111 /* PowerPC DEXCR registers */ +#define NT_PPC_HASHKEYR 0x112 /* PowerPC HASHKEYR register */ +#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ +#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ +#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ +/* Old binutils treats 0x203 as a CET state */ +#define NT_X86_SHSTK 0x204 /* x86 SHSTK state */ +#define NT_X86_XSAVE_LAYOUT 0x205 /* XSAVE layout description */ +#define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */ +#define NT_S390_TIMER 0x301 /* s390 timer register */ +#define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */ +#define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */ +#define NT_S390_CTRS 0x304 /* s390 control registers */ +#define NT_S390_PREFIX 0x305 /* s390 prefix register */ +#define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */ +#define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */ +#define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */ +#define NT_S390_VXRS_LOW 0x309 /* s390 vector registers 0-15 upper half */ +#define NT_S390_VXRS_HIGH 0x30a /* s390 vector registers 16-31 */ +#define NT_S390_GS_CB 0x30b /* s390 guarded storage registers */ +#define NT_S390_GS_BC 0x30c /* s390 guarded storage broadcast control block */ +#define NT_S390_RI_CB 0x30d /* s390 runtime instrumentation */ +#define NT_S390_PV_CPU_DATA 0x30e /* s390 protvirt cpu dump data */ +#define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */ +#define NT_ARM_TLS 0x401 /* ARM TLS register */ +#define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */ +#define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */ +#define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */ +#define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension registers */ +#define NT_ARM_PAC_MASK 0x406 /* ARM pointer authentication code masks */ +#define NT_ARM_PACA_KEYS 0x407 /* ARM pointer authentication address keys */ +#define NT_ARM_PACG_KEYS 0x408 /* ARM pointer authentication generic key */ +#define NT_ARM_TAGGED_ADDR_CTRL 0x409 /* arm64 tagged address control (prctl()) */ +#define NT_ARM_PAC_ENABLED_KEYS 0x40a /* arm64 ptr auth enabled keys (prctl()) */ +#define NT_ARM_SSVE 0x40b /* ARM Streaming SVE registers */ +#define NT_ARM_ZA 0x40c /* ARM SME ZA registers */ +#define NT_ARM_ZT 0x40d /* ARM SME ZT registers */ +#define NT_ARM_FPMR 0x40e /* ARM floating point mode register */ +#define NT_ARM_POE 0x40f /* ARM POE registers */ +#define NT_ARM_GCS 0x410 /* ARM GCS state */ +#define NT_ARC_V2 0x600 /* ARCv2 accumulator/extra registers */ +#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note */ +#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers */ +#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode */ +#define NT_MIPS_MSA 0x802 /* MIPS SIMD registers */ +#define NT_RISCV_CSR 0x900 /* RISC-V Control and Status Registers */ +#define NT_RISCV_VECTOR 0x901 /* RISC-V vector registers */ +#define NT_RISCV_TAGGED_ADDR_CTRL 0x902 /* RISC-V tagged address control (prctl()) */ +#define NT_LOONGARCH_CPUCFG 0xa00 /* LoongArch CPU config registers */ +#define NT_LOONGARCH_CSR 0xa01 /* LoongArch control and status registers */ +#define NT_LOONGARCH_LSX 0xa02 /* LoongArch Loongson SIMD Extension registers */ +#define NT_LOONGARCH_LASX 0xa03 /* LoongArch Loongson Advanced SIMD Extension registers */ +#define NT_LOONGARCH_LBT 0xa04 /* LoongArch Loongson Binary Translation registers */ +#define NT_LOONGARCH_HW_BREAK 0xa05 /* LoongArch hardware breakpoint registers */ +#define NT_LOONGARCH_HW_WATCH 0xa06 /* LoongArch hardware watchpoint registers */ + +/* Note types with note name "GNU" */ +#define NT_GNU_PROPERTY_TYPE_0 5 + +/* Note header in a PT_NOTE section */ +typedef struct elf32_note { + Elf32_Word n_namesz; /* Name size */ + Elf32_Word n_descsz; /* Content size */ + Elf32_Word n_type; /* Content type */ +} Elf32_Nhdr; + +/* Note header in a PT_NOTE section */ +typedef struct elf64_note { + Elf64_Word n_namesz; /* Name size */ + Elf64_Word n_descsz; /* Content size */ + Elf64_Word n_type; /* Content type */ +} Elf64_Nhdr; + +/* .note.gnu.property types for EM_AARCH64: */ +#define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000 + +/* Bits for GNU_PROPERTY_AARCH64_FEATURE_1_BTI */ +#define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1U << 0) + +typedef struct { + Elf32_Half vd_version; + Elf32_Half vd_flags; + Elf32_Half vd_ndx; + Elf32_Half vd_cnt; + Elf32_Word vd_hash; + Elf32_Word vd_aux; + Elf32_Word vd_next; +} Elf32_Verdef; + +typedef struct { + Elf64_Half vd_version; + Elf64_Half vd_flags; + Elf64_Half vd_ndx; + Elf64_Half vd_cnt; + Elf64_Word vd_hash; + Elf64_Word vd_aux; + Elf64_Word vd_next; +} Elf64_Verdef; + +typedef struct { + Elf32_Word vda_name; + Elf32_Word vda_next; +} Elf32_Verdaux; + +typedef struct { + Elf64_Word vda_name; + Elf64_Word vda_next; +} Elf64_Verdaux; + +#endif /* _LINUX_ELF_H */ From patchwork Mon Feb 3 09:05:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13957088 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E585E1FF1D2; Mon, 3 Feb 2025 09:05:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573526; cv=none; b=g0E6FSxJaqOXf/CqmgO38CQbLCpw0L7jjchKhFVJOX+bdw+gs2Ml5VDmcX91yoVO3VFWyxi00pqelr8n+ZUENlY4MoqBwsTHIjrMyjeddJjGoDyzlSlTcNHGDogP7bKkJt2c4O0qJpOmExGyjDNlH1tjz6R6upfrn/+JYQhq8pw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573526; c=relaxed/simple; bh=0OYIxTlpnbjEhvswabtZg49j38hT3MAFwMnYXuy7rHo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YCqO7nuHP5nN/scx9bA0iz9nuNXZGIbLSa4NRlOjM2J8WW93NC59tF9478EIEGvzIguypTeEZcMyVCkATHdncxrvY3ho0iw2J78lkwENueLSK6jCBHX+9Eq9pvABUxb+RmVq0ONrWYpDuVTgjI8ubPg3zrIoKNthhM+TzNdq/MU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=JhMKYXZh; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=sjZoTqPe; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="JhMKYXZh"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="sjZoTqPe" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1738573522; 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=sG/oZgAVhh6ntwQfY2W+UbeC4PlDV/c3H2R+4urGbL8=; b=JhMKYXZhVSl8/w2BmQY+EqIs3pyiQ1lhM0emDgv0arK+K4XfGigIh+g7r0at1+9pdkHLaV BEDeI0QuP5p2TSNd7UcHI4NU5k/ph0uuA3OrMPWoMI6Xg9xCBm0mh6N2wJPUumv53sSPSg jL6FXZz5CdlgIxGLAYDIyDs2pVr4njxIO9MAQ/YKVAH80I3CQPxXcCx/QgeUJYzh+Fp3+v rwpHneaSmTQZujuYiT7zMvIFTTSt22ck+3CsHkeKfaSkBQsDE4PMEIFzV2RxeOgTYch/7U AcVJEAcWLxm//knVgt04bowdoOenBJzIBREKOl5QDJ9UsN9f+OedDsp6JRfQvw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1738573522; 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=sG/oZgAVhh6ntwQfY2W+UbeC4PlDV/c3H2R+4urGbL8=; b=sjZoTqPehK2ud05RLSFDc5lU4mzS47xZKf+CsUnMXqFCM4Bm54cCYDsz1eW1TtpPW2KZbw nGrE4YodtXB7OtBQ== Date: Mon, 03 Feb 2025 10:05:09 +0100 Subject: [PATCH 08/16] selftests: Add headers target Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250203-parse_vdso-nolibc-v1-8-9cb6268d77be@linutronix.de> References: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> In-Reply-To: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> To: Kees Cook , Eric Biederman , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev, =?utf-8?q?Thomas_We?= =?utf-8?q?i=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1738573516; l=1095; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=0OYIxTlpnbjEhvswabtZg49j38hT3MAFwMnYXuy7rHo=; b=7OFfX8P7FhSczFpGy/axi3iZncIH116trhlD/v/wjEr2m0wr4S0g/2HGcyDlWkMjKCfp4pL/9 UfyCKzpFw7ACjbY83Xh0CMIYZqw0+FIc4YHGYKq3pWuiltxDT9sA6C7 X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= Some selftests need access to a full UAPI headers tree, for example when building with nolibc which heavily relies on UAPI headers. A reference to such a tree is available in the KHDR_INCLUDES variable, but there is currently no way to populate such a tree automatically. Provide a target that the tests can depend on to get access to usable UAPI headers. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/lib.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index d6edcfcb5be832ddee4c3d34b5ad221e9295f878..5303900339292e618dee4fd7ff8a7c2fa3209a68 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -228,4 +228,7 @@ $(OUTPUT)/%:%.S $(LINK.S) $^ $(LDLIBS) -o $@ endif -.PHONY: run_tests all clean install emit_tests gen_mods_dir clean_mods_dir +headers: + $(Q)$(MAKE) -C $(top_srcdir) headers + +.PHONY: run_tests all clean install emit_tests gen_mods_dir clean_mods_dir headers From patchwork Mon Feb 3 09:05:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13957089 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 849F11FF603; Mon, 3 Feb 2025 09:05:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573526; cv=none; b=pbvcnD8UWeUBkCYYAXRMdfBjPdzXUwMjF5ErwqTaID68m2U+2NutIXLRG+x6AtLVCoG4hCwY7P+weWsBoAp5ZCzY1CFs6aL5yAz8rV0R0yYU94SfZK/ehqWbGQSJJuqCA6CeubKSKeEn/mkWSG9Vj7qE0R/qO0CNTtNYn9Bdzho= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573526; c=relaxed/simple; bh=C3WrIXo4pF6mfQdzvKKu1BjqdXgy4M3jnZi0dZUjrCw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fiq8ICBr8eSOx4cvgHEfIZpLejuqMxxfAs/HH01avRZ/Sr7F+j3b4bV0nIdMnD3awr++Zf4KxJeDneRjeY00I3W94VR3hKujb9oixKj04v+4HInhOo60M1yphUQB33lNicNcmnYULq5Gd38aSBBt33C6s+0tgBoUMVHdX8P3NMQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=sMnBRWh5; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=xwTeEsva; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="sMnBRWh5"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="xwTeEsva" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1738573523; 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=cRuD5hbVHSSw/8cljIctKIY+Y3ZkYhQFJxv3Eq1eG8c=; b=sMnBRWh5Odu/hj5HZMTeDDMsDUsT1NHGleJvFt0LCBuMV7COMniMpGez18OWPxAgA6u7MG X0LXW4hxnmeKSs+3ZS06zwWpivEevPl5q1Zs/Ya0kd488hSx/EEhmi7yHMsnNIiCwDGmaT kn9Si5Bv8TDq1iZJavb5pT6bGqInyMMEyGzSDgRWhz/pGJPALzRuGx0oNjCRgdFOGB+Fye 3ZO72L3jxvwcioTkFQJOdPNG0U9D6Q9ZN81917whURIBSyDbVvtJNzT5V+SVrV9dFXmrFr xBVd7BbtrVaWa0v0+QLcNs2f/AI8LyAG+ppaVAdglfVjOqtR1P3okLxGNmmBSw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1738573523; 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=cRuD5hbVHSSw/8cljIctKIY+Y3ZkYhQFJxv3Eq1eG8c=; b=xwTeEsvab709zFyQI9k93t/nyI1n1BCLhqfH7Pd7esKStlGj7syuEBBF5uT3Oi1q45FpGe RtCosuKtkd5H1GBA== Date: Mon, 03 Feb 2025 10:05:10 +0100 Subject: [PATCH 09/16] selftests: vDSO: vdso_standalone_test_x86: Use vdso_init_form_sysinfo_ehdr Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250203-parse_vdso-nolibc-v1-9-9cb6268d77be@linutronix.de> References: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> In-Reply-To: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> To: Kees Cook , Eric Biederman , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev, =?utf-8?q?Thomas_We?= =?utf-8?q?i=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1738573516; l=1895; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=C3WrIXo4pF6mfQdzvKKu1BjqdXgy4M3jnZi0dZUjrCw=; b=vqn4AilDy7ubG5y+C+hp2FjcC5G15khR+tILwCvaP1GUME4dr3rv0qNjecgSBJ09SsGUhU9Ln 6sEIXscGBezCysoRDXLnNFoAbxqVNBfjeEVRJkZdbJVF7MPnQxvFLvX X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= vdso_standalone_test_x86 is the only user of vdso_init_from_auxv(). Instead of combining the parsing the aux vector with the parsing of the vDSO, split them apart into getauxval() and the regular vdso_init_from_sysinfo_ehdr(). The implementation of getauxval() is taken from tools/include/nolibc/stdlib.h. Signed-off-by: Thomas Weißschuh --- All of this code will be deleted later again. --- .../selftests/vDSO/vdso_standalone_test_x86.c | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c b/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c index 644915862af8883131e5defd336f1bd80736fc0f..500608f89c66b5747e3d845ebc54e4c3a35b6ccd 100644 --- a/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c +++ b/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "parse_vdso.h" @@ -84,6 +85,30 @@ void to_base10(char *lastdig, time_t n) } } +unsigned long getauxval(const unsigned long *auxv, unsigned long type) +{ + unsigned long ret; + + if (!auxv) + return 0; + + while (1) { + if (!auxv[0] && !auxv[1]) { + ret = 0; + break; + } + + if (auxv[0] == type) { + ret = auxv[1]; + break; + } + + auxv += 2; + } + + return ret; +} + void c_main(void **stack) { /* Parse the stack */ @@ -96,7 +121,7 @@ void c_main(void **stack) stack++; /* Now we're pointing at auxv. Initialize the vDSO parser. */ - vdso_init_from_auxv((void *)stack); + vdso_init_from_sysinfo_ehdr(getauxval((unsigned long *)stack, AT_SYSINFO_EHDR)); /* Find gettimeofday. */ typedef long (*gtod_t)(struct timeval *tv, struct timezone *tz); From patchwork Mon Feb 3 09:05:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13957093 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17C501FF7A1; Mon, 3 Feb 2025 09:05:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573528; cv=none; b=jqDrIFklXNsWuDV0j2mFaKqiWSZ/OtYLmiXX2UNWGQxkMpU+TJVdjDy6dxd4n2yI0Jy3vMKQVrDwBpsK7bNgJqoceRtL5h4OpuzIptswLjjB+9LNqQZRECK+6fBD9QUQbZo8rOSAsehHj+MjtZ1yu6r9ZzqrLPnAVo097CzwzdQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573528; c=relaxed/simple; bh=ugBwqhNadfgaJrsWyUX/2beQ4czEKoozrpKImBBUGps=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=q/zyy7djundoAnx4hp1bgMTJbCypCptaQXKWDzsRLMkk1pyb/zJQh6kE+b+ZbgLJsJFBiW0dM+YnMs8da9vqCVA5aNM5DicPeuLlO0WQFCnbFb6XNmJ2djuZEVd9QeNBtBTNENNab9x39O4K//ec+BuaVmUeSCdgB7K/eIQ/Qcc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=fgkPYkL9; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=bauLXxZ1; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="fgkPYkL9"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="bauLXxZ1" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1738573523; 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=9OHpPSU9A8rMw65GpV2i5kAnHrOB7dGDB0rMnM6cdCQ=; b=fgkPYkL9gMRnyDkH2RMIwKuOFSQ+y+KO7EHHtpv7Wngciwo89WNxP728ntzAAt1JUW/UTn H0Fg8D33X4l/QIWJNe8JWTaU+Ye8fCjdrKywWuLyM5LxlLUAf0cXPmW/KclM+oPE8MgmES SJxYKqlLzN9IFqngaxWPLyRMbdzTXVOlgsgxW1MMzSDfGd9ToBldiUJv+znD8Ata5DzkeW 16oJosV2UUPRuK44RefC2ea9AihINCjdN7H8QaAWloooA2RbrDzBXUi8qpytymNSUJOZN/ Du9GAHro/3MRHoIWBh2PlninlkPOMx13+WpEdCj2EeOl2q7MK7SKnY13MKj69w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1738573523; 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=9OHpPSU9A8rMw65GpV2i5kAnHrOB7dGDB0rMnM6cdCQ=; b=bauLXxZ18S9/378dg+A3yudnEpxzalp2Z99jMwwAW+rGiU96hjqw7z8Ig05lE1UMox2dou t+dLKA5NVDkybmBw== Date: Mon, 03 Feb 2025 10:05:11 +0100 Subject: [PATCH 10/16] selftests: vDSO: parse_vdso: Drop vdso_init_from_auxv() Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250203-parse_vdso-nolibc-v1-10-9cb6268d77be@linutronix.de> References: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> In-Reply-To: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> To: Kees Cook , Eric Biederman , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev, =?utf-8?q?Thomas_We?= =?utf-8?q?i=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1738573516; l=1524; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=ugBwqhNadfgaJrsWyUX/2beQ4czEKoozrpKImBBUGps=; b=14j5KAr756dMld/affOvFMwsnE3RfqI6n9MkPXjBS3SeQCSJnmZpBsFXGJMIC6BfEE+NqoqNB JEIjSpeFEuyDorQqPFhp9++Vl+WbXqyyJu8KIzXICUkV9cX7C9/zdR0 X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= There are no users left. Also remove the usage of ElfXX_auxv_t, which is not formally standardized. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/vDSO/parse_vdso.c | 14 -------------- tools/testing/selftests/vDSO/parse_vdso.h | 1 - 2 files changed, 15 deletions(-) diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c index 2fe5e983cb22f1ed066d0310a54f6aef2ed77ed8..3638fe605e80ca41b29d43c6ac452964eef35d56 100644 --- a/tools/testing/selftests/vDSO/parse_vdso.c +++ b/tools/testing/selftests/vDSO/parse_vdso.c @@ -297,17 +297,3 @@ void *vdso_sym(const char *version, const char *name) return 0; } - -void vdso_init_from_auxv(void *auxv) -{ - ELF(auxv_t) *elf_auxv = auxv; - for (int i = 0; elf_auxv[i].a_type != AT_NULL; i++) - { - if (elf_auxv[i].a_type == AT_SYSINFO_EHDR) { - vdso_init_from_sysinfo_ehdr(elf_auxv[i].a_un.a_val); - return; - } - } - - vdso_info.valid = false; -} diff --git a/tools/testing/selftests/vDSO/parse_vdso.h b/tools/testing/selftests/vDSO/parse_vdso.h index de0453067d7cd0d8b63f7d3738842f60370db813..09d068ed11f97f0c5c8f4e7b341f08fa261c9735 100644 --- a/tools/testing/selftests/vDSO/parse_vdso.h +++ b/tools/testing/selftests/vDSO/parse_vdso.h @@ -26,6 +26,5 @@ */ void *vdso_sym(const char *version, const char *name); void vdso_init_from_sysinfo_ehdr(uintptr_t base); -void vdso_init_from_auxv(void *auxv); #endif From patchwork Mon Feb 3 09:05:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13957091 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 085831FFC4A; Mon, 3 Feb 2025 09:05:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573528; cv=none; b=Stdz6w+/4z7YGuCwZFPO3I4+dBAvGZTNHoSnQo3SlPzFE2uBWCN+OzvDON93fA6e8IJ45X/zQZbYY8i7Z/cNCdkltbK0eyu2XX0J6t6HFCl982mdMp3kgARlD+4j/q9epBfxruGX5UnAHK+nrnbKbEp1jtC56Gb/jpV/FtgMspE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573528; c=relaxed/simple; bh=NpOQuxLd7KblcjFPnaDO5YLxwLL0GxVqW0hZLzvIMGU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cb4EKfCTw+HyzJVWgIxCd0/Cta500iJrcgNBwXSYdxgUTxH53ftZXENdfalQE0DIfV7f8PaQCRyW0jP3JCph1mvLvGQjwbXQv88aKGzcMX0bNiPqCw9kBr75EXBR7KXNkMgWBRmgjnRGSnnm3PC15CuGFyeS6drcRuYsN0jooTo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=QKMTSHwC; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ANpDWJuI; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="QKMTSHwC"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ANpDWJuI" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1738573524; 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=MOyFPIEiH7gm2OvTiVE+dNl/7Ao4pkwSxETN6MXhZOM=; b=QKMTSHwCQSP1GFrALXRUd1pr+I0o1ken7IFPwr5hwCqzVi5W6OAH6JEzSoS++jlQNCQqtQ 00KSRzsq/zQbFz9eJiGM3N3QvBCwPu9xXoRt28OcagWfzRCpaeaFZ3lgKiQlXeFj/fbf1V DPF7gANzIcMfKhFc2IHT7o0pWk+tdhx0OvkmPAAajMUw7iyIP9rD491lyrpvnpz12e2kNo mrEdWAM30mWVtaHFrSFuuYdSsHHzA0+kM1USqBmE0DX7S5NbFBX1eZFxGsJZSTaefZfjfx OfXPqMO4W6RgERpxeK/11QmwDNm6Drfs2txWKiz7gd/vZ4KAtd64gHVgVl9GPQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1738573524; 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=MOyFPIEiH7gm2OvTiVE+dNl/7Ao4pkwSxETN6MXhZOM=; b=ANpDWJuIpNr8cNesKHQJBMRYvjmuj39qzxjgbY6Dw12se5Zf4/l2uhcKpcUNWox9CHNc4z qdBmoii2TPSVlHAw== Date: Mon, 03 Feb 2025 10:05:12 +0100 Subject: [PATCH 11/16] selftests: vDSO: parse_vdso: Use UAPI headers instead of libc headers Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250203-parse_vdso-nolibc-v1-11-9cb6268d77be@linutronix.de> References: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> In-Reply-To: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> To: Kees Cook , Eric Biederman , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev, =?utf-8?q?Thomas_We?= =?utf-8?q?i=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1738573516; l=1432; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=NpOQuxLd7KblcjFPnaDO5YLxwLL0GxVqW0hZLzvIMGU=; b=EVrIy1GANEM6B5AcEyRo8lV/ac+2X2NNYAMOZ2NnAil0mfCdvESkLcjnYXyGzAHMomYPMYrjZ 9nl+mXfJMzCCzL46iUgHOKGLJ7oGfv2ZDai+6a470OId6MfhWN/AzaG X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= To allow the usage of parse_vdso.c together with a limited libc like nolibc, use the kernels own elf.h and auxvec.h headers. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/vDSO/Makefile | 3 +++ tools/testing/selftests/vDSO/parse_vdso.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/vDSO/Makefile b/tools/testing/selftests/vDSO/Makefile index 1cf14a8da43803249f72fe1b09689c8834806986..bc8ca186fb877dc11740c37f1e07e45e84c2ae92 100644 --- a/tools/testing/selftests/vDSO/Makefile +++ b/tools/testing/selftests/vDSO/Makefile @@ -19,6 +19,9 @@ LDLIBS += -lgcc_s endif include ../lib.mk + +CFLAGS += $(TOOLS_INCLUDES) + $(OUTPUT)/vdso_test_gettimeofday: parse_vdso.c vdso_test_gettimeofday.c $(OUTPUT)/vdso_test_getcpu: parse_vdso.c vdso_test_getcpu.c $(OUTPUT)/vdso_test_abi: parse_vdso.c vdso_test_abi.c diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c index 3638fe605e80ca41b29d43c6ac452964eef35d56..200c534cc70e2c2381fce3be5c0ebe4cb5675e84 100644 --- a/tools/testing/selftests/vDSO/parse_vdso.c +++ b/tools/testing/selftests/vDSO/parse_vdso.c @@ -19,7 +19,8 @@ #include #include #include -#include +#include +#include #include "parse_vdso.h" From patchwork Mon Feb 3 09:05:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13957092 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 172651FFC4C; Mon, 3 Feb 2025 09:05:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573528; cv=none; b=NeT1ZalMW2dKtbvxvA+8XUxVB5JLahe8wMUZJZgiSnHarwhMb8HCLQ8G8NQGnORvI9QSq8JQ3eWAc4yc1sDbpyJ923N9bSv3w+YokVklZJwkMQaIlSw+uIE5jDRrYnv02kWR3ZWCMTufh+FqF/k4wnWps2z1+3hAszaU+v1Myr8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573528; c=relaxed/simple; bh=fJM1dVn7zNhQ0eUj0mWU+BrWz8rCvgfwxzZIAbjOWds=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GXHYIHvoMEIWsFaqFoCMJGL6e3KlccbOjhlazTlSVOkvgtLNsqzKhrI9VC1eURSPnPrJF5thaEm7Xqhk5Lil86sOZAV+yZ4LW5Bz9wTCmt/bl/6HRBx9HtUQ+t7DkElqVtFKw9Ao6yn4mo3wsbQhlu0eqYWLjuFN73Usr5uqwfA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=nvEN1cOm; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=oF1rtIul; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="nvEN1cOm"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="oF1rtIul" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1738573524; 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=tIWdgZoCmwWBnzk969udACPDuwBISkKWyW+kvFZi0zY=; b=nvEN1cOmn06k49QOVYgcSYuPY5VASet5LsKlrY5DYUZOHO4UmeYOuTHYyWx2OLJ4wkvFT2 ja29nLqXV6qQBiSPYRZZ8jD4RgMVrGmKu10RGdVABquOEtfTIpNicZN5WA4ArSK5CibbOo idVN3IMAor/2EQHweC5iQp7PvxrNVEg3kdiDD0JPtJe8WumBoOh6ZLAnsgNPLnoviMOAaY FxooXiVCuBCUq1eYPuAaqNED5jsajGMiiMYPUXeWXJqAegS0Pmwu5Pt8D6ojtc+2j3MNjK QZS/YhVUAe8sYq817HUGYzz+UdOHcqqnevqre9JX80n6T3KMbdb8FefbljQMTA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1738573524; 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=tIWdgZoCmwWBnzk969udACPDuwBISkKWyW+kvFZi0zY=; b=oF1rtIulgN3B5woeBiKpzvQTVwGp3aSYHc5lUe24f1IDKPQ9ufAslpGaab29OU3BJWg1nG EV6VnsFpjI1gEyCQ== Date: Mon, 03 Feb 2025 10:05:13 +0100 Subject: [PATCH 12/16] selftests: vDSO: parse_vdso: Test __SIZEOF_LONG__ instead of ULONG_MAX Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250203-parse_vdso-nolibc-v1-12-9cb6268d77be@linutronix.de> References: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> In-Reply-To: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> To: Kees Cook , Eric Biederman , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev, =?utf-8?q?Thomas_We?= =?utf-8?q?i=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1738573516; l=1086; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=fJM1dVn7zNhQ0eUj0mWU+BrWz8rCvgfwxzZIAbjOWds=; b=P2jF09IdnCieXPEKGoemdM93wx2FWHeUgvh77I2DZzUgYMzUUEK/15O2kADdMBCByL/IGRMDb XPonFfZ5batAjxJINdtO2IIyDvSP2J2y/IOTq5G6FHdWQBmcgPx7uiA X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= According to limits.h(2) ULONG_MAX is only guaranteed to expand to an expression, not a symbolic constant which can be evaluated by the preprocessor. Specifically the definition of ULONG_MAX from nolibc can no be evaluated by the preprocessor. To provide compatibility with nolibc, check with __SIZEOF_LONG__ instead, with is provided directly by the preprocessor and therefore always a symbolic constant. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/vDSO/parse_vdso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c index 200c534cc70e2c2381fce3be5c0ebe4cb5675e84..902b8f9984a1f70049d46bcd4f199df24f507dcb 100644 --- a/tools/testing/selftests/vDSO/parse_vdso.c +++ b/tools/testing/selftests/vDSO/parse_vdso.c @@ -26,7 +26,7 @@ /* And here's the code. */ #ifndef ELF_BITS -# if ULONG_MAX > 0xffffffffUL +# if __SIZEOF_LONG__ >= 8 # define ELF_BITS 64 # else # define ELF_BITS 32 From patchwork Mon Feb 3 09:05:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13957094 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC6CC1FFC75; Mon, 3 Feb 2025 09:05:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573528; cv=none; b=JvPpVc5q3Beu8zBebnBE9THNwrTksCOsr3yoS9xwkisyheaONiZr0mDejQg5fn6/bbr75CnBiEcfR38S1QJSn4PP2nE5DgaefBuY9MhvhJTGogTy7ZrcDyrFdiSQ+2oVOwRzUGgj3y2wCkk41CHrDixi//cx49ZYo9VcgwG/aHA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573528; c=relaxed/simple; bh=k6VUcueMsds64a4Z4MA/57EnupYZZoqU0G2BNVcipcM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aNII41uPxMSM8B9P4LgXEvBt3T87N3+NDzGl55caT5uiXmG4burh3Y2UF228WlGN2/QcmSiB6Cr8BKAILOJPK3zVWAuz4MUvA1+SKbqEdFov5vMM0Vzh7pFx6pSCU9qDvQsxh6Ovb3xk1jrUGNShV29NpnHwg1X5guaSoJqK77o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=DfC6KsHR; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=rA+hLWr6; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="DfC6KsHR"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="rA+hLWr6" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1738573525; 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=IQYQpcPfp6ErdUhcd4g1hQR7rxemGi27GYxhVGxGLIM=; b=DfC6KsHRJsJQPxHeNvNfWqqvAjHu5L4PMF/ZKBcNWpdNF41CWDQjwSQNr3ItUnSwcNAjEf XVBhU3TlZRaqxVtk9Z9rhlXaqxNZYDZ8jnwhOO7E++JyAzOXg1lTCcqXQGwxDtkl8kKN2/ QnJYH59ZagNcROQM6YvD82ObUKy0TQ90JldyJiANnr5zmkgEaXSUKuO4W207CB9MH1r9ha f0mClQYJ/AEKwkQK4Wwag5u4dkRUiG3q+JCunW1NOXO+X7Rb5/v8WewcRPMClCmRjRdkz1 f0/XO1RBnDWXdPeCGK7kDIQLVCHrk5U7GGQbFQWs/D43QL2XZUSk0i59hLqpcA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1738573525; 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=IQYQpcPfp6ErdUhcd4g1hQR7rxemGi27GYxhVGxGLIM=; b=rA+hLWr6BMpQWLvEovR3V0jSYbK1RbwTORd27NAuWuAvtIbg3xiRJd/+xwABegsrk7+Z2V h/Hq6/0YkxIYZnCg== Date: Mon, 03 Feb 2025 10:05:14 +0100 Subject: [PATCH 13/16] selftests: vDSO: parse_vdso: Make compatible with nolibc Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250203-parse_vdso-nolibc-v1-13-9cb6268d77be@linutronix.de> References: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> In-Reply-To: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> To: Kees Cook , Eric Biederman , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev, =?utf-8?q?Thomas_We?= =?utf-8?q?i=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1738573516; l=756; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=k6VUcueMsds64a4Z4MA/57EnupYZZoqU0G2BNVcipcM=; b=VNnbvj9POxcSn3A13xo7ug3s412wmbrg96lC38H2tnhmDK285wBgMT1/UX6qO+TUEE2TdHrBV d4lNdSDjftsB4ikN+Hj4kSbgObC8Xve+4WVgIxIeGYyX6Y2VtnqQFEc X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= nolibc does not provide this header, instead its definitions are available unconditionally. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/vDSO/parse_vdso.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c index 902b8f9984a1f70049d46bcd4f199df24f507dcb..6ea1d7cca6a3da910097630e8237a3a6daa0cd06 100644 --- a/tools/testing/selftests/vDSO/parse_vdso.c +++ b/tools/testing/selftests/vDSO/parse_vdso.c @@ -18,7 +18,9 @@ #include #include #include +#ifndef NOLIBC #include +#endif #include #include From patchwork Mon Feb 3 09:05:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13957095 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 62A8B20011B; Mon, 3 Feb 2025 09:05:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573529; cv=none; b=lk1Htp63PZrfAG18wRFLhB2cQtajkIW1OrivpP3MpWgmgqAlcv85FYRHacEXIG04HdRnDoECtn2PUXGy57Ym0umgfmH8j9kYKKVLVhPe96vhZ83XNm06iW3cnnl6O87Py5ag+cT/VLXiDurHdgWG8XcrPXTXx+X1y7jtVgURpbM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573529; c=relaxed/simple; bh=WWyAjd0lBF4CXtwQtc/ysMPL9nKJJ2TfKtJWs4lpBX4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rEtMFEmcrNqYtHp7BTi/8aw8mefukaCanVuXhWgLY3gaTMQ5n2VUdgV3RrLkk3vMsbDFtfmKT47VVU1Hy9bOcT3fbT5dwg2Qkg/lAUSL0gyxdCzKc19tnIRXiEFF1dnS9d5lJvSM30APqdSlkczMLgVpCp4Uo8xXBWe25JIUB1Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=yjmAtgMY; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Qk+5JP6m; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="yjmAtgMY"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Qk+5JP6m" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1738573525; 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=KmfOckZ/ezvQbsI8oO+Ny3Ym1fUd+U8v8PjgJTjlhxI=; b=yjmAtgMYGYfBdpksBGL3fLj3qyPKzWWYn9LYLPNuZ48cP7fMNj2UUfTat6YJOWkmEUT+vR UHTsI4zn8oh+peO1dvBPkvsvUICpuqld/b/0da5ylPAMpltqhNSqXWOVu5fwnZ3b5QGQM3 eoYOD6yyEDikifawdsoHk40vO5ieyjDGlRD+u3cuy4IkfAa3WMScUnZrQ9YRHzU/yD4AHq IIqqMSZ3H4utDJ8Bt2Qy+2ueNbkA/Dx/T0PTHmtPjkkzYcGsYCYqwdJRYwE+ofpbD5tE6s Fv4SAl7sIVAmqRN5VLws6Rsn7sl3wEO7DGNlCdGY0qNFVlw10copD9nFdUFN5Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1738573525; 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=KmfOckZ/ezvQbsI8oO+Ny3Ym1fUd+U8v8PjgJTjlhxI=; b=Qk+5JP6mxxwppOPLgoax+Q7V36u+yZMdh/As+saJE+SWTU+amwMyzjwngOwgQ//NXRieeG QofsWTBRfOJfO1Aw== Date: Mon, 03 Feb 2025 10:05:15 +0100 Subject: [PATCH 14/16] selftests: vDSO: vdso_test_gettimeofday: Clean up includes Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250203-parse_vdso-nolibc-v1-14-9cb6268d77be@linutronix.de> References: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> In-Reply-To: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> To: Kees Cook , Eric Biederman , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev, =?utf-8?q?Thomas_We?= =?utf-8?q?i=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1738573516; l=803; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=WWyAjd0lBF4CXtwQtc/ysMPL9nKJJ2TfKtJWs4lpBX4=; b=Wx5hqx8BLX3nyiwjknii3zPUhoiOo1txrGf9MQx5F49M1A8vApW5O5bGzPPmgJKo1eAaOt0mk eQyNUERgj8dCiDDbUeShmbJ3c0NvGokZun7HHe6yXdmDHodqA/P5NGJ X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= Some unnecessary headers are included, remove them. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/vDSO/vdso_test_gettimeofday.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/testing/selftests/vDSO/vdso_test_gettimeofday.c b/tools/testing/selftests/vDSO/vdso_test_gettimeofday.c index e31b18ffae338c1576449b54ca7f84d9816d2ecb..636a56ccf8e4e7943ca446fe3fad6897598ca77f 100644 --- a/tools/testing/selftests/vDSO/vdso_test_gettimeofday.c +++ b/tools/testing/selftests/vDSO/vdso_test_gettimeofday.c @@ -10,8 +10,6 @@ * Tested on x86, 32-bit and 64-bit. It may work on other architectures, too. */ -#include -#include #include #include #include From patchwork Mon Feb 3 09:05:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13957096 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE77B20013A; Mon, 3 Feb 2025 09:05:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573529; cv=none; b=q/TpadB0F0a9+nbn6Lrm0fd9ZRRwQ5z8Xz0iQqdSanqwXfmYbnCsLDGzo9RWKz0i/yjrr1uPnPmCzc/GnSpbXOvMMXvsYBFJFcLEhrb2cJ2TQ7DmQiQROLbcxqqTTwmropTYULX3rJsFpTinaNNMDuZwO+maedaufcY6quE5WMg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573529; c=relaxed/simple; bh=M1LNRTP++ni6j86RT9Rb5Y7RmFRtlZo8BBJFYlsbVjE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TsFA1tnifuDpuur/Xhw6NP3moJc3WAVm+2qV4dDEFjMWYgjn7t/8N2IMkkYxKkTAyNvt4xSHo9VkO6MPmj0hyp2JREVbmQSTNDeLWcxA608CpYpLXQiiozokq/QMsKFd67KzkNbXAXK86KBgl/F8GeOlXZ/UoPoMz7MMjZ25gE4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=UqHJOYRL; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=+rybI6sz; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="UqHJOYRL"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="+rybI6sz" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1738573526; 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=akjX6ejZy6yrjMb8T4TWrINw3z0nyCa+K645jeCYdtU=; b=UqHJOYRL16V8iJkhRHeGNFCghjH4fyhS1flQsI2QrAvDEHe13267dEjB6OtyxCq2nrOXm8 Wi6Ce7ido4LLW4mO3Hk+sz30Xnh7ddepdAADMIenVUaAwkH4VpuNtGyySMClyJrsKteEgy BhHewXdJG96x6RTzomwjwGMu8Rdq2NwVWPyc9yDj4WcNkO9DzTreQ2EMs5X65r9/I8Q/J3 +AwuVUUtXpACdl+Zta9bPe17LQRBNm3zn3i0EJD/KTks5iV2B48iKIgWxg+RguF5Id+7EL MM7iU4gQUFKSbecqSHzFKIfu0JsPCXza0t+XhsDa0mpOvwf8oZLtBXqqCna6Rw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1738573526; 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=akjX6ejZy6yrjMb8T4TWrINw3z0nyCa+K645jeCYdtU=; b=+rybI6szJmwaOxnMbGkpE1H0dn8OSbN7Z3I5x0wi1pTVv5WtLBpnD1xPYrt6z2X0Vh+rtz 7Oj39xC4G/+BxuDg== Date: Mon, 03 Feb 2025 10:05:16 +0100 Subject: [PATCH 15/16] selftests: vDSO: vdso_test_gettimeofday: Make compatible with nolibc Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250203-parse_vdso-nolibc-v1-15-9cb6268d77be@linutronix.de> References: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> In-Reply-To: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> To: Kees Cook , Eric Biederman , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev, =?utf-8?q?Thomas_We?= =?utf-8?q?i=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1738573516; l=811; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=M1LNRTP++ni6j86RT9Rb5Y7RmFRtlZo8BBJFYlsbVjE=; b=tc0ELT6WhbHsJLvQddowjngOvtPYhzILhrX41ImTVVgJKAtZb4t+Iv2gwURamYqufz368zilT ejOhdeac9lPB6l0Kn3cv1zKLlfQXV+b1zaxTjWqCUDh/C26xTuB7yD8 X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= nolibc does not provide these headers, instead those definitions are available unconditionally. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/vDSO/vdso_test_gettimeofday.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/vDSO/vdso_test_gettimeofday.c b/tools/testing/selftests/vDSO/vdso_test_gettimeofday.c index 636a56ccf8e4e7943ca446fe3fad6897598ca77f..9ce795b806f0992b83cef78c7e16fac0e54750da 100644 --- a/tools/testing/selftests/vDSO/vdso_test_gettimeofday.c +++ b/tools/testing/selftests/vDSO/vdso_test_gettimeofday.c @@ -11,8 +11,10 @@ */ #include +#ifndef NOLIBC #include #include +#endif #include "../kselftest.h" #include "parse_vdso.h" From patchwork Mon Feb 3 09:05:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13957097 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46FEA1FFC60; Mon, 3 Feb 2025 09:05:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573530; cv=none; b=C2BXmQt8cZ41KOYWOZ9KAZTiLzJskh7wRmAorWzSXpexWIFywlWY6g2cdoY821E4zgq8+Hk00y92NSSOPfZ+plPQKDQGK3Q78kIERYpBfr8At0hvxaPvbnwWDk13j+EQkS5LDipkNw1gh4CmbTvI+ELaZu31m3vbLdQtMaD4huE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573530; c=relaxed/simple; bh=io6sXt7iIEpqclAN5udDVtDQPsKQqT7YCXVo80AmeIk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AFUgl10Vr+uf2PG685b5w5pVFshppzguRoYhgcmZrE3vh2fKnBR62c5AI1Ku9YQ51Bw4aLGmynM+WXY+dkCzg6RPqi7/u/WsXWcUFl5ZErZAcrIyHyMHXiKZ+yxJGHuKFFjdkWfTxBb6IogFCKu+rG6yICyEY0Lx4MSATe9p8qo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=tu8Hh9hb; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=M1mKAq5B; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="tu8Hh9hb"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="M1mKAq5B" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1738573526; 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=wWWpuwHkmHsBX34pcGl1jvCG52qLLh0La3Bmm84Eboo=; b=tu8Hh9hbsWetkIDgzcpH2nG14ZI8nV2lcq3oKrs+KHbFh8KtE4qTpI38Igq94jhAvFsFQj 3yY9SX6JdKiD8tVe2lUU9LRtsvnnjdn1JhlJXI2mhmuz8+sLGmg738B9CYWqJu3GcKAmBR eAZBHmf/DNUJNQ4HU3P4/HKvBWjUi8TdvgzhWp8BgOqw/UWfqmIFX4Ii8DQWyiZRkNMGxo XnDY1pvwSsJZetB95mma2AdKtOTPOicddBbhqUJKIL7EuaTezJuUX5Ac44BaK7XUGYnMqr qMdTdJVpXfOXIriZL4wt6wd6AqBXU45ogl118Na0xqoUU0pDPq51ih4XZk2scA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1738573526; 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=wWWpuwHkmHsBX34pcGl1jvCG52qLLh0La3Bmm84Eboo=; b=M1mKAq5BEsyd2vw89rzEqIJlchsRF4h8bG5ZOfxZUaEDBVmgPocf4eab2VMqxI3symVNg2 4ntxneSBMmqJbIAA== Date: Mon, 03 Feb 2025 10:05:17 +0100 Subject: [PATCH 16/16] selftests: vDSO: vdso_standalone_test_x86: Switch to nolibc Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250203-parse_vdso-nolibc-v1-16-9cb6268d77be@linutronix.de> References: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> In-Reply-To: <20250203-parse_vdso-nolibc-v1-0-9cb6268d77be@linutronix.de> To: Kees Cook , Eric Biederman , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev, =?utf-8?q?Thomas_We?= =?utf-8?q?i=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1738573516; l=6263; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=io6sXt7iIEpqclAN5udDVtDQPsKQqT7YCXVo80AmeIk=; b=GwjI5bSquW7zdPwOw/ObHOwJd3uaE2TURfhr6wXyXJSxHF8582pBDftmeCnGijOcc4+cOJsgI vZbb5XCvvLxC6Hni87Pvz2ilsFxfk0A2G8pgIDBOlJWWLW/J36zx9Uk X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= vdso_standalone_test_x86 provides its own ASM syscall wrappers and _start() implementation. The in-tree nolibc library already provides this functionality for multiple architectures. By making use of nolibc, the standalone testcase can be built from the exact same codebase as the non-standalone version. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/vDSO/Makefile | 8 +- .../selftests/vDSO/vdso_standalone_test_x86.c | 168 +-------------------- 2 files changed, 7 insertions(+), 169 deletions(-) diff --git a/tools/testing/selftests/vDSO/Makefile b/tools/testing/selftests/vDSO/Makefile index bc8ca186fb877dc11740c37f1e07e45e84c2ae92..12a0614b9fd4983deffe5d6a7cfa06ba8d92a516 100644 --- a/tools/testing/selftests/vDSO/Makefile +++ b/tools/testing/selftests/vDSO/Makefile @@ -22,13 +22,17 @@ include ../lib.mk CFLAGS += $(TOOLS_INCLUDES) +CFLAGS_NOLIBC := -nostdlib -nostdinc -ffreestanding -fno-asynchronous-unwind-tables \ + -fno-stack-protector -include $(top_srcdir)/tools/include/nolibc/nolibc.h \ + -I$(top_srcdir)/tools/include/nolibc/ $(KHDR_INCLUDES) + $(OUTPUT)/vdso_test_gettimeofday: parse_vdso.c vdso_test_gettimeofday.c $(OUTPUT)/vdso_test_getcpu: parse_vdso.c vdso_test_getcpu.c $(OUTPUT)/vdso_test_abi: parse_vdso.c vdso_test_abi.c $(OUTPUT)/vdso_test_clock_getres: vdso_test_clock_getres.c -$(OUTPUT)/vdso_standalone_test_x86: vdso_standalone_test_x86.c parse_vdso.c -$(OUTPUT)/vdso_standalone_test_x86: CFLAGS +=-nostdlib -fno-asynchronous-unwind-tables -fno-stack-protector +$(OUTPUT)/vdso_standalone_test_x86: vdso_standalone_test_x86.c parse_vdso.c | headers +$(OUTPUT)/vdso_standalone_test_x86: CFLAGS:=$(CFLAGS_NOLIBC) $(CFLAGS) $(OUTPUT)/vdso_test_correctness: vdso_test_correctness.c $(OUTPUT)/vdso_test_correctness: LDFLAGS += -ldl diff --git a/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c b/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c deleted file mode 100644 index 500608f89c66b5747e3d845ebc54e4c3a35b6ccd..0000000000000000000000000000000000000000 --- a/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c +++ /dev/null @@ -1,167 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * vdso_test.c: Sample code to test parse_vdso.c on x86 - * Copyright (c) 2011-2014 Andy Lutomirski - * - * You can amuse yourself by compiling with: - * gcc -std=gnu99 -nostdlib - * -Os -fno-asynchronous-unwind-tables -flto -lgcc_s - * vdso_standalone_test_x86.c parse_vdso.c - * to generate a small binary. On x86_64, you can omit -lgcc_s - * if you want the binary to be completely standalone. - */ - -#include -#include -#include -#include -#include - -#include "parse_vdso.h" - -/* We need some libc functions... */ -int strcmp(const char *a, const char *b) -{ - /* This implementation is buggy: it never returns -1. */ - while (*a || *b) { - if (*a != *b) - return 1; - if (*a == 0 || *b == 0) - return 1; - a++; - b++; - } - - return 0; -} - -/* - * The clang build needs this, although gcc does not. - * Stolen from lib/string.c. - */ -void *memcpy(void *dest, const void *src, size_t count) -{ - char *tmp = dest; - const char *s = src; - - while (count--) - *tmp++ = *s++; - return dest; -} - -/* ...and two syscalls. This is x86-specific. */ -static inline long x86_syscall3(long nr, long a0, long a1, long a2) -{ - long ret; -#ifdef __x86_64__ - asm volatile ("syscall" : "=a" (ret) : "a" (nr), - "D" (a0), "S" (a1), "d" (a2) : - "cc", "memory", "rcx", - "r8", "r9", "r10", "r11" ); -#else - asm volatile ("int $0x80" : "=a" (ret) : "a" (nr), - "b" (a0), "c" (a1), "d" (a2) : - "cc", "memory" ); -#endif - return ret; -} - -static inline long linux_write(int fd, const void *data, size_t len) -{ - return x86_syscall3(__NR_write, fd, (long)data, (long)len); -} - -static inline void linux_exit(int code) -{ - x86_syscall3(__NR_exit, code, 0, 0); -} - -void to_base10(char *lastdig, time_t n) -{ - while (n) { - *lastdig = (n % 10) + '0'; - n /= 10; - lastdig--; - } -} - -unsigned long getauxval(const unsigned long *auxv, unsigned long type) -{ - unsigned long ret; - - if (!auxv) - return 0; - - while (1) { - if (!auxv[0] && !auxv[1]) { - ret = 0; - break; - } - - if (auxv[0] == type) { - ret = auxv[1]; - break; - } - - auxv += 2; - } - - return ret; -} - -void c_main(void **stack) -{ - /* Parse the stack */ - long argc = (long)*stack; - stack += argc + 2; - - /* Now we're pointing at the environment. Skip it. */ - while(*stack) - stack++; - stack++; - - /* Now we're pointing at auxv. Initialize the vDSO parser. */ - vdso_init_from_sysinfo_ehdr(getauxval((unsigned long *)stack, AT_SYSINFO_EHDR)); - - /* Find gettimeofday. */ - typedef long (*gtod_t)(struct timeval *tv, struct timezone *tz); - gtod_t gtod = (gtod_t)vdso_sym("LINUX_2.6", "__vdso_gettimeofday"); - - if (!gtod) - linux_exit(1); - - struct timeval tv; - long ret = gtod(&tv, 0); - - if (ret == 0) { - char buf[] = "The time is .000000\n"; - to_base10(buf + 31, tv.tv_sec); - to_base10(buf + 38, tv.tv_usec); - linux_write(1, buf, sizeof(buf) - 1); - } else { - linux_exit(ret); - } - - linux_exit(0); -} - -/* - * This is the real entry point. It passes the initial stack into - * the C entry point. - */ -asm ( - ".text\n" - ".global _start\n" - ".type _start,@function\n" - "_start:\n\t" -#ifdef __x86_64__ - "mov %rsp,%rdi\n\t" - "and $-16,%rsp\n\t" - "sub $8,%rsp\n\t" - "jmp c_main" -#else - "push %esp\n\t" - "call c_main\n\t" - "int $3" -#endif - ); diff --git a/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c b/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c new file mode 120000 index 0000000000000000000000000000000000000000..4d3d96f1e440c965474681a6f35375a60b3921be --- /dev/null +++ b/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c @@ -0,0 +1 @@ +vdso_test_gettimeofday.c \ No newline at end of file