From patchwork Sat Jan 11 05:48:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13935787 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3BD8E7719A for ; Sat, 11 Jan 2025 05:48:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 077E06B009A; Sat, 11 Jan 2025 00:48:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 027DA6B009B; Sat, 11 Jan 2025 00:48:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E0AC26B009C; Sat, 11 Jan 2025 00:48:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id C28406B009A for ; Sat, 11 Jan 2025 00:48:57 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 42C921A10BB for ; Sat, 11 Jan 2025 05:48:57 +0000 (UTC) X-FDA: 82994092314.15.C486514 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by imf29.hostedemail.com (Postfix) with ESMTP id 6CF8A120005 for ; Sat, 11 Jan 2025 05:48:55 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=daynix-com.20230601.gappssmtp.com header.s=20230601 header.b=yh5iMfl3; spf=pass (imf29.hostedemail.com: domain of akihiko.odaki@daynix.com designates 209.85.216.54 as permitted sender) smtp.mailfrom=akihiko.odaki@daynix.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736574535; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=3P73rJyuNl3Q0nwSoWVJRyshylUCVEtly88Ev7msAUs=; b=3GR8z+BD4V2CAjcDXbfAW7teIRsswJgY7gBg7iTOjxYECtrgrOdJCz6yv6m2k5th9XuIx3 T/NQd1CGxPfNPh7y41ig3IJ5p+weS37eIv+wgt/h3GVEGUfHzDoziBuu6X52zcsiQFlIRa bRcvW+iOn4XvcRpnqhe7osHgAcIfmhg= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=daynix-com.20230601.gappssmtp.com header.s=20230601 header.b=yh5iMfl3; spf=pass (imf29.hostedemail.com: domain of akihiko.odaki@daynix.com designates 209.85.216.54 as permitted sender) smtp.mailfrom=akihiko.odaki@daynix.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736574535; a=rsa-sha256; cv=none; b=rVAGtjl3w838CkTiV0+8vwCwwW07EOS19UmUU5W3zHbk0Qf3pngjBBjfnl2dD606W1uLAp ClWhFQY9bmeeGKRnDest6txVgniX5+oy1E2eul36NwOGj5wCYjaCfZCfi4NMgBtiUj/r2X izVOU5vJ5jOBLsxAMolNncaBVhB7TxI= Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-2ef6c56032eso3535180a91.2 for ; Fri, 10 Jan 2025 21:48:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1736574534; x=1737179334; darn=kvack.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=3P73rJyuNl3Q0nwSoWVJRyshylUCVEtly88Ev7msAUs=; b=yh5iMfl30M1pUs+6oZT3DY/FdtHsfIQngAAV827OU4jKfJMwqYmibTkhnDoTYPGBq/ 3tgh3AHbaZW8DyEaDE31bNBlSnndx6DmszRZHJxMtbC8Bfq9//P0qyQDiOI5cVYGBkxF KDP/tcX5sxo1vPtBORcVq7gbUJzD8kGQQBHwxjPvJKZI5HDARYamkR4OSmhEtsoyK5bD DtfLt6ofMVp026HlR2chlQn8yOmDCqRLPhvofbOhEIyeERxC89lQBXXBTtpwUKexsX4H D0b4JTiqGNO4A9mVfSy94wHOFf2S3nm+EaTobgfs55vlID1wVy8IqaLTBRVCyQ+xYNGx 9bLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736574534; x=1737179334; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3P73rJyuNl3Q0nwSoWVJRyshylUCVEtly88Ev7msAUs=; b=d3Hx2wAV4jRdSwY5gpcgqo/6eT0crdS813CuP0thG3gMgIanPLM7OI9xsIPbRW8nCt 1YQxSmV+k2shhtdgbg9qDpl1bt8T2nPDTx/O72N5xcRY4kBNqHdFsx8j2LaOjRBYO/Tt h1UswdCTyydhebVirwlqkXJGrPAdwKS9+gwGkhSzGM1YS+WMeo7sxvT/Qp8jTFaumroC ZK1ZA/UTMu5dAykcY8etyW0ywOk4vdVsUEaDWkHhGciKxqGTyKqAUXgxznZRckg9bo67 9CdwUwUbKjYEfL3UVJFaHKawv6yZ8gmWq+wYC5pAHjWpgwA0wy6ra5GDT17qoP/+PoaG Z3pw== X-Gm-Message-State: AOJu0YxN9v4DPV+a6jbraJGpVlb1IK3OQZaopmHytj1YsY+qffaiqpTC ha8BUYrEc8fEF2Rd/4O4cjokxpN/Wh/r/O4HMdiq4cF6CnPAjByHfFD6AghCa5A= X-Gm-Gg: ASbGncuXyrCyKepr9jbkGak6Mhe4CyPqQmc6q12fZxKtJi1GWnfdLZlgJalIxWqC37+ 5WOS09i2SvFy/5Ly0l0kTzxCiJoeooB3nCf3bcPz6o7mJs4ysmWkP4tZqETQvBFIiAww9edWA+1 V+JmYGh3BXjplGlz/y+w0dr4C8rorKpT+EYsntx0VteD6ec4Tjj3YcEA8Q7eIrt4la2apiWW1C/ SNE91Aol0aZvtV7hzmgvjfIrKuA+EY5V6Boi762iCHR11Va+X4stZSwkag= X-Google-Smtp-Source: AGHT+IHnxhywBj4CVIR5TvzIlJFphpilQTNTWugzFhTp+kcciB5abGLTfjWrtU8KJEUcfzvGCQC8ng== X-Received: by 2002:a17:90b:538e:b0:2ee:3cc1:793a with SMTP id 98e67ed59e1d1-2f548f580femr19629798a91.29.1736574534006; Fri, 10 Jan 2025 21:48:54 -0800 (PST) Received: from localhost ([157.82.203.37]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-21a9f1372e7sm21407345ad.83.2025.01.10.21.48.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Jan 2025 21:48:53 -0800 (PST) From: Akihiko Odaki Subject: [PATCH v4 0/6] elf: Define note name macros Date: Sat, 11 Jan 2025 14:48:43 +0900 Message-Id: <20250111-elf-v4-0-b3841fa0dcd9@daynix.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIADwGgmcC/2XMywrCMBCF4VcpWRuZ3Kxx5XuIi1xGG9BWEgktp e9u2iooLs8w3z+ShDFgIodqJBFzSKFry5CbirjGtFekwZdNOHDJOAOKtwu1e0AjtNROaFI+HxE voV8qp3PZTUjPLg5LNLP5+vZcLT4zymitUUsQCryCozdDG/qt6+5kDmT+QQoYyBVxCrSuveMIO 28l/iHxjeoViYK0dlaBssxY/oOmaXoB8zVRagEBAAA= To: Eric Biederman , Kees Cook , Catalin Marinas , Mark Brown , Dave Martin , Baoquan He , Vivek Goyal , Dave Young , LEROY Christophe Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, kexec@lists.infradead.org, binutils@sourceware.org, devel@daynix.com, Akihiko Odaki ,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NLkbrzPchWbHvRq6Ep8twJekl9beN4bo5FSHQVmFNhTqIgLUgDkqCkSP3MGx 1Ss7GsQZ ejmxdVZaQISvQQ2aOAqqFGpQ7J44H/jeMgWWfWkOmiK8HOgAfk9pJOQtamX3c5kQIhyo5bC30wU4eqeYyxnNRKJT5R+AFtqcTBjuVCDFOZKYG2ZAzhIy7pBpzKfOUlyaPMXHYZkXUUs+Iqk6W6kOh6lzaLR6TZjwOgM9wRfQFIgHe0ssmn9xvGJRBRvjS+vfOyzH2vvBx58y/Wh9jS2KrO/eiR94h7RcedbcSPZxsBHsVNsgtOyK/m1rIMo2bt4uO8tV7oivxHUAuUuPDMWPOYBgGhRi/TbFf7x0BGqHVFbgws3mQ8xHFwXqJ8rwvyaTxKjfJYMaApsO3QxDP0AWBaJ/96p7NJIOm7Ba3mCKlSwqRIDs= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000573, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: elf.h had a comment saying: > 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". However, NT_PRSTATUS is also named "CORE". It is also unclear what "these types" refers to. To fix these problems, define a name for each note type. The added definitions are macros so the kernel and userspace can directly refer to them. For userspace program developers --------------------------------------------------- While the main purpose of new macros is documentation, they are also hoped to be useful for userspace programs. Please check patch "elf: Define note name macros" and if you have a suggestion to make it more convenient for you, please share. I added the Binutils mailing list to the CC as it contains code to parse dumps. I'm also planning to share this series on LLVM Discourse. Signed-off-by: Akihiko Odaki --- Changes in v4: - s/powwerpc/powerpc/ - s/NT_INIT/nt_init/g s/NT_SIZE/nt_size/g - Removed parentheses that have little value. - Fixed the code alignment in get_cpu_elf_notes_size(). - Link to v3: https://lore.kernel.org/r/20250107-elf-v3-0-99cb505b1ab2@daynix.com Changes in v3: - Added patch "s390/crash: Use note name macros". - Changed to interleave note name and type macros. - Described NN_ and NT_ macros. - Link to v2: https://lore.kernel.org/r/20250104-elf-v2-0-77dc2e06db4e@daynix.com Changes in v2: - Added a macro definition for each note type instead of trying to describe in a comment. - Link to v1: https://lore.kernel.org/r/20241225-elf-v1-1-79e940350d50@daynix.com --- Akihiko Odaki (6): elf: Define note name macros binfmt_elf: Use note name macros powerpc: Use note name macros crash: Use note name macros s390/crash: Use note name macros crash: Remove KEXEC_CORE_NOTE_NAME arch/powerpc/kernel/fadump.c | 2 +- arch/powerpc/platforms/powernv/opal-core.c | 8 +-- arch/s390/kernel/crash_dump.c | 62 ++++++++------------- fs/binfmt_elf.c | 21 ++++---- fs/binfmt_elf_fdpic.c | 8 +-- fs/proc/kcore.c | 12 ++--- include/linux/kexec.h | 2 - include/linux/vmcore_info.h | 3 +- include/uapi/linux/elf.h | 86 ++++++++++++++++++++++++++++-- kernel/crash_core.c | 2 +- 10 files changed, 133 insertions(+), 73 deletions(-) --- base-commit: a32e14f8aef69b42826cf0998b068a43d486a9e9 change-id: 20241210-elf-b80ea3949c39 Best regards,