From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D0E4E77188 for ; Mon, 6 Jan 2025 14:39:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 13A346B0088; Mon, 6 Jan 2025 09:39:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0EB2B6B0089; Mon, 6 Jan 2025 09:39:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF4A06B0093; Mon, 6 Jan 2025 09:39:24 -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 D3CC56B0088 for ; Mon, 6 Jan 2025 09:39:24 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 29FB9C15F7 for ; Mon, 6 Jan 2025 14:39:24 +0000 (UTC) X-FDA: 82977285048.14.6B6C609 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf13.hostedemail.com (Postfix) with ESMTP id 495D52000A for ; Mon, 6 Jan 2025 14:39:22 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; spf=pass (imf13.hostedemail.com: domain of Dave.Martin@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=Dave.Martin@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736174362; 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: in-reply-to:in-reply-to:references:references; bh=KScFq6VCrgf/nu/Jb5BN/GzdP0ojcAD8SI4fYCVhxV8=; b=IfUCmXFTW2knjl5X9V7yaBuvtAHZQEmjiTujFH71NOSdbaHRyyzpbBKq7H5ZtE8+AQzfnl yzSXGmIIcCEJ4mUhJY0vdVVcLijrMwa1Reu7riaSS+040yLCKAJ8fiEdDlZBu5ynix3kJc rZ/gF+htjm0ML+N5bcW2dBXeeoPjhGQ= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; spf=pass (imf13.hostedemail.com: domain of Dave.Martin@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=Dave.Martin@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736174362; a=rsa-sha256; cv=none; b=P/lLtgk3Cnt3x4tlTz64BWclDqYpb21bzE0o5J3ZS/YKKeCt9RwCptDzwoHTXCpjX3aZ4K F7M4tqZe9qnpHTKf897N2aZdWDpJc0A/PAh4VAfEPYoWYZjscZRLl8c0I05ep0b+oRHuSI of/PgqO5Flble2Suey9Q93lL3jv5yug= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 85C64143D; Mon, 6 Jan 2025 06:39:49 -0800 (PST) Received: from e133380.arm.com (e133380.arm.com [10.1.197.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 052903F59E; Mon, 6 Jan 2025 06:39:18 -0800 (PST) Date: Mon, 6 Jan 2025 14:39:13 +0000 From: Dave Martin To: Akihiko Odaki Cc: Eric Biederman , Kees Cook , Catalin Marinas , Mark Brown , Baoquan He , Vivek Goyal , Dave Young , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, kexec@lists.infradead.org, devel@daynix.com Subject: Re: [PATCH v2 1/5] elf: Define note name macros Message-ID: References: <20250104-elf-v2-0-77dc2e06db4e@daynix.com> <20250104-elf-v2-1-77dc2e06db4e@daynix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250104-elf-v2-1-77dc2e06db4e@daynix.com> X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 495D52000A X-Rspam-User: X-Stat-Signature: 9ux6kjanxc1n7jhcutzdqw98be4ygxxf X-HE-Tag: 1736174362-689226 X-HE-Meta: U2FsdGVkX1//uu4syYysqh8dPFxIP4KQHCBloZgZeTM0sz3cLevYjj1t6+S2F3XrpZavbDHu1SOiNdfmzfLgVxHqTHatdGZOFvjvwYtLXwrNpI4m3PVW4yXQfhV8FHWCTrf5ALVTAF1vc2HcJuHsK3Lk9RHgP3S+PgP9LDmXlXDkE/Xb7rmWVrcAq9eavnMArCbY7YAPY1hfxersubMKgegrjM60PtSr7jwh51L/7QN/BS+NiJSW7UZfvwNPeFgOp5ObPIRN8g0J73tbwb/dnwJ8QZCLyts5tGPNthdt6mzcwELV9CQBGFOaIivdDd0I94D+IhfhqFuXnDLHWVKG4t7+I1OYn40rWMI79tIj1hxa/M98GiwaM3SwLcoCrHDfSvICoqya8Bio8EdvumT4bMAHENFFMkmpgBGpVQ4M9X1BPcjN8jwr5AmEhL3/obaDMr03gUbDKGEGewHgslsQT8z5QcswzxwsrIYmDQTcK31HYkRaCb25fAoxXMTB1cyWnnNPTTkk1Y5a9nvTrMhUBYODtf/RG9W1MoMpyotg8JFznqWQv3TzZyn5gb7jWXqv6j3zHS2V+Nl4m51hthRQbON+EODWLiqc2m9SbKWjR6FXaXTpf5xY4LkIIcDY2hfx0ZKWhI3bxc7At0O/8fns0A3GtDlJi6+jPwG4u80ff92DGjB305+ViMymdSpqdh2NRQN74XsRB7bENSlJLV2RVXR/PEly1HHFYHbOGxLmbuseiq39BZpK/p/biVQ9gcHnWTkXhMxLynRenBlpP8+nKIyHfKeEImH0OpZKaby97Q5mOGCkQ8u2y9R5uymCrTQbU4VEE3/47e2yMlWt5LrH8zLl/EBJf07LhMFsc9LiZ4NhWj6iSpaul8YqUTY5nFCjT2rubi3PkotShJHwN8hxKAahRf3hRvg/Fgw96ItrSiP/sA4n+/QtYCevo66xG4pcdF+uLHmimt3nebDKOQv NyQLivIX D34+wrtd+y17DhCcTrXbMkQ9tgeKtr0ObDQ8beg1zzkSWGkF5Rr+oftgDOcnruNv/0wy+I5oNMqkZKqpiRV9KpWTEOgngXgPwYNep5jLmJ/4DJxvzSNYNTV4/ZiM/1XmVIsfQKYMGhNRFGxtciW0tri6P2GUoygPhm3a0O+BuRH2f0sqGJZ2bYojnIlGXie7xzPP1k6kLDweDS1M= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Sat, Jan 04, 2025 at 11:38:34PM +0900, Akihiko Odaki wrote: > 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. > > Signed-off-by: Akihiko Odaki > --- > include/uapi/linux/elf.h | 86 ++++++++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 83 insertions(+), 3 deletions(-) > > diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h > index b44069d29cec..014b705b97d7 100644 > --- a/include/uapi/linux/elf.h > +++ b/include/uapi/linux/elf.h > @@ -372,8 +372,6 @@ typedef struct elf64_shdr { > * 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". Maybe most people would find it obvious, but is it worth saying what the NT_ and NN_ macros are for? They can easily be explained in terms of the elfXX_note struct fields. > */ > #define NT_PRSTATUS 1 > #define NT_PRFPREG 2 > @@ -460,9 +458,91 @@ typedef struct elf64_shdr { > #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" */ > +/* Note used in ET_EXEC and ET_DYN. */ May just "other notes"? I think that the comment might bitrot over time. > #define NT_GNU_PROPERTY_TYPE_0 5 > > +/* Note names */ > +#define NN_PRSTATUS "CORE" Can these be interleaved with the NT_ definitions? I think this would make the resulting header (and the diff) easier to read. > +#define NN_PRFPREG "CORE" [...] > +#define NN_GNU_PROPERTY_TYPE_0 "GNU" [...] Cheers ---Dave