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 DA01BE77188 for ; Tue, 14 Jan 2025 12:22:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F9036B007B; Tue, 14 Jan 2025 07:22:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4A91A6B0083; Tue, 14 Jan 2025 07:22:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3974A6B0085; Tue, 14 Jan 2025 07:22:44 -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 1B5C06B007B for ; Tue, 14 Jan 2025 07:22:44 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C5D7A1C7434 for ; Tue, 14 Jan 2025 12:22:43 +0000 (UTC) X-FDA: 83005971006.18.E0F21C0 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf27.hostedemail.com (Postfix) with ESMTP id D3DA040003 for ; Tue, 14 Jan 2025 12:22:41 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf27.hostedemail.com: domain of Dave.Martin@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=Dave.Martin@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736857362; 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=4M9snT9qbDvQ88PdgmNC6RL0sxoR82CuhIh6v4YfX4A=; b=i02Be1NkWCrNODSi4e/IvQVuYcNh78eYOYkr9IuDSZx6Hhe/yznQQf7i0jAVc8MHRVFxIU RfxOhvLORzLZjxFm1hpQsCOIIIB6QTqsSWS9bdI8qrVVWnryExDs56pUbk+VPrB8uRoA9A 33SCwaRLA/unAzCBsF980gWrDgyfp18= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf27.hostedemail.com: domain of Dave.Martin@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=Dave.Martin@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736857362; a=rsa-sha256; cv=none; b=Y7OuBuMqrhGLK7iGRvuF/9BoXHFMzBNrzx9pLdacBS+CeRglsfYQ3BG8YPIH6tsYwzsY5y 2T5PhR3aNdPg7q2ymU38itaL4ayrc+MT036h7GZ3Fvse7uCqsAydt0F5/LqAcLxE3qhggd 7Im/hr2+9ODGKbXjI0c1x3pXxo9sKuw= 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 1E61311FB; Tue, 14 Jan 2025 04:23:09 -0800 (PST) Received: from e133380.arm.com (e133380.arm.com [10.1.197.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7E5BF3F66E; Tue, 14 Jan 2025 04:22:38 -0800 (PST) Date: Tue, 14 Jan 2025 12:22:31 +0000 From: Dave Martin To: Akihiko Odaki Cc: Eric Biederman , Kees Cook , Catalin Marinas , Mark Brown , Baoquan He , Vivek Goyal , Dave Young , LEROY Christophe , 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 Subject: Re: [PATCH v4 1/6] elf: Define note name macros Message-ID: References: <20250111-elf-v4-0-b3841fa0dcd9@daynix.com> <20250111-elf-v4-1-b3841fa0dcd9@daynix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250111-elf-v4-1-b3841fa0dcd9@daynix.com> X-Rspamd-Queue-Id: D3DA040003 X-Stat-Signature: 8ihmchx4nwp3gymb1srp9snicc6cau3g X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736857361-764054 X-HE-Meta: U2FsdGVkX1+Q7x3ZLe9BGsnFTIlhY7ju5gI/y5QsxopLTGsmEIEiGw2g8cSuJunsJEbHehPa4MxC+NyyDpkrO+gaRT5BiLdoY2W4UrOax/c0ksZe0l4KKfZQQglXq/fEc7wKs9KDct+MxyW6sbfvKiRtLjHSAPeH360GxHwnigeLEW3PXGtF/yhVN5KnxjVcKpe3u1TGZTY6TL3bTlM84WpYgNnsTXqyXNOAqgME11EPUQzJcJl9GZybvIUwwHTqPaibKRvzgoEWgk/A/AuUVmrYLcUcqgMq4CmsHKqMhlvolZbi2ysjT7iBRKbXdw1zdD6IDH0WLtiSBi+66dQZLMybKPeDQSNZDS/1LCzoc+WTxr3ZS1BoP7fA98+RQ2qjZlpml1tWZokiXt7ERfoSZPkSqHitdpBfhvqh2r1VNCEVUsxmDeUAvFRI8u9JyvtcgLOVwPsy5zflzcFRR77hi92DQ7RGtdF7VwcYyuSnPuPlafNoScnAy0VOWQz3lDL3n53xhqNSuCH/wts5uvAJs8jQRdh9bFGEnzMoKKLYFOgjz6atZIx+33czExKvMrMxOpIPNeh1aiG3y3d8X3CpHcpnPxVCx2zYUWmeq/GsGZwxGQhu9C/Q+Hbc/+NtcHtxMzrZOwi3MZI25bemTJXsdrL7blbMoxcuCyV1hPnqSP6QW/C1TAUTXtILAlNVAqlNQiA67Z06myjX7a4ZZuc+V23eRgbFzRjd45+g8ME68kd5SPWFYy70AX5mPBFrphD3Pmg5Np72aSpDsCuek/Lk6RDU5DcIIEKitNY8HpWC70w/GAXNBZEf5qTO1Xi0rwiQ9zBrE4YWpQAhuM6xJuPOqqbvr3UjxjzYyQj+/9s3h411jFqMapvyObFtYjowGS/azwCFpwqTiE85kd3mYBJ5PjiPgxZ3+d49aApooUx/uYB9z/PhOC2eSkUIX0Pvlfhns1vPnCnKliHPSEGeGwl 8pYk/TrL EiQGlMrPW2clcfvb1CCcQcLmuBQIqtARHre6U6EHanR+4DikQyPgxeF9UHxE53jIXyIXO5nds+D9ZWFlIvP39h35DeE69gFG/US0Hc2cC5Ud8yLZWtkOVD4OoIAIwMNsWN9dbmGxIyXttnQS0EmTshR3K6oXv6XwCiNQT8mqD2CyY+NYjhtOSzjs3oT6fqD7cuVH/kyuhzN8bjrtmpS7UDbkjyp05H+wgAv1C89WNBlgi4ZlT3Lv8GCreiCZYab/CXqA5R7BIsv2RuBHwmi4E/0BDAlEkIQHkx8gn 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: Hi, On Sat, Jan 11, 2025 at 02:48:44PM +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. I guess another motivation is to move towards having elf.h as the single point of definition for the note names, so that obscure and duplicate logic for determining note names can be removed. (Could be worth adding a note on this is the patch is respun, but this would be overkill otherwise...) > Signed-off-by: Akihiko Odaki > Acked-by: Baoquan He > --- > 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..343f5c40d03a 100644 > --- a/include/uapi/linux/elf.h > +++ b/include/uapi/linux/elf.h > @@ -368,99 +368,179 @@ typedef struct elf64_shdr { > #define ELF_OSABI ELFOSABI_NONE > #endif > > +/* Note definitions: NN_ defines names. NT_ defines types. */ > + > /* > * 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 NN_PRSTATUS "CORE" > #define NT_PRSTATUS 1 > +#define NN_PRFPREG "CORE" > #define NT_PRFPREG 2 > +#define NN_PRPSINFO "CORE" > #define NT_PRPSINFO 3 > +#define NN_TASKSTRUCT "CORE" > #define NT_TASKSTRUCT 4 > +#define NN_AUXV "CORE" > #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 NN_SIGINFO "CORE" > #define NT_SIGINFO 0x53494749 > +#define NN_FILE "CORE" > #define NT_FILE 0x46494c45 > +#define NN_PRXFPREG "LINUX" > #define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ [...] > +#define NN_LOONGARCH_HW_WATCH "LINUX" > #define NT_LOONGARCH_HW_WATCH 0xa06 /* LoongArch hardware watchpoint registers */ > > -/* Note types with note name "GNU" */ > +/* Note used in other file types. */ For this, it may make sense to be vaguer, e.g. /* Other notes */ (We don't dump NT_GNU_PROPERTY_TYPE_0 in coredumps, but I don't think it would be nonsensical to do so.) > +#define NN_GNU_PROPERTY_TYPE_0 "GNU" > #define NT_GNU_PROPERTY_TYPE_0 5 [...] With or without those changes, Reviewed-by: Dave Martin