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 47B03E77199 for ; Wed, 8 Jan 2025 13:45:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D7AA66B0083; Wed, 8 Jan 2025 08:45:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D35586B0088; Wed, 8 Jan 2025 08:45:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C19816B0093; Wed, 8 Jan 2025 08:45:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id A40EC6B0083 for ; Wed, 8 Jan 2025 08:45:19 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 368BF1C8344 for ; Wed, 8 Jan 2025 13:45:19 +0000 (UTC) X-FDA: 82984406358.08.C6209B8 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf23.hostedemail.com (Postfix) with ESMTP id 1CC97140006 for ; Wed, 8 Jan 2025 13:45:16 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf23.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=1736343917; a=rsa-sha256; cv=none; b=BfMWWdWuHsqHUcoNg37G7rgzDqlhl0guetc05ZoTjSEdc7zTPabmKcYYhBF64RuK6aCN4I 5FD4n6JSLFfCXW8YfU64YHaBbqZYw2UOPdWxdh0FqS+DayDTyXXH0y7yuM4lz8Qp0XAEXe UgL1+Zx5ysal99lyZCAkF+j2GePZPGY= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf23.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=1736343917; 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=Dp4YiVyk7VgThiWRacmuSQVvTMLuSAHIMMx/x3SLL+k=; b=rRc6zCXXvjNTV5n3RiITWI5MR+JVoFYkz+ohak+ouT6GTHGIpwImlRRYDAX/tNSlIJxEq6 4t688Nc12uc/JacbuDg3BB8ZKMUI5CqC1DXmaPhW1KZ10MzR7EbvIS82N3b7jLVIBE/8Lx vvoJ2OXvQuBX+Rn5kMhb2vICX7DpOjM= 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 3DC2C13D5; Wed, 8 Jan 2025 05:45:44 -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 3294C3F673; Wed, 8 Jan 2025 05:45:14 -0800 (PST) Date: Wed, 8 Jan 2025 13:45:11 +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, binutils@sourceware.org, devel@daynix.com Subject: Re: [PATCH v3 2/6] binfmt_elf: Use note name macros Message-ID: References: <20250107-elf-v3-0-99cb505b1ab2@daynix.com> <20250107-elf-v3-2-99cb505b1ab2@daynix.com> <2c6f2c95-b2fc-46e0-91ce-1b9f14b28d3d@daynix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2c6f2c95-b2fc-46e0-91ce-1b9f14b28d3d@daynix.com> X-Stat-Signature: kz7ff59rjzkm91gbhn1wnu84jcdwwsx9 X-Rspam-User: X-Rspamd-Queue-Id: 1CC97140006 X-Rspamd-Server: rspam08 X-HE-Tag: 1736343916-68136 X-HE-Meta: U2FsdGVkX189v7vJW+AjqYPixNbi84QXdsk5MkTKwcqjJhBd5mlLpbAL1eEU4wnRoABCTjLdIHep7r+z6gqaR3KwBydZ42t9CLeyQS+0G8d8rrl5RcoCU4aW8fvwlVo7lXk8vG4nwN7SERCmzGmN2QUkMQpxCN8yoIifzPJjArIezsV9dog8+KGj+kqRVSkxRREBhKTxQvPOlkpOhpOy7VirC5frG4xBBhloTF+7/0HRYzFKztXileYhguxzXK6dXmswtR4xlAcyV2glEiCL5gbYt3oJCn3W/0mJfPtGWjlojPU3mNWi/tguy1PtCFtA7Bf3MvjVRtmGSeLIveGK3zhnE3Q8JT/g0rX2ufFkXNNx1TUj2JLLLzx3Zna6vyXMUwDZRNtiTiyTtBRi2yOmxmu6Y4pS/XSRht1DSV9KzQPEugkzJ9CISxdTYzysJVkSM5tePAvFxDAxCQdV0ANKd3RoPAhMkgKnXOfqf5oGKnu2R6gHqE3oJjJnUYx/84hE959O+kkqkw6OWMvtjWydibkJtdNeoyBxzZJv1ogEWc4em1iS58rCR6XtVt8hSlVixsinA2UIKZBXRrbdHoc9CPGKAfI/+8HjeJkb5nBHan3C6xpdO0CFnWntniMCgjiEOw+30pRC+5iuuKEuyaNbeaZgbShYEwoaDwL5RDeFpgoRfh2xbh4dXMbJbkhSQJSvThnnO6Q+zgtYVUFoTo75daMNAStRfntacj+m7yEQxsLl5EuX1d8FyaQZGDSMA977gY7zbu3Xv3ZkVpb1H+HZOBQSr+8A9ytqkClEHIKeVwth/AAfqqaKet5Q5aG+DT9Wq8y8erzKdcGkLWpiN0xsDKmqEQPLbKfNpjvG2NPr0E8m94QWxOAU5PQMUKbc1/QyJN0EExUnPAdkeVybi4tSoJ8DHkyPdzebYKoIhb0PgAMu8CNQsk9xMnRVtYxy8VVoqkKKNhGouP4TGZd5whj +Vtug9Fb UFv4KkaGvZXhARyrII7imC/oa+VfRSFCT+nGDnPzpSE213TOx5g5nGBr4ckNP1uJjcYVFAZUWsK3a38i6FLxCG9Eh92zRJML6/pB8XspK8aoW5IXKn3Wk0dQRHl2YiqEZixUMzINNJohPpYwGD3v3ePY3o4fm+ncl0uF7xhfW3/ji/GYVrCtxZiJAGUcCUOPtJd86HO1nqdJ/5yJvRiuHJ08gBeLnWSY15U76JnUCATvIhBJdY+E7PFOHbUyKy22To/pSVK1Z04sC4JTNsCrEAnUP/g== 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 Wed, Jan 08, 2025 at 01:34:24PM +0900, Akihiko Odaki wrote: > On 2025/01/08 1:18, Dave Martin wrote: > > On Tue, Jan 07, 2025 at 09:45:53PM +0900, Akihiko Odaki wrote: > > > Use note name macros to match with the userspace's expectation. > > > > Also (and more importantly) get rid of duplicated knowledge about the > > mapping of note types to note names, so that elf.h is the authoritative > > source of this information? > > > > > > > > Signed-off-by: Akihiko Odaki > > > Acked-by: Baoquan He > > > --- > > > fs/binfmt_elf.c | 21 ++++++++++----------- > > > fs/binfmt_elf_fdpic.c | 8 ++++---- > > > 2 files changed, 14 insertions(+), 15 deletions(-) > > > > > > diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c > > > index 106f0e8af177..5b4a92e5e508 100644 > > > --- a/fs/binfmt_elf.c > > > +++ b/fs/binfmt_elf.c > > > > [...] > > > > > @@ -1538,7 +1538,7 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm) > > > do > > > i += 2; > > > while (auxv[i - 2] != AT_NULL); > > > - fill_note(&auxv_note, "CORE", NT_AUXV, i * sizeof(elf_addr_t), auxv); > > > + fill_note(&auxv_note, NN_AUXV, NT_AUXV, i * sizeof(elf_addr_t), auxv); > > > thread_status_size += notesize(&auxv_note); > > > offset = sizeof(*elf); /* ELF header */ > > > > Looking at this code, it appears that the right name is explicitly > > taken from elf.h for a few specific notes, but for those that are > > specified by the arch code (e.g., in struct user_regset entries) the > > name is still guessed locally: > > > > static int fill_thread_core_info(...) { > > > > ... > > > > fill_note(&t->notes[note_iter], is_fpreg ? "CORE" : "LINUX", > > note_type, ret, data); > > > > > > It would be preferable to clean this up if we want elf.h to be the > > authoritative source for the names. > > If we want elf.h to be the authoritative source, yes, but I like the current > form as it ensures nobody adds a note with a name different from "LINUX" and > it is also simpler. There is a trade-off so I'd like to keep the current > form unless anyone has a strong preference for one option. > > Regards, > Akihiko Odaki I can see where you're coming from here. It would be nice to at least be able to check that elf.h is consistent with the behaviour here, but you're right -- there is a tradeoff. Maybe add a comment in elf.h at the end of the block of #defines saying that new Linux-specific entries should use the name "LINUX"? Either way, I don't think it's a huge deal. If people are happy with this code as-is, then I don't have an issue with it. I might follow up with a separate patch if this series is merged, and people can consider it on its own merits (or lack thereof). Cheers ---Dave