From patchwork Wed Jan 15 05:47:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13939848 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 85569C02180 for ; Wed, 15 Jan 2025 05:48:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1C295280001; Wed, 15 Jan 2025 00:48:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 171176B0093; Wed, 15 Jan 2025 00:48:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01127280001; Wed, 15 Jan 2025 00:48:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id D727F6B0092 for ; Wed, 15 Jan 2025 00:48:39 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 9E2DD807FF for ; Wed, 15 Jan 2025 05:48:39 +0000 (UTC) X-FDA: 83008606758.09.5D2C1FC Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf09.hostedemail.com (Postfix) with ESMTP id A6EEF140007 for ; Wed, 15 Jan 2025 05:48:37 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=daynix-com.20230601.gappssmtp.com header.s=20230601 header.b=BkkBRoWm; spf=pass (imf09.hostedemail.com: domain of akihiko.odaki@daynix.com designates 209.85.216.49 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=1736920117; 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=Akn62yShjkzTVW+wH6ehtLyqM9iw3YLFKJEmmviG+rI=; b=BXWSL5JW7PV9nBJf9O1lUym88jkAd1bcGeAT9XB1e5Spwyxp+lp5PPAKn1GO6IGr8w7xKA QjOM3vIguug6zgYq7FqHq1m5OBc9/SkXIC2z2oY6v7I6c0N9Ha/otaiYeRmS/PE6t5gk62 rpwNBymn17+XXRBDuVj8EcqnYAH/TzA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736920117; a=rsa-sha256; cv=none; b=PDIimIGx4MPrfi6aFFyae9bu8nE1VrSAECdjH5InRTqBLU15l9RF++MntcJNaNe7tJinbl 5/1gPsWcHJmfAcCIbGB5ypRy8n9wwS8iZuItjYUvZKHccGElcEDmb2cAastPrQoSY9Wa5B SU46o6xXqNJXaVA5v5di88x0am3PHPA= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=daynix-com.20230601.gappssmtp.com header.s=20230601 header.b=BkkBRoWm; spf=pass (imf09.hostedemail.com: domain of akihiko.odaki@daynix.com designates 209.85.216.49 as permitted sender) smtp.mailfrom=akihiko.odaki@daynix.com; dmarc=none Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-2f44353649aso8354449a91.0 for ; Tue, 14 Jan 2025 21:48:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1736920116; x=1737524916; 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=Akn62yShjkzTVW+wH6ehtLyqM9iw3YLFKJEmmviG+rI=; b=BkkBRoWm08D25uKn3PxtCYc2DiddIk2bDZH08x5MXcM9jAW53uOdOARvYda9t5wTat E8aSDugoydmCeSv1WcY2eylLSn2JPLi3KObeoiij3LPCuTze/9lgxttsQLJQO3m13h6A tIBImcruYa+Q4/ha1M4vVYotE7WxcJuHOfJeWAPLHiVf9aGVlWfDP9jN2g3ne50UXH2h dfn+wYKxrnDsihept52qf9uYYewk/25BqLISLN2JeNSj+iAnj/t6/m1Sqsd7OzdY4Agc wAL6/XoNuE10Z7PrYzJ+rD04PMs6PQA4PBkoK+Ge2iwynuxaXIguhD8UtypjNk71QoYb 56KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736920116; x=1737524916; 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=Akn62yShjkzTVW+wH6ehtLyqM9iw3YLFKJEmmviG+rI=; b=CMtasPE9POEa/o5Sv6bhMqzu46dtOlp97K3UklZ6h4D/L+a0NRqhL8KGhBjUOOhuxA u/n/P6vSxfgaAmftwA4sB7bq1+mWn8XcS2Sqwz/u94vLEu8t9yJgwVgwsmr6KFDrOE61 ka9L0PRZc/SwvGyLcyh777pS/N5eb6/79rT66g36OUe+jnT2WrJ2FmHQV0KFwbYrcF6e PCTCuwkSOsbvV4ky8pOFwyYO7y23EWEFiJSYNtoERHBqppFCOjTsAwqq+E3RaJeDRfSP CRYgIo/ZEyy3nWKdvO7BYeDdl10chwO54mDZh/um+vH5rK8g7PsDyWy/3yFApPm6Vff2 Exfg== X-Gm-Message-State: AOJu0YwhoigtkDw1vlIe5a0Y86RGwn5XYZ0tr+RDTy/LSvnZjT9Ipuf4 zoPn52sZ8Vd5XbBzyR9Q2rixg52mWl22PLWhXba4ZkLPL11pZOv3sir0BkvFwTU= X-Gm-Gg: ASbGncuIosgCDouocbKrL3vMB3JoMM5gGxn2AeTCVoCxsK710ULhzYOzt0XEcW7QfUx oKInzB9bt7mtypfS0kvS9N3rEZQ6yQJLY+W0Rexp4Xg0KLsr42NEMaeX8VVPfFnCgDSjduJKhiE uDj4o82ZkRDHZ92BvsA98sIDoBXC/U4mdfbIIxOCRC3b1+0LE2FXV3Sex6ikvS22mTh4xBCLp9a TnAIXA/f0uyZtIrrpFZPCOSNnKwMI2Hucxmu6wQjWsNya1ukpjmJD197oo= X-Google-Smtp-Source: AGHT+IGTAFr6fQ9a6YArcK/8amGmkIoCg+M7qyB/EhAZVK1D/0q1h57yniAmS1nzzXQhV2aOnFsX2A== X-Received: by 2002:a17:90b:3bc3:b0:2ee:bbd8:2b9d with SMTP id 98e67ed59e1d1-2f548f75de6mr34075229a91.34.1736920116365; Tue, 14 Jan 2025 21:48:36 -0800 (PST) Received: from localhost ([157.82.203.37]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-2f72c1cb28csm504577a91.21.2025.01.14.21.48.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Jan 2025 21:48:35 -0800 (PST) From: Akihiko Odaki Subject: [PATCH v5 0/6] elf: Define note name macros Date: Wed, 15 Jan 2025 14:47:57 +0900 Message-Id: <20250115-elf-v5-0-0f9e55bbb2fc@daynix.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAA1Mh2cC/2XMyw6CMBCF4VchXVsz04tYV76HcdHLoE0UDBgCI by7BTTBsDyT+f6BNVRHatgpG1hNbWxiVaahdxnzd1veiMeQNhMgFAoETo+CuyOQlUYZLw1Ln6+ aitjNlcs17Xts3lXdz9EWp+vXCz37Fjny3JBRIDUEDedg+zJ2e1892RRoxQ9pQFALEhx4ngcvC A7BKdoguUb5gmRCxninQTu0TmyQWiHEBamEnDwqLCwEH8wfGsfxA3RS27E2AQAA 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 , Heiko Carstens X-Mailer: b4 0.14-dev-fd6e3 X-Rspamd-Queue-Id: A6EEF140007 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: 3ubirek7e8syy5zom9z9w61x1ainr4qk X-HE-Tag: 1736920117-818870 X-HE-Meta: U2FsdGVkX1+tDKsOqQujkccd9CUByyauoiwqEFeFXXPTN4avobGH/olvEb4qes4UZFT/SCpIPWLSW0l12joZZFK3TO2Ojn/IIv9Y8KJcPvXvZ900HHBVTqQLaNdT1CeL21FZw2qA5cnk0zvZ6cDM1oU72nkSh2VhPYT0lHUxy5264CWgybF4nNQWf+Jrzu6hj9MnDqNgpUg4x9AERgCi7Wb1DHljWtcCEe9dAaQocEtxw1+Cut5+oblOnPQ2qqHJ8VTwjMngCSVcSwcjUyhmRYkox05+DXHcEbJbskadJQc+ursbStD00GS2Kbu65Ri8kGdybzC80z5Y0Ywmu8psrtNQ0VuW9e5sOG663cetjU14qnL8X6K3MLDQX5hviHU6EQZ+lDg4IFYVzd5sw/c4Uy78BSHqq6/napQKo2DxB7wI6KqOb7+2+Db2ZnvTVEL1h65mHhj7WWOmmOVNTPR8lCuDXujAlQ32Sn9+XVHFK41xTbW8M1WOlcKITkwWlSdwraRA5fCDREng0AruVOESxCIWNlJ+fwjfwoCiDehBE4d9c8WbVGpE0lMvI9l3wX2fkNLpbk2UlO8S9zcGl3u4v3uah54VDgZjv2DwNA6X/MuwAqVyjidu9TINIUvTwtenWKaq8/52jAZnD5YSWVtm3DWyq37GktqKswzBRdn8ruyF16YldH1w1b9wrsPwpsggpVC3kQWb4XGY0VIpjOuefk0WP0mMBA4XjbZoZlEtiqfhuaI0GNyXchu2vrdC+l7dMqFEBggqGZ+qFOZ7lXw1ukWhuC/1hp+Di2Su2iuqtEsQ2hRLeHGSJwDoNiu6XQmsFhrr6nLVymc2OZECjNaypWxB1+Lw6zKyCg49xLMqiucM4xdCirEI1rTrsxiIPkqT0ubSTnfiVtp2h+Dt+1MnIOo4eWw/uCeDUb0ad3VqqKe/nrKowuUDpj+TtYkj5PA/LQPctSKioxQ/OeDJOHQ WloIRauX WncI436qyD0ZGYLy54lr0dRROeA+rlrZj98jqmRmka1/UMoYcZbpHUSr+5zqNgELMJISdGv3ykyYMaOwTShc/pf8MUODUkaGnHLLk3PSBoW0Ayf092vDFencw6X33QTZkt2VE/Q+N8dNHEPv7WHzZ0NyIdEYNAEelKMyWfBIrMXcteNgz5TR1VttrCCu2fRtd4nXpSZ+DgQvRW7OiDLCQkdf9rq4Rlma6mLJh2TA+rAdNpdXuU83vecVU9ebW3fx26sZk6SCb6CHpy8AXNBTdQo+hY8gjSmYffp8KfWGEPNXehumX5WfavLAVc/GPEmuMP/tgqh8txi/Z4UQhqvMlEcGnQTBf5f4yR8srWMZdofS4k+0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.001654, 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 v5: - Noted that patch "elf: Define note name macros" allows removing duplicate definitions of note names. - Reordered NT_GNU_PROPERTY_TYPE_0 to precede notes used in ET_CORE to show its not specific to ET_CORE. - Link to v4: https://lore.kernel.org/r/20250111-elf-v4-0-b3841fa0dcd9@daynix.com 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 | 89 ++++++++++++++++++++++++++++-- kernel/crash_core.c | 2 +- 10 files changed, 134 insertions(+), 75 deletions(-) --- base-commit: a32e14f8aef69b42826cf0998b068a43d486a9e9 change-id: 20241210-elf-b80ea3949c39 Best regards,