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 AA840E77188 for ; Mon, 6 Jan 2025 06:07:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E7A266B0082; Mon, 6 Jan 2025 01:07:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E2C386B0088; Mon, 6 Jan 2025 01:07:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF2976B0089; Mon, 6 Jan 2025 01:07:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id B01E56B0082 for ; Mon, 6 Jan 2025 01:07:01 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 470ED813B5 for ; Mon, 6 Jan 2025 06:07:01 +0000 (UTC) X-FDA: 82975993842.19.7F0D2D5 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf28.hostedemail.com (Postfix) with ESMTP id 589E1C0012 for ; Mon, 6 Jan 2025 06:06:59 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="iUNBYk/7"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf28.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736143619; a=rsa-sha256; cv=none; b=Ydy3+o7PGvTGA+VCsk7M6PsT/zb4J4W2okvixRd5vdBhZLtvyDsq1jXKPq6erCKq01P+0R qms3a31Epqagay29KFkEn/tnLwPcgjDJNeTAOuwiUweIy7GFhD/be6NChmQh5V9XLcw0us EN81hJFBjjMmf0GzPSvMMTO8xHvef6g= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="iUNBYk/7"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf28.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736143619; 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:dkim-signature; bh=rZEyOknT6FMXaCRBHIS8IeQzepG9pSVU98fwitc15cw=; b=XtmOC3eBSDnmywlbjKj3cRfgzTlq4LKpGoOgJrkWpJADSPCuxkrJQI4dSVzsqecFGkLPdm LMysEKCh6j2aoUDEcua5LEe1StE4/fDjHHKrb8HATma6u6KiEJnTqQyxyVh5Bes1UkhBoz vLLeyelRlGB1Ow+DR6dgRLNaX7Oo/Cw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736143618; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=rZEyOknT6FMXaCRBHIS8IeQzepG9pSVU98fwitc15cw=; b=iUNBYk/7/Gz6aOMIi4sbvkJNGhEnztF5Ojy0FHai93N5++JjS1ZjJ1sEp9nnBXa8rKnGZJ 7YhlY/O4zpr+bda7bjGYMNJ3naR49B2YvfygG3KvoO8uu7KvUuvMdgEp0CrXFKvbdIvEir imx+L+zMaOVZs2KOpsa6MHw4X+DmUY0= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-680-Ol1aODmFNWyCxf2Aofwj4g-1; Mon, 06 Jan 2025 01:06:55 -0500 X-MC-Unique: Ol1aODmFNWyCxf2Aofwj4g-1 X-Mimecast-MFC-AGG-ID: Ol1aODmFNWyCxf2Aofwj4g Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 301221956087; Mon, 6 Jan 2025 06:06:52 +0000 (UTC) Received: from localhost (unknown [10.72.112.99]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B5FC319560A2; Mon, 6 Jan 2025 06:06:49 +0000 (UTC) Date: Mon, 6 Jan 2025 14:06:45 +0800 From: Baoquan He To: Akihiko Odaki Cc: Eric Biederman , Kees Cook , Catalin Marinas , Mark Brown , Dave Martin , 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> <70daf544-f59f-404b-bec0-0d60e892a9e9@daynix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <70daf544-f59f-404b-bec0-0d60e892a9e9@daynix.com> X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Stat-Signature: i8ue66bxhxsehxu8b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A4SO7 BaAWaFqRJW+P8tPMuJMxDTTEat2QV36mG3So0rKRuv8D6t2pG5KBSlZDc2YowTxLhMlfFGvNp9/m9WdI020zhwJ3PEm8PuQsszS2ZTOFvBF6my6SbPRGFf2JewV/+gSjtno+MD6TN0zZoJyj/NCq8tw/l08VolkktWqcH70ySGtq5gGQsoaISxR045AgCFfqUmPA057qX96ylye698+RM9n9G+5GwwzUgCMRrcn+KjnAl2/nT1P/DlVtGHUmpIa5YIjajLXFdQjmDqenBYV9ueiLYzQjZNxBKBK1adZBtniX3VwG7YJku37QkVKUqcjZIkKDdMI2F0IB+yGe3rSP214T4aPtUXANhsIxZb5iIE2Vgegvq0xp30KVSV/mXAsWWmhGLKUZXOz4rA65SOfFrRwAqKHUffwix51Thv728zpdWUdDMEQBDmn8tGa2qe/GxCYtusat8L3AUgZWAqcdIPZBNLblr1mBPAP9NEAdEQmPmeng= 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 01/06/25 at 02:07pm, Akihiko Odaki wrote: > On 2025/01/06 11:21, Baoquan He wrote: > > On 01/04/25 at 11:38pm, 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". > > > */ > > > #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. */ > > > #define NT_GNU_PROPERTY_TYPE_0 5 > > > +/* Note names */ > > > +#define NN_PRSTATUS "CORE" > > > +#define NN_PRFPREG "CORE" > > > +#define NN_PRPSINFO "CORE" > > > +#define NN_TASKSTRUCT "CORE" > > > +#define NN_AUXV "CORE" > > > +#define NN_SIGINFO "CORE" > > > +#define NN_FILE "CORE" > > > +#define NN_PRXFPREG "LINUX" > > > > No objection to make them clearer. Thanks for the effort. > > > > Wondering where below arch specific macros are used. So you just > > added all NN_xxx for the corresponding NT_xxx? Not sure if this is > > needed if we don't use them at all in the current kernel. > > Indeed I just added all NN_xxx. The kernel won't use the macros that are > defined as "LINUX"; fs/binfmt_elf.c uses "LINUX" by default as the notes > named "CORE" or "GNU" are exceptional. > > Userspace applications may still be interested in these macros as > demonstrated in: > https://lore.kernel.org/r/Z3f7zJwu8bu8HYln@e133380.arm.com > > These macros also serve as documentation; correcting and clarifying the > documentation is the main purpose of this series. I see, thanks. Then the overall series looks good to me.