From patchwork Sat Jan 4 14:38:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13926268 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 3C4ABE77199 for ; Sat, 4 Jan 2025 14:38:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B37D56B008C; Sat, 4 Jan 2025 09:38:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AE86A6B0092; Sat, 4 Jan 2025 09:38:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9AFF66B0093; Sat, 4 Jan 2025 09:38:52 -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 7C9CA6B008C for ; Sat, 4 Jan 2025 09:38:52 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 03D21C0B14 for ; Sat, 4 Jan 2025 14:38:51 +0000 (UTC) X-FDA: 82970026104.11.D766C5B Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf16.hostedemail.com (Postfix) with ESMTP id 21095180009 for ; Sat, 4 Jan 2025 14:38:49 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=daynix-com.20230601.gappssmtp.com header.s=20230601 header.b="RjlViv/c"; spf=pass (imf16.hostedemail.com: domain of akihiko.odaki@daynix.com designates 209.85.214.169 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=1736001530; 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:in-reply-to:references:references:dkim-signature; bh=3DDRJB8oNZeq6N6MlMy+rUGIqaIntb5QA28c12Ptyck=; b=xwWkug5X7RwdOwSHntGf0PFMTJDtwtWVS8RXZGHYZ7Z/+I8zFE1lLTiaj64Z3eG2x3Z2Mu eVzyH11Kpo4pZvb3X7Kjt2HBjwg2WPH3Q2BYGLT34z13Mkv4WpoEmmXJCnv08bQiJLHIte AFEjiwmIn+tBLsDhYXXjcj384cubxPI= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=daynix-com.20230601.gappssmtp.com header.s=20230601 header.b="RjlViv/c"; spf=pass (imf16.hostedemail.com: domain of akihiko.odaki@daynix.com designates 209.85.214.169 as permitted sender) smtp.mailfrom=akihiko.odaki@daynix.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736001530; a=rsa-sha256; cv=none; b=4iiXItBn3ijGIJThMQ5VvQW+hNlbC3egiJ+MGEfvcXKmfujilOpc6AO49OWiwoxCxUckOC 2Z1CAMO+VUQTSIhRyx4jk6B4MZLeKTy9kwRgCsh/5NcBLZIaguoAUR+dLTZtOswr3JlBZM hyipOqg5CjGrVfdaIli2GdnuW6gt7sQ= Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2163bd70069so84583125ad.0 for ; Sat, 04 Jan 2025 06:38:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1736001529; x=1736606329; darn=kvack.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3DDRJB8oNZeq6N6MlMy+rUGIqaIntb5QA28c12Ptyck=; b=RjlViv/cVyUYTUDnUN17TYhevECGdZZddDugBOv0rg5kmrtfqWIxJ0+HeUxuTf1BPf v4SC81o+bTD/+6Ii03C6Y5hZhJCR9jNnk95pjX9FcFPW14CLutZQYzZz7nY2QoHvd4Au TpxKU0TNmLwrmUtrT/8/7cylXMc8KmuM1l9eJ+nKS+sJdBbSHY7EC0O9E4sK1XReHAxa DtSTRP3cTwZ4/u5rMOKScQBd0jWNx2RYCHr3Kt9UYJy2bZKuLxiwdD4YzH0KA6DJNW5d 6sEPdM6WCZmm/7pvxj5pDnr15nLd+s65q2EEWAGyWBoVNNso0RSCfMFqm8Us/Ox6Of0j BEKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736001529; x=1736606329; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3DDRJB8oNZeq6N6MlMy+rUGIqaIntb5QA28c12Ptyck=; b=B+uzEWoSefCh9Gs7fhPcC12dX0Bn++XIm51Fwo2HKzAnPJ4R1xaa2lqTw2rqj2W8dA ohV9mUOUWlx561qR1fUZrZY6L3clp01c/ztCmo/oQbgXtE0wMAh9HDUaAxFnGNj2MFs3 r6A+k3pT//kk7E3mvW/gIBHjJEUnnSkORimNQ9OzkYlpw7980AhFvU9QigyZP8LGA2S7 einJKNlyt+JIQn2squRw+42aDYmVpuAHfP+PTITLcxIhi/or3WIhTf2331C/lY5HZIOv h3nEQDD2IwcxrGJ+DWuAHpOCdZiBIo6PuDUGozHdPrVlzovPrC9206j8kpeNlM/5wARc b6Ng== X-Gm-Message-State: AOJu0YwDhSIKTJmBc3YUKEbdHYC5t0g3+X9i3NBFs8vrnmTF7s9wtccf e/iVJGKD5M5g2FgJR4k5F+0aJJgpewtH2rMQhHS6zb2aNJlb/msPOyvXCaXtwyM= X-Gm-Gg: ASbGncsove0K7j3dpwAN6JIkASX1/qGJp+t+m3SagcEwxZSNXZiSChZ00BODy2nUpxr yYdhjwA/Jwd2LgYHLNoR/xpEiXB0UDSrNIEn5HeSty22fxHgWz2/XGUzRbYRv43yvcYY/FBx2zn pedqYxQcg5mb46C1FQ3DwLz1VU66DBW8dLR3jYwcHxaeie+7tYwx7pvnApEgWMcQ2cBZ7GSz60O PfB6+MFHtSU+3iyl8yFz+NeRS7/YhHDCXtCn+u0aFVlofday1x4FE29sB/S/cE= X-Google-Smtp-Source: AGHT+IHXNTPwYGpyoF2oIO9YtYeoBNZ9bkHyASDQWStwZpuI0NOPrSg1SLgfLCaPbrvbr04vYZJzgg== X-Received: by 2002:a17:902:e5c7:b0:215:bf1b:a894 with SMTP id d9443c01a7336-219e6eb5bffmr760628135ad.24.1736001528912; Sat, 04 Jan 2025 06:38:48 -0800 (PST) Received: from localhost ([2400:4050:b783:b00:4952:3c52:120a:27e9]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-219dc962c5esm260927675ad.12.2025.01.04.06.38.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 04 Jan 2025 06:38:48 -0800 (PST) From: Akihiko Odaki Date: Sat, 04 Jan 2025 23:38:34 +0900 Subject: [PATCH v2 1/5] elf: Define note name macros MIME-Version: 1.0 Message-Id: <20250104-elf-v2-1-77dc2e06db4e@daynix.com> References: <20250104-elf-v2-0-77dc2e06db4e@daynix.com> In-Reply-To: <20250104-elf-v2-0-77dc2e06db4e@daynix.com> To: Eric Biederman , Kees Cook , Catalin Marinas , Mark Brown , Dave Martin , Baoquan He , Vivek Goyal , Dave Young Cc: 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, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 X-Rspamd-Queue-Id: 21095180009 X-Stat-Signature: iz86ipg5t7cur7qbahhic4c4k8dodmag X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736001529-707399 X-HE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5ZVbxyA5DhvejbDmdSDRIurvwfQN16RtKyqFAwTWRLwr6dOpuGZJLHhed1eJYxKG0QFeZTboAb3UzWN3HXiI09Hbr05h7x9SwkzJZGE4lvr8vY7uxVSl/VKLt0AKuznRZGJCNQRKCQlY6AUkbd5LmyaCvE/HKSU5oU9vrVp3HtZyVGH8oL4+hUQGVQLcsDrA4oP2rWm1P7UbHgQbTQtgJDdWOxWHMSOxGISebGFwZiDHHXuwu/WfvvONzuYlY2j6jC/ur3iCtKE/pHh48Aaz/pjcYCsXjN3EfuwjN9Slk9bZ3S+gh X-Bogosity: Ham, tests=bogofilter, spamicity=0.000278, 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. 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" +#define NN_PPC_VMX "LINUX" +#define NN_PPC_SPE "LINUX" +#define NN_PPC_VSX "LINUX" +#define NN_PPC_TAR "LINUX" +#define NN_PPC_PPR "LINUX" +#define NN_PPC_DSCR "LINUX" +#define NN_PPC_EBB "LINUX" +#define NN_PPC_PMU "LINUX" +#define NN_PPC_TM_CGPR "LINUX" +#define NN_PPC_TM_CFPR "LINUX" +#define NN_PPC_TM_CVMX "LINUX" +#define NN_PPC_TM_CVSX "LINUX" +#define NN_PPC_TM_SPR "LINUX" +#define NN_PPC_TM_CTAR "LINUX" +#define NN_PPC_TM_CPPR "LINUX" +#define NN_PPC_TM_CDSCR "LINUX" +#define NN_PPC_PKEY "LINUX" +#define NN_PPC_DEXCR "LINUX" +#define NN_PPC_HASHKEYR "LINUX" +#define NN_386_TLS "LINUX" +#define NN_386_IOPERM "LINUX" +#define NN_X86_XSTATE "LINUX" +#define NN_X86_SHSTK "LINUX" +#define NN_X86_XSAVE_LAYOUT "LINUX" +#define NN_S390_HIGH_GPRS "LINUX" +#define NN_S390_TIMER "LINUX" +#define NN_S390_TODCMP "LINUX" +#define NN_S390_TODPREG "LINUX" +#define NN_S390_CTRS "LINUX" +#define NN_S390_PREFIX "LINUX" +#define NN_S390_LAST_BREAK "LINUX" +#define NN_S390_SYSTEM_CALL "LINUX" +#define NN_S390_TDB "LINUX" +#define NN_S390_VXRS_LOW "LINUX" +#define NN_S390_VXRS_HIGH "LINUX" +#define NN_S390_GS_CB "LINUX" +#define NN_S390_GS_BC "LINUX" +#define NN_S390_RI_CB "LINUX" +#define NN_S390_PV_CPU_DATA "LINUX" +#define NN_ARM_VFP "LINUX" +#define NN_ARM_TLS "LINUX" +#define NN_ARM_HW_BREAK "LINUX" +#define NN_ARM_HW_WATCH "LINUX" +#define NN_ARM_SYSTEM_CALL "LINUX" +#define NN_ARM_SVE "LINUX" +#define NN_ARM_PAC_MASK "LINUX" +#define NN_ARM_PACA_KEYS "LINUX" +#define NN_ARM_PACG_KEYS "LINUX" +#define NN_ARM_TAGGED_ADDR_CTRL "LINUX" +#define NN_ARM_PAC_ENABLED_KEYS "LINUX" +#define NN_ARM_SSVE "LINUX" +#define NN_ARM_ZA "LINUX" +#define NN_ARM_ZT "LINUX" +#define NN_ARM_FPMR "LINUX" +#define NN_ARM_POE "LINUX" +#define NN_ARM_GCS "LINUX" +#define NN_ARC_V2 "LINUX" +#define NN_VMCOREDD "LINUX" +#define NN_MIPS_DSP "LINUX" +#define NN_MIPS_FP_MODE "LINUX" +#define NN_MIPS_MSA "LINUX" +#define NN_RISCV_CSR "LINUX" +#define NN_RISCV_VECTOR "LINUX" +#define NN_RISCV_TAGGED_ADDR_CTRL "LINUX" +#define NN_LOONGARCH_CPUCFG "LINUX" +#define NN_LOONGARCH_CSR "LINUX" +#define NN_LOONGARCH_LSX "LINUX" +#define NN_LOONGARCH_LASX "LINUX" +#define NN_LOONGARCH_LBT "LINUX" +#define NN_LOONGARCH_HW_BREAK "LINUX" +#define NN_LOONGARCH_HW_WATCH "LINUX" +#define NN_GNU_PROPERTY_TYPE_0 "GNU" + /* Note header in a PT_NOTE section */ typedef struct elf32_note { Elf32_Word n_namesz; /* Name size */